Jak utworzyć link" Oceń tę aplikację" w aplikacji React Native?

Jak poprawnie połączyć użytkownika ze stroną recenzji w App Store w aplikacji React Native na iOS?

Author: vtambourine, 2016-02-24

4 answers

Dla iOS należy dodać LSApplicationQueriesSchemes jako Array param do Info.plist i dodać do niego elementy.

Na przykład do linkowania AppStore używam itms-apps jako jednego z param w tej tablicy.

Twój link powinien wyglądać tak

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

Cóż. Teraz masz wszystkie rzeczy do zrobienia Link komponent z metodą
handleClick () {
    Linking.canOpenURL(link).then(supported => {
        supported && Linking.openURL(link);
    }, (err) => console.log(err));
}
 15
Author: SerzN1,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-12-07 15:18:07

Użyj linkowania , Aby otworzyć adres url do app store. Aby utworzyć właściwy adres url, postępuj zgodnie z instrukcjami dla iOSi/lub android. Np.

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

Lub

Linking.openURL('itms://itunes.apple.com/us/app/apple-store/myiosappid?mt=8')
 9
Author: outofculture,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:10:44

Jest to coś podobnego, pokazuje pole alertu, aby zaktualizować aplikację i otwiera sklep play lub app store w zależności od systemu operacyjnego urządzenia.

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));
                }
            }},
        ]
    );
}
 6
Author: Simar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-11-04 19:16:22

Używam tej biblioteki . wygląda całkiem nieźle. Wystarczy podać nazwę pakietu i identyfikator App store i wywołać funkcję. Jest też wieloplatformowy.

render() {
        return (
            <View>
                <Button title="Rate App" onPress={()=>{
                    let options = {
                        AppleAppID:"2193813192",
                        GooglePackageName:"com.mywebsite.myapp",
                        AmazonPackageName:"com.mywebsite.myapp",
                        OtherAndroidURL:"http://www.randomappstore.com/app/47172391",
                        preferredAndroidMarket: AndroidMarket.Google,
                        preferInApp:false,
                        openAppStoreIfInAppFails:true,
                        fallbackPlatformURL:"http://www.mywebsite.com/myapp.html",
                    }
                    Rate.rate(options, (success)=>{
                        if (success) {
                            // this technically only tells us if the user successfully went to the Review Page. Whether they actually did anything, we do not know.
                            this.setState({rated:true})
                        }
                    })
                } />
            </View>
        )
    }
 1
Author: Nabeel K,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-08-28 10:21:54