使用原生 Android 的 React native 简单动作选单 (使用内置的 AlertDialog)
使用原生 Android 的 React native 简单动作选单 (使用内置的 AlertDialog)
React native action sheet with native android (using the built-in AlertDialog)
This module simply return the ActionSheetIOS if the device on iOS
| iOS | Android |
|---|---|
npm install react-native-action-sheet@latest --save
react-native link react-native-action-sheet
...
import com.actionsheet.ActionSheetPackage; // getPackages() { return Arrays.asList( new MainReactPackage(), new ActionSheetPackage() // { console.log('button clicked :', buttonIndex); });
## Methods
For the iOS implementation see [ActionSheetIOS](https://facebook.github.io/react-native/docs/actionsheetios.html)
#### showActionSheetWithOptions (Android)
```javascript
/**
* Display the native action sheet
*/
static showActionSheetWithOptions(options, callback);@note: on Android in case of a touch outside the ActionSheet or the hardware back button is pressed the buttonIndex value is cancelButtonIndex or 'undefined'
| option | iOS | Android | Info |
|---|---|---|---|
| options | OK | OK | (array of strings) - a list of button titles (required on iOS) |
| cancelButtonIndex | OK | Ok | (int) - index of cancel button in options |
| destructiveButtonIndex | OK | - | (int) - index of destructive button in options (same as above) |
| title | OK | OK | (string) - a title to show above the action sheet |
| message | OK | - | (string) - a message to show below the title |
| tintColor | OK | - | (string) - a color to set to the text (defined by processColor) |
暂无开放 Issues,或尚未同步最近议题。