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

View File

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

View File

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

View File

@ -102,6 +102,7 @@ class AppContainer extends React.Component<Props, State> {
pointerEvents="box-none"
style={styles.appContainer}
ref={ref => {
// $FlowFixMe - Typing ReactNativeComponent revealed errors
this._mainRef = ref;
}}>
{this.props.children}

View File

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

View File

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