1
- import { UNSTABLE_usePreventRemove , useIsFocused , useNavigation , useRoute } from '@react-navigation/native' ;
1
+ import { UNSTABLE_usePreventRemove , useIsFocused , useNavigation } from '@react-navigation/native' ;
2
2
import type { ForwardedRef , ReactNode } from 'react' ;
3
3
import React , { createContext , forwardRef , useContext , useEffect , useMemo , useRef , useState } from 'react' ;
4
4
import type { StyleProp , ViewStyle } from 'react-native' ;
5
5
import { Keyboard , NativeModules , PanResponder , View } from 'react-native' ;
6
+ import { useOnyx } from 'react-native-onyx' ;
6
7
import { PickerAvoidingView } from 'react-native-picker-select' ;
7
8
import type { EdgeInsets } from 'react-native-safe-area-context' ;
8
9
import useEnvironment from '@hooks/useEnvironment' ;
@@ -18,6 +19,7 @@ import type {ReportsSplitNavigatorParamList, RootNavigatorParamList} from '@libs
18
19
import addViewportResizeListener from '@libs/VisualViewport' ;
19
20
import toggleTestToolsModal from '@userActions/TestTool' ;
20
21
import CONST from '@src/CONST' ;
22
+ import ONYXKEYS from '@src/ONYXKEYS' ;
21
23
import CustomDevMenu from './CustomDevMenu' ;
22
24
import CustomStatusBarAndBackgroundContext from './CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext' ;
23
25
import FocusTrapForScreens from './FocusTrap/FocusTrapForScreen' ;
@@ -158,6 +160,7 @@ function ScreenWrapper(
158
160
// since Modals are drawn in separate native view hierarchy we should always add paddings
159
161
const ignoreInsetsConsumption = ! useContext ( ModalContext ) . default ;
160
162
const { setRootStatusBarEnabled} = useContext ( CustomStatusBarAndBackgroundContext ) ;
163
+ const [ isSingleNewDotEntry ] = useOnyx ( ONYXKEYS . IS_SINGLE_NEW_DOT_ENTRY ) ;
161
164
162
165
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout for a case where we want to show the offline indicator only on small screens
163
166
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
@@ -169,14 +172,10 @@ function ScreenWrapper(
169
172
const maxHeight = shouldEnableMaxHeight ? windowHeight : undefined ;
170
173
const minHeight = shouldEnableMinHeight && ! isSafari ( ) ? initialHeight : undefined ;
171
174
172
- const route = useRoute ( ) ;
173
- const shouldReturnToOldDot = useMemo ( ( ) => {
174
- return ! ! route ?. params && CONST . HYBRID_APP . SINGLE_NEW_DOT_ENTRY in route . params && route . params [ CONST . HYBRID_APP . SINGLE_NEW_DOT_ENTRY ] === 'true' ;
175
- } , [ route ?. params ] ) ;
176
175
const { isBlurred, setIsBlurred} = useInputBlurContext ( ) ;
177
176
178
- UNSTABLE_usePreventRemove ( shouldReturnToOldDot , ( ) => {
179
- NativeModules . HybridAppModule ?. closeReactNativeApp ( false , false ) ;
177
+ UNSTABLE_usePreventRemove ( isSingleNewDotEntry ?? false , ( ) => {
178
+ NativeModules . HybridAppModule ?. closeReactNativeApp ( { shouldSignOut : false , shouldSetNVP : false } ) ;
180
179
setRootStatusBarEnabled ( false ) ;
181
180
} ) ;
182
181
0 commit comments