react-native wrapper around ios app rating component
##Installation
First you need to install react-native-appirater:
npm install react-native-appirater --save
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
-
android impl taken mostly from https://github.com/drewjw81/appirater-android
-
In
android/settings.gradle
...
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
);
}
}
}
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>
//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();