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

141
Views
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
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!