Я работаю в приложении React Native, где я использую tcomb-form-native
для пользовательской формы в случае регистрации и входа в систему. Теперь я хочу добавить значок глаза в поле пароля, где я могу просмотреть пароль при нажатии. Как я могу это сделать, используя эту зависимость. Теперь у меня есть такой код:
const LoginForm = Tcomb.form.Form;
const customStyle = cloneDeep(Tcomb.form.Form.stylesheet);
customStyle.textbox.normal = {
...customStyle.textbox.normal,
...styles.input,
borderColor: '#fff',
};
class SignUpScreen extends Component {
static propTypes = {
user: PropTypes.object
};
initialUserForm = () => {
this.User = Tcomb.struct({
username: Tcomb.String,
password: Tcomb.String,
});
this.options = {
auto: 'none',
fields: {
username: {
label: Languages.userOrEmail,
error: Languages.EmptyError,
underlineColorAndroid: 'transparent',
stylesheet: customStyle,
autoCapitalize: 'none',
autoCorrect: false,
},
password: {
label: Languages.password,
underlineColorAndroid: 'transparent',
autoCapitalize: 'none',
stylesheet: customStyle,
autoCorrect: false,
secureTextEntry: true,
},
},
};
};
onChange = value => {
this.setState(value);
};
render(){
return (
<View>
<LoginForm
ref="form"
type={this.User}
options={this.options}
value={this.state}
onChange={this.onChange}
/>
</View>
)}
}
Заранее спасибо.