【问题标题】:When I use secureTextEntry = {true} the input reset the value when try to type again当我使用secureTextEntry = {true}时,输入会在尝试再次输入时重置值
【发布时间】:2018-02-19 20:32:27
【问题描述】:

我使用 react native TextInput 字段来保存密码值,所以我添加了secureTextEntry 来隐藏该值。所以我输入密码,一切都很好,但是如果我去其他字段让说用户名,然后我回到密码,我想在密码中添加一个新字符,我在输入变得清晰之前输入它并获取新的字符作为新密码。因此,例如,如果我输入“cat”,然后我想添加另一个字母,例如“o”,它不会像这样添加:“cato”而是将值设置为“o”

我正在使用onChangeText 来处理状态,但我不知道那里发生了什么..

这是输入:

<TextInput onChangeText = {(pass) => this.setState({pass})} value = {this.state.pass} secureTextEntry = {true} />

【问题讨论】:

    标签: react-native


    【解决方案1】:

    默认情况下,iOS 会清除安全文本字段中的文本。 请参阅UITextField with secure entry, always getting cleared before editingUITextField with secure entry, always getting cleared before editing

    在底层 UITextField 上对此问题的进一步讨论

    【讨论】:

      猜你喜欢
      • 2014-11-15
      • 2017-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 1970-01-01
      相关资源
      最近更新 更多