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
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
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();
Linking.openURL('app-settings:1');
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.
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();
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