I am trying to use react-native secureTextEntry
to hide my password and confirm password fields during registration.I'm using custom InputBox component for textInput.below is my code,
<InputBox
error={this.state.PwordError}
keyboardType={'default'}
onChangeText={Pword =>
this.setState({
Pword
})
}
secureTextEntry={true}
value={this.state.Pword}
pHolder={"Password"}
color={'white'} />
<View style={styles.spacer} />
<InputBox
error={this.state.CPwordError}
keyboardType={'default'}
onChangeText={CPword =>
this.setState({
CPword
})
}
secureTextEntry={true}
value={this.state.CPword}
pHolder={"Confirm Password"}
color={'white'} />
The first textbox works fine when a password is entered it show as dots, but the confirm password field does not work. does anyone have an idea why this could occur?
This is the input box that is referred by the above code
<TextInput
underlineColorAndroid="transparent"
placeholder={this.props.pHolder}
placeholderTextColor={this.props.color === 'white' ? 'black':"white" }
{...this.props}
style={this.props.color == 'white' ? styles.ReginputStyle : styles.inputStyle}
/>
i am using,
"react": "16.5.0",
"react-native": "0.57.1",
I was able to fix this by removing the keyboardType={'default'}
code from my input component. Even though the problem is fixed i would like to know why the first secureTextEntry
box worked while the other didn't, as both of them were identical except for the value. can any one give a reason to why this could occur,
thanks.
Source: View source