-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
103 lines (92 loc) · 2.41 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, { useState } from 'react';
import AccountManager from 'react-native-account-manager';
import {
SafeAreaView,
TextInput,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
function App() {
const [accountDevices, setAccountDevices] = useState([]);
const [textUsername, setTextUsername] = useState('');
const [textPassword, setTextPassword] = useState('');
const getAccountInDevice = () => {
AccountManager.getAccountsByType('com.accountmanager').then((accounts) => {
console.log('available accounts', accounts);
setAccountDevices(accounts);
// console.log(firstAccount);
// AccountManager.getUserData(firstAccount, 'com.accountmanager').then((storedData) => {
// console.log('stored data for storeKey', storedData);
// AccountManager.setUserData(account, 'storedKey', JSON.stringify({foo: "bar"})).then(() => {
// // console.log('data successfully stored');
// })
// });
})
}
return (
<SafeAreaView>
<View style={{padding: 50}}>
<View style={styles.blockInput}>
<Text style={styles.label}>Username:</Text>
<TextInput
onChangeText={setTextUsername}
style={styles.textInput}
/>
</View>
<View style={styles.blockInput}>
<Text style={styles.label}>Password:</Text>
<TextInput
onChangeText={setTextPassword}
style={styles.textInput}
secureTextEntry={true}
/>
</View>
<TouchableOpacity
style={styles.blockButton}
onPress={getAccountInDevice}>
<Text style={styles.buttonSubmit}>Submit</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
textInput: {
// color
borderColor: 'black',
borderWidth: 0.5,
borderRadius: 30,
// padding
paddingHorizontal: 20,
},
label: {
fontWeight: 'bold',
marginBottom: 10,
},
buttonSubmit: {
paddingHorizontal: 20,
paddingVertical: 10,
// color
backgroundColor: '#0099FF',
color: 'white',
// border
borderRadius: 30,
},
blockInput: {
marginBottom: 10,
},
blockButton: {
alignItems: 'center',
marginTop: 10,
}
})
export default App;