-
Notifications
You must be signed in to change notification settings - Fork 131
Crashing when using style prop that is a string #278
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
Comments
Same exact problem for me. Crashes eslint. Through trial and error I figured out that the bad rule that does this is: It also says the same in your error message, but just wanted to make it more clear. And yes, it happens with Expo's status bar element that has a string for its style attribute. |
As a temporary workaround you could assign the style string to a variable: const statusBarStyle = 'light'; and then use that as your style: <StatusBar style={ statusBarStyle } /> This will prevent |
The good news: this was fixed in this PR #262 which was merged in March 2021 b908186 The bad news: the latest release, 3.10.0, was in September 2020, so the fix isn't yet available. @Intellicode can you please publish a patch release to NPM? Thanks! [edit:] Sorry, just saw that you said on the PR you'd try to this weekend 🙌 Unfortunately the error seems to occur even if there's an eslint-disable for {/* eslint-plugin-react-native crashes on style="...", use style={'...'} */}
{/* https://github.com/Intellicode/eslint-plugin-react-native/issues/278 */}
{/* eslint-disable-next-line react/jsx-curly-brace-presence, react/style-prop-object */}
<StatusBar style={'light'} /> |
@AlanSl, just made a release, hope it works! If it breaks let me know. |
@Intellicode Thanks! 3.11.0 works fine for me, looks like this (and the two linked duplicates just above) are fixed 🎉 |
@AlanSl thanks for your confirmation! |
@Intellicode Getting this error in VSCode in v4.0.0: Eslint: v8.17.0
|
Here is the crashing error:
This is caused because the StatusBar component from Expo has a style prop that can be
auto
,inverted
,light
, ordark
. Here is the snippet where is crashing:This, is not:
The text was updated successfully, but these errors were encountered: