react-native-material-textfield
react-native-material-textfield copied to clipboard
Stuck with the first value property value from 0.13.0+
Starting from version 0.13.0 when i try to change the value property it doesn't reflect on the component. version 0.12.0 works well
@ahmedreda97 Thank you!
I have spent days trying to figure out why TextField would not update when my last released version of the app worked fine.
I rolled back react-native-material-textfield 0.12.0 and problem is fixed:
"react": "^16.9.0",
"react-native": "0.60.6",
"react-native-material-textfield": "0.12.0",
This problem affects both iOS and Android.
Same issue here. Version 0.12.0 works without problem, but starting from 0.13.0 TextField does not reflect passed value.
Hey guys, i was going mad about this issue until blaming formik because of this. After replace this input for a different one i realized that formik had nothing to do with this. So reading closer this library documentation i found out this :
setValue()
Thus in my case i just need to do something like:
const CustomPicker = React.forwardRef(
(props: Props, ref: React.Ref<OutlinedTextField>) => {
const { label, textColor, name, theme } = props
const [field, meta] = useField(name)
React.useEffect(() => {
ref.current.**setValue**(field.value)
}, [field.value])
...
I hope this help to somebody
The issue is still present in 0.16 (latest) version of this library ( checked on android device), please fix this.
EDIT:
This is not an issue, this is just how the library works, you need to use setValue
to set the value of TextField, the value
prop only works as initialValue. This is explained in the issue #184
Hey guys, i was going mad about this issue until blaming formik because of this. After replace this input for a different one i realized that formik had nothing to do with this. So reading closer this library documentation i found out this :
setValue()
Thus in my case i just need to do something like:
const CustomPicker = React.forwardRef( (props: Props, ref: React.Ref<OutlinedTextField>) => { const { label, textColor, name, theme } = props const [field, meta] = useField(name) React.useEffect(() => { ref.current.**setValue**(field.value) }, [field.value]) ...
I hope this help to somebody
Thanks for the pointer, it helped me in my case. I thought it was Formik issue as well until I came across this comment, and the comment by @sriteja777, anyone facing form reset issue with this library using formik should see this comment https://github.com/n4kz/react-native-material-textfield/issues/184
The issue is still present in 0.16 (latest) version of this library ( checked on android device), please fix this.
EDIT: This is not an issue, this is just how the library works, you need to use
setValue
to set the value of TextField, thevalue
prop only works as initialValue. This is explained in the issue #184
This is definitely a bug, or the properly should be called initialValue.