For the most part the changes are taking the "static propTypes" declaration off of components and declaring them as Flow types. Sometimes to support flow some method signatures had to be added. There are some exceptions in which more had to be done to tame the beast: - AbstractVideoTrack: put in additional truthy checks for videoTrack. - Video: add truthy checks for the _videoElement ref. - shouldRenderVideoTrack function: Some component could pass null for the videoTrack argument and Flow wanted that called out explicitly. - DisplayName: Add a truthy check for the input ref before acting on it. - NumbersList: Move array checks inline for Flow to comprehend array methods could be called. Add type checks in the Object.entries loop as the value is assumed to be a mixed type by Flow. - AbstractToolbarButton: add additional truthy check for passed in type.
68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
/* @flow */
|
|
|
|
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import AbstractVideoTrack from '../AbstractVideoTrack';
|
|
import type { Props as AbstractVideoTrackProps } from '../AbstractVideoTrack';
|
|
|
|
import Video from './Video';
|
|
|
|
/**
|
|
* The type of the React {@code Component} props of {@link VideoTrack}.
|
|
*/
|
|
type Props = {
|
|
...AbstractVideoTrackProps,
|
|
|
|
/**
|
|
* CSS classes to add to the video element.
|
|
*/
|
|
className: string,
|
|
|
|
/**
|
|
* The value of the id attribute of the video. Used by the torture tests
|
|
* to locate video elements.
|
|
*/
|
|
id: string
|
|
};
|
|
|
|
/**
|
|
* Component that renders a video element for a passed in video track and
|
|
* notifies the store when the video has started playing.
|
|
*
|
|
* @extends AbstractVideoTrack
|
|
*/
|
|
class VideoTrack extends AbstractVideoTrack<Props> {
|
|
/**
|
|
* Default values for {@code VideoTrack} component's properties.
|
|
*
|
|
* @static
|
|
*/
|
|
static defaultProps = {
|
|
className: '',
|
|
|
|
id: ''
|
|
};
|
|
|
|
/**
|
|
* Renders the video element.
|
|
*
|
|
* @override
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
return (
|
|
<Video
|
|
autoPlay = { true }
|
|
className = { this.props.className }
|
|
id = { this.props.id }
|
|
onVideoPlaying = { this._onVideoPlaying }
|
|
videoTrack = { this.props.videoTrack } />
|
|
);
|
|
}
|
|
|
|
_onVideoPlaying: () => void;
|
|
}
|
|
|
|
export default connect()(VideoTrack);
|