Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Switch button becomes false again

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>
)}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!