From a956551af73cf785ee4345e92e71fd5b17c5644e Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 14 May 2018 17:36:40 -0700 Subject: [PATCH] RN: Fix $FlowFixMe in AppContainer Summary: Fixes the `$FlowFixMe` type errors in `AppContainer`. Reviewed By: TheSavior Differential Revision: D7987552 fbshipit-source-id: 5eba319aa2661c2d6d8ed24affc066504096b72c --- Libraries/ReactNative/AppContainer.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index ce4a78043..ad5f8c06a 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -21,25 +21,24 @@ const View = require('View'); type Context = { rootTag: number, }; -type Props = {| - /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment - * suppresses an error when upgrading Flow's support for React. To see the - * error delete this comment and run Flow. */ - children?: React.Children, + +type Props = $ReadOnly<{| + children?: React.Node, rootTag: number, - WrapperComponent?: ?React.ComponentType<*>, -|}; -type State = { - inspector: ?React.Element, + WrapperComponent?: ?React.ComponentType, +|}>; + +type State = {| + inspector: ?React.Node, mainKey: number, -}; +|}; class AppContainer extends React.Component { state: State = { inspector: null, mainKey: 1, }; - _mainRef: ?React.Element; + _mainRef: ?React.ElementRef; _subscription: ?EmitterSubscription = null; static childContextTypes = { @@ -81,7 +80,7 @@ class AppContainer extends React.Component { } componentWillUnmount(): void { - if (this._subscription) { + if (this._subscription != null) { this._subscription.remove(); } } @@ -102,7 +101,6 @@ class AppContainer extends React.Component { pointerEvents="box-none" style={styles.appContainer} ref={ref => { - // $FlowFixMe - Typing ReactNativeComponent revealed errors this._mainRef = ref; }}> {this.props.children} @@ -110,7 +108,7 @@ class AppContainer extends React.Component { ); const Wrapper = this.props.WrapperComponent; - if (Wrapper) { + if (Wrapper != null) { innerView = {innerView}; } return (