Skip to content

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

Closed

Description

@michel-p

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

Activity

  1. elicwhite commented on Mar 10, 2018

    @elicwhite
    Contributor

    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

  2. locked as resolved and limited conversation to collaborators on Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions