Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump 0.49 to React 16 #19274

Merged
merged 3 commits into from May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
@@ -1 +1 @@
c3718c48f01fa6c2e04bd47226061769484c951b
589c0a25dfa18c2090549cc6f5b626d69ea53c2a
620 changes: 74 additions & 546 deletions Libraries/Renderer/ReactNativeFiber-dev.js

Large diffs are not rendered by default.

129 changes: 29 additions & 100 deletions 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
Expand Down Expand Up @@ -170,13 +168,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);
}
}

Expand All @@ -191,18 +185,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;
Expand All @@ -218,9 +206,6 @@ function batchedUpdatesWithControlledComponents(fn, bookkeeping) {
}

var ReactGenericBatchingInjection = {
injectStackBatchedUpdates: function(_batchedUpdates) {
stackBatchedUpdates = _batchedUpdates;
},
injectFiberBatchedUpdates: function(_batchedUpdates) {
fiberBatchedUpdates = _batchedUpdates;
}
Expand Down Expand Up @@ -260,25 +245,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];
}
Expand All @@ -305,9 +275,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 = {
Expand Down Expand Up @@ -526,16 +494,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 = {
Expand Down Expand Up @@ -726,7 +687,7 @@ var popContextProvider_1 = popContextProvider, pushTopLevelContextObject = funct
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;
Expand All @@ -745,7 +706,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);
Expand Down Expand Up @@ -958,11 +919,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;
Expand Down Expand Up @@ -2552,27 +2513,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, performWithPriority = _ReactFiberScheduler.performWithPriority, batchedUpdates = _ReactFiberScheduler.batchedUpdates, unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates, flushSync = _ReactFiberScheduler.flushSync, deferredUpdates = _ReactFiberScheduler.deferredUpdates;
function scheduleTopLevelUpdate(current, element, callback) {
Expand All @@ -2587,7 +2535,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);
},
Expand Down Expand Up @@ -2915,11 +2863,7 @@ getInspectorDataForViewTag = function() {

var ReactNativeFiberInspector = {
getInspectorDataForViewTag: getInspectorDataForViewTag
}, ReactVersion = "16.0.0-beta.5", ReactNativeFeatureFlags = require("ReactNativeFeatureFlags"), injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) {
return ReactNativeFiberRenderer.findHostInstance(fiber);
} : function(instance) {
return instance;
};
}, ReactVersion = "16.0.0";

function findNodeHandle(componentOrHandle) {
if (null == componentOrHandle) return null;
Expand Down Expand Up @@ -3037,22 +2981,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 type %s", 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++) {
Expand All @@ -3076,14 +3009,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) {
Expand Down
8 changes: 3 additions & 5 deletions 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
Expand Down
8 changes: 3 additions & 5 deletions 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
Expand Down
8 changes: 3 additions & 5 deletions 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
*/
Expand Down
8 changes: 3 additions & 5 deletions 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
*/
Expand Down
6 changes: 2 additions & 4 deletions 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
Expand Down
17 changes: 17 additions & 0 deletions Libraries/Renderer/shims/ReactNativeBridgeEventPlugin.js
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule ReactNativeBridgeEventPlugin
*/

'use strict';

const {
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
} = require('ReactNative');

module.exports =
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactNativeBridgeEventPlugin;
8 changes: 3 additions & 5 deletions 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
Expand Down
8 changes: 3 additions & 5 deletions 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
Expand Down
6 changes: 2 additions & 4 deletions 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
Expand Down
8 changes: 3 additions & 5 deletions 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
*/
Expand Down