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

144
Vistas
close Modal automatically in React Native

I use here a modal. In the case that everything is good and I added the data to the database, I want to automatically close the modal with the line "this.props.closeModal" but I get the error undefined is not an object (evaluating this.props)

closeModal is called from EmailChildConnect.js field and changeshowTaskVisible value

Any ideas?

ConnectModal.js

class ConnectModal extends React.Component {

  addAdultConnexion = async () => {
    if (this.state.emailAdult !== "") {
                 //add to the firebase in the case that is good
                  this.props.closeModal;
                else {
                  Alert.alert("", "the email does not exist");   
              };
    }
    else {
      Alert.alert("", "field is required");     
    }
  };


  render() {
    return (
      <CustomBackground>
        <TouchableOpacity
          onPress={this.props.closeModal}
        >
          <AntDesign name="close" size={WIDTH / 17.2} color={colors.black} />
        </TouchableOpacity>
        <View>
            <TextInput
              onChangeText={(text) => this.setState({ emailAdult: text })}
              value={this.state.emailAdult}/>
            <CustomValidationButton onPress={() => this.addAdultConnexion()}>
              <Text>add</Text>
            </CustomValidationButton>
        </View>
      </CustomBackground>
    );
  }
}

EmailChildConnect.js :

class EmailChildConnect extends React.Component {
  state = {
    showTaskVisible: false,
  };

  toggleisModal() {
    this.setState({ showTaskVisible: !this.state.showTaskVisible });
  }

  render() {
    const email = this.props.email;
    return (
      <View>
        <Modal
          animationType="slide"
          visible={this.state.showTaskVisible}
          onRequestClose={() => this.toggleisModal()}
        >
          <ConnectModal email={email} closeModal={() => this.toggleisModal()} />
        </Modal>

        <RenderListEmail
          onPress={() => this.toggleisModal()}
          children1={email.name}
          children2={email.childEmail}
        />
      </View>
    );
  }
}



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