BlueWallet/prompt.js

28 lines
563 B
JavaScript
Raw Normal View History

2018-03-31 02:03:58 +02:00
import { AlertIOS } from 'react-native';
2018-09-18 08:48:53 +02:00
module.exports = (title, text) => {
return new Promise((resolve, reject) => {
2018-03-31 02:03:58 +02:00
AlertIOS.prompt(
title,
text,
[
2018-09-18 08:48:53 +02:00
{
text: 'Cancel',
onPress: () => {
reject(Error('Cancel Pressed'));
},
style: 'cancel',
},
2018-03-31 02:03:58 +02:00
{
text: 'OK',
onPress: password => {
console.log('OK Pressed, password: ' + password);
resolve(password);
},
},
],
'secure-text',
);
});
};