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

RN 0.54 - Stylesheet Flow types incompatible with spread operator #18277

Closed
michel-p opened this issue Mar 8, 2018 · 1 comment
Closed

RN 0.54 - Stylesheet Flow types incompatible with spread operator #18277

michel-p opened this issue Mar 8, 2018 · 1 comment
Labels
JavaScript Resolution: Locked This issue was locked by the bot.

Comments

@michel-p
Copy link

michel-p commented Mar 8, 2018

Hi everyone, since the last react-native update, all my Stylesheet files are generating flow errors because of the spread Operator. Can someone help me resolve it ?

Environment

OS: macOS High Sierra 10.13.3
Node: 8.6.0
Yarn: 1.3.2
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.0 => 0.54.0

Expected Behavior

No flow error, recognizing spread.

Actual Behavior

image

Steps to Reproduce

Just use a spread operator in a Stylesheet definition.
image

@elicwhite
Copy link
Member

elicwhite commented Mar 10, 2018

Unfortunately, due to a bug in Flow, as we tighten the types of the stylesheets, they no longer support being spread into. My recommendation is to create a second style that is just fonts.BnpSansCondensed and pass your component an array containing both styles.

The good news is that flow will start enforcing that only view styles can be passed to view, and only text styles can be passed to text.

cc @samwgoldman

julienR2 pushed a commit to nowmad-io/hybridapp that referenced this issue May 28, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Mar 10, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
JavaScript Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants