-
Notifications
You must be signed in to change notification settings - Fork 25
/
App.tsx
66 lines (62 loc) · 1.64 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {
Appbar,
DarkTheme,
DefaultTheme,
Provider,
Surface,
ThemeProvider,
} from 'react-native-paper';
import React, {useState} from 'react';
import {
Platform,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
} from 'react-native';
import AdvancedExample from './AdvancedExample';
//@ts-ignore
import KeyboardSpacer from 'react-native-keyboard-spacer';
function App() {
const [nightMode, setNightmode] = useState(false);
return (
<Provider theme={nightMode ? DarkTheme : DefaultTheme}>
<ThemeProvider theme={nightMode ? DarkTheme : DefaultTheme}>
<StatusBar
backgroundColor={
nightMode ? DarkTheme.colors.surface : DefaultTheme.colors.primary
}
barStyle={'light-content'}
/>
<Surface style={styles.container}>
<Appbar.Header>
<Appbar.Content title="React Native Paper Form Builder" />
<Appbar.Action
icon={nightMode ? 'brightness-7' : 'brightness-3'}
onPress={() => setNightmode(!nightMode)}
/>
</Appbar.Header>
<SafeAreaView style={styles.container}>
<ScrollView
showsVerticalScrollIndicator={false}
style={styles.scrollView}
keyboardShouldPersistTaps={'handled'}>
<AdvancedExample />
</ScrollView>
{Platform.OS === 'ios' && <KeyboardSpacer />}
</SafeAreaView>
</Surface>
</ThemeProvider>
</Provider>
);
}
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
},
scrollView: {
flexGrow: 1,
padding: 20,
},
});