RN: Fix $FlowFixMe in AppContainer

Summary: Fixes the `$FlowFixMe` type errors in `AppContainer`.

Reviewed By: TheSavior

Differential Revision: D7987552

fbshipit-source-id: 5eba319aa2661c2d6d8ed24affc066504096b72c
This commit is contained in:
Tim Yung 2018-05-14 17:36:40 -07:00 committed by Facebook Github Bot
parent 206ef54aa4
commit a956551af7
1 changed files with 12 additions and 14 deletions

View File

@ -21,25 +21,24 @@ const View = require('View');
type Context = { type Context = {
rootTag: number, rootTag: number,
}; };
type Props = {|
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment type Props = $ReadOnly<{|
* suppresses an error when upgrading Flow's support for React. To see the children?: React.Node,
* error delete this comment and run Flow. */
children?: React.Children,
rootTag: number, rootTag: number,
WrapperComponent?: ?React.ComponentType<*>, WrapperComponent?: ?React.ComponentType<any>,
|}; |}>;
type State = {
inspector: ?React.Element<any>, type State = {|
inspector: ?React.Node,
mainKey: number, mainKey: number,
}; |};
class AppContainer extends React.Component<Props, State> { class AppContainer extends React.Component<Props, State> {
state: State = { state: State = {
inspector: null, inspector: null,
mainKey: 1, mainKey: 1,
}; };
_mainRef: ?React.Element<any>; _mainRef: ?React.ElementRef<typeof View>;
_subscription: ?EmitterSubscription = null; _subscription: ?EmitterSubscription = null;
static childContextTypes = { static childContextTypes = {
@ -81,7 +80,7 @@ class AppContainer extends React.Component<Props, State> {
} }
componentWillUnmount(): void { componentWillUnmount(): void {
if (this._subscription) { if (this._subscription != null) {
this._subscription.remove(); this._subscription.remove();
} }
} }
@ -102,7 +101,6 @@ class AppContainer extends React.Component<Props, State> {
pointerEvents="box-none" pointerEvents="box-none"
style={styles.appContainer} style={styles.appContainer}
ref={ref => { ref={ref => {
// $FlowFixMe - Typing ReactNativeComponent revealed errors
this._mainRef = ref; this._mainRef = ref;
}}> }}>
{this.props.children} {this.props.children}
@ -110,7 +108,7 @@ class AppContainer extends React.Component<Props, State> {
); );
const Wrapper = this.props.WrapperComponent; const Wrapper = this.props.WrapperComponent;
if (Wrapper) { if (Wrapper != null) {
innerView = <Wrapper>{innerView}</Wrapper>; innerView = <Wrapper>{innerView}</Wrapper>;
} }
return ( return (