Skip to content

Commit

Permalink
Update flow to 0.148
Browse files Browse the repository at this point in the history
Close #1980
  • Loading branch information
comp615 authored and necolas committed Apr 20, 2021
1 parent c67b695 commit 84fd278
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"react": {
"pragma": "React",
"version": "16.6",
"flowVersion": "0.142.0" // Flow version
"flowVersion": "0.148.0" // Flow version
}
},
// babel parser to support ES6/7 features
Expand Down
9 changes: 1 addition & 8 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[version]
^0.142.0
^0.148.0

[ignore]
<PROJECT_ROOT>/.*/__tests__/.*
Expand All @@ -15,10 +15,3 @@

[options]
munge_underscores=true
types_first=false
well_formed_exports=false
esproposal.optional_chaining=enable
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"flow-bin": "^0.142.0",
"flow-bin": "^0.148.0",
"glob": "^7.1.6",
"husky": "^4.3.8",
"inline-style-prefixer": "^6.0.0",
Expand Down
14 changes: 10 additions & 4 deletions packages/benchmarks/src/app/Benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/* global $Values */

import type { Node } from 'react';

import * as Timing from './timing';
import React, { Component } from 'react';
import { getMean, getMedian, getStdDev } from './math';
Expand Down Expand Up @@ -94,15 +96,19 @@ export default class Benchmark extends Component<BenchmarkPropsType, BenchmarkSt
_startTime: number;
_samples: Array<SampleTimingType>;

static displayName = 'Benchmark';
static displayName: ?string = 'Benchmark';

static defaultProps = {
static defaultProps: {|
sampleCount: number,
timeout: number,
type: $PropertyType<BenchmarkPropsType, 'type'>
|} = {
sampleCount: 50,
timeout: 10000, // 10 seconds
type: BenchmarkType.MOUNT
};

static Type = BenchmarkType;
static Type: typeof BenchmarkType = BenchmarkType;

constructor(props: BenchmarkPropsType, context?: {}) {
super(props, context);
Expand Down Expand Up @@ -162,7 +168,7 @@ export default class Benchmark extends Component<BenchmarkPropsType, BenchmarkSt
}
}

render() {
render(): Node {
const { component: Component, type } = this.props;
const { componentProps, cycle, running } = this.state;
if (running && shouldRecord(cycle, type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BoundingDimensions.prototype.destructor = function () {
this.height = null;
};

BoundingDimensions.getPooledFromElement = function (element): any {
BoundingDimensions.getPooledFromElement = function (element: HTMLElement): any {
return BoundingDimensions.getPooled(element.offsetWidth, element.offsetHeight);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export default function useWindowDimensions(): DisplayMetrics {
const [dims, setDims] = useState(() => Dimensions.get('window'));
useEffect(() => {
function handleChange({ window }) {
// $FlowFixMe
setDims(window);
if (window != null) {
setDims(window);
}
}
Dimensions.addEventListener('change', handleChange);
// We might have missed an update between calling `get` in render and
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/modules/useEvent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ export default function useEvent(
};
}, [addListener]);

// $FlowFixMe
return addListener;
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5321,10 +5321,10 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==

flow-bin@^0.142.0:
version "0.142.0"
resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.142.0.tgz#b46b69de1123cf7c5a50917402968e07291df054"
integrity sha512-YgiapK/wrJjcgSgOWfoncbZ4vZrZWdHs+p7V9duI9zo4ehW2nM/VRrpSaWoZ+CWu3t+duGyAvupJvC6MM2l07w==
flow-bin@^0.148.0:
version "0.148.0"
resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.148.0.tgz#1d264606dbb4d6e6070cc98a775e21dcd64e6890"
integrity sha512-7Cx6BUm8UAlbqtYJNYXdMrh900MQhNV+SjtBxZuWN7UmlVG4tIRNzNLEOjNnj2DN2vcL1wfI5IlSUXnws/QCEw==

follow-redirects@^1.0.0, follow-redirects@^1.10.0:
version "1.13.1"
Expand Down

0 comments on commit 84fd278

Please sign in to comment.