-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
v4: Cannot style the SVG fill property #614
Comments
Firstly, you can now remove You can then write your styles as On native, |
@marklawlor thank you, this export default function App() {
return (
<View className="flex-1 bg-white items-center justify-center gap-8 p-6">
{/* Height and width do not work */}
<ErrorIcon style={{ height: 64, width: 64, fill: "red" }} />
{/* Works */}
<ErrorIcon height={64} width={64} fill="red" />
{/* Does not work */}
<ErrorIcon className="prop:h-16 prop:w-16 fill-red-500" />
{/* Does not work with icon as an element prop */}
<Foo icon={ErrorIcon} />
</View>
);
} Am I missing something in my config? Apologies if so. |
Can you try |
Yes! Thank you so much @marklawlor |
Ah, native <ErrorIcon style={{ height: 64, width: 64, fill: "red" }} /> Which is weird right? |
No, that is to be expected. NativeWind only works with Wrapping in If you want that behaviour you can restore the |
It works after I modified it like below.
|
I am trying to style an SVG file imported directly into my app via the magic of
react-native-svg
andreact-native-svg-transformer
but I am unable to style thefill
property using the latest Nativewind. I'm trying to usecssInterop
to add support forheight
,width
andfill
but the latter does not work.Here is a sample repo: https://github.com/robcaldecott/nativewind-4-issues
Here is the code:
When the app runs I see the following console error:
This would work in v2 using
styled
like this:I am getting a TS issue with that
fill
property ofnativeStyleToProp
so cannot rule out I'm misunderstanding how this should work but our app makes extensive use of SVGs and I'm sure this must be possible?We also pass elements as props in some of our components so would love this to work as well (as the
Foo
example in the code.)The text was updated successfully, but these errors were encountered: