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
&& (style = StyleSheet.flatten(style))
&& _TAG_KEY in style) {
// $FlowFixMe
switch (style[_TAG_KEY]) {
case _SUBMIT_TEXT_TAG_VALUE:
if (this.state.submitting) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@ type Props = {
export class LargeVideoBackgroundCanvas extends Component<Props> {
_canvasEl: Object;
_updateCanvasInterval: number;
_updateCanvasInterval: *;
/**
* 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};
* {@code false}, otherwise.
*/
static needsRender(state) {
static needsRender(state: Object) {
const conferenceError = state['features/base/conference'].error;
const configError = state['features/base/config'].error;
const connectionError = state['features/base/connection'].error;
@ -88,7 +88,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
|| configError);
}
_interval: ?number
_interval: *;
state: {
@ -120,7 +120,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
* @type {string}
*/
title: string
}
};
/**
* 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
* @returns {ReactElement|null}

View File

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

View File

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