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

style-prop-object does not allow null #812

Closed
vdh opened this issue Sep 8, 2016 · 7 comments
Closed

style-prop-object does not allow null #812

vdh opened this issue Sep 8, 2016 · 7 comments
Labels

Comments

@vdh
Copy link

vdh commented Sep 8, 2016

I use style variables that are conditionally set as objects only when required, and AFAIK it's valid to provide null props to React.

@ljharb ljharb added the bug label Sep 9, 2016
@ljharb
Copy link
Member

ljharb commented Sep 9, 2016

indeed, null and undefined should both be accepted.

@lencioni
Copy link
Collaborator

lencioni commented Sep 16, 2016

This might be worth looking into at the same time as #809

cc @petersendidit

@vdh
Copy link
Author

vdh commented Jan 19, 2017

@ljharb This fails in 6.9.0 on an edge case of an explicit null variable:

let style = null;
<div style={style}></div>

I dropped the unnecessary = null in my own code, so it's not an issue for me, but I thought I'd make a note of it just in case.

@ljharb
Copy link
Member

ljharb commented Jan 19, 2017

@vdh fails in what way?

@vdh
Copy link
Author

vdh commented Jan 20, 2017

@ljharb Line 37 doesn't have the same null check as line 72, so it gives a Style prop value must be an object error.

@vdh
Copy link
Author

vdh commented Jan 20, 2017

I was also able to get a test failure by duplicating this existing test and adding = null to it.

ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 20, 2017
@ljharb
Copy link
Member

ljharb commented Jan 20, 2017

@vdh thanks, this is now fixed in latest master.

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

No branches or pull requests

3 participants