question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field prop `data` moved from `...rest` props into `meta` prop

See original GitHub issue

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

The package react-native-material-dropdown has a data prop to pass the list of items for dropdown. https://github.com/n4kz/react-native-material-dropdown

Previously to #711 PR I used the final-form wrapper as

<Dropdown
            {...input}
            onChangeText={input.onChange}
            value={`${input.value}`}
            label={label}
            error={getErrorMessage(meta)}
            {...rest}
        />

For now data prop moved from ...rest to meta prop. So I’ve got an unexpected bug. To fix it I need to pass the data prop manually

<Dropdown
            {...input}
            data={meta.data} // I need to pass this prop manually 
            onChangeText={input.onChange}
            value={`${input.value}`}
            label={label}
            error={getErrorMessage(meta)}
            {...rest}
        />

What is the expected behavior?

The expected is that the data prop remains in ...rest props.

Sandbox Link

https://codesandbox.io/s/hardcore-bird-hly9t

What’s your environment?

“final-form”: “^4.18.7”, “react-final-form”: “^6.3.5”,

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeTaylorcommented, Feb 13, 2020

The commit at f3c1aea has the backwards-incompatible effect of preventing a <Field> from using a prop called data. We have that does this, and which inexplicably stopped working due to the react-final-form change. (One of our devs spent the whole morning tracking down this action-at-a-distance bug.)

Can this change please be unwound until the next major release, since it’s a breaking change?

1reaction
PerfectPixelcommented, Feb 4, 2020

In my eyes the change made is still a bugfix as the intention of the <Field /> props were that they provide the parameters for FieldConfig + x. data is part of the FieldConfig. It was not there and it should be => bugfix. Surplus props are passed down to the rendered component.

That being said, exactly for the reason of namespace collisions useField or <Field>{(props) => ...}</Field> exist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass all other props to react class? - Stack Overflow
how would I pass down any other props that I originally don't expect, but say someone else using my component would want to...
Read more >
Transferring Props | React
Rest properties allow you to extract the remaining properties from an object into a new object. It excludes every other property listed in...
Read more >
Lifting State Up - React
Let's see how this works step by step. First, we will replace this.state.temperature with this.props.temperature in the TemperatureInput component.
Read more >
React-admin - Upgrading to v4 - Marmelab
The <Admin initialState> prop used to be used to initialize the store. As there is no Redux store anymore, you cannot set the...
Read more >
Unit Testing in React: Full Guide on Jest and Enzyme Testing
Testing props: As a rule, I divide the testing of the props into two tests: – Firstly, check the render of default prop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found