-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle theme change based on device preferences (#2016)
- Loading branch information
Showing
28 changed files
with
2,053 additions
and
5,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.