1
- import React , { memo , useEffect , useMemo , useRef , useState } from 'react' ;
1
+ import React , { memo , useEffect , useRef , useState } from 'react' ;
2
2
import { View } from 'react-native' ;
3
3
import type { OnyxEntry } from 'react-native-onyx' ;
4
4
import Onyx , { withOnyx } from 'react-native-onyx' ;
@@ -13,14 +13,13 @@ import useActiveWorkspace from '@hooks/useActiveWorkspace';
13
13
import useOnboardingFlowRouter from '@hooks/useOnboardingFlow' ;
14
14
import usePermissions from '@hooks/usePermissions' ;
15
15
import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
16
- import useStyleUtils from '@hooks/useStyleUtils' ;
17
16
import useThemeStyles from '@hooks/useThemeStyles' ;
17
+ import * as Welcome from '@libs/actions/Welcome' ;
18
18
import { READ_COMMANDS } from '@libs/API/types' ;
19
19
import HttpUtils from '@libs/HttpUtils' ;
20
20
import KeyboardShortcut from '@libs/KeyboardShortcut' ;
21
21
import Log from '@libs/Log' ;
22
22
import getCurrentUrl from '@libs/Navigation/currentUrl' ;
23
- import getOnboardingModalScreenOptions from '@libs/Navigation/getOnboardingModalScreenOptions' ;
24
23
import Navigation from '@libs/Navigation/Navigation' ;
25
24
import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom' ;
26
25
import type { AuthScreensParamList , CentralPaneName , CentralPaneScreensParamList } from '@libs/Navigation/types' ;
@@ -56,9 +55,8 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';
56
55
import type ReactComponentModule from '@src/types/utils/ReactComponentModule' ;
57
56
import beforeRemoveReportOpenedFromSearchRHP from './beforeRemoveReportOpenedFromSearchRHP' ;
58
57
import CENTRAL_PANE_SCREENS from './CENTRAL_PANE_SCREENS' ;
59
- import createCustomStackNavigator from './createCustomStackNavigator ' ;
58
+ import createResponsiveStackNavigator from './createResponsiveStackNavigator ' ;
60
59
import defaultScreenOptions from './defaultScreenOptions' ;
61
- import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions' ;
62
60
import BottomTabNavigator from './Navigators/BottomTabNavigator' ;
63
61
import ExplanationModalNavigator from './Navigators/ExplanationModalNavigator' ;
64
62
import FeatureTrainingModalNavigator from './Navigators/FeatureTrainingModalNavigator' ;
@@ -67,6 +65,7 @@ import LeftModalNavigator from './Navigators/LeftModalNavigator';
67
65
import OnboardingModalNavigator from './Navigators/OnboardingModalNavigator' ;
68
66
import RightModalNavigator from './Navigators/RightModalNavigator' ;
69
67
import WelcomeVideoModalNavigator from './Navigators/WelcomeVideoModalNavigator' ;
68
+ import useRootNavigatorOptions from './useRootNavigatorOptions' ;
70
69
71
70
type AuthScreensProps = {
72
71
/** Session of currently logged in user */
@@ -194,7 +193,7 @@ function handleNetworkReconnect() {
194
193
}
195
194
}
196
195
197
- const RootStack = createCustomStackNavigator < AuthScreensParamList > ( ) ;
196
+ const RootStack = createResponsiveStackNavigator < AuthScreensParamList > ( ) ;
198
197
// We want to delay the re-rendering for components(e.g. ReportActionCompose)
199
198
// that depends on modal visibility until Modal is completely closed and its focused
200
199
// When modal screen is focused, update modal visibility in Onyx
@@ -224,18 +223,12 @@ const modalScreenListenersWithCancelSearch = {
224
223
225
224
function AuthScreens ( { session, lastOpenedPublicRoomID, initialLastUpdateIDAppliedToClient} : AuthScreensProps ) {
226
225
const styles = useThemeStyles ( ) ;
227
- const StyleUtils = useStyleUtils ( ) ;
228
- const { shouldUseNarrowLayout, onboardingIsMediumOrLargerScreenWidth, isSmallScreenWidth} = useResponsiveLayout ( ) ;
229
- const screenOptions = getRootNavigatorScreenOptions ( shouldUseNarrowLayout , styles , StyleUtils ) ;
226
+ const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
227
+ const rootNavigatorOptions = useRootNavigatorOptions ( ) ;
230
228
const { canUseDefaultRooms} = usePermissions ( ) ;
231
229
const { activeWorkspaceID} = useActiveWorkspace ( ) ;
232
230
const { toggleSearchRouter} = useSearchRouterContext ( ) ;
233
231
234
- const onboardingModalScreenOptions = useMemo ( ( ) => screenOptions . onboardingModalNavigator ( onboardingIsMediumOrLargerScreenWidth ) , [ screenOptions , onboardingIsMediumOrLargerScreenWidth ] ) ;
235
- const onboardingScreenOptions = useMemo (
236
- ( ) => getOnboardingModalScreenOptions ( shouldUseNarrowLayout , styles , StyleUtils , onboardingIsMediumOrLargerScreenWidth ) ,
237
- [ StyleUtils , shouldUseNarrowLayout , onboardingIsMediumOrLargerScreenWidth , styles ] ,
238
- ) ;
239
232
const modal = useRef < OnyxTypes . Modal > ( { } ) ;
240
233
const [ didPusherInit , setDidPusherInit ] = useState ( false ) ;
241
234
const { isOnboardingCompleted} = useOnboardingFlowRouter ( ) ;
@@ -409,19 +402,16 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
409
402
return (
410
403
< ComposeProviders components = { [ OptionsListContextProvider , SearchContextProvider ] } >
411
404
< View style = { styles . rootNavigatorContainerStyles ( shouldUseNarrowLayout ) } >
412
- < RootStack . Navigator
413
- screenOptions = { screenOptions . centralPaneNavigator }
414
- isSmallScreenWidth = { isSmallScreenWidth }
415
- >
405
+ < RootStack . Navigator screenOptions = { rootNavigatorOptions . centralPaneNavigator } >
416
406
< RootStack . Screen
417
407
name = { NAVIGATORS . BOTTOM_TAB_NAVIGATOR }
418
- options = { screenOptions . bottomTab }
408
+ options = { rootNavigatorOptions . bottomTab }
419
409
component = { BottomTabNavigator }
420
410
/>
421
411
< RootStack . Screen
422
412
name = { SCREENS . VALIDATE_LOGIN }
423
413
options = { {
424
- ...screenOptions . fullScreen ,
414
+ ...rootNavigatorOptions . fullScreen ,
425
415
headerShown : false ,
426
416
title : 'New Expensify' ,
427
417
} }
@@ -461,6 +451,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
461
451
options = { {
462
452
headerShown : false ,
463
453
presentation : 'transparentModal' ,
454
+ animation : 'none' ,
464
455
} }
465
456
getComponent = { loadProfileAvatar }
466
457
listeners = { modalScreenListeners }
@@ -485,51 +476,51 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
485
476
/>
486
477
< RootStack . Screen
487
478
name = { SCREENS . NOT_FOUND }
488
- options = { screenOptions . fullScreen }
479
+ options = { rootNavigatorOptions . fullScreen }
489
480
component = { NotFoundPage }
490
481
/>
491
482
< RootStack . Screen
492
483
name = { NAVIGATORS . RIGHT_MODAL_NAVIGATOR }
493
- options = { screenOptions . rightModalNavigator }
484
+ options = { rootNavigatorOptions . rightModalNavigator }
494
485
component = { RightModalNavigator }
495
486
listeners = { modalScreenListenersWithCancelSearch }
496
487
/>
497
488
< RootStack . Screen
498
489
name = { NAVIGATORS . FULL_SCREEN_NAVIGATOR }
499
- options = { screenOptions . fullScreen }
490
+ options = { rootNavigatorOptions . fullScreen }
500
491
component = { FullScreenNavigator }
501
492
/>
502
493
< RootStack . Screen
503
494
name = { NAVIGATORS . LEFT_MODAL_NAVIGATOR }
504
- options = { screenOptions . leftModalNavigator }
495
+ options = { rootNavigatorOptions . leftModalNavigator }
505
496
component = { LeftModalNavigator }
506
497
listeners = { modalScreenListeners }
507
498
/>
508
499
< RootStack . Screen
509
500
name = { SCREENS . DESKTOP_SIGN_IN_REDIRECT }
510
- options = { screenOptions . fullScreen }
501
+ options = { rootNavigatorOptions . fullScreen }
511
502
component = { DesktopSignInRedirectPage }
512
503
/>
513
504
< RootStack . Screen
514
505
name = { NAVIGATORS . EXPLANATION_MODAL_NAVIGATOR }
515
- options = { onboardingModalScreenOptions }
506
+ options = { rootNavigatorOptions . onboardingModalNavigator }
516
507
component = { ExplanationModalNavigator }
517
508
/>
518
509
< RootStack . Screen
519
510
name = { NAVIGATORS . FEATURE_TRANING_MODAL_NAVIGATOR }
520
- options = { onboardingModalScreenOptions }
511
+ options = { rootNavigatorOptions . onboardingModalNavigator }
521
512
component = { FeatureTrainingModalNavigator }
522
513
listeners = { modalScreenListeners }
523
514
/>
524
515
< RootStack . Screen
525
516
name = { NAVIGATORS . WELCOME_VIDEO_MODAL_NAVIGATOR }
526
- options = { onboardingModalScreenOptions }
517
+ options = { rootNavigatorOptions . onboardingModalNavigator }
527
518
component = { WelcomeVideoModalNavigator }
528
519
/>
529
520
{ isOnboardingCompleted === false && (
530
521
< RootStack . Screen
531
522
name = { NAVIGATORS . ONBOARDING_MODAL_NAVIGATOR }
532
- options = { onboardingScreenOptions }
523
+ options = { rootNavigatorOptions . onboardingModalNavigator }
533
524
component = { OnboardingModalNavigator }
534
525
listeners = { {
535
526
focus : ( ) => {
@@ -559,7 +550,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
559
550
/>
560
551
< RootStack . Screen
561
552
name = { SCREENS . CONNECTION_COMPLETE }
562
- options = { screenOptions . fullScreen }
553
+ options = { defaultScreenOptions }
563
554
component = { ConnectionCompletePage }
564
555
/>
565
556
{ Object . entries ( CENTRAL_PANE_SCREENS ) . map ( ( [ screenName , componentGetter ] ) => {
0 commit comments