diff options
author | dan <dan.abramov@gmail.com> | 2023-11-24 22:31:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 22:31:33 +0000 |
commit | f2d164ec23247d878f7f019d568a3073a5ae94c4 (patch) | |
tree | 7db9131e8b1f642494bb0b626a75a5ec7be36755 /src/App.native.tsx | |
parent | 4b59a21cacc36d3c05e68d22379538c0f32550c9 (diff) | |
download | voidsky-f2d164ec23247d878f7f019d568a3073a5ae94c4.tar.zst |
PWI: Refactor Shell (#1989)
* Vendor createNativeStackNavigator for further tweaks * Completely disable withAuthRequired * Render LoggedOut for protected routes * Move web shell into the navigator * Simplify the logic * Add login modal * Delete withAuthRequired * Reset app state on session change * Move TS suppression
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r-- | src/App.native.tsx | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx index b9f9519c9..64c7e718f 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -28,6 +28,7 @@ import {Provider as LightboxStateProvider} from 'state/lightbox' import {Provider as MutedThreadsProvider} from 'state/muted-threads' import {Provider as InvitesStateProvider} from 'state/invites' import {Provider as PrefsStateProvider} from 'state/preferences' +import {Provider as LoggedOutViewProvider} from 'state/shell/logged-out' import I18nProvider from './locale/i18nProvider' import { Provider as SessionProvider, @@ -42,7 +43,7 @@ SplashScreen.preventAutoHideAsync() function InnerApp() { const colorMode = useColorMode() - const {isInitialLoad} = useSession() + const {isInitialLoad, currentAccount} = useSession() const {resumeSession} = useSessionApi() // init @@ -69,19 +70,25 @@ function InnerApp() { */ return ( - <UnreadNotifsProvider> - <ThemeProvider theme={colorMode}> - <analytics.Provider> - {/* All components should be within this provider */} - <RootSiblingParent> - <GestureHandlerRootView style={s.h100pct}> - <TestCtrls /> - <Shell /> - </GestureHandlerRootView> - </RootSiblingParent> - </analytics.Provider> - </ThemeProvider> - </UnreadNotifsProvider> + <React.Fragment + // Resets the entire tree below when it changes: + key={currentAccount?.did}> + <LoggedOutViewProvider> + <UnreadNotifsProvider> + <ThemeProvider theme={colorMode}> + <analytics.Provider> + {/* All components should be within this provider */} + <RootSiblingParent> + <GestureHandlerRootView style={s.h100pct}> + <TestCtrls /> + <Shell /> + </GestureHandlerRootView> + </RootSiblingParent> + </analytics.Provider> + </ThemeProvider> + </UnreadNotifsProvider> + </LoggedOutViewProvider> + </React.Fragment> ) } |