flow: tame the beast

This commit is contained in:
Saúl Ibarra Corretgé
2018-06-04 16:05:48 -05:00
committed by Lyubo Marinov
parent 9ac5aafe10
commit 0817482b9c
15 changed files with 37 additions and 33 deletions
@@ -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) {
@@ -75,9 +75,9 @@ class CalleeInfo extends Component<Props, State> {
_onLargeVideoAvatarVisible: Function;
_playAudioInterval: ?number;
_playAudioInterval: *;
_ringingTimeout: ?number
_ringingTimeout: *;
_setAudio: Function;
@@ -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
@@ -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;
}
+2 -2
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;
@@ -58,6 +58,7 @@ export function makeAspectRatioAware(
}
}
// $FlowFixMe
return connect(_mapStateToProps)(AspectRatioAware);
}
@@ -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
@@ -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
@@ -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.