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

138
Views
Warning: Cannot update a component from inside the function body of a different component. in TouchableOpacity

I got this error

Warning: Cannot update a component from inside the function body of a different component.

How to fix this ?

When I remove touchable opacity, it's not showing anymore

                  <View style={styles.SaD}>
                            <TouchableOpacity onPress={(e) = props.locationSetState(1)}> // here
                                <Text style={styles.text1}>Choose your starting point</Text>
                            </TouchableOpacity>

                            <TouchableOpacity onPress={(e) = props.locationSetState(2)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                        </View>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

details are not sufficient to understand your problem but according to what I understand from your code try using react hooks and try this

function App() {

  const [state,setState]=React.useState(null);
  console.log(state);
  return (
                       <View style={styles.SaD}>
                            
                            <TouchableOpacity onPress={(e) => setState(1)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                            <TouchableOpacity onPress={(e) => setState(2)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                        </View>
  );
}
about 4 years ago · Juan Pablo Isaza Report
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!