You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
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:
This plugin can automatically contribute a list of valid react-native style properties. PRs welcome. Let me know if you have any questions about implementing this
Reacted by Jan Czizikow, Eric Eldredge, Andréas Hanss, Benjamin von Polheim, Victor Malov, João Ferreira, Roman Mahotskyi, Nelson Sousa, Marcus Ekwall, Jonathan Ferreira and 6 more
Reacted by Rayon Lindraz, ManAnRuck, Matilda Söderblom, Max Gomez Åberg and Matthieu Bézard
Workaround provided by Donghua Li (@lidonghua) kind of works, does anyone have an exhaustive list of react-native specific properties to use until these become supported?
Priit Kallas (@kallaspriit) so far I have: shadow-color,shadow-opacity,shadow-offset,padding-horizontal,padding-vertical,margin-vertical,margin-vertical,tint-color,aspect-ratio,elevation
Reacted by Dries Van Schevensteen, Simon Reggiani, v1rtl and Ana Arezo
notice validProperties is an actual array, not a csv string
Reacted by burzymur, Jeff Gu Kang, Chris Bews, Victor Malov, João Ferreira, brunoebstein, Jeremy Gollehon, Hiep Dam, Yuri Toledo, Gary and 40 more
Reacted by ManAnRuck, Chianti Scarlett, rovas, Gustavo Gava, Paulo Silva, Ana Arezo, Seanmclem and Sávio
Reacted by Antoine Rousseau, Rayon Lindraz, Jongwoo Moon, Ahmed Elrefaey, Marcos Dourado, ManAnRuck, Chianti Scarlett, Gustavo Gava, Paulo Silva, Ana Arezo and 3 more
So I have this warning too in VSCode: Unknown property: 'shadow-radius' ts-styled-plugin(9999)
I set up a tsconfig.json file but actually I don't use TypeScript ! Anyway, this file did not change a thing for me. I also installed stylelint but it didn't change either, still the warning.
Reacted by Jani Partanen, Diego Rodrigues, Daybayzayd, andy, ManAnRuck, Michael McKinley, Tatiana Narumi Onishi , castellan, Arnaud Ambroselli, Gustavo Moraes and 1 more
Hey all. This issue was super helpful to fix missing react-native properties. Thanks! 👍
My next question...
Is there a way to say "only show these properties" in the auto-complete. From time to time I find myself accidentally using web properties while in a React Native project. I'd love for the auto-complete to only show valid React Native properties.
I can put the list together but not sure if there's a place to put it. 😃
Is this possible? Thanks.
Activity
mjbvz commentedon Oct 29, 2018
This is now possible using the css-language-service api: microsoft/vscode-css-languageservice#111
This plugin can automatically contribute a list of valid react-native style properties. PRs welcome. Let me know if you have any questions about implementing this
alvincrespo commentedon Nov 6, 2018
More than happy to help here. Matt Bierner (@mjbvz) Is there a guide on how to add these properties?
mjbvz commentedon Nov 7, 2018
Pass a list of
validPropertiesto the language services, here I believe.lidonghua commentedon Dec 6, 2018
After inspecting source code of the plugin, I managed to find a working solution.
Edit your
tsconfig.jsonlike this:{ "compilerOptions": { "plugins": [ { "name": "typescript-styled-plugin", "lint": { "validProperties": "shadow-color,shadow-opacity,shadow-offset" } } ] } }Maybe it helps.
ScreamZ commentedon Feb 14, 2019
Any news on this ?
kallaspriit commentedon Feb 19, 2019
Workaround provided by Donghua Li (@lidonghua) kind of works, does anyone have an exhaustive list of react-native specific properties to use until these become supported?
ScreamZ commentedon Feb 19, 2019
Priit Kallas (@kallaspriit) You can add
tint-colorbut I guess it's a step by step process once you get an error…DriesVS commentedon Mar 11, 2019
Priit Kallas (@kallaspriit) so far I have:
shadow-color,shadow-opacity,shadow-offset,padding-horizontal,padding-vertical,margin-vertical,margin-vertical,tint-color,aspect-ratio,elevationsregg commentedon Apr 23, 2019
This works for me:
notice
validPropertiesis an actual array, not a csv stringdimaip commentedon Oct 4, 2019
Now how do you disallow properties which are not supported by RN, e.g.
box-shadow?mjbvz commentedon Oct 4, 2019
Could someone please submit a PR that documents
validPropertiesarnaudambro commentedon Oct 17, 2019
So I have this warning too in VSCode:
Unknown property: 'shadow-radius' ts-styled-plugin(9999)I set up a
tsconfig.jsonfile but actually I don't use TypeScript ! Anyway, this file did not change a thing for me. I also installedstylelintbut it didn't change either, still the warning.Any idea ?
I updated the properties for those in needs
robinmetral commentedon Jan 6, 2020
If your project isn't using TypeScript, create a
jsconfig.jsoninstead of atsconfig.json.Sample
jsconfig.json(at the root of your project):{ "compilerOptions": { "plugins": [ { "name": "typescript-styled-plugin", "lint": { "validProperties": [ "aspect-ratio", "elevation", "margin-vertical", "margin-horizontal", "padding-horizontal", "padding-vertical", "resize-mode", "shadow-color", "shadow-opacity", "shadow-offset", "shadow-radius", "text-align-vertical", "tint-color" ] } } ] } }GollyJer commentedon Jun 30, 2020
Hey all. This issue was super helpful to fix missing
react-nativeproperties. Thanks! 👍My next question...
Is there a way to say "only show these properties" in the auto-complete. From time to time I find myself accidentally using web properties while in a React Native project. I'd love for the auto-complete to only show valid React Native properties.
I can put the list together but not sure if there's a place to put it. 😃
Is this possible? Thanks.
👉 Equivalent StackOverflow Question
rayonnunes commentedon Nov 24, 2020
You can also disable the warnings for unknown properties (at your own risk of losing some intellisense) adding in your
tsconfig.json:Referring the official documentation: https://github.com/microsoft/typescript-styled-plugin#unknownproperties
lcustodio commentedon Mar 29, 2022
Any updates on this?
Typescript + Styled Components + React Nativestill not workingali-soltanii commentedon Sep 8, 2022
This is the list I'm using.
pke commentedon Nov 7, 2022
Been 4 years. Are there any plans to add this to the official distribution config?
karlhorky commentedon Nov 21, 2022
Matt Bierner (@mjbvz) Ok, since I'm also having this problem with
vscode-styled-components.I'm not sure if I'm doing this contribution correctly, but I opened a PR over here, only for the standard
aspect-ratioproperty:mjbvz commentedon Apr 4, 2023
Closing as this package has been deprecated in favor of the official styled-components/typescript-styled-plugin fork
After updating to that fork, follow up in the styled-components repo if this is still an issue