Redux Form - Not able to type anything in input

会有一股神秘感。 提交于 2019-12-11 00:32:30

问题


Hi I have upgraded to redux-form version 6.0.0 recently. And I am facing an issue like I am not able to type anything in the text field.

P.S I am also using Reactintl. I am using compose to aggregate connect, reduxform and intl decorator

Here is my code Pastebin


回答1:


If I understand correctly, then starting with v6 you should provide extra onBlur and onChange methods for the input in order to update its state. For your stateless component renderInput it could be done like this:

const renderInput = (field) => {

  const onBlur = () => {
    field.input.onBlur(field.input.value);
  };

  const onChange = (inputValue) => {
    field.input.onChange(inputValue ? inputValue : '')
  };

  return <input {...field.input} onBlur={onBlur} onChange={onChange}
                [...other options omitted for readability] /> 

}


来源:https://stackoverflow.com/questions/39326454/redux-form-not-able-to-type-anything-in-input

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!