RN: Fix Type for ReactNative.NativeComponent (2/2)

Reviewed By: TheSavior

Differential Revision: D7984936

fbshipit-source-id: d0477c54420b49220e9529fa70c2b2babce0b409
This commit is contained in:
Tim Yung 2018-05-13 00:48:51 -07:00 committed by Facebook Github Bot
parent de11ba2a5e
commit 752863629d
6 changed files with 16 additions and 2 deletions

View File

@ -189,6 +189,7 @@ const KeyboardAvoidingView = ((createReactClass({
heightStyle = {height: this.frame.height - bottomHeight, flex: 0}; heightStyle = {height: this.frame.height - bottomHeight, flex: 0};
} }
return ( return (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<View <View
ref={viewRef} ref={viewRef}
style={[style, heightStyle]} style={[style, heightStyle]}
@ -203,6 +204,7 @@ const KeyboardAvoidingView = ((createReactClass({
const {contentContainerStyle} = this.props; const {contentContainerStyle} = this.props;
return ( return (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<View <View
ref={viewRef} ref={viewRef}
style={style} style={style}
@ -217,6 +219,7 @@ const KeyboardAvoidingView = ((createReactClass({
case 'padding': case 'padding':
const paddingStyle = {paddingBottom: bottomHeight}; const paddingStyle = {paddingBottom: bottomHeight};
return ( return (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<View <View
ref={viewRef} ref={viewRef}
style={[style, paddingStyle]} style={[style, paddingStyle]}
@ -228,6 +231,7 @@ const KeyboardAvoidingView = ((createReactClass({
default: default:
return ( return (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<View <View
ref={viewRef} ref={viewRef}
onLayout={this._onLayout} onLayout={this._onLayout}

View File

@ -757,7 +757,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
cellKey={this._getCellKey() + '-header'} cellKey={this._getCellKey() + '-header'}
key="$header"> key="$header">
<View onLayout={this._onLayoutHeader} style={inversionStyle}> <View onLayout={this._onLayoutHeader} style={inversionStyle}>
{element} {
// $FlowFixMe - Typing ReactNativeComponent revealed errors
element}
</View> </View>
</VirtualizedCellWrapper>, </VirtualizedCellWrapper>,
); );
@ -890,7 +892,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
cellKey={this._getCellKey() + '-footer'} cellKey={this._getCellKey() + '-footer'}
key="$footer"> key="$footer">
<View onLayout={this._onLayoutFooter} style={inversionStyle}> <View onLayout={this._onLayoutFooter} style={inversionStyle}>
{element} {
// $FlowFixMe - Typing ReactNativeComponent revealed errors
element}
</View> </View>
</VirtualizedCellWrapper>, </VirtualizedCellWrapper>,
); );
@ -1008,6 +1012,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
_defaultRenderScrollComponent = props => { _defaultRenderScrollComponent = props => {
const onRefresh = props.onRefresh; const onRefresh = props.onRefresh;
if (this._isNestedWithSameOrientation()) { if (this._isNestedWithSameOrientation()) {
// $FlowFixMe - Typing ReactNativeComponent revealed errors
return <View {...props} />; return <View {...props} />;
} else if (onRefresh) { } else if (onRefresh) {
invariant( invariant(

View File

@ -42,6 +42,7 @@ class SnapshotViewIOS extends React.Component<{
const testIdentifier = this.props.testIdentifier || 'test'; const testIdentifier = this.props.testIdentifier || 'test';
const onSnapshotReady = this.props.onSnapshotReady || this.onDefaultAction; const onSnapshotReady = this.props.onSnapshotReady || this.onDefaultAction;
return ( return (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<RCTSnapshot <RCTSnapshot
style={style.snapshot} style={style.snapshot}
{...this.props} {...this.props}

View File

@ -102,6 +102,7 @@ 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}

View File

@ -36,6 +36,7 @@ type ResponseHandlers = $ReadOnly<{|
type Props = $ReadOnly<{ type Props = $ReadOnly<{
...TextProps, ...TextProps,
// $FlowFixMe - Typing ReactNativeComponent revealed errors
forwardedRef: ?React.Ref<NativeComponent<TextProps>>, forwardedRef: ?React.Ref<NativeComponent<TextProps>>,
}>; }>;
@ -139,6 +140,7 @@ class TouchableText extends React.Component<Props, State> {
<TextAncestor.Consumer> <TextAncestor.Consumer>
{hasTextAncestor => {hasTextAncestor =>
hasTextAncestor ? ( hasTextAncestor ? (
// $FlowFixMe - Typing ReactNativeComponent revealed errors
<RCTVirtualText {...props} ref={props.forwardedRef} /> <RCTVirtualText {...props} ref={props.forwardedRef} />
) : ( ) : (
<TextAncestor.Provider value={true}> <TextAncestor.Provider value={true}>

View File

@ -484,6 +484,7 @@ class RTLExample extends React.Component<any, State> {
<RNTesterBlock <RNTesterBlock
title={'Controlling Animation'} title={'Controlling Animation'}
description={'Animation direction according to layout'}> description={'Animation direction according to layout'}>
{/* $FlowFixMe - Typing ReactNativeComponent revealed errors */}
<View Style={styles.view}> <View Style={styles.view}>
<AnimationBlock <AnimationBlock
onPress={this._linearTap} onPress={this._linearTap}