Setting the value doesn't work for arrays

Open
#45 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, react, react-native
Domain
mobile

Research direction

Start at src/makeReactNativeField.js#L9 and inspect how the field name is passed to lodash for nested array paths. Reproduce the example with arrayValue.${i}.name and verify that setting the input updates the nested name value; done when this case works without regressing ordinary field names.

Written by the indexing model from the issue text.

Description

question

If my form state has a value, that is an array: [this] https://github.com/bamlab/react-native-formik/blob/master/src/makeReactNativeField.js#L9 fails

Say the form is like:

{
  arrayValue: [
    { name: "Hello" }
  ]
}

Indeed you would set name=arrayValue.${i}.name on the input and lodash is not getting by path

Ping @Gguigre if you want to add more details

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bamlab/react-native-formik

All issues in bamlab/react-native-formik

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.