react-native-android-action-sheet
react-native-android-action-sheet is a JavaScript library for React Native, it implements AcionSheet for Android relys on AndroidActionSheet.
Installing react-native-android-action-sheet
npm install rn-android-actionsheet --save
Android
android/setting.gradle
...include ':react-native-android-action-sheet'project(':react-native-android-action-sheet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-action-sheet/android')
android/app/build.gradle
dependencies { ... compile project(":react-native-android-action-sheet")}
In react-native < 0.29.0
- Register Module (in MainActivity.java)
In react-native >= 0.29.0
- Register Module (in MainApplication.java)
Usage
; //both on iOS and Android { let btns = 'Option 0' 'Option 1' 'Option 2' 'Delete' 'Cancel' ; let params = 'options': btns 'cancelButtonIndex': 4 'destructiveButtonIndex': 3 'title': 'ActionSheet' ; ActionSheet;} //Android only { let title = 'title': 'CustomActionSheet' 'titleColor': '#0000ff' ; let cancelBtn = 'btnTitle': 'Cancel' 'btnTitleColor': '#00ffff' ; let optionBtns = 'btnTitle': 'Option 0' 'btnTitleColor': '#6aa84f' 'btnTitle': 'Option 1' 'btnTitleColor': '#000000' 'btnTitle': 'Option 2' 'btnTitleColor': '#7f6000' 'btnTitle': 'Delete' 'btnTitleColor': '#ff0000' ; let params = 'title': title 'optionBtns': optionBtns 'cancelBtn': cancelBtn ActionSheet;}