Fix background in web scroll elements and update settings screen for web
parent
f7e3b1451e
commit
9659625e8e
|
@ -22,7 +22,9 @@ import {
|
||||||
View,
|
View,
|
||||||
ViewProps,
|
ViewProps,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
import {useTheme} from '../../lib/ThemeContext'
|
||||||
import {addStyle} from '../../lib/addStyle'
|
import {addStyle} from '../../lib/addStyle'
|
||||||
|
import {colors} from '../../lib/styles'
|
||||||
|
|
||||||
export function CenteredView({
|
export function CenteredView({
|
||||||
style,
|
style,
|
||||||
|
@ -36,7 +38,15 @@ export function FlatList<ItemT>({
|
||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
...props
|
...props
|
||||||
}: React.PropsWithChildren<FlatListProps<ItemT>>) {
|
}: 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} />
|
return <RNFlatList contentContainerStyle={contentContainerStyle} {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +54,15 @@ export function ScrollView({
|
||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
...props
|
...props
|
||||||
}: React.PropsWithChildren<ScrollViewProps>) {
|
}: 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 (
|
return (
|
||||||
<RNScrollView contentContainerStyle={contentContainerStyle} {...props} />
|
<RNScrollView contentContainerStyle={contentContainerStyle} {...props} />
|
||||||
)
|
)
|
||||||
|
@ -57,4 +75,17 @@ const styles = StyleSheet.create({
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
},
|
},
|
||||||
|
containerScroll: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
maxWidth: 600,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
containerLight: {
|
||||||
|
backgroundColor: colors.gray1,
|
||||||
|
},
|
||||||
|
containerDark: {
|
||||||
|
backgroundColor: colors.gray7,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React, {useEffect} from 'react'
|
import React, {useEffect} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
ScrollView,
|
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
|
@ -11,6 +10,7 @@ import {observer} from 'mobx-react-lite'
|
||||||
import {useStores} from '../../state'
|
import {useStores} from '../../state'
|
||||||
import {ScreenParams} from '../routes'
|
import {ScreenParams} from '../routes'
|
||||||
import {s} from '../lib/styles'
|
import {s} from '../lib/styles'
|
||||||
|
import {ScrollView} from '../com/util/Views'
|
||||||
import {ViewHeader} from '../com/util/ViewHeader'
|
import {ViewHeader} from '../com/util/ViewHeader'
|
||||||
import {Link} from '../com/util/Link'
|
import {Link} from '../com/util/Link'
|
||||||
import {Text} from '../com/util/text/Text'
|
import {Text} from '../com/util/text/Text'
|
||||||
|
@ -56,7 +56,8 @@ export const Settings = observer(function Settings({
|
||||||
return (
|
return (
|
||||||
<View style={[s.h100pct]} testID="settingsScreen">
|
<View style={[s.h100pct]} testID="settingsScreen">
|
||||||
<ViewHeader title="Settings" />
|
<ViewHeader title="Settings" />
|
||||||
<ScrollView style={[s.mt10, s.pl10, s.pr10, s.h100pct]}>
|
<ScrollView style={s.h100pct}>
|
||||||
|
<View style={[s.mt10, s.pl10, s.pr10]}>
|
||||||
<View style={[s.flexRow]}>
|
<View style={[s.flexRow]}>
|
||||||
<Text type="xl-bold" style={pal.text}>
|
<Text type="xl-bold" style={pal.text}>
|
||||||
Signed in as
|
Signed in as
|
||||||
|
@ -159,6 +160,7 @@ export const Settings = observer(function Settings({
|
||||||
<Text style={pal.link}>Storybook</Text>
|
<Text style={pal.link}>Storybook</Text>
|
||||||
</Link>
|
</Link>
|
||||||
<View style={s.footerSpacer} />
|
<View style={s.footerSpacer} />
|
||||||
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue