Skip to content

Commit 0f62d0c

Browse files
committed
narrower type: replaced the broad 'ImageSourcePropType' with a 'ImageRequireSource'. Now icon can be used source prop in <FastImage>.
1 parent 2c39b76 commit 0f62d0c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Platform} from 'react-native';
1+
import {Platform, type ImageRequireSource} from 'react-native';
22
import type {MapId} from './type';
33

44
export const isIOS: boolean = Platform.OS === 'ios';
@@ -76,7 +76,7 @@ export const generateTitles = (
7676
};
7777
};
7878

79-
export const icons: Record<string, number> = {
79+
export const icons: Record<string, ImageRequireSource> = {
8080
'apple-maps': require('./images/apple-maps.png'),
8181
'google-maps': require('./images/google-maps.png'),
8282
citymapper: require('./images/citymapper.png'),

src/type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {ImageSourcePropType} from 'react-native';
1+
import type {ImageRequireSource} from 'react-native';
22

33
/** id for map application. this is the id that is passed to the `app` option */
44
export type MapId =
@@ -40,7 +40,7 @@ export interface SharedOptions {
4040
export type GetAppsResponse = {
4141
id: MapId;
4242
name: string;
43-
icon: ImageSourcePropType;
43+
icon: ImageRequireSource;
4444
/** function to link user to map app */
4545
open: () => Promise<string | null | undefined>;
4646
};

0 commit comments

Comments
 (0)