fix: [types] allow Image "href" & "xlinkHref" to be strings (#1896)

Allow 'string' type for href and xlinkHref props in Image component.
Logic in the component allows passing 'string' values to the Image.resolveAssetSource by checking for its type, so it would be nice to reflect it on the properties types as well.
This commit is contained in:
Denis Slávik
2022-10-21 14:43:37 +02:00
committed by GitHub
parent dadf0c975e
commit 65f373b084
4 changed files with 4 additions and 6 deletions
+2 -2
View File
@@ -28,8 +28,8 @@ export interface ImageProps
y?: NumberProp;
width?: NumberProp;
height?: NumberProp;
xlinkHref?: RNImageProps['source'];
href?: RNImageProps['source'];
xlinkHref?: RNImageProps['source'] | string;
href?: RNImageProps['source'] | string;
preserveAspectRatio?: string;
opacity?: NumberProp;
clipPath?: string;
+2 -2
View File
@@ -252,8 +252,8 @@ export type ImageProps = {
y?: NumberProp,
width?: NumberProp,
height?: NumberProp,
xlinkHref?: $PropertyType<ReactNative.ImageProps, "source">,
href?: $PropertyType<ReactNative.ImageProps, "source">,
xlinkHref?: $PropertyType<ReactNative.ImageProps, "source"> | string,
href?: $PropertyType<ReactNative.ImageProps, "source"> | string,
preserveAspectRatio?: string,
opacity?: NumberProp,
clipPath?: string,