DefinitelyTyped/types/react-native-video/index.d.ts
Tanguy Krotoff 4abbfb42ff [react-native] Switch to *real* components + rename Properties to Props (#25307)
* Switch from var to const

* import React instead of /// <reference types="react" />

* Fix TextInput and remove TextInputStatic

See #16318 [react-native] Wrong type for component ref

* Remove TextStatic

* Remove ActivityIndicatorStatic

* Remove ActivityIndicatorIOSStatic

* Remove DatePickerIOSStatic

* Remove DrawerLayoutAndroidStatic

* Remove ImageStatic

* Remove ImageBackgroundStatic

* Remove InputAccessoryViewStatic

* Remove ListViewStatic

* Remove MapViewStatic

* Remove MaskedViewStatic

* Remove ModalStatic

* Remove NavigatorIOSStatic

* Remove PickerStatic

* Remove PickerIOSStatic

* Remove ProgressBarAndroidStatic

* Remove ProgressViewIOSStatic

* Remove RefreshControlStatic

* Remove RecyclerViewBackedScrollViewStatic

* Remove SafeAreaViewStatic

* Remove SegmentedControlIOSStatic

* Remove SliderStatic

* Remove StatusBarStatic

* Remove ScrollViewStatic

* Remove SnapshotViewIOSStatic

* Remove SwipeableListViewStatic

* Remove SwitchStatic

* Remove SwitchIOSStatic

* Remove TabBarIOSStatic

* Remove ToolbarAndroidStatic

* Remove TouchableHighlightStatic

* Remove TouchableNativeFeedbackStatic

* Remove TouchableOpacityStatic

* Remove TouchableWithoutFeedbackStatic

* Remove ViewStatic

* Remove ViewPagerAndroidStatic

* Remove WebViewStatic

* Remove ButtonStatic

* Remove ClippingRectangleStatic, GroupStatic, ShapeStatic, SurfaceStatic, ARTTextStatic, ARTTextStatic

* Remove KeyboardAvoidingViewStatic

* Remove FlatListStatic

* Rename TextProperties and friends to *Props

* Rename TextInputProperties and friends to *Props

* Rename WebViewProperties and friends to *Props

* Rename *Properties to *Props

* Rename ScrollViewProperties and friends to *Props

* Improve DatePickerAndroid.open()

* Rename ImagePropertiesSourceOptions to ImageSourcePropType

* Rename MaskedViewProps to MaskedViewIOSProps

* Rename PointProperties to PointPropType

* Rename TabBarItem to TabBarIOSItem

* Remove internal *Properties

* ImagePropertiesSourceOptions => ImagePropsSourceOptions

* Merge fail: react-native-linear-gradient has been removed

* Rename ImageProperties to ImageProps

* Update authors list

* Remove ImagePropsSourceOptions

* Move *Properties redirections to legacy-properties.d.ts
2018-04-26 10:30:30 -07:00

104 lines
2.8 KiB
TypeScript

// Type definitions for react-native-video 2.0
// Project: https://github.com/react-native-community/react-native-video
// Definitions by: HuHuanming <https://github.com/huhuanming>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
import {
ViewProps
} 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 ViewProps {
/* Native only */
src?: any;
seek?: number;
fullscreen?: boolean;
onVideoLoadStart?(): void;
onVideoLoad?(): void;
onVideoBuffer?(): void;
onVideoError?(): void;
onVideoProgress?(): void;
onVideoSeek?(): void;
onVideoEnd?(): void;
onTimedMetadata?(): void;
onVideoFullscreenPlayerWillPresent?(): void;
onVideoFullscreenPlayerDidPresent?(): void;
onVideoFullscreenPlayerWillDismiss?(): void;
onVideoFullscreenPlayerDidDismiss?(): void;
/* Wrapper component */
// Opaque type returned by require('./video.mp4')
source: { uri?: string } | number;
resizeMode?: string;
poster?: string;
repeat?: boolean;
paused?: boolean;
muted?: boolean;
volume?: number;
rate?: number;
playInBackground?: boolean;
playWhenInactive?: boolean;
ignoreSilentSwitch?: 'ignore' | 'obey';
disableFocus?: boolean;
controls?: boolean;
currentTime?: number;
progressUpdateInterval?: number;
onLoadStart?(): void;
onLoad?(data: OnLoadData): void;
onBuffer?(): void;
onError?(error: LoadError): void;
onProgress?(data: {
currentTime: number;
playableDuration: number;
}): void;
onSeek?(): void;
onEnd?(): void;
onFullscreenPlayerWillPresent?(): void;
onFullscreenPlayerDidPresent?(): void;
onFullscreenPlayerWillDismiss?(): void;
onFullscreenPlayerDidDismiss?(): void;
onReadyForDisplay?(): void;
onPlaybackStalled?(): void;
onPlaybackResume?(): void;
onPlaybackRateChange?(): void;
onAudioFocusChanged?(): void;
onAudioBecomingNoisy?(): void;
/* Required by react-native */
scaleX?: number;
scaleY?: number;
translateX?: number;
translateY?: number;
rotation?: number;
}
export default class Video extends React.Component<VideoProperties> {
seek(time: number): void;
presentFullscreenPlayer(): void;
dismissFullscreenPlayer(): void;
}