forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThemeExample.tsx
43 lines (40 loc) · 1 KB
/
ThemeExample.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
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { useTheme, Paragraph } from 'react-native-paper';
import { Provider as PaperProvider } from 'react-native-paper';
const Content = () => {
const theme = useTheme();
return (
<View
style={[styles.container, { backgroundColor: theme.colors.background }]}
>
<Paragraph style={styles.paragraph}>
React Native Paper automatically adapts theme based on system
preferences
</Paragraph>
<Paragraph style={styles.paragraph}>
Please change system theme to dark/light to see the effect
</Paragraph>
</View>
);
};
const ThemeExample = () => {
return (
<PaperProvider>
<Content />
</PaperProvider>
);
};
ThemeExample.title = 'Theme';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
paragraph: {
textAlign: 'center',
marginHorizontal: 16,
marginVertical: 16,
},
});
export default ThemeExample;