1- import HybridAppModule from '@expensify/react-native-hybrid-app' ;
21import { Str } from 'expensify-common' ;
32import type { ReactElement } from 'react' ;
4- import React , { useCallback , useContext , useEffect , useState } from 'react' ;
3+ import React , { useCallback , useEffect , useState } from 'react' ;
54import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
65import useLocalize from '@hooks/useLocalize' ;
76import useOnyx from '@hooks/useOnyx' ;
@@ -15,14 +14,14 @@ import Log from '@libs/Log';
1514import Navigation from '@libs/Navigation/Navigation' ;
1615import { getActivePolicies , getAdminsPrivateEmailDomains , isPaidGroupPolicy } from '@libs/PolicyUtils' ;
1716import colors from '@styles/theme/colors' ;
17+ import closeReactNativeApp from '@userActions/HybridApp' ;
1818import CONFIG from '@src/CONFIG' ;
1919import CONST from '@src/CONST' ;
2020import ONYXKEYS from '@src/ONYXKEYS' ;
2121import ROUTES from '@src/ROUTES' ;
2222import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
2323import Button from './Button' ;
2424import ConfirmModal from './ConfirmModal' ;
25- import CustomStatusBarAndBackgroundContext from './CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext' ;
2625import DotIndicatorMessage from './DotIndicatorMessage' ;
2726import { RocketDude } from './Icon/Illustrations' ;
2827import Text from './Text' ;
@@ -62,7 +61,6 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
6261 const [ travelSettings ] = useOnyx ( ONYXKEYS . NVP_TRAVEL_SETTINGS , { canBeMissing : false } ) ;
6362 const [ sessionEmail ] = useOnyx ( ONYXKEYS . SESSION , { selector : ( session ) => session ?. email , canBeMissing : false } ) ;
6463 const primaryContactMethod = primaryLogin ?? sessionEmail ?? '' ;
65- const { setRootStatusBarEnabled} = useContext ( CustomStatusBarAndBackgroundContext ) ;
6664 const { isBlockedFromSpotnanaTravel, isBetaEnabled} = usePermissions ( ) ;
6765 const [ isPreventionModalVisible , setPreventionModalVisibility ] = useState ( false ) ;
6866 const [ isVerificationModalVisible , setVerificationModalVisibility ] = useState ( false ) ;
@@ -72,7 +70,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
7270 const groupPaidPolicies = activePolicies . filter ( ( activePolicy ) => activePolicy . type !== CONST . POLICY . TYPE . PERSONAL && isPaidGroupPolicy ( activePolicy ) ) ;
7371 // Flag indicating whether NewDot was launched exclusively for Travel,
7472 // e.g., when the user selects "Trips" from the Expensify Classic menu in HybridApp.
75- const [ wasNewDotLaunchedJustForTravel ] = useOnyx ( ONYXKEYS . IS_SINGLE_NEW_DOT_ENTRY , { canBeMissing : false } ) ;
73+ const [ wasNewDotLaunchedJustForTravel ] = useOnyx ( ONYXKEYS . HYBRID_APP , { selector : ( hybridApp ) => hybridApp ?. isSingleNewDotEntry , canBeMissing : false } ) ;
7674
7775 const hidePreventionModal = ( ) => setPreventionModalVisibility ( false ) ;
7876 const hideVerificationModal = ( ) => setVerificationModalVisibility ( false ) ;
@@ -137,8 +135,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
137135
138136 // Close NewDot if it was opened only for Travel, as its purpose is now fulfilled.
139137 Log . info ( '[HybridApp] Returning to OldDot after opening TravelDot' ) ;
140- HybridAppModule . closeReactNativeApp ( { shouldSignOut : false , shouldSetNVP : false } ) ;
141- setRootStatusBarEnabled ( false ) ;
138+ closeReactNativeApp ( { shouldSignOut : false , shouldSetNVP : false } ) ;
142139 } )
143140 ?. catch ( ( ) => {
144141 setErrorMessage ( translate ( 'travel.errorMessage' ) ) ;
@@ -170,17 +167,16 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
170167 isBlockedFromSpotnanaTravel ,
171168 primaryContactMethod ,
172169 policy ,
170+ groupPaidPolicies . length ,
173171 travelSettings ?. hasAcceptedTerms ,
172+ travelSettings ?. lastTravelSignupRequestTime ,
173+ isBetaEnabled ,
174174 styles . flexRow ,
175175 styles . link ,
176176 StyleUtils ,
177177 translate ,
178178 wasNewDotLaunchedJustForTravel ,
179- setRootStatusBarEnabled ,
180179 isUserValidated ,
181- groupPaidPolicies . length ,
182- isBetaEnabled ,
183- travelSettings ?. lastTravelSignupRequestTime ,
184180 ] ) ;
185181
186182 return (
0 commit comments