about summary refs log tree commit diff
path: root/src/view/com/auth/Onboarding.tsx
blob: 6ea8cd79e1549e5b57a0e5d827783a4d1bf157f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from 'react'
import {SafeAreaView} from 'react-native'
import {observer} from 'mobx-react-lite'
import {ErrorBoundary} from 'view/com/util/ErrorBoundary'
import {s} from 'lib/styles'
import {usePalette} from 'lib/hooks/usePalette'
import {useStores} from 'state/index'
import {Welcome} from './onboarding/Welcome'
import {RecommendedFeeds} from './onboarding/RecommendedFeeds'

export const Onboarding = observer(function OnboardingImpl() {
  const pal = usePalette('default')
  const store = useStores()

  React.useEffect(() => {
    store.shell.setMinimalShellMode(true)
  }, [store])

  const next = () => store.onboarding.next()
  const skip = () => store.onboarding.skip()

  return (
    <SafeAreaView testID="onboardingView" style={[s.hContentRegion, pal.view]}>
      <ErrorBoundary>
        {store.onboarding.step === 'Welcome' && (
          <Welcome skip={skip} next={next} />
        )}
        {store.onboarding.step === 'RecommendedFeeds' && (
          <RecommendedFeeds next={next} />
        )}
      </ErrorBoundary>
    </SafeAreaView>
  )
})