Skip to content

Commit

Permalink
Upgrade to Flow v0.68.0
Browse files Browse the repository at this point in the history
Reviewed By: gabelevi

Differential Revision: D7310349

fbshipit-source-id: 70d29815dd7912704aec8a015c970be3fafeeba3
  • Loading branch information
samwgoldman authored and facebook-github-bot committed Mar 20, 2018
1 parent 5347ecf commit 0d924dd
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.67.0
^0.68.0
3 changes: 3 additions & 0 deletions Libraries/Animated/src/nodes/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ let _uniqueId = 1;
function _flush(rootNode: AnimatedValue): void {
const animatedStyles = new Set();
function findAnimatedStyles(node) {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (typeof node.update === 'function') {
animatedStyles.add(node);
} else {
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Experimental/SwipeableRow/SwipeableListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class SwipeableListView extends React.Component<Props, State> {
* (from high 20s to almost consistently 60 fps)
*/
_setListViewScrollable(value: boolean): void {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (this._listViewRef && typeof this._listViewRef.setNativeProps === 'function') {
this._listViewRef.setNativeProps({
scrollEnabled: value,
Expand All @@ -151,6 +154,9 @@ class SwipeableListView extends React.Component<Props, State> {

// Passing through ListView's getScrollResponder() function
getScrollResponder(): ?Object {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (this._listViewRef && typeof this._listViewRef.getScrollResponder === 'function') {
return this._listViewRef.getScrollResponder();
}
Expand Down
14 changes: 6 additions & 8 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
cellKey={this._getCellKey() + '-header'}
key="$header">
<View onLayout={this._onLayoutHeader} style={inversionStyle}>
{/*
Flow doesn't know this is a React.Element and not a React.Component
$FlowFixMe https://fburl.com/b9xmtm09
*/}
{element}
</View>
</VirtualizedCellWrapper>,
Expand Down Expand Up @@ -883,10 +879,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
cellKey={this._getCellKey() + '-footer'}
key="$footer">
<View onLayout={this._onLayoutFooter} style={inversionStyle}>
{/*
Flow doesn't know this is a React.Element and not a React.Component
$FlowFixMe https://fburl.com/b9xmtm09
*/}
{element}
</View>
</VirtualizedCellWrapper>,
Expand Down Expand Up @@ -1122,6 +1114,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
const itemCount = this.props.getItemCount(this.props.data);
for (let ii = 0; ii < itemCount; ii++) {
const frame = this._getFrameMetricsApprox(ii);
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (frame.inLayout) {
framesInLayout.push(frame);
}
Expand Down Expand Up @@ -1646,6 +1641,9 @@ class CellRenderer extends React.Component<
separators: this._separators,
});
const onLayout =
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
getItemLayout && !parentProps.debug && !fillRateHelper.enabled()
? undefined
: this.props.onLayout;
Expand Down
9 changes: 9 additions & 0 deletions Libraries/ReactNative/YellowBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ function sprintf(format, ...args) {
}

function updateWarningMap(...args): void {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
if (console.disableYellowBox) {
return;
}
Expand Down Expand Up @@ -178,6 +181,9 @@ function isWarningIgnored(warning: string): boolean {

// DEPRECATED
return (
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
Array.isArray(console.ignoredYellowBox) &&
console.ignoredYellowBox.some(ignorePrefix =>
warning.startsWith(String(ignorePrefix)),
Expand Down Expand Up @@ -379,6 +385,9 @@ class YellowBox extends React.Component<
}

render() {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (console.disableYellowBox || this.state.warningMap.size === 0) {
return null;
}
Expand Down
3 changes: 3 additions & 0 deletions Libraries/ReactNative/renderApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ function renderApplication<Props: Object>(
// to be async also. To do this, wrap AppContainer with an async marker.
// For more info see https://fb.me/is-component-async
if (
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
RootComponent.prototype != null &&
RootComponent.prototype.unstable_isAsyncReactComponent === true
) {
Expand Down
3 changes: 3 additions & 0 deletions Libraries/ReactNative/renderFabricSurface.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function renderFabricSurface<Props: Object>(
// to be async also. To do this, wrap AppContainer with an async marker.
// For more info see https://fb.me/is-component-async
if (
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
RootComponent.prototype != null &&
RootComponent.prototype.unstable_isAsyncReactComponent === true
) {
Expand Down
3 changes: 3 additions & 0 deletions Libraries/ReactNative/requireFabricComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ function requireNativeComponent(
// TODO (bvaughn) Revert this particular change any time after April 1
if (componentInterface) {
viewConfig.propTypes =
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete
* this comment and run Flow. */
typeof componentInterface.__propTypesSecretDontUseThesePlease ===
'object'
? componentInterface.__propTypesSecretDontUseThesePlease
Expand Down
3 changes: 3 additions & 0 deletions Libraries/ReactNative/requireNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ function requireNativeComponent(
// TODO (bvaughn) Revert this particular change any time after April 1
if (componentInterface) {
viewConfig.propTypes =
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete
* this comment and run Flow. */
typeof componentInterface.__propTypesSecretDontUseThesePlease ===
'object'
? componentInterface.__propTypesSecretDontUseThesePlease
Expand Down
3 changes: 3 additions & 0 deletions Libraries/WebSocket/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) {
const {headers = {}, ...unrecognized} = options || {};

// Preserve deprecated backwards compatibility for the 'origin' option
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (unrecognized && typeof unrecognized.origin === 'string') {
console.warn('Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.');
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This
Expand Down
3 changes: 3 additions & 0 deletions RNTester/js/CameraRollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ var CameraRollView = createReactClass({
this.fetch();
},

/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
UNSAFE_componentWillReceiveProps: function(nextProps: {groupTypes?: string}) {
if (this.props.groupTypes !== nextProps.groupTypes) {
this.fetch(true);
Expand Down
9 changes: 9 additions & 0 deletions RNTester/js/RNTesterExampleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class RNTesterExampleList extends React.Component<Props, $FlowFixMeState> {
const filterText = this.props.persister.state.filter;
const filterRegex = new RegExp(String(filterText), 'i');
const filter = (example) =>
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
this.props.disableSearch ||
filterRegex.test(example.module.title) &&
(!Platform.isTVOS || example.supportsTVOS);
Expand Down Expand Up @@ -128,6 +131,9 @@ class RNTesterExampleList extends React.Component<Props, $FlowFixMeState> {
);

_renderTitleRow(): ?React.Element<any> {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (!this.props.displayTitleRow) {
return null;
}
Expand All @@ -146,6 +152,9 @@ class RNTesterExampleList extends React.Component<Props, $FlowFixMeState> {
}

_renderTextInput(): ?React.Element<any> {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
if (this.props.disableSearch) {
return null;
}
Expand Down
3 changes: 3 additions & 0 deletions RNTester/js/RNTesterPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class RNTesterPage extends React.Component<{
wrapperProps.keyboardShouldPersistTaps = 'handled';
wrapperProps.keyboardDismissMode = 'interactive';
}
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
var title = this.props.title ?
<RNTesterTitle title={this.props.title} /> :
null;
Expand Down
15 changes: 15 additions & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ function runServer(
var ms = null;

const terminal = new Terminal(process.stdout);
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
const ReporterImpl = getReporterImpl(args.customLogReporterPath || null);
const reporter = new ReporterImpl(terminal);
const packagerServer = getPackagerServer(args, config, reporter);
Expand Down Expand Up @@ -105,10 +108,16 @@ function runServer(

app.use(morgan('combined')).use(errorhandler());

/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
if (args.https && (!args.key || !args.cert)) {
throw new Error('Cannot use https without specifying key and cert options');
}

/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
const serverInstance = args.https
? https.createServer(
{
Expand Down Expand Up @@ -157,11 +166,17 @@ function getReporterImpl(customLogReporterPath: ?string) {
}

function getPackagerServer(args, config, reporter) {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.68 was deployed. To see the error delete this comment
* and run Flow. */
const transformModulePath = args.transformer
? path.resolve(args.transformer)
: config.getTransformModulePath();

const providesModuleNodeModules =
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
args.providesModuleNodeModules || defaultProvidesModuleNodeModules;

return Metro.createServer({
Expand Down
2 changes: 1 addition & 1 deletion local-cli/templates/HelloWorld/_flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.67.0
^0.68.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"eslint-plugin-jest": "21.8.0",
"eslint-plugin-prettier": "2.6.0",
"eslint-plugin-react": "7.6.1",
"flow-bin": "^0.67.1",
"flow-bin": "^0.68.0",
"jest": "22.4.2",
"jest-junit": "3.6.0",
"prettier": "1.9.1",
Expand Down

0 comments on commit 0d924dd

Please sign in to comment.