UNPKG

3.07 kBMarkdownView Raw
1# react-native-store-review
2
3This module exposes the native APIs to ask the user to rate the app in the iOS App Store or Google Play store directly from within the app (requires iOS >= 12.4 or Android 5.0 with Google Play store installed).
4
5<img width="274" alt="Rating Dialog" src="https://cloud.githubusercontent.com/assets/378279/24377493/d22eb0b8-133f-11e7-9968-44d186a3801f.png">
6
7## Installation
8
9```bash
10# Add dependency
11yarn add react-native-store-review
12# Link iOS dependency
13pod install --project-directory=ios
14# Compile project
15react-native run-ios # or run-android
16```
17
18## Usage
19
20The intention of this API is to ask the user to rate the app as a part of the user journey, typically as the user completes a task. **Since it's not possible to know if a dialog will be shown or not you should not call it as a result of tapping a button**, but rather as a side effect of an event happening in the app.
21
22```js
23import * as StoreReview from 'react-native-store-review';
24
25StoreReview.requestReview();
26```
27
28### Button
29
30If you want to show a button or provide a fallback for OS versions not supporting these APIs, you can redirect the user to the respective stores to review the app there instead.
31
32```js
33import { Linking, Platform } from 'react-native';
34
35const APP_STORE_LINK = `itms-apps://apps.apple.com/app/id${IOS_APP_ID}?action=write-review`;
36const PLAY_STORE_LINK = `market://details?id=${ANDROID_APP_ID}`;
37
38const STORE_LINK = Platform.select({
39 ios: APP_STORE_LINK,
40 android: PLAY_STORE_LINK,
41});
42
43export const openReviewInStore = () => Linking.openURL(STORE_LINK)
44```
45
46## References
47
48* [`SKStoreReviewController` for App Store](https://developer.apple.com/documentation/storekit/skstorereviewcontroller/requesting_app_store_reviews)
49* [`In-App Review API` for Google Play Store](https://developer.android.com/guide/playcore/in-app-review).
50
51## Troubleshooting
52
53### The dialog is not showing in the correct language on iOS
54
55The strings in the dialog comes from the OS, if your translations are purely in JavaScript land you need to add meta data so iOS understand which languages you support, [see the official documentation](https://developer.apple.com/documentation/xcode/localization/adding_support_for_languages_and_regions).
56
57### The dialog is not showing when I call `requestReview()`
58
59#####(1)
60For iOS you have to add LSApplicationQueriesSchemes as Array param to Info.plist and add itms-apps as one of params in this array to link appstore.
61
62For example:
63```js
64<key>LSApplicationQueriesSchemes</key>
65<array>
66 <string>itms-apps</string>
67</array>
68```
69
70##### or (2)
71The dialog **is not showing while testing with TestFlight** but will be working normally once in production ([source](https://stackoverflow.com/questions/46770549/skstorereviewcontroller-requestreview-popup-is-not-showing-in-testflight-build/47048474#47048474)). Furthermore it will not work for enterprise apps as they are not available on the App Store, and Apple/Google will restrict the amount of times the API can be called to a few times per year in order prevent misuse.