相关疑难解决方法(0)

React Native + Redux表单 - 使用键盘下一步按钮转到下一个TextInput字段

我在React Native应用程序中使用Redux Form(RF).一切正常但我无法弄清楚如何refsField输入到Redux Form转到下一个输入字段.

没有RF,这个解决方案就可以正常工作.

这是我的代码:

class RenderInput extends Component {
   const { input, nextField, refs,
        meta: { touched, error, warning },
        input: { onChange } } = this.props
   render() {
      return (
         <Input
            returnKeyType = {'next'}
            onChangeText={onChange}
            onBlur={input.onBlur}
            onFocus={input.onFocus}
            onSubmitEditing = {(event) => {
               // refs is undefined
               refs[nextField].focus()
            }}/>
      )
   }
}

class Form extends Component {
   render() {
      return (
         <Field
            name="field1"
            focus
            withRef
            ref='field1'
            nextField = "field2"
            component={RenderInput}/> …
Run Code Online (Sandbox Code Playgroud)

react-native redux-form

5
推荐指数
1
解决办法
4645
查看次数

标签 统计

react-native ×1

redux-form ×1