Closed LouisJS closed 6 years ago
These might be related:
v7.1.0
)Confirmation that one of these is the cause or solution would be much appreciated.
Att: @jkomyno.
Unfortunately, i haven't found any issue nor solution related to mine in your links. No error is triggered but i don't get the desired output.
This is my form which is called by reduxForm
<View style={styles.container}>
<Text>Email:</Text>
<Field name="email" component={renderInput} />
<TouchableOpacity onPress={handleSubmit(submit)}>
<Text style={styles.button}>Submit</Text>
</TouchableOpacity>
</View>
And this is what my component looks like
const renderInput = ({ input: { value, onChange, onBlur, onFocus }}) => {
return <TextInput
style={styles.input}
onChangeText={onChange}
onBlur={onBlur}
onFocus={onFocus}
value={value}
/>
}
The value
property freezes the input and the onChangeText doesn't seems to work at all.
When i try to submit my form, it appears as an empty object.
I'm not using Immutable.
@erikras, I don't have this issue, if necessary I can provide a gist.
@LouisJS, you don't seem to be passing the onChange
prop to
@jkomyno Hi. I'm passing the input.onChange
method to TextInput
with onChangeText
.
It is such a simple case, i don't get why it doesn't work properly.
If there any chances you could provide a working example. We would be sure that i did something the wrong way. 👍
Solved. If it ever happens to you. You might have something wrong with your Redux Store setup (very hard to debug without Redux Dev Tools working on Simulator JS debugger) Or checkout if your react-native is not too recent. (had to downgrade to 0.42.x <=)
"prop-types": "^15.6.0", "react": "16.0.0-beta.5", "react-native": "0.49.1", "react-redux": "^5.0.6", "redux": "^3.7.2", "redux-form": "^7.1.0"
The React Native - Redux Form Implementation Guide 3. Connect the form fields to the store using the Field wrapper
Following the guide, when i arrive at this step and add the 'value' property to my InputText, i can't edit it in my iOS Simulator and so my form doesn't work.
Anyone facing this issue ?