|
@@ -1,12 +1,13 @@
|
1
|
1
|
import 'react-native-gesture-handler';
|
2
|
2
|
import * as React from 'react';
|
3
|
|
-import { DevSettings } from 'react-native';
|
|
3
|
+import { DevSettings, View, Text } from 'react-native';
|
4
|
4
|
import { enableScreens } from 'react-native-screens';
|
5
|
5
|
import AsyncStorage from '@react-native-community/async-storage';
|
6
|
6
|
import ReactNavigation4Example from './ReactNavigation4Example';
|
7
|
7
|
import ReactNavigation5Example from './ReactNavigation5Example';
|
8
|
8
|
import SimpleExample from './SimpleExample';
|
9
|
9
|
import NativeStackExample from './NativeStackExample';
|
|
10
|
+import ReactNativeSafeAreaView from './ReactNativeSafeAreaView';
|
10
|
11
|
|
11
|
12
|
enableScreens();
|
12
|
13
|
|
|
@@ -20,7 +21,7 @@ export default function App() {
|
20
|
21
|
React.useEffect(() => {
|
21
|
22
|
async function loadCurrentExample() {
|
22
|
23
|
const example = await AsyncStorage.getItem(STORAGE_KEY);
|
23
|
|
- setCurrentExample(example ?? 'simple');
|
|
24
|
+ setCurrentExample(example ?? null);
|
24
|
25
|
}
|
25
|
26
|
loadCurrentExample();
|
26
|
27
|
}, []);
|
|
@@ -47,6 +48,9 @@ export default function App() {
|
47
|
48
|
DevSettings.addMenuItem('Show Native Stack Example', () => {
|
48
|
49
|
setCurrentExample('native-stack');
|
49
|
50
|
});
|
|
51
|
+ DevSettings.addMenuItem('Show React Native Safe Area View Example', () => {
|
|
52
|
+ setCurrentExample('react-native-safe-area-view');
|
|
53
|
+ });
|
50
|
54
|
}, []);
|
51
|
55
|
|
52
|
56
|
switch (currentExample) {
|
|
@@ -58,7 +62,22 @@ export default function App() {
|
58
|
62
|
return <ReactNavigation5Example />;
|
59
|
63
|
case 'native-stack':
|
60
|
64
|
return <NativeStackExample />;
|
|
65
|
+ case 'react-native-safe-area-view':
|
|
66
|
+ return <ReactNativeSafeAreaView />;
|
61
|
67
|
default:
|
62
|
|
- return null;
|
|
68
|
+ return (
|
|
69
|
+ <View
|
|
70
|
+ style={{
|
|
71
|
+ flex: 1,
|
|
72
|
+ alignItems: 'center',
|
|
73
|
+ justifyContent: 'center',
|
|
74
|
+ padding: 24,
|
|
75
|
+ }}
|
|
76
|
+ >
|
|
77
|
+ <Text style={{ textAlign: 'center', fontSize: 14 }}>
|
|
78
|
+ Open the dev menu to choose an example
|
|
79
|
+ </Text>
|
|
80
|
+ </View>
|
|
81
|
+ );
|
63
|
82
|
}
|
64
|
83
|
}
|