Initialisation documentation is wrong, crashes the app
Closed this issue · 2 comments
I've tried initialising your SDK using the commands on the readme:
import RNRefiner from 'refiner-react-native';
RNRefiner.initialize("PROJECT_ID");
This results in in an app crash / typeerror saying RNRefiner doesn't exist.
If I look at your example app, it's initialised by doing:
import {NativeModules, NativeEventEmitter} from 'react-native'
export const RNRefiner = NativeModules.RNRefiner;
export const RNRefinerEventEmitter = new NativeEventEmitter(RNRefiner);
When I use this method, it works fine. Suggest you either update the readme to use this instead of import RNRefiner from 'refiner-react-native'
, or update the package so that importing 'refiner-react-native' loads an initialisable object.
Cheers!
Thank you for letting us know, I updated the readme 👍
@tekinalper Updating the readme is not the correct fix here, no other RN library makes you do this. This bug is simply that import RNRefiner from 'refiner-react-native';
should actually be import { RNRefiner } from 'refiner-react-native';
. And your example application should do this instead. OR make the packages index.js
export RNRefiner as the default export, in which case the import without the {} will work fine.