diff --git a/components/navigationStyle.tsx b/components/navigationStyle.tsx index 2a022533e..0a31dc7d3 100644 --- a/components/navigationStyle.tsx +++ b/components/navigationStyle.tsx @@ -79,8 +79,8 @@ const navigationStyle = ( return theme => ({ navigation, route }) => { const isFirstRouteInStack = navigation.getState().index === 0; - const isModal = route.params?.presentation === 'modal' || route.params?.presentation === 'transparentModal'; - const isFormSheet = route.params?.presentation === 'formSheet'; + const isModal = opts.presentation === 'modal' || opts.presentation === 'transparentModal'; + const isFormSheet = opts.presentation === 'formSheet'; const closeButton = getCloseButtonPosition(closeButtonPosition, isFirstRouteInStack, isModal); const handleClose = getHandleCloseAction(onCloseButtonPressed, navigation, route); @@ -88,42 +88,35 @@ const navigationStyle = ( let headerRight; let headerLeft; + const renderCloseButton = () => ( + + + + ); + if (closeButton === CloseButtonPosition.Right) { - headerRight = () => ( - - - - ); + headerRight = renderCloseButton; } else if (closeButton === CloseButtonPosition.Left) { - headerLeft = () => ( - - - - ); + headerLeft = renderCloseButton; } - if (!headerLeft && !isFirstRouteInStack) { - headerLeft = () => ( - { - Keyboard.dismiss(); - navigation.goBack(); - }} - /> - ); + if (closeButton === CloseButtonPosition.None) { + headerLeft = (props: any) => + props.canGoBack ? ( + { + Keyboard.dismiss(); + navigation.goBack(); + }} + /> + ) : null; } const baseHeaderStyle = { @@ -135,7 +128,6 @@ const navigationStyle = ( color: theme.colors.foregroundColor, }, headerTintColor: theme.colors.foregroundColor, - headerBackButtonDisplayMode: 'minimal' as const, }; const isLeftCloseButtonAndroid = closeButton === CloseButtonPosition.Left && Platform.OS === 'android'; diff --git a/components/themes.ts b/components/themes.ts index 7809c44d0..f6fbfd49a 100644 --- a/components/themes.ts +++ b/components/themes.ts @@ -17,6 +17,7 @@ const palette = { gray400: '#9AA0AA', gray450: '#99A1AF', gray500: '#81868E', + gray700: '#545454', gray800: '#3A3A3C', gray850: '#313030', gray900: '#202020', @@ -84,6 +85,7 @@ const tokens = { receiveBackground: pair('#D1F9D6', 'rgba(210,248,214,.2)'), navigationBarColor: pair(palette.white, palette.gray800), androidRippleColor: pair('#CCCCCC', '#444444'), + backButtonIcon: pair(palette.black, palette.gray700), // Brand violet in both modes, matching master #123. Also the canonical token for the former // buttonBackgroundColor / mainColor / feeValue, which were identical in both schemes. primary: same(palette.violet600), @@ -128,7 +130,7 @@ const tokens = { bannerBorderColor: pair(palette.violet100, '#2D264F'), scanBtnBorderColor: pair(palette.violet100, '#241F3B'), settingsBtnBackground: pair('#F6F7F9', '#141414'), - settingsBtnIconColor: pair('#545454', '#AAAAAA'), + settingsBtnIconColor: pair(palette.gray700, '#AAAAAA'), searchIconBackground: pair(palette.white, '#0D0D0D'), shieldIconBackground: pair('#FAF5FF', palette.violet900), shieldIconBorder: pair('#F3E8FF', '#181818'), diff --git a/navigation/SendDetailsStack.tsx b/navigation/SendDetailsStack.tsx index d5c6819ef..25d798b17 100644 --- a/navigation/SendDetailsStack.tsx +++ b/navigation/SendDetailsStack.tsx @@ -1,9 +1,7 @@ import React from 'react'; -import { Keyboard } from 'react-native'; -import { NativeStackNavigationOptions, createNativeStackNavigator } from '@react-navigation/native-stack'; +import { createNativeStackNavigator } from '@react-navigation/native-stack'; import navigationStyle from '../components/navigationStyle'; -import HeaderBackButton from '../components/HeaderBackButton'; -import { Theme, useTheme } from '../components/themes'; +import { useTheme } from '../components/themes'; import loc from '../loc'; import { CoinControlComponent, @@ -20,24 +18,6 @@ import SelectFeeScreen from '../screen/SelectFeeScreen'; const Stack = createNativeStackNavigator(); -// SendDetails is the initial route of this nested stack (index 0), so navigationStyle's -// default back chevron doesn't apply to it and it needs its own headerLeft. -const withBackChevron = ( - options: NativeStackNavigationOptions, - { theme, navigation }: { theme: Theme; navigation: any }, -): NativeStackNavigationOptions => ({ - ...options, - headerLeft: () => ( - { - Keyboard.dismiss(); - navigation.goBack(); - }} - /> - ), -}); - const SendDetailsStack = () => { const theme = useTheme(); @@ -46,25 +26,14 @@ const SendDetailsStack = () => { - - + +