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 }}
Repository navigation
[Feature request] Add a way to add style to <img /> #2139
@yuxizhe I just checked and this is what TypeScripts tells me:
TS2769: No overload matches this call. Overload 1 of 2, '(props: Omit<Omit<ImageProps & RefAttributes<Image> & { height: number; width: number; }, never> & Partial<Pick<ImageProps & RefAttributes<Image> & { ...; }, never>>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error. Type '{ transform: string; }' is not assignable to type 'StyleProp<ImageStyle>'. Types of property 'transform' are incompatible. Type 'string' is not assignable to type '(PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 7 more ... | MatrixTransform)[] | undefined'. Overload 2 of 2, '(props: StyledComponentPropsWithAs<typeof Image, DefaultTheme, { height: number; width: number; }, never, typeof Image, typeof Image>): ReactElement<...>', gave the following error. Type '{ transform: string; }' is not assignable to type 'StyleProp<ImageStyle>'. Types of property 'transform' are incompatible. Type 'string' is not assignable to type '(PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 7 more ... | MatrixTransform)[] | undefined'.
So far, we have to stick to our patch-package until this is properly fixed.
Thanks for the report. #1786 lists this request under its "Support for CSS like backgroundBlendMode" item. I'm closing this issue as a duplicate of #1786. Please follow that issue for updates.
Activity
yuxizhe commentedon Jun 28, 2022
@kopax-polyconseil why not use style prop
<Image style={{transform: 'scale(1.1)'}}>kopax-polyconseil commentedon Jun 28, 2022
I think I tried, at the time I wrote. Does it work now ?
kopax-polyconseil commentedon Jul 18, 2022
@yuxizhe I just checked and this is what TypeScripts tells me:
TS2769: No overload matches this call. Overload 1 of 2, '(props: Omit<Omit<ImageProps & RefAttributes<Image> & { height: number; width: number; }, never> & Partial<Pick<ImageProps & RefAttributes<Image> & { ...; }, never>>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error. Type '{ transform: string; }' is not assignable to type 'StyleProp<ImageStyle>'. Types of property 'transform' are incompatible. Type 'string' is not assignable to type '(PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 7 more ... | MatrixTransform)[] | undefined'. Overload 2 of 2, '(props: StyledComponentPropsWithAs<typeof Image, DefaultTheme, { height: number; width: number; }, never, typeof Image, typeof Image>): ReactElement<...>', gave the following error. Type '{ transform: string; }' is not assignable to type 'StyleProp<ImageStyle>'. Types of property 'transform' are incompatible. Type 'string' is not assignable to type '(PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ... 7 more ... | MatrixTransform)[] | undefined'.So far, we have to stick to our patch-package until this is properly fixed.
necolas commentedon Jul 18, 2022
That's because (as explained in the ts error message you pasted) you're passing a transform string where React Native expects an object
kopax-polyconseil commentedon Aug 1, 2022
@necolas the format was given by @yuxizhe in the previous message. How should I write to redo the test ?
zoontek commentedon Nov 6, 2026
Thanks for the report. #1786 lists this request under its "Support for CSS like
backgroundBlendMode" item. I'm closing this issue as a duplicate of #1786. Please follow that issue for updates.