question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for React-Native specific properties

See original GitHub issue

There are several CSS properties that are specific to React-Native that are supported by styled-components/native. For example the following properties are part of React-Native but appear as errors when using this plugin:

const Main = styled.View`
  shadow-color: black;
  shadow-opacity: 0.5;
  shadow-offset: 2px 2px;
`

Would React-Native specific properties be something to consider supporting?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:62
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

66reactions
sreggcommented, Apr 23, 2019

This works for me:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-styled-plugin",
        "lint": {
          "validProperties": [
            "shadow-color",
            "shadow-opacity",
            "shadow-offset",
            "shadow-radius",
            "padding-horizontal",
            "padding-vertical",
            "margin-vertical",
            "margin-horizontal",
            "tint-color",
            "aspect-ratio",
            "elevation"
          ]
        }
      }
    ]
  }
}

notice validProperties is an actual array, not a csv string

20reactions
lidonghuacommented, Dec 6, 2018

After inspecting source code of the plugin, I managed to find a working solution.

Edit your tsconfig.json like this:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-styled-plugin",
        "lint": {
          "validProperties": "shadow-color,shadow-opacity,shadow-offset"
        }
      }
    ]
  }
}

Maybe it helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Platform Specific Code - React Native
React Native provides two ways to organize your code and separate it by platform: Using the Platform module. Using platform-specific file ...
Read more >
DOM Elements - React
In React, all DOM properties and attributes (including event handlers) ... The checked attribute is supported by <input> components of type checkbox or ......
Read more >
Where can I find all list of style properties supported by react ...
Here's a cheatsheet: React Native Styling Cheat Sheet. The supported styles are in the official documentation for each component. Here are the links...
Read more >
React Native Installation - Developer Guides Overview
React Native -Specific Captured Properties: · Type: For React Navigation, the event type will be reactNavigationScreenview . · path: The path property will...
Read more >
React Native - Advanced
To make things easier, you can register these properties as super properties. If you tell us just once that these properties are important,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found