Skip to content

Commit

Permalink
Merge pull request #42847 from Expensify/techievivek_revert_41764
Browse files Browse the repository at this point in the history
Revert "Merge pull request #41764 from software-mansion-labs:fix-init-url-hybrid

(cherry picked from commit a09a12b)
  • Loading branch information
puneetlath authored and OSBotify committed May 30, 2024
1 parent 0012976 commit f986a79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/components/InitialURLContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {createContext} from 'react';
import React, {createContext, useEffect, useState} from 'react';
import type {ReactNode} from 'react';
import {Linking} from 'react-native';
import type {Route} from '@src/ROUTES';

/** Initial url that will be opened when NewDot is embedded into Hybrid App. */
Expand All @@ -14,7 +15,16 @@ type InitialURLContextProviderProps = {
};

function InitialURLContextProvider({children, url}: InitialURLContextProviderProps) {
return <InitialURLContext.Provider value={url}>{children}</InitialURLContext.Provider>;
const [initialURL, setInitialURL] = useState(url);
useEffect(() => {
if (initialURL) {
return;
}
Linking.getInitialURL().then((initURL) => {
setInitialURL(initURL as Route);
});
}, [initialURL]);
return <InitialURLContext.Provider value={initialURL}>{children}</InitialURLContext.Provider>;
}

InitialURLContextProvider.displayName = 'InitialURLContextProvider';
Expand Down
1 change: 0 additions & 1 deletion src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function ExitSurveyConfirmPage({exitReason, isLoading, route, navigation}: ExitS
ExitSurvey.switchToOldDot();

if (NativeModules.HybridAppModule) {
Navigation.resetToHome();
NativeModules.HybridAppModule.closeReactNativeApp();
return;
}
Expand Down

0 comments on commit f986a79

Please sign in to comment.