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>
1.4m articles
1.4m replys
5 comments
57.0k users