How to make a “Rate this app” link in React Native app?

后端 未结 6 1234
无人及你
无人及你 2021-01-30 13:11

How to properly link a user to reviews page at App Store app in React Native application on iOS?

6条回答
  •  广开言路
    2021-01-30 13:56

    This is something similar, it shows an alert box to update the app and it opens the play store or the app store depending on their device os.

    function updateAppNotice(){
         const APP_STORE_LINK = 'itms://itunes.apple.com/us/app/apple-store/myiosappid?mt=8';
         const PLAY_STORE_LINK = 'market://details?id=myandroidappid';
         Alert.alert(
            'Update Available',
            'This version of the app is outdated. Please update app from the '+(Platform.OS =='ios' ? 'app store' : 'play store')+'.',
            [
                {text: 'Update Now', onPress: () => {
                    if(Platform.OS =='ios'){
                        Linking.openURL(APP_STORE_LINK).catch(err => console.error('An error occurred', err));
                    }
                    else{
                        Linking.openURL(PLAY_STORE_LINK).catch(err => console.error('An error occurred', err));
                    }
                }},
            ]
        );
    }
    

提交回复
热议问题