2.9.0 • Published 1 year ago

react-native-bottomsheet v2.9.0

Weekly downloads
1,139
License
MIT
Repository
github
Last release
1 year ago

react-native-bottomsheet

react-native-bottomsheet is a cross-platform ActionSheet for both Android and iOS. It uses original ActionSheet on iOS and soarcn BottomSheet on Android with some minor fixes, such as title and list item margins.

Update: The library now uses a copy of original lib (source copied) so you can modify it whenever you need to.

bottomsheet

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

BottomSheet.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 @clip-sub/react-native-bottomsheet

Then:

- If you are using React Native 0.60+

You don't have to do anything, since it will be linked automatically for you.

- If you are using React Native 0.59 and below

Then link the native module, since we are using native bottom sheet on Android:

react-native link react-native-bottomsheet

Or you can link it manually in MainApplication.java

import com.clipsub.rnbottomsheet.RNBottomSheetPackage; // Import this

....
@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
       new RNBottomSheetPackage() // Add this
  );
}

Usage

Import the package

import BottomSheet from 'react-native-bottomsheet';

Use it like how you do with ActionSheet.

BottomSheet.showBottomSheetWithOptions(options: Object, callback: Function)
BottomSheet.showShareBottomSheetWithOptions(options: Object, failureCallback: Function, successCallback: Function)

Example:

import BottomSheet from 'react-native-bottomsheet';
...
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);
})
2.9.0

1 year ago

2.5.2

3 years ago

2.5.0

3 years ago

2.2.0

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.9.5

5 years ago

1.9.3

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.7

7 years ago

1.7.6

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago