/** * Copyright 2013-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. * * @noflow * @providesModule ReactNativeFiber-dev */ "use strict"; __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) { return !0; }, showDialog = defaultShowDialog; function logCapturedError(capturedError) { if (!1 !== showDialog(capturedError)) { var componentName = (capturedError.error, capturedError.componentName), componentStack = capturedError.componentStack, errorBoundaryName = capturedError.errorBoundaryName, errorBoundaryFound = capturedError.errorBoundaryFound, willRetry = capturedError.willRetry, componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:", errorBoundaryMessage = void 0; errorBoundaryMessage = errorBoundaryFound && errorBoundaryName ? willRetry ? "React will try to recreate this component tree from scratch " + "using the error boundary you provided, " + errorBoundaryName + "." : "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree." : "Consider adding an error boundary to your tree to customize error handling behavior.\n" + "You can learn more about error boundaries at https://fb.me/react-error-boundaries."; var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + errorBoundaryMessage; console.error(combinedMessage); } } var injection = { injectDialog: function(fn) { invariant(showDialog === defaultShowDialog, "The custom dialog was already injected."), invariant("function" == typeof fn, "Injected showDialog() must be a function."), showDialog = fn; } }, logCapturedError_1 = logCapturedError, ReactFiberErrorLogger = { injection: injection, logCapturedError: logCapturedError_1 }, ReactErrorUtils = { _caughtError: null, _hasCaughtError: !1, _rethrowError: null, _hasRethrowError: !1, injection: { injectErrorUtils: function(injectedErrorUtils) { invariant("function" == typeof injectedErrorUtils.invokeGuardedCallback, "Injected invokeGuardedCallback() must be a function."), invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback; } }, invokeGuardedCallback: function(name, func, context, a, b, c, d, e, f) { invokeGuardedCallback.apply(ReactErrorUtils, arguments); }, invokeGuardedCallbackAndCatchFirstError: function(name, func, context, a, b, c, d, e, f) { if (ReactErrorUtils.invokeGuardedCallback.apply(this, arguments), ReactErrorUtils.hasCaughtError()) { var error = ReactErrorUtils.clearCaughtError(); ReactErrorUtils._hasRethrowError || (ReactErrorUtils._hasRethrowError = !0, ReactErrorUtils._rethrowError = error); } }, rethrowCaughtError: function() { return rethrowCaughtError.apply(ReactErrorUtils, arguments); }, hasCaughtError: function() { return ReactErrorUtils._hasCaughtError; }, clearCaughtError: function() { if (ReactErrorUtils._hasCaughtError) { var error = ReactErrorUtils._caughtError; return ReactErrorUtils._caughtError = null, ReactErrorUtils._hasCaughtError = !1, error; } invariant(!1, "clearCaughtError was called but no error was captured. This error " + "is likely caused by a bug in React. Please file an issue."); } }, invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { ReactErrorUtils._hasCaughtError = !1, ReactErrorUtils._caughtError = null; var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { ReactErrorUtils._caughtError = error, ReactErrorUtils._hasCaughtError = !0; } }; if ("undefined" != typeof window && "function" == typeof window.dispatchEvent && "undefined" != typeof document && "function" == typeof document.createEvent) { var fakeNode = document.createElement("react"); invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { var didError = !0, funcArgs = Array.prototype.slice.call(arguments, 3); function callCallback() { fakeNode.removeEventListener(evtType, callCallback, !1), func.apply(context, funcArgs), didError = !1; } var error = void 0, didSetError = !1, isCrossOriginError = !1; function onError(event) { error = event.error, didSetError = !0, null === error && 0 === event.colno && 0 === event.lineno && (isCrossOriginError = !0); } var evtType = "react-" + (name || "invokeguardedcallback"); window.addEventListener("error", onError), fakeNode.addEventListener(evtType, callCallback, !1); var evt = document.createEvent("Event"); evt.initEvent(evtType, !1, !1), fakeNode.dispatchEvent(evt), didError ? (didSetError ? isCrossOriginError && (error = new Error("A cross-origin error was thrown. React doesn't have access to " + "the actual error because it catches errors using a global " + 'error handler, in order to preserve the "Pause on exceptions" ' + "behavior of the DevTools. This is only an issue in DEV-mode; " + "in production, React uses a normal try-catch statement.\n\n" + "If you are using React from a CDN, ensure that the