11import * as React from 'react' ;
22import { View , Platform , StyleSheet } from 'react-native' ;
33import type { StackNavigationProp } from '@react-navigation/stack' ;
4- import {
5- Colors ,
6- Appbar ,
7- FAB ,
8- Switch ,
9- Paragraph ,
10- useTheme ,
11- } from 'react-native-paper' ;
4+ import { Appbar , FAB , Switch , Paragraph } from 'react-native-paper' ;
5+ import ScreenWrapper from '../ScreenWrapper' ;
126
137type Props = {
148 navigation : StackNavigationProp < { } > ;
@@ -17,8 +11,6 @@ type Props = {
1711const MORE_ICON = Platform . OS === 'ios' ? 'dots-horizontal' : 'dots-vertical' ;
1812
1913const AppbarExample = ( { navigation } : Props ) => {
20- const { colors } = useTheme ( ) ;
21-
2214 const [ showLeftIcon , setShowLeftIcon ] = React . useState ( true ) ;
2315 const [ showSubtitle , setShowSubtitle ] = React . useState ( true ) ;
2416 const [ showSearchIcon , setShowSearchIcon ] = React . useState ( true ) ;
@@ -62,33 +54,38 @@ const AppbarExample = ({ navigation }: Props) => {
6254 ] ) ;
6355
6456 return (
65- < View style = { [ styles . container , { backgroundColor : colors . background } ] } >
66- < View style = { styles . row } >
67- < Paragraph > Left icon</ Paragraph >
68- < Switch value = { showLeftIcon } onValueChange = { setShowLeftIcon } />
69- </ View >
70- < View style = { styles . row } >
71- < Paragraph > Subtitle</ Paragraph >
72- < Switch value = { showSubtitle } onValueChange = { setShowSubtitle } />
73- </ View >
74- < View style = { styles . row } >
75- < Paragraph > Search icon</ Paragraph >
76- < Switch value = { showSearchIcon } onValueChange = { setShowSearchIcon } />
77- </ View >
78- < View style = { styles . row } >
79- < Paragraph > More icon</ Paragraph >
80- < Switch value = { showMoreIcon } onValueChange = { setShowMoreIcon } />
81- </ View >
82- < View style = { styles . row } >
83- < Paragraph > Custom Color</ Paragraph >
84- < Switch value = { showCustomColor } onValueChange = { setShowCustomColor } />
85- </ View >
86- < View style = { styles . row } >
87- < Paragraph > Exact Dark Theme</ Paragraph >
88- < Switch value = { showExactTheme } onValueChange = { setShowExactTheme } />
89- </ View >
57+ < >
58+ < ScreenWrapper
59+ style = { styles . container }
60+ contentContainerStyle = { styles . contentContainer }
61+ >
62+ < View style = { styles . row } >
63+ < Paragraph > Left icon</ Paragraph >
64+ < Switch value = { showLeftIcon } onValueChange = { setShowLeftIcon } />
65+ </ View >
66+ < View style = { styles . row } >
67+ < Paragraph > Subtitle</ Paragraph >
68+ < Switch value = { showSubtitle } onValueChange = { setShowSubtitle } />
69+ </ View >
70+ < View style = { styles . row } >
71+ < Paragraph > Search icon</ Paragraph >
72+ < Switch value = { showSearchIcon } onValueChange = { setShowSearchIcon } />
73+ </ View >
74+ < View style = { styles . row } >
75+ < Paragraph > More icon</ Paragraph >
76+ < Switch value = { showMoreIcon } onValueChange = { setShowMoreIcon } />
77+ </ View >
78+ < View style = { styles . row } >
79+ < Paragraph > Custom Color</ Paragraph >
80+ < Switch value = { showCustomColor } onValueChange = { setShowCustomColor } />
81+ </ View >
82+ < View style = { styles . row } >
83+ < Paragraph > Exact Dark Theme</ Paragraph >
84+ < Switch value = { showExactTheme } onValueChange = { setShowExactTheme } />
85+ </ View >
86+ </ ScreenWrapper >
9087 < Appbar
91- style = { [ styles . bottom ] }
88+ style = { styles . bottom }
9289 theme = { { mode : showExactTheme ? 'exact' : 'adaptive' } }
9390 >
9491 < Appbar . Action icon = "archive" onPress = { ( ) => { } } />
@@ -97,7 +94,7 @@ const AppbarExample = ({ navigation }: Props) => {
9794 < Appbar . Action icon = "delete" onPress = { ( ) => { } } />
9895 </ Appbar >
9996 < FAB icon = "reply" onPress = { ( ) => { } } style = { styles . fab } />
100- </ View >
97+ </ >
10198 ) ;
10299} ;
103100
@@ -107,8 +104,9 @@ export default AppbarExample;
107104
108105const styles = StyleSheet . create ( {
109106 container : {
110- flex : 1 ,
111- backgroundColor : Colors . white ,
107+ marginBottom : 56 ,
108+ } ,
109+ contentContainer : {
112110 paddingVertical : 8 ,
113111 } ,
114112 row : {
0 commit comments