From c949269abcc4079535f0f9f3171a6ecf1f67c9b6 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 1 Nov 2022 11:53:30 -0500 Subject: [PATCH] Replace footer-nav back and forward arrows with search and notifications --- src/view/shell/mobile/HistoryMenu.tsx | 100 -------------------------- src/view/shell/mobile/index.tsx | 26 ++----- 2 files changed, 5 insertions(+), 121 deletions(-) delete mode 100644 src/view/shell/mobile/HistoryMenu.tsx diff --git a/src/view/shell/mobile/HistoryMenu.tsx b/src/view/shell/mobile/HistoryMenu.tsx deleted file mode 100644 index d0b9b975..00000000 --- a/src/view/shell/mobile/HistoryMenu.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react' -import { - StyleSheet, - Text, - TouchableOpacity, - TouchableWithoutFeedback, - View, -} from 'react-native' -import RootSiblings from 'react-native-root-siblings' -import {NavigationTabModel} from '../../../state/models/navigation' - -export function createBackMenu(tab: NavigationTabModel): RootSiblings { - const onPressItem = (index: number) => { - sibling.destroy() - tab.goToIndex(index) - } - const onOuterPress = () => sibling.destroy() - const sibling = new RootSiblings( - ( - <> - - - - - {tab.backTen.map((item, i) => ( - onPressItem(item.index)}> - {item.title || item.url} - - ))} - - - ), - ) - return sibling -} - -export function createForwardMenu(tab: NavigationTabModel): RootSiblings { - const onPressItem = (index: number) => { - sibling.destroy() - tab.goToIndex(index) - } - const onOuterPress = () => sibling.destroy() - const sibling = new RootSiblings( - ( - <> - - - - - {tab.forwardTen.reverse().map((item, i) => ( - onPressItem(item.index)}> - {item.title || item.url} - - ))} - - - ), - ) - return sibling -} - -const styles = StyleSheet.create({ - bg: { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0, - backgroundColor: '#000', - opacity: 0.1, - }, - menu: { - position: 'absolute', - bottom: 80, - backgroundColor: '#fff', - borderRadius: 8, - opacity: 1, - }, - back: { - left: 10, - }, - forward: { - left: 60, - }, - menuItem: { - paddingVertical: 10, - paddingLeft: 15, - paddingRight: 30, - }, - menuItemBorder: { - borderTopWidth: 1, - borderTopColor: '#ddd', - }, -}) diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 873fd655..3b0b01e9 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -24,12 +24,10 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {IconProp} from '@fortawesome/fontawesome-svg-core' import {useStores} from '../../../state' import {NavigationModel} from '../../../state/models/navigation' -import {TabsSelectorModel} from '../../../state/models/shell' import {match, MatchResult} from '../../routes' import {Login} from '../../screens/Login' import {Modal} from '../../com/modals/Modal' import {LocationNavigator} from './LocationNavigator' -import {createBackMenu, createForwardMenu} from './HistoryMenu' import {MainMenu} from './MainMenu' import {TabsSelector} from './TabsSelector' import {s, colors} from '../../lib/styles' @@ -108,8 +106,6 @@ export const MobileShell: React.FC = observer(() => { } const onDismissLocationNavigator = () => setLocationMenuActive(false) - const onPressBack = () => store.nav.tab.goBack() - const onPressForward = () => store.nav.tab.goForward() const onPressHome = () => { if (store.nav.tab.current.url === '/') { scrollElRef.current?.scrollToOffset({offset: 0}) @@ -118,11 +114,9 @@ export const MobileShell: React.FC = observer(() => { } } const onPressMenu = () => setMainMenuActive(true) + const onPressNotifications = () => store.nav.navigate('/notifications') const onPressTabs = () => setTabsSelectorActive(true) - const onLongPressBack = () => createBackMenu(store.nav.tab) - const onLongPressForward = () => createForwardMenu(store.nav.tab) - const goBack = () => store.nav.tab.goBack() const swipeGesture = Gesture.Pan() .onUpdate(e => { @@ -206,23 +200,13 @@ export const MobileShell: React.FC = observer(() => { + {} /* TODO */} /> + - -