diff --git a/src/VideoNativeComponent.ts b/src/VideoNativeComponent.ts index d4d70450..96923561 100644 --- a/src/VideoNativeComponent.ts +++ b/src/VideoNativeComponent.ts @@ -7,7 +7,7 @@ import {NativeModules, requireNativeComponent} from 'react-native'; import type ResizeMode from './types/ResizeMode'; import type FilterType from './types/FilterType'; import type Orientation from './types/Orientation'; -import type {AdEvent, OnTextTracksTypeData} from './types'; +import type {AdEvent, EnumValues, OnTextTracksTypeData} from './types'; // -------- There are types for native component (future codegen) -------- // if you are looking for types for react component, see src/types/video.ts @@ -270,7 +270,7 @@ export interface VideoNativeProps extends ViewProps { adTagUrl?: string; allowsExternalPlayback?: boolean; // ios, true maxBitRate?: number; - resizeMode?: ResizeMode; + resizeMode?: EnumValues; repeat?: boolean; automaticallyWaitsToMinimizeStalling?: boolean; textTracks?: TextTracks; @@ -279,7 +279,7 @@ export interface VideoNativeProps extends ViewProps { paused?: boolean; muted?: boolean; controls?: boolean; - filter?: FilterType; + filter?: EnumValues; filterEnabled?: boolean; volume?: number; // default 1.0 playInBackground?: boolean; diff --git a/src/types/video.ts b/src/types/video.ts index 0f169133..48a8c350 100644 --- a/src/types/video.ts +++ b/src/types/video.ts @@ -1,11 +1,15 @@ import type {ISO639_1} from './language'; import type {ReactVideoEvents} from './events'; -import type {AccessibilityProps, StyleProp, ViewStyle} from 'react-native'; +import type {StyleProp, ViewProps, ViewStyle} from 'react-native'; import type VideoResizeMode from './ResizeMode'; import type FilterType from './FilterType'; export type Headers = Record; +export type EnumValues = T extends string + ? `${T}` | T + : T; + export type ReactVideoSourceProperties = { uri?: string; isNetwork?: boolean; @@ -172,7 +176,7 @@ export enum PosterResizeModeType { export type AudioOutput = 'speaker' | 'earpiece'; -export interface ReactVideoProps extends ReactVideoEvents, AccessibilityProps { +export interface ReactVideoProps extends ReactVideoEvents, ViewProps { source?: ReactVideoSource; drm?: Drm; style?: StyleProp; @@ -188,31 +192,31 @@ export interface ReactVideoProps extends ReactVideoEvents, AccessibilityProps { currentPlaybackTime?: number; // Android disableFocus?: boolean; disableDisconnectError?: boolean; // Android - filter?: FilterType; // iOS + filter?: EnumValues; // iOS filterEnabled?: boolean; // iOS focusable?: boolean; // Android fullscreen?: boolean; // iOS fullscreenAutorotate?: boolean; // iOS - fullscreenOrientation?: FullscreenOrientationType; // iOS + fullscreenOrientation?: EnumValues; // iOS hideShutterView?: boolean; // Android - ignoreSilentSwitch?: IgnoreSilentSwitchType; // iOS + ignoreSilentSwitch?: EnumValues; // iOS minLoadRetryCount?: number; // Android maxBitRate?: number; - mixWithOthers?: MixWithOthersType; // iOS + mixWithOthers?: EnumValues; // iOS muted?: boolean; paused?: boolean; pictureInPicture?: boolean; // iOS playInBackground?: boolean; playWhenInactive?: boolean; // iOS poster?: string; - posterResizeMode?: PosterResizeModeType; + posterResizeMode?: EnumValues; preferredForwardBufferDuration?: number; // iOS preventsDisplaySleepDuringVideoPlayback?: boolean; progressUpdateInterval?: number; rate?: number; repeat?: boolean; reportBandwidth?: boolean; //Android - resizeMode?: VideoResizeMode; + resizeMode?: EnumValues; selectedAudioTrack?: SelectedTrack; selectedTextTrack?: SelectedTrack; selectedVideoTrack?: SelectedVideoTrack; // android