Skip to content

Commit

Permalink
Upgrade fbsource/xplat/js to Flow v0.53.0
Browse files Browse the repository at this point in the history
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
  • Loading branch information
Caleb Meredith authored and facebook-github-bot committed Aug 18, 2017
1 parent 1ce7e4c commit 90eaeb0
Show file tree
Hide file tree
Showing 154 changed files with 652 additions and 631 deletions.
8 changes: 5 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|we

This comment has been minimized.

Copy link
@janicduplessis

janicduplessis Aug 22, 2017

Contributor

@calebmer This broke oss flow. We need to update the version of flow-bin in package.json and also site=react_native_fb doesn't work so we need to change it to either site=react_native_oss or just remove the site.

This comment has been minimized.

Copy link
@janicduplessis

janicduplessis Aug 23, 2017

Contributor

This comment has been minimized.

Copy link
@chirag04

chirag04 Aug 23, 2017

Contributor

This comment has been minimized.

Copy link
@hramos

hramos Aug 29, 2017

Contributor

This commit was synced to GitHub from our Phabricator instance. As it happens, not all engineers receive notifications for comments left on commits. Until we have a better system in place for this, I suggest creating a new issue and tagging @facebook/react-native (or myself directly) and I'll follow up with the author on the internal Phabricator diff.

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
4 changes: 2 additions & 2 deletions IntegrationTests/AccessibilityManagerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {
} = ReactNative.NativeModules;


class AccessibilityManagerTest extends React.Component {
class AccessibilityManagerTest extends React.Component<{}> {
componentDidMount() {
AccessibilityManager.setAccessibilityContentSizeMultipliers({
'extraSmall': 1.0,
Expand All @@ -42,7 +42,7 @@ class AccessibilityManagerTest extends React.Component {
});
}

render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/AppEventsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/AsyncStorageTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function testOptimizedMultiGet() {
}


class AsyncStorageTest extends React.Component {
class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> {
state = {
messages: 'Initializing...',
done: false,
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/ImageCachePolicyTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/ImageSnapshotTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
10 changes: 4 additions & 6 deletions IntegrationTests/IntegrationTestHarnessTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion IntegrationTests/IntegrationTestsApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require('LoggingTestModule');

type Test = any;

class IntegrationTestsApp extends React.Component {
class IntegrationTestsApp extends React.Component<{}, $FlowFixMeState> {
state = {
test: (null: ?Test),
};
Expand All @@ -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>
);
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/PromiseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,7 +66,7 @@ class PromiseTest extends React.Component {
}
};

render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/SimpleSnapshotTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/SyncMethodTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -32,7 +32,7 @@ class SyncMethodTest extends React.Component {
TestModule.markTestCompleted();
}

render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/WebSocketTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -158,7 +158,7 @@ class WebSocketTest extends React.Component {
});
}

render(): React.Element<any> {
render(): React.Node {
return <View />;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 8 additions & 11 deletions Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions Libraries/Components/MaskedView/MaskedViewIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
};

/**
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Navigation/NavigatorIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
36 changes: 16 additions & 20 deletions Libraries/Components/Picker/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*/
Expand Down
22 changes: 9 additions & 13 deletions Libraries/Components/Picker/PickerAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 19 additions & 3 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down Expand Up @@ -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}
Expand All @@ -829,13 +837,21 @@ 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>
);
}
}
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>
Expand Down Expand Up @@ -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') {
Expand All @@ -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.
Expand Down
Loading

0 comments on commit 90eaeb0

Please sign in to comment.