diff --git a/src/utils.ts b/src/utils.ts index abff57e9f4..0200ffc05a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,8 +1,7 @@ import type {Component, RefObject, ComponentClass} from 'react'; -import {Image, findNodeHandle} from 'react-native'; +import {Image, findNodeHandle, type ImageSourcePropType} from 'react-native'; import type {ReactVideoSource, ReactVideoSourceProperties} from './types/video'; - // eslint-disable-next-line @typescript-eslint/no-explicit-any export function generateHeaderForNative(obj?: Record) { if (!obj) { @@ -12,8 +11,9 @@ export function generateHeaderForNative(obj?: Record) { } type Source = ImageSourcePropType | ReactVideoSource; + export function resolveAssetSourceForVideo( - source: ReactVideoSource, + source: Source, ): ReactVideoSourceProperties { // This is deprecated, but we need to support it for backward compatibility if (typeof source === 'number') { @@ -22,7 +22,7 @@ export function resolveAssetSourceForVideo( }; } - if (typeof source.uri === 'number') { + if ('uri' in source && typeof source.uri === 'number') { return { ...source, uri: Image.resolveAssetSource(source.uri).uri,