Move onboarding to the withAuthRequired HOC
This commit is contained in:
parent
bf37913701
commit
5d9534ca72
9 changed files with 45 additions and 103 deletions
|
@ -1,23 +0,0 @@
|
|||
import React from 'react'
|
||||
import {useStores} from 'state/index'
|
||||
import {useNavigation} from '@react-navigation/native'
|
||||
import {NavigationProp} from 'lib/routes/types'
|
||||
import {isNative, isWeb} from 'platform/detection'
|
||||
|
||||
export function useOnboarding() {
|
||||
const store = useStores()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
React.useEffect(() => {
|
||||
if (store.onboarding.isActive) {
|
||||
if (isWeb) {
|
||||
store.shell.openModal({name: 'onboarding'})
|
||||
return
|
||||
}
|
||||
if (isNative) {
|
||||
navigation.navigate('Welcome')
|
||||
return
|
||||
}
|
||||
}
|
||||
}, [store.onboarding.isActive, navigation, store.shell])
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
import {NavigationState, PartialState} from '@react-navigation/native'
|
||||
import type {NativeStackNavigationProp} from '@react-navigation/native-stack'
|
||||
import {OnboardingScreenSteps} from 'state/models/discovery/onboarding'
|
||||
|
||||
export type {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||
|
||||
|
@ -30,10 +29,6 @@ export type CommonNavigatorParams = {
|
|||
CopyrightPolicy: undefined
|
||||
AppPasswords: undefined
|
||||
SavedFeeds: undefined
|
||||
} & OnboardingScreenParams
|
||||
|
||||
export type OnboardingScreenParams = {
|
||||
[K in keyof typeof OnboardingScreenSteps]: undefined
|
||||
}
|
||||
|
||||
export type BottomTabNavigatorParams = CommonNavigatorParams & {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue