You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble using this input spinner with Formik in React Native. I've narrowed the issue down to the onChange function of the input spinner but nothing I'm trying is working.
Edit: I fixed it, incase anyone also is having this problem the solution is below.
The fix is pretty simple, I was first trying to just pass formiks handleChange prop directly to the onChange of the Input spinner but you need to give it the setFieldProp like so:
<InputSpinner
skin="clean"
background={colors.primary}
min={0}
type="float"
name="weight"
value={values.weight}
initialValue={values.weight}
onChange={(num) => {
setFieldValue("weight", num)
setFieldTouched('weight', true, false)
}}
/>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am having trouble using this input spinner with Formik in React Native. I've narrowed the issue down to the onChange function of the input spinner but nothing I'm trying is working.
Edit: I fixed it, incase anyone also is having this problem the solution is below.
The fix is pretty simple, I was first trying to just pass formiks handleChange prop directly to the onChange of the Input spinner but you need to give it the setFieldProp like so:
<InputSpinner
skin="clean"
background={colors.primary}
min={0}
type="float"
name="weight"
value={values.weight}
initialValue={values.weight}
onChange={(num) => {
setFieldValue("weight", num)
setFieldTouched('weight', true, false)
}}
/>
Beta Was this translation helpful? Give feedback.
All reactions