MCPcopy Create free account
hub / github.com/react-native-maps/react-native-maps / fixImageProp

Function fixImageProp

src/fixImageProp.ts:3–17  ·  view source on GitHub ↗
(
  image: ImageSourcePropType,
)

Source from the content-addressed store, hash-verified

1import {Image, type ImageSourcePropType} from 'react-native';
2
3export function fixImageProp(
4 image: ImageSourcePropType,
5): {uri: string} | ImageSourcePropType {
6 if (typeof image === 'string') {
7 return {uri: image};
8 }
9
10 if (typeof image === 'number') {
11 // Handle local image asset (require('./image.png'))
12 const resolvedImage = Image.resolveAssetSource(image);
13 return resolvedImage?.uri ? {uri: resolvedImage.uri} : image;
14 }
15
16 return image;
17}

Callers 2

renderMethod · 0.90
renderMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…