Custom input with initial value is not working
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, react, react-native
Research direction
Start at the WithFormikControl implementation shown in the issue and inspect how its mapProps function selects the input value from Formik values and the value prop. Verify the precedence when an initial value is supplied, then update the selection so the reported getValue result is not overridden. Done means custom inputs preserve the intended initial value behavior.
Written by the indexing model from the issue text.
Description
If we give initial value as per the code in WithFormikControl the initila value from props always overrides the value got from getValue
const withFormikControl = compose(
withErrorIfNeeded,
connect,
mapProps(
({
formik: { values, setFieldValue, setFieldTouched },
name,
value,
...props
}) => ({
value: get(values, name) === undefined ? value : get(values, name),
setFieldValue: (value, ...args) => setFieldValue(name, value, ...args),
setFieldTouched: (value, ...args) =>
setFieldTouched(name, value, ...args),
name,
...props
})
)
);
this should be the code
- Dominant language
- JavaScript
- Stars
- 398
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bamlab/react-native-formik
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
bamlab/react-native-formik#173 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
bamlab/react-native-formik#162 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
bamlab/react-native-formik#156 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
bamlab/react-native-formik#145 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
bamlab/react-native-formik#142 · 4 comments · 2 reactions ·
All issues in bamlab/react-native-formik
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·