Skip to content Skip to sidebar Skip to footer

Redux Form In React Native, Onchangetext With Value Not Work Correcly

I use TextInput with onChangeText and Value, Value for use initialValues, and onChangeText for change this value. When I only use onChangeText without Value, it works correcly, but

Solution 1:

I guess, you should pass most of the redux-formprops.input to the react-native<TextInput />.

Here's a complete wrapper, taken from Easy forms in React Native with Redux Form article:

Input.js:

importReactfrom'react';
import { TextInput, View, Text } from'react-native';

// Your custom Input wrapper (adapter betwen `redux-form` and `react-native`exportdefault ({ input, ...inputProps }) => (
  <View><TextInput
      {...inputProps}
      onChangeText={input.onChange}onBlur={input.onBlur}onFocus={input.onFocus}value={input.value}
      /></View>
);

Usage:

<Field name="firstName" component={Input} />

Post a Comment for "Redux Form In React Native, Onchangetext With Value Not Work Correcly"