diff options
Diffstat (limited to 'src/screens/Signup.tsx')
-rw-r--r-- | src/screens/Signup.tsx | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/screens/Signup.tsx b/src/screens/Signup.tsx index bab7abc1c..1d5915d65 100644 --- a/src/screens/Signup.tsx +++ b/src/screens/Signup.tsx @@ -1,24 +1,36 @@ import React from 'react' +import {Text, Button, View, ActivityIndicator} from 'react-native' +import {observer} from 'mobx-react-lite' import {Shell} from '../platform/shell' -import {Text, Button, View} from 'react-native' import type {RootTabsScreenProps} from '../routes/types' import {useStores} from '../state' -export function Signup({navigation}: RootTabsScreenProps<'Signup'>) { - const store = useStores() - return ( - <Shell> - <View style={{justifyContent: 'center', alignItems: 'center'}}> - <Text style={{fontSize: 20, fontWeight: 'bold'}}>Create Account</Text> - <Button - title="Create new account" - onPress={() => store.session.setAuthed(true)} - /> - <Button - title="Log in to an existing account" - onPress={() => navigation.navigate('Login')} - /> - </View> - </Shell> - ) -} +export const Signup = observer( + ({navigation}: RootTabsScreenProps<'Signup'>) => { + const store = useStores() + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Create Account</Text> + {store.session.uiError ?? <Text>{store.session.uiError}</Text>} + {store.session.uiState === 'idle' ? ( + <> + <Button + title="Create new account" + onPress={() => + store.session.createTestAccount('http://localhost:1986') + } + /> + <Button + title="Log in to an existing account" + onPress={() => navigation.navigate('Login')} + /> + </> + ) : ( + <ActivityIndicator /> + )} + </View> + </Shell> + ) + }, +) |