Clip-sub/react-native-bottomsheet

undefined is not an object evaluating '_reactNativeBottomsheet2.default.showBottomSheetWithOptions'

Closed this issue · 10 comments

I'm gettings this error when trying this on Android:

BottomSheet.showBottomSheetWithOptions({
options: SORT_OPTIONS,
title: Strings.Sort,
dark: true,
cancelButtonIndex: SORT_OPTIONS.length - 1,
}, (value) => {
this.sort(value);
});

BottomSheet is always undefined in Android.
react-native: 0.48
react: 16.0.0-alpha.12
react-native-bottomsheet: 1.8.1

news?

Have you linked it yet?

react-native link react-native-bottomsheet

I fix this issue by adding the following code to MainApplication.java

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

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

I hope it help

Thank you, I will update the README file.

I still get this error although I linked as mentioned in README. Any solution?

@mstfymrtc you have to do what i said in a comment above

MainApplication.java file already contain lines which you've written above.

In app build.gradle, add

compile project(':react-native-bottomsheet')

Then in MainApplication.java, add

import com.clipsub.rnbottomsheet.RNBottomSheetPackage;

new RNBottomSheetPackage()