GithubHelp home page GithubHelp logo

kjellconnelly / react-native-rate Goto Github PK

View Code? Open in Web Editor NEW
634.0 10.0 98.0 245 KB

Send your app users to Apple App Store, Google Play, Amazon, or other using the newest APIs

JavaScript 22.21% Objective-C 40.93% Ruby 5.40% Java 31.46%

react-native-rate's Introduction

react-native-rate

React Native Rate is a cross platform solution to getting users to easily rate your app.

Stores Supported:
Apple App Store Google Play Amazon Other Android Markets All Others
Building your app for a different Android store, you can provide your own URL If your platform isn't one of the others, you can input a fallback url to send users to instead

Getting started

$ npm i react-native-rate

Mostly automatic installation (new way with react-native v0.60+)

cd ios && pod install && cd ../

Mostly automatic installation (old way)

$ react-native link react-native-rate

Manual installation

iOS

Without CocoaPods
  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-rate and add RNRate.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNRate.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<
Using CocoaPods

Add the following to your Podfile (and run pod install):

pod 'RNRate', :path => '../node_modules/react-native-rate'

Other Platforms

Android, Windows, etc don't use any native code. So don't worry! (There still is linking to Android if you do react-native link. We only left this here so that we can call native code if there is native code to call someday.)

iOS Specific:

Users using iOS 10.3 (from 2017) and above can now use SKStoreReviewController to open a Rating Alert right from within their app. There are a few gotchas to using this ReviewController though:

  • Users are first presented with a pop up allowing them to choose 1-5 stars. If they give a numerical rating, the pop up will allow them to then write a review. They can cancel at any time, leaving you with either nothing, a rating, or a rating and review.
  • To prevent annoying popups, Apple decides whether or not you can display it, and they do not offer a callback to let you know if it was displayed or not. It is limited to being shown 3-4 times per year.
  • If you do want this ReviewController to show up, we wrote a little hack to see if it worked, and if it doesn't, we just open the App Store (using the optional for all devices pre-iOS10.3). Hopefully this hack continues to work, and hopefully Apple updates the API so we don't have to use this hack.
  • If you set options.preferInApp = true, the popup will happen on appropriate devices the first time you call it after the app is open. The hack used checks the number of windows the application has. For some reason, when the inapp window is dismissed, it is still on the stack. So if you try it again, the popup will appear (if it is 3 or less times you've done it this year), but after a short delay, the App Store will open too.
  • Due to all these issues, we recommend only setting preferInApp to true when you are absolutely sure you want a one time, rare chance to ask users to rate your app from within the app. Do not use it to spam them between levels. Do not have a button for rating/reviewing the app, and call this method. And if you want to have a really professional app, save the number of attempts to the device, along with a date. Otherwise you will get some strange behavior.
  • If you want to open via the SKStoreReviewController, but don't want the App Store App to open after the timeout, you can set openAppStoreIfInAppFails:false in options. By default, it will open after the timeout.

Android Specific for in-app popups:

  • Similar to iOS since 2017, Android FINALLY supports an in-app dialogue that allows users to rate/review your app. As of August 2020, this is our first release using Android's PlayCore in-app-review popup, so there may be some hiccups. Note that this only works for the Android Google Play store (and Chrome OS devices that have the Google Play Store installed). No Amazon marketplace, sorry :( Also requires Android 5.0 and above, which I think has been required for newer versions of React Native for at least the least year or two. So if you've updated your react-native library since probably 2018, you should be good to use this.
  • If you set preferredAndroidMarket = AndroidMarket.Google and options.preferInApp = true, it will open the native UI in the app (see Official docs).
  • Your app needs to be published at least once to the Play Store for it to show (see How to test).
  • It seems that it only shows on a real device, not on a simulator.
  • Need troubleshooting? Check out the official documentation on common problems here.
  • Want to show the in-app review dialogue even after the user has reviewed your app? Maybe they tapped a button to edit their review? Unfortunately, like Apple, Google doesn't tell us if the user has reviewed or not. So if you try to open the in-app dialogue, your callback will be SUCCESS. But actually, nothing will happen. And since it is "successful", the Play Store page won't open either. In order to handle this, I suggest 1 of two solutions. Either create a separate button that ALWAYS opens the play store (never the in-app prompt). Or create some logic to estimate if a user has rated or not. For example, if the user comes back to the app within 10 seconds, they probably didn't rate the app. Or you could just never try the in-app prompt once it has been successful once. Or, if you're a programming genius, and you know the usernames of your users, make a Google Play query and search for their review. If exists, don't try again. Ya, but I bet you won't have access to that info. But that's hopeful dreaming.

Example

import React from 'react'
import { View, Button } from 'react-native'
import Rate, { AndroidMarket } from 'react-native-rate'

export default class ExamplePage extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      rated: false
    }
  }

  render() {
    return (
      <View>
        <Button title="Rate App" onPress={()=>{
          const options = {
            AppleAppID:"2193813192",
            GooglePackageName:"com.mywebsite.myapp",
            AmazonPackageName:"com.mywebsite.myapp",
            OtherAndroidURL:"http://www.randomappstore.com/app/47172391",
            preferredAndroidMarket: AndroidMarket.Google,
            preferInApp:false,
            openAppStoreIfInAppFails:true,
            fallbackPlatformURL:"http://www.mywebsite.com/myapp.html",
          }
          Rate.rate(options, (success, errorMessage)=>{
            if (success) {
              // this technically only tells us if the user successfully went to the Review Page. Whether they actually did anything, we do not know.
              this.setState({rated:true})
            }
            if (errorMessage) {
              // errorMessage comes from the native code. Useful for debugging, but probably not for users to view
              console.error(`Example page Rate.rate() error: ${errorMessage}`)
            }
          })
        }} />
      </View>
    )
  }
}

