You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
903 B

import prompt from 'react-native-prompt-android';
module.exports = (title, text, isCancelable = true) => {
6 years ago
return new Promise((resolve, reject) => {
const buttons = isCancelable
? [
{
text: 'Cancel',
onPress: () => {
reject(Error('Cancel Pressed'));
},
style: 'cancel',
6 years ago
},
{
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: 'secure-text',
cancelable: isCancelable,
});
});
};