Front: Wrap App w/ React Native Paper's Provider

This commit is contained in:
Arthi-chaud
2022-07-11 10:51:01 +02:00
parent b2d409eb56
commit 2308ac47f6
+4 -1
View File
@@ -1,6 +1,7 @@
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View, ColorValue } from 'react-native'; import { StyleSheet, Text, View, ColorValue } from 'react-native';
import ColorTheme from './Theme'; import ColorTheme from './Theme';
import { Provider as PaperProvider } from 'react-native-paper';
const ExampleBox = (props: { textColor: ColorValue, backgroundColor: ColorValue }) => ( const ExampleBox = (props: { textColor: ColorValue, backgroundColor: ColorValue }) => (
<View style={{ backgroundColor: props.backgroundColor }}> <View style={{ backgroundColor: props.backgroundColor }}>
@@ -10,6 +11,7 @@ const ExampleBox = (props: { textColor: ColorValue, backgroundColor: ColorValue
export default function App() { export default function App() {
return ( return (
<PaperProvider>
<View style={styles.container}> <View style={styles.container}>
<ExampleBox backgroundColor={ColorTheme.primary} textColor={ColorTheme.onPrimary}/> <ExampleBox backgroundColor={ColorTheme.primary} textColor={ColorTheme.onPrimary}/>
<ExampleBox backgroundColor={ColorTheme.primaryVariant} textColor={ColorTheme.onPrimary}/> <ExampleBox backgroundColor={ColorTheme.primaryVariant} textColor={ColorTheme.onPrimary}/>
@@ -29,13 +31,14 @@ export default function App() {
/> />
<StatusBar style="auto" /> <StatusBar style="auto" />
</View> </View>
</PaperProvider>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: ColorTheme.backgroundDark, backgroundColor: ColorTheme.backgroundLight,
justifyContent: 'center', justifyContent: 'center',
}, },
}); });