From bbc3f603f1c06a4e1368990a76ee35d9371a5d02 Mon Sep 17 00:00:00 2001 From: Lukas Kurucz Date: Tue, 10 Oct 2017 03:23:53 -0700 Subject: [PATCH] Add minimal example to actionsheet Summary: Easier to understand how to use this component. A quick example helps to beginners. Closes https://github.com/facebook/react-native/pull/16110 Differential Revision: D6017956 Pulled By: shergin fbshipit-source-id: 82a340dfe8551cc8d7b692b9c71237e2b4421aba --- Libraries/ActionSheetIOS/ActionSheetIOS.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Libraries/ActionSheetIOS/ActionSheetIOS.js b/Libraries/ActionSheetIOS/ActionSheetIOS.js index ce4dbcd304e..8c3dbe55a1d 100644 --- a/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -29,6 +29,20 @@ var ActionSheetIOS = { * * The 'callback' function takes one parameter, the zero-based index * of the selected item. + * + * Minimal example: + * + * ``` + * ActionSheetIOS.showActionSheetWithOptions({ + * options: ['Remove', 'Cancel'], + * destructiveButtonIndex: 1, + * cancelButtonIndex: 0, + * }, + * (buttonIndex) => { + * if (buttonIndex === 1) { // destructive action } + * }); + * ``` + * */ showActionSheetWithOptions(options: Object, callback: Function) { invariant(