Fix double back button android (#521)

* Fix double android back button

* Fix double android back button

* Remove back button from certain tab screens

* Remove back button from certain tab screens

* re-add back btn to obs detail
This commit is contained in:
Chris
2023-03-12 08:25:26 -05:00
committed by GitHub
parent da743537bc
commit 1dfcf308ef
2 changed files with 37 additions and 10 deletions

View File

@@ -15,7 +15,8 @@ import IdentifyStackNavigation from "navigation/identifyStackNavigation";
import {
blankHeaderTitle,
hideHeader,
showHeader
hideHeaderLeft,
showHeaderLeft
} from "navigation/navigationOptions";
import ProjectsStackNavigation from "navigation/projectsStackNavigation";
import React from "react";
@@ -42,12 +43,13 @@ const BottomTabs = () => {
initialRouteName={OBS_LIST_SCREEN_ID}
tabBar={renderTabBar}
backBehavior="history"
screenOptions={showHeader}
screenOptions={showHeaderLeft}
>
<Tab.Screen
name="Explore"
component={Explore}
options={{
...hideHeaderLeft,
meta: {
icon: "compass-rose-outline",
testID: EXPLORE_SCREEN_ID,
@@ -76,6 +78,7 @@ const BottomTabs = () => {
name="Messages"
component={Messages}
options={{
...hideHeaderLeft,
meta: {
icon: "notifications-bell",
testID: MESSAGES_SCREEN_ID,
@@ -89,7 +92,10 @@ const BottomTabs = () => {
<Tab.Screen
name="search"
component={Search}
options={{ headerTitle: t( "Search" ) }}
options={{
...hideHeaderLeft,
headerTitle: t( "Search" )
}}
/>
<Tab.Screen
name="identify"
@@ -104,16 +110,28 @@ const BottomTabs = () => {
<Tab.Screen
name="settings"
component={Settings}
options={{ headerTitle: t( "Settings" ) }}
options={{ ...hideHeaderLeft, headerTitle: t( "Settings" ) }}
/>
<Tab.Screen
name="about"
component={About}
options={{ headerTitle: t( "About-iNaturalist" ) }}
options={{ ...hideHeaderLeft, headerTitle: t( "About-iNaturalist" ) }}
/>
<Tab.Screen
name="help"
component={PlaceholderComponent}
options={hideHeaderLeft}
/>
<Tab.Screen
name="network"
component={NetworkLogging}
options={hideHeaderLeft}
/>
<Tab.Screen
name="UI Library"
component={UiLibrary}
options={hideHeaderLeft}
/>
<Tab.Screen name="help" component={PlaceholderComponent} />
<Tab.Screen name="network" component={NetworkLogging} />
<Tab.Screen name="UI Library" component={UiLibrary} />
<Tab.Screen
name="ObsDetails"
component={ObsDetails}

View File

@@ -9,8 +9,7 @@ import ContextHeader from "./ContextHeader";
const baseHeaderOptions: Object = {
headerShown: true,
headerBackTitleVisible: false,
headerShadowVisible: false,
headerLeft: ( ) => <BackButton />
headerShadowVisible: false
};
const showHeader: Object = {
@@ -25,6 +24,16 @@ const showHeader: Object = {
}
};
export const showHeaderLeft: Object = {
...showHeader,
headerLeft: ( ) => <BackButton />
};
export const hideHeaderLeft: Object = {
...showHeader,
headerLeft: null
};
const showCustomHeader: Object = {
...baseHeaderOptions,
header: ContextHeader