From 678a7f3c39e495db602e90e994894051eb7aab10 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 4 Oct 2017 10:06:57 -0700 Subject: [PATCH] React sync for revisions b5ac963...5f93ee6f6 Reviewed By: gaearon Differential Revision: D5950896 fbshipit-source-id: 74aebcee8a64e8552b170223adf59ed4ed905a74 --- Libraries/Renderer/REVISION | 2 +- Libraries/Renderer/ReactNativeFiber-dev.js | 616 +++--------------- Libraries/Renderer/ReactNativeFiber-prod.js | 125 +--- .../Renderer/shims/NativeMethodsMixin.js | 8 +- Libraries/Renderer/shims/PooledClass.js | 8 +- Libraries/Renderer/shims/ReactDebugTool.js | 8 +- .../Renderer/shims/ReactGlobalSharedState.js | 8 +- Libraries/Renderer/shims/ReactNative.js | 6 +- .../shims/ReactNativeBridgeEventPlugin.js | 8 +- .../shims/ReactNativeComponentTree.js | 8 +- .../Renderer/shims/ReactNativePropRegistry.js | 8 +- Libraries/Renderer/shims/ReactNativeTypes.js | 6 +- Libraries/Renderer/shims/ReactPerf.js | 8 +- Libraries/Renderer/shims/ReactTypes.js | 8 +- Libraries/Renderer/shims/TouchHistoryMath.js | 8 +- .../shims/createReactNativeComponentClass.js | 8 +- Libraries/Renderer/shims/takeSnapshot.js | 8 +- package.json | 6 +- 18 files changed, 147 insertions(+), 710 deletions(-) diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index 87eaec8c7..1caaa5f39 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -b5ac963fb791d1298e7f396236383bc955f916c1 \ No newline at end of file +589c0a25dfa18c2090549cc6f5b626d69ea53c2a \ No newline at end of file diff --git a/Libraries/Renderer/ReactNativeFiber-dev.js b/Libraries/Renderer/ReactNativeFiber-dev.js index 17218a4a8..7de81ef95 100644 --- a/Libraries/Renderer/ReactNativeFiber-dev.js +++ b/Libraries/Renderer/ReactNativeFiber-dev.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @noflow * @providesModule ReactNativeFiber-dev @@ -14,7 +12,7 @@ __DEV__ && function() { var invariant = require("fbjs/lib/invariant"), require$$0 = require("fbjs/lib/warning"), ExceptionsManager = require("ExceptionsManager"), emptyObject = require("fbjs/lib/emptyObject"), react = require("react"), checkPropTypes = require("prop-types/checkPropTypes"), shallowEqual = require("fbjs/lib/shallowEqual"), deepDiffer = require("deepDiffer"), flattenStyle = require("flattenStyle"), TextInputState = require("TextInputState"), UIManager = require("UIManager"), deepFreezeAndThrowOnMutationInDev = require("deepFreezeAndThrowOnMutationInDev"); require("InitializeCore"); - var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment"), performanceNow = require("fbjs/lib/performanceNow"), defaultShowDialog = function(capturedError) { + var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), defaultShowDialog = function(capturedError) { return !0; }, showDialog = defaultShowDialog; function logCapturedError(capturedError) { @@ -181,13 +179,9 @@ __DEV__ && function() { function restoreStateOfTarget(target) { var internalInstance = EventPluginUtils_1.getInstanceFromNode(target); if (internalInstance) { - if ("number" == typeof internalInstance.tag) { - invariant(fiberHostComponent && "function" == typeof fiberHostComponent.restoreControlledState, "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue."); - var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode); - return void fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); - } - invariant("function" == typeof internalInstance.restoreControlledState, "The internal instance must be a React host component. " + "This error is likely caused by a bug in React. Please file an issue."), - internalInstance.restoreControlledState(); + invariant(fiberHostComponent && "function" == typeof fiberHostComponent.restoreControlledState, "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue."); + var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode); + fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); } } var ReactControlledComponent = { @@ -201,16 +195,11 @@ __DEV__ && function() { if (restoreTarget = null, restoreQueue = null, restoreStateOfTarget(target), queuedTargets) for (var i = 0; i < queuedTargets.length; i++) restoreStateOfTarget(queuedTargets[i]); } } - }, ReactControlledComponent_1 = ReactControlledComponent, stackBatchedUpdates = function(fn, a, b, c, d, e) { - return fn(a, b, c, d, e); - }, fiberBatchedUpdates = function(fn, bookkeeping) { + }, ReactControlledComponent_1 = ReactControlledComponent, fiberBatchedUpdates = function(fn, bookkeeping) { return fn(bookkeeping); }; - function performFiberBatchedUpdates(fn, bookkeeping) { - return fiberBatchedUpdates(fn, bookkeeping); - } function batchedUpdates(fn, bookkeeping) { - return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping); + return fiberBatchedUpdates(fn, bookkeeping); } var isNestingBatched = !1; function batchedUpdatesWithControlledComponents(fn, bookkeeping) { @@ -223,9 +212,6 @@ __DEV__ && function() { } } var ReactGenericBatchingInjection = { - injectStackBatchedUpdates: function(_batchedUpdates) { - stackBatchedUpdates = _batchedUpdates; - }, injectFiberBatchedUpdates: function(_batchedUpdates) { fiberBatchedUpdates = _batchedUpdates; } @@ -262,21 +248,9 @@ __DEV__ && function() { isPortal: isPortal, REACT_PORTAL_TYPE: REACT_PORTAL_TYPE_1 }, instanceCache = {}, instanceProps = {}; - function getRenderedHostOrTextFromComponent(component) { - for (var rendered; rendered = component._renderedComponent; ) component = rendered; - return component; - } - function precacheNode(inst, tag) { - var nativeInst = getRenderedHostOrTextFromComponent(inst); - instanceCache[tag] = nativeInst; - } function precacheFiberNode(hostInst, tag) { instanceCache[tag] = hostInst; } - function uncacheNode(inst) { - var tag = inst._rootNodeID; - tag && delete instanceCache[tag]; - } function uncacheFiberNode(tag) { delete instanceCache[tag], delete instanceProps[tag]; } @@ -298,9 +272,7 @@ __DEV__ && function() { getInstanceFromNode: getInstanceFromTag, getNodeFromInstance: getTagFromInstance, precacheFiberNode: precacheFiberNode, - precacheNode: precacheNode, uncacheFiberNode: uncacheFiberNode, - uncacheNode: uncacheNode, getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode, updateFiberProps: updateFiberProps }, ReactNativeComponentTree_1 = ReactNativeComponentTree, commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, ReactFeatureFlags = { @@ -500,16 +472,9 @@ __DEV__ && function() { beginUpdateQueue: beginUpdateQueue_1, commitCallbacks: commitCallbacks_1 }; - function getComponentName$1(instanceOrFiber) { - if ("function" == typeof instanceOrFiber.getName) { - return instanceOrFiber.getName(); - } - if ("number" == typeof instanceOrFiber.tag) { - var fiber = instanceOrFiber, type = fiber.type; - if ("string" == typeof type) return type; - if ("function" == typeof type) return type.displayName || type.name; - } - return null; + function getComponentName$1(fiber) { + var type = fiber.type; + return "string" == typeof type ? type : "function" == typeof type ? type.displayName || type.name : null; } var getComponentName_1 = getComponentName$1, ReactInstanceMap = { remove: function(key) { @@ -528,7 +493,6 @@ __DEV__ && function() { ReactCurrentOwner: ReactInternals.ReactCurrentOwner }; Object.assign(ReactGlobalSharedState, { - ReactComponentTreeHook: ReactInternals.ReactComponentTreeHook, ReactDebugCurrentFrame: ReactInternals.ReactDebugCurrentFrame }); var ReactGlobalSharedState_1 = ReactGlobalSharedState, ReactCurrentOwner = ReactGlobalSharedState_1.ReactCurrentOwner, warning$4 = require$$0, ClassComponent$2 = ReactTypeOfWork.ClassComponent, HostComponent$1 = ReactTypeOfWork.HostComponent, HostRoot$2 = ReactTypeOfWork.HostRoot, HostPortal = ReactTypeOfWork.HostPortal, HostText = ReactTypeOfWork.HostText, NoEffect = ReactTypeOfSideEffect.NoEffect, Placement = ReactTypeOfSideEffect.Placement, MOUNTING = 1, MOUNTED = 2, UNMOUNTED = 3; @@ -689,7 +653,9 @@ __DEV__ && function() { }, ReactDebugCurrentFrame = ReactGlobalSharedState_1.ReactDebugCurrentFrame, getComponentName$3 = getComponentName_1, _require2$1 = ReactFiberComponentTreeHook, getStackAddendumByWorkInProgressFiber = _require2$1.getStackAddendumByWorkInProgressFiber; function getCurrentFiberOwnerName() { var fiber = ReactDebugCurrentFiber$2.current; - return null === fiber ? null : null != fiber._debugOwner ? getComponentName$3(fiber._debugOwner) : null; + if (null === fiber) return null; + var owner = fiber._debugOwner; + return null !== owner && void 0 !== owner ? getComponentName$3(owner) : null; } function getCurrentFiberStackAddendum() { var fiber = ReactDebugCurrentFiber$2.current; @@ -699,8 +665,11 @@ __DEV__ && function() { ReactDebugCurrentFrame.getCurrentStack = null, ReactDebugCurrentFiber$2.current = null, ReactDebugCurrentFiber$2.phase = null; } - function setCurrentFiber(fiber, phase) { + function setCurrentFiber(fiber) { ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum, ReactDebugCurrentFiber$2.current = fiber, + ReactDebugCurrentFiber$2.phase = null; + } + function setCurrentPhase(phase) { ReactDebugCurrentFiber$2.phase = phase; } var ReactDebugCurrentFiber$2 = { @@ -708,6 +677,7 @@ __DEV__ && function() { phase: null, resetCurrentFiber: resetCurrentFiber, setCurrentFiber: setCurrentFiber, + setCurrentPhase: setCurrentPhase, getCurrentFiberOwnerName: getCurrentFiberOwnerName, getCurrentFiberStackAddendum: getCurrentFiberStackAddendum }, ReactDebugCurrentFiber_1 = ReactDebugCurrentFiber$2, ReactDebugFiberPerf = null, _require$2 = ReactTypeOfWork, HostRoot$3 = _require$2.HostRoot, HostComponent$3 = _require$2.HostComponent, HostText$1 = _require$2.HostText, HostPortal$1 = _require$2.HostPortal, YieldComponent = _require$2.YieldComponent, Fragment = _require$2.Fragment, getComponentName$4 = getComponentName_1, reactEmoji = "⚛", warningEmoji = "⛔", supportsUserTiming = "undefined" != typeof performance && "function" == typeof performance.mark && "function" == typeof performance.clearMarks && "function" == typeof performance.measure && "function" == typeof performance.clearMeasures, currentFiber = null, currentPhase = null, currentPhaseFiber = null, isCommitting = !1, hasScheduledUpdateInCurrentCommit = !1, hasScheduledUpdateInCurrentPhase = !1, commitCountInCurrentWorkLoop = 0, effectCountInCurrentCommit = 0, labelsInCurrentCommit = new Set(), formatMarkName = function(markName) { @@ -859,9 +829,8 @@ __DEV__ && function() { var context = {}; for (var key in contextTypes) context[key] = unmaskedContext[key]; var name = getComponentName_1(workInProgress) || "Unknown"; - return ReactDebugCurrentFiber$1.setCurrentFiber(workInProgress, null), checkPropTypes$1(contextTypes, context, "context", name, ReactDebugCurrentFiber$1.getCurrentFiberStackAddendum), - ReactDebugCurrentFiber$1.resetCurrentFiber(), instance && cacheContext(workInProgress, unmaskedContext, context), - context; + return checkPropTypes$1(contextTypes, context, "context", name, ReactDebugCurrentFiber$1.getCurrentFiberStackAddendum), + instance && cacheContext(workInProgress, unmaskedContext, context), context; }, hasContextChanged = function() { return didPerformWorkStackCursor.current; }; @@ -882,7 +851,7 @@ __DEV__ && function() { invariant(null == contextStackCursor.cursor, "Unexpected context found on stack. " + "This error is likely caused by a bug in React. Please file an issue."), push(contextStackCursor, context, fiber), push(didPerformWorkStackCursor, didChange, fiber); }; - function processChildContext$1(fiber, parentContext, isReconciling) { + function processChildContext$1(fiber, parentContext) { var instance = fiber.stateNode, childContextTypes = fiber.type.childContextTypes; if ("function" != typeof instance.getChildContext) { var componentName = getComponentName_1(fiber) || "Unknown"; @@ -891,12 +860,12 @@ __DEV__ && function() { parentContext; } var childContext = void 0; - ReactDebugCurrentFiber$1.setCurrentFiber(fiber, "getChildContext"), startPhaseTimer(fiber, "getChildContext"), - childContext = instance.getChildContext(), stopPhaseTimer(), ReactDebugCurrentFiber$1.resetCurrentFiber(); + ReactDebugCurrentFiber$1.setCurrentPhase("getChildContext"), startPhaseTimer(fiber, "getChildContext"), + childContext = instance.getChildContext(), stopPhaseTimer(), ReactDebugCurrentFiber$1.setCurrentPhase(null); for (var contextKey in childContext) invariant(contextKey in childContextTypes, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName_1(fiber) || "Unknown", contextKey); - var name = getComponentName_1(fiber) || "Unknown", workInProgress = isReconciling ? fiber : null; - return ReactDebugCurrentFiber$1.setCurrentFiber(workInProgress, null), checkPropTypes$1(childContextTypes, childContext, "child context", name, ReactDebugCurrentFiber$1.getCurrentFiberStackAddendum), - ReactDebugCurrentFiber$1.resetCurrentFiber(), Object.assign({}, parentContext, childContext); + var name = getComponentName_1(fiber) || "Unknown"; + return checkPropTypes$1(childContextTypes, childContext, "child context", name, ReactDebugCurrentFiber$1.getCurrentFiberStackAddendum), + Object.assign({}, parentContext, childContext); } var processChildContext_1 = processChildContext$1, pushContextProvider = function(workInProgress) { if (!isContextProvider$1(workInProgress)) return !1; @@ -908,7 +877,7 @@ __DEV__ && function() { var instance = workInProgress.stateNode; if (invariant(instance, "Expected to have an instance by this point. " + "This error is likely caused by a bug in React. Please file an issue."), didChange) { - var mergedContext = processChildContext$1(workInProgress, previousContext, !0); + var mergedContext = processChildContext$1(workInProgress, previousContext); instance.__reactInternalMemoizedMergedChildContext = mergedContext, pop(didPerformWorkStackCursor, workInProgress), pop(contextStackCursor, workInProgress), push(contextStackCursor, mergedContext, workInProgress), push(didPerformWorkStackCursor, didChange, workInProgress); @@ -1098,11 +1067,11 @@ __DEV__ && function() { if (null !== mixedRef && "function" != typeof mixedRef) { if (element._owner) { var owner = element._owner, inst = void 0; - if (owner) if ("number" == typeof owner.tag) { + if (owner) { var ownerFiber = owner; invariant(ownerFiber.tag === ClassComponent$7, "Stateless function components cannot have refs."), inst = ownerFiber.stateNode; - } else inst = owner.getPublicInstance(); + } invariant(inst, "Missing owner for string ref %s. This error is likely caused by a " + "bug in React. Please file an issue.", mixedRef); var stringRef = "" + mixedRef; if (null !== current && null !== current.ref && current.ref._stringRef === stringRef) return current.ref; @@ -1678,8 +1647,8 @@ __DEV__ && function() { var fn = workInProgress.type, nextProps = workInProgress.pendingProps, memoizedProps = workInProgress.memoizedProps; if (hasContextChanged$1()) null === nextProps && (nextProps = memoizedProps); else if (null === nextProps || memoizedProps === nextProps) return bailoutOnAlreadyFinishedWork(current, workInProgress); var nextChildren, unmaskedContext = getUnmaskedContext$1(workInProgress), context = getMaskedContext$1(workInProgress, unmaskedContext); - return ReactCurrentOwner$2.current = workInProgress, ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, "render"), - nextChildren = fn(nextProps, context), ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, null), + return ReactCurrentOwner$2.current = workInProgress, ReactDebugCurrentFiber$4.setCurrentPhase("render"), + nextChildren = fn(nextProps, context), ReactDebugCurrentFiber$4.setCurrentPhase(null), workInProgress.effectTag |= PerformedWork$1, reconcileChildren(current, workInProgress, nextChildren), memoizeProps(workInProgress, nextProps), workInProgress.child; } @@ -1695,8 +1664,8 @@ __DEV__ && function() { var instance = workInProgress.stateNode; ReactCurrentOwner$2.current = workInProgress; var nextChildren = void 0; - return ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, "render"), nextChildren = instance.render(), - ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, null), workInProgress.effectTag |= PerformedWork$1, + return ReactDebugCurrentFiber$4.setCurrentPhase("render"), nextChildren = instance.render(), + ReactDebugCurrentFiber$4.setCurrentPhase(null), workInProgress.effectTag |= PerformedWork$1, reconcileChildren(current, workInProgress, nextChildren), memoizeState(workInProgress, instance.state), memoizeProps(workInProgress, instance.props), hasContext && invalidateContextProvider$1(workInProgress, !0), workInProgress.child; @@ -1806,7 +1775,7 @@ __DEV__ && function() { } function beginWork(current, workInProgress, priorityLevel) { if (workInProgress.pendingWorkPriority === NoWork$3 || workInProgress.pendingWorkPriority > priorityLevel) return bailoutOnLowPriority(current, workInProgress); - switch (ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, null), workInProgress.tag) { + switch (workInProgress.tag) { case IndeterminateComponent$2: return mountIndeterminateComponent(current, workInProgress, priorityLevel); @@ -1870,7 +1839,7 @@ __DEV__ && function() { beginWork: beginWork, beginFailedWork: beginFailedWork }; - }, reconcileChildFibers$2 = ReactChildFiber.reconcileChildFibers, popContextProvider$2 = ReactFiberContext.popContextProvider, popTopLevelContextObject$1 = ReactFiberContext.popTopLevelContextObject, IndeterminateComponent$3 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$3 = ReactTypeOfWork.FunctionalComponent, ClassComponent$8 = ReactTypeOfWork.ClassComponent, HostRoot$7 = ReactTypeOfWork.HostRoot, HostComponent$7 = ReactTypeOfWork.HostComponent, HostText$5 = ReactTypeOfWork.HostText, HostPortal$6 = ReactTypeOfWork.HostPortal, CoroutineComponent$3 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase$1 = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$4 = ReactTypeOfWork.YieldComponent, Fragment$4 = ReactTypeOfWork.Fragment, Placement$4 = ReactTypeOfSideEffect.Placement, Ref$2 = ReactTypeOfSideEffect.Ref, Update$2 = ReactTypeOfSideEffect.Update, OffscreenPriority$2 = ReactPriorityLevel.OffscreenPriority, ReactDebugCurrentFiber$5 = ReactDebugCurrentFiber_1, ReactFiberCompleteWork = function(config, hostContext, hydrationContext) { + }, reconcileChildFibers$2 = ReactChildFiber.reconcileChildFibers, popContextProvider$2 = ReactFiberContext.popContextProvider, popTopLevelContextObject$1 = ReactFiberContext.popTopLevelContextObject, IndeterminateComponent$3 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$3 = ReactTypeOfWork.FunctionalComponent, ClassComponent$8 = ReactTypeOfWork.ClassComponent, HostRoot$7 = ReactTypeOfWork.HostRoot, HostComponent$7 = ReactTypeOfWork.HostComponent, HostText$5 = ReactTypeOfWork.HostText, HostPortal$6 = ReactTypeOfWork.HostPortal, CoroutineComponent$3 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase$1 = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$4 = ReactTypeOfWork.YieldComponent, Fragment$4 = ReactTypeOfWork.Fragment, Placement$4 = ReactTypeOfSideEffect.Placement, Ref$2 = ReactTypeOfSideEffect.Ref, Update$2 = ReactTypeOfSideEffect.Update, OffscreenPriority$2 = ReactPriorityLevel.OffscreenPriority, ReactFiberCompleteWork = function(config, hostContext, hydrationContext) { var createInstance = config.createInstance, createTextInstance = config.createTextInstance, appendInitialChild = config.appendInitialChild, finalizeInitialChildren = config.finalizeInitialChildren, prepareUpdate = config.prepareUpdate, getRootHostContainer = hostContext.getRootHostContainer, popHostContext = hostContext.popHostContext, getHostContext = hostContext.getHostContext, popHostContainer = hostContext.popHostContainer, prepareToHydrateHostInstance = hydrationContext.prepareToHydrateHostInstance, prepareToHydrateHostTextInstance = hydrationContext.prepareToHydrateHostTextInstance, popHydrationState = hydrationContext.popHydrationState; function markUpdate(workInProgress) { workInProgress.effectTag |= Update$2; @@ -1917,7 +1886,6 @@ __DEV__ && function() { } } function completeWork(current, workInProgress, renderPriority) { - ReactDebugCurrentFiber$5.setCurrentFiber(workInProgress, null); var newProps = workInProgress.pendingProps; switch (null === newProps ? newProps = workInProgress.memoizedProps : workInProgress.pendingWorkPriority === OffscreenPriority$2 && renderPriority !== OffscreenPriority$2 || (workInProgress.pendingProps = null), workInProgress.tag) { @@ -2453,7 +2421,7 @@ __DEV__ && function() { } function commitAllHostEffects() { for (;null !== nextEffect; ) { - ReactDebugCurrentFiber$3.setCurrentFiber(nextEffect, null), recordEffect(); + ReactDebugCurrentFiber$3.setCurrentFiber(nextEffect), recordEffect(); var effectTag = nextEffect.effectTag; if (effectTag & ContentReset && config.resetTextContent(nextEffect.stateNode), effectTag & Ref) { var current = nextEffect.alternate; @@ -2532,7 +2500,11 @@ __DEV__ && function() { } function completeUnitOfWork(workInProgress) { for (;!0; ) { - var current = workInProgress.alternate, next = completeWork(current, workInProgress, nextPriorityLevel), returnFiber = workInProgress.return, siblingFiber = workInProgress.sibling; + var current = workInProgress.alternate; + ReactDebugCurrentFiber$3.setCurrentFiber(workInProgress); + var next = completeWork(current, workInProgress, nextPriorityLevel); + ReactDebugCurrentFiber$3.resetCurrentFiber(); + var returnFiber = workInProgress.return, siblingFiber = workInProgress.sibling; if (resetWorkPriority(workInProgress, nextPriorityLevel), null !== next) return stopWorkTimer(workInProgress), !0 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onCompleteWork(workInProgress), next; @@ -2552,19 +2524,19 @@ __DEV__ && function() { } function performUnitOfWork(workInProgress) { var current = workInProgress.alternate; - startWorkTimer(workInProgress); + startWorkTimer(workInProgress), ReactDebugCurrentFiber$3.setCurrentFiber(workInProgress); var next = beginWork(current, workInProgress, nextPriorityLevel); - return !0 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onBeginWork(workInProgress), + return ReactDebugCurrentFiber$3.resetCurrentFiber(), !0 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onBeginWork(workInProgress), null === next && (next = completeUnitOfWork(workInProgress)), ReactCurrentOwner$1.current = null, - ReactDebugCurrentFiber$3.resetCurrentFiber(), next; + next; } function performFailedUnitOfWork(workInProgress) { var current = workInProgress.alternate; - startWorkTimer(workInProgress); + startWorkTimer(workInProgress), ReactDebugCurrentFiber$3.setCurrentFiber(workInProgress); var next = beginFailedWork(current, workInProgress, nextPriorityLevel); - return !0 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onBeginWork(workInProgress), + return ReactDebugCurrentFiber$3.resetCurrentFiber(), !0 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onBeginWork(workInProgress), null === next && (next = completeUnitOfWork(workInProgress)), ReactCurrentOwner$1.current = null, - ReactDebugCurrentFiber$3.resetCurrentFiber(), next; + next; } function performDeferredWork(deadline) { performWork(OffscreenPriority, deadline); @@ -2821,22 +2793,12 @@ __DEV__ && function() { flushSync: flushSync, deferredUpdates: deferredUpdates }; - }, getContextFiber = function(arg) { - invariant(!1, "Missing injection for fiber getContextForSubtree"); - }; + }, addTopLevelUpdate = ReactFiberUpdateQueue.addTopLevelUpdate, findCurrentUnmaskedContext = ReactFiberContext.findCurrentUnmaskedContext, isContextProvider = ReactFiberContext.isContextProvider, processChildContext = ReactFiberContext.processChildContext, createFiberRoot = ReactFiberRoot.createFiberRoot, HostComponent = ReactTypeOfWork.HostComponent, warning$1 = require$$0, ReactFiberInstrumentation = ReactFiberInstrumentation_1, ReactDebugCurrentFiber = ReactDebugCurrentFiber_1, getComponentName = getComponentName_1, findCurrentHostFiber = ReactFiberTreeReflection.findCurrentHostFiber, findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection.findCurrentHostFiberWithNoPortals; function getContextForSubtree(parentComponent) { if (!parentComponent) return emptyObject; - var instance = ReactInstanceMap_1.get(parentComponent); - return "number" == typeof instance.tag ? getContextFiber(instance) : instance._processChildContext(instance._context); + var fiber = ReactInstanceMap_1.get(parentComponent), parentContext = findCurrentUnmaskedContext(fiber); + return isContextProvider(fiber) ? processChildContext(fiber, parentContext) : parentContext; } - getContextForSubtree._injectFiber = function(fn) { - getContextFiber = fn; - }; - var getContextForSubtree_1 = getContextForSubtree, addTopLevelUpdate = ReactFiberUpdateQueue.addTopLevelUpdate, findCurrentUnmaskedContext = ReactFiberContext.findCurrentUnmaskedContext, isContextProvider = ReactFiberContext.isContextProvider, processChildContext = ReactFiberContext.processChildContext, createFiberRoot = ReactFiberRoot.createFiberRoot, HostComponent = ReactTypeOfWork.HostComponent, warning$1 = require$$0, ReactFiberInstrumentation = ReactFiberInstrumentation_1, ReactDebugCurrentFiber = ReactDebugCurrentFiber_1, getComponentName = getComponentName_1, findCurrentHostFiber = ReactFiberTreeReflection.findCurrentHostFiber, findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection.findCurrentHostFiberWithNoPortals; - getContextForSubtree_1._injectFiber(function(fiber) { - var parentContext = findCurrentUnmaskedContext(fiber); - return isContextProvider(fiber) ? processChildContext(fiber, parentContext, !1) : parentContext; - }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } @@ -3036,7 +2998,7 @@ __DEV__ && function() { updateContainer: function(element, container, parentComponent, callback) { var current = container.current; ReactFiberInstrumentation.debugTool && (null === current.alternate ? ReactFiberInstrumentation.debugTool.onMountContainer(container) : null === element ? ReactFiberInstrumentation.debugTool.onUnmountContainer(container) : ReactFiberInstrumentation.debugTool.onUpdateContainer(container)); - var context = getContextForSubtree_1(parentComponent); + var context = getContextForSubtree(parentComponent); null === container.context ? container.context = context : container.pendingContext = context, scheduleTopLevelUpdate(current, element, callback); }, @@ -3213,7 +3175,7 @@ __DEV__ && function() { }; var ReactNativeFiberInspector = { getInspectorDataForViewTag: getInspectorDataForViewTag - }, ReactVersion = "16.0.0-rc.3", ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, warning$11 = require$$0; + }, ReactVersion = "16.0.0", ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, warning$11 = require$$0; function findNodeHandle(componentOrHandle) { var owner = ReactCurrentOwner$3.current; if (null !== owner && null !== owner.stateNode && (warning$11(owner.stateNode._warnedAboutRefsInRender, "%s is accessing findNodeHandle inside its render(). " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", getComponentName_1(owner) || "A component"), @@ -3323,22 +3285,11 @@ __DEV__ && function() { injectEventPluginsByName: EventPluginRegistry_1.injectEventPluginsByName }, getListener: function(inst, registrationName) { - var listener; - if ("number" == typeof inst.tag) { - var stateNode = inst.stateNode; - if (!stateNode) return null; - var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode); - if (!props) return null; - if (listener = props[registrationName], shouldPreventMouseEvent(registrationName, inst.type, props)) return null; - } else { - var currentElement = inst._currentElement; - if ("string" == typeof currentElement || "number" == typeof currentElement) return null; - if (!inst._rootNodeID) return null; - var _props = currentElement.props; - if (listener = _props[registrationName], shouldPreventMouseEvent(registrationName, currentElement.type, _props)) return null; - } - return invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener), - listener; + var listener, stateNode = inst.stateNode; + if (!stateNode) return null; + var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode); + return props ? (listener = props[registrationName], shouldPreventMouseEvent(registrationName, inst.type, props) ? null : (invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener), + listener)) : null; }, extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { for (var events, plugins = EventPluginRegistry_1.plugins, i = 0; i < plugins.length; i++) { @@ -3361,14 +3312,10 @@ __DEV__ && function() { } }, EventPluginHub_1 = EventPluginHub, HostComponent$11 = ReactTypeOfWork.HostComponent; function getParent(inst) { - if (void 0 !== inst._hostParent) return inst._hostParent; - if ("number" == typeof inst.tag) { - do { - inst = inst.return; - } while (inst && inst.tag !== HostComponent$11); - if (inst) return inst; - } - return null; + do { + inst = inst.return; + } while (inst && inst.tag !== HostComponent$11); + return inst || null; } function getLowestCommonAncestor(instA, instB) { for (var depthA = 0, tempA = instA; tempA; tempA = getParent(tempA)) depthA++; @@ -3988,430 +3935,7 @@ __DEV__ && function() { return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle(view) || "window"), UIManager.__takeSnapshot(view, options); } - var takeSnapshot_1 = takeSnapshot, ReactInvalidSetStateWarningHook = {}, warning$17 = require$$0, processingChildContext = !1, warnInvalidSetState = function() { - warning$17(!processingChildContext, "setState(...): Cannot call setState() inside getChildContext()"); - }; - ReactInvalidSetStateWarningHook = { - onBeginProcessingChildContext: function() { - processingChildContext = !0; - }, - onEndProcessingChildContext: function() { - processingChildContext = !1; - }, - onSetState: function() { - warnInvalidSetState(); - } - }; - var ReactInvalidSetStateWarningHook_1 = ReactInvalidSetStateWarningHook, ReactHostOperationHistoryHook = null, history = []; - ReactHostOperationHistoryHook = { - onHostOperation: function(operation) { - history.push(operation); - }, - clearHistory: function() { - ReactHostOperationHistoryHook._preventClearing || (history = []); - }, - getHistory: function() { - return history; - } - }; - var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook, ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook, warning$16 = require$$0, ReactDebugTool = null, hooks = [], didHookThrowForEvent = {}, callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) { - try { - fn.call(context, arg1, arg2, arg3, arg4, arg5); - } catch (e) { - warning$16(didHookThrowForEvent[event], "Exception thrown by hook while handling %s: %s", event, e + "\n" + e.stack), - didHookThrowForEvent[event] = !0; - } - }, emitEvent = function(event, arg1, arg2, arg3, arg4, arg5) { - for (var i = 0; i < hooks.length; i++) { - var hook = hooks[i], fn = hook[event]; - fn && callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); - } - }, isProfiling = !1, flushHistory = [], lifeCycleTimerStack = [], currentFlushNesting = 0, currentFlushMeasurements = [], currentFlushStartTime = 0, currentTimerDebugID = null, currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerType = null, lifeCycleTimerHasWarned = !1, clearHistory = function() { - ReactComponentTreeHook.purgeUnmountedComponents(), ReactHostOperationHistoryHook_1.clearHistory(); - }, getTreeSnapshot = function(registeredIDs) { - return registeredIDs.reduce(function(tree, id) { - var ownerID = ReactComponentTreeHook.getOwnerID(id), parentID = ReactComponentTreeHook.getParentID(id); - return tree[id] = { - displayName: ReactComponentTreeHook.getDisplayName(id), - text: ReactComponentTreeHook.getText(id), - updateCount: ReactComponentTreeHook.getUpdateCount(id), - childIDs: ReactComponentTreeHook.getChildIDs(id), - ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, - parentID: parentID - }, tree; - }, {}); - }, resetMeasurements = function() { - var previousStartTime = currentFlushStartTime, previousMeasurements = currentFlushMeasurements, previousOperations = ReactHostOperationHistoryHook_1.getHistory(); - if (0 === currentFlushNesting) return currentFlushStartTime = 0, currentFlushMeasurements = [], - void clearHistory(); - if (previousMeasurements.length || previousOperations.length) { - var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); - flushHistory.push({ - duration: performanceNow() - previousStartTime, - measurements: previousMeasurements || [], - operations: previousOperations || [], - treeSnapshot: getTreeSnapshot(registeredIDs) - }); - } - clearHistory(), currentFlushStartTime = performanceNow(), currentFlushMeasurements = []; - }, checkDebugID = function(debugID) { - arguments.length > 1 && void 0 !== arguments[1] && arguments[1] && 0 === debugID || debugID || warning$16(!1, "ReactDebugTool: debugID may not be empty."); - }, beginLifeCycleTimer = function(debugID, timerType) { - 0 !== currentFlushNesting && (currentTimerType && !lifeCycleTimerHasWarned && (warning$16(!1, "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), - lifeCycleTimerHasWarned = !0), currentTimerStartTime = performanceNow(), currentTimerNestedFlushDuration = 0, - currentTimerDebugID = debugID, currentTimerType = timerType); - }, endLifeCycleTimer = function(debugID, timerType) { - 0 !== currentFlushNesting && (currentTimerType === timerType || lifeCycleTimerHasWarned || (warning$16(!1, "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), - lifeCycleTimerHasWarned = !0), isProfiling && currentFlushMeasurements.push({ - timerType: timerType, - instanceID: debugID, - duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration - }), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerDebugID = null, - currentTimerType = null); - }, pauseCurrentLifeCycleTimer = function() { - var currentTimer = { - startTime: currentTimerStartTime, - nestedFlushStartTime: performanceNow(), - debugID: currentTimerDebugID, - timerType: currentTimerType - }; - lifeCycleTimerStack.push(currentTimer), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, - currentTimerDebugID = null, currentTimerType = null; - }, resumeCurrentLifeCycleTimer = function() { - var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), startTime = _lifeCycleTimerStack$.startTime, nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, debugID = _lifeCycleTimerStack$.debugID, timerType = _lifeCycleTimerStack$.timerType, nestedFlushDuration = performanceNow() - nestedFlushStartTime; - currentTimerStartTime = startTime, currentTimerNestedFlushDuration += nestedFlushDuration, - currentTimerDebugID = debugID, currentTimerType = timerType; - }, lastMarkTimeStamp = 0, canUsePerformanceMeasure = "undefined" != typeof performance && "function" == typeof performance.mark && "function" == typeof performance.clearMarks && "function" == typeof performance.measure && "function" == typeof performance.clearMeasures, shouldMark = function(debugID) { - if (!isProfiling || !canUsePerformanceMeasure) return !1; - var element = ReactComponentTreeHook.getElement(debugID); - return null != element && "object" == typeof element && !("string" == typeof element.type); - }, markBegin = function(debugID, markType) { - if (shouldMark(debugID)) { - var markName = debugID + "::" + markType; - lastMarkTimeStamp = performanceNow(), performance.mark(markName); - } - }, markEnd = function(debugID, markType) { - if (shouldMark(debugID)) { - var markName = debugID + "::" + markType, displayName = ReactComponentTreeHook.getDisplayName(debugID) || "Unknown"; - if (performanceNow() - lastMarkTimeStamp > .1) { - var measurementName = displayName + " [" + markType + "]"; - performance.measure(measurementName, markName); - } - performance.clearMarks(markName), measurementName && performance.clearMeasures(measurementName); - } - }; - ReactDebugTool = { - addHook: function(hook) { - hooks.push(hook); - }, - removeHook: function(hook) { - for (var i = 0; i < hooks.length; i++) hooks[i] === hook && (hooks.splice(i, 1), - i--); - }, - isProfiling: function() { - return isProfiling; - }, - beginProfiling: function() { - isProfiling || (isProfiling = !0, flushHistory.length = 0, resetMeasurements(), - ReactDebugTool.addHook(ReactHostOperationHistoryHook_1)); - }, - endProfiling: function() { - isProfiling && (isProfiling = !1, resetMeasurements(), ReactDebugTool.removeHook(ReactHostOperationHistoryHook_1)); - }, - getFlushHistory: function() { - return flushHistory; - }, - onBeginFlush: function() { - currentFlushNesting++, resetMeasurements(), pauseCurrentLifeCycleTimer(), emitEvent("onBeginFlush"); - }, - onEndFlush: function() { - resetMeasurements(), currentFlushNesting--, resumeCurrentLifeCycleTimer(), emitEvent("onEndFlush"); - }, - onBeginLifeCycleTimer: function(debugID, timerType) { - checkDebugID(debugID), emitEvent("onBeginLifeCycleTimer", debugID, timerType), markBegin(debugID, timerType), - beginLifeCycleTimer(debugID, timerType); - }, - onEndLifeCycleTimer: function(debugID, timerType) { - checkDebugID(debugID), endLifeCycleTimer(debugID, timerType), markEnd(debugID, timerType), - emitEvent("onEndLifeCycleTimer", debugID, timerType); - }, - onBeginProcessingChildContext: function() { - emitEvent("onBeginProcessingChildContext"); - }, - onEndProcessingChildContext: function() { - emitEvent("onEndProcessingChildContext"); - }, - onHostOperation: function(operation) { - checkDebugID(operation.instanceID), emitEvent("onHostOperation", operation); - }, - onSetState: function() { - emitEvent("onSetState"); - }, - onSetChildren: function(debugID, childDebugIDs) { - checkDebugID(debugID), childDebugIDs.forEach(checkDebugID), emitEvent("onSetChildren", debugID, childDebugIDs); - }, - onBeforeMountComponent: function(debugID, element, parentDebugID) { - checkDebugID(debugID), checkDebugID(parentDebugID, !0), emitEvent("onBeforeMountComponent", debugID, element, parentDebugID), - markBegin(debugID, "mount"); - }, - onMountComponent: function(debugID) { - checkDebugID(debugID), markEnd(debugID, "mount"), emitEvent("onMountComponent", debugID); - }, - onBeforeUpdateComponent: function(debugID, element) { - checkDebugID(debugID), emitEvent("onBeforeUpdateComponent", debugID, element), markBegin(debugID, "update"); - }, - onUpdateComponent: function(debugID) { - checkDebugID(debugID), markEnd(debugID, "update"), emitEvent("onUpdateComponent", debugID); - }, - onBeforeUnmountComponent: function(debugID) { - checkDebugID(debugID), emitEvent("onBeforeUnmountComponent", debugID), markBegin(debugID, "unmount"); - }, - onUnmountComponent: function(debugID) { - checkDebugID(debugID), markEnd(debugID, "unmount"), emitEvent("onUnmountComponent", debugID); - }, - onTestEvent: function() { - emitEvent("onTestEvent"); - } - }, ReactDebugTool.addHook(ReactInvalidSetStateWarningHook_1), ReactDebugTool.addHook(ReactComponentTreeHook), - /[?&]react_perf\b/.test(ExecutionEnvironment.canUseDOM && window.location.href || "") && ReactDebugTool.beginProfiling(); - var ReactDebugTool_1 = ReactDebugTool, lowPriorityWarning = function() {}, printWarning = function(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key]; - var argIndex = 0, message = "Warning: " + format.replace(/%s/g, function() { - return args[argIndex++]; - }); - "undefined" != typeof console && console.warn(message); - try { - throw new Error(message); - } catch (x) {} - }; - lowPriorityWarning = function(condition, format) { - if (void 0 === format) throw new Error("`warning(condition, format, ...args)` requires a warning " + "message argument"); - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) args[_key2 - 2] = arguments[_key2]; - printWarning.apply(void 0, [ format ].concat(args)); - } - }; - var lowPriorityWarning_1 = lowPriorityWarning; - function roundFloat(val) { - var base = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, n = Math.pow(10, base); - return Math.floor(val * n) / n; - } - function consoleTable(table) { - console.table(table); - } - function getLastMeasurements() { - return ReactDebugTool_1.getFlushHistory(); - } - function getExclusive() { - var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; - function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) { - var displayName = treeSnapshot[instanceID].displayName, key = displayName, stats = aggregatedStats[key]; - stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { - key: key, - instanceCount: 0, - counts: {}, - durations: {}, - totalDuration: 0 - }), stats.durations[timerType] || (stats.durations[timerType] = 0), stats.counts[timerType] || (stats.counts[timerType] = 0), - affectedIDs[key][instanceID] = !0, applyUpdate(stats); - } - return flushHistory.forEach(function(flush) { - var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot; - measurements.forEach(function(measurement) { - var duration = measurement.duration, instanceID = measurement.instanceID, timerType = measurement.timerType; - updateAggregatedStats(treeSnapshot, instanceID, timerType, function(stats) { - stats.totalDuration += duration, stats.durations[timerType] += duration, stats.counts[timerType]++; - }); - }); - }), Object.keys(aggregatedStats).map(function(key) { - return Object.assign({}, aggregatedStats[key], { - instanceCount: Object.keys(affectedIDs[key]).length - }); - }).sort(function(a, b) { - return b.totalDuration - a.totalDuration; - }); - } - function getInclusive() { - var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; - function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { - var _treeSnapshot$instanc = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc.displayName, ownerID = _treeSnapshot$instanc.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName, stats = aggregatedStats[key]; - stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { - key: key, - instanceCount: 0, - inclusiveRenderDuration: 0, - renderCount: 0 - }), affectedIDs[key][instanceID] = !0, applyUpdate(stats); - } - var isCompositeByID = {}; - return flushHistory.forEach(function(flush) { - flush.measurements.forEach(function(measurement) { - var instanceID = measurement.instanceID; - "render" === measurement.timerType && (isCompositeByID[instanceID] = !0); - }); - }), flushHistory.forEach(function(flush) { - var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot; - measurements.forEach(function(measurement) { - var duration = measurement.duration, instanceID = measurement.instanceID; - if ("render" === measurement.timerType) { - updateAggregatedStats(treeSnapshot, instanceID, function(stats) { - stats.renderCount++; - }); - for (var nextParentID = instanceID; nextParentID; ) isCompositeByID[nextParentID] && updateAggregatedStats(treeSnapshot, nextParentID, function(stats) { - stats.inclusiveRenderDuration += duration; - }), nextParentID = treeSnapshot[nextParentID].parentID; - } - }); - }), Object.keys(aggregatedStats).map(function(key) { - return Object.assign({}, aggregatedStats[key], { - instanceCount: Object.keys(affectedIDs[key]).length - }); - }).sort(function(a, b) { - return b.inclusiveRenderDuration - a.inclusiveRenderDuration; - }); - } - function getWasted() { - var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; - function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { - var _treeSnapshot$instanc2 = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc2.displayName, ownerID = _treeSnapshot$instanc2.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName, stats = aggregatedStats[key]; - stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { - key: key, - instanceCount: 0, - inclusiveRenderDuration: 0, - renderCount: 0 - }), affectedIDs[key][instanceID] = !0, applyUpdate(stats); - } - return flushHistory.forEach(function(flush) { - var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot, operations = flush.operations, isDefinitelyNotWastedByID = {}; - operations.forEach(function(operation) { - for (var instanceID = operation.instanceID, nextParentID = instanceID; nextParentID; ) isDefinitelyNotWastedByID[nextParentID] = !0, - nextParentID = treeSnapshot[nextParentID].parentID; - }); - var renderedCompositeIDs = {}; - measurements.forEach(function(measurement) { - var instanceID = measurement.instanceID; - "render" === measurement.timerType && (renderedCompositeIDs[instanceID] = !0); - }), measurements.forEach(function(measurement) { - var duration = measurement.duration, instanceID = measurement.instanceID; - if ("render" === measurement.timerType) { - var updateCount = treeSnapshot[instanceID].updateCount; - if (!isDefinitelyNotWastedByID[instanceID] && 0 !== updateCount) { - updateAggregatedStats(treeSnapshot, instanceID, function(stats) { - stats.renderCount++; - }); - for (var nextParentID = instanceID; nextParentID; ) renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID] && updateAggregatedStats(treeSnapshot, nextParentID, function(stats) { - stats.inclusiveRenderDuration += duration; - }), nextParentID = treeSnapshot[nextParentID].parentID; - } - } - }); - }), Object.keys(aggregatedStats).map(function(key) { - return Object.assign({}, aggregatedStats[key], { - instanceCount: Object.keys(affectedIDs[key]).length - }); - }).sort(function(a, b) { - return b.inclusiveRenderDuration - a.inclusiveRenderDuration; - }); - } - function getOperations() { - var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), stats = []; - return flushHistory.forEach(function(flush, flushIndex) { - var operations = flush.operations, treeSnapshot = flush.treeSnapshot; - operations.forEach(function(operation) { - var instanceID = operation.instanceID, type = operation.type, payload = operation.payload, _treeSnapshot$instanc3 = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc3.displayName, ownerID = _treeSnapshot$instanc3.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName; - stats.push({ - flushIndex: flushIndex, - instanceID: instanceID, - key: key, - type: type, - ownerID: ownerID, - payload: payload - }); - }); - }), stats; - } - function printExclusive(flushHistory) { - consoleTable(getExclusive(flushHistory).map(function(item) { - var key = item.key, instanceCount = item.instanceCount, totalDuration = item.totalDuration, renderCount = item.counts.render || 0, renderDuration = item.durations.render || 0; - return { - Component: key, - "Total time (ms)": roundFloat(totalDuration), - "Instance count": instanceCount, - "Total render time (ms)": roundFloat(renderDuration), - "Average render time (ms)": renderCount ? roundFloat(renderDuration / renderCount) : void 0, - "Render count": renderCount, - "Total lifecycle time (ms)": roundFloat(totalDuration - renderDuration) - }; - })); - } - function printInclusive(flushHistory) { - consoleTable(getInclusive(flushHistory).map(function(item) { - var key = item.key, instanceCount = item.instanceCount, inclusiveRenderDuration = item.inclusiveRenderDuration, renderCount = item.renderCount; - return { - "Owner > Component": key, - "Inclusive render time (ms)": roundFloat(inclusiveRenderDuration), - "Instance count": instanceCount, - "Render count": renderCount - }; - })); - } - function printWasted(flushHistory) { - consoleTable(getWasted(flushHistory).map(function(item) { - var key = item.key, instanceCount = item.instanceCount, inclusiveRenderDuration = item.inclusiveRenderDuration, renderCount = item.renderCount; - return { - "Owner > Component": key, - "Inclusive wasted time (ms)": roundFloat(inclusiveRenderDuration), - "Instance count": instanceCount, - "Render count": renderCount - }; - })); - } - function printOperations(flushHistory) { - consoleTable(getOperations(flushHistory).map(function(stat) { - return { - "Owner > Node": stat.key, - Operation: stat.type, - Payload: "object" == typeof stat.payload ? JSON.stringify(stat.payload) : stat.payload, - "Flush index": stat.flushIndex, - "Owner Component ID": stat.ownerID, - "DOM Component ID": stat.instanceID - }; - })); - } - var warnedAboutPrintDOM = !1; - function printDOM(measurements) { - return lowPriorityWarning_1(warnedAboutPrintDOM, "`ReactPerf.printDOM(...)` is deprecated. Use " + "`ReactPerf.printOperations(...)` instead."), - warnedAboutPrintDOM = !0, printOperations(measurements); - } - var warnedAboutGetMeasurementsSummaryMap = !1; - function getMeasurementsSummaryMap(measurements) { - return lowPriorityWarning_1(warnedAboutGetMeasurementsSummaryMap, "`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use " + "`ReactPerf.getWasted(...)` instead."), - warnedAboutGetMeasurementsSummaryMap = !0, getWasted(measurements); - } - function start() { - ReactDebugTool_1.beginProfiling(); - } - function stop() { - ReactDebugTool_1.endProfiling(); - } - function isRunning() { - return ReactDebugTool_1.isProfiling(); - } - var ReactPerfAnalysis = { - getLastMeasurements: getLastMeasurements, - getExclusive: getExclusive, - getInclusive: getInclusive, - getWasted: getWasted, - getOperations: getOperations, - printExclusive: printExclusive, - printInclusive: printInclusive, - printWasted: printWasted, - printOperations: printOperations, - start: start, - stop: stop, - isRunning: isRunning, - printDOM: printDOM, - getMeasurementsSummaryMap: getMeasurementsSummaryMap - }, ReactPerf = ReactPerfAnalysis, injectInternals = ReactFiberDevToolsHook.injectInternals; + var takeSnapshot_1 = takeSnapshot, injectInternals = ReactFiberDevToolsHook.injectInternals; ReactGenericBatching_1.injection.injectFiberBatchedUpdates(ReactNativeFiberRenderer.batchedUpdates); var roots = new Map(); ReactFiberErrorLogger.injection.injectDialog(ReactNativeFiberErrorDialog_1.showDialog); @@ -4450,8 +3974,16 @@ __DEV__ && function() { } }; Object.assign(ReactNativeFiber.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { - ReactDebugTool: ReactDebugTool_1, - ReactPerf: ReactPerf + ReactDebugTool: { + addHook: function() {}, + removeHook: function() {} + }, + ReactPerf: { + start: function() {}, + stop: function() {}, + printInclusive: function() {}, + printWasted: function() {} + } }), injectInternals({ findFiberByHostInstance: ReactNativeComponentTree_1.getClosestInstanceFromNode, findHostInstanceByFiber: ReactNativeFiberRenderer.findHostInstance, diff --git a/Libraries/Renderer/ReactNativeFiber-prod.js b/Libraries/Renderer/ReactNativeFiber-prod.js index 92357de33..12e7faa7d 100644 --- a/Libraries/Renderer/ReactNativeFiber-prod.js +++ b/Libraries/Renderer/ReactNativeFiber-prod.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @noflow * @providesModule ReactNativeFiber-prod @@ -166,13 +164,9 @@ var EventPluginUtils = { function restoreStateOfTarget(target) { var internalInstance = EventPluginUtils_1.getInstanceFromNode(target); if (internalInstance) { - if ("number" == typeof internalInstance.tag) { - invariant(fiberHostComponent && "function" == typeof fiberHostComponent.restoreControlledState, "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue."); - var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode); - return void fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); - } - invariant("function" == typeof internalInstance.restoreControlledState, "The internal instance must be a React host component. " + "This error is likely caused by a bug in React. Please file an issue."), - internalInstance.restoreControlledState(); + invariant(fiberHostComponent && "function" == typeof fiberHostComponent.restoreControlledState, "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue."); + var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode); + fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); } } @@ -187,18 +181,12 @@ var ReactControlledComponent = { if (restoreTarget = null, restoreQueue = null, restoreStateOfTarget(target), queuedTargets) for (var i = 0; i < queuedTargets.length; i++) restoreStateOfTarget(queuedTargets[i]); } } -}, ReactControlledComponent_1 = ReactControlledComponent, stackBatchedUpdates = function(fn, a, b, c, d, e) { - return fn(a, b, c, d, e); -}, fiberBatchedUpdates = function(fn, bookkeeping) { +}, ReactControlledComponent_1 = ReactControlledComponent, fiberBatchedUpdates = function(fn, bookkeeping) { return fn(bookkeeping); }; -function performFiberBatchedUpdates(fn, bookkeeping) { - return fiberBatchedUpdates(fn, bookkeeping); -} - function batchedUpdates(fn, bookkeeping) { - return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping); + return fiberBatchedUpdates(fn, bookkeeping); } var isNestingBatched = !1; @@ -214,9 +202,6 @@ function batchedUpdatesWithControlledComponents(fn, bookkeeping) { } var ReactGenericBatchingInjection = { - injectStackBatchedUpdates: function(_batchedUpdates) { - stackBatchedUpdates = _batchedUpdates; - }, injectFiberBatchedUpdates: function(_batchedUpdates) { fiberBatchedUpdates = _batchedUpdates; } @@ -256,25 +241,10 @@ var showDialog$1 = ReactNativeFiberErrorDialog, ReactNativeFiberErrorDialog_1 = REACT_PORTAL_TYPE: REACT_PORTAL_TYPE_1 }, instanceCache = {}, instanceProps = {}; -function getRenderedHostOrTextFromComponent(component) { - for (var rendered; rendered = component._renderedComponent; ) component = rendered; - return component; -} - -function precacheNode(inst, tag) { - var nativeInst = getRenderedHostOrTextFromComponent(inst); - instanceCache[tag] = nativeInst; -} - function precacheFiberNode(hostInst, tag) { instanceCache[tag] = hostInst; } -function uncacheNode(inst) { - var tag = inst._rootNodeID; - tag && delete instanceCache[tag]; -} - function uncacheFiberNode(tag) { delete instanceCache[tag], delete instanceProps[tag]; } @@ -301,9 +271,7 @@ var ReactNativeComponentTree = { getInstanceFromNode: getInstanceFromTag, getNodeFromInstance: getTagFromInstance, precacheFiberNode: precacheFiberNode, - precacheNode: precacheNode, uncacheFiberNode: uncacheFiberNode, - uncacheNode: uncacheNode, getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode, updateFiberProps: updateFiberProps }, ReactNativeComponentTree_1 = ReactNativeComponentTree, commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, ReactFeatureFlags = { @@ -522,16 +490,9 @@ var commitCallbacks_1 = commitCallbacks, ReactFiberUpdateQueue = { commitCallbacks: commitCallbacks_1 }; -function getComponentName$1(instanceOrFiber) { - if ("function" == typeof instanceOrFiber.getName) { - return instanceOrFiber.getName(); - } - if ("number" == typeof instanceOrFiber.tag) { - var fiber = instanceOrFiber, type = fiber.type; - if ("string" == typeof type) return type; - if ("function" == typeof type) return type.displayName || type.name; - } - return null; +function getComponentName$1(fiber) { + var type = fiber.type; + return "string" == typeof type ? type : "function" == typeof type ? type.displayName || type.name : null; } var getComponentName_1 = getComponentName$1, ReactInstanceMap = { @@ -724,7 +685,7 @@ var popContextProvider_1 = popContextProvider, popTopLevelContextObject = functi push(contextStackCursor, context, fiber), push(didPerformWorkStackCursor, didChange, fiber); }; -function processChildContext$1(fiber, parentContext, isReconciling) { +function processChildContext$1(fiber, parentContext) { var instance = fiber.stateNode, childContextTypes = fiber.type.childContextTypes; if ("function" != typeof instance.getChildContext) return parentContext; var childContext = void 0; @@ -743,7 +704,7 @@ var processChildContext_1 = processChildContext$1, pushContextProvider = functio var instance = workInProgress.stateNode; if (invariant(instance, "Expected to have an instance by this point. " + "This error is likely caused by a bug in React. Please file an issue."), didChange) { - var mergedContext = processChildContext$1(workInProgress, previousContext, !0); + var mergedContext = processChildContext$1(workInProgress, previousContext); instance.__reactInternalMemoizedMergedChildContext = mergedContext, pop(didPerformWorkStackCursor, workInProgress), pop(contextStackCursor, workInProgress), push(contextStackCursor, mergedContext, workInProgress), push(didPerformWorkStackCursor, didChange, workInProgress); @@ -946,11 +907,11 @@ function coerceRef(current, element) { if (null !== mixedRef && "function" != typeof mixedRef) { if (element._owner) { var owner = element._owner, inst = void 0; - if (owner) if ("number" == typeof owner.tag) { + if (owner) { var ownerFiber = owner; invariant(ownerFiber.tag === ClassComponent$7, "Stateless function components cannot have refs."), inst = ownerFiber.stateNode; - } else inst = owner.getPublicInstance(); + } invariant(inst, "Missing owner for string ref %s. This error is likely caused by a " + "bug in React. Please file an issue.", mixedRef); var stringRef = "" + mixedRef; if (null !== current && null !== current.ref && current.ref._stringRef === stringRef) return current.ref; @@ -2526,27 +2487,14 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo flushSync: flushSync, deferredUpdates: deferredUpdates }; -}, getContextFiber = function(arg) { - invariant(!1, "Missing injection for fiber getContextForSubtree"); -}; +}, addTopLevelUpdate = ReactFiberUpdateQueue.addTopLevelUpdate, findCurrentUnmaskedContext = ReactFiberContext.findCurrentUnmaskedContext, isContextProvider = ReactFiberContext.isContextProvider, processChildContext = ReactFiberContext.processChildContext, createFiberRoot = ReactFiberRoot.createFiberRoot, HostComponent = ReactTypeOfWork.HostComponent, findCurrentHostFiber = ReactFiberTreeReflection.findCurrentHostFiber, findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection.findCurrentHostFiberWithNoPortals; function getContextForSubtree(parentComponent) { if (!parentComponent) return emptyObject; - var instance = ReactInstanceMap_1.get(parentComponent); - return "number" == typeof instance.tag ? getContextFiber(instance) : instance._processChildContext(instance._context); + var fiber = ReactInstanceMap_1.get(parentComponent), parentContext = findCurrentUnmaskedContext(fiber); + return isContextProvider(fiber) ? processChildContext(fiber, parentContext) : parentContext; } -getContextForSubtree._injectFiber = function(fn) { - getContextFiber = fn; -}; - -var getContextForSubtree_1 = getContextForSubtree, addTopLevelUpdate = ReactFiberUpdateQueue.addTopLevelUpdate, findCurrentUnmaskedContext = ReactFiberContext.findCurrentUnmaskedContext, isContextProvider = ReactFiberContext.isContextProvider, processChildContext = ReactFiberContext.processChildContext, createFiberRoot = ReactFiberRoot.createFiberRoot, HostComponent = ReactTypeOfWork.HostComponent, findCurrentHostFiber = ReactFiberTreeReflection.findCurrentHostFiber, findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection.findCurrentHostFiberWithNoPortals; - -getContextForSubtree_1._injectFiber(function(fiber) { - var parentContext = findCurrentUnmaskedContext(fiber); - return isContextProvider(fiber) ? processChildContext(fiber, parentContext, !1) : parentContext; -}); - var ReactFiberReconciler = function(config) { var getPublicInstance = config.getPublicInstance, _ReactFiberScheduler = ReactFiberScheduler(config), scheduleUpdate = _ReactFiberScheduler.scheduleUpdate, getPriorityContext = _ReactFiberScheduler.getPriorityContext, batchedUpdates = _ReactFiberScheduler.batchedUpdates, unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates, flushSync = _ReactFiberScheduler.flushSync, deferredUpdates = _ReactFiberScheduler.deferredUpdates; function scheduleTopLevelUpdate(current, element, callback) { @@ -2561,7 +2509,7 @@ var ReactFiberReconciler = function(config) { return createFiberRoot(containerInfo); }, updateContainer: function(element, container, parentComponent, callback) { - var current = container.current, context = getContextForSubtree_1(parentComponent); + var current = container.current, context = getContextForSubtree(parentComponent); null === container.context ? container.context = context : container.pendingContext = context, scheduleTopLevelUpdate(current, element, callback); }, @@ -2892,7 +2840,7 @@ getInspectorDataForViewTag = function() { var ReactNativeFiberInspector = { getInspectorDataForViewTag: getInspectorDataForViewTag -}, ReactVersion = "16.0.0-rc.3"; +}, ReactVersion = "16.0.0"; function findNodeHandle(componentOrHandle) { if (null == componentOrHandle) return null; @@ -3010,22 +2958,11 @@ var EventPluginHub = { injectEventPluginsByName: EventPluginRegistry_1.injectEventPluginsByName }, getListener: function(inst, registrationName) { - var listener; - if ("number" == typeof inst.tag) { - var stateNode = inst.stateNode; - if (!stateNode) return null; - var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode); - if (!props) return null; - if (listener = props[registrationName], shouldPreventMouseEvent(registrationName, inst.type, props)) return null; - } else { - var currentElement = inst._currentElement; - if ("string" == typeof currentElement || "number" == typeof currentElement) return null; - if (!inst._rootNodeID) return null; - var _props = currentElement.props; - if (listener = _props[registrationName], shouldPreventMouseEvent(registrationName, currentElement.type, _props)) return null; - } - return invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener), - listener; + var listener, stateNode = inst.stateNode; + if (!stateNode) return null; + var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode); + return props ? (listener = props[registrationName], shouldPreventMouseEvent(registrationName, inst.type, props) ? null : (invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener), + listener)) : null; }, extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { for (var events, plugins = EventPluginRegistry_1.plugins, i = 0; i < plugins.length; i++) { @@ -3049,14 +2986,10 @@ var EventPluginHub = { }, EventPluginHub_1 = EventPluginHub, HostComponent$10 = ReactTypeOfWork.HostComponent; function getParent(inst) { - if (void 0 !== inst._hostParent) return inst._hostParent; - if ("number" == typeof inst.tag) { - do { - inst = inst.return; - } while (inst && inst.tag !== HostComponent$10); - if (inst) return inst; - } - return null; + do { + inst = inst.return; + } while (inst && inst.tag !== HostComponent$10); + return inst || null; } function getLowestCommonAncestor(instA, instB) { diff --git a/Libraries/Renderer/shims/NativeMethodsMixin.js b/Libraries/Renderer/shims/NativeMethodsMixin.js index 085c653bf..cd0e673b3 100644 --- a/Libraries/Renderer/shims/NativeMethodsMixin.js +++ b/Libraries/Renderer/shims/NativeMethodsMixin.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule NativeMethodsMixin * @flow diff --git a/Libraries/Renderer/shims/PooledClass.js b/Libraries/Renderer/shims/PooledClass.js index 7b5d93ab7..ad5d874ba 100644 --- a/Libraries/Renderer/shims/PooledClass.js +++ b/Libraries/Renderer/shims/PooledClass.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule PooledClass * @flow diff --git a/Libraries/Renderer/shims/ReactDebugTool.js b/Libraries/Renderer/shims/ReactDebugTool.js index c532f4bbe..e45af4fb0 100644 --- a/Libraries/Renderer/shims/ReactDebugTool.js +++ b/Libraries/Renderer/shims/ReactDebugTool.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactDebugTool */ diff --git a/Libraries/Renderer/shims/ReactGlobalSharedState.js b/Libraries/Renderer/shims/ReactGlobalSharedState.js index a2b584020..089449a94 100644 --- a/Libraries/Renderer/shims/ReactGlobalSharedState.js +++ b/Libraries/Renderer/shims/ReactGlobalSharedState.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactGlobalSharedState */ diff --git a/Libraries/Renderer/shims/ReactNative.js b/Libraries/Renderer/shims/ReactNative.js index cb23d1f68..35b7c3909 100644 --- a/Libraries/Renderer/shims/ReactNative.js +++ b/Libraries/Renderer/shims/ReactNative.js @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactNative * @flow diff --git a/Libraries/Renderer/shims/ReactNativeBridgeEventPlugin.js b/Libraries/Renderer/shims/ReactNativeBridgeEventPlugin.js index c7a1ed8c1..3170faedb 100644 --- a/Libraries/Renderer/shims/ReactNativeBridgeEventPlugin.js +++ b/Libraries/Renderer/shims/ReactNativeBridgeEventPlugin.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactNativeBridgeEventPlugin */ diff --git a/Libraries/Renderer/shims/ReactNativeComponentTree.js b/Libraries/Renderer/shims/ReactNativeComponentTree.js index 92672f3e8..30ec5257f 100644 --- a/Libraries/Renderer/shims/ReactNativeComponentTree.js +++ b/Libraries/Renderer/shims/ReactNativeComponentTree.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactNativeComponentTree * @flow diff --git a/Libraries/Renderer/shims/ReactNativePropRegistry.js b/Libraries/Renderer/shims/ReactNativePropRegistry.js index d72d46018..1ffd01057 100644 --- a/Libraries/Renderer/shims/ReactNativePropRegistry.js +++ b/Libraries/Renderer/shims/ReactNativePropRegistry.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactNativePropRegistry * @flow diff --git a/Libraries/Renderer/shims/ReactNativeTypes.js b/Libraries/Renderer/shims/ReactNativeTypes.js index 89c4948c6..5da688601 100644 --- a/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/Libraries/Renderer/shims/ReactNativeTypes.js @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactNativeTypes * @flow diff --git a/Libraries/Renderer/shims/ReactPerf.js b/Libraries/Renderer/shims/ReactPerf.js index e879d267a..bb6777fff 100644 --- a/Libraries/Renderer/shims/ReactPerf.js +++ b/Libraries/Renderer/shims/ReactPerf.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactPerf */ diff --git a/Libraries/Renderer/shims/ReactTypes.js b/Libraries/Renderer/shims/ReactTypes.js index 8af183188..736d1210e 100644 --- a/Libraries/Renderer/shims/ReactTypes.js +++ b/Libraries/Renderer/shims/ReactTypes.js @@ -1,10 +1,8 @@ /** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2014-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule ReactTypes * @flow diff --git a/Libraries/Renderer/shims/TouchHistoryMath.js b/Libraries/Renderer/shims/TouchHistoryMath.js index 339bfe03f..75edb24a7 100644 --- a/Libraries/Renderer/shims/TouchHistoryMath.js +++ b/Libraries/Renderer/shims/TouchHistoryMath.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule TouchHistoryMath */ diff --git a/Libraries/Renderer/shims/createReactNativeComponentClass.js b/Libraries/Renderer/shims/createReactNativeComponentClass.js index 6934beb79..d5d2b8c59 100644 --- a/Libraries/Renderer/shims/createReactNativeComponentClass.js +++ b/Libraries/Renderer/shims/createReactNativeComponentClass.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule createReactNativeComponentClass * @flow diff --git a/Libraries/Renderer/shims/takeSnapshot.js b/Libraries/Renderer/shims/takeSnapshot.js index e594b9783..00abd8917 100644 --- a/Libraries/Renderer/shims/takeSnapshot.js +++ b/Libraries/Renderer/shims/takeSnapshot.js @@ -1,10 +1,8 @@ /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule takeSnapshot */ diff --git a/package.json b/package.json index 076bc83dd..6f70f0165 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "react-native": "local-cli/wrong-react-native.js" }, "peerDependencies": { - "react": "16.0.0-rc.3" + "react": "16.0.0" }, "dependencies": { "absolute-path": "^0.0.0", @@ -202,8 +202,8 @@ "jest": "^21", "mock-fs": "^4.4.1", "prettier": "1.7.0", - "react": "16.0.0-rc.3", - "react-test-renderer": "16.0.0-rc.3", + "react": "16.0.0", + "react-test-renderer": "16.0.0", "shelljs": "^0.7.8", "sinon": "^2.2.0" }