diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index b264df6d64..4d9edaa364 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -3,13 +3,36 @@ // Definitions by: HuHuanming // abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 import * as React from 'react'; import { ViewProperties } from 'react-native'; +export interface OnLoadData { + canPlayFastForward: boolean; + canPlayReverse: boolean; + canPlaySlowForward: boolean; + canPlaySlowReverse: boolean; + canStepBackward: boolean; + canStepForward: boolean; + currentTime: number; + duration: number; + naturalSize: { + height: number; + width: number; + orientation: 'horizontal' | 'landscape'; + }; +} + +export interface LoadError { + error: { + '': string; + errorString: string; + }; +} + export interface VideoProperties extends ViewProperties { /* Native only */ src?: any; @@ -46,12 +69,12 @@ export interface VideoProperties extends ViewProperties { currentTime?: number; progressUpdateInterval?: number; onLoadStart?(): void; - onLoad?(): void; + onLoad?(data: OnLoadData): void; onBuffer?(): void; - onError?(): void; + onError?(error: LoadError): void; onProgress?(data: { - currentTime: number, - playableDuration: number, + currentTime: number; + playableDuration: number; }): void; onSeek?(): void; onEnd?(): void; diff --git a/types/react-native-video/react-native-video-tests.tsx b/types/react-native-video/react-native-video-tests.tsx index 5b61336e80..0e7990a04e 100644 --- a/types/react-native-video/react-native-video-tests.tsx +++ b/types/react-native-video/react-native-video-tests.tsx @@ -17,10 +17,40 @@ class VideoTest extends React.Component {