forked from BlueWallet/BlueWallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.js
37 lines (35 loc) · 916 Bytes
/
prompt.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
import prompt from 'react-native-prompt-android';
module.exports = (title, text, isCancelable = true, type = 'secure-text') => {
return new Promise((resolve, reject) => {
const buttons = isCancelable
? [
{
text: 'Cancel',
onPress: () => {
reject(Error('Cancel Pressed'));
},
style: 'cancel',
},
{
text: 'OK',
onPress: password => {
console.log('OK Pressed, password: ' + password);
resolve(password);
},
},
]
: [
{
text: 'OK',
onPress: password => {
console.log('OK Pressed, password: ' + password);
resolve(password);
},
},
];
prompt(title, text, buttons, {
type: type,
cancelable: isCancelable,
});
});
};