React native in app notification

yarn add react-native-internal-notification
import { NotificationProvider } from 'react-native-internal-notification';
import App from './App';

const Application = function () {
return (
<NotificationProvider>
<App />
</NotificationProvider>
);
};
import React, { useCallback } from 'react';
import { TouchableOpacity, Text } from 'react-native';
import { FontAwesome } from '@expo/vector-icons';

import { useNotification } from 'react-native-internal-notification';

export default function DevScreen() {
const notification = useNotification();

const handleNotificationTestClick = useCallback(() => {
notification.showNotification({
title: 'My first notification',
message: 'Hello from my first message',
icon: <FontAwesome name="check-circle" size={45} />,
onPress: () => {
alert('Pressed');
},
});
}, [notification]);

return (
<>
<TouchableOpacity onPress={handleNotificationTestClick}>
<Text>Show notification</Text>
</TouchableOpacity>
</>
);
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Viacheslav Volkov

Viacheslav Volkov

1 Follower

JS Developer from London, UK. Working with React, React Native and Typescript. My russian blog https://vexell.ru