MinaSamir11 / react-native-in-app-review

The Google Play In-App Review API, App store rating API lets you prompt users to submit Play Store or App store ratings and reviews without the inconvenience of leaving your app or game.
MIT License
648 stars 58 forks source link

Modal not showing in android and and get try catch error #71

Closed gonzaloocascio closed 2 years ago

gonzaloocascio commented 2 years ago

Hello!

First of all great work and thank you for this package!

I followed the steps for Android integration then use the example code and uploaded the app to the play store.

    try {
      if (InAppReview.isAvailable()) {
        InAppReview.RequestInAppReview()
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
          .then((_hasFlowFinishedSuccessfully: boolean) => {
            // TODO: track this event
            // TODO: let the server know the workflow has finished
            console.log('Review Success?:', _hasFlowFinishedSuccessfully);
            ToastAndroid.show(
              `Review Success?: ${_hasFlowFinishedSuccessfully}`,
              ToastAndroid.SHORT
            );
          })
          // eslint-disable-next-line @typescript-eslint/no-unused-vars
          .catch((_error) => {
            // TODO: track this event
            ToastAndroid.show(`Showing Error: ${_error}`, ToastAndroid.SHORT);
          })
          .finally(() => {
            // dispatch(askForReviewOff());
          });
      }
    } catch (error) {
      ToastAndroid.show(`Try Error: ${error}`, ToastAndroid.SHORT);
      console.log(`Try Error: ${error}`, ToastAndroid.SHORT);
    }

When I run the following code I get an error in the try catch

undefined is not a function (near '...}).finally(function () {});...')

However .then((_hasFlowFinishedSuccessfully: boolean) => { returns true

Please let me know if you need more information and in advance thank you very much for your help.

MinaSamir11 commented 2 years ago
  try {
    await InAppReview.RequestInAppReview();
  } catch (error) {
    console.log(error)
  }

try this !!