Avoid overlap against phone header when tabs selector is open

zio/stable
Paul Frazee 2022-11-17 10:24:40 -06:00
parent a0afb8386b
commit 58d5cb47b7
1 changed files with 22 additions and 8 deletions

View File

@ -8,12 +8,14 @@ import {
StyleSheet, StyleSheet,
Text, Text,
TouchableOpacity, TouchableOpacity,
useColorScheme,
View, View,
ViewStyle, ViewStyle,
} from 'react-native' } from 'react-native'
import {ScreenContainer, Screen} from 'react-native-screens' import {ScreenContainer, Screen} from 'react-native-screens'
import LinearGradient from 'react-native-linear-gradient' import LinearGradient from 'react-native-linear-gradient'
import {GestureDetector, Gesture} from 'react-native-gesture-handler' import {GestureDetector, Gesture} from 'react-native-gesture-handler'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import Animated, { import Animated, {
useSharedValue, useSharedValue,
useAnimatedStyle, useAnimatedStyle,
@ -142,6 +144,8 @@ export const MobileShell: React.FC = observer(() => {
const winDim = useWindowDimensions() const winDim = useWindowDimensions()
const swipeGestureInterp = useSharedValue<number>(0) const swipeGestureInterp = useSharedValue<number>(0)
const tabMenuInterp = useSharedValue<number>(0) const tabMenuInterp = useSharedValue<number>(0)
const colorScheme = useColorScheme()
const safeAreaInsets = useSafeAreaInsets()
const screenRenderDesc = constructScreenRenderDesc(store.nav) const screenRenderDesc = constructScreenRenderDesc(store.nav)
const onPressHome = () => { const onPressHome = () => {
@ -274,6 +278,15 @@ export const MobileShell: React.FC = observer(() => {
</ScreenContainer> </ScreenContainer>
</GestureDetector> </GestureDetector>
</SafeAreaView> </SafeAreaView>
{isTabsSelectorActive ? (
<View
style={[
styles.topBarProtector,
colorScheme === 'dark' ? styles.topBarProtectorDark : undefined,
{height: safeAreaInsets.top},
]}
/>
) : undefined}
<TabsSelector <TabsSelector
active={isTabsSelectorActive} active={isTabsSelectorActive}
tabMenuInterp={tabMenuInterp} tabMenuInterp={tabMenuInterp}
@ -379,15 +392,16 @@ const styles = StyleSheet.create({
backgroundColor: '#000', backgroundColor: '#000',
opacity: 0.5, opacity: 0.5,
}, },
topBar: { topBarProtector: {
flexDirection: 'row', position: 'absolute',
top: 0,
left: 0,
right: 0,
height: 50, // will be overwritten by insets
backgroundColor: colors.white, backgroundColor: colors.white,
borderBottomWidth: 1, },
borderBottomColor: colors.gray2, topBarProtectorDark: {
paddingLeft: 10, backgroundColor: colors.black,
paddingRight: 10,
paddingTop: 40,
paddingBottom: 5,
}, },
avi: { avi: {
width: 34, width: 34,