mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
Merge pull request #16771 from huhuanming/react-native-video
Add react-native-video
This commit is contained in:
77
types/react-native-video/index.d.ts
vendored
Normal file
77
types/react-native-video/index.d.ts
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// Type definitions for react-native-video 1.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.1
|
||||
|
||||
import * as React from 'react';
|
||||
import {
|
||||
ViewProperties
|
||||
} from 'react-native';
|
||||
|
||||
export interface VideoProperties extends ViewProperties {
|
||||
/* 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?(): void;
|
||||
onBuffer?(): void;
|
||||
onError?(): void;
|
||||
onProgress?(): 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;
|
||||
}
|
||||
26
types/react-native-video/react-native-video-tests.tsx
Normal file
26
types/react-native-video/react-native-video-tests.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
ViewStyle
|
||||
} from 'react-native';
|
||||
import Video from 'react-native-video';
|
||||
|
||||
class SwiperTest extends React.Component<{}, {}> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render(): React.ReactElement<any> {
|
||||
return (
|
||||
<Video source={{uri: '//:example.com/test.mp4'}}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
24
types/react-native-video/tsconfig.json
Normal file
24
types/react-native-video/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-video-tests.tsx"
|
||||
]
|
||||
}
|
||||
3
types/react-native-video/tslint.json
Normal file
3
types/react-native-video/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user