From 6b715224f2221112d4ab5cc49c112d09c5149d80 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 17 Nov 2022 10:37:30 -0600 Subject: Include tab count and move btn to center --- src/state/models/navigation.ts | 4 ++++ src/view/shell/mobile/index.tsx | 52 ++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/state/models/navigation.ts b/src/state/models/navigation.ts index 096f35335..553a897d4 100644 --- a/src/state/models/navigation.ts +++ b/src/state/models/navigation.ts @@ -179,6 +179,10 @@ export class NavigationModel { return this.tabs[this.tabIndex] } + get tabCount() { + return this.tabs.length + } + isCurrentScreen(tabId: number, index: number) { return this.tab.id === tabId && this.tab.index === index } diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 3067f3976..3fadee5e0 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -51,8 +51,8 @@ const SWIPE_GESTURE_VEL_TRIGGER = 2500 const Btn = ({ icon, - inactive, notificationCount, + tabCount, onPress, onLongPress, }: { @@ -66,8 +66,8 @@ const Btn = ({ | 'bell-solid' | 'search' | 'search-solid' - inactive?: boolean notificationCount?: number + tabCount?: number onPress?: (event: GestureResponderEvent) => void onLongPress?: (event: GestureResponderEvent) => void }) => { @@ -104,22 +104,6 @@ const Btn = ({ IconEl = FontAwesomeIcon } - if (inactive) { - return ( - - {notificationCount ? ( - - {notificationCount} - - ) : undefined} - - - ) - } return ( {notificationCount ? ( - - {notificationCount} + + {notificationCount} + + ) : undefined} + {tabCount > 1 ? ( + + {tabCount} ) : undefined} @@ -299,8 +288,9 @@ export const MobileShell: React.FC = observer(() => { onPress={onPressSearch} /> { notificationCount={store.me.notificationCount} />