Skip to content

Invariant Violation: "//" is not a valid style property. #133

Closed
@Zn4rK

Description

@Zn4rK
styled.View`
  // background: green;
  background: red;
`;

Yields:

Invariant Violation: "//" is not a valid style property.
StyleSheet generated: {
  "//": "green",
  "backgroundColor": "red"
}
Valid style props: [
  "alignContent",
  "alignItems",
  "alignSelf",
  "aspectRatio",
   ...etc
]

StackTrace:

 at invariant (node_modules/invariant/invariant.js:40:15)
    at styleError (node_modules/react-native/Libraries/StyleSheet/StyleSheetValidation.js:77:3)
    at Function.validateStyleProp (node_modules/react-native/Libraries/StyleSheet/StyleSheetValidation.js:35:7)
    at Function.validateStyle (node_modules/react-native/Libraries/StyleSheet/StyleSheetValidation.js:55:28)
    at Object.create (node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:355:30)
    at InlineStyle.generateStyleObject (node_modules/styled-components/native/dist/styled-components.native.cjs.js:5809:33)
    at StyledNativeComponent.generateAndInjectStyles (node_modules/styled-components/native/dist/styled-components.native.cjs.js:6037:24)
    at node_modules/styled-components/native/dist/styled-components.native.cjs.js:5991:36
    at updateContextConsumer (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9740:19)
    at beginWork$1 (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10123:14)

Relevant dependencies:

    "styled-components": "^5.0.1"
    "react-native": "^0.61.5",
    "react-test-renderer": "^16.12.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions