-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
64 lines (59 loc) · 1.43 KB
/
App.js
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
54
55
56
57
58
59
60
61
62
63
64
import React, { useState} from 'react';
import sdk from './src/config';
import {
SafeAreaView,
StyleSheet,
View,
TextInput,
Button,
Text,
} from 'react-native';
function App() {
const [alert, setAlert] = useState('');
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
function handleSubmit() {
sdk.account
.create(email, password, name)
.then(setAlert('User created successfully'))
.catch(setAlert('User created successfully'));
}
return (
<SafeAreaView>
<View style={styles.container}>
<Text>{alert}</Text>
<TextInput
style={styles.input}
placeholder="Name"
onChangeText={nameText => setName(nameText)}
/>
<TextInput
style={styles.input}
placeholder="Email"
onChangeText={nameEmail => setEmail(nameEmail)}
/>
<TextInput
style={styles.input}
placeholder="Password"
onChangeText={namePassword => setPassword(namePassword)}
/>
<Button title="Sign Up" onPress={() => handleSubmit()} />
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
centerContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
input: {
borderWidth: 1,
borderColor: '#ccc',
padding: 10,
margin: 10,
},
});
export default App;