Open Settings App from another App in iOS - React Native

后端 未结 9 1258
予麋鹿
予麋鹿 2020-12-29 02:40

I\'m going through the docs in React Native and can only find navigating to external links from the app I am in.

I want to be able to navigate to the Settings

相关标签:
9条回答
  • 2020-12-29 03:18

    I successfully opened the settings by the code below, hope it's helpful :)

    Linking.canOpenURL('app-settings:').then(supported => {
      if (!supported) {
        console.log('Can\'t handle settings url');
      } else {
        return Linking.openURL('app-settings:');
      }
    }).catch(err => console.error('An error occurred', err));
    

    Reference: https://facebook.github.io/react-native//docs/linking.html

    0 讨论(0)
  • 2020-12-29 03:18

    Since React Native version 0.59 this should be possible using openSettings();. This is described in the React Native Linking documentation. Although it did not work for me. When I tried quickly I saw a _reactNative.Linking.openSettings is not a function error message.

    Linking.openSettings();
    
    0 讨论(0)
  • 2020-12-29 03:21

    Linking.openURL('app-settings:1');

    0 讨论(0)
  • 2020-12-29 03:23

    You can access settings of the application with: Linking.openURL('app-settings:');

    But I don't know (yet) how to open a specific deep-link.

    0 讨论(0)
  • 2020-12-29 03:26

    Adding an answer that worked for me and is easy to apply.

    openSettings function in @react-native-community/react-native-permissions works for both iOS and Android.

    Calling openSettings function will direct the user to the settings page of your app.

    import { openSettings } from 'react-native-permissions';
    openSettings();
    
    0 讨论(0)
  • 2020-12-29 03:26

    You can import Linking from 'react-native' and then use Linking.openSettings() to trigger the call. This link explains it very concisely:

    https://til.hashrocket.com/posts/eyegh79kqs-how-to-open-the-settings-app-in-reactnative-060

    0 讨论(0)
提交回复
热议问题