@@ -30,6 +30,7 @@ import AccountSettingsNavigator from "./AccountSettingsNavigator";
3030import PasswordAddFlowNavigator from "./PasswordAddFlowNavigator" ;
3131import PasswordModifyFlowNavigator from "./PasswordModifyFlowNavigator" ;
3232import SwapNavigator from "./SwapNavigator" ;
33+ import SwapSubScreensNavigator from "./SwapSubScreensNavigator" ;
3334import PerpsNavigator from "./PerpsNavigator" ;
3435import NotificationCenterNavigator from "./NotificationCenterNavigator" ;
3536import AnalyticsAllocation from "~/screens/Analytics/Allocation" ;
@@ -98,6 +99,65 @@ import { AppState } from "react-native";
9899
99100const Stack = createNativeStackNavigator < BaseNavigatorStackParamList > ( ) ;
100101
102+ type OperationDetailsRouteProp = RouteProp <
103+ BaseNavigatorStackParamList ,
104+ ScreenName . OperationDetails
105+ > ;
106+
107+ const renderNullHeader = ( ) => null ;
108+
109+ function ScanRecipientHeaderRight ( ) {
110+ const { colors } = useTheme ( ) ;
111+
112+ return (
113+ < NavigationHeaderCloseButtonAdvanced
114+ color = { colors . constant . white }
115+ preferDismiss = { false }
116+ rounded
117+ />
118+ ) ;
119+ }
120+
121+ function FlowHeaderCloseButton ( ) {
122+ return < NavigationHeaderCloseButtonAdvanced preferDismiss = { false } /> ;
123+ }
124+
125+ function OperationDetailsHeaderLeft ( ) {
126+ return < NavigationHeaderBackButton /> ;
127+ }
128+
129+ function OperationDetailsHeaderTitle ( ) {
130+ const { t } = useTranslation ( ) ;
131+ const route = useRoute < OperationDetailsRouteProp > ( ) ;
132+ const operationType = route . params ?. operation ?. type ;
133+
134+ return (
135+ < StepHeader
136+ subtitle = { t ( "operationDetails.title" ) }
137+ title = { operationType ? t ( `operations.types.${ operationType } ` ) : "" }
138+ testID = "operationDetails-title"
139+ />
140+ ) ;
141+ }
142+
143+ function OperationDetailsHeaderRight ( ) {
144+ const route = useRoute < OperationDetailsRouteProp > ( ) ;
145+
146+ return route . params ?. isSubOperation ? < NavigationHeaderCloseButton /> : null ;
147+ }
148+
149+ function FirmwareUpdateHeaderTitle ( ) {
150+ return null ;
151+ }
152+
153+ function FirmwareUpdateHeaderLeft ( ) {
154+ return null ;
155+ }
156+
157+ function FirmwareUpdateHeaderRight ( ) {
158+ return < NavigationHeaderCloseButton /> ;
159+ }
160+
101161export default function BaseNavigator ( ) {
102162 const { t } = useTranslation ( ) ;
103163 const route = useRoute <
@@ -289,6 +349,13 @@ export default function BaseNavigator() {
289349 component = { SwapNavigator }
290350 options = { { headerShown : false } }
291351 />
352+
353+ < Stack . Screen
354+ name = { NavigatorName . SwapSubScreens }
355+ component = { SwapSubScreensNavigator }
356+ options = { { headerShown : false } }
357+ />
358+
292359 < Stack . Screen
293360 name = { NavigatorName . Perps }
294361 component = { PerpsNavigator }
@@ -361,24 +428,11 @@ export default function BaseNavigator() {
361428 < Stack . Screen
362429 name = { ScreenName . OperationDetails }
363430 component = { OperationDetails }
364- options = { ( { route } ) => {
365- return {
366- headerTitle : ( ) => (
367- < StepHeader
368- subtitle = { t ( "operationDetails.title" ) }
369- title = {
370- route . params ?. operation ?. type
371- ? t ( `operations.types.${ route . params . operation . type } ` )
372- : ""
373- }
374- testID = "operationDetails-title"
375- />
376- ) ,
377- headerLeft : ( ) => < NavigationHeaderBackButton /> ,
378- headerRight : ( ) =>
379- route . params ?. isSubOperation ? < NavigationHeaderCloseButton /> : null ,
380- animation : "slide_from_bottom" ,
381- } ;
431+ options = { {
432+ headerTitle : OperationDetailsHeaderTitle ,
433+ headerLeft : OperationDetailsHeaderLeft ,
434+ headerRight : OperationDetailsHeaderRight ,
435+ animation : "slide_from_bottom" ,
382436 } }
383437 />
384438 < Stack . Screen
@@ -451,14 +505,8 @@ export default function BaseNavigator() {
451505 options = { {
452506 ...TransparentHeaderNavigationOptions ,
453507 title : t ( "send.scan.title" ) ,
454- headerRight : ( ) => (
455- < NavigationHeaderCloseButtonAdvanced
456- color = { colors . constant . white }
457- preferDismiss = { false }
458- rounded
459- />
460- ) ,
461- headerLeft : ( ) => null ,
508+ headerRight : ScanRecipientHeaderRight ,
509+ headerLeft : renderNullHeader ,
462510 } }
463511 />
464512 < Stack . Screen
@@ -547,17 +595,17 @@ export default function BaseNavigator() {
547595 component = { NoFundsFlowNavigator }
548596 options = { {
549597 ...TransparentHeaderNavigationOptions ,
550- headerRight : ( ) => < NavigationHeaderCloseButtonAdvanced preferDismiss = { false } /> ,
551- headerLeft : ( ) => null ,
598+ headerRight : FlowHeaderCloseButton ,
599+ headerLeft : renderNullHeader ,
552600 } }
553601 />
554602 < Stack . Screen
555603 name = { NavigatorName . StakeFlow }
556604 component = { StakeFlowNavigator }
557605 options = { {
558606 ...TransparentHeaderNavigationOptions ,
559- headerRight : ( ) => < NavigationHeaderCloseButtonAdvanced preferDismiss = { false } /> ,
560- headerLeft : ( ) => null ,
607+ headerRight : FlowHeaderCloseButton ,
608+ headerLeft : renderNullHeader ,
561609 } }
562610 />
563611 < Stack . Screen
@@ -580,10 +628,10 @@ export default function BaseNavigator() {
580628 component = { FirmwareUpdateScreen }
581629 options = { {
582630 gestureEnabled : false ,
583- headerTitle : ( ) => null ,
631+ headerTitle : FirmwareUpdateHeaderTitle ,
584632 title : "" ,
585- headerLeft : ( ) => null ,
586- headerRight : ( ) => < NavigationHeaderCloseButton /> ,
633+ headerLeft : FirmwareUpdateHeaderLeft ,
634+ headerRight : FirmwareUpdateHeaderRight ,
587635 } }
588636 />
589637 < Stack . Screen
0 commit comments