Android package https://github.com/soarcn/BottomSheet
$ npm install rn-action-sheet --save
$ react-native link rn-action-sheet
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜rn-action-sheet
and addRNActionSheet.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNActionSheet.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.ronal2do.RNActionSheetPackage;
to the imports at the top of the file - Add
new RNActionSheetPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':rn-action-sheet' project(':rn-action-sheet').projectDir = new File(rootProject.projectDir, '../node_modules/rn-action-sheet/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':rn-action-sheet')
import RNActionSheet from 'rn-action-sheet';
onPress = () => RNActionSheet.show({
options: ['Banana', 'Orange', 'Apple', 'Mango', 'Lemon', 'Cancel'],
title: 'Mix Salad',
dark: this.state.dark, // boolean
showCancel: true, // android only, to show cancel button
cancelButtonIndex: 5,
}, value => {
console.log(value);
})
onShare = () => RNActionSheet.showShare({
url: 'https://your_url.com',
subject: 'Share',
message: 'Simple share',
}, (value) => {
alert(value);
}, (resultcode, path) => {
console.log(resultcode);
console.log(path);
})