我在React Native应用程序中使用Redux Form(RF).一切正常但我无法弄清楚如何refs从Field输入到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)