mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-04-24 00:41:45 -04:00
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:
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user