From 9f6399c29d8eddc98c68e14528f7a9757b7d5743 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 7 May 2024 15:16:08 +0200 Subject: [PATCH 1/3] fix initUrl for HybridApp --- src/components/InitialURLContextProvider.tsx | 2 +- src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/InitialURLContextProvider.tsx b/src/components/InitialURLContextProvider.tsx index a3df93844ca9..3f9bceebb2b6 100644 --- a/src/components/InitialURLContextProvider.tsx +++ b/src/components/InitialURLContextProvider.tsx @@ -23,7 +23,7 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro Linking.getInitialURL().then((initURL) => { setInitialURL(initURL as Route); }); - }, [initialURL]); + }, [initialURL, url]); return {children}; } diff --git a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx index 672dbbb91069..7507e1015f86 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx @@ -87,6 +87,7 @@ function ExitSurveyConfirmPage({exitReason, isLoading, route, navigation}: ExitS ExitSurvey.switchToOldDot(); if (NativeModules.HybridAppModule) { + Navigation.resetToHome(); NativeModules.HybridAppModule.closeReactNativeApp(); return; } From 09a87cca1f9b30d1ec8edb37f7507855c635ccfc Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 7 May 2024 15:16:46 +0200 Subject: [PATCH 2/3] fix one more time --- src/components/InitialURLContextProvider.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/InitialURLContextProvider.tsx b/src/components/InitialURLContextProvider.tsx index 3f9bceebb2b6..adcb27f2cf5e 100644 --- a/src/components/InitialURLContextProvider.tsx +++ b/src/components/InitialURLContextProvider.tsx @@ -15,16 +15,7 @@ type InitialURLContextProviderProps = { }; function InitialURLContextProvider({children, url}: InitialURLContextProviderProps) { - const [initialURL, setInitialURL] = useState(url); - useEffect(() => { - if (initialURL) { - return; - } - Linking.getInitialURL().then((initURL) => { - setInitialURL(initURL as Route); - }); - }, [initialURL, url]); - return {children}; + return {children}; } InitialURLContextProvider.displayName = 'InitialURLContextProvider'; From 3f3fb078269d3cc19031734a0c8bbeef49a82020 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Tue, 7 May 2024 15:17:16 +0200 Subject: [PATCH 3/3] remove imports --- src/components/InitialURLContextProvider.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/InitialURLContextProvider.tsx b/src/components/InitialURLContextProvider.tsx index adcb27f2cf5e..710f045ede4e 100644 --- a/src/components/InitialURLContextProvider.tsx +++ b/src/components/InitialURLContextProvider.tsx @@ -1,6 +1,5 @@ -import React, {createContext, useEffect, useState} from 'react'; +import React, {createContext} 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. */