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 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<ResizeMode>;
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<FilterType>;
filterEnabled?: boolean;
volume?: number; // default 1.0
playInBackground?: boolean;

View File

@ -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<string, string>;
export type EnumValues<T extends string | number> = 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<ViewStyle>;
@ -188,31 +192,31 @@ export interface ReactVideoProps extends ReactVideoEvents, AccessibilityProps {
currentPlaybackTime?: number; // Android
disableFocus?: boolean;
disableDisconnectError?: boolean; // Android
filter?: FilterType; // iOS
filter?: EnumValues<FilterType>; // iOS
filterEnabled?: boolean; // iOS
focusable?: boolean; // Android
fullscreen?: boolean; // iOS
fullscreenAutorotate?: boolean; // iOS
fullscreenOrientation?: FullscreenOrientationType; // iOS
fullscreenOrientation?: EnumValues<FullscreenOrientationType>; // iOS
hideShutterView?: boolean; // Android
ignoreSilentSwitch?: IgnoreSilentSwitchType; // iOS
ignoreSilentSwitch?: EnumValues<IgnoreSilentSwitchType>; // iOS
minLoadRetryCount?: number; // Android
maxBitRate?: number;
mixWithOthers?: MixWithOthersType; // iOS
mixWithOthers?: EnumValues<MixWithOthersType>; // iOS
muted?: boolean;
paused?: boolean;
pictureInPicture?: boolean; // iOS
playInBackground?: boolean;
playWhenInactive?: boolean; // iOS
poster?: string;
posterResizeMode?: PosterResizeModeType;
posterResizeMode?: EnumValues<PosterResizeModeType>;
preferredForwardBufferDuration?: number; // iOS
preventsDisplaySleepDuringVideoPlayback?: boolean;
progressUpdateInterval?: number;
rate?: number;
repeat?: boolean;
reportBandwidth?: boolean; //Android
resizeMode?: VideoResizeMode;
resizeMode?: EnumValues<VideoResizeMode>;
selectedAudioTrack?: SelectedTrack;
selectedTextTrack?: SelectedTrack;
selectedVideoTrack?: SelectedVideoTrack; // android