Store review
StoreReview is the platform's "rate this app" prompt, bound to expo-store-review: the App
Store's review sheet on iOS and the Play Store's in-app review on Android.
import { StoreReview } from '@ng-native/expo';
inject(StoreReview)Platforms. Available on macOS, iPadOS, iPhone and Android (with the Play Store). Absent on Linux and Web host, where available() is false.
The prompt belongs to the platform, and so does the decision whether it appears. iOS shows it at
most three times in a year and says nothing when it declines, so request() resolving does not
mean anyone saw a prompt. Ask at a moment of success - a task finished, not an app launched - and
never from a button labeled "Rate us", which is what the store page is for.
Install
npx expo install expo-store-reviewimport { StoreReview } from '@ng-native/expo/store-review';The smallest useful example
import { Component, inject } from '@angular/core';
import { Pressable, Text } from '@ng-native/components';
import { StoreReview } from '@ng-native/expo/store-review';
@Component({
selector: 'app-workout-done',
imports: [Pressable, Text],
template: `<pressable (press)="finish()"><text>Done</text></pressable>`,
})
export class WorkoutDone {
private readonly review = inject(StoreReview);
protected async finish(): Promise<void> {
if (await this.review.hasAction()) await this.review.request();
}
}What it does
available()- whether the platform has an in-app review prompt.hasAction()- whetherrequest()would do anything: show the prompt, or open the store page when there is no prompt.request()- asks the platform to show the prompt. Where there is none, it opens the store page set asios.appStoreUrlorandroid.playStoreUrlin the app config instead.storeUrl()- that store page, for a "rate us" link that opens the store directly. Null when the app config sets none.
Without the module
On iOS and Android, a missing expo-store-review - never installed, or installed without the app
being rebuilt since - leaves the service made, so injecting it does not throw. A call, or a read of
a value only the module knows, throws a MissingModuleError. Its message names the module and the
commands that fix it; see
Using a module.
On the web, and in a test that provides no fake, available() and hasAction() resolve to false,
storeUrl() is null, and request() resolves without doing anything.
Reference
StoreReviewservice@ng-native/expoimport { StoreReview } from '@ng-native/expo';Methods
hasAction(): Promise<boolean> Whether request() would do anything: show the prompt, or failing that open the store page set as ios.appStoreUrl or android.playStoreUrl in the app config.
request(): Promise<void>Asks the platform to show the prompt, or opens the store page where there is none. Resolves whether or not the platform chose to show anything.
storeUrl(): string | nullThe app's store page from the app config, for a "rate us" link. Null when none is set.