From a995e8dcd5b7aa6a7aaf10611ce66c339e318593 Mon Sep 17 00:00:00 2001 From: simek Date: Fri, 28 Feb 2020 17:03:22 +0100 Subject: [PATCH 1/5] add Snack example for ActionSheetIOS --- docs/actionsheetios.md | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/actionsheetios.md b/docs/actionsheetios.md index e81a917d962..aa3a6a8fe72 100644 --- a/docs/actionsheetios.md +++ b/docs/actionsheetios.md @@ -3,6 +3,56 @@ id: actionsheetios title: ActionSheetIOS --- +Displays native to iOS [Action Sheet](https://developer.apple.com/design/human-interface-guidelines/ios/views/action-sheets/) component. + +### Example + +```SnackPlayer name=ActionSheetIOS&supportedPlatforms=ios +import React from 'react'; +import { ActionSheetIOS, Button, StyleSheet, Text, View } from 'react-native'; + +export default App = () => { + const [result, setResult] = React.useState('🔮'); + + const onPress = () => ( + ActionSheetIOS.showActionSheetWithOptions( + { + options: ['Cancel', 'Generate number', 'Reset'], + destructiveButtonIndex: 2, + cancelButtonIndex: 0, + }, + (buttonIndex) => { + if (buttonIndex === 0) { + // cancel action + } else if (buttonIndex === 1) { + setResult(Math.floor(Math.random() * 100) + 1); + } else if (buttonIndex === 2) { + setResult('🔮'); + } + } + ) + ); + + return ( + + {result} +