Move video ref type to its own file

This commit is contained in:
Zoe Roux 2024-06-30 09:38:10 +00:00
parent fa126de97f
commit a72ab331dc
No known key found for this signature in database
5 changed files with 21 additions and 7 deletions

View File

@ -37,8 +37,7 @@ import {
resolveAssetSourceForVideo, resolveAssetSourceForVideo,
} from './utils'; } from './utils';
import NativeVideoManager from './specs/NativeVideoManager'; import NativeVideoManager from './specs/NativeVideoManager';
import type {VideoSaveData} from './specs/NativeVideoManager'; import {ViewType, type VideoSaveData} from './types';
import {ViewType} from './types';
import type { import type {
OnLoadData, OnLoadData,
OnTextTracksData, OnTextTracksData,

View File

@ -1,5 +1,4 @@
import Video from './Video'; import Video from './Video';
export {VideoDecoderProperties} from './VideoDecoderProperties'; export {VideoDecoderProperties} from './VideoDecoderProperties';
export type * from './types'; export type * from './types';
export type {VideoRef} from './Video';
export default Video; export default Video;

View File

@ -4,10 +4,7 @@ import type {
Float, Float,
UnsafeObject, UnsafeObject,
} from 'react-native/Libraries/Types/CodegenTypes'; } from 'react-native/Libraries/Types/CodegenTypes';
import type {VideoSaveData} from '../types/video-ref';
export type VideoSaveData = {
uri: string;
};
// @TODO rename to "Spec" when applying new arch // @TODO rename to "Spec" when applying new arch
export interface VideoManagerType { export interface VideoManagerType {

View File

@ -7,4 +7,5 @@ export {default as ResizeMode} from './ResizeMode';
export {default as TextTrackType} from './TextTrackType'; export {default as TextTrackType} from './TextTrackType';
export {default as ViewType} from './ViewType'; export {default as ViewType} from './ViewType';
export * from './video'; export * from './video';
export * from './video-ref';
export * from '../specs/VideoNativeComponent'; export * from '../specs/VideoNativeComponent';

18
src/types/video-ref.ts Normal file
View File

@ -0,0 +1,18 @@
export type VideoSaveData = {
uri: string;
};
export interface VideoRef {
seek: (time: number, tolerance?: number) => void;
resume: () => void;
pause: () => void;
presentFullscreenPlayer: () => void;
dismissFullscreenPlayer: () => void;
restoreUserInterfaceForPictureInPictureStopCompleted: (
restore: boolean,
) => void;
save: (options: object) => Promise<VideoSaveData>;
setVolume: (volume: number) => void;
getCurrentPosition: () => Promise<number>;
setFullScreen: (fullScreen: boolean) => void;
}