@samitouri / QOS-React-2 / commits / 9bfa45bd2d

Update Flow and fix issues (#8006)

Dan Abramov committed Oct 18, 2016 at 15:26 UTC 9bfa45bd2db57ccfd086cc0faa843d51e8489858
9 files changed +25 -22
.flowconfig
+4 -4
@@ -13,7 +13,7 @@
13 [include]
14
15 [libs]
16 -./node_modules/fbjs/flow/lib
16 +./node_modules/fbjs/flow/lib/dev.js
17 ./flow
18
19 [options]
@@ -29,10 +29,10 @@ suppress_type=$FlowFixMe
29 suppress_type=$FixMe
30 suppress_type=$FlowExpectedError
31
32 -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
33 -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
32 +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
33 +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
34 suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
35 suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
36
37 [version]
38 -^0.31.0
38 +^0.33.0
package.json
+2 -2
@@ -43,9 +43,9 @@
43 "eslint": "1.10.3",
44 "eslint-plugin-react": "4.1.0",
45 "eslint-plugin-react-internal": "file:eslint-rules",
46 - "fbjs": "^0.8.4",
46 + "fbjs": "^0.8.5",
47 "fbjs-scripts": "^0.6.0",
48 - "flow-bin": "^0.31.0",
48 + "flow-bin": "^0.33.0",
49 "glob": "^6.0.1",
50 "grunt": "^0.4.5",
51 "grunt-cli": "^0.1.13",
src/renderers/dom/fiber/ReactDOMFiber.js
+6 -4
@@ -54,9 +54,10 @@ var DOMRenderer = ReactFiberReconciler({
54 createInstance(type : string, props : Props, children : HostChildren<Instance | TextInstance>) : Instance {
55 const domElement = document.createElement(type);
56 recursivelyAppendChildren(domElement, children);
57 - if (typeof props.children === 'string' ||
58 - typeof props.children === 'number') {
57 + if (typeof props.children === 'string') {
58 domElement.textContent = props.children;
59 + } else if (typeof props.children === 'number') {
60 + domElement.textContent = props.children.toString();
61 }
62 return domElement;
63 },
@@ -70,9 +71,10 @@ var DOMRenderer = ReactFiberReconciler({
71 },
72
73 commitUpdate(domElement : Instance, oldProps : Props, newProps : Props) : void {
73 - if (typeof newProps.children === 'string' ||
74 - typeof newProps.children === 'number') {
74 + if (typeof newProps.children === 'string') {
75 domElement.textContent = newProps.children;
76 + } else if (typeof newProps.children === 'number') {
77 + domElement.textContent = newProps.children.toString();
78 }
79 },
80
src/renderers/native/NativeMethodsMixin.js
+1 -1
@@ -212,7 +212,7 @@ function mountSafeCallback(
212 callback: ?Function
213 ): any {
214 return function() {
215 - if (!callback || (context.isMounted && !context.isMounted())) {
215 + if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) {
216 return undefined;
217 }
218 return callback.apply(context, arguments);
src/renderers/shared/ReactDebugTool.js
-1
@@ -239,7 +239,6 @@ function resumeCurrentLifeCycleTimer() {
239
240 var lastMarkTimeStamp = 0;
241 var canUsePerformanceMeasure: boolean =
242 -// $FlowFixMe https://github.com/facebook/flow/issues/2345
242 typeof performance !== 'undefined' &&
243 typeof performance.mark === 'function' &&
244 typeof performance.clearMarks === 'function' &&
src/renderers/shared/fiber/ReactFiberBeginWork.js
+1 -1
@@ -369,7 +369,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>, s
369 // next one immediately.
370 return workInProgress.child;
371 case HostComponent:
372 - if (workInProgress.stateNode && config.beginUpdate) {
372 + if (workInProgress.stateNode && typeof config.beginUpdate === 'function') {
373 config.beginUpdate(workInProgress.stateNode);
374 }
375 return updateHostComponent(current, workInProgress);
src/renderers/shared/stack/reconciler/ReactInstanceType.js
+10 -5
@@ -12,22 +12,27 @@
12
13 'use strict';
14
15 +import type {ReactElement} from 'ReactElementType';
16 +
17 export type DebugID = number;
18
19 export type ReactInstance = {
18 - // ReactCompositeComponent
20 + // Shared
21 mountComponent: any,
22 + unmountComponent: any,
23 + receiveComponent: any,
24 + getName: () => string,
25 + getPublicInstance: any,
26 + _currentElement: ReactElement,
27 +
28 + // ReactCompositeComponent
29 performInitialMountWithErrorHandling: any,
30 performInitialMount: any,
31 getHostNode: any,
23 - unmountComponent: any,
24 - receiveComponent: any,
32 performUpdateIfNecessary: any,
33 updateComponent: any,
34 attachRef: (ref: string, component: ReactInstance) => void,
35 detachRef: (ref: string) => void,
29 - getName: () => string,
30 - getPublicInstance: any,
36 _rootNodeID: number,
37
38 // ReactDOMComponent
src/renderers/shared/utils/ReactErrorUtils.js
-1
@@ -77,7 +77,6 @@ if (__DEV__) {
77 var evtType = `react-${name}`;
78 fakeNode.addEventListener(evtType, boundFunc, false);
79 var evt = document.createEvent('Event');
80 - // $FlowFixMe https://github.com/facebook/flow/issues/2336
80 evt.initEvent(evtType, false, false);
81 fakeNode.dispatchEvent(evt);
82 fakeNode.removeEventListener(evtType, boundFunc, false);
src/renderers/testing/ReactTestMount.js
+1 -3
@@ -20,10 +20,8 @@ var getHostComponentFromComposite = require('getHostComponentFromComposite');
20 var instantiateReactComponent = require('instantiateReactComponent');
21 var invariant = require('invariant');
22
23 -import type { ReactElement } from 'ReactElementType';
24 -
23 export type TestRendererOptions = {
26 - createNodeMock: (element: ReactElement) => any,
24 + createNodeMock: (element: ReactElement<any>) => any,
25 };
26
27 var defaultTestOptions = {