1.0.7 • Published 7 years ago
rn-action-sheet v1.0.7
rn-action-sheet
Android package https://github.com/soarcn/BottomSheet
Getting started
$ npm install rn-action-sheet --save
Mostly automatic installation
$ react-native link rn-action-sheet
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜rn-action-sheetand addRNActionSheet.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNActionSheet.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- 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')
Usage
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);
})