import { StackNavigationProp } from '@react-navigation/stack'; import * as StoreReview from 'expo-store-review'; import React from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; import Button from '../components/Button'; import Colors from '../constants/Colors'; type Props = { navigation: StackNavigationProp; }; function getStoreUrlInfo(): string { const storeUrl = StoreReview.storeUrl(); if (storeUrl) { return `On Android devices pressing this button will open ${storeUrl}.`; } return 'You will need to add ios.appStoreUrl, and android.playStoreUrl to your app.config.js in order to use this feature on Android.'; } function StoreReviewScreen({ navigation }: Props) { React.useLayoutEffect(() => { navigation.setOptions({ title: 'Store Review', }); }, [navigation]); const [isAvailable, setAvailable] = React.useState(false); React.useEffect(() => { StoreReview.isAvailableAsync().then(setAvailable); }, []); const isSupportedText = isAvailable ? 'is available' : 'is not available!'; return ( Native Store Review {isSupportedText} {getStoreUrlInfo()}