11import type { RouteProp } from '@react-navigation/native' ;
22import { useNavigation } from '@react-navigation/native' ;
3- import React , { memo , useEffect , useMemo , useRef , useState } from 'react' ;
3+ import React , { memo , useContext , useEffect , useMemo , useRef , useState } from 'react' ;
44import type { OnyxEntry } from 'react-native-onyx' ;
55import Onyx , { withOnyx } from 'react-native-onyx' ;
66import ComposeProviders from '@components/ComposeProviders' ;
77import DelegateNoAccessModalProvider from '@components/DelegateNoAccessModalProvider' ;
88import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator' ;
9+ import { InitialURLContext } from '@components/InitialURLContextProvider' ;
910import LockedAccountModalProvider from '@components/LockedAccountModalProvider' ;
1011import OptionsListContextProvider from '@components/OptionListContextProvider' ;
1112import PriorityModeController from '@components/PriorityModeController' ;
@@ -89,9 +90,6 @@ type AuthScreensProps = {
8990
9091 /** The last Onyx update ID was applied to the client */
9192 initialLastUpdateIDAppliedToClient : OnyxEntry < number > ;
92-
93- /** Initial url */
94- initialUrl : string | null ;
9593} ;
9694
9795const loadAttachmentModalScreen = ( ) => require < ReactComponentModule > ( '../../../pages/media/AttachmentModalScreen' ) . default ;
@@ -226,7 +224,7 @@ const modalScreenListenersWithCancelSearch = {
226224 } ,
227225} ;
228226
229- function AuthScreens ( { session, lastOpenedPublicRoomID, initialLastUpdateIDAppliedToClient, initialUrl } : AuthScreensProps ) {
227+ function AuthScreens ( { session, lastOpenedPublicRoomID, initialLastUpdateIDAppliedToClient} : AuthScreensProps ) {
230228 const theme = useTheme ( ) ;
231229 const StyleUtils = useStyleUtils ( ) ;
232230 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
@@ -246,6 +244,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
246244 const prevIsOnboardingLoading = usePrevious ( isOnboardingLoading ) ;
247245 const [ shouldShowRequire2FAPage , setShouldShowRequire2FAPage ] = useState ( ! ! account ?. needsTwoFactorAuthSetup && ! account . requiresTwoFactorAuth ) ;
248246 const navigation = useNavigation ( ) ;
247+ const { initialURL} = useContext ( InitialURLContext ) ;
249248
250249 // State to track whether the delegator's authentication is completed before displaying data
251250 const [ isDelegatorFromOldDotIsReady , setIsDelegatorFromOldDotIsReady ] = useState ( false ) ;
@@ -326,7 +325,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
326325 setIsDelegatorFromOldDotIsReady ( true ) ;
327326 } ) ;
328327 } else {
329- const reportID = getReportIDFromLink ( initialUrl ) ;
328+ const reportID = getReportIDFromLink ( initialURL ?? null ) ;
330329 if ( reportID ) {
331330 Report . openReport ( reportID ) ;
332331 }
@@ -789,7 +788,7 @@ const AuthScreensMemoized = memo(AuthScreens, () => true);
789788// Further analysis required and more details can be seen here:
790789// https://github.com/Expensify/App/issues/50560
791790// eslint-disable-next-line
792- export default withOnyx < AuthScreensProps , Omit < AuthScreensProps , 'initialUrl' > > ( {
791+ export default withOnyx < AuthScreensProps , AuthScreensProps > ( {
793792 session : {
794793 key : ONYXKEYS . SESSION ,
795794 } ,
0 commit comments