Wootric / react-native-wootric

React Native wrapper for Wootric
MIT License
2 stars 17 forks source link

Fix survey not showing up & add forceSurvey method #26

Closed diegoserranoa closed 2 years ago

diegoserranoa commented 2 years ago

Fix Android error preventing survey to show up java.lang.IllegalStateException: Method addObserver must be called on the main thread and add forceSurvey method

Test

  1. Create a ReactNative app
$ npx react-native init TestApp
$ cd TestApp
  1. Add the library from this branch
$ npm install https://github.com/Wootric/react-native-wootric.git#ds-update-library --save
  1. Modify App.js file:
import RNWootric from '@wootric/react-native-wootric';

RNWootric.configureWithClientID(YOUR_CLIENT_ID, YOUR_ACCOUNT_TOKEN);
RNWootric.setSurveyImmediately(true);
RNWootric.setEndUserEmail("test@email.com");
RNWootric.setEndUserCreatedAt(1234567890);
RNWootric.setEndUserProperties({platform: "React Native"});
RNWootric.showSurvey();
  1. Run app in Android
$ npx react-native run-android