how to redirect to app settings in react native for android 12 only?
NativeModules.OpenSettings.openNetworkSettings(() => null);
i can't use that code right now
import { openSettings } from 'react-native-permissions';
openSettings();
this also not working for me
CodePudding user response:
have you tried this
const Screen = () => (
<Button
title="Open Settings"
onPress={() => {
Linking.openSettings();
}}
/>
);
don't forget to import
import { Button, Linking } from "react-native";
CodePudding user response:
First you have go to the official documentation of React Native there you find the solution of this question.
Documentation of React Native Linking
Code:
<TouchableOpacity
onPress={() => {
Linking.openSettings();
}}
style={{
paddingHorizontal: 80,
paddingVertical: 10,
backgroundColor: '#326A81',
}}>
<Text style={{color: 'white'}}>Open Setting</Text>
</TouchableOpacity>