mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Update Flow and fix issues (#8006)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
./node_modules/fbjs/flow/lib
|
||||
./node_modules/fbjs/flow/lib/dev.js
|
||||
./flow
|
||||
|
||||
[options]
|
||||
@@ -29,10 +29,10 @@ suppress_type=$FlowFixMe
|
||||
suppress_type=$FixMe
|
||||
suppress_type=$FlowExpectedError
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
[version]
|
||||
^0.31.0
|
||||
^0.33.0
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
"eslint": "1.10.3",
|
||||
"eslint-plugin-react": "4.1.0",
|
||||
"eslint-plugin-react-internal": "file:eslint-rules",
|
||||
"fbjs": "^0.8.4",
|
||||
"fbjs": "^0.8.5",
|
||||
"fbjs-scripts": "^0.6.0",
|
||||
"flow-bin": "^0.31.0",
|
||||
"flow-bin": "^0.33.0",
|
||||
"glob": "^6.0.1",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^0.1.13",
|
||||
|
||||
@@ -54,9 +54,10 @@ var DOMRenderer = ReactFiberReconciler({
|
||||
createInstance(type : string, props : Props, children : HostChildren<Instance | TextInstance>) : Instance {
|
||||
const domElement = document.createElement(type);
|
||||
recursivelyAppendChildren(domElement, children);
|
||||
if (typeof props.children === 'string' ||
|
||||
typeof props.children === 'number') {
|
||||
if (typeof props.children === 'string') {
|
||||
domElement.textContent = props.children;
|
||||
} else if (typeof props.children === 'number') {
|
||||
domElement.textContent = props.children.toString();
|
||||
}
|
||||
return domElement;
|
||||
},
|
||||
@@ -70,9 +71,10 @@ var DOMRenderer = ReactFiberReconciler({
|
||||
},
|
||||
|
||||
commitUpdate(domElement : Instance, oldProps : Props, newProps : Props) : void {
|
||||
if (typeof newProps.children === 'string' ||
|
||||
typeof newProps.children === 'number') {
|
||||
if (typeof newProps.children === 'string') {
|
||||
domElement.textContent = newProps.children;
|
||||
} else if (typeof newProps.children === 'number') {
|
||||
domElement.textContent = newProps.children.toString();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ function mountSafeCallback(
|
||||
callback: ?Function
|
||||
): any {
|
||||
return function() {
|
||||
if (!callback || (context.isMounted && !context.isMounted())) {
|
||||
if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) {
|
||||
return undefined;
|
||||
}
|
||||
return callback.apply(context, arguments);
|
||||
|
||||
@@ -239,7 +239,6 @@ function resumeCurrentLifeCycleTimer() {
|
||||
|
||||
var lastMarkTimeStamp = 0;
|
||||
var canUsePerformanceMeasure: boolean =
|
||||
// $FlowFixMe https://github.com/facebook/flow/issues/2345
|
||||
typeof performance !== 'undefined' &&
|
||||
typeof performance.mark === 'function' &&
|
||||
typeof performance.clearMarks === 'function' &&
|
||||
|
||||
@@ -369,7 +369,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>, s
|
||||
// next one immediately.
|
||||
return workInProgress.child;
|
||||
case HostComponent:
|
||||
if (workInProgress.stateNode && config.beginUpdate) {
|
||||
if (workInProgress.stateNode && typeof config.beginUpdate === 'function') {
|
||||
config.beginUpdate(workInProgress.stateNode);
|
||||
}
|
||||
return updateHostComponent(current, workInProgress);
|
||||
|
||||
@@ -12,22 +12,27 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ReactElement} from 'ReactElementType';
|
||||
|
||||
export type DebugID = number;
|
||||
|
||||
export type ReactInstance = {
|
||||
// ReactCompositeComponent
|
||||
// Shared
|
||||
mountComponent: any,
|
||||
unmountComponent: any,
|
||||
receiveComponent: any,
|
||||
getName: () => string,
|
||||
getPublicInstance: any,
|
||||
_currentElement: ReactElement,
|
||||
|
||||
// ReactCompositeComponent
|
||||
performInitialMountWithErrorHandling: any,
|
||||
performInitialMount: any,
|
||||
getHostNode: any,
|
||||
unmountComponent: any,
|
||||
receiveComponent: any,
|
||||
performUpdateIfNecessary: any,
|
||||
updateComponent: any,
|
||||
attachRef: (ref: string, component: ReactInstance) => void,
|
||||
detachRef: (ref: string) => void,
|
||||
getName: () => string,
|
||||
getPublicInstance: any,
|
||||
_rootNodeID: number,
|
||||
|
||||
// ReactDOMComponent
|
||||
|
||||
@@ -77,7 +77,6 @@ if (__DEV__) {
|
||||
var evtType = `react-${name}`;
|
||||
fakeNode.addEventListener(evtType, boundFunc, false);
|
||||
var evt = document.createEvent('Event');
|
||||
// $FlowFixMe https://github.com/facebook/flow/issues/2336
|
||||
evt.initEvent(evtType, false, false);
|
||||
fakeNode.dispatchEvent(evt);
|
||||
fakeNode.removeEventListener(evtType, boundFunc, false);
|
||||
|
||||
@@ -20,10 +20,8 @@ var getHostComponentFromComposite = require('getHostComponentFromComposite');
|
||||
var instantiateReactComponent = require('instantiateReactComponent');
|
||||
var invariant = require('invariant');
|
||||
|
||||
import type { ReactElement } from 'ReactElementType';
|
||||
|
||||
export type TestRendererOptions = {
|
||||
createNodeMock: (element: ReactElement) => any,
|
||||
createNodeMock: (element: ReactElement<any>) => any,
|
||||
};
|
||||
|
||||
var defaultTestOptions = {
|
||||
|
||||
Reference in New Issue
Block a user