After the switch button is true, it becomes false again when I close the page. When it's true, I want it to stay that way. How can I solve this? I also set the colors on other pages with isEnabled. But since it is false again, it returns to light mode.
export const [isEnabled, setIsEnabled] = React.useState(false);
export const toggleSwitch = () => setIsEnabled(previousState => !previousState);
export function SettingsAccount(props) {
const { navigate } = props.navigation;
return(
<SafeAreaView>
<View style = {styles.container}>
<TouchableOpacity onPress ={() => {navigationService.navigate('MyAccount', null);}
}>
<Image style= {styles.imageSt} source={require('../../assets/arrow-left-circle.png')} />
</TouchableOpacity>
<View style = {styles.textView}>
<Text style = {styles.textStyle}>Uygulama Ayarları</Text>
</View>
</View>
<View style={styles.SwitchStyle}>
<Switch
trackColor={{ false: "#767577", true: "#81b0ff" }}
thumbColor={isEnabled ? "#f5dd4b" : "#f4f3f4"}
ios_backgroundColor="#3e3e3e"
onValueChange={toggleSwitch}
value={isEnabled}
/>
</View>
<View>
<TouchableOpacity style={{backgroundColor: isEnabled ? "green":"red", marginTop: 50}}>
<Text>
Deneme Buton
</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
)}