Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda