aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js')
-rw-r--r--node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js477
1 files changed, 304 insertions, 173 deletions
diff --git a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
index 21327c077..febe1d719 100644
--- a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
+++ b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-unstable-native-dependencies.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -16,18 +16,53 @@ if (process.env.NODE_ENV !== "production") {
'use strict';
var ReactDOM = require('react-dom');
-var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
var _assign = require('object-assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
*/
+var validateFormat = function () {};
+
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
+}
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
+
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
+
{
// In DEV mode, we swap out invokeGuardedCallback for a special version
// that plays more nicely with the browser's DevTools. The idea is to preserve
@@ -57,34 +92,141 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
}
}
-var getFiberCurrentPropsFromNode = null;
-var getInstanceFromNode = null;
-var getNodeFromInstance = null;
+/**
+ * Call a function while guarding against errors that happens within it.
+ * Returns an error if it throws, otherwise null.
+ *
+ * In production, this is implemented using a try-catch. The reason we don't
+ * use a try-catch directly is so that we can swap out a different
+ * implementation in DEV mode.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
-var injection = {
- injectComponentTree: function (Injected) {
- getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
- getInstanceFromNode = Injected.getInstanceFromNode;
- getNodeFromInstance = Injected.getNodeFromInstance;
- {
- warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
+/**
+ * Same as invokeGuardedCallback, but instead of returning an error, it stores
+ * it in a global so it can be rethrown by `rethrowCaughtError` later.
+ * TODO: See if caughtError and rethrowError can be unified.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+
+
+/**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- }
-};
-function isEndish(topLevelType) {
- return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
}
-function isMoveish(topLevelType) {
- return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
-}
-function isStartish(topLevelType) {
- return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
+var warningWithoutStack$1 = warningWithoutStack;
+
+var getFiberCurrentPropsFromNode$1 = null;
+var getInstanceFromNode$1 = null;
+var getNodeFromInstance$1 = null;
+
+function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
+ getFiberCurrentPropsFromNode$1 = getFiberCurrentPropsFromNodeImpl;
+ getInstanceFromNode$1 = getInstanceFromNodeImpl;
+ getNodeFromInstance$1 = getNodeFromInstanceImpl;
+ {
+ !(getNodeFromInstance$1 && getInstanceFromNode$1) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
+ }
}
-var validateEventDispatches;
+var validateEventDispatches = void 0;
{
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
@@ -96,7 +238,7 @@ var validateEventDispatches;
var instancesIsArr = Array.isArray(dispatchInstances);
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
- warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.');
+ !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
@@ -162,7 +304,7 @@ function executeDirectDispatch(event) {
var dispatchListener = event._dispatchListeners;
var dispatchInstance = event._dispatchInstances;
!!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
- event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
+ event.currentTarget = dispatchListener ? getNodeFromInstance$1(dispatchInstance) : null;
var res = dispatchListener ? dispatchListener(event) : null;
event.currentTarget = null;
event._dispatchListeners = null;
@@ -179,15 +321,13 @@ function hasDispatches(event) {
}
// Before we know whether it is functional or class
-
-
// Root of a host tree. Could be nested inside another node.
// A subtree. Could be an entry point to a different renderer.
-var HostComponent = 5;
+var HostComponent = 7;
function getParent(inst) {
do {
- inst = inst['return'];
+ inst = inst.return;
// TODO: If this is a HostRoot we might want to bail out.
// That is depending on if we want nested subtrees (layers) to bubble
// events to their parent. We could also go through parentNode on the
@@ -267,7 +407,7 @@ function traverseTwoPhase(inst, fn, arg) {
path.push(inst);
inst = getParent(inst);
}
- var i;
+ var i = void 0;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
@@ -453,7 +593,7 @@ function shouldPreventMouseEvent(name, type, props) {
* @return {?function} The stored callback.
*/
function getListener(inst, registrationName) {
- var listener;
+ var listener = void 0;
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
@@ -462,7 +602,7 @@ function getListener(inst, registrationName) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
- var props = getFiberCurrentPropsFromNode(stateNode);
+ var props = getFiberCurrentPropsFromNode$1(stateNode);
if (!props) {
// Work in progress.
return null;
@@ -476,30 +616,6 @@ function getListener(inst, registrationName) {
}
/**
- * Allows registered plugins an opportunity to extract events from top-level
- * native browser events.
- *
- * @return {*} An accumulation of synthetic events.
- * @internal
- */
-
-
-/**
- * Enqueues a synthetic event that should be dispatched when
- * `processEventQueue` is invoked.
- *
- * @param {*} events An accumulation of synthetic events.
- * @internal
- */
-
-
-/**
- * Dispatches all synthetic events on the event queue.
- *
- * @internal
- */
-
-/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
@@ -526,7 +642,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
*/
function accumulateDirectionalDispatches(inst, phase, event) {
{
- warning(inst, 'Dispatching inst must not be null');
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
}
var listener = listenerAtPhase(inst, event, phase);
if (listener) {
@@ -602,12 +718,8 @@ function accumulateDirectDispatches(events) {
/* eslint valid-typeof: 0 */
-var didWarnForAddedNewProperty = false;
-var isProxySupported = typeof Proxy === 'function';
var EVENT_POOL_SIZE = 10;
-var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
-
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -616,7 +728,9 @@ var EventInterface = {
type: null,
target: null,
// currentTarget is set when dispatching; no use in copying it here
- currentTarget: emptyFunction.thatReturnsNull,
+ currentTarget: function () {
+ return null;
+ },
eventPhase: null,
bubbles: null,
cancelable: null,
@@ -627,6 +741,14 @@ var EventInterface = {
isTrusted: null
};
+function functionThatReturnsTrue() {
+ return true;
+}
+
+function functionThatReturnsFalse() {
+ return false;
+}
+
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
@@ -651,6 +773,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
+ delete this.isDefaultPrevented;
+ delete this.isPropagationStopped;
}
this.dispatchConfig = dispatchConfig;
@@ -679,11 +803,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
} else {
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
+ this.isDefaultPrevented = functionThatReturnsFalse;
}
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
@@ -700,7 +824,7 @@ _assign(SyntheticEvent.prototype, {
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
},
stopPropagation: function () {
@@ -720,7 +844,7 @@ _assign(SyntheticEvent.prototype, {
event.cancelBubble = true;
}
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
+ this.isPropagationStopped = functionThatReturnsTrue;
},
/**
@@ -729,7 +853,7 @@ _assign(SyntheticEvent.prototype, {
* won't be added back into the pool.
*/
persist: function () {
- this.isPersistent = emptyFunction.thatReturnsTrue;
+ this.isPersistent = functionThatReturnsTrue;
},
/**
@@ -737,7 +861,7 @@ _assign(SyntheticEvent.prototype, {
*
* @return {boolean} True if this should not be released, false otherwise.
*/
- isPersistent: emptyFunction.thatReturnsFalse,
+ isPersistent: functionThatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
@@ -749,13 +873,19 @@ _assign(SyntheticEvent.prototype, {
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
}
}
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
- this[shouldBeReleasedProperties[i]] = null;
- }
+ this.dispatchConfig = null;
+ this._targetInst = null;
+ this.nativeEvent = null;
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
+ this._dispatchListeners = null;
+ this._dispatchInstances = null;
{
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
}
}
});
@@ -764,53 +894,27 @@ SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
- *
- * @param {function} Class
- * @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function (Class, Interface) {
+SyntheticEvent.extend = function (Interface) {
var Super = this;
var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();
+ function Class() {
+ return Super.apply(this, arguments);
+ }
_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = _assign({}, Super.Interface, Interface);
- Class.augmentClass = Super.augmentClass;
+ Class.extend = Super.extend;
addEventPoolingTo(Class);
-};
-/** Proxying after everything set on SyntheticEvent
- * to resolve Proxy issue on some WebKit browsers
- * in which some Event properties are set to undefined (GH#10010)
- */
-{
- if (isProxySupported) {
- /*eslint-disable no-func-assign */
- SyntheticEvent = new Proxy(SyntheticEvent, {
- construct: function (target, args) {
- return this.apply(target, Object.create(target.prototype), args);
- },
- apply: function (constructor, that, args) {
- return new Proxy(constructor.apply(that, args), {
- set: function (target, prop, value) {
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
- warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.');
- didWarnForAddedNewProperty = true;
- }
- target[prop] = value;
- return true;
- }
- });
- }
- });
- /*eslint-enable no-func-assign */
- }
-}
+ return Class;
+};
addEventPoolingTo(SyntheticEvent);
@@ -844,7 +948,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
function warn(action, result) {
var warningCondition = false;
- warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
@@ -860,7 +964,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
function releasePooledEvent(event) {
var EventConstructor = this;
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
event.destructor();
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
EventConstructor.eventPool.push(event);
@@ -873,30 +977,45 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent;
}
-var SyntheticEvent$1 = SyntheticEvent;
-
/**
* `touchHistory` isn't actually on the native event, but putting it in the
* interface will ensure that it is cleaned up when pooled/destroyed. The
* `ResponderEventPlugin` will populate it appropriately.
*/
-var ResponderEventInterface = {
+var ResponderSyntheticEvent = SyntheticEvent.extend({
touchHistory: function (nativeEvent) {
return null; // Actually doesn't even look at the native event.
}
-};
+});
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native event.
- * @extends {SyntheticEvent}
- */
-function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+// Note: ideally these would be imported from DOMTopLevelEventTypes,
+// but our build system currently doesn't let us do that from a fork.
+
+var TOP_TOUCH_START = 'touchstart';
+var TOP_TOUCH_MOVE = 'touchmove';
+var TOP_TOUCH_END = 'touchend';
+var TOP_TOUCH_CANCEL = 'touchcancel';
+var TOP_SCROLL = 'scroll';
+var TOP_SELECTION_CHANGE = 'selectionchange';
+var TOP_MOUSE_DOWN = 'mousedown';
+var TOP_MOUSE_MOVE = 'mousemove';
+var TOP_MOUSE_UP = 'mouseup';
+
+function isStartish(topLevelType) {
+ return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
}
-SyntheticEvent$1.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
+function isMoveish(topLevelType) {
+ return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
+}
+
+function isEndish(topLevelType) {
+ return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL || topLevelType === TOP_MOUSE_UP;
+}
+
+var startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
+var moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
+var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
/**
* Tracks the position and time of each active touch by `touch.identifier`. We
@@ -961,7 +1080,7 @@ function getTouchIdentifier(_ref) {
!(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
{
- warning(identifier <= MAX_TOUCH_BANK, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK);
+ !(identifier <= MAX_TOUCH_BANK) ? warningWithoutStack$1(false, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
}
return identifier;
}
@@ -1049,7 +1168,7 @@ var ResponderTouchHistoryStore = {
}
{
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
- warning(activeRecord != null && activeRecord.touchActive, 'Cannot find single active touch.');
+ !(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
}
}
}
@@ -1098,11 +1217,6 @@ var responderInst = null;
*/
var trackedTouchCount = 0;
-/**
- * Last reported number of active touches.
- */
-var previousActiveTouches = 0;
-
var changeResponder = function (nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst;
responderInst = nextResponderInst;
@@ -1120,7 +1234,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onStartShouldSetResponder',
captured: 'onStartShouldSetResponderCapture'
- }
+ },
+ dependencies: startDependencies
},
/**
@@ -1136,7 +1251,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onScrollShouldSetResponder',
captured: 'onScrollShouldSetResponderCapture'
- }
+ },
+ dependencies: [TOP_SCROLL]
},
/**
@@ -1150,7 +1266,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onSelectionChangeShouldSetResponder',
captured: 'onSelectionChangeShouldSetResponderCapture'
- }
+ },
+ dependencies: [TOP_SELECTION_CHANGE]
},
/**
@@ -1161,22 +1278,45 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onMoveShouldSetResponder',
captured: 'onMoveShouldSetResponderCapture'
- }
+ },
+ dependencies: moveDependencies
},
/**
* Direct responder events dispatched directly to responder. Do not bubble.
*/
- responderStart: { registrationName: 'onResponderStart' },
- responderMove: { registrationName: 'onResponderMove' },
- responderEnd: { registrationName: 'onResponderEnd' },
- responderRelease: { registrationName: 'onResponderRelease' },
+ responderStart: {
+ registrationName: 'onResponderStart',
+ dependencies: startDependencies
+ },
+ responderMove: {
+ registrationName: 'onResponderMove',
+ dependencies: moveDependencies
+ },
+ responderEnd: {
+ registrationName: 'onResponderEnd',
+ dependencies: endDependencies
+ },
+ responderRelease: {
+ registrationName: 'onResponderRelease',
+ dependencies: endDependencies
+ },
responderTerminationRequest: {
- registrationName: 'onResponderTerminationRequest'
+ registrationName: 'onResponderTerminationRequest',
+ dependencies: []
},
- responderGrant: { registrationName: 'onResponderGrant' },
- responderReject: { registrationName: 'onResponderReject' },
- responderTerminate: { registrationName: 'onResponderTerminate' }
+ responderGrant: {
+ registrationName: 'onResponderGrant',
+ dependencies: []
+ },
+ responderReject: {
+ registrationName: 'onResponderReject',
+ dependencies: []
+ },
+ responderTerminate: {
+ registrationName: 'onResponderTerminate',
+ dependencies: []
+ }
};
/**
@@ -1370,7 +1510,7 @@ to return true:wantsResponderID| |
*/
function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === 'topSelectionChange' ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
+ var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
// TODO: stop one short of the current responder.
var bubbleShouldSetFrom = !responderInst ? targetInst : getLowestCommonAncestor(responderInst, targetInst);
@@ -1395,7 +1535,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
if (!wantsResponderInst || wantsResponderInst === responderInst) {
return null;
}
- var extracted;
+ var extracted = void 0;
var grantEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget);
grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
@@ -1442,7 +1582,7 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
// responderIgnoreScroll: We are trying to migrate away from specifically
// tracking native scroll events here and responderIgnoreScroll indicates we
// will send topTouchCancel to handle canceling touch events instead
- topLevelType === 'topScroll' && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === 'topSelectionChange' || isStartish(topLevelType) || isMoveish(topLevelType));
+ topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE || isStartish(topLevelType) || isMoveish(topLevelType));
}
/**
@@ -1462,7 +1602,7 @@ function noResponderTouches(nativeEvent) {
var target = activeTouch.target;
if (target !== null && target !== undefined && target !== 0) {
// Is the original touch location inside of the current responder?
- var targetInst = getInstanceFromNode(target);
+ var targetInst = getInstanceFromNode$1(target);
if (isAncestor(responderInst, targetInst)) {
return false;
}
@@ -1521,7 +1661,7 @@ var ResponderEventPlugin = {
extracted = accumulate(extracted, gesture);
}
- var isResponderTerminate = responderInst && topLevelType === 'topTouchCancel';
+ var isResponderTerminate = responderInst && topLevelType === TOP_TOUCH_CANCEL;
var isResponderRelease = responderInst && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
if (finalTouch) {
@@ -1532,17 +1672,10 @@ var ResponderEventPlugin = {
changeResponder(null);
}
- var numberActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
- if (ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches) {
- ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches);
- }
- previousActiveTouches = numberActiveTouches;
-
return extracted;
},
GlobalResponderHandler: null,
- GlobalInteractionHandler: null,
injection: {
/**
@@ -1552,29 +1685,27 @@ var ResponderEventPlugin = {
*/
injectGlobalResponderHandler: function (GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
- },
-
- /**
- * @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
- * Object that handles any change in the number of active touches.
- */
- injectGlobalInteractionHandler: function (GlobalInteractionHandler) {
- ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
}
}
};
-// This is used by react-native-web.
-var injectComponentTree = injection.injectComponentTree;
// Inject react-dom's ComponentTree into this module.
-var ReactDOMComponentTree = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree;
+// Keep in sync with ReactDOM.js and ReactTestUtils.js:
+var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
+var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
+var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
+var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
+var injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
+
+
+setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
+
-injectComponentTree(ReactDOMComponentTree);
var ReactDOMUnstableNativeDependencies = Object.freeze({
- injectComponentTree: injectComponentTree,
ResponderEventPlugin: ResponderEventPlugin,
- ResponderTouchHistoryStore: ResponderTouchHistoryStore
+ ResponderTouchHistoryStore: ResponderTouchHistoryStore,
+ injectEventPluginsByName: injectEventPluginsByName
});
var unstableNativeDependencies = ReactDOMUnstableNativeDependencies;