-
Notifications
You must be signed in to change notification settings - Fork 7
/
App.tsx
53 lines (44 loc) · 1.18 KB
/
App.tsx
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, { type ReactElement, useState, useEffect } from 'react'
import { Button, Platform, StyleSheet, View } from 'react-native'
import { requestPermissions } from './RequestPermissions'
import { Spacer } from './Spacer'
import { CredoScreen } from './credo/CredoScreen'
import { RegularScreen } from './regular/Screen'
export const App = () => {
const [flow, setFlow] = useState<'regular' | 'credo'>(undefined)
let component: ReactElement
useEffect(() => {
if (Platform.OS === 'android') {
void requestPermissions()
}
}, [])
if (!flow) {
component = (
<>
<Button title="credo flow" onPress={() => setFlow('credo')} />
<Spacer />
<Button title="regular flow" onPress={() => setFlow('regular')} />
</>
)
}
if (flow === 'regular') {
component = <RegularScreen />
}
if (flow === 'credo') {
component = <CredoScreen />
}
return (
<View style={styles.container}>
<Button title="reset" onPress={() => setFlow(undefined)} />
<Spacer />
{component}
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
})