Move border positioning to FlatList and ScrollView (#509)

* Move border positioning to FlatList and ScrollView

* Fix mobile web tab bar border
zio/stable
Ollie Hsieh 2023-04-21 14:40:41 -07:00 committed by GitHub
parent f0706dbe9f
commit aa56f4a5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 34 deletions

View File

@ -63,11 +63,10 @@ const styles = StyleSheet.create({
position: 'absolute', position: 'absolute',
zIndex: 1, zIndex: 1,
left: '50%', left: '50%',
width: 640, width: 598,
top: 0, top: 0,
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: 18,
}, },
tabBarAvi: { tabBarAvi: {
marginTop: 1, marginTop: 1,

View File

@ -33,7 +33,7 @@ export const FeedsTabBar = observer(
}, [store]) }, [store])
return ( return (
<Animated.View style={[pal.view, styles.tabBar, transform]}> <Animated.View style={[pal.view, pal.border, styles.tabBar, transform]}>
<TouchableOpacity <TouchableOpacity
testID="viewHeaderDrawerBtn" testID="viewHeaderDrawerBtn"
style={styles.tabBarAvi} style={styles.tabBarAvi}
@ -61,6 +61,7 @@ const styles = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: 18, paddingHorizontal: 18,
borderBottomWidth: 1,
}, },
tabBarAvi: { tabBarAvi: {
marginTop: 1, marginTop: 1,

View File

@ -23,6 +23,7 @@ import {
ViewProps, ViewProps,
} from 'react-native' } from 'react-native'
import {addStyle, colors} from 'lib/styles' import {addStyle, colors} from 'lib/styles'
import {usePalette} from 'lib/hooks/usePalette'
export function CenteredView({ export function CenteredView({
style, style,
@ -41,6 +42,7 @@ export const FlatList = React.forwardRef(function <ItemT>(
}: React.PropsWithChildren<FlatListProps<ItemT>>, }: React.PropsWithChildren<FlatListProps<ItemT>>,
ref: React.Ref<RNFlatList>, ref: React.Ref<RNFlatList>,
) { ) {
const pal = usePalette('default')
contentContainerStyle = addStyle( contentContainerStyle = addStyle(
contentContainerStyle, contentContainerStyle,
styles.containerScroll, styles.containerScroll,
@ -61,7 +63,11 @@ export const FlatList = React.forwardRef(function <ItemT>(
return ( return (
<RNFlatList <RNFlatList
ref={ref} ref={ref}
contentContainerStyle={contentContainerStyle} contentContainerStyle={[
contentContainerStyle,
pal.border,
styles.contentContainer,
]}
style={style} style={style}
contentOffset={contentOffset} contentOffset={contentOffset}
{...props} {...props}
@ -73,13 +79,19 @@ export const ScrollView = React.forwardRef(function (
{contentContainerStyle, ...props}: React.PropsWithChildren<ScrollViewProps>, {contentContainerStyle, ...props}: React.PropsWithChildren<ScrollViewProps>,
ref: React.Ref<RNScrollView>, ref: React.Ref<RNScrollView>,
) { ) {
const pal = usePalette('default')
contentContainerStyle = addStyle( contentContainerStyle = addStyle(
contentContainerStyle, contentContainerStyle,
styles.containerScroll, styles.containerScroll,
) )
return ( return (
<RNScrollView <RNScrollView
contentContainerStyle={contentContainerStyle} contentContainerStyle={[
contentContainerStyle,
pal.border,
styles.contentContainer,
]}
ref={ref} ref={ref}
{...props} {...props}
/> />
@ -87,6 +99,11 @@ export const ScrollView = React.forwardRef(function (
}) })
const styles = StyleSheet.create({ const styles = StyleSheet.create({
contentContainer: {
borderLeftWidth: 1,
borderRightWidth: 1,
minHeight: '100vh',
},
container: { container: {
width: '100%', width: '100%',
maxWidth: 600, maxWidth: 600,
@ -95,7 +112,6 @@ const styles = StyleSheet.create({
}, },
containerScroll: { containerScroll: {
width: '100%', width: '100%',
maxHeight: '100vh',
maxWidth: 600, maxWidth: 600,
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',

View File

@ -14,11 +14,9 @@ import {RoutesContainer, FlatNavigator} from '../../Navigation'
import {DrawerContent} from './Drawer' import {DrawerContent} from './Drawer'
import {useWebMediaQueries} from '../../lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from '../../lib/hooks/useWebMediaQueries'
import {BottomBarWeb} from './bottom-bar/BottomBarWeb' import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
import {usePalette} from 'lib/hooks/usePalette'
const ShellInner = observer(() => { const ShellInner = observer(() => {
const store = useStores() const store = useStores()
const pal = usePalette('default')
const {isDesktop} = useWebMediaQueries() const {isDesktop} = useWebMediaQueries()
return ( return (
@ -32,20 +30,6 @@ const ShellInner = observer(() => {
<> <>
<DesktopLeftNav /> <DesktopLeftNav />
<DesktopRightNav /> <DesktopRightNav />
<View
style={[
styles.viewBorder,
{borderLeftColor: pal.colors.border},
styles.viewBorderLeft,
]}
/>
<View
style={[
styles.viewBorder,
{borderLeftColor: pal.colors.border},
styles.viewBorderRight,
]}
/>
</> </>
)} )}
<Composer <Composer
@ -90,18 +74,6 @@ const styles = StyleSheet.create({
bgDark: { bgDark: {
backgroundColor: colors.black, // TODO backgroundColor: colors.black, // TODO
}, },
viewBorder: {
position: 'absolute',
width: 1,
height: '100%',
borderLeftWidth: 1,
},
viewBorderLeft: {
left: 'calc(50vw - 300px)',
},
viewBorderRight: {
left: 'calc(50vw + 300px)',
},
drawerMask: { drawerMask: {
position: 'absolute', position: 'absolute',
width: '100%', width: '100%',