react-native-cross-actionsheet
Simple to use, static API, cross platform ActionSheets using Native Android ActionSheets and ActionSheetIOS.
- Native Android ActionSheets
- Simple API that can be statically called (no JSX components)
- Feature parity with iOS
- Modern sleek UI
- Typescript support
- Async support
Quickstart
yarn: yarn add react-native-cross-actionsheet
npm: npm install react-native-cross-actionsheet
Preview
Android | iOS |
---|---|
![]() |
![]() |
Usage
ActionSheet.options
It's recommended to use the ActionSheet.options
API as it is cleaner, more straightforward to use, and allows awaiting
.
Name | Type | Required | Default |
---|---|---|---|
title | string | No | |
message | string | No | |
options | { text, onPress, destructable } | Yes | |
.text | string | Yes | |
.onPress | () => void | No | |
.destructable | boolean | No | false |
cancel | { text, onPress } OR false | Yes | |
.text | string | No | 'Cancel' |
.onPress | () => void | No | |
tintColor | string (eg. '#0088FF') | No | |
anchor (iOS) | number | No |
Simple
Additional Options
Disable Cancel
ActionSheet.showActionSheetWithOptions
If you wish to stick with the traditional API, you can call ActionSheet.showActionSheetWithOptions
, which uses the exact same API as ActionSheetIOS.
anchor
is only used for iOS.
Simple
Additional Options
Only require usage of ActionSheetAndroid
If you only wish to import ActionSheetAndroid
as you wish to handle ActionSheets differently for different platforms, then you may import it directly: