Skip to content

Wootric/react-native-wootric

Repository files navigation

circle-ci: build License: MIT

react-native-wootric

Getting started

$ npm install @wootric/react-native-wootric --save

iOS

Install the WootricSDK using Cocoapods

$ cd ios
$ pod install

ReactNative <= 0.60

As @wootric/react-native-wootric contains native codes so requires your project to link our native module library:

$ react-native link @wootric/react-native-wootric //Do not run if you are using React Native version 0.60 or greater.

Autolinking is a replacement for react-native link. If you have been using React Native before version 0.60, please unlink native dependencies if you have any from a previous install.

Manual installation

Linking Libraries

Windows

Support for Windows is currently not available.

Usage

import RNWootric from '@wootric/react-native-wootric';

RNWootric.configureWithClientID("client_id", "account_token"); //replace `client_id` and `account_token` with yours from Wootric dashboard account settings.
RNWootric.setEndUserEmail("react_example@wootric.com");
RNWootric.setSurveyImmediately(true);
RNWootric.forceSurvey(true);
RNWootric.setEndUserCreatedAt(1234567890);
RNWootric.setEndUserExternalId("external_id_1234");
RNWootric.setEndUserPhoneNumber("+17865551234");
RNWootric.setEndUserProperties({first_name: "React", last_name: "Native"});
RNWootric.showOptOut(true);
RNWootric.setFirstSurveyAfter(5);
RNWootric.setCustomLanguage("ES");
RNWootric.setCustomProductName("Wootric React Native");
RNWootric.setCustomAudience("un amigo");
RNWootric.showDisclaimerText("Learn how we handle your feedback","https://example.com/terms-of-use","here");
RNWootric.eventEmitter.addListener("surveyWillShow", () => console.log("surveyWillShow"));
RNWootric.eventEmitter.addListener("surveyDidShow", () => console.log("surveyDidShow"));
RNWootric.eventEmitter.addListener("surveyWillHide", () => console.log("surveyWillHide"));
RNWootric.eventEmitter.addListener("surveyDidHide", values => console.log("surveyDidHide", values));
RNWootric.showSurvey();

Possible Errors and Solutions

  1. If link fails then please delete node_modules dir and package-lock.json from your react native project and run npm install again.

  2. If you get Error:Execution failed for task ':app:processDebugResources'. > java.io.IOException: Could not delete folder “” while running your react native for android (ex. react-native run-android) then please clean your android project (ex. gradlew clean) and run project again.

License

MIT License

About

React Native wrapper for Wootric

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •