Skip to content

Commit a91fa25

Browse files
Naturalclarvuletuanbtvuletuan
authored
chore: fix example (#317)
Co-authored-by: vuletuanbt <vuletuanbt@gmail.com> Co-authored-by: vuletuan <vult@zigexn.vn>
1 parent 26e767e commit a91fa25

File tree

1 file changed

+77
-60
lines changed

1 file changed

+77
-60
lines changed

example/App.js

Lines changed: 77 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
ScrollView,
1616
View,
1717
DeviceEventEmitter,
18+
SafeAreaView,
1819
} from 'react-native';
1920
import PushNotificationIOS from '../js';
2021

@@ -133,6 +134,9 @@ export const App = (): React.Node => {
133134
threadId: 'thread-id',
134135
fireDate: new Date(new Date().valueOf() + 2000),
135136
repeats: true,
137+
userInfo: {
138+
image: 'https://www.github.com/Naturalclar.png',
139+
},
136140
});
137141
};
138142

@@ -318,70 +322,83 @@ export const App = (): React.Node => {
318322
};
319323

320324
return (
321-
<ScrollView contentContainerStyle={styles.container}>
322-
<Button onPress={sendNotification} label="Send fake notification" />
323-
<Button
324-
onPress={sendLocalNotification}
325-
label="Send fake local notification"
326-
/>
327-
<Button
328-
onPress={sendLocalNotificationWithSound}
329-
label="Send fake local notification with custom sound"
330-
/>
331-
<Button
332-
onPress={scheduleLocalNotification}
333-
label="Schedule fake local notification"
334-
/>
335-
<Button
336-
onPress={addNotificationRequest}
337-
label="Add Notification Request"
338-
/>
339-
<Button
340-
onPress={addCriticalNotificationRequest}
341-
label="Add Critical Notification Request (only works with Critical Notification entitlement)"
342-
/>
343-
<Button
344-
onPress={addMultipleRequests}
345-
label="Add Multiple Notification Requests"
346-
/>
347-
<Button
348-
onPress={setNotificationCategories}
349-
label="Set notification categories"
350-
/>
351-
<Button
352-
onPress={removePendingNotificationRequests}
353-
label="Remove Partial Pending Notification Requests"
354-
/>
355-
<Button
356-
onPress={removeAllPendingNotificationRequests}
357-
label="Remove All Pending Notification Requests"
358-
/>
359-
<Button
360-
onPress={sendSilentNotification}
361-
label="Send fake silent notification"
362-
/>
363-
364-
<Button
365-
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(42)}
366-
label="Set app's icon badge to 42"
367-
/>
368-
<Button
369-
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(0)}
370-
label="Clear app's icon badge"
371-
/>
372-
<Button
373-
onPress={getPendingNotificationRequests}
374-
label="Get Pending Notification Requests"
375-
/>
376-
<View>
377-
<Button onPress={showPermissions} label="Show enabled permissions" />
378-
<Text>{JSON.stringify(permissions)}</Text>
379-
</View>
380-
</ScrollView>
325+
<View style={[styles.flex, styles.background]}>
326+
<SafeAreaView style={styles.flex}>
327+
<ScrollView contentContainerStyle={styles.container}>
328+
<Button onPress={sendNotification} label="Send fake notification" />
329+
<Button
330+
onPress={sendLocalNotification}
331+
label="Send fake local notification"
332+
/>
333+
<Button
334+
onPress={sendLocalNotificationWithSound}
335+
label="Send fake local notification with custom sound"
336+
/>
337+
<Button
338+
onPress={scheduleLocalNotification}
339+
label="Schedule fake local notification"
340+
/>
341+
<Button
342+
onPress={addNotificationRequest}
343+
label="Add Notification Request"
344+
/>
345+
<Button
346+
onPress={addCriticalNotificationRequest}
347+
label="Add Critical Notification Request (only works with Critical Notification entitlement)"
348+
/>
349+
<Button
350+
onPress={addMultipleRequests}
351+
label="Add Multiple Notification Requests"
352+
/>
353+
<Button
354+
onPress={setNotificationCategories}
355+
label="Set notification categories"
356+
/>
357+
<Button
358+
onPress={removePendingNotificationRequests}
359+
label="Remove Partial Pending Notification Requests"
360+
/>
361+
<Button
362+
onPress={removeAllPendingNotificationRequests}
363+
label="Remove All Pending Notification Requests"
364+
/>
365+
<Button
366+
onPress={sendSilentNotification}
367+
label="Send fake silent notification"
368+
/>
369+
370+
<Button
371+
onPress={() =>
372+
PushNotificationIOS.setApplicationIconBadgeNumber(42)
373+
}
374+
label="Set app's icon badge to 42"
375+
/>
376+
<Button
377+
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(0)}
378+
label="Clear app's icon badge"
379+
/>
380+
<Button
381+
onPress={getPendingNotificationRequests}
382+
label="Get Pending Notification Requests"
383+
/>
384+
<View>
385+
<Button
386+
onPress={showPermissions}
387+
label="Show enabled permissions"
388+
/>
389+
<Text>{JSON.stringify(permissions)}</Text>
390+
</View>
391+
</ScrollView>
392+
</SafeAreaView>
393+
</View>
381394
);
382395
};
383396

384397
const styles = StyleSheet.create({
398+
background: {
399+
backgroundColor: '#F5FCFF',
400+
},
401+
flex: {flex: 1},
385402
container: {
386403
flexGrow: 1,
387404
backgroundColor: '#F5FCFF',

0 commit comments

Comments
 (0)