https://github.com/doochik/simpleactionsheetios
Handy wrapper for react-native ActionSheetIOS
https://github.com/doochik/simpleactionsheetios
Last synced: over 1 year ago
JSON representation
Handy wrapper for react-native ActionSheetIOS
- Host: GitHub
- URL: https://github.com/doochik/simpleactionsheetios
- Owner: doochik
- License: mit
- Created: 2017-08-08T07:22:38.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-08T09:17:21.000Z (almost 9 years ago)
- Last Synced: 2025-03-06T15:51:09.222Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://badge.fury.io/js/react-native-simple-action-sheet-ios)
# SimpleActionSheetIOS
Handy wrapper for react-native ActionSheetIOS.
`ActionSheetIOS.showActionSheetWithOptions` has inconvenient API:
```
ActionSheetIOS.showActionSheetWithOptions({
options: [
'button1',
'button2',
'button3',
],
cancelButtonIndex: 2,
destructiveButtonIndex: 0
}, (buttonIndex) => {
if (buttonIndex === 0) {
// do something...
} else if (buttonIndex === 1) {
// do something...
}
})
```
SimpleActionSheetIOS simplifies this API
```
import simpleActionSheetIOS from 'react-native-simple-action-sheet-ios';
simpleActionSheetIOS({
options: [
{ title: 'button1', callback: myFn1, isDestructive: true },
{ title: 'button2', callback: myFn2 },
{ title: 'button3', callback: myFn3, isCancel: true },
]
});
```