diff --git a/src/CONST.ts b/src/CONST.ts index 4ca9b45f13df..31b54b4816a9 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4215,7 +4215,6 @@ const CONST = { }, EVENTS: { SCROLLING: 'scrolling', - ON_RETURN_TO_OLD_DOT: 'onReturnToOldDot', }, CHAT_HEADER_LOADER_HEIGHT: 36, diff --git a/src/components/HybridAppMiddleware/index.ios.tsx b/src/components/HybridAppMiddleware/index.ios.tsx deleted file mode 100644 index 6982487983c4..000000000000 --- a/src/components/HybridAppMiddleware/index.ios.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type React from 'react'; -import {useEffect} from 'react'; -import {NativeEventEmitter, NativeModules} from 'react-native'; -import type {NativeModule} from 'react-native'; -import Log from '@libs/Log'; -import CONST from '@src/CONST'; -import {useSplashScreenStateContext} from '@src/SplashScreenStateContext'; - -type HybridAppMiddlewareProps = { - authenticated: boolean; - children: React.ReactNode; -}; - -function HybridAppMiddleware({children}: HybridAppMiddlewareProps) { - const {setSplashScreenState} = useSplashScreenStateContext(); - - // In iOS, the HybridApp defines the `onReturnToOldDot` event. - // If we frequently transition from OldDot to NewDot during a single app lifecycle, - // we need to artificially display the bootsplash since the app is booted only once. - // Therefore, splashScreenState needs to be updated at the appropriate time. - useEffect(() => { - if (!NativeModules.HybridAppModule) { - return; - } - const HybridAppEvents = new NativeEventEmitter(NativeModules.HybridAppModule as unknown as NativeModule); - const listener = HybridAppEvents.addListener(CONST.EVENTS.ON_RETURN_TO_OLD_DOT, () => { - Log.info('[HybridApp] `onReturnToOldDot` event received. Resetting state of HybridAppMiddleware', true); - setSplashScreenState(CONST.BOOT_SPLASH_STATE.VISIBLE); - }); - - return () => { - listener.remove(); - }; - }, [setSplashScreenState]); - - return children; -} - -HybridAppMiddleware.displayName = 'HybridAppMiddleware'; - -export default HybridAppMiddleware; diff --git a/src/components/HybridAppMiddleware/index.tsx b/src/components/HybridAppMiddleware/index.tsx deleted file mode 100644 index 74e018bcfa5a..000000000000 --- a/src/components/HybridAppMiddleware/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import type React from 'react'; - -type HybridAppMiddlewareProps = { - children: React.ReactNode; -}; - -function HybridAppMiddleware({children}: HybridAppMiddlewareProps) { - return children; -} - -HybridAppMiddleware.displayName = 'HybridAppMiddleware'; - -export default HybridAppMiddleware; diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index a1aa53bc0b7e..1003fe99583e 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -3,7 +3,6 @@ import {DefaultTheme, findFocusedRoute, NavigationContainer} from '@react-naviga import React, {useContext, useEffect, useMemo, useRef} from 'react'; import {NativeModules} from 'react-native'; import {useOnyx} from 'react-native-onyx'; -import HybridAppMiddleware from '@components/HybridAppMiddleware'; import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useCurrentReportID from '@hooks/useCurrentReportID'; @@ -186,10 +185,7 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady, sh enabled: false, }} > - {/* HybridAppMiddleware needs to have access to navigation ref and SplashScreenHidden context */} - - - + ); }