options:

There are lots of options. You can ignore some of them if you don't plan to have them on that App Store.

Option Description
AppleAppID When you create an app in iTunes Connect, you get a number that is around 10 digits long.
GooglePackageName Created when you create an app on Google Play Developer Console.
AmazonPackageName Create when you create an app on the Amazon Developer Console.
preferredAndroidMarket This only matters if you plan to deploy to both Google Play and Amazon or other markets. Since there is no reliable way to check at run time where the app was downloaded from, we suggest creating your own build logic to decipher if the app was built for Google Play or Amazon, or Other markets. Available Options: AndroidMarket.Google, AndroidMarket.Amazon, Other
preferInApp If true and user is on iOS, tries to use SKStoreReviewController. If true and user is on Android, it will try to use the native UI. If fails for whatever reason, or user is on another platform, opens the App Store externally. Default false
fallbackPlatformURL if ((Platform.OS != 'ios) && (Platform.OS != 'android')), open this URL.
inAppDelay (IOS ONLY) Delay to wait for the InApp review dialog to show (if preferInApp == true). After delay, opens the App Store if the InApp review doesn't show. Default 3.0
openAppStoreIfInAppFails If preferInApp = true but the native iOS and Android UI failed, opens the store externally. Default true
Options Example1
// iOS only, not using in-app rating (this is the default)
const options = {
  AppleAppID:"2193813192",
}
Options Example2
// Android only, able to target both Google Play & Amazon stores. You have to write custom build code to find out if the build was for the Amazon App Store, or Google Play
import {androidPlatform} from './buildConstants/androidPlatform' // this is a hypothetical constant created at build time
const options = {
  GooglePackageName:"com.mywebsite.myapp",
  AmazonPackageName:"com.mywebsite.myapp",
  preferredAndroidMarket: androidPlatform == 'google' ? AndroidMarket.Google : AndroidMarket.Amazon
}
Options Example3
// targets only iOS app store and Amazon App Store (not google play or anything else). Also, on iOS, tries to open SKStoreReviewController.
const options = {
  AppleAppID:"2193813192",
  AmazonPackageName:"com.mywebsite.myapp",
  preferredAndroidMarket:AndroidMarket.Amazon,
  preferInApp:true,
}
Options Example4
// targets iOS, Google Play, and Amazon. Also targets Windows, so has a specific URL if Platform isn't ios or android. Like example 2, custom build tools are used to check if built for Google Play or Amazon. Prefers not using InApp rating for iOS.
import {androidPlatform} from './buildConstants/androidPlatform' // this is a hypothetical constant created at build time
const options = {
  AppleAppID:"2193813192",
  GooglePackageName:"com.mywebsite.myapp",
  AmazonPackageName:"com.mywebsite.myapp",
  preferredAndroidMarket: androidPlatform == 'google' ? AndroidMarket.Google : AndroidMarket.Amazon,
  fallbackPlatformURL:"ms-windows-store:review?PFN:com.mywebsite.myapp",
}
Options Example5
// targets 4 different android stores: Google Play, Amazon, and 2 fake hypothetical stores: CoolApps and Andrule
import {androidPlatform} from './buildConstants/androidPlatform' // this is a hypothetical constant created at build time
const options = {
  GooglePackageName:"com.mywebsite.myapp",
  AmazonPackageName:"com.mywebsite.myapp",
  preferredAndroidMarket: (androidPlatform == 'google') ? AndroidMarket.Google : (androidPlatform == 'amazon' ? AndroidMarket.Amazon : AndroidMarket.Other),
  OtherAndroidURL:(androidPlatform == 'CoolApps') ? "http://www.coolapps.net/apps/31242342" : "http://www.andrule.com/apps/dev/21312"
}
Options Example6
// Tries to open the SKStoreReviewController in app for iOS only, but if it fails, nothing happens instead of opening the App Store app after 5.0s. Technically, you do not need to add inAppDelay in options below because it has a default value. I am only writing it below to show the difference between openAppStoreIfInAppFails true/false values and what would happen after the inAppDelay.
const options = {
  AppleAppID:"2193813192",
  preferInApp:true,
  inAppDelay:5.0,
  openAppStoreIfInAppFails:false,
}

About Package Names (Google Play & Android) and Bundle Identifiers (Apple):

If you want to keep the same package name and bundle identifier everywhere, we suggest the following:

  • All lowercase letters
  • No numbers
  • Use reverse domain style: com.website.appname

I’m new to mobile development. Why is rating important?

Though this isn’t specific to this module, some new developers are not quite sure why rating is important.

First off, rating and reviews are technically two different things. Rating being typically a 1-5 star rating, and a review being text that a user writes. Both are important for different reasons.

A higher rating increases your app’s chance of being shown in search results. Some even think that ANY rating will increase your app’s chance, though I don’t know the algorithm. Some users also look at stars and weigh their decision to download or not partially on this metric.

Likewise, reviews give both developers and users good feedback on how the app is doing. Developers can use these reviews as quotes in their app description, and in some stores even reply to reviews (iOS, Google Play, Amazon, and possibly others).

Getting good reviews and good ratings will increase your app’s popularity and downloads. Of course, getting a user to rate your app is mainly about maximizing your probability of success, vs annoying them. There are a lot of articles online on how best to get users to rate your app, but we won’t go into them here.

Your job as the developer, using this module, is to create an experience for the user, and at the right time, ask them to rate. This can be in the form of a pop up, a perpetual button on a settings menu, or after being a level in a game. It’s up to you.

What does this module do when you call rate()

For those that don’t want to read through the code, this module will open a link to the App Store of your choosing based on your options and user’s device. The App Store will be on your app’s page. If possible, it will be on the Ratings/Reviews section.

If possible, the App Store will be opened in the native app for the Store (ie the App Store app). If not possible, it will be opened from the user’s browser.

The only time when the above is not true is for iOS when you setup your options to use the SKStoreReviewController. In this case, a native UI pop up (created by Apple) is displayed from within you app.

Rate.rate() success?

Success in most cases is self explanatory. But for the iOS SKStoreReviewController case:

--- success !success
{preferInApp:true} and the SKStoreReviewController successfully opens ---
{preferInApp:true, openAppStoreIfInAppFails:true} and the SKStoreReviewController fails to open, but opens the App Store App ---
{preferInApp:true, openAppStoreIfInAppFails:false} and the SKStoreReviewController fails to open, and does not open the App Store App ---

This used to work, now I'm getting an error message with react-native-rate v1.2.0

I moved the podspec file outside of the ios directory. If you use pods before this version, you may have set paths to ios/RNRate.podspec. You may need to change that back.

preferInApp works in iOS development, but not via TestFlight!

True. According to Apple's documentation, the SKStoreReviewController should work as expected while in development and production modes, but not one that is distributed via TestFlight.

Future Plans

I plan to add default support for Windows, but haven't personally built any windows app for a few years now. So will do it when it's actually relevant.

react-native-rate's People

Contributors

ardavank avatar backmeupplz avatar baloo1 avatar benlaverriere avatar bgrynblat avatar bltnico avatar chuckspartan avatar dependabot[bot] avatar ericpkerr avatar fetten avatar frikkiesnyman avatar imoby avatar janicduplessis avatar jayli3n avatar jensdebergh avatar kjellconnelly avatar maxhungry avatar mezod avatar minhloi avatar mrxyfir avatar nbashenko avatar r1ckye avatar soheilpro avatar sregg avatar tiagogouvea avatar tuanfonos avatar volfpe avatar vonovak avatar zidail avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-rate's Issues

LICENSE.md file

Hey, thanks for the package! It would be super useful if you could add a LICENSE file in the repository just so folks are completely clear on the basis on which they can use the code! I can make a pull request myself if you want - just let me know (but I would need to know the year you first released the package)

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Do in-app reviews appear immediately on press?

So If I set: options.preferInApp = true, does the review prompt appear immediately or does Apple decide the appropriate time to display it?

Sorry, not an issue. I know. But I cannot find a clear answer Googling around.

RCTBridgeModule 'file now found' issues

#ISSUE
I tried the 3 ways of linking the lib to ios but this doesnt seem to be working fine (beside andorid which works just fine).
Issue happening is shown below:

In file included from /Users/studocu/development/app/node_modules/react-native-rate/ios/RNRate.h:3:
../../react-native/React/Base/RCTBridgeModule.h:10:9: fatal error: 'React/RCTDefines.h' file not found

#import <React/RCTDefines.h>
        ^~~~~~~~~~~~~~~~~~~~

1 error generated.



** BUILD FAILED **

Some people suggesting changes in React-native folders and so on. Not sure how to make this work though!?

FYI:
react-native-cli: 2.0.1
react-native: 0.58.6
Xcode 10.2
react-native-rate: ^1.1.6

Null is not an object (evaluating 'RNRate.rate')

OS: IOS
IOS Deployment Target: 11.0
React-native: 33.0.0
expo: 33.0.7
eact-native-rate: 1.1.7

Running in IOS, I have an alert that prompts the user about rating the app. On rate, it tries and opens the react-native-rate's Rate.rate() function.

Alert:
Alert.alert('Rate this App', 'Do you want to rate this app?', [ { text: 'Rate', onPress: () => UserManager.getInstance().rateOpen() }, { text: 'Remind Me Later', onPress: () => UserManager.getInstance().rateRemindLater() } ])

UserManager.getInstance().rateOpen() function
let options = { AppleAppID: '**********', GooglePackageName: 'com.**********.*****', preferredAndroidMarket: AndroidMarket.Google, preferInApp: false, openAppStoreIfInAppFails: true }

Rate.rate(options, (success) => { if (success) { AsyncStorage.setItem('isAlreadyRate', 'true') console.log('App Rated. Stored into Async Storage') } })

TypeError: null is not an object (evaluating 'RNRate.rate')

Package Versions:

"react-native": "0.62.2"
"react-native-rate": "^1.2.4"

Device:

testing on iPhoneXs 13.6

App already has a couple versions in the app store.

Issue:

I added the package and ran pod install. I then copied the example code and filled in the options with my app specific details and then when I tried to initiate the Rate.rate method with the options I got the following error:

TypeError: null is not an object (evaluating 'RNRate.rate')

Here is the method I was calling on button press with my real app details removed:

import Rate, { AndroidMarket, IConfig } from 'react-native-rate';

const RateApp = () => {
  const options: IConfig = {
    AppleAppID: 'blah',
    GooglePackageName: 'blah',
    OtherAndroidURL:
      'blah',
    preferredAndroidMarket: AndroidMarket.Google,
    preferInApp: true,
    openAppStoreIfInAppFails: true,
    fallbackPlatformURL: 'blah',
  };

  Rate.rate(options, (success) => {
    if (success) {
      console.log('success **********************');
    } else {
      console.log('failed **********************');
    }
  });
};

The error is throwing on line 40 in the index.js file, so maybe theres a problem with getting a hold of the module from NativeModules?

const { RNRate } = NativeModules

Any ideas on whats going on?
Thanks :)

is this MIT License?

Hi,
I am not seeing a license. Is this project under an MIT License?
Thank you

Android failed to build (error: method does not override or implement a method from a supertype)

Thanks for writing this library!

I tried to use react-native link. Sadly our iOS isn't working right now so I successfully added it manually - all good :)

The weird one was native link did add references for android in the settings.gradle and build.gradle. These result in an error when building:

[…]/node_modules/react-native-rate/android/src/main/java/com/reactlibrary/RNRatePackage.java:19: error: method does not override or implement a method from a supertype

I noticed you said that android doesn't need to be manually added (so I removed and all good) so perhaps there is something that can be added to prevent these additions the link command adds?

App Store Opens after the InApp shows

Device: iPhone SE
OS: 11.0.1

When I use this options:
const options = {
AppleAppID: '123456',
GooglePackageName: 'com.example.app',
preferInApp: true,
};

the App Store open after 3 seconds and is ok is how the documentations says, if I try to use inAppDelay: 10.0 the AppStore opens after 10, but if the inApp prompt showed and dismissed the AppStore is open anyways.

null is not an object (evaluating 'RNRate.rate') rate

React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 648.76 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.14.2 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.2 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 19, 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Hi, I use Expo for emulating my React Native project and i try to use the module.
I tested the manual and automatic installation, the module is in the node_modules, I tried via Xcode too but always the same error. It's maybe a problem with Expo ?

ShareMenu.js

import React, { Component } from 'react';
import { containers, texts, images, buttons} from '../styles'
import { Image, Share } from 'react-native'

import { Linking } from 'react-native'
import Rate, { AndroidMarket } from 'react-native-rate'

class ShareMenu extends Component {

  constructor(props) {
    super(props)

    this.state = {
      rated: false
    }
  }

  onShare = async () => {
      try {
        const result = await Share.share({
          message:
            'React Native | A framework for building native apps using React',
        });
  
        if (result.action === Share.sharedAction) {
          console.log('success')
          if (result.activityType) {
            // shared with activity type of result.activityType
          } else {
            // shared
          }
        } else if (result.action === Share.dismissedAction) {
          // dismissed
        }
      } catch (error) {
        alert(error.message);
      }
  };

  render() {
    return (
        <>
            <texts.titletop mt>Nous soutenir</texts.titletop>
            <containers.inlineitems around mt>
                <buttons.contentcenterbutton onPress={() => Linking.openURL('mailto:[email protected]')} title="[email protected]">
                    <Image
                        style={{ width: 25, height: 21 }}
                        source={require("../assets/share/mail.png")}
                    />
                </buttons.contentcenterbutton>
                <buttons.contentcenterbutton onPress={()=>{
                const options = {
                    AppleAppID:"**********",
                    GooglePackageName:"com.teaser.teaserapp",
                    AmazonPackageName:"com.teaser.teaserapp",
                    preferredAndroidMarket: AndroidMarket.Google,
                    preferInApp:false,
                    openAppStoreIfInAppFails:true,
                    fallbackPlatformURL:"https://www.teaserapp.fr",
                }
                Rate.rate(options, success=>{
                    if (success) {
                        this.setState({rated:true})
                    }
                })
            }}>
                    <Image
                        style={{ width: 25, height: 24 }}
                        source={require("../assets/share/star.png")}
                    />

                </buttons.contentcenterbutton>
                <buttons.contentcenterbutton onPress={() => this.onShare()}>
                    <Image
                        style={{ width: 23, height: 25 }}
                        source={require("../assets/share/share.png")}
                    />

                </buttons.contentcenterbutton>
                <buttons.contentcenterbutton onPress={() => Linking.openURL('instagram://user?username=teasergame')}>
                    <Image
                        style={{ width: 25, height: 25 }}
                        source={require("../assets/share/like.png")}
                    />
                </buttons.contentcenterbutton>
            </containers.inlineitems>
        </>
    );
  }
}

export default ShareMenu;

Redirecting to Appstore

Hi,

I'm using your library to implement in app rating to my app, and it's works quite well.

But on iPhone I've a weird issue.

when I'm under development, no issue, the popup show up but on production, I'm directly redirected to App Store application. Not very pleasant in term of UX.

Do you have any idea ?

(Everything works great on Android)

"react-native-rate": "^1.2.6",

    const options = {
        AppleAppID: '1566....',
        GooglePackageName: 'com.app',
        AmazonPackageName: 'com.app',
        preferredAndroidMarket: AndroidMarket.Google,
        preferInApp: true,
        openAppStoreIfInAppFails: true,
        fallbackPlatformURL: 'https://webiste.app',
      };

Thanks

Doesn't link for android platform.

Hi,

Thanks for awesome package first.

I'd like to use this platform on my RN project and was available to install this package via yarn.
When I try to link this package to platforms with react-native link react-native-rate command, it links to iOS platform, but doesn't link to Android platform at all.

React Native: v0.59.0
React: v16.8.3
react-native-rate: v1.0.9

There is no error during link process.
After link this package, I couldn't find android folder at the 'node_modules/react-native-rate'.

This is error I am facing when try to run on android.
image

I spent a few days to find the solution, but couldn't find yet.

Thanks for any help.

Disabling fallback redirect on iOS

On iOS it would be useful to be able to disable the fallback of opening the App Store if the in-app review process fails.

The reason being - HCI guidelines indicate that the review prompt should not be shown in response to a button press. If a user is performing some positive actions and they are suddenly redirected to the App Store without any prompt, this is hugely irritating.

If redirecting to the app store, we should be displaying some sort of dialog, giving the user the option to rate.

Either this library should implement some sort of customisable dialog, or the redirect after failed in-app rate should be configurable.

Currently because of the redirect, I can't use in-app ratings at all.

Would you be open to some of the changes above?

In app review not working in production Android, but works with Internal App Sharing

I have integrated the latest version of this library to my production app.

The expected behaviour would be to see the popup when I call the rate function, but nothing happens. When I tested it with Play Console's Internal App Sharing feature, it worked, the popup was shown, of course with disabled Submit button.

However the that exact same APK released to production fails to bring up the popup. Not just for me, but for all of my users (we have 5k daily active users, but no increase in rating numbers).

@sregg Have you tried this library in PRODUCTION as well? Can you confirm, it is working for you?

Is there anybody, who can confirm, that the In app review for Android in react-native-rate version 1.2.4 works in PRODUCTION?

Thank you guys for the help.

Neither rating dilog opens nor it redirect me to the store.

Hello,
I am working on an android application which was already built and published on play store and now i'm translating the whole code to react native.

I have used this library which works well on iOS but not on android.
I have not rated the application before and also i'm new to android platform. What would have been missed by me?

What does this do?

I've completed the installation process using iOS and CocoaPods and am now testing on the iOS Simulator. My callback is returning success but nothing happens.

Is this supposed to redirect the user to the App Store app and to my app's App Store record to provide a review? Or is this supposed to open a WebView to enable a user to submit a rating over http?

I'm using the example found here:
- https://github.com/KjellConnelly/react-native-rate

React-Native: 0.59.3
Edit: October 31st, 2019; 11:52AM
Resolved by viewing the following:

New Question: Is it supposed to work on the iOS simulator?

Cannot read property 'rate' of undefined

I applied it to my app as your Example, but it didn't work and the debugger console showed TypeError: Cannot read property 'rate' of undefined. When I looked up the Rate.rate function,

const {RNRate} = NativeModules
RNRate.rate (options, (response) => {....

There seems to be a problem here.
How can I solve this problem?

[Android] Package name

It seems that you are using the default package name 'com.reactlibrary' which created some compilation error on android if another library also use this package

Open Google Play Store app instead of a chooser

Hey,

Due to url http://play.google.com/store/apps/details?id=, the action to be performed could be handled by multiple apps and the user might prefer a different app each time. So it will show a chooser dialog as shown:

https://developer.android.com/training/basics/intents/sending#AppChooser

image

The chooser dialog forces the user to select which app to use for the action every time (the user cannot select a default app for the action).

I think we can use Linking from an Android App, so that users can see app's details in the Google Play Store app instead of a chooser.

[iOS] App Rating in App not showing in Testflight

This is maybe more of a question or something to add to the documentation.
While developing the feature/adding in-app rating I was able to see it but on Testflight it never prompts me.

Is this known / normal?

Direct users straight to rating section on google play

Hi Kjell,

Got the lib working for Android now :-) but noticed that it redirects to the product page and not the specific rating section of the product page. Is this expected behaviour? Did you try to figure out a way to direct to the rating section? Just making sure if I should invest time into it or not. Thanks again!

Joan

import androidx.annotation.NonNull

Additional Information
"react-native-rate": "^1.2.4",
"react": "16.8.3",
"react-native": "0.59.9",
Platform(s) (iOS, Android, or both?): Android
Operating System : macOS

Error
/node_modules/react-native-rate/android/src/main/java/com/reactnativerate/RNRateModule.java:4: error: cannot find symbol
import androidx.annotation.NonNull;
^
symbol: class NonNull
location: package androidx.annotation

public void onComplete(@nonnull final Task requestTask) {
^
symbol: class NonNull

Cannot install on RN 0.60+

After yarn install and react-native link, I see a line added to Podfile.

I run pod install and receive:

[!] No podspec found for RNRate in ../node_modules/react-native-rate

When I build (without running pod install), I receive Folly error.

/project/Pods/Folly/folly/detail/RangeCommon.h:22:10: 'glog/logging.h' file not found (But fixed this after removing Podfile.lock , unlinking, removing package, and running pod install again)

Android Rate is redirecting to Google Play by default

Hi,
I am implementing react-native-rate, it is working in iOS as a pop-up. In Android it is redirecting to Google Play store(It is not asking pop-up). IS this i the default behaviour? or what might be the issue?

About SKStoreReviewController

I read in the docs:

"Users can only rate the app 1-5 stars. They cannot write a review."

Afaik, iOS default (native) rating first pops-up a 1-5 stars rating, and after you rate, you are allowed to write a reply. I understand this is the default SKStoreReviewController behaviour. Is this not the case here?

I also take this opportunity to ask if you could define better what "a cross platform solution to getting users to easily rate your app." means. I know it's petty but, what exactly will the outcome be? Is this just a link to the app store/google play review section, or there's some sort of rating pop-up for android too (similar to SKStoreReviewController for iOS)?

A few words on how would you normally use this lib would be appreciated, as in: Just a link in the menu saying "Review this app!" or something more intrusive based on behaviour (even if it's showing the SKStoreReviewController just once after a certain progress is achieved.

Thanks!

Duplicated field in types

Hey,

Latest package from npm has file index.d.ts with content:

declare module 'react-native-rate' {
        export interface IConfig {
                AppleAppID?: string,
                GooglePackageName?: string,
                AmazonPackageName?: string,
                OtherAndroidURL?: string,
                preferredAndroidMarket?: AndroidMarket,
                preferInApp?: boolean,
                openAppStoreIfInAppFails?: boolean,
                inAppDelay?: number,
                fallbackPlatformURL?: string,
                openAppStoreIfInAppFails?: boolean,
        }

        export enum AndroidMarket {
                Google,
                Amazon,
                Other,
        }

        export function rate(config: IConfig, callback: (success: boolean) => void): void;
}

meanwhile index.d.ts on master branch is:

declare module 'react-native-rate' {
	export interface IConfig {
		AppleAppID?: string,
		GooglePackageName?: string,
		AmazonPackageName?: string,
		OtherAndroidURL?: string,
		preferredAndroidMarket?: AndroidMarket,
		preferInApp?: boolean,
		openAppStoreIfInAppFails?: boolean,
		inAppDelay?: number,
		fallbackPlatformURL?: string,
	}

	export enum AndroidMarket {
		Google,
		Amazon,
		Other,
	}

	export function rate(config: IConfig, callback: (success: boolean) => void): void;
}

The npm version has duplicated field:

 openAppStoreIfInAppFails?: boolean,

I think that you forgot to push latest changes to the npm repository. Would you mind update it? I would be grateful :)

Rating an app in Dev

The prompt comes up for dev builds, just wondering what happens if I leave a review for a non production build.

Thanks

iOS in App rate pop-up is not coming

Hi,

In iOS I used preferInApp: true, but rate in App pop-up is not coming, instead it is redirecting to app store. In App rate pop-up in iOS has to come?

Any other things needs to be added?

iOS Podspec file missing homepage

I get an error when running pod install for RNRate. It says that homepage property is not configured in the podspec file.

Pod::Spec.new do |s|
  s.name         = "RNRate"
  s.version      = "1.0.0"
  s.summary      = "RNRate"
  s.description  = <<-DESC
                  RNRate
                   DESC
  s.homepage     = ""
  s.license      = "MIT"
  # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }
  s.author             = { "author" => "[email protected]" }
  s.platform     = :ios, "7.0"
  s.source       = { :git => "https://github.com/author/RNRate.git", :tag => "master" }
  s.source_files  = "RNRate/**/*.{h,m}"
  s.requires_arc = true


  s.dependency "React"
  #s.dependency "others"

end

image

value of success is always true when I restart the app

Hello, thank you so much for making this great library.
I have some question to ask.

While testing your package in iOS development mode,
I used preferInApp: true, openAppStoreIfInAppFails: false options.
I used this code in my 'Home' Screen, so as user get into the 'Home' screen, SKStoreReviewController works.
So I can see in-app-review popup in my app, instead of directly opening the store externally.

스크린샷 2020-12-04 오후 6 06 19

But the problem is, even though user doesn't click 'submit' button, I found out that value of success returns as true.
Below is my code.

// Home.jsx

const showInAppReview = setTimeout(() => {
  const options = {
    AppleAppID: '0000000000',
    GooglePackageName: 'com.example',
    preferredAndroidMarket: AndroidMarket.Google,
    preferInApp: true,
    openAppStoreIfInAppFails: false,
    inAppDelay: 5.0,
  };

  Rate.rate(options, (success) => {
    console.log('1 =====> ', success);
    if (success) {
      console.log('2 =====> ', success);
    }
  });
}, 5000);

I used setTimeout, so I get console.logs 5 seconds after I reach 'Home' screen.
console log if I completely close the app, and restart the app

1 =====> true
2 =====> true

console log when I click 'Not Now' or 'Cancel' in in-app-review popup, and shake my device to reload (I'm testing with actual device linked by USB cable)

// (setTimeout 5 secs + inAppDelay 5 secs = 10 secs)

1 =====> false

So I checked out react-native-rate/ios/RNRate.m file, and found out that there are 4 cases that this callback emits true.


  1. when preferInApp is false
  2. preferInApp is true, but SKStoreReviewController is unavailable
  3. if there is a new window (Appstore expected)
  4. inAppDelay time is over, but there's no user action. And Also, openAppStoreIfInAppFails is true

As I mentioned above, I used preferInApp: true, openAppStoreIfInAppFails: false options, so number 1 and 4 are not my case.

In-app review popup showed off, and appstore didn't open also. So number 2 is not my case too.

I didn't click submit button, so appstore didn't open. The number of windows didn't change. So probably number 3 is not my case too...?

I'm pretty sure number 1 and 4 are not my case, but not very certain of number 2 and 3. Maybe I'm misunderstanding this package, or maybe there are some side effects in my code..?

TypeError: null is not an object (evaluating 'RNRate.rate') [ANDROID]

I've just upgraded from 1.2.1 to 1.2.4 and I'm getting this error on Android (not iOS!)

Error description

TypeError: null is not an object (evaluating 'RNRate.rate')

See screenshot below:

Screenshot 2020-09-01 at 10 38 32

Code sample

import Rate from 'react-native-rate'

// ...

    Rate.rate({
      AppleAppID: config.appStoreId,
      GooglePackageName: config.androidPackageName,
      preferInApp: true
    }, success => {
        // Removed my code here since it's not relevant to the error
    })

Misc info

React Native: 0.63.2
React Native Rate: 1.2.4

Tested on real device

(iOS): Cannot read property 'rate' of undefined

( in dev, non-AppStore version ): when I try to test this package, checked all installation steps( and set AppleAppId for AppStore app version ), I've get this error.
If it help, Dev & Release versions have different bundleId.

Message says about error, that located in index.js( from this package ), line 37:
RNRate.rate(options, response=>{

The Android in-app review does not open after I have already reviewed

If the user has already reviewed the app in the store, the in-app review does not open and does not open the Play Store and the successful callback comes true.
My options are:

AppleAppID: APPLE_APP_ID,
 GooglePackageName: GOOGLE_PACKAGE_NAME,
 preferredAndroidMarket: AndroidMarket.Google,
 preferInApp: true,
 openAppStoreIfInAppFails: true,

I think that if the in-app review did not open, it should open the Play Store, as in the iOS that opens the AppStore.

pop up not visible when preferInApp: true on Android

Issue Description
When we set preferInApp: true the app is not showing the popup to rate the app but getting the call in success.

Expected Results
Popup to rate the app should appear

Additional Information
react-native-rate version: ^1.2.4,
React Native version:0.61.4
Platform(s) (iOS, Android, or both?): Android
Operating System (macOS, Linux, or Windows?): macOS

Steps to Reproduce / Code Snippets
<View>
<Button title="Rate App" onPress={() => {
const options = {
GooglePackageName: "com.instagram.android",
preferredAndroidMarket: AndroidMarket.Google,
preferInApp: true
}
Rate.rate(options, success => {
if (success) {
console.log(success);
}
})
}} />
</View>

Leave a review - text is not visible

I have a strange behaviour. Everything works fine, but when a user clicks to leave a review, the optional comment review section is all bg color when you type your review in. The title section comes out fine with black text. But the review section text is the same as bg color and you cant see what you are typing. I tested it out in several devices and same issue... please help! I even tried react-native-store-review and same issue there...

Can I able to show review and comment for all platforms

Can I able to show this rate as like and its count value (i.e) total liked count in react-native app

What are the options of rate. (Number, star, Heart etc ..)

Is it have that option.

Does it allow review for all values (If I did not set give the numerical value)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.