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

155
Views
Modal not showing when setting visibility in UseEffect call

Hi so I am trying to conditionally set the visibility of a modal (react-native-modal) in the useEffect function of one of my components. The issue is the modal sometimes doesn't show even though the visibility is set to true. Also when this happens it prevents me from interacting with the page below it pretty much breaking the app and causing the user to have to clear it before proceeding.

Here is how i render my modal in the return(the view is just a placeholder):

<Modal
    isVisible={guidanceVisible}
    style={styles.guidanceModalContainer}
    onBackdropPress={() => null}
    backdropOpacity={.75}
  >
    <View style={{
      width: '100%',
      height: '100%',
      backgroundColor: 'green'
    }}/>
  </Modal>

Initialize State: const [guidanceVisible, setGuidanceVisible] = useState(false);

setGuidance in useEffect:

useEffect(() => {
if(myPosts.length > 1){
  // setTimeout(() => {
    setGuidanceVisible(true)
  // }, 500)
}}, []);

As you can see I have already tried using a setTimeout but then I run into a different error. If a user interacts with the page while the timeout is waiting to be called then the same issue as before with the page being uninteractable happens again. Please let me know if you have any ideas or spot any mistakes. Thanks ahead of time!

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!