Upgrade fbsource/xplat/js to Flow v0.53.0

Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
This commit is contained in:
Caleb Meredith 2017-08-17 18:36:54 -07:00 committed by Facebook Github Bot
parent 1ce7e4c1e5
commit 90eaeb019b
154 changed files with 652 additions and 631 deletions

View File

@ -42,14 +42,16 @@ module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|we
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-2]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-2]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.52.0
^0.53.0

View File

@ -21,7 +21,7 @@ const {
} = ReactNative.NativeModules;
class AccessibilityManagerTest extends React.Component {
class AccessibilityManagerTest extends React.Component<{}> {
componentDidMount() {
AccessibilityManager.setAccessibilityContentSizeMultipliers({
'extraSmall': 1.0,
@ -42,7 +42,7 @@ class AccessibilityManagerTest extends React.Component {
});
}
render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}

View File

@ -32,7 +32,7 @@ type State = {
elapsed?: string,
};
class AppEventsTest extends React.Component {
class AppEventsTest extends React.Component<{}, State> {
state: State = {sent: 'none', received: 'none'};
componentDidMount() {

View File

@ -168,7 +168,7 @@ function testOptimizedMultiGet() {
}
class AsyncStorageTest extends React.Component {
class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> {
state = {
messages: 'Initializing...',
done: false,

View File

@ -41,7 +41,7 @@ type State = {
'force-cache'?: boolean,
}
class ImageCachePolicyTest extends React.Component {
class ImageCachePolicyTest extends React.Component<Props, $FlowFixMeState> {
state = {}
shouldComponentUpdate(nextProps: Props, nextState: State) {

View File

@ -19,7 +19,7 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
class ImageSnapshotTest extends React.Component {
class ImageSnapshotTest extends React.Component<{}> {
componentDidMount() {
if (!TestModule.verifySnapshot) {
throw new Error('TestModule.verifySnapshot not defined.');

View File

@ -21,12 +21,10 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
class IntegrationTestHarnessTest extends React.Component {
props: {
shouldThrow?: boolean,
waitOneFrame?: boolean,
};
class IntegrationTestHarnessTest extends React.Component<{
shouldThrow?: boolean,
waitOneFrame?: boolean,
}, $FlowFixMeState> {
static propTypes = {
shouldThrow: PropTypes.bool,
waitOneFrame: PropTypes.bool,

View File

@ -48,7 +48,7 @@ require('LoggingTestModule');
type Test = any;
class IntegrationTestsApp extends React.Component {
class IntegrationTestsApp extends React.Component<{}, $FlowFixMeState> {
state = {
test: (null: ?Test),
};
@ -57,6 +57,10 @@ class IntegrationTestsApp extends React.Component {
if (this.state.test) {
return (
<ScrollView>
{/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error when upgrading Flow's support for React. Common errors
* found when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */}
<this.state.test />
</ScrollView>
);

View File

@ -16,7 +16,7 @@ var ReactNative = require('react-native');
var { View } = ReactNative;
var { TestModule } = ReactNative.NativeModules;
class PromiseTest extends React.Component {
class PromiseTest extends React.Component<{}> {
shouldResolve = false;
shouldReject = false;
shouldSucceedAsync = false;
@ -66,7 +66,7 @@ class PromiseTest extends React.Component {
}
};
render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}

View File

@ -21,7 +21,7 @@ var {
} = ReactNative;
var { TestModule } = ReactNative.NativeModules;
class SimpleSnapshotTest extends React.Component {
class SimpleSnapshotTest extends React.Component<{}> {
componentDidMount() {
if (!TestModule.verifySnapshot) {
throw new Error('TestModule.verifySnapshot not defined.');

View File

@ -21,7 +21,7 @@ const {
} = ReactNative.NativeModules;
class SyncMethodTest extends React.Component {
class SyncMethodTest extends React.Component<{}> {
componentDidMount() {
if (RNTesterTestModule.echoString('test string value') !== 'test string value') {
throw new Error('Something wrong with sync method export');
@ -32,7 +32,7 @@ class SyncMethodTest extends React.Component {
TestModule.markTestCompleted();
}
render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}

View File

@ -42,7 +42,7 @@ type State = {
testExpectedResponse: string;
};
class WebSocketTest extends React.Component {
class WebSocketTest extends React.Component<{}, State> {
state: State = {
url: DEFAULT_WS_URL,
fetchStatus: null,
@ -158,7 +158,7 @@ class WebSocketTest extends React.Component {
});
}
render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}

View File

@ -1753,7 +1753,7 @@ class AnimatedProps extends Animated {
}
function createAnimatedComponent(Component: any): any {
class AnimatedComponent extends React.Component {
class AnimatedComponent extends React.Component<Object> {
_component: any;
_prevComponent: any;
_propsAnimated: AnimatedProps;

View File

@ -48,17 +48,14 @@ const invariant = require('fbjs/lib/invariant');
*
*/
class Button extends React.Component {
props: {
title: string,
onPress: () => any,
color?: ?string,
accessibilityLabel?: ?string,
disabled?: ?boolean,
testID?: ?string,
};
class Button extends React.Component<{
title: string,
onPress: () => any,
color?: ?string,
accessibilityLabel?: ?string,
disabled?: ?boolean,
testID?: ?string,
}> {
static propTypes = {
/**
* Text to display inside the button

View File

@ -25,7 +25,7 @@ type Props = ViewProps & {
* Should be a React element to be rendered and applied as the
* mask for the child element.
*/
maskElement: React.Element<*>,
maskElement: React.Element<any>,
};
/**
@ -64,9 +64,7 @@ type Props = ViewProps & {
* transparent pixels block that content.
*
*/
class MaskedViewIOS extends React.Component {
props: Props;
class MaskedViewIOS extends React.Component<Props> {
static propTypes = {
...ViewPropTypes,
maskElement: PropTypes.element.isRequired,

View File

@ -36,7 +36,7 @@ function getuid() {
return __uid++;
}
class NavigatorTransitionerIOS extends React.Component {
class NavigatorTransitionerIOS extends React.Component<$FlowFixMeProps> {
requestSchedulingNavigation(cb) {
RCTNavigatorManager.requestSchedulingJavaScriptNavigation(
ReactNative.findNodeHandle(this),

View File

@ -37,14 +37,12 @@ var MODE_DROPDOWN = 'dropdown';
/**
* Individual selectable item in a Picker.
*/
class PickerItem extends React.Component {
props: {
label: string,
value?: any,
color?: ColorPropType,
testID?: string,
};
class PickerItem extends React.Component<{
label: string,
value?: any,
color?: ColorPropType,
testID?: string,
}> {
static propTypes = {
/**
* Text to display for this item.
@ -82,18 +80,16 @@ class PickerItem extends React.Component {
* <Picker.Item label="JavaScript" value="js" />
* </Picker>
*/
class Picker extends React.Component {
props: {
style?: $FlowFixMe,
selectedValue?: any,
onValueChange?: Function,
enabled?: boolean,
mode?: 'dialog' | 'dropdown',
itemStyle?: $FlowFixMe,
prompt?: string,
testID?: string,
};
class Picker extends React.Component<{
style?: $FlowFixMe,
selectedValue?: any,
onValueChange?: Function,
enabled?: boolean,
mode?: 'dialog' | 'dropdown',
itemStyle?: $FlowFixMe,
prompt?: string,
testID?: string,
}> {
/**
* On Android, display the options in a dialog.
*/

View File

@ -36,19 +36,15 @@ type Event = Object;
/**
* Not exposed as a public API - use <Picker> instead.
*/
class PickerAndroid extends React.Component {
props: {
style?: $FlowFixMe,
selectedValue?: any,
enabled?: boolean,
mode?: 'dialog' | 'dropdown',
onValueChange?: Function,
prompt?: string,
testID?: string,
};
state: *;
class PickerAndroid extends React.Component<{
style?: $FlowFixMe,
selectedValue?: any,
enabled?: boolean,
mode?: 'dialog' | 'dropdown',
onValueChange?: Function,
prompt?: string,
testID?: string,
}, *> {
static propTypes = {
...ViewPropTypes,
style: pickerStyleType,

View File

@ -16,7 +16,7 @@ const requireNativeComponent = require('requireNativeComponent');
const RCTRefreshControl = requireNativeComponent('RCTRefreshControl');
class RefreshControlMock extends React.Component {
class RefreshControlMock extends React.Component<{}> {
static latestRef: ?RefreshControlMock;
componentDidMount() {
RefreshControlMock.latestRef = this;

View File

@ -742,6 +742,10 @@ const ScrollView = createReactClass({
const contentContainer =
<ScrollContentContainerViewClass
{...contentSizeChangeProps}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
ref={this._setInnerViewRef}
style={contentContainerStyle}
removeClippedSubviews={
@ -814,6 +818,10 @@ const ScrollView = createReactClass({
// On iOS the RefreshControl is a child of the ScrollView.
// tvOS lacks native support for RefreshControl, so don't include it in that case
return (
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error when upgrading Flow's support for React. Common errors
* found when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
{Platform.isTVOS ? null : refreshControl}
{contentContainer}
@ -829,6 +837,10 @@ const ScrollView = createReactClass({
return React.cloneElement(
refreshControl,
{style: props.style},
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error when upgrading Flow's support for React. Common errors
* found when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<ScrollViewClass {...props} style={baseStyle} ref={this._setScrollViewRef}>
{contentContainer}
</ScrollViewClass>
@ -836,6 +848,10 @@ const ScrollView = createReactClass({
}
}
return (
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
{contentContainer}
</ScrollViewClass>
@ -874,12 +890,12 @@ if (Platform.OS === 'android') {
};
AndroidScrollView = requireNativeComponent(
'RCTScrollView',
(ScrollView: ReactClass<any>),
(ScrollView: React.ComponentType<any>),
nativeOnlyProps
);
AndroidHorizontalScrollView = requireNativeComponent(
'AndroidHorizontalScrollView',
(ScrollView: ReactClass<any>),
(ScrollView: React.ComponentType<any>),
nativeOnlyProps
);
} else if (Platform.OS === 'ios') {
@ -893,7 +909,7 @@ if (Platform.OS === 'android') {
};
RCTScrollView = requireNativeComponent(
'RCTScrollView',
(ScrollView: ReactClass<any>),
(ScrollView: React.ComponentType<any>),
nativeOnlyProps,
);
// $FlowFixMe (bvaughn) Update ComponentInterface in ViewPropTypes to include a string type (for Fiber host components) in a follow-up.

View File

@ -16,21 +16,18 @@ const React = require('React');
const StyleSheet = require('StyleSheet');
type Props = {
children?: React.Element<*>,
children?: React.Element<any>,
nextHeaderLayoutY: ?number,
onLayout: (event: Object) => void,
scrollAnimatedValue: Animated.Value,
};
class ScrollViewStickyHeader extends React.Component {
props: Props;
state: {
measured: boolean,
layoutY: number,
layoutHeight: number,
nextHeaderLayoutY: ?number,
};
class ScrollViewStickyHeader extends React.Component<Props, {
measured: boolean,
layoutY: number,
layoutHeight: number,
nextHeaderLayoutY: ?number,
}> {
constructor(props: Props, context: Object) {
super(props, context);
this.state = {

View File

@ -17,7 +17,7 @@ const requireNativeComponent = require('requireNativeComponent');
const RCTScrollView = requireNativeComponent('RCTScrollView');
class ScrollViewMock extends React.Component {
class ScrollViewMock extends React.Component<$FlowFixMeProps> {
render() {
return (
<RCTScrollView {...this.props}>

View File

@ -28,7 +28,7 @@ const React = require('React');
* Typically, you will not need to use this component and should opt for normal
* React reconciliation.
*/
class StaticContainer extends React.Component {
class StaticContainer extends React.Component<Object> {
shouldComponentUpdate(nextProps: Object): boolean {
return !!nextProps.shouldUpdate;

View File

@ -15,12 +15,10 @@ var React = require('React');
var PropTypes = require('prop-types');
class StaticRenderer extends React.Component {
props: {
shouldUpdate: boolean,
render: Function,
};
class StaticRenderer extends React.Component<{
shouldUpdate: boolean,
render: Function,
}> {
static propTypes = {
shouldUpdate: PropTypes.bool.isRequired,
render: PropTypes.func.isRequired,
@ -30,7 +28,7 @@ class StaticRenderer extends React.Component {
return nextProps.shouldUpdate;
}
render(): React.Element<any> {
render(): React.Node {
return this.props.render();
}
}

View File

@ -149,17 +149,15 @@ function createStackEntry(props: any): any {
*
* `currentHeight` (Android only) The height of the status bar.
*/
class StatusBar extends React.Component {
props: {
hidden?: boolean,
animated?: boolean,
backgroundColor?: string,
translucent?: boolean,
barStyle?: 'default' | 'light-content' | 'dark-content',
networkActivityIndicatorVisible?: boolean,
showHideTransition?: 'fade' | 'slide',
};
class StatusBar extends React.Component<{
hidden?: boolean,
animated?: boolean,
backgroundColor?: string,
translucent?: boolean,
barStyle?: 'default' | 'light-content' | 'dark-content',
networkActivityIndicatorVisible?: boolean,
showHideTransition?: 'fade' | 'slide',
}> {
static _propsStack = [];
static _defaultProps = createStackEntry({
@ -410,7 +408,7 @@ class StatusBar extends React.Component {
});
};
render(): ?React.Element<any> {
render(): React.Node {
return null;
}
}

View File

@ -115,6 +115,10 @@ var Switch = createReactClass({
return (
<RCTSwitch
{...props}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
ref={(ref) => { this._rctSwitch = ref; }}
onChange={this._onChange}
/>

View File

@ -17,7 +17,7 @@ const StyleSheet = require('StyleSheet');
const TabBarItemIOS = require('TabBarItemIOS');
const View = require('View');
class DummyTabBarIOS extends React.Component {
class DummyTabBarIOS extends React.Component<$FlowFixMeProps> {
static Item = TabBarItemIOS;
render() {

View File

@ -20,17 +20,15 @@ const ViewPropTypes = require('ViewPropTypes');
var requireNativeComponent = require('requireNativeComponent');
class TabBarIOS extends React.Component {
props: {
style?: $FlowFixMe,
unselectedTintColor?: $FlowFixMe,
tintColor?: $FlowFixMe,
unselectedItemTintColor?: $FlowFixMe,
barTintColor?: $FlowFixMe,
translucent?: boolean,
itemPositioning?: 'fill' | 'center' | 'auto',
};
class TabBarIOS extends React.Component<{
style?: $FlowFixMe,
unselectedTintColor?: $FlowFixMe,
tintColor?: $FlowFixMe,
unselectedItemTintColor?: $FlowFixMe,
barTintColor?: $FlowFixMe,
translucent?: boolean,
itemPositioning?: 'fill' | 'center' | 'auto',
}> {
static Item = TabBarItemIOS;
// $FlowFixMe(>=0.41.0)

View File

@ -139,12 +139,36 @@ var TouchableBounce = createReactClass({
render: function(): React.Element<any> {
return (
<Animated.View
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
style={[{transform: [{scale: this.state.scale}]}, this.props.style]}
accessible={this.props.accessible !== false}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
accessibilityLabel={this.props.accessibilityLabel}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
accessibilityComponentType={this.props.accessibilityComponentType}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
accessibilityTraits={this.props.accessibilityTraits}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
nativeID={this.props.nativeID}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
testID={this.props.testID}
hitSlop={this.props.hitSlop}
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}

View File

@ -19,7 +19,7 @@ const StyleSheet = require('StyleSheet');
* Common implementation for a simple stubbed view. Simply applies the view's styles to the inner
* View component and renders its children.
*/
class UnimplementedView extends React.Component {
class UnimplementedView extends React.Component<$FlowFixMeProps> {
setNativeProps() {
// Do nothing.
// This method is required in order to use this view as a Touchable* child.

View File

@ -68,18 +68,16 @@ export type ViewPagerScrollState = $Enum<{
* }
* ```
*/
class ViewPagerAndroid extends React.Component {
props: {
initialPage?: number,
onPageScroll?: Function,
onPageScrollStateChanged?: Function,
onPageSelected?: Function,
pageMargin?: number,
peekEnabled?: boolean,
keyboardDismissMode?: 'none' | 'on-drag',
scrollEnabled?: boolean,
};
class ViewPagerAndroid extends React.Component<{
initialPage?: number,
onPageScroll?: Function,
onPageScrollStateChanged?: Function,
onPageSelected?: Function,
pageMargin?: number,
peekEnabled?: boolean,
keyboardDismissMode?: 'none' | 'on-drag',
scrollEnabled?: boolean,
}> {
static propTypes = {
...ViewPropTypes,
/**

View File

@ -99,7 +99,7 @@ type DefaultProps = {
type State = {
doIncrementalRender: boolean,
};
class Incremental extends React.Component<DefaultProps, Props, State> {
class Incremental extends React.Component<Props, State> {
props: Props;
state: State;
context: Context;
@ -154,7 +154,7 @@ class Incremental extends React.Component<DefaultProps, Props, State> {
}).done();
}
render(): ?React.Element<any> {
render(): React.Node {
if (this._rendered || // Make sure that once we render once, we stay rendered even if incrementalGroupEnabled gets flipped.
!this.context.incrementalGroupEnabled ||
this.state.doIncrementalRender) {

View File

@ -35,8 +35,7 @@ JSEventLoopWatchdog.install({thresholdMS: 200});
let totalWidgets = 0;
class SlowWidget extends React.Component {
state: {ctorTimestamp: number, timeToMount: number};
class SlowWidget extends React.Component<$FlowFixMeProps, {ctorTimestamp: number, timeToMount: number}> {
constructor(props, context) {
super(props, context);
this.state = {
@ -89,11 +88,10 @@ function Block(props: Object) {
const Row = (props: Object) => <View style={styles.row} {...props} />;
class IncrementalExample extends React.Component {
class IncrementalExample extends React.Component<mixed, {stats: ?Object}> {
static title = '<Incremental*>';
static description = 'Enables incremental rendering of complex components.';
start: number;
state: {stats: ?Object};
constructor(props: mixed, context: mixed) {
super(props, context);
this.start = performanceNow();
@ -116,7 +114,7 @@ class IncrementalExample extends React.Component {
console.log('onDone:', stats);
}, 0);
}
render(): React.Element<any> {
render(): React.Node {
return (
<IncrementalGroup
disabled={false}

View File

@ -34,8 +34,7 @@ import type {Props, Context} from 'Incremental';
*
* See Incremental.js for more info.
*/
class IncrementalGroup extends React.Component {
props: Props & {disabled?: boolean};
class IncrementalGroup extends React.Component<Props & {disabled?: boolean}> {
context: Context;
_groupInc: string;
componentWillMount() {
@ -67,7 +66,7 @@ class IncrementalGroup extends React.Component {
};
}
render(): React.Element<any> {
render(): React.Node {
return (
<Incremental
onDone={this.props.onDone}

View File

@ -40,8 +40,7 @@ type Props = {
style?: mixed,
children?: any,
}
class IncrementalPresenter extends React.Component {
props: Props;
class IncrementalPresenter extends React.Component<Props> {
context: Context;
_isDone: boolean;

View File

@ -53,7 +53,7 @@ type State = {
* - It can bounce the 1st row of the list so users know it's swipeable
* - More to come
*/
class SwipeableListView extends React.Component<DefaultProps, Props, State> {
class SwipeableListView extends React.Component<Props, State> {
props: Props;
state: State;
@ -113,7 +113,7 @@ class SwipeableListView extends React.Component<DefaultProps, Props, State> {
}
}
render(): React.Element<any> {
render(): React.Node {
return (
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
@ -121,6 +121,10 @@ class SwipeableListView extends React.Component<DefaultProps, Props, State> {
<ListView
{...this.props}
ref={(ref) => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error when upgrading Flow's support for React. Common errors
* found when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._listViewRef = ref;
}}
dataSource={this.state.dataSource.getDataSource()}

View File

@ -26,18 +26,16 @@ import type {ImageSource} from 'ImageSource';
* with SwipeableListView. Each button takes an image and text with optional
* formatting.
*/
class SwipeableQuickActionButton extends React.Component {
props: {
accessibilityLabel?: string,
imageSource: ImageSource | number,
imageStyle?: ?ViewPropTypes.style,
onPress?: Function,
style?: ?ViewPropTypes.style,
testID?: string,
text?: ?(string | Object | Array<string | Object>),
textStyle?: ?ViewPropTypes.style,
};
class SwipeableQuickActionButton extends React.Component<{
accessibilityLabel?: string,
imageSource: ImageSource | number,
imageStyle?: ?ViewPropTypes.style,
onPress?: Function,
style?: ?ViewPropTypes.style,
testID?: string,
text?: ?(string | Object | Array<string | Object>),
textStyle?: ?ViewPropTypes.style,
}> {
static propTypes = {
accessibilityLabel: PropTypes.string,
imageSource: Image.propTypes.source.isRequired,
@ -49,7 +47,7 @@ class SwipeableQuickActionButton extends React.Component {
textStyle: Text.propTypes.style,
};
render(): ?React.Element<any> {
render(): React.Node {
if (!this.props.imageSource && !this.props.text) {
return null;
}

View File

@ -27,14 +27,12 @@ const ViewPropTypes = require('ViewPropTypes');
* <SwipeableQuickActionButton {..props} />
* </SwipeableQuickActions>
*/
class SwipeableQuickActions extends React.Component {
props: {style?: $FlowFixMe};
class SwipeableQuickActions extends React.Component<{style?: $FlowFixMe}> {
static propTypes = {
style: ViewPropTypes.style,
};
render(): React.Element<any> {
render(): React.Node {
// $FlowFixMe found when converting React.createClass to ES6
const children = this.props.children;
let buttons = [];

View File

@ -150,9 +150,7 @@ type State = {
firstRow: number,
lastRow: number,
};
class WindowedListView extends React.Component {
props: Props;
state: State;
class WindowedListView extends React.Component<Props, State> {
/**
* Recomputing which rows to render is batched up and run asynchronously to avoid wastful updates,
* e.g. from multiple layout updates in rapid succession.
@ -423,7 +421,7 @@ class WindowedListView extends React.Component {
this._firstVisible = newFirstVisible;
this._lastVisible = newLastVisible;
}
render(): React.Element<any> {
render(): React.Node {
const {firstRow} = this.state;
const lastRow = clamp(0, this.state.lastRow, this.props.data.length - 1);
const rowFrames = this._rowFrames;
@ -613,8 +611,7 @@ type CellProps = {
*/
onWillUnmount: (rowKey: string) => void,
};
class CellRenderer extends React.Component {
props: CellProps;
class CellRenderer extends React.Component<CellProps> {
_containerRef: NativeMethodsMixinType;
_offscreenRenderDone = false;
_timeout = 0;
@ -700,6 +697,10 @@ class CellRenderer extends React.Component {
return newProps.rowData !== this.props.rowData;
}
_setRef = (ref) => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._containerRef = ref;
};
render() {

View File

@ -45,7 +45,7 @@ import type {NativeMethodsMixinType} from 'ReactNativeTypes';
* AppRegistry.registerComponent('DisplayAnImageBackground', () => DisplayAnImageBackground);
* ```
*/
class ImageBackground extends React.Component {
class ImageBackground extends React.Component<$FlowFixMeProps> {
setNativeProps(props: Object) {
// Work-around flow
const viewRef = this._viewRef;
@ -58,6 +58,10 @@ class ImageBackground extends React.Component {
_viewRef: ?NativeMethodsMixinType = null;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._viewRef = ref;
};

View File

@ -14,7 +14,7 @@
var React = require('React');
var View = require('View');
class BorderBox extends React.Component {
class BorderBox extends React.Component<$FlowFixMeProps> {
render() {
var box = this.props.box;
if (!box) {

View File

@ -24,7 +24,7 @@ var blank = {
bottom: 0,
};
class BoxInspector extends React.Component {
class BoxInspector extends React.Component<$FlowFixMeProps> {
render() {
var frame = this.props.frame;
var style = this.props.style;
@ -47,15 +47,14 @@ class BoxInspector extends React.Component {
}
}
class BoxContainer extends React.Component {
class BoxContainer extends React.Component<$FlowFixMeProps> {
render() {
var box = this.props.box;
return (
<View style={styles.box}>
<View style={styles.row}>
{/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error found when Flow v0.53 was deployed. To see the error
* delete this comment and run Flow. */}
{
}
<Text style={[this.props.titleStyle, styles.label]}>{this.props.title}</Text>
<Text style={styles.boxText}>{box.top}</Text>
</View>

View File

@ -19,7 +19,7 @@ var resolveBoxStyle = require('resolveBoxStyle');
var flattenStyle = require('flattenStyle');
class ElementBox extends React.Component {
class ElementBox extends React.Component<$FlowFixMeProps> {
render() {
var style = flattenStyle(this.props.style) || {};
var margin = resolveBoxStyle('margin', style);

View File

@ -25,16 +25,14 @@ const flattenStyle = require('flattenStyle');
const mapWithSeparator = require('mapWithSeparator');
const openFileInEditor = require('openFileInEditor');
class ElementProperties extends React.Component {
props: {
hierarchy: Array<$FlowFixMe>,
style?: Object | Array<$FlowFixMe> | number,
source?: {
fileName?: string,
lineNumber?: number,
},
};
class ElementProperties extends React.Component<{
hierarchy: Array<$FlowFixMe>,
style?: Object | Array<$FlowFixMe> | number,
source?: {
fileName?: string,
lineNumber?: number,
},
}> {
static propTypes = {
hierarchy: PropTypes.array.isRequired,
style: PropTypes.oneOfType([

View File

@ -44,24 +44,20 @@ function findRenderer(): ReactRenderer {
return renderers[keys[0]];
}
class Inspector extends React.Component {
props: {
inspectedViewTag: ?number,
onRequestRerenderApp: (callback: (tag: ?number) => void) => void
};
state: {
devtoolsAgent: ?Object,
hierarchy: any,
panelPos: string,
inspecting: bool,
selection: ?number,
perfing: bool,
inspected: any,
inspectedViewTag: any,
networking: bool,
};
class Inspector extends React.Component<{
inspectedViewTag: ?number,
onRequestRerenderApp: (callback: (tag: ?number) => void) => void
}, {
devtoolsAgent: ?Object,
hierarchy: any,
panelPos: string,
inspecting: bool,
selection: ?number,
perfing: bool,
inspected: any,
inspectedViewTag: any,
networking: bool,
}> {
_subs: ?Array<() => void>;
constructor(props: Object) {

View File

@ -23,16 +23,14 @@ type EventLike = {
nativeEvent: Object,
};
class InspectorOverlay extends React.Component {
props: {
inspected?: {
frame?: Object,
style?: any,
},
inspectedViewTag?: number,
onTouchViewTag: (tag: number, frame: Object, pointerY: number) => void,
};
class InspectorOverlay extends React.Component<{
inspected?: {
frame?: Object,
style?: any,
},
inspectedViewTag?: number,
onTouchViewTag: (tag: number, frame: Object, pointerY: number) => void,
}> {
static propTypes = {
inspected: PropTypes.shape({
frame: PropTypes.object,

View File

@ -22,7 +22,7 @@ const Text = require('Text');
const TouchableHighlight = require('TouchableHighlight');
const View = require('View');
class InspectorPanel extends React.Component {
class InspectorPanel extends React.Component<$FlowFixMeProps> {
renderWaiting() {
if (this.props.inspecting) {
return (
@ -104,7 +104,7 @@ InspectorPanel.propTypes = {
setNetworking: PropTypes.func,
};
class Button extends React.Component {
class Button extends React.Component<$FlowFixMeProps> {
render() {
return (
<TouchableHighlight onPress={() => this.props.onClick(!this.props.pressed)} style={[

View File

@ -50,7 +50,11 @@ type NetworkRequestInfo = {
/**
* Show all the intercepted network requests over the InspectorPanel.
*/
class NetworkOverlay extends React.Component {
class NetworkOverlay extends React.Component<Object, {
dataSource: ListView.DataSource,
newDetailInfo: bool,
detailRowID: ?number,
}> {
_requests: Array<NetworkRequestInfo>;
_listViewDataSource: ListView.DataSource;
_listView: ?ListView;
@ -73,12 +77,6 @@ class NetworkOverlay extends React.Component {
// Map of `xhr._index` -> `index in `_requests``.
_xhrIdMap: {[key: number]: number};
state: {
dataSource: ListView.DataSource,
newDetailInfo: bool,
detailRowID: ?number,
};
constructor(props: Object) {
super(props);
this._requests = [];

View File

@ -17,7 +17,7 @@ var StyleSheet = require('StyleSheet');
var Text = require('Text');
var View = require('View');
class PerformanceOverlay extends React.Component {
class PerformanceOverlay extends React.Component<{}> {
render() {
var perfLogs = PerformanceLogger.getTimespans();
var items = [];

View File

@ -16,7 +16,7 @@ var StyleSheet = require('StyleSheet');
var Text = require('Text');
var View = require('View');
class StyleInspector extends React.Component {
class StyleInspector extends React.Component<$FlowFixMeProps> {
render() {
if (!this.props.style) {
return <Text style={styles.noStyle}>No style</Text>;

View File

@ -72,22 +72,22 @@ type OptionalProps<ItemT> = {
* which will update the `highlighted` prop, but you can also add custom props with
* `separators.updateProps`.
*/
ItemSeparatorComponent?: ?ReactClass<any>,
ItemSeparatorComponent?: ?React.ComponentType<any>,
/**
* Rendered when the list is empty. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListEmptyComponent?: ?(ReactClass<any> | React.Element<any>),
ListEmptyComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the bottom of all the items. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListFooterComponent?: ?(ReactClass<any> | React.Element<any>),
ListFooterComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the top of all the items. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListHeaderComponent?: ?(ReactClass<any> | React.Element<any>),
ListHeaderComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Optional custom style for multi-item rows generated when numColumns > 1.
*/
@ -306,11 +306,7 @@ type DefaultProps = typeof defaultProps;
*
* Also inherets [ScrollView Props](docs/scrollview.html#props), unless it is nested in another FlatList of same orientation.
*/
class FlatList<ItemT> extends React.PureComponent<
DefaultProps,
Props<ItemT>,
void,
> {
class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
static defaultProps: DefaultProps = defaultProps;
props: Props<ItemT>;
/**
@ -416,6 +412,10 @@ class FlatList<ItemT> extends React.PureComponent<
_listRef: VirtualizedList;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._listRef = ref;
};

View File

@ -16,7 +16,7 @@ const React = require('React');
const ScrollView = require('ScrollView');
const StaticRenderer = require('StaticRenderer');
class ListViewMock extends React.Component {
class ListViewMock extends React.Component<$FlowFixMeProps> {
static latestRef: ?ListViewMock;
static defaultProps = {
renderScrollComponent: props => <ScrollView {...props} />,

View File

@ -22,13 +22,13 @@ const invariant = require('fbjs/lib/invariant');
type Item = any;
type NormalProps = {
FooterComponent?: ReactClass<*>,
renderItem: (info: Object) => ?React.Element<*>,
FooterComponent?: React.ComponentType<*>,
renderItem: (info: Object) => ?React.Element<any>,
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.53 was deployed. To see the error delete this comment
* and run Flow. */
renderSectionHeader?: ({section: Object}) => ?React.Element<*>,
SeparatorComponent?: ?ReactClass<*>, // not supported yet
renderSectionHeader?: ({section: Object}) => ?React.Element<any>,
SeparatorComponent?: ?React.ComponentType<*>, // not supported yet
// Provide either `items` or `sections`
items?: ?Array<Item>, // By default, an Item is assumed to be {key: string}
@ -61,8 +61,7 @@ type Props = NormalProps & DefaultProps;
* some section support tacked on. It is recommended to just use FlatList directly, this component
* is mostly for debugging and performance comparison.
*/
class MetroListView extends React.Component {
props: Props;
class MetroListView extends React.Component<Props, $FlowFixMeState> {
scrollToEnd(params?: ?{animated?: ?boolean}) {
throw new Error('scrollToEnd not supported in legacy ListView.');
}
@ -162,6 +161,10 @@ class MetroListView extends React.Component {
}
_listRef: ListView;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._listRef = ref;
};
_computeState(props: Props, state) {
@ -186,6 +189,10 @@ class MetroListView extends React.Component {
};
}
}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an error
* when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
_renderFooter = () => <this.props.FooterComponent key="$footer" />;
_renderRow = (item, sectionID, rowID, highlightRow) => {
return this.props.renderItem({item, index: rowID});
@ -199,6 +206,10 @@ class MetroListView extends React.Component {
return renderSectionHeader({section});
};
_renderSeparator = (sID, rID) =>
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<this.props.SeparatorComponent key={sID + rID} />;
}

View File

@ -44,7 +44,7 @@ type SectionBase<SectionItemT> = {
updateProps: (select: 'leading' | 'trailing', newProps: Object) => void,
},
}) => ?React.Element<any>,
ItemSeparatorComponent?: ?ReactClass<any>,
ItemSeparatorComponent?: ?React.ComponentType<any>,
keyExtractor?: (item: SectionItemT) => string,
// TODO: support more optional/override props
@ -86,22 +86,22 @@ type OptionalProps<SectionT: SectionBase<any>> = {
* `separators.highlight`/`unhighlight` which will update the `highlighted` prop, but you can also
* add custom props with `separators.updateProps`.
*/
ItemSeparatorComponent?: ?ReactClass<any>,
ItemSeparatorComponent?: ?React.ComponentType<any>,
/**
* Rendered at the very beginning of the list. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListHeaderComponent?: ?(ReactClass<any> | React.Element<any>),
ListHeaderComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered when the list is empty. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListEmptyComponent?: ?(ReactClass<any> | React.Element<any>),
ListEmptyComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the very end of the list. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListFooterComponent?: ?(ReactClass<any> | React.Element<any>),
ListFooterComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the top and bottom of each section (note this is different from
* `ItemSeparatorComponent` which is only rendered between items). These are intended to separate
@ -109,7 +109,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {
* `ItemSeparatorComponent`. Also receives `highlighted`, `[leading/trailing][Item/Separator]`,
* and any custom props from `separators.updateProps`.
*/
SectionSeparatorComponent?: ?ReactClass<any>,
SectionSeparatorComponent?: ?React.ComponentType<any>,
/**
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
@ -252,11 +252,7 @@ type DefaultProps = typeof defaultProps;
* Alternatively, you can provide a custom `keyExtractor` prop.
*
*/
class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
DefaultProps,
Props<SectionT>,
void,
> {
class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<Props<SectionT>, void> {
props: Props<SectionT>;
static defaultProps: DefaultProps = defaultProps;
@ -333,6 +329,10 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
_wrapperListRef: MetroListView | VirtualizedSectionList<any>;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._wrapperListRef = ref;
};
}

View File

@ -98,22 +98,22 @@ type OptionalProps = {
* Each cell is rendered using this element. Can be a React Component Class,
* or a render function. Defaults to using View.
*/
CellRendererComponent?: ?ReactClass<any>,
CellRendererComponent?: ?React.ComponentType<any>,
/**
* Rendered when the list is empty. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListEmptyComponent?: ?(ReactClass<any> | React.Element<any>),
ListEmptyComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the bottom of all the items. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListFooterComponent?: ?(ReactClass<any> | React.Element<any>),
ListFooterComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* Rendered at the top of all the items. Can be a React Component Class, a render function, or
* a rendered element.
*/
ListHeaderComponent?: ?(ReactClass<any> | React.Element<any>),
ListHeaderComponent?: ?(React.ComponentType<any> | React.Element<any>),
/**
* The maximum number of items to render in each incremental render batch. The more rendered at
* once, the better the fill rate, but responsiveness my suffer because rendering content may
@ -206,7 +206,7 @@ type State = {first: number, last: number};
* Alternatively, you can provide a custom `keyExtractor` prop.
*
*/
class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
class VirtualizedList extends React.PureComponent<Props, State> {
props: Props;
// scrollToEnd may be janky without getItemLayout prop
@ -221,7 +221,15 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
this._footerLength -
this._scrollMetrics.visibleLength,
);
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._scrollRef.scrollTo(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this.props.horizontal ? {x: offset, animated} : {y: offset, animated},
);
}
@ -252,7 +260,15 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
(viewPosition || 0) *
(this._scrollMetrics.visibleLength - frame.length),
) - (viewOffset || 0);
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._scrollRef.scrollTo(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
horizontal ? {x: offset, animated} : {y: offset, animated},
);
}
@ -287,7 +303,15 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
*/
scrollToOffset(params: {animated?: ?boolean, offset: number}) {
const {animated, offset} = params;
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._scrollRef.scrollTo(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this.props.horizontal ? {x: offset, animated} : {y: offset, animated},
);
}
@ -298,6 +322,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
}
flashScrollIndicators() {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._scrollRef.flashScrollIndicators();
}
@ -308,12 +336,20 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
*/
getScrollResponder() {
if (this._scrollRef && this._scrollRef.getScrollResponder) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
return this._scrollRef.getScrollResponder();
}
}
getScrollableNode() {
if (this._scrollRef && this._scrollRef.getScrollableNode) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
return this._scrollRef.getScrollableNode();
} else {
return ReactNative.findNodeHandle(this._scrollRef);
@ -322,6 +358,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
setNativeProps(props: Object) {
if (this._scrollRef) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._scrollRef.setNativeProps(props);
}
}
@ -539,6 +579,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListHeaderComponent // $FlowFixMe
: <ListHeaderComponent />;
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<View
key="$header"
onLayout={this._onLayoutHeader}
@ -644,6 +688,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListEmptyComponent // $FlowFixMe
: <ListEmptyComponent />;
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<View
key="$empty"
onLayout={this._onLayoutEmpty}
@ -657,6 +705,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListFooterComponent // $FlowFixMe
: <ListFooterComponent />;
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
<View
key="$footer"
onLayout={this._onLayoutFooter}
@ -1169,25 +1221,23 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
}
}
class CellRenderer extends React.Component {
props: {
CellRendererComponent?: ?ReactClass<any>,
ItemSeparatorComponent: ?ReactClass<*>,
cellKey: string,
fillRateHelper: FillRateHelper,
index: number,
inversionStyle: ?StyleObj,
item: Item,
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
onUnmount: (cellKey: string) => void,
onUpdateSeparators: (cellKeys: Array<?string>, props: Object) => void,
parentProps: {
getItemLayout?: ?Function,
renderItem: renderItemType,
},
prevCellKey: ?string,
};
class CellRenderer extends React.Component<{
CellRendererComponent?: ?React.ComponentType<any>,
ItemSeparatorComponent: ?React.ComponentType<*>,
cellKey: string,
fillRateHelper: FillRateHelper,
index: number,
inversionStyle: ?StyleObj,
item: Item,
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
onUnmount: (cellKey: string) => void,
onUpdateSeparators: (cellKeys: Array<?string>, props: Object) => void,
parentProps: {
getItemLayout?: ?Function,
renderItem: renderItemType,
},
prevCellKey: ?string,
}, $FlowFixMeState> {
state = {
separatorProps: {
highlighted: false,

View File

@ -39,8 +39,8 @@ type SectionBase = {
unhighlight: () => void,
updateProps: (select: 'leading' | 'trailing', newProps: Object) => void,
},
}) => ?React.Element<*>,
ItemSeparatorComponent?: ?ReactClass<*>,
}) => ?React.Element<any>,
ItemSeparatorComponent?: ?React.ComponentType<*>,
keyExtractor?: (item: SectionItem, index: ?number) => string,
// TODO: support more optional/override props
@ -57,11 +57,11 @@ type OptionalProps<SectionT: SectionBase> = {
/**
* Rendered after the last item in the last section.
*/
ListFooterComponent?: ?(ReactClass<*> | React.Element<*>),
ListFooterComponent?: ?(React.ComponentType<*> | React.Element<any>),
/**
* Rendered at the very beginning of the list.
*/
ListHeaderComponent?: ?(ReactClass<*> | React.Element<*>),
ListHeaderComponent?: ?(React.ComponentType<*> | React.Element<any>),
/**
* Default renderer for every item in every section.
*/
@ -78,20 +78,20 @@ type OptionalProps<SectionT: SectionBase> = {
/**
* Rendered at the top of each section.
*/
renderSectionHeader?: ?({section: SectionT}) => ?React.Element<*>,
renderSectionHeader?: ?({section: SectionT}) => ?React.Element<any>,
/**
* Rendered at the bottom of each section.
*/
renderSectionFooter?: ?({section: SectionT}) => ?React.Element<*>,
renderSectionFooter?: ?({section: SectionT}) => ?React.Element<any>,
/**
* Rendered at the bottom of every Section, except the very last one, in place of the normal
* ItemSeparatorComponent.
*/
SectionSeparatorComponent?: ?ReactClass<*>,
SectionSeparatorComponent?: ?React.ComponentType<*>,
/**
* Rendered at the bottom of every Item except the very last one in the last section.
*/
ItemSeparatorComponent?: ?ReactClass<*>,
ItemSeparatorComponent?: ?React.ComponentType<*>,
/**
* Warning: Virtualization can drastically improve memory consumption for long lists, but trashes
* the state of items when they scroll out of the render window, so make sure all relavent data is
@ -133,11 +133,7 @@ type State = {childProps: VirtualizedListProps};
* hood. The only operation that might not scale well is concatting the data arrays of all the
* sections when new props are received, which should be plenty fast for up to ~10,000 items.
*/
class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
DefaultProps,
Props<SectionT>,
State,
> {
class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<Props<SectionT>, State> {
props: Props<SectionT>;
state: State;
@ -305,7 +301,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
ref && ref.updateSeparatorProps(newProps);
};
_getSeparatorComponent(index: number, info?: ?Object): ?ReactClass<*> {
_getSeparatorComponent(index: number, info?: ?Object): ?React.ComponentType<*> {
info = info || this._subExtractor(index);
if (!info) {
return null;
@ -369,13 +365,17 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
_cellRefs = {};
_listRef: VirtualizedList;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._listRef = ref;
};
}
type ItemWithSeparatorProps = {
LeadingSeparatorComponent: ?ReactClass<*>,
SeparatorComponent: ?ReactClass<*>,
LeadingSeparatorComponent: ?React.ComponentType<*>,
SeparatorComponent: ?React.ComponentType<*>,
cellKey: string,
index: number,
item: Item,
@ -389,9 +389,7 @@ type ItemWithSeparatorProps = {
trailingSection: ?Object,
};
class ItemWithSeparator extends React.Component {
props: ItemWithSeparatorProps;
class ItemWithSeparator extends React.Component<ItemWithSeparatorProps, $FlowFixMeState> {
state = {
separatorProps: {
highlighted: false,

View File

@ -79,7 +79,7 @@ const RCTModalHostView = requireNativeComponent('RCTModalHostView', null);
* ```
*/
class Modal extends React.Component {
class Modal extends React.Component<Object> {
static propTypes = {
/**
* The `animationType` prop controls how the modal animates.
@ -168,7 +168,7 @@ class Modal extends React.Component {
}
}
render(): ?React.Element<any> {
render(): React.Node {
if (this.props.visible === false) {
return null;
}

View File

@ -22,12 +22,10 @@ const ViewPropTypes = require('ViewPropTypes');
var requireNativeComponent = require('requireNativeComponent');
class SnapshotViewIOS extends React.Component {
props: {
onSnapshotReady?: Function,
testIdentifier?: string,
};
class SnapshotViewIOS extends React.Component<{
onSnapshotReady?: Function,
testIdentifier?: string,
}> {
// $FlowFixMe(>=0.41.0)
static propTypes = {
...ViewPropTypes,

View File

@ -25,22 +25,25 @@ type Context = {
rootTag: number,
};
type Props = {|
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an error
* when upgrading Flow's support for React. Common errors found when
* upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
children?: React.Children,
rootTag: number,
WrapperComponent?: ?ReactClass<*>,
WrapperComponent?: ?React.ComponentType<*>,
|};
type State = {
inspector: ?React.Element<*>,
inspector: ?React.Element<any>,
mainKey: number,
};
class AppContainer extends React.Component {
props: Props;
class AppContainer extends React.Component<Props, State> {
state: State = {
inspector: null,
mainKey: 1,
};
_mainRef: ?React.Element<*>;
_mainRef: ?React.Element<any>;
_subscription: ?EmitterSubscription = null;
static childContextTypes = {
@ -87,7 +90,7 @@ class AppContainer extends React.Component {
}
}
render(): React.Element<*> {
render(): React.Node {
let yellowBox = null;
if (__DEV__) {
if (!global.__RCTProfileIsProfiling) {
@ -103,6 +106,10 @@ class AppContainer extends React.Component {
pointerEvents="box-none"
style={styles.appContainer}
ref={ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error when upgrading Flow's support for React. Common errors
* found when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
this._mainRef = ref;
}}>
{this.props.children}

View File

@ -23,9 +23,9 @@ const renderApplication = require('renderApplication');
type Task = (taskData: any) => Promise<void>;
type TaskProvider = () => Task;
export type ComponentProvider = () => ReactClass<any>;
export type ComponentProvider = () => React$ComponentType<any>;
export type ComponentProviderInstrumentationHook =
(component: ComponentProvider) => ReactClass<any>;
(component: ComponentProvider) => React$ComponentType<any>;
export type AppConfig = {
appKey: string,
component?: ComponentProvider,
@ -43,7 +43,7 @@ export type Registry = {
sections: Array<string>,
runnables: Runnables,
};
export type WrapperComponentProvider = any => ReactClass<*>;
export type WrapperComponentProvider = any => React$ComponentType<*>;
const runnables: Runnables = {};
let runCount = 1;

View File

@ -304,12 +304,11 @@ const WarningInspector = ({
);
};
class YellowBox extends React.Component {
state: {
stacktraceVisible: boolean,
inspecting: ?string,
warningMap: Map<any, any>,
};
class YellowBox extends React.Component<mixed, {
stacktraceVisible: boolean,
inspecting: ?string,
warningMap: Map<any, any>,
}> {
_listener: ?EmitterSubscription;
dismissWarning: (warning: ?string) => void;

View File

@ -23,10 +23,10 @@ const invariant = require('fbjs/lib/invariant');
require('BackHandler');
function renderApplication<Props: Object>(
RootComponent: ReactClass<Props>,
RootComponent: React.ComponentType<Props>,
initialProps: Props,
rootTag: any,
WrapperComponent?: ?ReactClass<*>,
WrapperComponent?: ?React.ComponentType<*>,
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);

View File

@ -46,7 +46,7 @@ function requireNativeComponent(
viewName: string,
componentInterface?: ?ComponentInterface,
extraConfig?: ?{nativeOnly?: Object},
): ReactClass<any> | string {
): React$ComponentType<any> | string {
const viewConfig = UIManager[viewName];
if (!viewConfig || !viewConfig.NativeProps) {
warning(false, 'Native component for "%s" does not exist', viewName);

View File

@ -13,7 +13,7 @@
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
export type ComponentInterface = ReactClass<any> | {
export type ComponentInterface = React$ComponentType<any> | {
name?: string,
displayName?: string,
propTypes: Object,
@ -43,6 +43,10 @@ function verifyPropTypes(
if (!propTypes) {
throw new Error(
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
'`' + componentName + '` has no propTypes defined`'
);
}
@ -54,9 +58,17 @@ function verifyPropTypes(
(!nativePropsToIgnore || !nativePropsToIgnore[prop])) {
var message;
if (propTypes.hasOwnProperty(prop)) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
message = '`' + componentName + '` has incorrectly defined propType for native prop `' +
viewConfig.uiViewClassName + '.' + prop + '` of native type `' + nativeProps[prop];
} else {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error when upgrading Flow's support for React. Common errors found
* when upgrading Flow's React support are documented at
* https://fburl.com/eq7bs81w */
message = '`' + componentName + '` has no propType for native prop `' +
viewConfig.uiViewClassName + '.' + prop + '` of native type `' +
nativeProps[prop] + '`';

View File

@ -13,16 +13,16 @@
'use strict';
export type ReactNode =
| ReactElement<any>
| React$Element<any>
| ReactCoroutine
| ReactYield
| ReactPortal
| ReactText
| ReactFragment;
export type ReactFragment = ReactEmpty | Iterable<ReactNode>;
export type ReactFragment = ReactEmpty | Iterable<React$Node>;
export type ReactNodeList = ReactEmpty | ReactNode;
export type ReactNodeList = ReactEmpty | React$Node;
export type ReactText = string | number;

View File

@ -33,19 +33,19 @@ function normalizeColor(color: string | number): ?number {
if ((match = matchers.rgb.exec(color))) {
return (
(// b
parse255(match[1]) << 24 | // r
parse255(match[2]) << 16 | // g
parse255(match[3]) << 8 | // b
0x000000ff // a
parse255(match[3]) << 8 | 0x000000ff) // a
) >>> 0;
}
if ((match = matchers.rgba.exec(color))) {
return (
(// b
parse255(match[1]) << 24 | // r
parse255(match[2]) << 16 | // g
parse255(match[3]) << 8 | // b
parse1(match[4]) // a
parse255(match[3]) << 8 | parse1(match[4])) // a
) >>> 0;
}
@ -76,23 +76,21 @@ function normalizeColor(color: string | number): ?number {
if ((match = matchers.hsl.exec(color))) {
return (
hslToRgb(
(hslToRgb(
parse360(match[1]), // h
parsePercentage(match[2]), // s
parsePercentage(match[3]) // l
) |
0x000000ff // a
) | 0x000000ff) // a
) >>> 0;
}
if ((match = matchers.hsla.exec(color))) {
return (
hslToRgb(
(hslToRgb(
parse360(match[1]), // h
parsePercentage(match[2]), // s
parsePercentage(match[3]) // l
) |
parse1(match[4]) // a
) | parse1(match[4])) // a
) >>> 0;
}

View File

@ -479,11 +479,11 @@ const Text = createReactClass({
});
};
this.touchableHandlePress = (e: SyntheticEvent) => {
this.touchableHandlePress = (e: SyntheticEvent<>) => {
this.props.onPress && this.props.onPress(e);
};
this.touchableHandleLongPress = (e: SyntheticEvent) => {
this.touchableHandleLongPress = (e: SyntheticEvent<>) => {
this.props.onLongPress && this.props.onLongPress(e);
};
@ -494,28 +494,28 @@ const Text = createReactClass({
// $FlowFixMe(>=0.41.0)
return setResponder;
},
onResponderGrant: function(e: SyntheticEvent, dispatchID: string) {
onResponderGrant: function(e: SyntheticEvent<>, dispatchID: string) {
// $FlowFixMe(>=0.41.0)
this.touchableHandleResponderGrant(e, dispatchID);
this.props.onResponderGrant &&
// $FlowFixMe(>=0.41.0)
this.props.onResponderGrant.apply(this, arguments);
}.bind(this),
onResponderMove: function(e: SyntheticEvent) {
onResponderMove: function(e: SyntheticEvent<>) {
// $FlowFixMe(>=0.41.0)
this.touchableHandleResponderMove(e);
this.props.onResponderMove &&
// $FlowFixMe(>=0.41.0)
this.props.onResponderMove.apply(this, arguments);
}.bind(this),
onResponderRelease: function(e: SyntheticEvent) {
onResponderRelease: function(e: SyntheticEvent<>) {
// $FlowFixMe(>=0.41.0)
this.touchableHandleResponderRelease(e);
this.props.onResponderRelease &&
// $FlowFixMe(>=0.41.0)
this.props.onResponderRelease.apply(this, arguments);
}.bind(this),
onResponderTerminate: function(e: SyntheticEvent) {
onResponderTerminate: function(e: SyntheticEvent<>) {
// $FlowFixMe(>=0.41.0)
this.touchableHandleResponderTerminate(e);
this.props.onResponderTerminate &&

View File

@ -30,7 +30,7 @@ const {
var scale = Platform.isTVOS ? 4 : 1;
class ARTExample extends React.Component{
class ARTExample extends React.Component<{}> {
render(){
const pathRect = new Path()
.moveTo(scale * 0,scale * 0)

View File

@ -19,7 +19,7 @@ var {
View,
} = ReactNative;
class AccessibilityIOSExample extends React.Component {
class AccessibilityIOSExample extends React.Component<{}> {
render() {
return (
<View>
@ -53,7 +53,7 @@ class AccessibilityIOSExample extends React.Component {
}
}
class ScreenReaderStatusExample extends React.Component {
class ScreenReaderStatusExample extends React.Component<{}, $FlowFixMeState> {
state = {
screenReaderEnabled: false,
}

View File

@ -31,7 +31,7 @@ var BUTTONS = [
var DESTRUCTIVE_INDEX = 3;
var CANCEL_INDEX = 4;
class ActionSheetExample extends React.Component {
class ActionSheetExample extends React.Component<{}, $FlowFixMeState> {
state = {
clicked: 'none',
};
@ -61,7 +61,7 @@ class ActionSheetExample extends React.Component {
};
}
class ActionSheetTintExample extends React.Component {
class ActionSheetTintExample extends React.Component<{}, $FlowFixMeState> {
state = {
clicked: 'none',
};
@ -92,7 +92,7 @@ class ActionSheetTintExample extends React.Component {
};
}
class ShareActionSheetExample extends React.Component {
class ShareActionSheetExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
text: ''
};
@ -132,7 +132,7 @@ class ShareActionSheetExample extends React.Component {
};
}
class ShareScreenshotExample extends React.Component {
class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
state = {
text: ''
};

View File

@ -20,11 +20,7 @@ import { ActivityIndicator, StyleSheet, View } from 'react-native';
type State = { animating: boolean; };
type Timer = number;
class ToggleAnimatingActivityIndicator extends Component {
/**
* Optional Flowtype state and timer types
*/
state: State;
class ToggleAnimatingActivityIndicator extends Component<$FlowFixMeProps, State> {
_timer: Timer;
constructor(props) {

View File

@ -81,8 +81,7 @@ exports.examples = [{
}
}];
class PromptOptions extends React.Component {
state: any;
class PromptOptions extends React.Component<$FlowFixMeProps, any> {
customButtons: Array<Object>;
constructor(props) {

View File

@ -35,9 +35,7 @@ exports.examples = [
'bring opacity from 0 to 1 when the component ' +
'mounts.',
render: function() {
class FadeInView extends React.Component {
state: any;
class FadeInView extends React.Component<$FlowFixMeProps, any> {
constructor(props) {
super(props);
this.state = {
@ -64,9 +62,7 @@ exports.examples = [
);
}
}
class FadeInExample extends React.Component {
state: any;
class FadeInExample extends React.Component<$FlowFixMeProps, any> {
constructor(props) {
super(props);
this.state = {

View File

@ -27,9 +27,7 @@ var CIRCLE_SIZE = 80;
var CIRCLE_MARGIN = 18;
var NUM_CIRCLES = 30;
class Circle extends React.Component {
state: any;
props: any;
class Circle extends React.Component<any, any> {
longTimer: number;
_onLongPress: () => void;
@ -78,7 +76,7 @@ class Circle extends React.Component {
});
}
render(): React.Element<any> {
render(): React.Node {
if (this.state.panResponder) {
var handlers = this.state.panResponder.panHandlers;
var dragStyle = { // Used to position while dragging
@ -156,10 +154,7 @@ class Circle extends React.Component {
}
}
class AnExApp extends React.Component {
state: any;
props: any;
class AnExApp extends React.Component<any, any> {
static title = 'Animated - Gratuitous App';
static description = 'Bunch of Animations - tap a circle to ' +
'open a view with more animations, or longPress and drag to reorder circles.';
@ -179,7 +174,7 @@ class AnExApp extends React.Component {
this._onMove = this._onMove.bind(this);
}
render(): React.Element<any> {
render(): React.Node {
var circles = this.state.keys.map((key, idx) => {
if (key === this.state.activeKey) {
return <Circle key={key + 'd'} dummy={true} />;

View File

@ -30,9 +30,7 @@ var BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => { // static positions
};
});
class AnExBobble extends React.Component {
state: any;
class AnExBobble extends React.Component<Object, any> {
constructor(props: Object) {
super(props);
this.state = {};
@ -83,7 +81,7 @@ class AnExBobble extends React.Component {
});
}
render(): React.Element<any> {
render(): React.Node {
return (
<View style={styles.bobbleContainer}>
{this.state.bobbles.map((_, i) => {

View File

@ -20,9 +20,7 @@ var {
View,
} = ReactNative;
class AnExChained extends React.Component {
state: any;
class AnExChained extends React.Component<Object, any> {
constructor(props: Object) {
super(props);
this.state = {

View File

@ -22,7 +22,7 @@ var {
View,
} = ReactNative;
class AnExScroll extends React.Component {
class AnExScroll extends React.Component<$FlowFixMeProps, any> {
state: any = { scrollX: new Animated.Value(0) };
render() {

View File

@ -26,9 +26,7 @@ var AnExChained = require('./AnExChained');
var AnExScroll = require('./AnExScroll');
var AnExTilt = require('./AnExTilt');
class AnExSet extends React.Component {
state: any;
class AnExSet extends React.Component<Object, any> {
constructor(props: Object) {
super(props);
function randColor() {
@ -40,7 +38,7 @@ class AnExSet extends React.Component {
openColor: randColor(),
};
}
render(): React.Element<any> {
render(): React.Node {
var backgroundColor = this.props.openVal ?
this.props.openVal.interpolate({
inputRange: [0, 1],

View File

@ -19,9 +19,7 @@ var {
StyleSheet,
} = ReactNative;
class AnExTilt extends React.Component {
state: any;
class AnExTilt extends React.Component<Object, any> {
constructor(props: Object) {
super(props);
this.state = {
@ -83,7 +81,7 @@ class AnExTilt extends React.Component {
this._startBurnsZoom();
}
render(): React.Element<any> {
render(): React.Node {
return (
<Animated.View
{...this.state.tiltPanResponder.panHandlers}

View File

@ -19,7 +19,7 @@ const {
View
} = ReactNative;
class AppStateSubscription extends React.Component {
class AppStateSubscription extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
appState: AppState.currentState,
previousAppStates: [],

View File

@ -20,7 +20,7 @@ var {
ScrollView
} = ReactNative;
class AssetScaledImageExample extends React.Component {
class AssetScaledImageExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
asset: this.props.asset
};

View File

@ -24,7 +24,7 @@ var PickerItemIOS = PickerIOS.Item;
var STORAGE_KEY = '@AsyncStorageExample:key';
var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
class BasicStorageExample extends React.Component {
class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
state = {
selectedValue: COLORS[0],
messages: [],

View File

@ -31,7 +31,7 @@ const CameraRollView = require('./CameraRollView');
const AssetScaledImageExampleView = require('./AssetScaledImageExample');
class CameraRollExample extends React.Component {
class CameraRollExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
groupTypes: 'SavedPhotos',
sliderValue: 1,

View File

@ -19,7 +19,7 @@ var {
Text,
} = ReactNative;
class ClipboardExample extends React.Component {
class ClipboardExample extends React.Component<{}, $FlowFixMeState> {
state = {
content: 'Content will appear here'
};

View File

@ -21,7 +21,7 @@ var {
View,
} = ReactNative;
class DatePickerExample extends React.Component {
class DatePickerExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
static defaultProps = {
date: new Date(),
timeZoneOffsetInHours: (-1) * (new Date()).getTimezoneOffset() / 60,
@ -91,7 +91,7 @@ class DatePickerExample extends React.Component {
}
}
class WithLabel extends React.Component {
class WithLabel extends React.Component<$FlowFixMeProps> {
render() {
return (
<View style={styles.labelContainer}>
@ -106,7 +106,7 @@ class WithLabel extends React.Component {
}
}
class Heading extends React.Component {
class Heading extends React.Component<$FlowFixMeProps> {
render() {
return (
<View style={styles.headingContainer}>

View File

@ -47,7 +47,7 @@ const VIEWABILITY_CONFIG = {
waitForInteraction: true,
};
class FlatListExample extends React.PureComponent {
class FlatListExample extends React.PureComponent<{}, $FlowFixMeState> {
static title = '<FlatList>';
static description = 'Performant, scrollable list of data.';

View File

@ -33,7 +33,7 @@ exports.examples = [
}
];
class GeolocationExample extends React.Component {
class GeolocationExample extends React.Component<{}, $FlowFixMeState> {
state = {
initialPosition: 'unknown',
lastPosition: 'unknown',

View File

@ -22,7 +22,7 @@ var {
View,
} = ReactNative;
class ImageCapInsetsExample extends React.Component {
class ImageCapInsetsExample extends React.Component<{}> {
render() {
return (
<View>

View File

@ -21,7 +21,7 @@ const {
TouchableOpacity,
} = ReactNative;
class AddRemoveExample extends React.Component {
class AddRemoveExample extends React.Component<{}, $FlowFixMeState> {
state = {
views: [],
};
@ -74,7 +74,7 @@ const BlueSquare = () =>
<Text>Blue square</Text>
</View>;
class CrossFadeExample extends React.Component {
class CrossFadeExample extends React.Component<{}, $FlowFixMeState> {
state = {
toggled: false,
};

View File

@ -32,7 +32,7 @@ type State = {
viewStyle: { margin: number },
};
class LayoutEventExample extends React.Component {
class LayoutEventExample extends React.Component<{}, State> {
state: State = {
viewStyle: {
margin: 20,

View File

@ -22,7 +22,7 @@ var {
var RNTesterBlock = require('./RNTesterBlock');
var RNTesterPage = require('./RNTesterPage');
class Circle extends React.Component {
class Circle extends React.Component<$FlowFixMeProps> {
render() {
var size = this.props.size || 20;
var backgroundColor = this.props.bgColor || '#527fe4';
@ -40,7 +40,7 @@ class Circle extends React.Component {
}
}
class CircleBlock extends React.Component {
class CircleBlock extends React.Component<$FlowFixMeProps> {
render() {
var circleStyle = {
flexDirection: 'row',
@ -57,7 +57,7 @@ class CircleBlock extends React.Component {
}
}
class LayoutExample extends React.Component {
class LayoutExample extends React.Component<$FlowFixMeProps> {
static title = 'Layout - Flexbox';
static description = 'Examples of using the flexbox API to layout views.';
static displayName = 'LayoutExample';

View File

@ -44,15 +44,14 @@ function genItemData(count: number, start: number = 0): Array<Item> {
const HORIZ_WIDTH = 200;
const ITEM_HEIGHT = 72;
class ItemComponent extends React.PureComponent {
props: {
fixedHeight?: ?boolean,
horizontal?: ?boolean,
item: Item,
onPress: (key: string) => void,
onShowUnderlay?: () => void,
onHideUnderlay?: () => void,
};
class ItemComponent extends React.PureComponent<{
fixedHeight?: ?boolean,
horizontal?: ?boolean,
item: Item,
onPress: (key: string) => void,
onShowUnderlay?: () => void,
onHideUnderlay?: () => void,
}> {
_onPress = () => {
this.props.onPress(this.props.item.key);
};
@ -91,7 +90,7 @@ const renderStackedItem = ({item}: {item: Item}) => {
);
};
class FooterComponent extends React.PureComponent {
class FooterComponent extends React.PureComponent<{}> {
render() {
return (
<View style={styles.headerFooterContainer}>
@ -104,7 +103,7 @@ class FooterComponent extends React.PureComponent {
}
}
class HeaderComponent extends React.PureComponent {
class HeaderComponent extends React.PureComponent<{}> {
render() {
return (
<View style={styles.headerFooterContainer}>
@ -117,13 +116,13 @@ class HeaderComponent extends React.PureComponent {
}
}
class SeparatorComponent extends React.PureComponent {
class SeparatorComponent extends React.PureComponent<{}> {
render() {
return <View style={styles.separator} />;
}
}
class ItemSeparatorComponent extends React.PureComponent {
class ItemSeparatorComponent extends React.PureComponent<$FlowFixMeProps> {
render() {
const style = this.props.highlighted
? [styles.itemSeparator, {marginLeft: 0, backgroundColor: 'rgb(217, 217, 217)'}]
@ -132,7 +131,7 @@ class ItemSeparatorComponent extends React.PureComponent {
}
}
class Spindicator extends React.PureComponent {
class Spindicator extends React.PureComponent<$FlowFixMeProps> {
render() {
return (
<Animated.View style={[styles.spindicator, {

View File

@ -45,7 +45,7 @@ var THUMB_URLS = [
var NUM_SECTIONS = 100;
var NUM_ROWS_PER_SECTION = 10;
class Thumb extends React.Component {
class Thumb extends React.Component<{}, $FlowFixMeState> {
componentWillMount() {
UIManager.setLayoutAnimationEnabledExperimental &&
UIManager.setLayoutAnimationEnabledExperimental(true);
@ -86,8 +86,7 @@ class Thumb extends React.Component {
}
}
class ListViewPagingExample extends React.Component {
state: *;
class ListViewPagingExample extends React.Component<$FlowFixMeProps, *> {
static title = '<ListView> - Paging';
static description = 'Floating headers & layout animations.';

View File

@ -23,7 +23,7 @@ const {
View,
} = require('react-native');
class MaskedViewExample extends React.Component {
class MaskedViewExample extends React.Component<{}, $FlowFixMeState> {
static title = '<MaskedViewIOS>';
static description = 'Renders the child view with a mask specified in the `renderMask` prop.';

View File

@ -30,7 +30,7 @@ exports.framework = 'React';
exports.title = '<Modal>';
exports.description = 'Component for presenting modal views.';
class Button extends React.Component {
class Button extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
active: false,
};
@ -52,9 +52,6 @@ class Button extends React.Component {
onHideUnderlay={this._onUnhighlight}
onPress={this.props.onPress}
onShowUnderlay={this._onHighlight}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete
* this comment and run Flow. */
style={[styles.button, this.props.style]}
underlayColor="#a9d9d4">
<Text style={[styles.buttonText, colorStyle]}>{this.props.children}</Text>
@ -72,7 +69,7 @@ const supportedOrientationsPickerValues = [
[],
];
class ModalExample extends React.Component {
class ModalExample extends React.Component<{}, $FlowFixMeState> {
state = {
animationType: 'none',
modalVisible: false,

View File

@ -36,7 +36,7 @@ const {
renderSmallSwitchOption,
} = require('./ListExampleShared');
class MultiColumnExample extends React.PureComponent {
class MultiColumnExample extends React.PureComponent<$FlowFixMeProps, $FlowFixMeState> {
static title = '<FlatList> - MultiColumn';
static description = 'Performant, scrollable grid of data.';

View File

@ -24,7 +24,7 @@ const {
var AnimatedSlider = Animated.createAnimatedComponent(Slider);
class Tester extends React.Component {
class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
native: new Animated.Value(0),
js: new Animated.Value(0),
@ -74,7 +74,7 @@ class Tester extends React.Component {
}
}
class ValueListenerExample extends React.Component {
class ValueListenerExample extends React.Component<{}, $FlowFixMeState> {
state = {
anim: new Animated.Value(0),
progress: 0,
@ -123,7 +123,7 @@ class ValueListenerExample extends React.Component {
}
}
class LoopExample extends React.Component {
class LoopExample extends React.Component<{}, $FlowFixMeState> {
state = {
value: new Animated.Value(0),
};
@ -158,9 +158,8 @@ class LoopExample extends React.Component {
}
const RNTesterSettingSwitchRow = require('RNTesterSettingSwitchRow');
class InternalSettings extends React.Component {
class InternalSettings extends React.Component<{}, {busyTime: number | string, filteredStall: number}> {
_stallInterval: ?number;
state: {busyTime: number | string, filteredStall: number};
render() {
return (
<View>
@ -208,7 +207,7 @@ class InternalSettings extends React.Component {
}
}
class EventExample extends React.Component {
class EventExample extends React.Component<{}, $FlowFixMeState> {
state = {
scrollX: new Animated.Value(0),
};

View File

@ -27,7 +27,7 @@ const {
View,
} = ReactNative;
class EmptyPage extends React.Component {
class EmptyPage extends React.Component<$FlowFixMeProps> {
render() {
return (
<View style={styles.emptyPage}>
@ -39,7 +39,7 @@ class EmptyPage extends React.Component {
}
}
class NavigatorIOSExamplePage extends React.Component {
class NavigatorIOSExamplePage extends React.Component<$FlowFixMeProps> {
render() {
var recurseTitle = 'Recurse Navigation';
if (!this.props.depth || this.props.depth === 1) {
@ -230,7 +230,7 @@ class NavigatorIOSExamplePage extends React.Component {
};
}
class NavigatorIOSExample extends React.Component {
class NavigatorIOSExample extends React.Component<$FlowFixMeProps> {
static title = '<NavigatorIOS>';
static description = 'iOS navigation capabilities';
static external = true;

View File

@ -20,7 +20,7 @@ const {
TouchableWithoutFeedback,
} = ReactNative;
class ConnectionInfoSubscription extends React.Component {
class ConnectionInfoSubscription extends React.Component<{}, $FlowFixMeState> {
state = {
connectionInfoHistory: [],
};
@ -56,7 +56,7 @@ class ConnectionInfoSubscription extends React.Component {
}
}
class ConnectionInfoCurrent extends React.Component {
class ConnectionInfoCurrent extends React.Component<{}, $FlowFixMeState> {
state = {
connectionInfo: null,
};
@ -93,7 +93,7 @@ class ConnectionInfoCurrent extends React.Component {
}
}
class IsConnected extends React.Component {
class IsConnected extends React.Component<{}, $FlowFixMeState> {
state = {
isConnected: null,
};
@ -130,7 +130,7 @@ class IsConnected extends React.Component {
}
}
class IsConnectionExpensive extends React.Component {
class IsConnectionExpensive extends React.Component<{}, $FlowFixMeState> {
state = {
isConnectionExpensive: (null : ?boolean),
};

View File

@ -21,7 +21,7 @@ const {
import type EmitterSubscription from 'EmitterSubscription';
class OrientationChangeExample extends React.Component {
class OrientationChangeExample extends React.Component<{}, $FlowFixMeState> {
_orientationSubscription: EmitterSubscription;
state = {

Some files were not shown because too many files have changed in this diff Show More