I want input field should not be an empty. please help me I am getting this error = undefined is not an object (evaluating '_this.state.BankName.trim')
here is my code
if (!this.state.BankName.trim()) // if (!/^$|^.*@.*..*$/.test(this.state.BankName)) { this.setState({ BankNameError: 'Field Should Not Be An Empty' }) return; } else { Alert.alert("All fields validated") return; } } handleBankName = (text) => { this.setState({ BankNameError: '' }) this.setState({ BankName: text }) } <TextInput maxLength={20} placeholder="Name of Bank*" style={styles.inputStyle} onChangeText={this.handleBankName} /> <Text>{this.state.BankNameError}</Text>
2.1m questions
2.1m answers
60 comments
57.0k users