Skip to content

Commit

Permalink
Update to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanPV committed May 3, 2017
1 parent 1795020 commit 2a6875a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,35 @@

RNBottomSheet is a cross-platform ActionSheet for both Android and iOS. It uses original ActionSheet on iOS and [soarcn BottomSheet](https://github.com/soarcn/BottomSheet) on Android with some minor fixes, such as title and list item margins.

Note: On Android, "message" property is not available.
Note: On Android, `message` property is not available. Instead, there's an `dark` option to turn on Dark Mode like so:

```
RNBottomSheet.showBottomSheetWithOptions({
options: ['Option 1', 'Option 2', 'Option 3'],
title: 'Demo Bottom Sheet',
dark: true,
cancelButtonIndex: 3,
}, (value) => {
alert(value);
});
```

## Installation

First, install the npm package:
```
npm install --save react-native-bottomsheet
```
Then link the native module, since we are using native bottom sheet on Android:
```
react-native link react-native-bottomsheet
```

## Demo

Coming soon...
![Android](https://s17.postimg.org/pjlqnhgz3/android.png "Android")

![iOS](https://s17.postimg.org/cthiae90v/ios.png "iOS")

## Usage

Expand All @@ -24,4 +43,32 @@ import BottomSheet from 'react-native-bottom-sheet';
````
BottomSheet.showBottomSheetWithOptions(options: Object, callback: Function)
BottomSheet.showShareBottomSheetWithOptions(options: Object, failureCallback: Function, successCallback: Function)
````
````

Example:

```
import BottomSheet from 'react-native-bottom-sheet';
...
BottomSheet.showBottomSheetWithOptions({
options: ['Option 1', 'Option 2', 'Option 3'],
title: 'Demo Bottom Sheet',
dark: true,
cancelButtonIndex: 3,
}, (value) => {
alert(value);
});
```

```
BottomSheet.showShareBottomSheetWithOptions({
url: 'https://google.com',
subject: 'Share',
message: 'Simple share',
}, (value) => {
alert(value);
}, (resultcode, path) => {
alert(resultcode);
alert(path);
})
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.stetho.common.StringUtil;

import org.json.JSONObject;

Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NativeModules, Platform, ActionSheetIOS } from 'react-native';
import { NativeModules, Platform } from 'react-native';
import BottomSheetIOS from "./module.ios";

export default Platform.OS === 'ios' ? ActionSheetIOS : NativeModules.RNBottomSheet;
export default Platform.OS === 'ios' ? BottomSheetIOS : NativeModules.RNBottomSheet;
14 changes: 14 additions & 0 deletions module.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
import { ActionSheetIOS } from 'react-native';

const BottomSheetIOS = {
showBottomSheetWithOptions: (options, callback) => {
return ActionSheetIOS.showActionSheetWithOptions(options, callback);
},

showShareBottomSheetWithOptions: (options, failureCallback, successCallback) => {
return ActionSheetIOS.showShareActionSheetWithOptions(options, failureCallback, successCallback);
}
}

export default BottomSheetIOS;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-bottomsheet",
"version": "1.0.0",
"version": "1.1.0",
"description": "True Cross-platform ActionSheet for Android and iOS",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2a6875a

Please sign in to comment.