Skip to content

Commit cb622bb

Browse files
authored
Merge pull request Expensify#65417 from software-mansion-labs/bugfix/kuba_nowakowski/go_back_to_OD
Fix go back to OD in hybridApp
2 parents 13dd5f0 + 57065cc commit cb622bb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/components/ScreenWrapper/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ function ScreenWrapper(
170170
const shouldOffsetMobileOfflineIndicator = displaySmallScreenOfflineIndicator && addSmallScreenOfflineIndicatorBottomSafeAreaPadding && isOffline;
171171

172172
const {initialURL} = useContext(InitialURLContext);
173-
const [isSingleNewDotEntry] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY, {canBeMissing: true});
173+
const [isSingleNewDotEntry = false] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY, {canBeMissing: true});
174174
const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext);
175175

176-
usePreventRemove((isSingleNewDotEntry ?? false) && initialURL === Navigation.getActiveRouteWithoutParams(), () => {
177-
if (!CONFIG.IS_HYBRID_APP) {
176+
usePreventRemove(true, () => {
177+
const isOnInitialURL = initialURL === Navigation.getActiveRouteWithoutParams();
178+
const shouldGoBackToOldDot = isSingleNewDotEntry && isOnInitialURL;
179+
180+
if (!CONFIG.IS_HYBRID_APP || !shouldGoBackToOldDot) {
178181
return;
179182
}
180183
HybridAppModule.closeReactNativeApp({shouldSignOut: false, shouldSetNVP: false});

0 commit comments

Comments
 (0)