mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #19523 from abrahambotros/react-native-video/on-progress-data
[react-native-video] Add `onProgress` data
This commit is contained in:
Vendored
+6
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for react-native-video 1.0
|
||||
// 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>
|
||||
// abrahambotros <https://github.com/abrahambotros>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -48,7 +49,10 @@ export interface VideoProperties extends ViewProperties {
|
||||
onLoad?(): void;
|
||||
onBuffer?(): void;
|
||||
onError?(): void;
|
||||
onProgress?(): void;
|
||||
onProgress?(data: {
|
||||
currentTime: number,
|
||||
playableDuration: number,
|
||||
}): void;
|
||||
onSeek?(): void;
|
||||
onEnd?(): void;
|
||||
onFullscreenPlayerWillPresent?(): void;
|
||||
|
||||
@@ -7,16 +7,26 @@ import {
|
||||
} from 'react-native';
|
||||
import Video from 'react-native-video';
|
||||
|
||||
class SwiperTest extends React.Component {
|
||||
class VideoTest extends React.Component {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render(): React.ReactElement<any> {
|
||||
return (
|
||||
<Video source={{uri: '//:example.com/test.mp4'}}/>
|
||||
<Video
|
||||
source={{ uri: '//:example.com/test.mp4' }}
|
||||
onProgress={this.onProgress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
onProgress = (data: {
|
||||
currentTime: number,
|
||||
playableDuration: number,
|
||||
}): void => {
|
||||
console.log(data.currentTime, data.playableDuration);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
||||
Reference in New Issue
Block a user