How to make a "Rate this app" link in React Native app? How to make a "Rate this app" link in React Native app? ios ios

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


Use Linking to open up the url to the app store. To construct the proper url, follow the instructions for iOS and/or android. E.g.

Linking.openURL('market://details?id=myandroidappid')

or

Linking.openURL('itms-apps://itunes.apple.com/us/app/apple-store/myiosappid?mt=8')


For iOS you Have to add LSApplicationQueriesSchemes as Array param to Info.plist and add items to it.

For example to AppStore linking I use itms-apps as one of params in this array.

For example:

<key>LSApplicationQueriesSchemes</key><array>  <string>itms-apps</string></array>

Your link should be like this

itms-apps://itunes.apple.com/us/app/id${APP_STORE_LINK_ID}?mt=8.

Well. Now you have all stuff to do Link component with method

handleClick () {    Linking.canOpenURL(link).then(supported => {        supported && Linking.openURL(link);    }, (err) => console.log(err));}


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));                }            }},        ]    );}