import { useCallback , useEffect , useState } from 'react' ; import { isAvailableAsync } from 'expo-store-review' ; see https example export function useStoreReviewIsAvailable ( options = { } ) { const [ storeReviewIsAvailable , setStoreReviewIsAvailable ] = useState < boolean > ( ) ; const { get = true } = options ; const getStoreReviewIsAvailable = useCallback ( ( ) => ( isAvailableAsync ( ) . then ( setStoreReviewIsAvailable ) ) , [ ] ) ; useEffect ( ( ) => { if ( get ) { getStoreReviewIsAvailable ( ) ; } } , [ get , getStoreReviewIsAvailable ] ) ; return [ storeReviewIsAvailable , getStoreReviewIsAvailable ] ; } export interface StoreReviewIsAvailableOptions { /** If it should fetch the store review is available when mounted, defaults to `true` */ get ? : boolean ; }