From 9f3ef48f65b9e5631e41241e1309725c71cfc643 Mon Sep 17 00:00:00 2001 From: Kevin Lacker Date: Fri, 16 Dec 2016 16:27:09 -0800 Subject: [PATCH] Added info about a cancelable option for Alerts on Android. Summary: In the 8e2906ae89660c977e66f2f8fae883d70acac9bf commit there was implemented a cancelable option for Alerts. It wasn't clear from the docs about this option and the additional Alert method's parameter. Closes https://github.com/facebook/react-native/pull/11292 Differential Revision: D4342707 Pulled By: lacker fbshipit-source-id: dc243b868106e705040e77bc90d4d9b8c2dc26eb --- Libraries/Alert/Alert.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index 8330e01bb..30784e178 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -52,6 +52,11 @@ type Options = { * - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK') * - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK') * + * Note that by default alerts on Android can be dismissed by clicking outside of their alert box. + * To prevent this behavior, you can provide + * an optional `options` parameter `{ cancelable: false }` to the Alert method. + * + * Example usage: * ``` * // Works on both iOS and Android * Alert.alert( @@ -61,7 +66,8 @@ type Options = { * {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, * {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, * {text: 'OK', onPress: () => console.log('OK Pressed')}, - * ] + * ], + * { cancelable: false } * ) * ``` */