jlyman / react-native-rating-requestor

A React Native component to prompt users for a rating after positive interactions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to config it for iOS and android at the same time?

mezod opened this issue · comments

Hi!

I see that this lib supports iOS and android but fail to see how to use both in the docs. I just want to confirm that the lib expects me to have some sort of platform specific code for iOS and android and call the lib separately (?). It's what I'd understand atm.

Also, since I assume that by default the lib will redirect to the app store / g play sites, is there any way to take the user immediately to the rating section instead of just the product page?

Thanks again for working on this :-)
Joan

You're right, there isn't an example in the docs on splitting differences between platforms, but luckily it's not too difficult.

Almost everything is the same except for, critically, the app store ID which is passed as the first parameter to a new RatingRequestor. This is an example I took from one of my cross-platform apps that uses the lib on both platforms. Notice the Platform.select({}) call that gives the IDs for each of the respective platform stores:

import { Platform } from 'react-native';
...
const RatingNag = new RatingRequestor(
  Platform.select({
    ios: '546236058',
    android: 'com.sparkgenius.TGGWordGenerator',
  }),
  {
    ...[other options here]
  },
);

That's really all you need to do. You can always split other options based on platform, but that's really the only thing needed generally.

Does that help solve that for you?

Yeah, thanks!