-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2df4f9d
commit b9edc2b
Showing
9 changed files
with
92 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/wallet-mobile/src/features/Notifications/useCases/NotificationsDevScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {Text, View} from 'react-native' | ||
import * as React from 'react' | ||
import {SafeAreaView} from 'react-native-safe-area-context' | ||
import {Button} from '../../../components' | ||
import {useEffect} from 'react' | ||
import {Notifications, Notification} from 'react-native-notifications' | ||
|
||
export const NotificationsDevScreen = () => { | ||
useEffect(() => { | ||
Notifications.registerRemoteNotifications() | ||
|
||
const s = Notifications.events().registerNotificationReceivedForeground( | ||
(notification: Notification, completion) => { | ||
console.log(`Notification received in foreground: ${notification.title} : ${notification.body}`) | ||
completion({alert: true, sound: false, badge: false}) | ||
}, | ||
) | ||
|
||
return () => { | ||
s.remove() | ||
} | ||
}, []) | ||
|
||
const handleOnPress = () => { | ||
const notification = new Notification({ | ||
title: 'Test', | ||
body: 'Test', | ||
sound: 'default', | ||
}) | ||
Notifications.postLocalNotification(notification.payload) | ||
} | ||
|
||
return ( | ||
<SafeAreaView edges={['bottom', 'top', 'left', 'right']}> | ||
<View style={{padding: 16}}> | ||
<Text style={{fontSize: 24}}>Notifications Playground</Text> | ||
<Button title="Show random notification" shelleyTheme onPress={handleOnPress} /> | ||
</View> | ||
</SafeAreaView> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters