flow: tame the beast

This commit is contained in:
Saúl Ibarra Corretgé 2018-05-22 16:23:03 +02:00 committed by Lyubo Marinov
parent 9ac5aafe10
commit 0817482b9c
15 changed files with 37 additions and 33 deletions

View File

@ -173,6 +173,7 @@ class Dialog extends AbstractDialog<Props, State> {
if (style if (style
&& (style = StyleSheet.flatten(style)) && (style = StyleSheet.flatten(style))
&& _TAG_KEY in style) { && _TAG_KEY in style) {
// $FlowFixMe
switch (style[_TAG_KEY]) { switch (style[_TAG_KEY]) {
case _SUBMIT_TEXT_TAG_VALUE: case _SUBMIT_TEXT_TAG_VALUE:
if (this.state.submitting) { if (this.state.submitting) {

View File

@ -75,9 +75,9 @@ class CalleeInfo extends Component<Props, State> {
_onLargeVideoAvatarVisible: Function; _onLargeVideoAvatarVisible: Function;
_playAudioInterval: ?number; _playAudioInterval: *;
_ringingTimeout: ?number _ringingTimeout: *;
_setAudio: Function; _setAudio: Function;

View File

@ -3,6 +3,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { PanResponder, PixelRatio, View } from 'react-native'; import { PanResponder, PixelRatio, View } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { type Dispatch } from 'redux';
import { storeVideoTransform } from '../../actions'; import { storeVideoTransform } from '../../actions';
import styles from './styles'; import styles from './styles';
@ -684,7 +685,7 @@ class VideoTransform extends Component<Props, State> {
* _onUnmount: Function * _onUnmount: Function
* }} * }}
*/ */
function _mapDispatchToProps(dispatch) { function _mapDispatchToProps(dispatch: Dispatch<*>) {
return { return {
/** /**
* Dispatches actions to store the last applied transform to a video. * Dispatches actions to store the last applied transform to a video.
@ -712,7 +713,7 @@ function _mapDispatchToProps(dispatch) {
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
/** /**
* The stored transforms retreived from Redux to be initially applied to * The stored transforms retrieved from Redux to be initially applied to
* different streams. * different streams.
* *
* @private * @private

View File

@ -1,6 +1,6 @@
// @flow // @flow
import React, { Component } from 'react'; import React, { Component, type Node } from 'react';
import { Platform, SafeAreaView, StatusBar, View } from 'react-native'; import { Platform, SafeAreaView, StatusBar, View } from 'react-native';
import styles, { HEADER_PADDING, STATUSBAR_COLOR } from './styles'; import styles, { HEADER_PADDING, STATUSBAR_COLOR } from './styles';
@ -11,14 +11,14 @@ import styles, { HEADER_PADDING, STATUSBAR_COLOR } from './styles';
const IOS10_PADDING = 20; const IOS10_PADDING = 20;
/** /**
* The type of the React {@code Component} props of {@link ScreenHeader} * The type of the React {@code Component} props of {@link Header}
*/ */
type Props = { type Props = {
/** /**
* Children component(s). * Children component(s).
*/ */
children: React$Node, children: Node,
/** /**
* The component's external style * The component's external style
@ -37,7 +37,7 @@ export default class Header extends Component<Props> {
* *
* @returns {Object} * @returns {Object}
*/ */
static get buttonStyle() { static get buttonStyle(): Object {
return styles.headerButton; return styles.headerButton;
} }
@ -47,7 +47,7 @@ export default class Header extends Component<Props> {
* *
* @returns {Object} * @returns {Object}
*/ */
static get pageStyle() { static get pageStyle(): Object {
return styles.page; return styles.page;
} }
@ -56,7 +56,7 @@ export default class Header extends Component<Props> {
* *
* @returns {Object} * @returns {Object}
*/ */
static get textStyle() { static get textStyle(): Object {
return styles.headerText; return styles.headerText;
} }

View File

@ -29,7 +29,7 @@ const REDUCED_UI_THRESHOLD = 300;
* aspectRatio: Symbol * aspectRatio: Symbol
* }} * }}
*/ */
export function setAspectRatio(width: number, height: number): Object { export function setAspectRatio(width: number, height: number): Function {
return (dispatch: Dispatch<*>, getState: Function) => { return (dispatch: Dispatch<*>, getState: Function) => {
// Don't change the aspect ratio if width and height are the same, that // Don't change the aspect ratio if width and height are the same, that
// is, if we transition to a 1:1 aspect ratio. // is, if we transition to a 1:1 aspect ratio.
@ -59,7 +59,7 @@ export function setAspectRatio(width: number, height: number): Object {
* reducedUI: boolean * reducedUI: boolean
* }} * }}
*/ */
export function setReducedUI(width: number, height: number) { export function setReducedUI(width: number, height: number): Function {
return (dispatch: Dispatch<*>, getState: Function) => { return (dispatch: Dispatch<*>, getState: Function) => {
const reducedUI = Math.min(width, height) < REDUCED_UI_THRESHOLD; const reducedUI = Math.min(width, height) < REDUCED_UI_THRESHOLD;

View File

@ -58,6 +58,7 @@ export function makeAspectRatioAware(
} }
} }
// $FlowFixMe
return connect(_mapStateToProps)(AspectRatioAware); return connect(_mapStateToProps)(AspectRatioAware);
} }

View File

@ -1,7 +1,8 @@
// @flow // @flow
import React, { Component } from 'react'; import React, { Component, type Node } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { type Dispatch } from 'redux';
import { setAspectRatio } from '../actions'; import { setAspectRatio } from '../actions';
import DimensionsDetector from './DimensionsDetector'; import DimensionsDetector from './DimensionsDetector';
@ -19,7 +20,7 @@ type Props = {
/** /**
* Any nested components. * Any nested components.
*/ */
children: React$Node children: Node
}; };
/** /**
@ -51,7 +52,7 @@ class AspectRatioDetector extends Component<Props> {
* _onDimensionsChanged: Function * _onDimensionsChanged: Function
* }} * }}
*/ */
function _mapDispatchToProps(dispatch) { function _mapDispatchToProps(dispatch: Dispatch<*>) {
return { return {
/** /**
* Handles the "on dimensions changed" event and dispatches aspect ratio * Handles the "on dimensions changed" event and dispatches aspect ratio

View File

@ -1,7 +1,8 @@
// @flow // @flow
import React, { Component } from 'react'; import React, { Component, type Node } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { type Dispatch } from 'redux';
import { setReducedUI } from '../actions'; import { setReducedUI } from '../actions';
import DimensionsDetector from './DimensionsDetector'; import DimensionsDetector from './DimensionsDetector';
@ -20,7 +21,7 @@ type Props = {
/** /**
* Any nested components. * Any nested components.
*/ */
children: React$Node children: Node
}; };
/** /**
@ -52,7 +53,7 @@ class ReducedUIDetector extends Component<Props> {
* _onDimensionsChanged: Function * _onDimensionsChanged: Function
* }} * }}
*/ */
function _mapDispatchToProps(dispatch) { function _mapDispatchToProps(dispatch: Dispatch<*>) {
return { return {
/** /**
* Handles the "on dimensions changed" event and dispatches the * Handles the "on dimensions changed" event and dispatches the

View File

@ -81,8 +81,7 @@ type State = {
* a good thing). * a good thing).
*/ */
class TestConnectionInfo extends Component<Props, State> { class TestConnectionInfo extends Component<Props, State> {
_onStatsUpdated: Object => void;
_onStatsUpdated: Object => void
/** /**
* Initializes new <tt>TestConnectionInfo</tt> instance. * Initializes new <tt>TestConnectionInfo</tt> instance.

View File

@ -56,14 +56,14 @@ type State = {
* screen when another meeting is about to start. * screen when another meeting is about to start.
*/ */
class ConferenceNotification extends Component<Props, State> { class ConferenceNotification extends Component<Props, State> {
updateIntervalId: number; updateIntervalId: *;
/** /**
* Constructor of the ConferenceNotification component. * Constructor of the ConferenceNotification component.
* *
* @inheritdoc * @inheritdoc
*/ */
constructor(props) { constructor(props: Props) {
super(props); super(props);
this.state = { this.state = {
@ -97,7 +97,7 @@ class ConferenceNotification extends Component<Props, State> {
* @inheritdoc * @inheritdoc
*/ */
componentWillUnmount() { componentWillUnmount() {
clearTimeout(this.updateIntervalId); clearInterval(this.updateIntervalId);
} }
/** /**
@ -160,7 +160,7 @@ class ConferenceNotification extends Component<Props, State> {
return null; return null;
} }
_getNotificationContentStyle: () => Array<Object> _getNotificationContentStyle: () => Array<Object>;
/** /**
* Decides the color of the notification and some additional * Decides the color of the notification and some additional
@ -251,7 +251,6 @@ class ConferenceNotification extends Component<Props, State> {
/** /**
* Opens the meeting URL that the notification shows. * Opens the meeting URL that the notification shows.
* *
* @param {string} url - The URL to open.
* @private * @private
* @returns {void} * @returns {void}
*/ */

View File

@ -1,6 +1,7 @@
// @flow // @flow
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import type { Dispatch } from 'redux';
import { AbstractButton } from '../../base/toolbox'; import { AbstractButton } from '../../base/toolbox';
import type { AbstractButtonProps } from '../../base/toolbox'; import type { AbstractButtonProps } from '../../base/toolbox';
@ -105,7 +106,7 @@ class InviteButton extends AbstractButton<Props, *> {
* }} * }}
* @private * @private
*/ */
function _mapDispatchToProps(dispatch) { function _mapDispatchToProps(dispatch: Dispatch<*>) {
return { return {
/** /**
* Launches native invite dialog. * Launches native invite dialog.

View File

@ -60,7 +60,7 @@ type Props = {
export class LargeVideoBackgroundCanvas extends Component<Props> { export class LargeVideoBackgroundCanvas extends Component<Props> {
_canvasEl: Object; _canvasEl: Object;
_updateCanvasInterval: number; _updateCanvasInterval: *;
/** /**
* Initializes new {@code LargeVideoBackgroundCanvas} instance. * Initializes new {@code LargeVideoBackgroundCanvas} instance.

View File

@ -76,7 +76,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
* @returns {boolean} - If this overlay needs to be rendered, {@code true}; * @returns {boolean} - If this overlay needs to be rendered, {@code true};
* {@code false}, otherwise. * {@code false}, otherwise.
*/ */
static needsRender(state) { static needsRender(state: Object) {
const conferenceError = state['features/base/conference'].error; const conferenceError = state['features/base/conference'].error;
const configError = state['features/base/config'].error; const configError = state['features/base/config'].error;
const connectionError = state['features/base/connection'].error; const connectionError = state['features/base/connection'].error;
@ -88,7 +88,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
|| configError); || configError);
} }
_interval: ?number _interval: *;
state: { state: {
@ -120,7 +120,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
* @type {string} * @type {string}
*/ */
title: string title: string
} };
/** /**
* Initializes a new AbstractPageReloadOverlay instance. * Initializes a new AbstractPageReloadOverlay instance.
@ -222,7 +222,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
} }
/** /**
* Renders the button for relaod the page if necessary. * Renders the button for reloading the page if necessary.
* *
* @protected * @protected
* @returns {ReactElement|null} * @returns {ReactElement|null}

View File

@ -98,7 +98,7 @@ type State = {
* @extends {Component} * @extends {Component}
*/ */
class RecordingLabel extends AbstractRecordingLabel<Props, State> { class RecordingLabel extends AbstractRecordingLabel<Props, State> {
_autohideTimeout: number; _autohideTimeout: *;
state = { state = {
hidden: false hidden: false

View File

@ -45,7 +45,7 @@ class SpeakerStats extends Component<*, *> {
stats: {} stats: {}
}; };
_updateInterval: number; _updateInterval: *;
/** /**
* Initializes a new SpeakerStats instance. * Initializes a new SpeakerStats instance.