Get value in `setValue`
See original GitHub issueI’m trying to make a conditional in my setValue like this:
setValue={
value !== 'custom' ? props.setValue(value) : props.setIsOverlayVisible(true)
}
However, the setValue callback returns a function instead of the value and I can’t do it in onChangeValue because I need it to retain the previous value if “custom” is selected. How do I go about getting the value in setValue ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
useForm - setValue - React Hook Form
This function allows you to dynamically set the value of a registered field and have the options to validate and update the form...
Read more >Solved: GetValue and setValue - ServiceNow Community
Variable in catalog item has some value, onChange of the field value, i should get the value and then append % to same...
Read more >PropertyInfo.SetValue Method (System.Reflection)
The SetValue(Object, Object) overload sets the value of a non-indexed property. To determine whether a property is indexed, call the GetIndexParameters method.
Read more >How to setValue and getValue when using useFormContext in ...
If you wnat to get the input value outside the Controller then the getValue must be the one returned by useForm.
Read more >Why values set by setValue are not get on getValues ... - GitHub
I have set the values of a field using methods.setValue('name', value, {shouldValidate: true, shouldDirty: true }) and get them using ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You shoudn’t touch the
setValueprop.to retain values:
Your comment in https://github.com/hossein-zare/react-native-dropdown-picker/issues/256#issuecomment-1072655805 solved my issue thank you!