Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Fragment in FormSection #4141

Open
patrikmolsson opened this issue Jul 23, 2018 · 2 comments
Open

Support for Fragment in FormSection #4141

patrikmolsson opened this issue Jul 23, 2018 · 2 comments

Comments

@patrikmolsson
Copy link

Are you submitting a bug report or a feature request?

Is most likely a feature request, but could be seen as a bug as well.

What is the current behavior?

When using FormSection component and providing the component to render as, Fragment will render an error message like this:

proxyConsole.js:72 Warning: Failed prop type: Invalid prop `component` supplied to `FormSection`.
    in FormSection (created by SimpleForm)
    in SimpleForm (created by Form(SimpleForm))
    in Form(SimpleForm) (created by Connect(Form(SimpleForm)))
    in Connect(Form(SimpleForm)) (created by ReduxForm)
    in ReduxForm
    in div
    in Provider

The rendered output, both in the DOM and in the redux store although works as expected.

What is the expected behavior?

That there is no error message.

Sandbox Link

https://codesandbox.io/s/rmr11kmkxo

What's your environment?

Redux form version: v.7.4.2.
Chrome: 65

Other information

@danielrob
Copy link
Collaborator

From memory Fragment's can't accept props, so this would require a two-fold fix of updating prop-types and not passing props when detecting a fragment. PR's welcome.

@lexanth
Copy link

lexanth commented Sep 7, 2018

#3859 fixed this. However, Fragments are JS Symbols, so this only works if the version of React in use in your app matches the version of react-is that redux-form depends on (currently 16.4.1).

Demonstrated in this sandbox: https://codesandbox.io/s/p5wvqqnw3j

Works fine with react 16.4.1, if you bump React to 16.4.2 or any other version, it gives a prop type error.

Not completely sure how to fix this. All I can think of is making react-is a peer dependency to pick up the consumer's version of it. Not sure if that would actually work though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants