Skip to content

wynnej1983/react-native-appirater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Downloads

react-native-appirater

react-native wrapper around ios app rating component

##Installation

First you need to install react-native-appirater:

npm install react-native-appirater --save

Installation (iOS)

In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name] ➜ Go to node_modules ➜ react-native-appirater and add the .xcodeproj file

In XCode, in the project navigator, select your project. Add the lib*.a from the appirater project to your project's Build Phases ➜ Link Binary With Libraries. Then, click on the .xcodeproj file you added before in the project navigator, and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React - mark both as recursive.

Installation (Android)

...
include ':RNAppirater'
project(':RNAppirater').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-appirater/android')
  • In android/app/build.gradle
...
dependencies {
  ...
  compile project(':RNAppirater')
}
  • Register the module (in MainActivity.java)
import com.wynnej1983.RNAppirater.*; // <--- import

public class MainActivity extends Activity {
  ...

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNAppirater()            //  <--- add here
      );
    }
  }
}

Usage

Usage (iOS)

Usage (Android)

Copy the /res/values/appirater-settings.xml from the AppiraterAndroid library in to your projects /res/values/ folder and adjust the settings to your preference.

To always show the popup for testing purposes set appirator_test_mode to true in the copied over appirater-settings.xml file in your project.

<bool name="appirator_test_mode">true</bool>

Note on Usage

Example

//import module
import Appirater from 'react-native-appirater';

componentWillMount() {
  //set app id
  Appirater.setAppId('123');
  Appirater.setDebug(true);
  Appirater.appLaunched(true);
  Appirater.appEnteredForeground(true);
}
...

//register user significant event
...
Appirater.userDidSignificantEvent();

About

react-native wrapper around ios app rating component

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published