1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Handle reserved names in RN

This commit is contained in:
Laurent Cozic
2017-07-15 17:25:33 +01:00
parent 0e05567706
commit e3db1e028a
3 changed files with 26 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import DialogBox from 'react-native-dialogbox';
import { Keyboard } from 'react-native';
// Add this at the bottom of the component:
//
@ -10,6 +11,8 @@ dialogs.confirm = (parentComponent, message) => {
if (!'dialogbox' in parentComponent) throw new Error('A "dialogbox" component must be defined on the parent component!');
return new Promise((resolve, reject) => {
Keyboard.dismiss();
parentComponent.dialogbox.confirm({
content: message,
@ -26,7 +29,14 @@ dialogs.confirm = (parentComponent, message) => {
},
});
})
});
};
dialogs.error = (parentComponent, message) => {
Keyboard.dismiss();
return parentComponent.dialogbox.alert(message);
}
dialogs.DialogBox = DialogBox
export { dialogs };