chore(typescript): upgrade enum types (#3453)

This commit is contained in:
Krzysztof Moch 2024-01-04 08:48:56 +01:00 committed by GitHub
parent f20d68b814
commit 51828f350f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import {NativeModules, requireNativeComponent} from 'react-native';
import type ResizeMode from './types/ResizeMode'; import type ResizeMode from './types/ResizeMode';
import type FilterType from './types/FilterType'; import type FilterType from './types/FilterType';
import type Orientation from './types/Orientation'; 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) -------- // -------- There are types for native component (future codegen) --------
// if you are looking for types for react component, see src/types/video.ts // 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; adTagUrl?: string;
allowsExternalPlayback?: boolean; // ios, true allowsExternalPlayback?: boolean; // ios, true
maxBitRate?: number; maxBitRate?: number;
resizeMode?: ResizeMode; resizeMode?: EnumValues<ResizeMode>;
repeat?: boolean; repeat?: boolean;
automaticallyWaitsToMinimizeStalling?: boolean; automaticallyWaitsToMinimizeStalling?: boolean;
textTracks?: TextTracks; textTracks?: TextTracks;
@ -279,7 +279,7 @@ export interface VideoNativeProps extends ViewProps {
paused?: boolean; paused?: boolean;
muted?: boolean; muted?: boolean;
controls?: boolean; controls?: boolean;
filter?: FilterType; filter?: EnumValues<FilterType>;
filterEnabled?: boolean; filterEnabled?: boolean;
volume?: number; // default 1.0 volume?: number; // default 1.0
playInBackground?: boolean; playInBackground?: boolean;

View File

@ -1,11 +1,15 @@
import type {ISO639_1} from './language'; import type {ISO639_1} from './language';
import type {ReactVideoEvents} from './events'; 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 VideoResizeMode from './ResizeMode';
import type FilterType from './FilterType'; import type FilterType from './FilterType';
export type Headers = Record<string, string>; export type Headers = Record<string, string>;
export type EnumValues<T extends string | number> = T extends string
? `${T}` | T
: T;
export type ReactVideoSourceProperties = { export type ReactVideoSourceProperties = {
uri?: string; uri?: string;
isNetwork?: boolean; isNetwork?: boolean;
@ -172,7 +176,7 @@ export enum PosterResizeModeType {
export type AudioOutput = 'speaker' | 'earpiece'; export type AudioOutput = 'speaker' | 'earpiece';
export interface ReactVideoProps extends ReactVideoEvents, AccessibilityProps { export interface ReactVideoProps extends ReactVideoEvents, ViewProps {
source?: ReactVideoSource; source?: ReactVideoSource;
drm?: Drm; drm?: Drm;
style?: StyleProp<ViewStyle>; style?: StyleProp<ViewStyle>;
@ -188,31 +192,31 @@ export interface ReactVideoProps extends ReactVideoEvents, AccessibilityProps {
currentPlaybackTime?: number; // Android currentPlaybackTime?: number; // Android
disableFocus?: boolean; disableFocus?: boolean;
disableDisconnectError?: boolean; // Android disableDisconnectError?: boolean; // Android
filter?: FilterType; // iOS filter?: EnumValues<FilterType>; // iOS
filterEnabled?: boolean; // iOS filterEnabled?: boolean; // iOS
focusable?: boolean; // Android focusable?: boolean; // Android
fullscreen?: boolean; // iOS fullscreen?: boolean; // iOS
fullscreenAutorotate?: boolean; // iOS fullscreenAutorotate?: boolean; // iOS
fullscreenOrientation?: FullscreenOrientationType; // iOS fullscreenOrientation?: EnumValues<FullscreenOrientationType>; // iOS
hideShutterView?: boolean; // Android hideShutterView?: boolean; // Android
ignoreSilentSwitch?: IgnoreSilentSwitchType; // iOS ignoreSilentSwitch?: EnumValues<IgnoreSilentSwitchType>; // iOS
minLoadRetryCount?: number; // Android minLoadRetryCount?: number; // Android
maxBitRate?: number; maxBitRate?: number;
mixWithOthers?: MixWithOthersType; // iOS mixWithOthers?: EnumValues<MixWithOthersType>; // iOS
muted?: boolean; muted?: boolean;
paused?: boolean; paused?: boolean;
pictureInPicture?: boolean; // iOS pictureInPicture?: boolean; // iOS
playInBackground?: boolean; playInBackground?: boolean;
playWhenInactive?: boolean; // iOS playWhenInactive?: boolean; // iOS
poster?: string; poster?: string;
posterResizeMode?: PosterResizeModeType; posterResizeMode?: EnumValues<PosterResizeModeType>;
preferredForwardBufferDuration?: number; // iOS preferredForwardBufferDuration?: number; // iOS
preventsDisplaySleepDuringVideoPlayback?: boolean; preventsDisplaySleepDuringVideoPlayback?: boolean;
progressUpdateInterval?: number; progressUpdateInterval?: number;
rate?: number; rate?: number;
repeat?: boolean; repeat?: boolean;
reportBandwidth?: boolean; //Android reportBandwidth?: boolean; //Android
resizeMode?: VideoResizeMode; resizeMode?: EnumValues<VideoResizeMode>;
selectedAudioTrack?: SelectedTrack; selectedAudioTrack?: SelectedTrack;
selectedTextTrack?: SelectedTrack; selectedTextTrack?: SelectedTrack;
selectedVideoTrack?: SelectedVideoTrack; // android selectedVideoTrack?: SelectedVideoTrack; // android