Skip to content

Commit 57065cc

Browse files
committed
clean code after comment
1 parent 2a2530c commit 57065cc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/ScreenWrapper/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +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

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

0 commit comments

Comments
 (0)