Fixes to drawer and bottombar
This commit is contained in:
@@ -69,7 +69,7 @@ export const BottomBar = observer(({navigation}: BottomTabBarProps) => {
|
||||
track(`MobileShell:${tab}ButtonPressed`)
|
||||
const state = navigation.getState()
|
||||
const curr = currentRoute(state).name
|
||||
if (curr === tab || curr === `${tab}Stack`) {
|
||||
if (curr === tab || curr === `${tab}Stack` || curr === `${tab}Inner`) {
|
||||
store.emitScreenSoftReset()
|
||||
} else if (state.routes[state.index].name === `${tab}Stack`) {
|
||||
navigation.dispatch(StackActions.popToTop())
|
||||
@@ -94,10 +94,14 @@ export const BottomBar = observer(({navigation}: BottomTabBarProps) => {
|
||||
}, [navigation, track, store.me.handle])
|
||||
|
||||
const curr = currentRoute(navigation.getState()).name
|
||||
const isAtHome = curr === 'HomeStack' || curr === 'Home'
|
||||
const isAtSearch = curr === 'SearchStack' || curr === 'Search'
|
||||
const isAtHome =
|
||||
curr === 'HomeStack' || curr === 'Home' || curr === 'HomeInner'
|
||||
const isAtSearch =
|
||||
curr === 'SearchStack' || curr === 'Search' || curr === 'SearchInner'
|
||||
const isAtNotifications =
|
||||
curr === 'NotificationsStack' || curr === 'Notifications'
|
||||
curr === 'NotificationsStack' ||
|
||||
curr === 'Notifications' ||
|
||||
curr === 'NotificationsInner'
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
|
||||
+19
-22
@@ -48,8 +48,7 @@ function currentRoute(state) {
|
||||
return node
|
||||
}
|
||||
|
||||
export const Drawer = observer(
|
||||
({state, navigation}: DrawerContentComponentProps) => {
|
||||
export const Drawer = observer(({navigation}: DrawerContentComponentProps) => {
|
||||
const theme = useTheme()
|
||||
const pal = usePalette('default')
|
||||
const store = useStores()
|
||||
@@ -60,11 +59,7 @@ export const Drawer = observer(
|
||||
// =
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log(
|
||||
'Drawer',
|
||||
isDrawerOpen ? 'minimizing' : 'unminimizing',
|
||||
'shell',
|
||||
)
|
||||
console.log('Drawer', isDrawerOpen ? 'minimizing' : 'unminimizing', 'shell')
|
||||
store.shell.setMinimalShellMode(isDrawerOpen)
|
||||
}, [isDrawerOpen, store])
|
||||
|
||||
@@ -72,22 +67,23 @@ export const Drawer = observer(
|
||||
(tab: string) => {
|
||||
track('Menu:ItemClicked', {url: tab})
|
||||
const state = navigation.getState()
|
||||
navigation.closeDrawer()
|
||||
const curr = currentRoute(state).name
|
||||
if (curr === tab || curr === `${tab}Stack`) {
|
||||
store.emitScreenSoftReset()
|
||||
} else if (state.routes[state.index].name === `${tab}Stack`) {
|
||||
navigation.dispatch(StackActions.popToTop())
|
||||
} else {
|
||||
// wait for drawer anim to finish
|
||||
setTimeout(() => {
|
||||
navigation.navigate(`${tab}Stack`)
|
||||
}, 250)
|
||||
}
|
||||
},
|
||||
[store, track, navigation],
|
||||
)
|
||||
|
||||
const onPressHome = React.useCallback(
|
||||
() => onPressTab('Home'),
|
||||
[onPressTab],
|
||||
)
|
||||
const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab])
|
||||
|
||||
const onPressSearch = React.useCallback(
|
||||
() => onPressTab('Search'),
|
||||
@@ -102,11 +98,13 @@ export const Drawer = observer(
|
||||
const onPressProfile = React.useCallback(() => {
|
||||
track('Menu:ItemClicked', {url: 'Profile'})
|
||||
navigation.navigate('Profile', {name: store.me.handle})
|
||||
navigation.closeDrawer()
|
||||
}, [navigation, track, store.me.handle])
|
||||
|
||||
const onPressSettings = React.useCallback(() => {
|
||||
track('Menu:ItemClicked', {url: 'Settings'})
|
||||
navigation.navigate('Settings')
|
||||
navigation.closeDrawer()
|
||||
}, [navigation, track])
|
||||
|
||||
const onPressFeedback = () => {
|
||||
@@ -157,10 +155,14 @@ export const Drawer = observer(
|
||||
}
|
||||
|
||||
const curr = currentRoute(navigation.getState()).name
|
||||
const isAtHome = curr === 'HomeStack' || curr === 'Home'
|
||||
const isAtSearch = curr === 'SearchStack' || curr === 'Search'
|
||||
const isAtHome =
|
||||
curr === 'HomeStack' || curr === 'Home' || curr === 'HomeInner'
|
||||
const isAtSearch =
|
||||
curr === 'SearchStack' || curr === 'Search' || curr === 'SearchInner'
|
||||
const isAtNotifications =
|
||||
curr === 'NotificationsStack' || curr === 'Notifications'
|
||||
curr === 'NotificationsStack' ||
|
||||
curr === 'Notifications' ||
|
||||
curr === 'NotificationsInner'
|
||||
|
||||
return (
|
||||
<View
|
||||
@@ -170,9 +172,7 @@ export const Drawer = observer(
|
||||
theme.colorScheme === 'light' ? pal.view : styles.viewDarkMode,
|
||||
]}>
|
||||
<SafeAreaView style={s.flex1}>
|
||||
<TouchableOpacity
|
||||
testID="profileCardButton"
|
||||
onPress={() => onNavigate(`/profile/${store.me.handle}`)}>
|
||||
<TouchableOpacity testID="profileCardButton" onPress={onPressProfile}>
|
||||
<UserAvatar
|
||||
size={80}
|
||||
displayName={store.me.displayName}
|
||||
@@ -187,9 +187,7 @@ export const Drawer = observer(
|
||||
<Text type="2xl" style={[pal.textLight, styles.profileCardHandle]}>
|
||||
@{store.me.handle}
|
||||
</Text>
|
||||
<Text
|
||||
type="xl"
|
||||
style={[pal.textLight, styles.profileCardFollowers]}>
|
||||
<Text type="xl" style={[pal.textLight, styles.profileCardFollowers]}>
|
||||
<Text type="xl-medium" style={pal.text}>
|
||||
{store.me.followersCount || 0}
|
||||
</Text>{' '}
|
||||
@@ -326,8 +324,7 @@ export const Drawer = observer(
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
view: {
|
||||
|
||||
Reference in New Issue
Block a user