【问题标题】:How do I tab to next input field with tcomb-form-native?如何使用 tcomb-form-native 跳转到下一个输入字段?
【发布时间】:2017-09-29 05:55:50
【问题描述】:

将 tcomb-form-native 库与 react native 结合使用 - 我已将返回键类型设置为 next。如何实现制表符/下一个行为,使其专注于表单中的下一个字段?

【问题讨论】:

    标签: react-native tcomb-form-native


    【解决方案1】:

    我可以覆盖表单中选项对象的onSubmitEditing 属性,以专门将焦点设置在下一个表单字段上。

          ref={(c) => { this.loginForm = c; }}
          options={{
              fields: {
                email: {
                  autoCapitalize: 'none',
                  keyboardType: 'email-address',
                  error: 'Invalid email',
                  returnKeyType: 'next',
                  onSubmitEditing: () => this.loginForm.getComponent('password').refs.input.focus(),
                },
                password: {
                  password: true,
                  secureTextEntry: true,
                  error: 'Invalid password',
                  onSubmitEditing: () => this.submit(),
                },
              },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      • 2011-09-15
      相关资源
      最近更新 更多