A powerful and easy-to-use library for implementing in-app ratings in React Native applications.
- π Easy integration with React Native projects
- π Cross-platform support (iOS and Android)
- π± Supports Android 5+ (API level 21+) and iOS 14+
- ποΈ Supports the new architecture for React Native
- π Supports multiple app stores:
- Google Play Store
- Samsung Galaxy Store
- Huawei AppGallery
- Apple App Store (iOS)
yarn add react-native-rate-app
or
npm install react-native-rate-app
To use the in-app review functionality on iOS, you need to add the StoreKit
framework to your project and update your Info.plist
file.
- Open your project in Xcode.
- Select your project in the Project Navigator.
- Select your app target.
- Go to the "Build Phases" tab.
- Expand the "Link Binary With Libraries" section.
- Click the "+" button and add
StoreKit.framework
.
To allow your app to open the App Store and handle the in-app review functionality, you need to add the LSApplicationQueriesSchemes
key to your Info.plist
file.
- Open your
Info.plist
file. - Add
itms-apps
string
Example:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>itms-apps</string>
</array>
This library will throw an error if something goes wrong during the execution of its methods. Make sure to handle these errors appropriately in your application.
Requests a review from the user using the native in-app review dialog.
options
(optional): An object containing the following properties:androidMarket
(optional): The market where the app's review request should be directed on Android. Defaults toAndroidMarket.GOOGLE
. Supported values are:AndroidMarket.GOOGLE
: Google Play StoreAndroidMarket.SAMSUNG
: Samsung Galaxy StoreAndroidMarket.HUAWEI
: Huawei AppGallery
androidPackageName
(optional): The package name of the app to request a review for on Samsung Galaxy Store.
const result = await RateApp.requestReview();
console.log(result); // true if successful, false otherwise
Please note that the in-app rating functionality for Huawei AppGallery and Samsung Galaxy Store has not been thoroughly tested. While the implementation follows the respective guidelines, we recommend conducting your own tests to ensure compatibility and functionality within your application environment.
To enable in-app reviews for the Huawei AppGallery, ensure that your app is correctly configured with Huawei Mobile Services (HMS). This functionality leverages Huawei In-App Comments mechanism.
To enable in-app reviews for the Samsung Galaxy Store, ensure that your app is correctly configured. You must provide the androidPackageName
specific to the Samsung Galaxy Store. This functionality leverages the Galaxy Store Broadcast mechanism.
- Quotas: In-app reviews are subject to rate limits set by the operating system. This means the review dialog might not always appear to the user, depending on how often it has been requested previously. Note that
requestReview
will returntrue
even if the rate limits have been reached. For more information, please refer to the official documentation from Apple and Google. - Development Mode: The in-app review dialog is always displayed in development mode, regardless of rate limits. This is useful for testing purposes.
- Best Practices: According to operating system guidelines, it is recommended to request a review during a natural flow in your app, rather than from a button. For example, you might request a review after a user has completed a task or achieved a milestone within your app.
Apple Documentation
Google Documentation
Opens the app store page for the app, allowing the user to leave a review.
const result = await RateApp.openStoreForReview({
iOSAppId: "your-ios-app-id", // Required on iOS, macOS
androidPackageName: "your.android.package.name", // Required on Android
androidMarket: AndroidMarket.GOOGLE, // Optional, defaults to GOOGLE
});
console.log(result); // true if successful, false otherwise
The androidMarket
option in RateApp.openStoreForReview
supports the following markets:
AndroidMarket.GOOGLE
: Google Play StoreAndroidMarket.AMAZON
: Amazon AppstoreAndroidMarket.SAMSUNG
: Samsung Galaxy StoreAndroidMarket.HUAWEI
: Huawei AppGallery
You need to add the LSApplicationQueriesSchemes
key to your Info.plist
file to allow your app to open the App Store.
- Open your
Info.plist
file. - Add the following entry:
We welcome contributions! Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
If you like this project, please consider supporting it by giving it a βοΈ on GitHub!
- create-react-native-library for the initial project setup