Fix background in web scroll elements and update settings screen for web

This commit is contained in:
Paul Frazee 2023-01-26 20:16:37 -06:00
parent f7e3b1451e
commit 9659625e8e
2 changed files with 119 additions and 86 deletions

View file

@ -22,7 +22,9 @@ import {
View,
ViewProps,
} from 'react-native'
import {useTheme} from '../../lib/ThemeContext'
import {addStyle} from '../../lib/addStyle'
import {colors} from '../../lib/styles'
export function CenteredView({
style,
@ -36,7 +38,15 @@ export function FlatList<ItemT>({
contentContainerStyle,
...props
}: React.PropsWithChildren<FlatListProps<ItemT>>) {
contentContainerStyle = addStyle(contentContainerStyle, styles.container)
const theme = useTheme()
contentContainerStyle = addStyle(
contentContainerStyle,
styles.containerScroll,
)
contentContainerStyle = addStyle(
contentContainerStyle,
theme.colorScheme === 'dark' ? styles.containerDark : styles.containerLight,
)
return <RNFlatList contentContainerStyle={contentContainerStyle} {...props} />
}
@ -44,7 +54,15 @@ export function ScrollView({
contentContainerStyle,
...props
}: React.PropsWithChildren<ScrollViewProps>) {
contentContainerStyle = addStyle(contentContainerStyle, styles.container)
const theme = useTheme()
contentContainerStyle = addStyle(
contentContainerStyle,
styles.containerScroll,
)
contentContainerStyle = addStyle(
contentContainerStyle,
theme.colorScheme === 'dark' ? styles.containerDark : styles.containerLight,
)
return (
<RNScrollView contentContainerStyle={contentContainerStyle} {...props} />
)
@ -57,4 +75,17 @@ const styles = StyleSheet.create({
marginLeft: 'auto',
marginRight: 'auto',
},
containerScroll: {
width: '100%',
height: '100%',
maxWidth: 600,
marginLeft: 'auto',
marginRight: 'auto',
},
containerLight: {
backgroundColor: colors.gray1,
},
containerDark: {
backgroundColor: colors.gray7,
},
})