From 8879e3135ee149cfec3dd46b6ffb24a619dcdbd3 Mon Sep 17 00:00:00 2001 From: Tom Underhill Date: Tue, 28 Apr 2020 11:49:15 -0700 Subject: [PATCH] Merge react-native 0.61-stable (#323) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Expose JS Responder handler in Scheduler API Summary: This diff implements the JSResponderHandler methods in the core of RN (scheduler API and friends) Reviewed By: ejanzer Differential Revision: D16543437 fbshipit-source-id: dac03e30c4330d182ecf134f3174ba942dbf7289 * Implement JS Responder Handler in Fabric Android Summary: This diff implements the JSResponderHandler in Fabric Android code Reviewed By: JoshuaGross Differential Revision: D16543438 fbshipit-source-id: 13680f77a5368e8ba1180383a5f9fb7d7330b90a * Implement JNI code to invoke Android JSResponder methods from C++ Summary: This diff implements the JNI code required for Android to receive JSResponderHandler calls Reviewed By: JoshuaGross, makovkastar Differential Revision: D16543431 fbshipit-source-id: 38cff16a05633fccefa201b189d761d503a9b839 * Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands Summary: `codegenNativeCommands` returns an object with functions for each command that has the previous behavior inside the React Renderer, and the new Fabric logic inside of the Fabric React Native Renderer. Changelog: [Internal] - Change AndroidDrawerLayoutNativeComponent to use JS codegen for commands Reviewed By: rickhanlonii Differential Revision: D16529887 fbshipit-source-id: 24a5307944a7f62e18482d60d26052fea3be2051 * Update commands transform to use helper Summary: This uses a new helper called `dispatchCommand` that now exists on the renderer. This was added to the renderer here: https://github.com/facebook/react/pull/16085 In Paper it calls UIManager.dispatchViewManagerCommand and in Fabric it calls the c++ Fabric UIManager Reviewed By: rickhanlonii Differential Revision: D16578708 fbshipit-source-id: 30f9468a7fd48afb506c0ee49a460b949bc863a1 * Delete jsi::Functions before jsi::Runtime gets deleted Summary: ## The Problem 1. `CatalystInstanceImpl` indirectly holds on to the `jsi::Runtime`. When you destroy `CatalystInstanceImpl`, you destroy the `jsi::Runtime`. As a part of reloading React Native, we destroy and re-create `CatalystInstanceImpl`, which destroys and re-creates the `jsi::Runtime`. 2. When JS passes in a callback to a TurboModule method, we take that callback (a `jsi::Function`) and wrap it in a Java `Callback` (implemented by `JCxxCallbackImpl`). This Java `Callback`, when executed, schedules the `jsi::Function` to be invoked on a Java thread at a later point in time. **Note:** The Java NativeModule can hold on to the Java `Callback` (and, by transitivity, the `jsi::Function`) for potentially forever. 3. It is a requirement of `jsi::Runtime` that all objects associated with the Runtime (ex: `jsi::Function`) must be destroyed before the Runtime itself is destroyed. See: https://fburl.com/m3mqk6wt ### jsi.h ``` /// .................................................... In addition, to /// make shutdown safe, destruction of objects associated with the Runtime /// must be destroyed before the Runtime is destroyed, or from the /// destructor of a managed HostObject or HostFunction. Informally, this /// means that the main source of unsafe behavior is to hold a jsi object /// in a non-Runtime-managed object, and not clean it up before the Runtime /// is shut down. If your lifecycle is such that avoiding this is hard, /// you will probably need to do use your own locks. class Runtime { public: virtual ~Runtime(); ``` Therefore, when you delete `CatalystInstanceImpl`, you could end up with a situation where the `jsi::Runtime` is destroyed before all `jsi::Function`s are destroyed. In dev, this leads the program to crash when you reload the app after having used a TurboModule method that uses callbacks. ## The Solution If the only reference to a `HostObject` or a `HostFunction` is in the JS Heap, then the `HostObject` and `HostFunction` destructors can destroy JSI objects. The TurboModule cache is the only thing, aside from the JS Heap, that holds a reference to all C++ TurboModules. But that cache (and the entire native side of `TurboModuleManager`) is destroyed when we call `mHybridData.resetNative()` in `TurboModuleManager.onCatalystInstanceDestroy()` in D16552730. (I verified this by commenting out `mHybridData.resetNative()` and placing a breakpoint in the destructor of `JavaTurboModule`). So, when we're cleaning up `TurboModuleManager`, the only reference to a Java TurboModule is the JS Heap. Therefore, it's safe and correct for us to destroy all `jsi::Function`s created by the Java TurboModule in `~JavaTurboModule`. So, in this diff, I keep a set of all `CallbackWrappers`, and explicitly call `destroy()` on them in the `JavaTurboModule` destructor. Note that since `~JavaTurboModule` accesses `callbackWrappers_`, it must be executed on the JS Thread, since `createJavaCallbackFromJSIFunction` also accesses `callbackWrappers_` on the JS Thread. For additional safety, I also eagerly destroyed the `jsi::Function` after it's been invoked once. I'm not yet sure if we only want JS callbacks to only ever be invoked once. So, I've created a Task to document this work: T48128233. Reviewed By: mdvacca Differential Revision: D16623340 fbshipit-source-id: 3a4c3efc70b9b3c8d329f19fdf4b4423c489695b * Fix missing rotateZ to useAnimatedDriver Whitelist (#25938) Summary: Added missing property to whitelist ## Changelog [General] [Fixed] - Fixed rotateZ native animation Pull Request resolved: https://github.com/facebook/react-native/pull/25938 Differential Revision: D16645798 Pulled By: cpojer fbshipit-source-id: ef74d7230fa80068dcceaaff841af27365df92e9 * Back out "[react-native][PR] Allow Animation EndResult callback to return Promise" Summary: Original commit changeset: 420d29d262b6 Reverts https://github.com/facebook/react-native/pull/25793 / D16515465 Union type property is not supported by codegen. We don't want to support unions yet and because the improvement is not that big and not yet published as stable for OSS (neither used anywhere internally) we can safely revert it. Reviewed By: RSNara Differential Revision: D16621228 fbshipit-source-id: 2fa416eef1ae353990860026ca97d2b0b429a852 * Switch Platform Constansts to use typedConstants structs Summary: It's actually the first module in OSS which is typed with taking advantages of codegen. Reviewed By: RSNara Differential Revision: D16620334 fbshipit-source-id: 65d6656506f2a4c68d493939ecfa65ba975abead * Fixed android bounding box (#25836) Summary: This PR fixes https://github.com/facebook/react-native/issues/19637. Summary of the issue: on Android, transformed touchables have press issues because the touchable's measurements are incorrect in the release phase. `UIManager.measure()` returns an incorrect size and position as explained [here](https://github.com/facebook/react-native/issues/19637#issuecomment-396065914) This is easily seen with the inspector : **Screenshot of a { scale: 2 } transform** The real view (scaled) is in pink, the incorrect touchable area is in blue. **Screenshot of a { rotateZ: "-45deg" } transform** The real view (rotated) is in pink, the incorrect touchable area is in blue. ## Changelog [Android] [Fixed] - Fix UIManager.measure() Pull Request resolved: https://github.com/facebook/react-native/pull/25836 Test Plan: Android now produces the same results as iOS as seen on these screenshots | Android without fix | Android with fix | iOS | | --- | --- | --- | | ![Screenshot_1564133103](https://user-images.githubusercontent.com/110431/61941632-28729b00-af98-11e9-9706-b13968b79df5.png) | ![Screenshot_1564130198](https://user-images.githubusercontent.com/110431/61941631-28729b00-af98-11e9-9ff3-5f2748077dbe.png) | ![Simulator Screen Shot - iPhone X - 2019-07-26 at 11 19 34](https://user-images.githubusercontent.com/110431/61941633-28729b00-af98-11e9-8dc4-22b61178242e.png) | Reviewed By: cpojer Differential Revision: D16598914 Pulled By: makovkastar fbshipit-source-id: d56b008b717ea17731fb09001cbd395aa1b044fe * Fix crash when tapping full screen button on video ad Summary: Fragment was assigned incorrect `tag` and `surfaceID` (`surfaceID` is the important one). Wrong `surfaceID` means that `navigationCoordinator` is never resolved. As a result of navigationCoordinator not being assigned, tapping a video ad on Marketplace results in showing video ad overlay rather than showing full screen video. Reviewed By: JoshuaGross Differential Revision: D16646492 fbshipit-source-id: 0da5c56ecb7c81e9f4a9469a3626ccd430a01558 * Pop frames correctly in console.error handler Reviewed By: cpojer Differential Revision: D16648992 fbshipit-source-id: 4581e2cd6859f27bc384fc3ab328ab5b9414c704 * Fix up NativeDialogManagerAndroid PR Summary: This diff has three changes: 1. Remove all references to `Stringish` from `NativeDialogManagerAndroid`. (All Fbt objects expose a `.toString` method we could call). 2. Make sure that we only access `DialogManagerAndroid` through `NativeDialogManagerAndroid`. 3. Removed a bunch of `$FlowFixMes` in the files I touched. Probably not the best idea to bite into this cleanup on this diff, but what's done is done. Since this diff is fairly large, I've commented on parts of it I thought were note-worthy. I've also commented on the changes I had to make to fix flow after removing the `$FlowFixMe`s. Reviewed By: PeteTheHeat Differential Revision: D16428855 fbshipit-source-id: 0e6daf2957f4b086ebb1e78e0a59930668c65576 * Bump hermes to v0.1.1 (#25908) Summary: Hermes has been updated to [v0.1.1](https://github.com/facebook/hermes/releases/tag/v0.1.1) and [renamed from 'hermesvm' to 'hermes-engine'](https://github.com/facebook/hermes/commit/c74842ee5c4d11dc9fe3bf012f97a0e3fde6d54f) ## Changelog [Android] [Changed] - Bump hermes to v0.1.1 Pull Request resolved: https://github.com/facebook/react-native/pull/25908 Test Plan: RNTester builds and runs as expected Differential Revision: D16645811 Pulled By: cpojer fbshipit-source-id: 4fb6a3160df2c6d08140dd1fee51acf9ff8baffc * Fabric PerfLogger: prevent ConcurrentModificationException Summary: Some surfaces throw ConcurrentModificationException when logging detailed perf for Fabric. I've refactored the ReactMarker class to use a threadsafe ArrayList and removed synchronization, which is safer and should improve perf everywhere the markers are used, even if there are zero listeners. Reviewed By: mdvacca Differential Revision: D16656139 fbshipit-source-id: 34572f9ad19028a273e0837b0b895c5e8a47976a * iOS fixed up inconsistent boolean convertion logic in RCTPlatform Summary: For some reason the conversion from a BOOL object to `bool` (C++ style) may lead to incorrect boolean value. This fixes the value provided to the builder to be of `bool` type instead. Reviewed By: JoshuaGross Differential Revision: D16657766 fbshipit-source-id: b66922aceadd20d16226a07f73b24ee0a3b825dc * Add ErrorUtils to global variables (#25947) Summary: ErrorUtils is giving an error by eslint. ('ErrorUtils is not defined'). ## Changelog [General] [Fixed] - Add ErrorUtils to eslint globals Pull Request resolved: https://github.com/facebook/react-native/pull/25947 Test Plan: Run eslint on a react native project using ErrorUtils. Eslint verification should pass. Differential Revision: D16666163 Pulled By: cpojer fbshipit-source-id: c20c4e21fe06c6863dcfc167d6d03c6217ae1235 * Update App.js (#25905) Summary: use "shorthand" of `Fragment` No need to import `Fragment` as it can be used via `<>` vs `` ## Changelog Use shorthand for Fragment in App.js [General] [Changed] - Use shorthand for Fragment in App.js Pull Request resolved: https://github.com/facebook/react-native/pull/25905 Test Plan: Ci Tests should be sufficient Differential Revision: D16666166 Pulled By: cpojer fbshipit-source-id: 70e2c9793087bf8f5e0a5477c75f178134cbd6a1 * Fix error string in codegenNativeComponent Summary: This diff fixes the error message in the codegenNativeComponent fallback Reviewed By: TheSavior Differential Revision: D16579775 fbshipit-source-id: 176f81ea91e11f671407a5e5e5b000c4b83f93b2 * Remove outdated React async component check Summary: I added this check [a couple of years ago](https://github.com/facebook/react-native/commit/1b22d49ae8945680dee4fd01e3fbb78b1e443e01) to mimic how [React used to check for async roots](https://github.com/facebook/react/blob/acabf112454e5545205da013266d8529599a2a82/packages/react-reconciler/src/ReactFiberReconciler.js#L321-L330). This code doesn't make sense anymore since there's neither an async base class or an `unstable_ConcurrentMode` export, so I'm just cleaning it up. Reviewed By: threepointone, sebmarkbage Differential Revision: D16668567 fbshipit-source-id: 5ccf5feccc4b65ffb3aeb0a09891d8be7490df26 * Add tests for codegenNativeComponent Summary: Adds tests for codegenNativeComponent Reviewed By: TheSavior Differential Revision: D16582627 fbshipit-source-id: 3527126c7838f3e2c0c56b19956c618f0a7fb9f9 * Update loading pre-bundled message Summary: Updated the message from > Loading from pre-bundled file to > Connect to Metro to develop JavaScript I also added a new RCT_PACKAGER_NAME so other packagers can override "Metro" Reviewed By: yungsters, cpojer Differential Revision: D16427501 fbshipit-source-id: 1b7f9e261f7521ba930c6248087fe6f3c3659cb7 * Add $FlowFixMeEmpty to suppressions in RN's .github.flowconfig Summary: The types-first codemod adds a few of these, so need to sync the suppressions here with the ones in xplat/js/.flowconfig Reviewed By: jbrown215 Differential Revision: D16690168 fbshipit-source-id: 49d3f80a4ab24badf11a9ac54abfe49670989a91 * Add portable bit field implementation Summary: @public Our usage of C++ bit fields has lead to quite some problems with different compiler setups. Problems include sign bits, alignment, etc. Here we introduce a portable implementation as a variadic template, allowing the user to store a number of booleans and enums (defined with `YG_ENUM_SEQ_DECL`) in an unsigned integer type of their choice. This will replace all usages of bit fields across the Yoga code base. Differential Revision: D16647801 fbshipit-source-id: 230ffab500885a3ad662ea8f19e35a5e9357a563 * Remove style property bitmask Summary: @public Removes the style properties bitmask. We have used this for experimentation, and it's no longer necessary. This simplifyies the code, and allows us to cut over to `Bitfield.h` more easily. Reviewed By: astreet Differential Revision: D16648862 fbshipit-source-id: 17c0899807af976f4ba34db54f8f0f6a3cd92519 * Use `Bitfield` in `YGNode` and `YGStyle` Summary: @public Replaces the usage of C++ bitfields with our portable `Bitfield` class. Reviewed By: SidharthGuglani Differential Revision: D16649875 fbshipit-source-id: 539f016d5e1c9a8c48cc9bacbbf6ed985e385e69 * Use `Bitfield` in `YGLayout` Summary: Replaces the usage of C++ bitfields with our portable `Bitfield` class. Reviewed By: SidharthGuglani Differential Revision: D16656361 fbshipit-source-id: 05f679e2e994e109b2bd1090c879d6850fabdc40 * Back out "[Yoga] Experiment: double invocations of measure callbacks" Summary: Removes the double measure callbacks experiment Original commit changesets: c6cf9c01a173, b157d8137c72 Reviewed By: SidharthGuglani Differential Revision: D16687367 fbshipit-source-id: 9649f8731bd1b27f4d291cee4fa30153165cea02 * Don't copy children in YGNodeComputeFlexBasisForChildren (#919) Summary: No need for a copy here. Pull Request resolved: https://github.com/facebook/yoga/pull/919 Differential Revision: D16701461 Pulled By: davidaurelio fbshipit-source-id: 3a90adbb2b5c43d5aefe693a8525aa3a37e53b3d * React edit text changes (#25964) Summary: Changing showSoftKeyboard and hideSoftKeyboard to be protected, as we need this change for an internal control that extends ReactEditText. ## Changelog [Android] [Changed] - part of our react native platform, we have a control that extends ReactEditText and we need to be able to override these 2 methods. Pull Request resolved: https://github.com/facebook/react-native/pull/25964 Test Plan: The change has been in Microsoft's branch of RN for almost 2 years, and since it's a relatively small change we've done a quick sanity check in RNTester prior to this PR, making sure the TextInput page loads fine and it's functional. Differential Revision: D16686878 Pulled By: cpojer fbshipit-source-id: 63035ee9c58e93bc0fa40e5bec318df05322c6c5 * Fix Fast Refresh on Fabric Summary: Brings in https://github.com/facebook/react/pull/16302. We were passing roots to a wrong renderer, hence a confusing Fabric-only crash. Reviewed By: JoshuaGross Differential Revision: D16672454 fbshipit-source-id: 115894eb375b50da09d145c57f15c7d5668b926d * iOS: Revert RCT->RN prefix renaming to avoid confusion Summary: The previous rename from RCT->RN prefix ended up causing some confusions on which prefix to use for which files and under what circumstances. To avoid further confusion before we're done with the re-architecture project, let's keep them as RCT. Reviewed By: mdvacca Differential Revision: D16705566 fbshipit-source-id: 395bff771c84e5ded6b2261a84c7549df1e6c5e5 * use array for passing measure callback reasons count Summary: Use an array for counting measure callbacks due to each reason. and this is now added as qpl metadata in Layout Calculation qpl event Reviewed By: davidaurelio Differential Revision: D16666786 fbshipit-source-id: ff85fba835148f06b9c5d90c4604e552a813777a * Commands codegen: added RCT prefix for protocols, extern C functions, and file names Summary: This will provide consistency with the rest of ObjC/ObjC++ files throughout RN codebase, which is also part of the iOS engineering practice to have a prefix. Highlights: * This only affects the `protocol` and extern C functions, and the .h output file name * Other C++ only file/classes are not affected * The assumption is that the RCT prefix is only for iOS specific files/names. The JS component name should **NOT** have any prefix in the long term (some of them still have RCT prefix in the name, which was an artifact of legacy inconsistency). * The RCT prefix is not relevant to Java/JNI code, since they have their own convention Reviewed By: TheSavior, mdvacca Differential Revision: D16661286 fbshipit-source-id: b8dd75fa7f176d6658183f225b27db017b4b55e7 * Add support for casting codegenNativeComponent Summary: Adds support for casting the codegenNativeComponent export Reviewed By: TheSavior Differential Revision: D16676207 fbshipit-source-id: 5e874bd5a72eb7e67e05b0f671856ae3319a335e * Format code in ReactCommon/turbomodule/core Summary: Just ran `arc f ReactCommon/turbomodule/core/**/*`. Reviewed By: ejanzer Differential Revision: D16691807 fbshipit-source-id: 3f499ffeffaae47bda550c0071c93cd7f48e2a23 * Refactor TextInput.js passes strings to Java for autoCapitalize Summary: We are working to remove constants from the view configs. On June 21st I modified native to support both numbers and strings. D15911323 Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D16697916 fbshipit-source-id: f346f37b2e664c2dd49e2a1308a0517f50284e4d * Minor improvements in native modules codegens Summary: Add handling of `$ReadOnly`, $ReadOnlyArray`. Drop handling of params for callback (does not impact native generated node) and promises' types (does not impact native generated node). Remove typo from native codegen. Reviewed By: RSNara Differential Revision: D16686886 fbshipit-source-id: 26345978bbbba0cee14d00e7b5b9e5017c89a46c * Add handling of nullable return value Summary: Retuned value can be nullable and it need to be handled Reviewed By: RSNara Differential Revision: D16687359 fbshipit-source-id: 7869c4e2b1da69b680b6eade3c88e0558077b705 * fallback not understandable types from methods to object Summary: We don't want to make our codegen breaking if type is not existing. In order to it we can always fallback to Object. That's how it currently works in old codegen #Facebook Thare're few places in our internal code where we use `Map` or tuple in these cases Reviewed By: RSNara Differential Revision: D16687360 fbshipit-source-id: bf8aafd3254fc7e18ad0d58ad1a29e2beeb15bf0 * change name convention for modules Summary: Following our internal discussion we want to change previously used name convention. Now it looks like: ``` #import ``` Name is a param of `rn_codegen` and `rn_library`. Also, I found it the easiest to move replacing `::_IMPORT_::` into buck rule Reviewed By: fkgozali Differential Revision: D16646616 fbshipit-source-id: 2c33c5b4d1c42b0e6f5a42d9a318bd8bda9745f4 * Add pointer to generated id Summary: It should always be a pointer, sorry! Reviewed By: RSNara Differential Revision: D16689608 fbshipit-source-id: f67d2606b5bdc169d312c1c75748c390ee5e56ed * Fix veryfying exports in module codegen Summary: If was breaking in cases like ``` export { x as default } ``` Reviewed By: RSNara Differential Revision: D16689606 fbshipit-source-id: 2583c73c5ac06ea0fa8666d219e739e68fc75b12 * DrawerLayoutAndroid drawerPosition now expects a string, number is deprecated Summary: The native change to support strings was made in D15912607 on June 21st. Migrating the JS callsites now to start passing strings instead of the constants. Reviewed By: zackargyle, mdvacca Differential Revision: D16703569 fbshipit-source-id: cb1d8698df55d2961cde1e2b1fbfcba086a03bb2 * Introduce NativeBugReporting Summary: This diff introduces `NativeBugReporting` and eliminates all uses of `NativeModules.BugReporting` from our codebase. Reviewed By: ejanzer Differential Revision: D16717540 fbshipit-source-id: 67b8620ba9dd4b41557ae042c30bdc521e927d30 * Introduce NativeFrameRateLogger Summary: This diff introduces `NativeFrameRateLogger` and eliminates all usages of `NativeModules.FrameRateLogger` from our codebase. Reviewed By: ejanzer Differential Revision: D16718105 fbshipit-source-id: caf903162bab978ee1b3faef56aedef6ada75b89 * Fix forceUpdate method on useWindowDimensions (#25990) Summary: useState won't trigger re-renders if the value passed is the same. ## Changelog [Internal] [Fixed] - Fix forceUpdate method on useWindowDimensions Pull Request resolved: https://github.com/facebook/react-native/pull/25990 Test Plan: Codesandbox: https://codesandbox.io/embed/elegant-cori-0ixbx Differential Revision: D16723962 Pulled By: sahrens fbshipit-source-id: 8a46152908a90553151e0353bbfd8c2e64cfd2af * Update regex used to check for codegenNativeComponent Summary: Updates regex to allow for type casts Reviewed By: TheSavior Differential Revision: D16717249 fbshipit-source-id: f22561d5cd33ab129fc0af4490692344726d7d71 * Use eslint-plugin-prettier recommended config (#25674) Summary: I created a new test project today using RN 0.60.3 and saw that prettier is now used with eslint. After looking at the `react-native-community` eslint config, I notice that it wasn't using the [recommended configuration](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) of `eslint-plugin-prettier` This PR adds the `eslint-config-prettier` to avoid conflicts between eslint and prettier, it also adds the `prettier/react` config to avoid problems with the `eslint-plugin-react`. ## Changelog [General] [Changed] - Use eslint-plugin-prettier recommended config Pull Request resolved: https://github.com/facebook/react-native/pull/25674 Test Plan: - ✅ Ensure there is no difference on this repo (no ESLint errors, same number of warnings, and no changes when running prettier). Differential Revision: D16666178 Pulled By: cpojer fbshipit-source-id: 70f81db793866acc88388b7b00a496aab5e0b156 * Codemod fbandroid// => //fbandroid/ in xplat/js/ Reviewed By: zertosh Differential Revision: D16710441 fbshipit-source-id: 610e0330c486e716a61b31a8198c05aa50a261cf * Manual fixes for xplat/js/react-native-github Summary: Need to add explicit type annotations in these areas to unblock types-first architecture for Flow. These are locations the codemod could not automatically handle. I'll call out areas I need a close eye on in the comments. Reviewed By: panagosg7 Differential Revision: D16659053 fbshipit-source-id: 167dd2abe093019b128676426374c1c62cf71e7f * xplat/js/react-native-github Reviewed By: panagosg7 Differential Revision: D16657770 fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33 * Remove usage of NativeModules.AccessibilityManager Summary: We introduced NativeAccessibilityManager a while back. This diff makes sure that there are no usages of NativeModules.AccessibilityManager in our codebase. Reviewed By: ejanzer Differential Revision: D16714424 fbshipit-source-id: edebf0f7a0fab615aa1722406f9d538696bd65a0 * React sync for revisions 55bc393...85d05b3 Summary: This sync includes the following changes: - **[85d05b3a4](https://github.com/facebook/react/commit/85d05b3a4 )**: Bump package.json versions //// - **[d9fdec6cf](https://github.com/facebook/react/commit/d9fdec6cf )**: [Flare] Remove contextmenu logic from Press (#16322) //// - **[12be8938a](https://github.com/facebook/react/commit/12be8938a )**: [Fresh] Support multiple renderers at the same time (#16302) //// - **[6f3c8332d](https://github.com/facebook/react/commit/6f3c8332d )**: Reset hydration state after reentering (#16306) //// - **[028c07f89](https://github.com/facebook/react/commit/028c07f89 )**: Ensure Fundamental flags are added to more locations (#16311) //// - **[9dfe973b5](https://github.com/facebook/react/commit/9dfe973b5 )**: Nit: fix inconsistent spacing in a warning (#16310) //// - **[c4f0b9370](https://github.com/facebook/react/commit/c4f0b9370 )**: Warn when Using String Refs (#16217) //// - **[7c838a645](https://github.com/facebook/react/commit/7c838a645 )**: [Flare] Adds support for hydrating host components with listeners (#16304) //// - **[ed4970079](https://github.com/facebook/react/commit/ed4970079 )**: [react-events] Separate the Focus/FocusWithin unit tests (#16298) //// - **[23405c9c4](https://github.com/facebook/react/commit/23405c9c4 )**: [react-events] Add ContextMenu responder (#16296) //// - **[606f76b6e](https://github.com/facebook/react/commit/606f76b6e )**: Fix hydration bug with nested suspense boundaries (#16288) //// - **[a1dbb852c](https://github.com/facebook/react/commit/a1dbb852c )**: warn if you try to use act() in prod (#16282) //// - **[dc232e677](https://github.com/facebook/react/commit/dc232e677 )**: chore: remove outdated comment about gcc (#16232) //// - **[6b565ce73](https://github.com/facebook/react/commit/6b565ce73 )**: Rendering tasks should not jump the queue (#16284) //// - **[c4c9f086e](https://github.com/facebook/react/commit/c4c9f086e )**: BugFix: Suspense priority warning firing when not supposed to (#16256) //// - **[05dce7598](https://github.com/facebook/react/commit/05dce7598 )**: Fix priority of clean-up function on deletion (#16277) //// - **[a53f5cc22](https://github.com/facebook/react/commit/a53f5cc22 )**: [SuspenseList] Bug fix: Reset renderState when bailing out (#16278) //// - **[0c1ec049f](https://github.com/facebook/react/commit/0c1ec049f )**: Add a feature flag to disable legacy context (#16269) //// - **[42794557c](https://github.com/facebook/react/commit/42794557c )**: [Flare] Tweaks to Flare system design and API (#16264) //// - **[b5af4fe3c](https://github.com/facebook/react/commit/b5af4fe3c )**: Remove FocusScope (#16267) //// - **[375616788](https://github.com/facebook/react/commit/375616788 )**: Add missing check to unmocked Scheduler warning (#16261) //// - **[f939df402](https://github.com/facebook/react/commit/f939df402 )**: [act] Wrap IsThisRendererActing in DEV check (#16259) //// - **[f440bfd55](https://github.com/facebook/react/commit/f440bfd55 )**: Bugfix: Effects should never have higher than normal priority (#16257) //// - **[db3ae32b8](https://github.com/facebook/react/commit/db3ae32b8 )**: flush fallbacks in tests (#16240) //// - **[e6a0473c3](https://github.com/facebook/react/commit/e6a0473c3 )**: Warn when rendering tests in concurrent/batched mode without a mocked scheduler (#16207) //// - **[e276a5e85](https://github.com/facebook/react/commit/e276a5e85 )**: [Flare] Remove delay props from Hover (#16248) //// - **[1912b4a0f](https://github.com/facebook/react/commit/1912b4a0f )**: [Flare] Remove delay props from Press (#16247) //// Changelog: [General][Changed] - React sync for revisions 55bc393...85d05b3 Reviewed By: zackargyle, rickhanlonii Differential Revision: D16720468 fbshipit-source-id: 1884ef67f404623697f516cd77ad952d1fbb4737 * @allow-large-files flow 0.105 xplat deploy Summary: bypass-lint allow_many_files Reviewed By: jbrown215 Differential Revision: D16753543 fbshipit-source-id: 1db37b56c1bb84b547e302dfe13ea0c9787deace * chore: Link to CLA wiki and CLA form. (#26016) Summary: After reading [Contributing Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#contributing-code), I found myself googling "react native cla", and figured it makes sense to include a link to the CLA alongside the guidelines. ## Changelog [Internal] [Changed] - Link to CLA Pull Request resolved: https://github.com/facebook/react-native/pull/26016 Test Plan: N/A Differential Revision: D16761411 Pulled By: cpojer fbshipit-source-id: 49912c9e32464725d9970f1a7a8bc483ee9f68ce * Fix indentation in Gradle files (#26012) Summary: Fixes indentation in `*.gradle` files by using four-space indents [as specified in `.editorconfig`](https://github.com/facebook/react-native/blob/0ccedf3964b1ebff43e4631d1e60b3e733096e56/.editorconfig#L13-L14). ## Changelog [Internal] [Fixed] - Fix indentation in Gradle files Pull Request resolved: https://github.com/facebook/react-native/pull/26012 Test Plan: Considering [the diff consists of whitespace changes only](https://github.com/facebook/react-native/compare/master...sonicdoe:gradle-indentation?w=1), I think this is safe to merge if the test suite passes. Differential Revision: D16761514 Pulled By: cpojer fbshipit-source-id: 9b035b5c6b35a70b2b54fe35416840fb90a0c6b1 * improve VirtualizedList error message (#25973) Summary: Motivation: when you receive error like `scrollToIndex out of range: 5 vs -1` it's not immediately clear if I requested 5 or -1. This will make the error a little easier to understand. ## Changelog not needed Pull Request resolved: https://github.com/facebook/react-native/pull/25973 Test Plan: not needed, tests must pass Differential Revision: D16708522 Pulled By: osdnk fbshipit-source-id: 8dfcbd95ff0f42805dbe32cd57969a93aea55add * Use ViewManagerDelegate if provided instead of $$PropsSetter to update view props Summary: This diff introduces an interface `ViewManagerDelegate` and its base implementation `BaseViewManagerDelegate`, which is used as a parent class for all view manager delegates generated by the JS codegen. Before the changes in this diff, generated delegates didn't support setting the base view properties such as background color, rotation, opacity, etc. Now it's possible to do by using `BaseViewManagerDelegate.setProperty(...)`, and since all generated delegates extend BaseViewManagerDelegate, they can just call `super.setProperty(...)` for properties they don't want to handle. This diff also introduced a new method `ViewManager.getDelegate()`. This will allow view managers to return an instance of the delegate generated by JS and ensure that the view properties are set in a type-safe manner. If this method returns null (it does by default), we fall back to the default implementation of setting view properties using Java-generated `$$PropsSetter` classes. This is an example of an interface class generated by JS: ``` public interface RCTAxialGradientViewViewManagerInterface { void setColors(T view, Nullable ReadableArray value); void setLocations(T view, Nullable ReadableArray value); void setEndX(T view, Float value); void setEndY(T view, Float value); void setStartX(T view, Float value); void setStartY(T view, Float value); } ``` This is an example of a delegate class generated by JS: ``` public class RCTAxialGradientViewManagerDelegate & RCTAxialGradientViewManagerInterface> extends BaseViewManagerDelegate { public RCTAxialGradientViewManagerDelegate(U viewManager) { super(viewManager); } Override public void setProperty(T view, String propName, Nullable Object value) { switch (propName) { case "colors": mViewManager.setColors(view, (ReadableArray) value); break; case "locations": mViewManager.setLocations(view, (ReadableArray) value); break; case "endX": mViewManager.setEndX(view, value == null ? Float.NaN : ((Double) value).floatValue()); break; case "endY": mViewManager.setEndY(view, value == null ? Float.NaN : ((Double) value).floatValue()); break; case "startX": mViewManager.setStartX(view, value == null ? Float.NaN : ((Double) value).floatValue()); break; case "startY": mViewManager.setStartY(view, value == null ? Float.NaN : ((Double) value).floatValue()); break; default: super.setProperty(view, propName, value); } } } ``` NOTE: What if a view manager, for instance ReactAxialGradientManager, wanted to add support for the borderRadius prop? In the old Java codegen, it would just need to create a method and annotate it with ReactProp (name = ViewProps.BORDER_RADIUS) and $$PropsSetter would call this method when a property with this name must be set. With the new JS codegen, borderRadius is a part of the basic view props, so setBorderRadius is not generated as a part of the ViewManagerInterface, so it’s not possible to set this value. I see two options: 1) add a method boolean setProperty (String propName, Object value) and let the view manager handle it in a non-type safe way (return true if it’s been handled). 2) Generate BaseViewManagerInterface which will include all basic view props and make BaseViewManager implement this interface, leaving all methods empty so that it stays compatible with the current implementation. Override these methods in a view manager that needs to handle a specific property in a custom way (so we would override setBorderRadius in ReactAxialGradientManager). Reviewed By: mdvacca Differential Revision: D16667686 fbshipit-source-id: 06a15a92f8af55640b7a53c5a34f40366d1be2a8 * Added jitpack repository to template (#25987) Summary: This PR will eliminate additional manual installation step for third-party RN libraries that include jitpack-published dependencies. ## Changelog [Android] [Added] - Added jitpack repository to template Pull Request resolved: https://github.com/facebook/react-native/pull/25987 Test Plan: No testing required. Differential Revision: D16763401 Pulled By: cpojer fbshipit-source-id: 72ff0146bd20c61a27b244f2dc7fea50781a4d1a * - Bump CLI to ^3.0.0-alpha.1 (#26028) Summary: Bumps the CLI to v3 alpha which includes Metro 0.56 ## Changelog [Internal] [Changed] - Bump CLI to ^3.0.0-alpha.1 Pull Request resolved: https://github.com/facebook/react-native/pull/26028 Test Plan: None Differential Revision: D16763732 Pulled By: cpojer fbshipit-source-id: 8f35fb80913f623cb44d37208f49040d4a33b07b * Fix handling of failed image downloads Summary: If you have following scenario 1. Have component with valid URL 2. Due to user action set to incorrect URL (something that 404s) Currently 1st image stay visible to the user. This is the case for both Fabric and Paper. Paper is being fixed -> https://github.com/facebook/react-native/pull/25919 Reviewed By: fkgozali Differential Revision: D16708532 fbshipit-source-id: ffdea5421faead4730e7b117a3b9f6e21869da70 * Fix crash during reload on Marketplace Home Summary: # What's the problem? `RCTSurfacePresenter._scheduler` is deallocated in `RCTSurfacePresenter.handleBridgeWillReloadNotification`. It shouldn't be used before `RCTSurfacePresenter.handleJavaScriptDidLoadNotification` is called because that's when new `RCTSurfacePresenter._batchedBridge` is created, scheduler depends on this new `RCTSurfacePresenter._batchedBridge`. But it is, it means that it is created with the old bridge, this means that it gets deallocated right away. First access point of old bridge is in `RCTSurfacePresenter.setMinimumSize`. # What's the fix? Make sure surface has correct stage before calling layout methods. The other idea was to return early in `RCTSurfacePresenter.setMinimumSize` in case bridge isn't setup. # Problems? 1. Following error still appears after reload {F176556210} 2. There is a white space for a while. By white space a mean the screen stays white for a short period of time before displaying content. Reviewed By: fkgozali, JoshuaGross Differential Revision: D16762443 fbshipit-source-id: 5a2a880b0f5345f268291c86811264f42f6058b3 * Add Object type to schema Summary: This diff adds ObjectTypeAnnotation to the codegen schema, throwing for the missing implementation sites added in the next diffs for easier review-ability. Also adds a schema fixture that is flow checked for review, but does not export it because the tests would fail Reviewed By: TheSavior Differential Revision: D16759109 fbshipit-source-id: 75c93623e8c1ae2003c7cc638e8e3447f0e7aa38 * Add object prop tests for unchanged fixtures Summary: This diff adds snapshot updates for the new object props test fixtures whose implementation does not need to change (e.g. event emitter files will not change when object props are implemented). This is for easier reviewability in later diffs. Notes that in the files that will change, we're temporarily filtering the OBJECT_PROPS test fixture Reviewed By: TheSavior Differential Revision: D16759124 fbshipit-source-id: 8aae063614f762c8bd7bf092b0d274804c38dd14 * Add view config support for Object props Summary: This diff adds handling for object prop types in the view config codegen Reviewed By: TheSavior Differential Revision: D16759136 fbshipit-source-id: ff4020f9cffe30f14a1356ac95afd7c9a1062c05 * Add Object props support for Java Summary: This diff adds Java handling for object props Reviewed By: TheSavior Differential Revision: D16759139 fbshipit-source-id: e47956dc43cd1eb4abd58636bf111dde8d7244cc * Move generateStructName to CppHelpers Summary: We'll need this helper in the prop files now so let's move it over to the generic cpp helpers Reviewed By: TheSavior Differential Revision: D16759164 fbshipit-source-id: 8765ffee3bd8219b5f0dc8677362ec45f0a8e2c5 * Add support for parsing object props Summary: This diff adds support to the flow parser to parse object props to the codegen schema This handles required and optional props, as well as required and optional object properties, WithDefault, enums, etc. Basically everything is supported that is supported at the top level Reviewed By: TheSavior, osdnk Differential Revision: D16759198 fbshipit-source-id: 6f501f4738f84f20a940235ba74f7bae93e64eef * Better error message for invalid type annotation Summary: Just a minor error message improvement Reviewed By: TheSavior, osdnk Differential Revision: D16759233 fbshipit-source-id: c53c54535eca683353085a8d2272c60596b52b54 * Add Flipper to React Native OSS by default Reviewed By: passy Differential Revision: D6723578 fbshipit-source-id: f34442689f99cd94220335a171010224a12132a8 * Improve ModuleRegistryBuilder assertion Summary: ModuleRegistryBuilder does as assertion to verify that all `cxxModules` are instances of `CxxModuleWrapperBase::javaStaticClass()`. This assertion is causing the crash in T48554656. Since we don't know which NativeModule is causing this problem, it's difficult to get to the bottom of this. So, for now, I'm improving the assertion message in the hopes that it helps us get to the bottom of this issue. Reviewed By: mdvacca Differential Revision: D16774711 fbshipit-source-id: 82318b8ff5ab735ae642da81777c1b5588e8a483 * Move HermesSamplingProfiler to OSS Reviewed By: willholen Differential Revision: D16069575 fbshipit-source-id: a67d19be8790a27e6b3fbd2da0d5c9fdd1e9d53a * Fix jest test crashes with animated components Summary: In the jest test renderer, host components have null refs by default. `createAnimatedComponent` tries to access the ref in componentDidMount, which then crashes. This is particularly problematic when trying to update test data: https://fb.workplace.com/groups/mpen00bs/permalink/494236684721027/?comment_id=510656413079054 Just checking for null fixes the issue and shouldn't affect anything else. Reviewed By: TheSavior, yungsters Differential Revision: D16777137 fbshipit-source-id: 0b9f7c5734c849f36318512ceffcc42dd44c58bb * Add RNTester and UITestBed as dev routes in main apps Summary: It's nice to have everything in one place, especially when touching native code where it's a pain to arc focus or buck build another target just to test some other JS. Reviewed By: yungsters Differential Revision: D14957052 fbshipit-source-id: fd3c388ab5b193b0fe9cebdc0c81ddbff9a714d4 * URL: Do not prepend baseUrl if the URL is not a relative URL (#26009) Summary: Fix for bug https://github.com/facebook/react-native/issues/26006 URL with base is always used, even when absolute URL is provided ## Changelog [Javascript] [Fixed] - `URL`: Base url value is ignored when the input url is not a relative url. Pull Request resolved: https://github.com/facebook/react-native/pull/26009 Test Plan: `new URL('http://github.com', 'http://google.com')` now returns `http://github.com/` Added a test case to `URL-test.js` to verify the same. Differential Revision: D16781921 Pulled By: cpojer fbshipit-source-id: 038aca3610e34f513f603e8993f9a925b7d28626 * Move TextInput PropTypes to Deprecated PropTypes (#26042) Summary: This pull request moves `TextInput`'s proptypes to `DeprecatedTextInputPropTypes`. This is in line with what is happening with other components. ## Changelog [General] [Deprecated] - Moved `TextInput`'s proptypes to `DeprecatedTextInputPropTypes` Pull Request resolved: https://github.com/facebook/react-native/pull/26042 Test Plan: Flow checks pass. Differential Revision: D16782322 Pulled By: cpojer fbshipit-source-id: c5f9caa402c0c5cd878e7fff502d380c7b468cbd * fix SectionList scrollToLocation and prevent regressions (#25997) Summary: Recently there were quite a few changes to this functionality, and they caused breakages https://github.com/facebook/react-native/issues/21577 https://github.com/facebook/react-native/issues/24034 https://github.com/facebook/react-native/issues/24734 https://github.com/facebook/react-native/issues/24735 Currently, whichever `viewOffset` I pass, it will be overridden (either by 0 or something computed in the if body). This fixes the issue and also adds tests to make sure there is no regression. ## Changelog [Javascript] [Fixed] - VirtualizedSectionList scrollToLocation viewOffset param ignored Pull Request resolved: https://github.com/facebook/react-native/pull/25997 Test Plan: tests pass Differential Revision: D16784036 Pulled By: cpojer fbshipit-source-id: 46421250993785176634b30a2629a6e12f0c2278 * Add reexport_all_header_dependencies to (yet more) misc rules Summary: Currently this is the default, but I plan to toggle the default to False shortly. False is better for build speed, as it forces you to separate deps and exported_deps. Reviewed By: williamtwilson Differential Revision: D16785991 fbshipit-source-id: 8cb73b87f1dfa50f21c0c12df1579054cdc99e6e * Commands: support Float arguments Summary: Support codegen'ing commands with Float arguments. Reviewed By: mdvacca Differential Revision: D16785534 fbshipit-source-id: 8174ae40762c1114b87a023cb2b69b2515dc6e23 * Use feature flag to enable view manager delegates for setting props Summary: This diff adds a feature flag which must be enabled if view managers should be allowed to use a delegate for setting their properties. Reviewed By: mdvacca Differential Revision: D16762876 fbshipit-source-id: ae3466d7f02ed02f203dbb79f5e0843e6d9fdd45 * fix display problems when image fails to load (#25969) Summary: This problem was also affecting Fabric and was fixed in D16708532. When the image resource is changed and the new image resource fails to load, we expect the display image to fail to load, but the image still shows the image that was successfully loaded last time. ## Changelog [iOS] [Fixed] - fix display problems when image fails to load Pull Request resolved: https://github.com/facebook/react-native/pull/25969 Test Plan: This is catalyst playground with following code P78264143. TLDR of the code, it sets URL that is 404. {F175486515} Reviewed By: makovkastar Differential Revision: D16783330 Pulled By: sammy-SC fbshipit-source-id: 1cb488590ce15d957357f32a73ebf8df6cccf4cd * Migrate RCTAxialGradientView to JS codegen Summary: This diff migrates `RCTAxialGradientView` to use generated `RCTAxialGradientViewManagerDelegate` for setting its props. The following base properties have been added to `BaseViewManager`: ``` protected void setBorderRadius(T view, float borderRadius) {} protected void setBorderBottomLeftRadius(T view, float borderRadius) {} protected void setBorderBottomRightRadius(T view, float borderRadius) {} protected void setBorderTopLeftRadius(T view, float borderRadius) {} protected void setBorderTopRightRadius(T view, float borderRadius) {} ``` Reviewed By: JoshuaGross, mdvacca Differential Revision: D16784173 fbshipit-source-id: f3971985efee2b6e0a5fb248b89c4809305e670c * hadle nullable params in generated objcpp Summary: Param of function can be optional and it should have impact on native code. Inspired by old codegen Reviewed By: RSNara Differential Revision: D16763884 fbshipit-source-id: dab50275f902dbe4af25824bb6128d3b37fc43cd * Remove multiple RTCConvert import Summary: RTCConvert was previously imported on each protocol. It was redundant. It's enough to import it once per file Reviewed By: RSNara Differential Revision: D16764834 fbshipit-source-id: 9e5dcd52e38dfefa675e3e2c9f2a8f414da1a02c * fix optional key in structs in new codegen Summary: Property should be marked as optional not only when value is optional, but also key. Reviewed By: RSNara Differential Revision: D16764332 fbshipit-source-id: d56944ef263da3aa1fce3482151c761574a83be6 * Change type of params in methods' protocols to nongeneric Summary: It was mistake which I fix here. Type of param in protocols should be generated struct. See generated struct in snap. It's exactly how it was in previous codegen Reviewed By: RSNara Differential Revision: D16770579 fbshipit-source-id: dac9c15c5d91a41ab2d06aea416f64bd7deb4476 * Fix name of key obtaining from dictionary in inline method in generated objcpp Summary: It was a mistake. We should obtain value by proper key always. Previously by a mistake I hardcoded 'a'. I wasn't break anything because it wasn't used in Internationalization. However, it was a bug Reviewed By: RSNara Differential Revision: D16782132 fbshipit-source-id: 59f7910f2be7753c07f16f00a201de856d57e29e * Add setMethodArgConversionSelector Summary: `setMethodArgConversionSelector` is method for provinding generated structs for methods' params. It was exactly how in old codegen. Reviewed By: RSNara Differential Revision: D16784403 fbshipit-source-id: d35bc8160be62385527299a6b8e68c1159002853 * Omit getConstants for codegening if object is empty Summary: Old codegen was omitting `getConstants` if it was empty. So do our. There's no point in providing this getter in this case. Reviewed By: RSNara Differential Revision: D16762230 fbshipit-source-id: 721df13a00848d23108329b152115c0f0aee8eb9 * Add documentation to TextInput's Flow types (#26054) Summary: The documentation from the Flow types' respective proptypes have been copied over to `TextInput`. ## Changelog [Internal] [Changed] - Added documentation to TextInput's Flow types Pull Request resolved: https://github.com/facebook/react-native/pull/26054 Test Plan: `yarn flow-check-ios` and `yarn flow-check-android` both pass. Differential Revision: D16801435 Pulled By: TheSavior fbshipit-source-id: 7f3d75ba149259d5bbf719375320e2e325188826 * Delete ensureComponentIsNative.js Summary: This function was used by Touchable*. It was removed from the Touchables in D6494579 in 2017. The only remaining callsite was ImageBackground which is attaching a ref directly to the View so we know it is a native component. This is needed for some setNativeProps cleanup Reviewed By: sahrens Differential Revision: D16796973 fbshipit-source-id: 19379094b3b91920efac4bf1969fc22d4b80bcc6 * Use SoundManager in Pressability and Touchable Summary: This diff replaces the usage of UIManagerModule.playTouchSound() in Pressability and Touchable for the SoundManager.playTouchSound() Reviewed By: yungsters Differential Revision: D16543433 fbshipit-source-id: a2ba060bc480889c1e08c5c87086361e06974684 * Revert D16543433: [Fabric][JS] Use SoundManager in Pressability and Touchable Differential Revision: D16543433 Original commit changeset: a2ba060bc480 fbshipit-source-id: 0ba31019fb7a9e77577e495782a3b10029575d22 * Migrate RCTImage NativeModules to CoreModules Summary: This diff moves RCTImageLoader, RCTImageEditingManager, and RCTImageStoreManager to CoreModules. This is necessary for us to convert all these NativeModules to TurboModules. **Note:** As a part of this diff, I had to break apart `RCTImageLoader.h`. All the protocols that were in `RCTImageLoader` are now in their own headers. Furthermore, `RCTImageLoader`'s methods are defined in `RCTImageLoaderProtocol`, so that we can call them from classes like `RCTImageViewManager` in `RCTImage`. Reviewed By: PeteTheHeat Differential Revision: D16805827 fbshipit-source-id: 89f6728b0766c30b74e25f7af1be8e6b8a7e6397 * Add support for `Double` prop type Summary: Support a prop-type `Double`, in addition to `Float`, for flow typing and codegen of components. Reviewed By: TheSavior Differential Revision: D16812812 fbshipit-source-id: b5588b3218636283a4e9c5d17212dd0b92986eb9 * Support spreading locally defined types Summary: We want to be able to spread types that are defined in the same file. Reviewed By: JoshuaGross Differential Revision: D16812171 fbshipit-source-id: 7cda9869ea25f0357b3f8a3b28443407b219f04b * Support spreading locally defined types deeply Summary: We want to be able to spread props at any level, not just the top level Reviewed By: JoshuaGross Differential Revision: D16812884 fbshipit-source-id: 2e710141f833a7cc7ea25a91a1523a5c43b4e02c * Support deeply nested spreads Summary: Apparently I missed one more edge case. Thanks Josh for flagging! Reviewed By: JoshuaGross Differential Revision: D16813354 fbshipit-source-id: 6b59bc7b18184e3aa437c3b038ffd22b0fc0ba6a * Add failure tests for duplicate props with the same name Summary: There are a couple of cases where props can conflict which would cause undefined behavior. We'll throw to protect against that. Now that we support type spread this is more possible without someone realizing. Reviewed By: JoshuaGross Differential Revision: D16813884 fbshipit-source-id: 1a8fce365ab315198abdff0de6006cfe34e84fb9 * Deprecate Text proptypes (#26055) Summary: This pull request moves `Text`'s prop types to the `DeprecatedPropTypes` folder. This was already partly in progress - there were redundant `TextPropTypes` and `DeprecatedTextPropTypes` files so I removed one, and made sure the version with the doc strings was the one used. ## Changelog [General] [Deprecated] - Move `Text` component's proptypes to DeprecatedPropTypes Pull Request resolved: https://github.com/facebook/react-native/pull/26055 Test Plan: Flow checks pass for iOS and Android Differential Revision: D16801078 Pulled By: TheSavior fbshipit-source-id: ef19300945d48d0a4a83d728ee32cdf7d1c0f0cc * add the jni initializer to the build for sampling profiler Summary: The OnLoad.cpp file is needed since it actually registers the jni functions, it wasn't included in the build so it wasn't working correctly. Reviewed By: jbower-fb Differential Revision: D16826230 fbshipit-source-id: 0243e456c4015879d17650737a6a27a58a3d0d9a * Generate super call to BaseViewManagerDelegate if delegate has no props Summary: This diff adds a super call to `BaseViewManagerDelegate` if the current delegate doesn't have any props. We still want to set base view props, so we need `BaseViewManagerDelegate` to take care of this. Reviewed By: rickhanlonii Differential Revision: D16806648 fbshipit-source-id: 61963f2211cc7b2e7f5822c48bb0a7f50d909221 * Remove vendored proguard annotation (#26069) Summary: There have been multiple complaints about combining RN with various other FB libraries, including Litho and Flipper, because of bundled dependencies that can't be deduplicated by Gradle. This is one of three current conflicts: 1) Proguard annotations (this PR) 2) Yoga 3) fbjni While the Yoga group name doesn't make a massive amount of sense it was the easiest existing package to use and since we don't have a better namespace for this, we might as well use this. A similar change to Litho is landing right now. ## Changelog [Android] [Changed] - Use centralized package for DoNotStrip annotation Pull Request resolved: https://github.com/facebook/react-native/pull/26069 Test Plan: ``` yarn ./gradlew :RNTester:android:app:assembleDebug ``` Reviewed By: cpojer Differential Revision: D16827430 Pulled By: passy fbshipit-source-id: 87542b5422fee598d8e635651441f0ecd42eb9d7 * Add Object props support for cxx Summary: Adds ability to codegen object props to cxx by generating the cxx structs and conversion functions | Reviewed By: JoshuaGross Differential Revision: D16759170 fbshipit-source-id: 7437421e59f4be42fbcd4cddc2e0ed513ae71d08 * Add e2e test for object props Summary: Adds e2e tests for cxx and java object props Reviewed By: JoshuaGross Differential Revision: D16759242 fbshipit-source-id: 2307dc4b3ba26222de510cf5876c582d35fc665c * Add array props to schema Summary: Adds arrays of objects to the codegen schema Reviewed By: motiz88 Differential Revision: D16814117 fbshipit-source-id: 10b20446f7aac5dccc3d2cb148891a134d136d3f * Generate array props Summary: Adds the cxx generators for arrays of object props Reviewed By: JoshuaGross, TheSavior Differential Revision: D16814136 fbshipit-source-id: fa4600f60c063bfb460033f5fde43e26c04b5a3b * Parse $ReadOnlyArray<$ReadOnly{}> props Summary: Add flow type parsing for `$ReadOnlyArray<$ReadOnly<{}>>` Reviewed By: TheSavior Differential Revision: D16814261 fbshipit-source-id: 9442916f5d31f6d27f560332aee311b3ad8f0864 * Add e2e tests for array object props Summary: Adds e2e tests for the array of object prop types in the codegen Reviewed By: rubennorte, motiz88 Differential Revision: D16814301 fbshipit-source-id: 613f32a888451c0c1b7359133b7bf88878e36916 * Add error message for paring unnamed params Summary: We're currently not supporting this kind of params ``` +sample(string):void ```` and here's special exception for it. Reviewed By: RSNara Differential Revision: D16708583 fbshipit-source-id: 809f9808b77108857c8363536b896089e9cb957f * Split buck rules for component and modules Summary: Split buck rules for component and modules for our further convenience Reviewed By: rickhanlonii Differential Revision: D16803703 fbshipit-source-id: c01fb97875b43be4020edd054cad538ec8ed6861 * Support Double in when generating props for .h files, in parsing component props, and for commands and events Summary: I realized my previous diff was incomplete. Adding parsing and generation code for Double for props, commands, and events. Reviewed By: rickhanlonii Differential Revision: D16823540 fbshipit-source-id: fbed9897bb84b789c502cf4153e81060590152b8 * Add support for spread with ReadOnlyArray Summary: The new support for ReadOnlyArray needs to call this new function for spreads too. Reviewed By: JoshuaGross Differential Revision: D16823796 fbshipit-source-id: 9de94b41cdead7ce5238c77a9e39b5daf760dfe2 * Convert RCTImageLoader to TurboModules [4/N] Summary: This diff adds a JS spec for RCTImageLoader, and conforms to it in ObjC++. Since RCTImageLoader isn't called from JS, the js spec is empty. Since `/CoreModules/` is the only dir in OSS which supports TM, move the ObjC++ impl there. The change in `NativeExceptionsManager.js` fixes a weird bug I was hitting in codegen, where the codegen cpp file wouldn't compile due to unused variable. Reviewed By: JoshuaGross Differential Revision: D16495674 fbshipit-source-id: 191897b87730a6b0b96022eedc6412551fae04a6 * Pass RCTImageLoader into RCTSurfacePresenter [5/N] Summary: Instead of grabbing `imageManager` from the bridge, pass it from above. Right now, still use bridge to pass from above, but this gives us flexibility to not use bridge in the future. Reviewed By: shergin Differential Revision: D16504270 fbshipit-source-id: 7977a7957b659375f8348d26cd57b648e9d5959f * Pass RuntimeExecutor into RCTSurfacePresenter Summary: Instead of getting `RuntimeExecutor` from the bridge, pass it from above. Right now pass through `null`, but eventually this will work :) Reviewed By: RSNara Differential Revision: D16626288 fbshipit-source-id: bce527f85c0a79cfe6cf240a3633bbbe357f75c4 * Fix BUCK-related React Native CI failures Reviewed By: cpojer Differential Revision: D16812633 fbshipit-source-id: 50de7603fbb514ff1c3bb6c5fa6afd579d8a20b8 * Move RCTExceptionsManager to CoreModules and make it conform to spec Summary: `NativeExceptionsManager.js` contains the JS spec for this native module. This diff moves the objc code to CoreModules (since it's the only directory that supports TM at the moment) and makes it conform to the spec. NOTE: I will update podfiles after this diff is reviewed, before I land. Adding those generated changes makes it really hard to review. Reviewed By: RSNara Differential Revision: D16812212 fbshipit-source-id: 38b6e9a20ce15e7e9995df34493b37ed7adb2911 * Bump test version for cache issues * Tweak script to work with no global CLI * Revert "Remove vendored proguard annotation (#26069)" This reverts commit 35fc0add2d3a278bf90257284fe23e03898008de. * Revert "Remove 's.static_framework = true' requirement for podspec (#25816)" This reverts commit ca9e108110e4a3cc39044805f879d9a9cb637c41. * [0.61.0-rc.0] Bump version numbers * Revert "[0.61.0-rc.0] Bump version numbers" This reverts commit 9296ab1a615f0eb322e22cb85a61aa5b5acdb76e. * [0.61.0-rc.0] Bump version numbers * Revert "[0.61.0-rc.0] Bump version numbers" This reverts commit 2575eb318f01c8d1e680e3e3aaf07c14e159daaf. * Add RCTWeakProxy to properly deallocate RCTUIImageViewAnimated Summary: @public CADisplayLink strongly holds onto its target, so you have to use a weak proxy object to pass the target into the CADisplayLink. Previously we passed a weak-self point (i.e. weakSelf) but this did not have the intended effect, since the pointer to self would still be passed to CADisplayLink, and thus it would hold onto the RCTUIImageViewAnimated strongly. So is weakSelf doing anything other than using self? It is but it's very minor and not useful. In the case that the object got de-allocated between assigning self to weakSelf and creating the CADisplayLink, then we would pass a nil target. This is actually impossible though because we are running an instance method, so self is implicitly retained! So semantically it is something different but in practice it is the same as passing self through. Notes: * This system was added originally in https://github.com/facebook/react-native/pull/24822 * https://github.com/facebook/react-native/pull/25636 then "enabled" this system by deprecating existing approach Reviewed By: fkgozali Differential Revision: D16939869 fbshipit-source-id: 7a0e947896f23aa30ad074d1dcb4d4db7543e00a * Remove RCTUIImageViewAnimated WeakProxy gating Summary: To help determine how severe this issue is, put the fix behind a MC. We will only pick the parent diff to the RC branch so that the fix immediately goes to master and we don't have to worry about fixing this any further. Reviewed By: fkgozali Differential Revision: D16940181 fbshipit-source-id: 91eb08181f82f51aea6a20b3fd489a33bdc0e424 * [0.61.0-rc.0] Bump version numbers * Revert "[0.61.0-rc.0] Bump version numbers" This reverts commit bc28eee87f777b19106d4df7f2ac775cb357a12b. * Update CircleCI config as per support request * [0.61.0-rc.0] Bump version numbers * Memory Leak due to JSStringRelease not called in multiple places in JSCRuntime.cpp (#25884) Summary: Memory Leak due to JSStringRelease not called in multiple places in JSCRuntime.cpp Issue: https://github.com/facebook/react-native/issues/25664 Reproducible repo: https://github.com/bhandarijiwan/memory_issue_repro ## Changelog [JSC] [JSCRuntime.cpp] - Added missing JSStringRelease calls in missing places Pull Request resolved: https://github.com/facebook/react-native/pull/25884 Test Plan: Tested that is no memory leak with various NativeModule to JS call flows Reviewed By: JoshuaGross Differential Revision: D16928985 Pulled By: TheSavior fbshipit-source-id: 65ce15ae32482d0db39bad7e22a2fed9ee04f230 * Fix Redbox on iOS Summary: Looks like we broke iOS redbox in D16812212. It stopped showing up because the feature detection stopped working, and we started calling noops. The fix is an explicit platform check. Fixes #26260 Reviewed By: motiz88 Differential Revision: D17139310 fbshipit-source-id: 829eec23cbb49151ac250889c34ab28d36b05e6a * Partial RN sync Summary: This cherry-picks one commit: https://github.com/facebook/react/commit/01fb68b9bf680ab8bbf96e86501e0fc540b3cc97 It fixes a bug in Fast Refresh. Reviewed By: threepointone Differential Revision: D17140543 fbshipit-source-id: a7654152d1cc7c27e7c4024380349b44ac496b22 * Change podspec name of yoga to Yoga Summary: Needed to capitalize the name, since this is the convention used elsewhere too [iOS] [Changed] - Renamed yoga podspec to Yoga Reviewed By: shergin Differential Revision: D17127104 fbshipit-source-id: 14047bf452edda000037701f4ba7f4a02a0e717b * Update the version of yoga podspec to match the actual version of Yoga published Summary: Yoga is currently published in cocoapods. While we don't use the Yoga from Cocoapods in React Native, we should atleast try to follow that version, so that other integrations with Yoga are possible Reviewed By: shergin Differential Revision: D17127625 fbshipit-source-id: bca2e1e33ad775e2a0d7a6f1e4177c3b480c023a * Sync Podfile * Update release script * [0.61.0-rc.2] Bump version numbers * TM iOS: Disable in test environment Summary: For now, disable TM completely in test environment, like RNTester integration/unit tests. See details in T53341772 This also fixes the failure discussed in https://github.com/facebook/react-native/pull/26151 Reviewed By: PeteTheHeat Differential Revision: D17147915 fbshipit-source-id: 1c48ebb9c3b81fc08bc33606dcc38c29297d6010 * Revert "Revert "Remove 's.static_framework = true' requirement for podspec (#25816)"" This reverts commit 612c033918e6f61713966a24fa024048fc520fca. * Add missing dependencies to React-CoreModules.podspec * Fix incorrect `module.name_mapper` in template .flowconfig (#26330) Summary: Has explained in https://github.com/facebook/react-native/issues/26233, current template is incorrect & can create error, like having require() of png that are considered as `string` instead of `number. This can probably hide tons of similar mistakes. The change in this PR should resolve the previous behavior (& for example, some places in previous version of the flowconfig have the full path like here https://github.com/facebook/react-native/blob/35300147ca66677f42e8544264be72ac0e9d1b45/template/_flowconfig#L61) Closes https://github.com/facebook/react-native/issues/26233 ## Changelog ``` [General] [Fixed] Fix incorrect `module.name_mapper` in template .flowconfig ``` Alternatively, message could be ``` [General] [Internal] Fix incorrect `module.name_mapper` in template .flowconfig ``` As it hasn't this "bug" hasn't been released in a public stable release. You decide Pull Request resolved: https://github.com/facebook/react-native/pull/26330 Test Plan: I just tested this in my project, thymikee might be able to confirm & approve this PR. Differential Revision: D17258891 Pulled By: cpojer fbshipit-source-id: 3904ffbc6f076ee0e435311249d694b8604fc7b8 * Rename Yoga * [0.61.0-rc.3] Bump version numbers * Fixing Yoga imports and includes on case-sensitive machines (#26416) Summary: In addition of the issue resolved by https://github.com/facebook/react-native/pull/26360 (already merged), machines with case-sensitive disks are still not able to build a project on Xcode due not found ` Date: Wed Sep 18 16:32:11 2019 +0100 [Fresh] Always remount classes (#16823) commit acfdc9760b4dc55d192b08de42b2c45e5e5bb531 Author: Ricky Date: Wed Sep 18 15:31:00 2019 +0100 [React Native] Fix for view config registrations (#16821) commit dbe593d96c35b33fcc1f1bec70af86c24779392b Author: Dominic Gannaway Date: Wed Sep 18 14:18:32 2019 +0200 [react-core] Do not null fiber.sibling in detachFiber (#16820) commit 30fa2f5ea3313b4b7932783d8ac71b5d59b8a8c7 Author: Dominic Gannaway Date: Tue Sep 17 17:30:22 2019 +0200 [react-core] Clear more properties in detachFiber (#16807) commit ea374e751b164ed029b35063b84c825305024a0a Author: Dan Abramov Date: Wed Aug 28 16:55:56 2019 +0100 Don't ignore dependencies for render phase update (#16574) Reviewed By: gaearon Differential Revision: D17456249 fbshipit-source-id: 87bad63fed4a571f65592ee904606828e3aa39af * bump android gradle plugin to 3.5.0 (#26129) Summary: Android Gradle Plugin 3.5.0 released with a lot of improvements and bug fixes. It's important to have this change merged before 0.61 release. See https://developer.android.com/studio/releases/gradle-plugin ## Changelog [Android] [Changed] - bump android gradle plugin to 3.5.0 Pull Request resolved: https://github.com/facebook/react-native/pull/26129 Test Plan: RNTester builds and runs as expected Reviewed By: mdvacca Differential Revision: D17091520 Pulled By: osdnk fbshipit-source-id: 232b9209526e62a7344d74422fd8471a03dec7f4 * Update Gradle wrapper to 5.6 (#26079) Summary: ``` Welcome to Gradle 5.6! Here are the highlights of this release: - Incremental Groovy compilation - Groovy compile avoidance - Test fixtures for Java projects - Manage plugin versions via settings script For more details see https://docs.gradle.org/5.6/release-notes.html ``` ## Changelog [Android] [Changed] - Gradle wrapper 5.6 Pull Request resolved: https://github.com/facebook/react-native/pull/26079 Test Plan: Ran build and tests locally. Differential Revision: D17054310 Pulled By: mdvacca fbshipit-source-id: de7ba3a6d04058e51b8bc6a21d5a3f828ef8bc25 * Revert "bump android gradle plugin to 3.5.0 (#26129)" This reverts commit 8d4e8a377528895c5ea3928e9c209eafa467f46b. * Revert "Update Gradle wrapper to 5.6 (#26079)" This reverts commit afd35296f2bd0a04e3406c03ff9c023e7192161f. * [0.61.0] Bump version numbers * Allow again for injecting custom root view via ReactActivityDelegate (#26495) Summary: This change restores the possibility of injecting custom root views via ReactAcitivtyDelegate. It has been used by react-native-gesture-handler library in order to replace default root view with a one that'd route touch events to gesture-handler internal pipeline. The regression happened in d0792d4b8ac42711dfd9fccb782f16e72ce3e335 where new `ReactDelegate` was introduced to provide support for rendering react native views in both Android fragments and activities. As a part of that change the logic responsible for creating root view has been moved from `ReactActivityDelegate` to `ReactDelegate` rendering `ReactActivityDelegate.createRootView` unused – that is there is no code path that leads to this method being called. Instead `ReactDelegate.createRootView` method has been added which now plays the same role. The custom root view injection was relying on overwriting that method and hence the method is no longer referenced overwriting it has no effect. Following the logic migration out of `ReactActivityDelegate` into `ReactDelegate` we could potentially now start overwriting methods of `ReactDelegate`. However when working with Android's activities in React Native we can only provide an instance of `ReactActivityDelegate` and in my opinion it does not make too much sense to expose also a way to provide own instance of `ReactDelegate`. The proposed fix was to route `ReactDelegate.createRootView` to call `ReactActivityDelegate.createRootView` and this way regaining control over root view creation to `ReactActivityDelgate`. The change of the behavior has been implemented by subclassing `ReactDelegate` directly from `ReactActivityDelegate` and hooking the aforementioned methods together. Thanks to this approach, the change has no effect on `ReactDelegate` being used directly from fragments or in other scenarios where it is not being instantiated from `ReactActivityDelegate`. This fixes an issue reported in https://github.com/kmagiera/react-native-gesture-handler/issues/745 and discussed on 0.61 release thread: https://github.com/react-native-community/releases/issues/140#issuecomment-532235945 ## Changelog [Internal] [Fixed] - Allow for custom root view to be injected via ReactActivityDelegate Pull Request resolved: https://github.com/facebook/react-native/pull/26495 Test Plan: 1. Run RNTester, take layout snapshot, see the react root view being on the top of view hierarchy. 2. Run gesture-handler Example app (or some other app that overwrites ReactActivityDelegate.createRootView method), on layout snapshot see custom root view being used. Differential Revision: D17482966 Pulled By: mdvacca fbshipit-source-id: 866f551b8b077bafe1eb9e34e5dccb1240fa935e * Fix ShareSheet crash on iOS 13 (#26429) Summary: Currently on iOS 13 the app will crash if you: - Open the share sheet - Tap something like messages or photos - Cancel the dialog - Perform any other action This is because `shareController.completionWithItemsHandler` is called when the dialog box is canceled and currently `failureCallback` or `successCallback` will always be called. In the situation above, `activityError` is `nil` so `successCallback` will be called even though `completed` is false. This leaves us in a state where the callback has been invoked but the ShareSheet is still active, meaning the success or error callback will be invoked again, leading to the crash. This PR adds a check to make sure `completed` is true before calling `successCallback`. This way `successCallback` will only be called when the user has successfully completed an action and the ShareSheet is closed. ## Changelog [iOS] [Fixed] - Fix crash in RCTActionSheetManager.m on iOS 13 Pull Request resolved: https://github.com/facebook/react-native/pull/26429 Test Plan: - Saved an image successfully - Opened and dismissed the `Photos` dialog multiple times without crashing Differential Revision: D17369712 Pulled By: PeteTheHeat fbshipit-source-id: 228b696243cd39fad1fa134f4412d95d845b1bc5 * [0.61.1] Bump version numbers * Revert "[0.61.1] Bump version numbers" This reverts commit 2577ca534008e362a977ce7c83eb4b51e14a0b52. * Revert "Add generated `xcshareddata` folder to gitignore (#25451)" This reverts commit d57cdac62b814d38d2d03cdbb1cb3da60a09c948. * [0.61.1] Bump version numbers * Bring back RNTester manual step * Removing the workspace (#26566) The workspace file is file to be added to git. Consider it as a lockfile for native ios :) * Revert "Set rounded rectangle mask on TouchableNativeFeedback's ripples (#25342)" This reverts commit 14b455f69a30d128db384749347f41b03b9a6000. * Include transform in OUTER_PROPS (#26611) Summary: Without `transform` in `OUTER_PROPS`, the refresh control component would not include `transform: {scaleY: -1}` in its style and so pulling down, rather than up, on a scroll view would trigger a refresh. Fixes https://github.com/facebook/react-native/issues/26181 ## Changelog [Android] [Fixed] - Fixed issue with refresh control not working properly on an inverted ScrollView Pull Request resolved: https://github.com/facebook/react-native/pull/26611 Test Plan: Updated unit test in splitLayoutProps-test.js. Differential Revision: D17661079 Pulled By: cpojer fbshipit-source-id: 747da27b11c3ca59b7f639f393ae5ac137f5490a * Use `warnOnce` for excessive number of callbacks error (#26508) Summary: I happened to hit this error a couple times and the issue is that if there are let's say 1000 pending callbacks the error would be triggered 500 times and pretty much crash the app. I think it is reasonable to use warn once here so it only happens once. ## Changelog [General] [Fixed] - Use `warnOnce` for excessive number of callbacks error Pull Request resolved: https://github.com/facebook/react-native/pull/26508 Test Plan: Tested by reducing the number of pending callbacks required to trigger the error. Reviewed By: TheSavior Differential Revision: D17512917 Pulled By: JoshuaGross fbshipit-source-id: 5ce8e2a0a166805cc6f3fe6d78e2716d6792a80e * improve error message in NativeModuleRegistryBuilder.java (#26467) Summary: ## Motivation I have seen a spike in users reporting this error. Unfortunately I did not receive any repros that would confirm this, but my hypothesis is that they ran into situation when `new XYZPackage()` was present in `getPackages()` method and then the CLI kicked in with autolinking and they were left with this incomplete error. someone more knowledgeable of autolinking should review this. Pull Request resolved: https://github.com/facebook/react-native/pull/26467 Differential Revision: D17661242 Pulled By: cpojer fbshipit-source-id: 63dfcd85a0d41d85a0dd52f84ab16cb7ceb64ba2 * iOS13 status bar has now 3 styles (#26294) Summary: iOS13 status bar has now 3 styles UIStatusBarStyleDefault, UIStatusBarStyleLightContent, UIStatusBarStyleDarkContent UIStatusBarStyleDefault now acts as an automatic style which will set it’s value dynamically based on the the userinterfacestyle(One of the traits) of the viewcontroller that controls the status bar appearance. ## Changelog [iOS] [Fixed] - iOS13 new status bar style UIStatusBarStyleDarkContent Pull Request resolved: https://github.com/facebook/react-native/pull/26294 Differential Revision: D17314054 Pulled By: cpojer fbshipit-source-id: ea109e729bb551dff314bc00a056860a8febb0e9 * [0.61.2] Bump version numbers * Release underlying resources when JS instance is GC'ed on Android try 2 (#26155) Summary: Reland https://github.com/facebook/react-native/pull/24767 The commit had to be reverted because it caused a crash when using remote debugging in chrome. This is normal since jsi is not available in that environment. The crash was caused by `jsContext.get()` being 0, then being dereferenced later in c++. We can simply skip initializing the blob collector in this case. This also includes the fix from https://github.com/facebook/react-native/issues/25720 to fix a crash when using hermes. ## Changelog [Android] [Fixed] - Release underlying resources when JS instance is GC'ed on Android Pull Request resolved: https://github.com/facebook/react-native/pull/26155 Test Plan: Test using RN tester with jsc and hermes Test remote debugging Reviewed By: mdvacca, fred2028 Differential Revision: D17072644 Pulled By: makovkastar fbshipit-source-id: 079d1d43501e854297fbbe586ba229920c892584 * Bump SoLoader to 0.8.0 (#26759) Summary: This PR bumps bumps Soloader to 0.8.0. This fixes white screen/ crash issues when downloading from Google Play. Related to: https://github.com/facebook/react-native/issues/25927 #26400 ## Changelog [Android] [Changed] - Bump Soloader to 0.8.0 Pull Request resolved: https://github.com/facebook/react-native/pull/26759 Test Plan: A few CI tests fail, but I don't see the link with what I changed, especially the ios tests. It's working locally though, and for people on github who tried this solution as well. Differential Revision: D17828891 Pulled By: mdvacca fbshipit-source-id: 1c7809aa681b41b8ed9a4da96d041d52f3cfbb76 * Revert "Bump SoLoader to 0.8.0 (#26759)" This reverts commit 66ae1caccd2c1142c519ce1913a6ac15d6f335fa. * Improve Flow Type for ScrollResponder Summary: FlatList and VirtualizedList were typing this value as any instead of using the actual type from ScrollView. I started with that change and then fixed the type to solve the other callsites in the codebase. Reviewed By: zackargyle Differential Revision: D17089934 fbshipit-source-id: bfc22cec9993904d779cad37b1de7cb3c0484d2c * Migrate scrollResponderScrollNativeHandleToKeyboard function to take nativeRef Summary: We need to get rid of findNodeHandle calls so migrating scrollResponderScrollNativeHandleToKeyboard to take a ref to a host component. I made this change with Flow, and tested by rendering UserJobApplicationForm Reviewed By: mdvacca Differential Revision: D17099280 fbshipit-source-id: 96af692006aace2c206f268f5416984b00f8a438 * Fix exception in scrollResponderScrollNativeHandleToKeyboard when ref is null Summary: We are seeing these errors in prod: ``` TypeError: Cannot read property '_nativeTag' of null at ReactNativeFiberHostComponent.prototype.measureLayout(ReactNativeRenderer-prod.fb.js:1594) ScrollResponderMixin.scrollResponderScrollNativeHandleToKeyboard(ScrollResponder.js:557) ``` This error is coming from these lines: https://github.com/facebook/react-native/blob/69c38e5a639f34620038ae5724426c92c355e509/Libraries/Components/ScrollResponder.js#L563-L567 Either `nodeHandle` is null or `this.getInnerViewRef()`. If `nodeHandle` was null, we'd get an error that we can't call `measureLayout` on null. So `this.getInnerViewRef()` must be null. In the React Native Renderer this error of `_nativeTag of null` is coming from this line: https://github.com/facebook/react/blob/db8afe4f6318dba422177a2054204ef089570ad8/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js#L84 Which means indeed `this.getInnerViewRef()` is null. So adding a null check here which is what we do at all the other product callsites of `measureLayout`. Flow should have caught this, but because ScrollView is one of the only components left using mixins (ScrollResponder), `this.getInnerViewRef` is typed as `any` instead of what it should be: ``` ?React.ElementRef>> ``` If `scrollResponder` was typed correctly then Flow would have caught this. Changelog: [Fixed] Exception in scrollResponderScrollNativeHandleToKeyboard when ref is null Reviewed By: mmmulani Differential Revision: D17717150 fbshipit-source-id: d7bc4c897ad259fb588e8100f37ccfb8a5d07874 * Fix bug where ScrollView contentInset top set to undefined wouldn't default to 0 Summary: If you passed ``` contentInset: { bottom: 10 } ``` then it wouldn't go into the if case and it could try to call `setOffset` with `undefined`. `setOffset` requires a number. Changelog: [Fix][ScrollView] ScrollView contentInset top now defaults to 0 in expected situations Reviewed By: JoshuaGross Differential Revision: D17796155 fbshipit-source-id: 951dbbb0de1052f64a6835963e8bbc564990c120 * Fix TimingAnimation rounding error issue (Take 2) Summary: This fixes a bug where the frames array can contain a duplicate entry at the end. For example, suppose the duration is 1000.0 then it would create an array with the following: ``` [ 0, 0.0010119824303159884, 0.00391003997863186, 0.00851330482578147, 0.01466951184383165, 0.022249135687575607, 0.03114100006836614, 0.041248932923769244, 0.05248918022066495, 0.06478838042267626, 0.07808196049642172, 0.09231285402599128, 0.1074304693764467, 0.12338985513375342, 0.14015102395653428, 0.15767840628626964, 0.17594041329987542, 0.1949090949486824, 0.21455988464815853, 0.23487142789035506, 0.25582549864491233, 0.27740701626433145, 0.2996041891505173, 0.3224088345090182, 0.34581696665965683, 0.36982983491413496, 0.394455794287552, 0.4197139228812336, 0.44564199741037275, 0.4723190090623474, 0.5000000572130084, 0.5276809909376533, 0.5543580025896278, 0.5802860771187669, 0.6055442057124484, 0.6301701650858652, 0.6541830333403433, 0.6775911654909819, 0.7003958108494828, 0.7225929837356684, 0.7441745013550876, 0.7651285721096447, 0.785440115351841, 0.8050909050513173, 0.8240595867001241, 0.84232159371373, 0.8598489760434653, 0.876610144866246, 0.8925695306235529, 0.9076871459740083, 0.9219180395035779, 0.9352116195773232, 0.9475108197793346, 0.9587510670762303, 0.9688589999316335, 0.9777508643124241, 0.9853304881561681, 0.9914866951742183, 0.996089960021368, 0.9989880175696839, 1, 1 ] ``` With this change, it now generates the following array: ``` [ 0, 0.0010119824303159884, 0.00391003997863186, 0.00851330482578147, 0.01466951184383165, 0.022249135687575607, 0.03114100006836614, 0.041248932923769244, 0.05248918022066495, 0.06478838042267626, 0.07808196049642172, 0.09231285402599128, 0.1074304693764467, 0.12338985513375342, 0.14015102395653428, 0.15767840628626964, 0.17594041329987542, 0.1949090949486824, 0.21455988464815853, 0.23487142789035506, 0.25582549864491233, 0.27740701626433145, 0.2996041891505173, 0.3224088345090182, 0.34581696665965683, 0.36982983491413496, 0.394455794287552, 0.4197139228812336, 0.44564199741037275, 0.4723190090623474, 0.5000000572130084, 0.5276809909376533, 0.5543580025896278, 0.5802860771187669, 0.6055442057124484, 0.6301701650858652, 0.6541830333403433, 0.6775911654909819, 0.7003958108494828, 0.7225929837356684, 0.7441745013550876, 0.7651285721096447, 0.785440115351841, 0.8050909050513173, 0.8240595867001241, 0.84232159371373, 0.8598489760434653, 0.876610144866246, 0.8925695306235529, 0.9076871459740083, 0.9219180395035779, 0.9352116195773232, 0.9475108197793346, 0.9587510670762303, 0.9688589999316335, 0.9777508643124241, 0.9853304881561681, 0.9914866951742183, 0.996089960021368, 0.9989880175696839, 1 ] ``` Note that the duplicate 1 at the end is now gone. This is because previously when it accumulated dt for 60 frames. dt wasn't quite exactly 1000, it was instead 999.9999999999999 and so didn't break out of the loop when it should have. This adds a tolerance so that it does break out of the loop. Reviewed By: dimach1977 Differential Revision: D17828204 fbshipit-source-id: 4483303de852071436cf9a82e50296baf3392329 * Fix ref type for Native Scroll View Summary: These types were wrong, this is a HostComponent, not a ReactNative.NativeComponent Reviewed By: lunaleaps Differential Revision: D17862305 fbshipit-source-id: e1e7acc7a5892f124b07cdc39d73d6ce7d414063 * Fix selecting videos from library in iOS 13 Summary: In iOS 13, Apple made a change that results in video URLs returned by UIImagePickerController becoming invalidated as soon as the info object from the delegate callback is released. This commit works around this issue by retaining these info objects by default and giving the application a way to release them once it is done processing the video. See also https://stackoverflow.com/questions/57798968/didfinishpickingmediawithinfo-returns-different-url-in-ios-13 Reviewed By: olegbl, mmmulani Differential Revision: D17845889 fbshipit-source-id: 12d0e496508dafa2581ef12730f7537ef98c60e2 * Fix bug in iOS13 nested text rendering Summary: This fixes a bug reported by Oculus and OSS. https://github.com/facebook/react-native/issues/26577 When rendering images nested in a `` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31 * Revert "Fix ref type for Native Scroll View" This reverts commit db662af5b28d0ad42abd1da67c32f2c38ff04900. * Invalidate cache * [0.61.3] Bump version numbers * Revert release and remove extraneous commits This reverts commit 7fa3eef2a11b094a59a43fb7db4ba5edb9ccdff5. * Revert "Fix exception in scrollResponderScrollNativeHandleToKeyboard when ref is null" This reverts commit 0da6a9bb45dc085db701de06ac354538e6814c64. * Revert "Migrate scrollResponderScrollNativeHandleToKeyboard function to take nativeRef" This reverts commit 09c4e7caf053d593d897f80ccd9df8f5bf96252b. * Revert "Improve Flow Type for ScrollResponder" This reverts commit 54bf3ae1cfaf49562d60ebf06386c157fc27131e. * [0.61.3] Bump version numbers * Bump react to 16.9.0 (#27060) * Bump react to 16.9.0 * Update package.json * might as well do everything * Update package.json * fix build with hermes on windows (#26556) Summary: On the Windows platform, with hermes-engine enabled, the assembly crashes with an error: ![image](https://user-images.githubusercontent.com/8634793/65568495-ab11d980-df8c-11e9-83a0-2a2d26447860.png) The problem lies in calling hermes command without the leading arguments `"cmd", "/c"` ([react.gradle, line: 152](https://github.com/facebook/react-native/blob/e028ac7af2d5b48860f01055f3bbacf91f6b6956/react.gradle#L152) ) ## Changelog [General] [Fixed] - Added a platform check and running commandLine with the corresponding arguments Pull Request resolved: https://github.com/facebook/react-native/pull/26556 Test Plan: Under Windows, enable hermes-engine in _build.gradle_ and run the `gradlew assembleRelease` or `gradlew bundleRelease` command Also check assembly on other available platforms Differential Revision: D17587023 Pulled By: cpojer fbshipit-source-id: bab10213b23fac5ab6a46ac4929759dcd43e39c2 * Don't wrap console methods for metro logging in Chrome debugger (#26883) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/26883 This diff fixes an issue reported in https://github.com/facebook/react-native/issues/26788 where logs in the Chrome console were showing a different location than previous versions. In the change here, we stop wrapping the console functions to attach the metro websocket in any environment that isn't a native app environment. We do this by checking `global.nativeLoggingHook` which is bound only by native apps and not environments like the Chrome DevTools. Changelog: [General][Fixed] - Fix wrong lines logging in Chrome debugger Reviewed By: cpojer, gaearon Differential Revision: D17951707 fbshipit-source-id: f045ea9abaa8aecc6afb8eca7db9842146a3d872 * Reverts "Timing: Fixes timer when app get into background (#24649)" (#27065) This reverts commit 338298417f8077dee177057c57b38671b4ec8c75 * [0.61.4] Bump version numbers * fix: Bundle assets in monorepo (#26940) Summary: In monorepo environment, `metro` isn't able to resolve `react-native` because the path to it is hardcoded. I've also added `packagingOptions` to RNTester to make Android builds work for me. Let me know if this is something that is only specific to my setup, and shouldn't be added. ## Changelog [Android] [Fixed] - Fix `bundleReleaseJsAndAssets` in monorepo env Pull Request resolved: https://github.com/facebook/react-native/pull/26940 Test Plan: - [x] - Works in monorepo setup on MacOS - [x] - Works with RNTester app Differential Revision: D18323703 Pulled By: cpojer fbshipit-source-id: b8eb15dfd8a32ae11fd862fc725af9cffea2cf96 * Fix multiple `set-cookie` not aggregated correctly in response headers (#27066) Summary: Multiple `set-cookie` headers should be aggregated as one `set-cookie` with values in a comma separated list. It is working as expected on iOS but not on Android. On Android, only the last one is preserved The problem arises because `NetworkingModule.translateHeaders()` uses `WritableNativeMap` as the translated headers but uses both native and non-native methods. The mixup causes out of sync data that both sets of methods do no agree. A simple fix is to use `Bundle` as the storage and only convert it to `WritableMap` at the end in one go Related issues: https://github.com/facebook/react-native/issues/26280, https://github.com/facebook/react-native/issues/21795, https://github.com/facebook/react-native/issues/23185 ## Changelog [Android] [Fixed] - Fix multiple headers of the same name (e.g. `set-cookie`) not aggregated correctly Pull Request resolved: https://github.com/facebook/react-native/pull/27066 Test Plan: A mock api, https://demo6524373.mockable.io/, will return 2 `set-cookie` as follows: ``` set-cookie: cookie1=value1 set-cookie: cookie2=value2 ``` Verify the following will print the `set-cookie` with a value `cookie1=value1, cookie2=value2` ```javascript fetch('https://demo6524373.mockable.io/') .then(response => { console.log(response.headers); }); ``` On iOS, `set-cookie` will have `cookie1=value1, cookie2=value2` while on Android it will have `cookie2=value2` (preserving only the last one) Differential Revision: D18298933 Pulled By: cpojer fbshipit-source-id: ce53cd41d7c6de0469700617900f30a7d0914c26 * - Bump CLI to ^3.0.0 (#27235) Summary: Upgrading CLI to latest. It's likely not yet compatible with master, because we depend on Metro 0.56, and master is on 0.57. This diff is intended to be cherry-picked to 0.61 and 0.62. cc grabbou ## Changelog [Internal] [Changed] - Bump CLI to ^3.0.0 Pull Request resolved: https://github.com/facebook/react-native/pull/27235 Test Plan: None Differential Revision: D18527709 Pulled By: cpojer fbshipit-source-id: 44448058c48a66d22a1d71abdc908f532f5aa547 * [0.61.5] Bump version numbers * Create and checkout branch for 0.61 merge: fb61merge * Fix up some basic merge issues with config files * Mostly fixing bad merges and podfile moves. Gets iOS building and some progress to getting macOS built * JS is not lint free. * iOS RNTester booting * Update test snapshot files * Get macOS building. Mostly image-related fixup with high probability of regression. Also take the opportunity to remove some stuff from RCTUIKit to help de-monolithize it * Fix iOS build breaks from last commit * Fix minor yarn lint issues to bring yarn lint parity with facebook's 0.61-stable branch * RNTester booting, but UIView is now being rejected because generated view config doesn't match native. * Fix a few yarn flow-check-ios issues * Make iOS flow clean * RNTester mac booting * Fix all yarn flow-check-macos issues * Add macOS equivalents for new iOS bundles * Make Android pass flow check * Fixed merge conflict errors, updated upstream diff comments. * Fixed more merge comments * Fixed PaperUIManager.js to add 'ios' || 'macos' case. Enabled building of RCTSurface for macos. * Fix macOS unit tests. * All macOS tests passing * Updated build scripts to build and test via Pods. * Fix lint and flow errors * Fix pod install * Change files * Fix build script to specify RNTesterPods.xcworkspace * Fix Release * Change files * Remove beachball change files. * Fix beachball to exclude internal packages * Fix react-native-macos-init * Fix react-native run-macos * Fix react-native-xcode.sh to work in repo and out of repo. * Fix RedBox * Synchronize android sources under ReactAndroid & ReactCommon with RNv0.61.5 .. This builds a clean base upon which all the patches will be rebased .. * Patches for some of the basic build customizations. Includes (1) Nuget step configuration files (2) build param to support excluding all SOs from library archives * Exclude package from beachball * Fixing the nuget configuration patches.. which was badly created last time * V8Integration patches * Changing patching command in pipeline definitions to only apply rebased patches * Consuming downloaded third party packages for folly, glog, double-conv and boost * Fixing the pipeline hacky step to update the POM file Co-authored-by: David Vacca Co-authored-by: Eli White Co-authored-by: Ramanpreet Nara Co-authored-by: Thibault Malbranche Co-authored-by: Michał Osadnik Co-authored-by: Florian Cargoët Co-authored-by: Samuel Susla Co-authored-by: Moti Zilberman Co-authored-by: sunnylqm Co-authored-by: Joshua Gross Co-authored-by: Kevin Gozali Co-authored-by: Rodinei Fagundes Co-authored-by: Kid Commit <26439946+ferdicus@users.noreply.github.com> Co-authored-by: Rick Hanlon Co-authored-by: Brian Vaughn Co-authored-by: Logan Daniels Co-authored-by: David Aurelio Co-authored-by: Adlai Holler Co-authored-by: Onti Vals Co-authored-by: Dan Abramov Co-authored-by: Sidharth Guglani Co-authored-by: Bruno Lemos Co-authored-by: Kant Co-authored-by: Scott Rice Co-authored-by: Avik Chaudhuri Co-authored-by: justin ross Co-authored-by: Jakob Krigovsky Co-authored-by: Vojtech Novak Co-authored-by: Oleksandr Melnykov Co-authored-by: iyegoroff Co-authored-by: Michał Pierzchała Co-authored-by: Ram N Co-authored-by: Spencer Ahrens Co-authored-by: jeswinsimon Co-authored-by: empyrical Co-authored-by: Adam Ernst Co-authored-by: jsfu Co-authored-by: Rodrigo Salazar Co-authored-by: Pascal Hartig Co-authored-by: Peter Argany Co-authored-by: Marc Horowitz Co-authored-by: Mike Grabowski Co-authored-by: Mehdi Mulani Co-authored-by: SachinTotale Co-authored-by: James Treanor Co-authored-by: Max Thirouin Co-authored-by: Gabriel Furini Co-authored-by: REDMOND\acoates Co-authored-by: Alexander Kawrykow Co-authored-by: Dulmandakh Co-authored-by: Frieder Bluemle Co-authored-by: Krzysztof Magiera Co-authored-by: Tom Targosz Co-authored-by: Pavlos Vinieratos Co-authored-by: Miguel Alatzar Co-authored-by: Janic Duplessis Co-authored-by: gaodeng Co-authored-by: Alaa Ben El Ahmar Co-authored-by: Martin Sherburn Co-authored-by: Albert Sun Co-authored-by: Ilia Burdukovski Co-authored-by: Radek Czemerys Co-authored-by: Kacper Wiszczuk Co-authored-by: Vincent Cheung Co-authored-by: Anand Rajeswaran Co-authored-by: Anandraj Govindan --- .ado/android-pr.yml | 12 +- .ado/publish.yml | 12 +- .ado/templates/apple-droid-node-patching.yml | 2 +- .ado/templates/apple-job-react-native.yml | 11 +- .ado/templates/prep-android-nuget.yml | 2 +- .appveyor/config.yml | 6 +- .circleci/config.yml | 892 +- .editorconfig | 2 +- .eslintrc | 8 + .flowconfig | 41 +- .flowconfig.android | 39 +- .flowconfig.macos | 40 +- .github/ISSUE_TEMPLATE/bug_report.md | 6 +- .gitignore | 6 + CONTRIBUTING.md | 9 +- IntegrationTests/AccessibilityManagerTest.js | 11 +- IntegrationTests/AppEventsTest.js | 4 +- IntegrationTests/AsyncStorageTest.js | 4 +- .../GlobalEvalWithSourceUrlTest.js | 80 + IntegrationTests/ImageCachePolicyTest.js | 6 +- IntegrationTests/ImageSnapshotTest.js | 4 +- .../IntegrationTestHarnessTest.js | 9 +- IntegrationTests/IntegrationTestsApp.js | 9 +- IntegrationTests/LayoutEventsTest.js | 20 +- IntegrationTests/PromiseTest.js | 16 +- .../ReactContentSizeUpdateTest.js | 10 +- IntegrationTests/SimpleSnapshotTest.js | 5 +- IntegrationTests/SizeFlexibilityUpdateTest.js | 12 +- IntegrationTests/TimersTest.js | 4 +- IntegrationTests/WebSocketTest.js | 6 +- Libraries/ART/ART.xcodeproj/project.pbxproj | 669 - Libraries/ART/ARTGroup.m | 2 +- Libraries/ART/ARTNode.m | 4 +- Libraries/ART/ARTRenderable.m | 2 +- Libraries/ART/ARTShape.m | 2 +- Libraries/ART/ARTSurfaceView.m | 4 +- Libraries/ART/ARTText.m | 2 +- Libraries/ART/Brushes/ARTBrush.m | 2 +- Libraries/ART/Brushes/ARTLinearGradient.m | 2 +- Libraries/ART/Brushes/ARTPattern.m | 2 +- Libraries/ART/Brushes/ARTRadialGradient.m | 2 +- Libraries/ART/Brushes/ARTSolidColor.m | 2 +- Libraries/ART/RCTConvert+ART.m | 8 +- Libraries/ART/React-ART.podspec | 6 +- Libraries/ART/ViewManagers/ARTGroupManager.m | 4 +- Libraries/ART/ViewManagers/ARTNodeManager.m | 4 +- .../ART/ViewManagers/ARTRenderableManager.m | 2 +- Libraries/ART/ViewManagers/ARTShapeManager.m | 4 +- .../ART/ViewManagers/ARTSurfaceViewManager.m | 4 +- Libraries/ART/ViewManagers/ARTTextManager.m | 4 +- Libraries/ActionSheetIOS/ActionSheetIOS.js | 12 +- .../NativeActionSheetManager.js | 51 + .../RCTActionSheet.xcodeproj/project.pbxproj | 328 - .../ActionSheetIOS/RCTActionSheetManager.m | 4 +- .../React-RCTActionSheet.podspec | 6 +- Libraries/Alert/Alert.js | 91 +- Libraries/Alert/AlertMacOS.js | 4 +- Libraries/Alert/NativeAlertManager.js | 34 + Libraries/Alert/RCTAlertManager.android.js | 8 +- Libraries/Alert/RCTAlertManager.ios.js | 15 +- Libraries/Alert/RCTAlertManager.macos.js | 2 +- Libraries/Animated/release/.gitignore | 1 - Libraries/Animated/release/package.json | 5 +- Libraries/Animated/src/Animated.js | 23 +- Libraries/Animated/src/AnimatedEvent.js | 5 +- .../Animated/src/AnimatedImplementation.js | 7 +- Libraries/Animated/src/AnimatedMock.js | 2 +- Libraries/Animated/src/AnimatedWeb.js | 6 +- Libraries/Animated/src/Easing.js | 18 +- .../Animated/src/NativeAnimatedHelper.js | 105 +- .../Animated/src/NativeAnimatedModule.js | 70 + .../Animated/src/__tests__/Animated-test.js | 9 + .../src/__tests__/AnimatedNative-test.js | 13 +- .../src/__tests__/TimingAnimation-test.js | 32 + .../Animated/src/__tests__/bezier-test.js | 2 +- .../Animated/src/animations/Animation.js | 4 +- .../Animated/src/animations/DecayAnimation.js | 9 +- .../src/animations/SpringAnimation.js | 14 +- .../src/animations/TimingAnimation.js | 5 +- Libraries/Animated/src/bezier.js | 2 +- .../src/components/AnimatedFlatList.js | 4 +- .../Animated/src/components/AnimatedImage.js | 2 +- .../src/components/AnimatedScrollView.js | 4 +- .../src/components/AnimatedSectionList.js | 4 +- .../Animated/src/components/AnimatedText.js | 2 +- .../Animated/src/components/AnimatedView.js | 2 +- .../Animated/src/createAnimatedComponent.js | 2 +- .../src/nodes/AnimatedInterpolation.js | 17 +- Libraries/Animated/src/nodes/AnimatedNode.js | 2 +- Libraries/Animated/src/nodes/AnimatedProps.js | 1 + Libraries/Animated/src/nodes/AnimatedStyle.js | 4 +- Libraries/AppState/AppState.js | 58 +- Libraries/AppState/NativeAppState.js | 6 +- Libraries/BatchedBridge/BatchedBridge.js | 2 +- Libraries/BatchedBridge/MessageQueue.js | 85 +- Libraries/BatchedBridge/NativeModules.js | 26 +- .../__mocks__/MessageQueueTestConfig.js | 22 +- .../__mocks__/MessageQueueTestModule.js | 2 +- .../__tests__/MessageQueue-test.js | 6 +- .../__tests__/NativeModules-test.js | 169 +- Libraries/Blob/BlobManager.js | 29 +- Libraries/Blob/BlobRegistry.js | 2 +- Libraries/Blob/FileReader.js | 23 +- Libraries/Blob/NativeBlobModule.js | 26 + Libraries/Blob/NativeFileReaderModule.js | 23 + .../Blob/RCTBlob.xcodeproj/project.pbxproj | 499 - Libraries/Blob/RCTBlobCollector.mm | 2 +- Libraries/Blob/RCTBlobManager.mm | 2 +- Libraries/Blob/RCTFileReaderModule.m | 4 +- Libraries/Blob/React-RCTBlob.podspec | 8 +- Libraries/Blob/URL.js | 26 +- Libraries/Blob/__mocks__/FileReaderModule.js | 4 +- Libraries/Blob/__tests__/URL-test.js | 2 + Libraries/BugReporting/BugReporting.js | 20 +- Libraries/BugReporting/NativeBugReporting.js | 20 + Libraries/BugReporting/dumpReactTree.js | 2 +- Libraries/CameraRoll/CameraRoll.js | 250 - Libraries/CameraRoll/ImagePickerIOS.js | 55 - .../RCTCameraRoll.xcodeproj/project.pbxproj | 310 - Libraries/CameraRoll/RCTCameraRollManager.m | 2 +- Libraries/CameraRoll/RCTImagePickerManager.m | 30 +- .../CameraRoll/React-RCTCameraRoll.podspec | 39 - Libraries/Color/normalizeColor.js | 2 +- .../Color/normalizeColorObject.android.js | 2 +- Libraries/Color/normalizeColorObject.ios.js | 4 +- Libraries/Color/normalizeColorObject.macos.js | 4 +- .../AccessibilityInfo.android.js | 23 +- .../AccessibilityInfo.ios.js | 52 +- .../NativeAccessibilityInfo.js | 27 + .../NativeAccessibilityManager.js | 59 + .../ActivityIndicator/ActivityIndicator.js | 18 +- .../ActivityIndicatorSchema.js | 91 - ...> ActivityIndicatorViewNativeComponent.js} | 28 +- .../ActivityIndicator-test.js.snap | 2 - .../AppleTV/NativeTVNavigationEventEmitter.js | 23 + .../Components/AppleTV/TVEventHandler.js | 8 +- Libraries/Components/Button.js | 2 +- .../AndroidCheckBoxNativeComponent.js | 6 +- Libraries/Components/Clipboard/Clipboard.js | 6 +- .../Components/Clipboard/NativeClipboard.js | 22 + .../DatePicker/DatePickerIOS.ios.js | 11 +- .../DatePickerAndroid.android.js | 5 +- .../NativeDatePickerAndroid.js | 22 + .../DatePickerMacOS.android.js | 8 +- .../DatePickerMacOS/DatePickerMacOS.ios.js | 8 +- .../AndroidDrawerLayoutNativeComponent.js | 80 +- .../DrawerLayoutAndroid.android.js | 70 +- .../__tests__/DrawerAndroid-test.js | 12 +- .../__snapshots__/DrawerAndroid-test.js.snap | 10 +- Libraries/Components/Keyboard/Keyboard.js | 45 +- .../Keyboard/KeyboardAvoidingView.js | 7 +- .../Keyboard/NativeKeyboardObserver.js | 21 + .../MaskedView/MaskedViewIOS.ios.js | 4 +- .../MaskedView/MaskedViewIOS.macos.js | 2 +- .../RCTMaskedViewNativeComponent.js | 11 +- .../AndroidDialogPickerNativeComponent.js | 51 +- .../AndroidDropdownPickerNativeComponent.js | 51 +- Libraries/Components/Picker/Picker.js | 12 +- .../Picker/PickerAndroid.android.js | 169 +- .../Components/Picker/PickerAndroid.macos.js | 2 +- Libraries/Components/Picker/PickerIOS.ios.js | 14 +- .../ProgressBarAndroid.android.js | 2 +- .../ProgressBarAndroid.macos.js | 2 +- .../ProgressBarAndroidNativeComponent.js | 24 +- .../__tests__/ProgressBarAndroid-test.js | 4 +- .../ProgressViewIOS/ProgressViewIOS.ios.js | 3 +- .../ProgressViewIOS/ProgressViewIOS.macos.js | 3 +- .../RCTProgressViewNativeComponent.js | 19 +- ...ndroidSwipeRefreshLayoutNativeComponent.js | 42 +- .../AndroidSwipeRefreshLayoutSchema.js | 98 - ...js => PullToRefreshViewNativeComponent.js} | 21 +- .../RefreshControl/PullToRefreshViewSchema.js | 80 - .../RefreshControl/RefreshControl.js | 15 +- .../__mocks__/RefreshControlMock.js | 2 +- .../RCTSafeAreaViewNativeComponent.js | 19 +- .../Components/SafeAreaView/SafeAreaView.js | 7 +- Libraries/Components/ScrollView/ScrollView.js | 73 +- .../ScrollView/ScrollViewStickyHeader.js | 6 +- .../ScrollView/__mocks__/ScrollViewMock.js | 4 +- .../RCTSegmentedControlNativeComponent.js | 72 +- .../SegmentedControlIOS.ios.js | 44 +- .../SegmentedControlIOS.macos.js | 62 +- .../Slider/RCTSliderNativeComponent.js | 51 - Libraries/Components/Slider/Slider.js | 6 +- .../Slider/SliderNativeComponent.js | 60 + Libraries/Components/Slider/SliderSchema.js | 218 - .../Components/Sound/NativeSoundManager.js | 23 + Libraries/Components/Sound/SoundManager.js | 20 + Libraries/Components/StaticContainer.react.js | 2 +- .../StatusBar/NativeStatusBarManager.js | 54 + Libraries/Components/StatusBar/StatusBar.js | 76 +- .../Components/StatusBar/StatusBarIOS.ios.js | 5 +- .../Switch/AndroidSwitchNativeComponent.js | 49 + Libraries/Components/Switch/Switch.js | 97 +- .../Switch/SwitchNativeComponent.js | 66 +- Libraries/Components/Switch/SwitchSchema.js | 95 - .../AndroidTextInputNativeComponent.js | 2 +- .../TextInput/InputAccessoryView.js | 2 +- .../RCTInputAccessoryViewNativeComponent.js | 21 +- Libraries/Components/TextInput/TextInput.js | 1055 +- .../Components/TextInput/TextInputState.js | 3 +- .../NativeTimePickerAndroid.js | 33 + .../TimePickerAndroid.ios.js | 26 - ...ndroid.android.js => TimePickerAndroid.js} | 23 +- .../TimePickerAndroid.macos.js | 8 +- .../TimePickerAndroidTypes.js | 24 - .../ToastAndroid/NativeToastAndroid.js | 39 + .../ToastAndroid/ToastAndroid.android.js | 21 +- .../ToastAndroid/ToastAndroid.ios.js | 18 + .../ToolbarAndroid/ToolbarAndroid.android.js | 251 - .../ToolbarAndroidNativeComponent.js | 134 - Libraries/Components/Touchable/Touchable.js | 20 +- .../Components/Touchable/TouchableBounce.js | 11 +- .../Touchable/TouchableHighlight.js | 8 +- .../TouchableNativeFeedback.android.js | 10 +- .../Components/Touchable/TouchableOpacity.js | 13 +- .../Touchable/TouchableWithoutFeedback.js | 37 +- .../TouchableHighlight-test.js.snap | 2 +- .../Touchable/ensureComponentIsNative.js | 23 - .../UnimplementedNativeView.js | 29 - .../UnimplementedNativeViewNativeComponent.js | 28 + .../UnimplementedNativeViewSchema.js | 43 - .../UnimplementedViews/UnimplementedView.js | 8 +- .../View/PlatformViewPropTypes.macos.js | 4 +- .../View/ReactNativeStyleAttributes.js | 4 +- .../View/ReactNativeViewAttributes.js | 14 +- .../View/ReactNativeViewViewConfig.js | 76 +- .../View/ReactNativeViewViewConfigAndroid.js | 74 + .../View/ReactNativeViewViewConfigMacOS.js | 55 + Libraries/Components/View/View.js | 22 +- .../Components/View/ViewAccessibility.js | 10 +- .../Components/View/ViewNativeComponent.js | 53 +- Libraries/Components/View/ViewPropTypes.js | 9 +- .../AndroidViewPagerNativeComponent.js | 112 - .../ViewPager/ViewPagerAndroid.android.js | 281 - .../Components/WKWebView/WKWebView.ios.js | 44 - Libraries/Core/Devtools/getDevServer.js | 9 +- Libraries/Core/Devtools/parseErrorStack.js | 9 +- Libraries/Core/Devtools/setupDevtools.js | 46 - .../Core/Devtools/symbolicateStackTrace.js | 13 +- Libraries/Core/ExceptionsManager.js | 116 +- Libraries/Core/InitializeCore.js | 1 - Libraries/Core/NativeExceptionsManager.js | 116 + Libraries/Core/ReactFiberErrorDialog.js | 54 + Libraries/Core/ReactNativeVersion.js | 4 +- Libraries/Core/ReactNativeVersionCheck.js | 11 +- .../SegmentFetcher/NativeSegmentFetcher.js | 7 +- Libraries/Core/Timers/JSTimers.js | 59 +- Libraries/Core/Timers/NativeTiming.js | 27 + .../Core/__tests__/ExceptionsManager-test.js | 481 + .../Core/__tests__/MapAndSetPolyfills-test.js | 102 - .../__tests__/ReactNativeVersionCheck-test.js | 11 +- Libraries/Core/polyfillES6Collections.js | 27 - Libraries/Core/setUpBatchedBridge.js | 83 +- Libraries/Core/setUpDeveloperTools.js | 101 +- Libraries/Core/setUpReactRefresh.js | 48 + Libraries/Core/setUpSegmentFetcher.js | 47 +- Libraries/Core/setUpTimers.js | 39 +- .../DeprecatedEdgeInsetsPropType.js | 7 +- .../DeprecatedImagePropType.js | 22 +- .../DeprecatedImageStylePropTypes.js | 18 +- .../DeprecatedLayoutPropTypes.js | 193 +- .../DeprecatedPointPropType.js | 5 +- .../DeprecatedShadowPropTypesIOS.js | 4 +- .../DeprecatedTextInputPropTypes.js | 535 + .../DeprecatedTextPropTypes.js | 125 +- .../DeprecatedTextStylePropTypes.js} | 77 +- .../DeprecatedTransformPropTypes.js | 39 +- .../DeprecatedViewPropTypes.js | 75 +- .../DeprecatedViewStylePropTypes.js | 13 +- .../EventEmitter/RCTDeviceEventEmitter.js | 2 +- Libraries/Experimental/Incremental.js | 12 +- Libraries/Experimental/IncrementalExample.js | 5 +- .../Experimental/IncrementalPresenter.js | 11 +- Libraries/Experimental/WindowedListView.js | 18 +- Libraries/FBLazyVector/BUCK | 11 + .../FBLazyVector.podspec} | 9 +- .../FBLazyVector/FBLazyIterator.h | 125 + .../FBLazyVector/FBLazyVector/FBLazyVector.h | 99 + Libraries/FBReactNativeSpec/BUCK | 23 + .../FBReactNativeSpec.podspec | 31 +- .../FBReactNativeSpec-generated.mm | 2373 ++ .../FBReactNativeSpec/FBReactNativeSpec.h | 3100 ++ .../{Utilities => HeapCapture}/HeapCapture.js | 9 +- Libraries/HeapCapture/NativeHeapCapture.js | 24 + Libraries/Image/Image.js | 4 +- Libraries/Image/ImageBackground.js | 5 +- Libraries/Image/ImageEditor.js | 73 - Libraries/Image/ImagePickerIOS.js | 105 + Libraries/Image/ImageSource.js | 1 - Libraries/Image/ImageStore.js | 108 - Libraries/Image/ImageViewNativeComponent.js | 2 +- Libraries/Image/NativeImageLoader.js | 20 + Libraries/Image/NativeImagePickerIOS.js | 40 + Libraries/Image/RCTAnimatedImage.h | 25 + Libraries/Image/RCTAnimatedImage.m | 176 + Libraries/Image/RCTGIFImageDecoder.h | 2 +- Libraries/Image/RCTGIFImageDecoder.m | 102 +- .../Image/RCTImage.xcodeproj/project.pbxproj | 667 - Libraries/Image/RCTImageBlurUtils.m | 2 +- Libraries/Image/RCTImageCache.h | 31 +- Libraries/Image/RCTImageCache.m | 6 +- Libraries/Image/RCTImageDataDecoder.h | 53 + Libraries/Image/RCTImageEditingManager.m | 80 - Libraries/Image/RCTImageLoader.h | 264 - Libraries/Image/RCTImageLoaderProtocol.h | 116 + Libraries/Image/RCTImageShadowView.m | 2 +- Libraries/Image/RCTImageURLLoader.h | 73 + Libraries/Image/RCTImageUtils.m | 2 +- Libraries/Image/RCTImageView.m | 67 +- Libraries/Image/RCTImageViewManager.m | 61 +- Libraries/Image/RCTLocalAssetImageLoader.h | 2 +- Libraries/Image/RCTLocalAssetImageLoader.m | 2 +- Libraries/Image/RCTResizeMode.m | 2 +- Libraries/Image/RCTUIImageViewAnimated.h | 17 + Libraries/Image/RCTUIImageViewAnimated.m | 337 + Libraries/Image/React-RCTImage.podspec | 6 +- Libraries/Image/RelativeImageStub.js | 4 +- .../Image/TextInlineImageNativeComponent.js | 2 +- .../__tests__/resolveAssetSource-test.js | 57 +- Libraries/Image/assetPathUtils.js | 9 +- Libraries/Image/resolveAssetSource.js | 5 +- Libraries/Inspector/BorderBox.js | 2 +- Libraries/Inspector/BoxInspector.js | 3 +- Libraries/Inspector/ElementBox.js | 4 +- Libraries/Inspector/ElementProperties.js | 2 +- Libraries/Inspector/Inspector.js | 4 +- Libraries/Inspector/InspectorOverlay.js | 8 +- Libraries/Inspector/InspectorPanel.js | 4 +- Libraries/Inspector/NetworkOverlay.js | 4 +- Libraries/Inspector/PerformanceOverlay.js | 2 +- Libraries/Inspector/StyleInspector.js | 2 +- Libraries/Inspector/resolveBoxStyle.js | 6 +- Libraries/Interaction/FrameRateLogger.js | 20 +- Libraries/Interaction/InteractionManager.js | 4 +- Libraries/Interaction/InteractionMixin.js | 7 +- .../Interaction/NativeFrameRateLogger.js | 24 + Libraries/Interaction/PanResponder.js | 20 +- .../__tests__/InteractionManager-test.js | 2 +- Libraries/JSInspector/NetworkAgent.js | 2 +- Libraries/LayoutAnimation/LayoutAnimation.js | 23 +- Libraries/Linking/Linking.js | 2 +- Libraries/Linking/NativeLinking.js | 4 +- .../RCTLinking.xcodeproj/project.pbxproj | 402 - Libraries/LinkingIOS/RCTLinkingManager.h | 5 - Libraries/LinkingIOS/RCTLinkingManager.m | 8 +- Libraries/LinkingIOS/React-RCTLinking.podspec | 6 +- Libraries/Lists/FillRateHelper.js | 20 +- Libraries/Lists/FlatList.js | 154 +- Libraries/Lists/SectionList.js | 19 +- Libraries/Lists/VirtualizedList.js | 261 +- Libraries/Lists/VirtualizedSectionList.js | 31 +- .../Lists/__flowtests__/FlatList-flowtest.js | 12 +- .../__flowtests__/SectionList-flowtest.js | 4 +- Libraries/Lists/__tests__/FlatList-test.js | 35 + .../Lists/__tests__/VirtualizeUtils-test.js | 2 +- .../Lists/__tests__/VirtualizedList-test.js | 55 + .../__tests__/VirtualizedSectionList-test.js | 94 + .../__snapshots__/FlatList-test.js.snap | 226 + .../VirtualizedList-test.js.snap | 110 + Libraries/Modal/Modal.js | 58 +- Libraries/Modal/ModalSchema.js | 182 - Libraries/Modal/NativeModalManager.js | 22 + .../Modal/RCTModalHostViewNativeComponent.js | 80 +- .../Drivers/RCTDecayAnimation.m | 6 +- .../Drivers/RCTEventAnimation.m | 2 +- .../Drivers/RCTFrameAnimation.m | 6 +- .../Drivers/RCTSpringAnimation.m | 6 +- .../Nodes/RCTAdditionAnimatedNode.m | 2 +- .../NativeAnimation/Nodes/RCTAnimatedNode.h | 2 +- .../NativeAnimation/Nodes/RCTAnimatedNode.m | 4 +- .../Nodes/RCTDiffClampAnimatedNode.m | 2 +- .../Nodes/RCTDivisionAnimatedNode.m | 2 +- .../Nodes/RCTInterpolationAnimatedNode.m | 114 +- .../Nodes/RCTModuloAnimatedNode.m | 2 +- .../Nodes/RCTMultiplicationAnimatedNode.m | 2 +- .../Nodes/RCTPropsAnimatedNode.m | 17 +- .../Nodes/RCTStyleAnimatedNode.m | 8 +- .../Nodes/RCTSubtractionAnimatedNode.m | 2 +- .../Nodes/RCTTrackingAnimatedNode.m | 6 +- .../Nodes/RCTTransformAnimatedNode.m | 4 +- .../Nodes/RCTValueAnimatedNode.h | 1 + .../Nodes/RCTValueAnimatedNode.m | 2 +- .../RCTAnimation.xcodeproj/project.pbxproj | 893 - Libraries/NativeAnimation/RCTAnimationUtils.m | 2 +- .../NativeAnimation/RCTNativeAnimatedModule.m | 46 +- .../RCTNativeAnimatedNodesManager.h | 2 - .../RCTNativeAnimatedNodesManager.m | 64 +- .../React-RCTAnimation.podspec | 4 +- .../specs/NativeAnimationsDebugModule.js | 21 + .../NativeModules/specs/NativeDevSettings.js | 28 + .../specs/NativeDeviceEventManager.js | 20 + .../specs/NativeDialogManagerAndroid.js | 49 + Libraries/NativeModules/specs/NativeRedBox.js | 21 + .../NativeModules/specs/NativeSourceCode.js | 22 + Libraries/Network/NativeNetworkingAndroid.js | 38 + Libraries/Network/NativeNetworkingIOS.js | 38 + Libraries/Network/RCTDataRequestHandler.m | 2 +- Libraries/Network/RCTFileRequestHandler.m | 2 +- Libraries/Network/RCTHTTPRequestHandler.mm | 24 +- Libraries/Network/RCTNetInfo.m | 6 +- .../RCTNetwork.xcodeproj/project.pbxproj | 485 - Libraries/Network/RCTNetworking.android.js | 13 +- Libraries/Network/RCTNetworking.js | 21 +- Libraries/Network/RCTNetworking.mm | 2 +- Libraries/Network/React-RCTNetwork.podspec | 6 +- Libraries/Network/XMLHttpRequest.js | 6 +- .../Network/__tests__/XMLHttpRequest-test.js | 5 + Libraries/Network/fetch.js | 10 +- .../components/DebugInstructions.js | 9 +- Libraries/NewAppScreen/components/Header.js | 8 +- .../NewAppScreen/components/LearnMoreLinks.js | 10 +- .../components/ReloadInstructions.js | 7 +- .../Performance/NativeJSCSamplingProfiler.js | 20 + .../Performance/QuickPerformanceLogger.js | 11 - Libraries/Performance/SamplingProfiler.js | 7 +- .../NativePermissionsAndroid.js | 59 + .../PermissionsAndroid/PermissionsAndroid.js | 205 +- .../NativePushNotificationManagerIOS.js | 74 + .../PushNotificationIOS.js | 99 +- .../project.pbxproj | 464 - .../RCTPushNotificationManager.h | 10 +- .../RCTPushNotificationManager.m | 16 +- .../React-RCTPushNotification.podspec | 6 +- Libraries/RCTRequired/BUCK | 8 + .../RCTRequired/RCTRequired.podspec | 12 +- .../RCTRequired/RCTRequired/RCTRequired.h | 77 + Libraries/ReactNative/AppContainer.js | 17 +- Libraries/ReactNative/AppRegistry.js | 58 +- Libraries/ReactNative/DummyUIManager.js | 119 + .../HeadlessJsTaskError.js} | 4 +- Libraries/ReactNative/I18nManager.js | 56 +- .../NativeHeadlessJsTaskSupport.js | 21 + Libraries/ReactNative/NativeI18nManager.js | 26 + Libraries/ReactNative/NativeUIManager.js | 122 + Libraries/ReactNative/PaperUIManager.js | 163 + Libraries/ReactNative/RootTagContext.js | 15 + Libraries/ReactNative/UIManager.js | 173 +- Libraries/ReactNative/UIManagerStatTracker.js | 4 +- .../getNativeComponentAttributes.js | 20 +- Libraries/ReactNative/renderApplication.js | 17 +- {lib => Libraries/ReactPrivate}/README | 2 +- .../ReactNativePrivateInitializeCore.js} | 5 +- .../ReactNativePrivateInterface.js | 46 + Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 23496 ++++++++++++++++ .../ReactFabric-dev.js | 13401 +++++---- .../implementations/ReactFabric-prod.fb.js | 7781 +++++ .../ReactFabric-prod.js | 3010 +- .../ReactFabric-profiling.fb.js | 8016 ++++++ .../ReactFabric-profiling.js | 3231 ++- .../ReactNativeRenderer-dev.fb.js | 23104 +++++++++++++++ .../ReactNativeRenderer-dev.js | 9560 ++++--- .../ReactNativeRenderer-prod.fb.js | 7975 ++++++ .../ReactNativeRenderer-prod.js | 3080 +- .../ReactNativeRenderer-profiling.fb.js | 8207 ++++++ .../ReactNativeRenderer-profiling.js | 3134 ++- Libraries/Renderer/shims/ReactFabric.js | 6 +- Libraries/Renderer/shims/ReactFeatureFlags.js | 7 +- Libraries/Renderer/shims/ReactNative.js | 4 +- Libraries/Renderer/shims/ReactNativeTypes.js | 80 +- .../shims/ReactNativeViewConfigRegistry.js | 14 +- Libraries/Renderer/shims/ReactTypes.js | 168 +- .../shims/createReactNativeComponentClass.js | 4 +- Libraries/Sample/Sample.android.js | 3 + .../Sample/Sample.xcodeproj/project.pbxproj | 277 - Libraries/Sample/package.json | 5 +- Libraries/Settings/NativeSettingsManager.js | 26 + .../RCTSettings.xcodeproj/project.pbxproj | 394 - Libraries/Settings/RCTSettingsManager.m | 2 +- Libraries/Settings/React-RCTSettings.podspec | 6 +- Libraries/Settings/Settings.ios.js | 9 +- Libraries/Settings/Settings.macos.js | 4 +- Libraries/Share/NativeShareModule.js | 24 + Libraries/Share/Share.js | 45 +- Libraries/Storage/AsyncStorage.js | 16 +- Libraries/Storage/NativeAsyncStorage.js | 44 + Libraries/StyleSheet/StyleSheet.js | 4 +- Libraries/StyleSheet/StyleSheetTypes.js | 5 + Libraries/StyleSheet/StyleSheetValidation.js | 4 +- .../__tests__/normalizeColor-test.js | 2 +- .../__tests__/splitLayoutProps-test.js | 5 +- Libraries/StyleSheet/processColor.js | 2 +- Libraries/StyleSheet/processColorArray.js | 22 + .../StyleSheet/processColorObject.android.js | 2 +- .../StyleSheet/processColorObject.ios.js | 4 +- .../StyleSheet/processColorObject.macos.js | 4 +- Libraries/StyleSheet/splitLayoutProps.js | 1 + .../Text/BaseText/RCTBaseTextShadowView.h | 5 +- .../Text/BaseText/RCTBaseTextShadowView.m | 24 +- .../Text/BaseText/RCTBaseTextViewManager.m | 2 +- Libraries/Text/RCTConvert+Text.h | 2 +- Libraries/Text/RCTConvert+Text.m | 2 +- .../Text/RCTText.xcodeproj/project.pbxproj | 946 - Libraries/Text/RCTTextAttributes.m | 4 +- Libraries/Text/RawText/RCTRawTextShadowView.m | 2 +- .../Text/RawText/RCTRawTextViewManager.m | 4 +- Libraries/Text/React-RCTText.podspec | 4 +- Libraries/Text/Text/RCTTextShadowView.m | 13 +- Libraries/Text/Text/RCTTextView.m | 24 +- Libraries/Text/Text/RCTTextViewManager.m | 6 +- Libraries/Text/TextAncestor.js | 2 +- .../Multiline/RCTMultilineTextInputView.m | 6 +- .../RCTMultilineTextInputViewManager.m | 4 +- .../Text/TextInput/Multiline/RCTUITextView.m | 6 +- .../TextInput/RCTBackedTextInputDelegate.h | 4 +- .../RCTBackedTextInputDelegateAdapter.h | 2 +- .../RCTBackedTextInputDelegateAdapter.m | 2 +- .../RCTBackedTextInputViewProtocol.h | 2 +- .../TextInput/RCTBaseTextInputShadowView.m | 15 +- .../Text/TextInput/RCTBaseTextInputView.h | 4 +- .../Text/TextInput/RCTBaseTextInputView.m | 35 +- .../TextInput/RCTBaseTextInputViewManager.m | 9 +- .../TextInput/RCTInputAccessoryShadowView.m | 2 +- .../Text/TextInput/RCTInputAccessoryView.m | 4 +- .../TextInput/RCTInputAccessoryViewContent.m | 2 +- .../TextInput/RCTInputAccessoryViewManager.m | 6 +- Libraries/Text/TextInput/RCTTextSelection.m | 2 +- .../Singleline/RCTSinglelineTextInputView.m | 4 +- .../RCTSinglelineTextInputViewManager.m | 6 +- .../TextInput/Singleline/RCTUITextField.m | 21 +- Libraries/Text/TextPropTypes.js | 143 - Libraries/Text/TextProps.js | 2 + .../VirtualText/RCTVirtualTextShadowView.m | 4 +- .../VirtualText/RCTVirtualTextViewManager.m | 4 +- Libraries/TurboModule/RCTExport.js | 14 +- Libraries/TurboModule/TurboModuleRegistry.js | 25 +- .../samples/NativeSampleTurboModule.js | 4 +- Libraries/TypeSafety/RCTConvertHelpers.h | 67 + Libraries/TypeSafety/RCTConvertHelpers.mm | 45 + .../TypeSafety/RCTTypeSafety.podspec | 20 +- .../TypeSafety/RCTTypedModuleConstants.h | 47 + .../TypeSafety/RCTTypedModuleConstants.mm | 48 + Libraries/Types/CodegenTypes.js | 40 + Libraries/Types/CoreEventTypes.js | 20 +- Libraries/UTFSequence.js | 17 +- Libraries/Utilities/BackHandler.android.js | 11 +- Libraries/Utilities/DeviceInfo.js | 8 +- Libraries/Utilities/Dimensions.js | 137 +- .../Utilities/GlobalPerformanceLogger.js | 5 +- Libraries/Utilities/HMRClient.js | 293 +- Libraries/Utilities/HMRClientProdShim.js | 29 + Libraries/Utilities/HMRLoadingView.android.js | 36 - Libraries/Utilities/HMRLoadingView.js | 32 - Libraries/Utilities/JSDevSupportModule.js | 33 +- Libraries/Utilities/LoadingView.android.js | 29 + Libraries/Utilities/LoadingView.ios.js | 32 + .../Utilities/LoadingView.js | 8 +- Libraries/Utilities/LoadingView.macos.js | 32 + Libraries/Utilities/NativeDevLoadingView.js | 25 + Libraries/Utilities/NativeDeviceInfo.js | 49 + Libraries/Utilities/NativeJSDevSupport.js | 25 + .../NativePlatformConstantsAndroid.js | 38 + .../Utilities/NativePlatformConstantsIOS.js | 34 + .../Utilities/NativePlatformConstantsMacOS.js | 32 + Libraries/Utilities/Platform.android.js | 18 +- Libraries/Utilities/Platform.ios.js | 41 +- Libraries/Utilities/Platform.macos.js | 33 +- Libraries/Utilities/ReactNativeTestTools.js | 4 +- .../Utilities/__tests__/DeviceInfo-test.js | 2 +- .../__tests__/buildStyleInterpolator-test.js | 2 +- .../__tests__/codegenNativeComponent-test.js | 67 + .../Utilities/__tests__/stringifySafe-test.js | 6 + ...erifyComponentAttributeEquivalence-test.js | 8 +- Libraries/Utilities/binaryToBase64.js | 2 +- Libraries/Utilities/codegenNativeCommands.js | 31 + Libraries/Utilities/codegenNativeComponent.js | 61 + .../Utilities/createPerformanceLogger.js | 32 +- Libraries/Utilities/differ/insetsDiffer.js | 2 +- .../Utilities/registerGeneratedViewConfig.js | 70 + Libraries/Utilities/setAndForwardRef.js | 5 +- Libraries/Utilities/stringifySafe.js | 2 + Libraries/Utilities/useWindowDimensions.js | 35 + .../verifyComponentAttributeEquivalence.js | 42 +- Libraries/Vibration/NativeVibration.js | 25 + Libraries/Vibration/RCTVibration.m | 2 +- .../RCTVibration.xcodeproj/project.pbxproj | 261 - .../Vibration/React-RCTVibration.podspec | 6 +- Libraries/Vibration/Vibration.js | 14 +- Libraries/WebSocket/NativeWebSocketModule.js | 35 + .../WebSocket/RCTReconnectingWebSocket.m | 92 +- Libraries/WebSocket/RCTSRWebSocket.m | 6 +- .../RCTWebSocket.xcodeproj/project.pbxproj | 754 - Libraries/WebSocket/RCTWebSocketExecutor.m | 4 +- Libraries/WebSocket/RCTWebSocketModule.m | 7 +- .../WebSocket/React-RCTWebSocket.podspec | 37 - Libraries/WebSocket/WebSocket.js | 29 +- Libraries/WebSocket/WebSocketInterceptor.js | 35 +- Libraries/Wrapper/RCTWrapperView.m | 2 +- .../YellowBox/Data/YellowBoxSymbolication.js | 2 +- .../Data/__tests__/YellowBoxRegistry-test.js | 2 +- .../__tests__/YellowBoxSymbolication-test.js | 2 +- .../Data/__tests__/YellowBoxWarning-test.js | 2 +- .../YellowBox/UI/YellowBoxImageSource.js | 55 +- Libraries/YellowBox/UI/YellowBoxInspector.js | 33 +- .../UI/YellowBoxInspectorSourceMapStatus.js | 2 +- .../UI/YellowBoxInspectorStackFrame.js | 32 +- Libraries/YellowBox/UI/YellowBoxList.js | 4 +- Libraries/YellowBox/UI/YellowBoxListRow.js | 8 +- Libraries/YellowBox/UI/YellowBoxPressable.js | 8 +- Libraries/YellowBox/YellowBox.js | 8 +- Libraries/fishhook/LICENSE | 22 - Libraries/fishhook/README.md | 75 - Libraries/fishhook/fishhook.c | 210 - Libraries/fishhook/fishhook.h | 76 - Libraries/polyfills/console.js | 18 + Libraries/polyfills/error-guard.js | 63 +- .../react-native-implementation.js | 329 +- Libraries/vendor/core/ErrorUtils.js | 4 +- Libraries/vendor/core/Map.js | 590 - Libraries/vendor/core/Set.js | 198 - .../core/_shouldPolyfillES6Collection.js | 66 - .../vendor/emitter/EventEmitterWithHolding.js | 6 +- Libraries/vendor/emitter/EventHolder.js | 5 +- Libraries/vendor/emitter/EventValidator.js | 2 +- README.md | 3 +- RNTester/.gitignore | 1 - RNTester/Gemfile | 4 + RNTester/Podfile | 43 +- RNTester/Podfile.lock | 425 +- .../FBSnapshotTestController.h | 2 +- .../FBSnapshotTestController.m | 2 + .../RCTTest/RCTTest.xcodeproj/project.pbxproj | 593 - RNTester/RCTTest/RCTTestRunner.m | 7 +- RNTester/RCTTest/React-RCTTest.podspec | 2 +- RNTester/README.md | 13 +- RNTester/RNTester-macOS/Info.plist | 6 +- .../RNTester_macOS.entitlements | 2 + RNTester/RNTester-tvOS/Info.plist | 2 + RNTester/RNTester.xcodeproj/project.pbxproj | 4537 --- RNTester/RNTester/AppDelegate.mm | 38 +- RNTester/RNTester/RNTester.entitlements | 14 + .../RNTester/RNTesterTurboModuleProvider.h | 11 +- .../RNTester/RNTesterTurboModuleProvider.mm | 13 +- RNTester/RNTesterBundle-macOS/Info.plist | 26 - .../RCTLoggingTests.m | 6 +- .../RCTRootViewIntegrationTests.m | 2 +- .../RCTUIManagerScenarioTests.m | 2 +- .../RNTesterIntegrationTests.m | 3 +- .../RNTesterSnapshotTests.m | 11 +- .../testSimpleSnapshotTest_1_macOS.png | Bin 19241 -> 13329 bytes .../testARTExample_1_macOS.png | Bin 0 -> 12381 bytes .../testLayoutExample_1_macOS.png | Bin 0 -> 12381 bytes .../testScrollViewExample_1_macOS.png | Bin 0 -> 12381 bytes .../testSliderExample_1_macOS.png | Bin 0 -> 12381 bytes .../testSwitchExample_1_macOS.png | Bin 0 -> 12381 bytes .../testTextExample_1_macOS.png | Bin 0 -> 12381 bytes .../testViewExample_1_macOS.png | Bin 0 -> 12381 bytes .../RNTesterPods.xcodeproj/project.pbxproj | 1394 +- .../xcschemes/RNTester-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/RNTester.xcscheme | 16 +- .../RNTesterIntegrationTests.xcscheme} | 102 +- .../xcschemes/RNTesterUnitTests.xcscheme} | 93 +- .../xcschemes/iosDeviceBuild.xcscheme | 67 + .../xcschemes/iosSimulatorBuild.xcscheme | 67 + .../xcschemes/macOSBuild.xcscheme | 67 + .../OCMock/OCMStubRecorder.h | 2 +- RNTester/RNTesterUnitTests/OCMock/OCMock.h | 16 +- .../RNTesterUnitTests/RCTAllocationTests.m | 2 +- .../RCTAnimationUtilsTests.m | 2 +- .../RNTesterUnitTests/RCTBlobManagerTests.m | 2 +- .../RCTBundleURLProviderTests.m | 4 +- .../RCTConvert_NSColorTests.m | 2 + .../RNTesterUnitTests/RCTConvert_NSURLTests.m | 2 +- .../RCTConvert_UIColorTests.m | 2 + .../RCTEventDispatcherTests.m | 4 +- .../RNTesterUnitTests/RCTImageLoaderTests.m | 68 +- .../RNTesterUnitTests/RCTImageUtilTests.m | 5 +- .../RCTMethodArgumentTests.m | 2 +- .../RCTModuleInitNotificationRaceTests.m | 1 + .../RCTNativeAnimatedNodesManagerTests.m | 12 +- RNTester/RNTesterUnitTests/RCTUtilsTests.m | 64 + RNTester/android/app/build.gradle | 29 +- .../react/uiapp/RNTesterActivity.java | 19 +- .../react/uiapp/RNTesterApplication.java | 55 +- RNTester/e2e/__tests__/Button-test.js~HEAD | 55 - RNTester/js/AssetScaledImageExample.js | 92 - RNTester/js/CameraRollExample.js | 162 - RNTester/js/CameraRollView.js | 264 - RNTester/js/ImageEditingExample.js | 315 - RNTester/js/RNTesterApp.android.js | 85 +- RNTester/js/RNTesterApp.ios.js | 44 +- RNTester/js/RNTesterApp.macos.js | 54 +- RNTester/js/RNTesterList.android.js | 257 - RNTester/js/ToolbarAndroidExample.android.js | 186 - .../js/ViewPagerAndroidExample.android.js | 302 - RNTester/js/XHRExampleFormData.js | 242 - .../js/{Thumbnails => assets}/bandaged.png | Bin RNTester/js/{ => assets}/bunny.png | Bin RNTester/js/{Thumbnails => assets}/call.png | Bin .../js/{Thumbnails => assets}/dislike.png | Bin RNTester/js/{Thumbnails => assets}/fist.png | Bin .../js/{Thumbnails => assets}/flowers.png | Bin RNTester/js/{ => assets}/flux@3x.png | Bin RNTester/js/{ => assets}/hawk.png | Bin RNTester/js/{Thumbnails => assets}/heart.png | Bin RNTester/js/{ => assets}/helloworld.html | 0 RNTester/js/{ => assets}/imageMask.png | Bin RNTester/js/{Thumbnails => assets}/like.png | Bin RNTester/js/{Thumbnails => assets}/liking.png | Bin RNTester/js/{ => assets}/messagingtest.html | 0 RNTester/js/{Thumbnails => assets}/party.png | Bin RNTester/js/{Thumbnails => assets}/poke.png | Bin RNTester/js/{ => assets}/relay@3x.png | Bin RNTester/js/{ => assets}/slider-left.png | Bin RNTester/js/{ => assets}/slider-left@2x.png | Bin RNTester/js/{ => assets}/slider-right.png | Bin RNTester/js/{ => assets}/slider-right@2x.png | Bin RNTester/js/{ => assets}/slider.png | Bin RNTester/js/{ => assets}/slider@2x.png | Bin .../js/{Thumbnails => assets}/superlike.png | Bin .../trees.jpg | Bin .../tumblr_mfqekpMktw1rn90umo1_500.gif | Bin .../uie_comment_highlighted@2x.png | Bin .../js/{ => assets}/uie_comment_normal@2x.png | Bin RNTester/js/{ => assets}/uie_thumb_big.png | Bin .../js/{ => assets}/uie_thumb_normal@2x.png | Bin .../js/{ => assets}/uie_thumb_selected@2x.png | Bin .../js/{Thumbnails => assets}/victory.png | Bin .../js/{ => components}/ListExampleShared.js | 66 +- RNTester/js/{ => components}/RNTesterBlock.js | 7 +- .../js/{ => components}/RNTesterButton.js | 5 +- .../RNTesterExampleContainer.js | 32 +- .../{ => components}/RNTesterExampleFilter.js | 7 +- .../{ => components}/RNTesterExampleList.js | 32 +- RNTester/js/{ => components}/RNTesterPage.js | 8 +- .../RNTesterSettingSwitchRow.js | 7 +- RNTester/js/{ => components}/RNTesterTitle.js | 3 +- .../{Shared => components}/TextInlineView.js | 20 +- .../js/{Shared => components}/TextLegend.js | 10 +- .../js/{ => components}/createExamplePage.js | 2 +- RNTester/js/{ => examples/ART}/ARTExample.js | 0 .../AccessibilityAndroidExample.android.js | 4 +- .../Accessibility}/AccessibilityExample.js | 84 +- .../Accessibility}/AccessibilityIOSExample.js | 2 +- .../ActionSheetIOS}/ActionSheetIOSExample.js | 0 .../ActivityIndicatorExample.js | 38 +- .../js/{ => examples/Alert}/AlertExample.js | 2 +- .../{ => examples/Alert}/AlertIOSExample.js | 8 +- .../Animated}/AnimatedExample.js | 115 +- .../AnimatedGratuitousApp/AnExApp.js | 26 +- .../AnimatedGratuitousApp/AnExBobble.js | 24 +- .../AnimatedGratuitousApp/AnExChained.js | 26 +- .../AnimatedGratuitousApp/AnExScroll.js | 3 +- .../AnimatedGratuitousApp/AnExSet.js | 7 +- .../AnimatedGratuitousApp/AnExSlides.md | 0 .../AnimatedGratuitousApp/AnExTilt.js | 31 +- .../AppState}/AppStateExample.js | 3 +- .../AsyncStorage}/AsyncStorageExample.js | 0 .../js/{ => examples/Border}/BorderExample.js | 6 +- .../BoxShadow}/BoxShadowExample.js | 2 +- .../js/{ => examples/Button}/ButtonExample.js | 23 +- .../CheckBox}/CheckBoxExample.js | 0 .../Clipboard}/ClipboardExample.js | 3 +- .../js/{ => examples/Crash}/CrashExample.js | 8 +- .../DarkModeExample}/DarkModeExample.js | 2 +- .../DatePicker}/DatePickerAndroidExample.js | 9 +- .../DatePicker}/DatePickerIOSExample.js | 8 +- .../DatePicker}/DatePickerMacOSExample.js | 0 .../Dimensions}/DimensionsExample.js | 24 +- .../FlatList}/FlatListExample.js | 70 +- .../FocusEventsExample}/FocusEventsExample.js | 2 +- .../Image}/ImageCapInsetsExample.js | 14 +- .../js/{ => examples/Image}/ImageExample.js | 131 +- .../InputAccessoryViewExample.js | 0 .../JSResponderHandlerExample.js | 77 + .../KeyboardAvoidingViewExample.js | 4 +- .../Layout}/LayoutAnimationExample.js | 0 .../Layout}/LayoutEventsExample.js | 12 +- .../js/{ => examples/Layout}/LayoutExample.js | 8 +- .../{ => examples/Linking}/LinkingExample.js | 6 +- .../MaskedView}/MaskedViewExample.js | 9 +- .../js/{ => examples/Modal}/ModalExample.js | 3 +- .../MultiColumn}/MultiColumnExample.js | 25 +- .../NativeAnimationsExample.js | 56 +- .../NewAppScreen}/NewAppScreenExample.js | 2 +- .../OrientationChangeExample.js | 5 +- .../PanResponder}/PanResponderExample.js | 11 +- .../PermissionsAndroid/PermissionsExample.js} | 3 +- .../js/{ => examples/Picker}/PickerExample.js | 24 +- .../{ => examples/Picker}/PickerIOSExample.js | 7 +- .../PointerEvents}/PointerEventsExample.js | 8 +- .../ProgressBarAndroidExample.android.js | 6 +- .../ProgressViewIOSExample.js | 3 +- .../PushNotificationIOSExample.js | 0 .../RCTRootView}/RCTRootViewIOSExample.js | 0 RNTester/js/{ => examples/RTL}/RTLExample.js | 29 +- .../RefreshControl}/RefreshControlExample.js | 0 .../RootViewSizeFlexibilityExampleApp.js | 3 +- .../SafeAreaView}/SafeAreaViewExample.js | 12 +- .../ScrollView/ScrollViewAnimatedExample.js | 103 + .../ScrollView}/ScrollViewExample.js | 9 +- .../ScrollView}/ScrollViewSimpleExample.js | 8 +- .../SectionList}/SectionListExample.js | 39 +- .../SegmentedControlIOSExample.js | 1 - .../SetPropertiesExampleApp.js | 3 +- .../js/{ => examples/Share}/ShareExample.js | 3 +- .../js/{ => examples/Slider}/SliderExample.js | 16 +- .../Snapshot}/SnapshotExample.js | 0 .../Snapshot}/SnapshotViewIOS.android.js | 2 +- .../Snapshot}/SnapshotViewIOS.ios.js | 13 +- .../StatusBar}/StatusBarExample.js | 17 +- .../js/{ => examples/Switch}/SwitchExample.js | 0 .../TVEventHandler}/TVEventHandlerExample.js | 2 +- .../Text}/TextExample.android.js | 12 +- .../js/{ => examples/Text}/TextExample.ios.js | 107 +- .../TextInput}/TextInputExample.android.js | 0 .../TextInput}/TextInputExample.ios.js | 55 +- .../TimePicker}/TimePickerAndroidExample.js | 9 +- .../js/{ => examples/Timer}/TimerExample.js | 28 +- .../ToastAndroidExample.android.js | 4 +- .../Touchable}/TouchableExample.js | 48 +- .../Transform}/TransformExample.js | 16 +- .../TransparentHitTestExample.js | 0 .../TurboModule}/SampleTurboModuleExample.js | 2 +- .../TurboModule}/TurboModuleExample.js | 0 .../Vibration}/VibrationExample.js | 11 +- .../js/{ => examples/View}/ViewExample.js | 30 +- .../WebSocket}/WebSocketExample.js | 4 +- .../WebSocket}/http_test_server.js | 0 .../WebSocket}/websocket_test_server.js | 0 RNTester/js/{ => examples/XHR}/XHRExample.js | 31 +- .../XHR}/XHRExampleAbortController.js | 3 +- .../XHR}/XHRExampleBinaryUpload.js | 7 +- .../{ => examples/XHR}/XHRExampleDownload.js | 3 +- .../js/{ => examples/XHR}/XHRExampleFetch.js | 3 +- .../{ => examples/XHR}/XHRExampleHeaders.js | 0 .../{ => examples/XHR}/XHRExampleOnTimeOut.js | 3 +- .../js/{Shared => types}/RNTesterTypes.js | 3 +- RNTester/js/{ => utils}/RNTesterActions.js | 0 RNTester/js/utils/RNTesterList.android.js | 241 + RNTester/js/{ => utils}/RNTesterList.ios.js | 154 +- RNTester/js/{ => utils}/RNTesterList.macos.js | 153 +- .../{ => utils}/RNTesterNavigationReducer.js | 1 - .../js/{ => utils}/RNTesterStatePersister.js | 0 RNTester/js/{ => utils}/URIActionMap.js | 1 - React-Core.podspec | 114 + React.podspec | 4 +- React/Base/RCTBridge.h | 14 +- React/Base/RCTBridge.m | 9 +- React/Base/RCTBridgeModule.h | 2 +- React/Base/RCTBundleURLProvider.m | 10 +- React/Base/RCTComponentEvent.h | 2 +- React/Base/RCTComponentEvent.m | 2 +- React/Base/RCTConvert.m | 11 +- React/Base/RCTDefines.h | 9 +- React/Base/RCTLog.mm | 21 - React/Base/RCTModuleData.h | 6 + React/Base/RCTModuleData.mm | 81 +- React/Base/RCTModuleMethod.mm | 2 +- React/Base/RCTPlatform.m | 62 - React/Base/RCTRootView.h | 29 +- React/Base/RCTRootView.m | 11 +- React/Base/RCTRootViewDelegate.h | 2 +- React/Base/RCTTouchHandler.m | 6 +- React/Base/RCTUIKit.h | 6 +- React/Base/RCTUtils.h | 9 +- React/Base/RCTUtils.m | 34 + React/Base/RCTVersion.h | 12 +- React/Base/RCTVersion.m | 18 +- React/Base/RCTWeakProxy.h | 16 + React/Base/RCTWeakProxy.m | 30 + React/Base/Surface/RCTSurface.mm | 14 +- React/Base/Surface/RCTSurfaceDelegate.h | 2 +- .../RCTSurfaceHostingProxyRootView.h | 6 +- .../RCTSurfaceHostingProxyRootView.mm | 10 +- .../RCTSurfaceHostingView.h | 6 +- .../RCTSurfaceHostingView.mm | 18 +- .../RCTSurfaceSizeMeasureMode.h | 2 +- .../RCTSurfaceSizeMeasureMode.mm | 2 +- React/Base/macOS/RCTPlatform.m | 6 +- React/Base/macOS/RCTUIKit.m | 42 +- React/CoreModules/BUCK | 62 + React/CoreModules/CoreModulesPlugins.h | 42 + React/CoreModules/CoreModulesPlugins.mm | 34 + .../RCTExceptionsManager.h | 4 +- .../RCTExceptionsManager.mm} | 52 +- .../CoreModules}/RCTImageEditingManager.h | 0 React/CoreModules/RCTImageEditingManager.m | 81 + React/CoreModules/RCTImageLoader.h | 34 + .../CoreModules/RCTImageLoader.mm | 116 +- .../CoreModules}/RCTImageStoreManager.h | 0 .../CoreModules}/RCTImageStoreManager.m | 4 +- React/{Base => CoreModules}/RCTPlatform.h | 0 React/CoreModules/RCTPlatform.mm | 86 + .../CoreModules/React-CoreModules.podspec | 34 +- React/CxxBridge/RCTCxxBridge.mm | 45 +- React/CxxModule/RCTCxxMethod.mm | 2 +- React/DevSupport/RCTDevLoadingView.h | 2 +- React/DevSupport/RCTDevLoadingView.m | 23 +- React/DevSupport/RCTDevMenu.m | 168 +- .../DevSupport/RCTInspectorDevServerHelper.h | 2 +- .../DevSupport/RCTInspectorDevServerHelper.mm | 16 +- React/DevSupport/RCTPackagerClient.h | 2 +- React/DevSupport/RCTPackagerClient.m | 2 +- React/DevSupport/RCTPackagerConnection.h | 2 +- React/DevSupport/RCTPackagerConnection.mm | 8 +- .../RCTActivityIndicatorViewComponentView.h | 2 +- .../RCTActivityIndicatorViewComponentView.mm | 8 +- .../Image/RCTImageComponentView.mm | 45 +- .../Modal/RCTFabricModalHostViewController.h | 22 + .../Modal/RCTFabricModalHostViewController.mm | 94 + .../Modal/RCTModalHostViewComponentView.h | 15 + .../Modal/RCTModalHostViewComponentView.mm | 208 + .../ScrollView/RCTEnhancedScrollView.h | 2 +- .../ScrollView/RCTEnhancedScrollView.mm | 14 + ....h => RCTPullToRefreshViewComponentView.h} | 2 +- ...m => RCTPullToRefreshViewComponentView.mm} | 21 +- .../ScrollView/RCTScrollViewComponentView.h | 15 +- .../ScrollView/RCTScrollViewComponentView.mm | 105 +- .../Slider/RCTSliderComponentView.mm | 8 +- .../Switch/RCTSwitchComponentView.mm | 8 +- .../Text/RCTParagraphComponentView.mm | 33 +- .../RCTUnimplementedNativeComponentView.mm | 8 +- .../View/RCTViewComponentView.h | 18 +- .../View/RCTViewComponentView.mm | 32 +- .../Mounting/RCTComponentViewFactory.mm | 6 +- .../Mounting/RCTComponentViewProtocol.h | 17 +- .../Mounting/RCTComponentViewRegistry.h | 2 +- React/Fabric/Mounting/RCTMountingManager.h | 7 +- React/Fabric/Mounting/RCTMountingManager.mm | 25 + .../Mounting/UIView+ComponentViewProtocol.h | 14 +- .../Mounting/UIView+ComponentViewProtocol.mm | 26 +- React/Fabric/RCTImageResponseObserverProxy.h | 27 +- React/Fabric/RCTImageResponseObserverProxy.mm | 26 +- React/Fabric/RCTScheduler.h | 8 +- React/Fabric/RCTScheduler.mm | 29 +- React/Fabric/RCTSurfacePresenter.h | 32 +- React/Fabric/RCTSurfacePresenter.mm | 144 +- React/Fabric/RCTSurfaceRegistry.h | 8 +- React/Fabric/RCTSurfaceTouchHandler.mm | 11 +- React/Fabric/Surface/RCTFabricSurface.mm | 2 +- React/Fabric/Utils/MainRunLoopEventBeat.h | 2 +- ...plitter.h => RCTGenericDelegateSplitter.h} | 2 +- ...itter.mm => RCTGenericDelegateSplitter.mm} | 10 +- React/Fabric/Utils/RuntimeEventBeat.h | 2 +- React/Inspector/RCTInspector.mm | 14 +- .../RCTInspectorPackagerConnection.h | 2 +- .../RCTInspectorPackagerConnection.m | 16 +- React/Modules/RCTAccessibilityManager.m | 2 +- React/Modules/RCTDevSettings.mm | 24 +- React/Modules/RCTRedBox.m | 2 +- React/Modules/RCTStatusBarManager.m | 101 +- React/Modules/RCTSurfacePresenterStub.h | 1 + React/Modules/RCTSurfacePresenterStub.m | 5 + React/Modules/RCTTiming.m | 2 +- React/Modules/RCTUIManager.m | 50 +- React/Modules/RCTUIManagerUtils.h | 2 +- React/Profiler/RCTProfile.m | 2 +- React/React-Core.podspec | 70 - React/React-RCTFabric.podspec | 2 +- React/React.xcodeproj/project.pbxproj | 7865 ------ React/Views/RCTActivityIndicatorViewManager.m | 12 +- React/Views/RCTBorderDrawing.m | 2 +- React/Views/RCTFont.mm | 2 + React/Views/RCTModalHostViewManager.m | 10 +- React/Views/RCTShadowView+Layout.h | 4 +- React/Views/RCTShadowView+Layout.m | 4 +- React/Views/RCTView.h | 1 - React/Views/RCTView.m | 69 +- React/Views/RCTViewManager.m | 64 +- React/Views/RCTWKWebViewManager.h~HEAD | 11 - .../ScrollView/RCTScrollContentShadowView.m | 2 +- React/Views/ScrollView/RCTScrollView.m | 8 +- React/Views/ScrollView/RCTScrollViewManager.m | 2 +- React/Views/UIView+React.h | 6 +- React/Views/UIView+React.m | 14 +- ReactAndroid/.npmignore | 2 - ReactAndroid/build.gradle | 35 +- ReactAndroid/gradle.properties | 5 +- ReactAndroid/release.gradle | 8 +- .../testing/AbstractScrollViewTestCase.java | 21 +- .../facebook/react/testing/AssertModule.java | 16 +- .../react/testing/FakeAsyncLocalStorage.java | 10 +- .../react/testing/FakeWebSocketModule.java | 30 +- .../testing/InstanceSpecForTestPackage.java | 13 +- .../react/testing/IntRecordingModule.java | 14 +- .../testing/JSIntegrationTestChecker.java | 24 +- .../testing/MultipleFailureException.java | 5 +- .../ReactAppInstrumentationTestCase.java | 88 +- .../react/testing/ReactAppTestActivity.java | 46 +- .../testing/ReactInstanceSpecForTest.java | 5 +- .../testing/ReactInstrumentationTest.java | 2 +- .../testing/ReactIntegrationTestCase.java | 68 +- .../react/testing/ReactSettingsForTests.java | 10 +- .../react/testing/ReactTestAppShell.java | 11 +- .../testing/ReactTestApplicationImpl.java | 6 +- .../react/testing/ReactTestFactory.java | 9 +- .../react/testing/ReactTestHelper.java | 173 +- .../testing/ScreenshotingFrameLayout.java | 12 +- .../testing/SingleTouchGestureGenerator.java | 35 +- .../react/testing/StringRecordingModule.java | 18 +- .../testing/idledetection/IdleWaiter.java | 9 +- .../ReactBridgeIdleSignaler.java | 8 +- .../idledetection/ReactIdleDetectionUtil.java | 191 +- .../network/NetworkRecordingModuleMock.java | 13 +- .../testing/rule/ReactNativeTestRule.java | 8 +- .../react/tests/AnimatedTransformTest.java | 23 +- .../tests/CatalystMeasureLayoutTest.java | 38 +- .../CatalystMultitouchHandlingTestCase.java | 81 +- ...alystNativeJSToJavaParametersTestCase.java | 83 +- ...talystNativeJavaToJSArgumentsTestCase.java | 47 +- ...ystNativeJavaToJSReturnValuesTestCase.java | 30 +- .../CatalystSubviewsClippingTestCase.java | 74 +- .../tests/CatalystTouchBubblingTestCase.java | 31 +- .../tests/CatalystUIManagerTestCase.java | 66 +- .../react/tests/DatePickerDialogTestCase.java | 36 +- .../react/tests/ImageErrorTestCase.java | 26 +- .../tests/ImageOverlayColorTestCase.java | 9 +- .../react/tests/InitialPropsTestCase.java | 33 +- .../facebook/react/tests/JSLocaleTest.java | 33 +- .../react/tests/JSResponderTestCase.java | 22 +- .../react/tests/LayoutEventsTestCase.java | 16 +- .../react/tests/NativeIdTestCase.java | 88 +- .../react/tests/ProgressBarTestCase.java | 47 +- .../ReactHorizontalScrollViewTestCase.java | 21 +- .../react/tests/ReactPickerTestCase.java | 53 +- .../react/tests/ReactScrollViewTestCase.java | 21 +- .../ReactSwipeRefreshLayoutTestCase.java | 18 +- .../facebook/react/tests/ShareTestCase.java | 28 +- .../facebook/react/tests/TestIdTestCase.java | 41 +- .../react/tests/TextInputTestCase.java | 227 +- .../react/tests/TimePickerDialogTestCase.java | 32 +- .../react/tests/ViewRenderingTestCase.java | 30 +- .../java/com/facebook/react/tests/core/BUCK | 2 + .../tests/core/ReactInstanceManagerTest.java | 30 +- .../react/tests/core/ReactRootViewTest.java | 150 +- .../tests/core/WritableNativeMapTest.java | 26 +- .../src/androidTest/js/NativeIdTestModule.js | 5 +- .../androidTest/js/ScrollViewTestModule.js | 17 +- .../src/androidTest/js/UIManagerTestModule.js | 8 +- .../facebook/flipper/ReactNativeFlipper.java | 51 + ReactAndroid/src/main/java/com/facebook/BUCK | 1 + .../com/facebook/debug/holder/Printer.java | 2 + .../debug/tags/ReactDebugOverlayTags.java | 10 +- .../hermes/instrumentation/Android.mk | 27 + .../com/facebook/hermes/instrumentation/BUCK | 42 + .../instrumentation/HermesMemoryDumper.h | 48 + .../instrumentation/HermesMemoryDumper.java | 17 + .../HermesSamplingProfiler.cpp | 37 + .../instrumentation/HermesSamplingProfiler.h | 36 + .../HermesSamplingProfiler.java | 27 + .../hermes/instrumentation/OnLoad.cpp | 9 + .../facebook/hermes/reactexecutor/Android.mk | 40 + .../com/facebook/hermes/reactexecutor/BUCK | 54 + .../hermes/reactexecutor/HermesExecutor.java | 68 + .../reactexecutor/HermesExecutorFactory.cpp | 230 + .../reactexecutor/HermesExecutorFactory.h | 50 + .../reactexecutor/HermesExecutorFactory.java | 40 + .../hermes/reactexecutor/JSITracing.cpp | 13 +- .../reactexecutor/JSITracing.h} | 10 +- .../facebook/hermes/reactexecutor/OnLoad.cpp | 154 + .../hermes/reactexecutor/RuntimeConfig.java | 22 + .../facebook/hermes/reactexecutor/fbjni.pro | 16 + .../hermes/unicode/AndroidUnicodeUtils.java | 81 + .../java/com/facebook/hermes/unicode/BUCK | 12 + .../src/main/java/com/facebook/jni/BUCK | 1 + .../main/java/com/facebook/jni/Countable.java | 11 +- .../com/facebook/jni/CpuCapabilitiesJni.java | 5 +- .../com/facebook/jni/DestructorThread.java | 56 +- .../com/facebook/jni/HybridClassBase.java | 4 +- .../java/com/facebook/jni/HybridData.java | 36 +- .../java/com/facebook/jni/IteratorHelper.java | 23 +- .../com/facebook/jni/MapIteratorHelper.java | 23 +- .../java/com/facebook/jni/NativeRunnable.java | 13 +- .../com/facebook/perftest/PerfTestConfig.java | 10 +- .../proguard/annotations/DoNotStrip.java | 16 +- .../annotations/KeepGettersAndSetters.java | 20 +- .../src/main/java/com/facebook/react/BUCK | 2 + .../facebook/react/CompositeReactPackage.java | 23 +- .../facebook/react/CoreModulesPackage.java | 11 +- .../com/facebook/react/DebugCorePackage.java | 30 +- .../facebook/react/EagerModuleProvider.java | 7 +- .../facebook/react/HeadlessJsTaskService.java | 95 +- .../com/facebook/react/LazyReactPackage.java | 4 +- .../facebook/react/MemoryPressureRouter.java | 22 +- .../react/NativeModuleRegistryBuilder.java | 6 +- .../com/facebook/react/ReactActivity.java | 38 +- .../facebook/react/ReactActivityDelegate.java | 123 +- .../ReactAndroidHWInputDeviceHelper.java | 68 +- .../com/facebook/react/ReactApplication.java | 9 +- .../com/facebook/react/ReactDelegate.java | 146 + .../com/facebook/react/ReactFragment.java | 202 + .../facebook/react/ReactFragmentActivity.java | 13 +- .../facebook/react/ReactInstanceManager.java | 387 +- .../react/ReactInstanceManagerBuilder.java | 113 +- .../facebook/react/ReactInstancePackage.java | 21 +- .../com/facebook/react/ReactNativeHost.java | 72 +- .../java/com/facebook/react/ReactPackage.java | 39 +- .../facebook/react/ReactPackageHelper.java | 5 +- .../facebook/react/ReactPackageLogger.java | 5 +- .../com/facebook/react/ReactRootView.java | 318 +- .../com/facebook/react/TurboReactPackage.java | 5 +- .../ViewManagerOnDemandReactPackage.java | 10 +- .../react/animated/AdditionAnimatedNode.java | 12 +- .../facebook/react/animated/AnimatedNode.java | 32 +- .../animated/AnimatedNodeValueListener.java | 9 +- .../react/animated/AnimationDriver.java | 7 +- .../java/com/facebook/react/animated/BUCK | 1 + .../react/animated/DecayAnimation.java | 12 +- .../react/animated/DiffClampAnimatedNode.java | 13 +- .../react/animated/DivisionAnimatedNode.java | 20 +- .../react/animated/EventAnimationDriver.java | 16 +- .../animated/FrameBasedAnimationDriver.java | 13 +- .../animated/InterpolationAnimatedNode.java | 131 +- .../react/animated/ModulusAnimatedNode.java | 13 +- .../animated/MultiplicationAnimatedNode.java | 12 +- .../react/animated/NativeAnimatedModule.java | 419 +- .../animated/NativeAnimatedNodesManager.java | 164 +- .../react/animated/PropsAnimatedNode.java | 48 +- .../react/animated/SpringAnimation.java | 53 +- .../react/animated/StyleAnimatedNode.java | 13 +- .../animated/SubtractionAnimatedNode.java | 12 +- .../react/animated/TrackingAnimatedNode.java | 8 +- .../react/animated/TransformAnimatedNode.java | 13 +- .../react/animated/ValueAnimatedNode.java | 13 +- .../react/bridge/ActivityEventListener.java | 8 +- .../com/facebook/react/bridge/Arguments.java | 97 +- .../react/bridge/AssertionException.java | 11 +- .../bridge/BaseActivityEventListener.java | 14 +- .../facebook/react/bridge/BaseJavaModule.java | 53 +- .../com/facebook/react/bridge/Callback.java | 10 +- .../facebook/react/bridge/CallbackImpl.java | 16 +- .../react/bridge/CatalystInstance.java | 64 +- .../react/bridge/CatalystInstanceImpl.java | 291 +- .../react/bridge/ContextBaseJavaModule.java | 12 +- .../react/bridge/CxxCallbackImpl.java | 13 +- .../react/bridge/CxxModuleWrapper.java | 7 +- .../react/bridge/CxxModuleWrapperBase.java | 10 +- ...faultNativeModuleCallExceptionHandler.java | 9 +- .../com/facebook/react/bridge/Dynamic.java | 13 +- .../react/bridge/DynamicFromArray.java | 12 +- .../facebook/react/bridge/DynamicFromMap.java | 25 +- .../react/bridge/DynamicFromObject.java | 23 +- .../react/bridge/FallbackJSBundleLoader.java | 28 +- .../react/bridge/GuardedAsyncTask.java | 29 +- .../react/bridge/GuardedResultAsyncTask.java | 18 +- .../react/bridge/GuardedRunnable.java | 17 +- .../com/facebook/react/bridge/Inspector.java | 14 +- .../bridge/InvalidIteratorException.java | 9 +- .../JSApplicationCausedNativeException.java | 29 +- ...JSApplicationIllegalArgumentException.java | 9 +- .../facebook/react/bridge/JSBundleLoader.java | 27 +- .../react/bridge/JSBundleLoaderDelegate.java | 37 +- .../react/bridge/JSCJavaScriptExecutor.java | 8 +- .../bridge/JSCJavaScriptExecutorFactory.java | 17 +- .../com/facebook/react/bridge/JSIModule.java | 19 +- .../react/bridge/JSIModuleHolder.java | 5 +- .../react/bridge/JSIModulePackage.java | 17 +- .../react/bridge/JSIModuleProvider.java | 6 +- .../react/bridge/JSIModuleRegistry.java | 29 +- .../facebook/react/bridge/JSIModuleSpec.java | 12 +- .../facebook/react/bridge/JSIModuleType.java | 16 + .../com/facebook/react/bridge/JSInstance.java | 14 +- .../facebook/react/bridge/JavaJSExecutor.java | 20 +- .../react/bridge/JavaMethodWrapper.java | 268 +- .../react/bridge/JavaModuleWrapper.java | 54 +- .../facebook/react/bridge/JavaOnlyArray.java | 44 +- .../facebook/react/bridge/JavaOnlyMap.java | 58 +- .../react/bridge/JavaScriptContextHolder.java | 7 +- .../react/bridge/JavaScriptExecutor.java | 16 +- .../bridge/JavaScriptExecutorFactory.java | 18 +- .../react/bridge/JavaScriptModule.java | 21 +- .../bridge/JavaScriptModuleRegistry.java | 46 +- .../com/facebook/react/bridge/JsonWriter.java | 216 - .../react/bridge/JsonWriterHelper.java | 110 +- .../react/bridge/LifecycleEventListener.java | 32 +- .../react/bridge/MemoryPressureListener.java | 9 +- .../facebook/react/bridge/ModuleHolder.java | 9 +- .../com/facebook/react/bridge/ModuleSpec.java | 2 +- .../bridge/NativeArgumentsParseException.java | 11 +- .../facebook/react/bridge/NativeArray.java | 14 +- .../react/bridge/NativeArrayInterface.java | 5 +- .../react/bridge/NativeDeltaClient.java | 12 +- .../com/facebook/react/bridge/NativeMap.java | 12 +- .../facebook/react/bridge/NativeModule.java | 33 +- .../NativeModuleCallExceptionHandler.java | 20 +- .../react/bridge/NativeModuleRegistry.java | 4 +- .../react/bridge/NoSuchKeyException.java | 9 +- .../NotThreadSafeBridgeIdleDebugListener.java | 26 +- .../ObjectAlreadyConsumedException.java | 11 +- .../react/bridge/OnBatchCompleteListener.java | 9 +- .../react/bridge/PerformanceCounter.java | 5 +- .../com/facebook/react/bridge/Promise.java | 56 +- .../facebook/react/bridge/PromiseImpl.java | 82 +- .../react/bridge/ProxyJavaScriptExecutor.java | 34 +- .../react/bridge/ReactApplicationContext.java | 9 +- .../facebook/react/bridge/ReactBridge.java | 10 +- .../facebook/react/bridge/ReactCallback.java | 5 +- .../facebook/react/bridge/ReactContext.java | 108 +- .../bridge/ReactContextBaseJavaModule.java | 26 +- .../facebook/react/bridge/ReactMarker.java | 82 +- .../react/bridge/ReactMarkerConstants.java | 17 +- .../facebook/react/bridge/ReactMethod.java | 36 +- .../react/bridge/ReactModuleWithSpec.java | 13 +- .../facebook/react/bridge/ReadableArray.java | 37 +- .../facebook/react/bridge/ReadableMap.java | 35 +- .../bridge/ReadableMapKeySetIterator.java | 10 +- .../react/bridge/ReadableNativeArray.java | 22 +- .../react/bridge/ReadableNativeMap.java | 36 +- .../facebook/react/bridge/ReadableType.java | 10 +- .../facebook/react/bridge/SoftAssertions.java | 23 +- .../com/facebook/react/bridge/Systrace.java | 6 +- .../com/facebook/react/bridge/UIManager.java | 41 +- .../facebook/react/bridge/UiThreadUtil.java | 35 +- .../bridge/UnexpectedNativeTypeException.java | 9 +- .../bridge/WindowFocusChangeListener.java | 13 + .../facebook/react/bridge/WritableArray.java | 22 +- .../facebook/react/bridge/WritableMap.java | 37 +- .../react/bridge/WritableNativeArray.java | 24 +- .../react/bridge/WritableNativeMap.java | 47 +- .../bridge/queue/MessageQueueThread.java | 28 +- .../queue/MessageQueueThreadHandler.java | 9 +- .../bridge/queue/MessageQueueThreadImpl.java | 109 +- .../queue/MessageQueueThreadPerfStats.java | 9 +- .../bridge/queue/MessageQueueThreadSpec.java | 9 +- .../react/bridge/queue/NativeRunnable.java | 9 +- .../queue/NativeRunnableDeprecated.java | 13 +- .../queue/QueueThreadExceptionHandler.java | 5 +- .../bridge/queue/ReactQueueConfiguration.java | 21 +- .../queue/ReactQueueConfigurationImpl.java | 24 +- .../queue/ReactQueueConfigurationSpec.java | 32 +- .../com/facebook/react/common/ArrayUtils.java | 5 +- .../common/ClearableSynchronizedPool.java | 4 +- .../react/common/DebugServerException.java | 37 +- .../HasJavascriptExceptionMetadata.java | 16 + .../react/common/JavascriptException.java | 21 +- .../facebook/react/common/LifecycleState.java | 11 +- .../com/facebook/react/common/LongArray.java | 15 +- .../com/facebook/react/common/MapBuilder.java | 56 +- .../facebook/react/common/ReactConstants.java | 5 +- .../facebook/react/common/ShakeDetector.java | 43 +- .../react/common/SingleThreadAsserter.java | 12 +- .../react/common/StandardCharsets.java | 25 +- .../facebook/react/common/SystemClock.java | 6 +- .../common/annotations/VisibleForTesting.java | 8 +- .../react/common/build/ReactBuildConfig.java | 5 +- .../common/futures/SimpleSettableFuture.java | 19 +- .../react/common/network/OkHttpCallUtil.java | 8 +- .../react/config/ReactFeatureFlags.java | 47 +- .../java/com/facebook/react/devsupport/BUCK | 3 +- .../react/devsupport/BundleDeltaClient.java | 41 +- .../react/devsupport/BundleDownloader.java | 66 +- .../devsupport/DebugOverlayController.java | 75 +- .../react/devsupport/DevInternalSettings.java | 38 +- .../devsupport/DevLoadingViewController.java | 96 +- .../react/devsupport/DevServerHelper.java | 474 +- .../react/devsupport/DevSettingsActivity.java | 7 +- .../devsupport/DevSupportManagerFactory.java | 100 +- .../devsupport/DevSupportManagerImpl.java | 760 +- .../devsupport/DisabledDevSupportManager.java | 100 +- .../devsupport/DoubleTapReloadRecognizer.java | 26 +- .../facebook/react/devsupport/FpsView.java | 40 +- .../facebook/react/devsupport/HMRClient.java | 27 +- .../InspectorPackagerConnection.java | 88 +- .../react/devsupport/JSCHeapCapture.java | 15 +- .../react/devsupport/JSCSamplingProfiler.java | 148 - .../devsupport/JSDebuggerWebSocketClient.java | 72 +- .../react/devsupport/JSDevSupport.java | 16 +- .../react/devsupport/JSException.java | 10 +- .../devsupport/MultipartStreamReader.java | 31 +- .../ReactInstanceManagerDevHelper.java | 34 +- .../react/devsupport/RedBoxDialog.java | 164 +- .../react/devsupport/RedBoxHandler.java | 33 +- .../react/devsupport/StackTraceHelper.java | 98 +- .../react/devsupport/ViewHierarchyUtil.java | 15 +- .../WebsocketJavaScriptExecutor.java | 68 +- .../react/devsupport/WindowOverlayCompat.java | 20 +- .../interfaces/DevBundleDownloadListener.java | 9 +- .../interfaces/DevOptionHandler.java | 12 +- .../interfaces/DevSupportManager.java | 58 +- .../interfaces/ErrorCustomizer.java | 8 +- .../interfaces/PackagerStatusCallback.java | 5 +- .../devsupport/interfaces/StackFrame.java | 45 +- .../main/java/com/facebook/react/fabric/BUCK | 4 +- .../react/fabric/{jsi => }/Binding.java | 43 +- .../{jsi => }/ComponentFactoryDelegate.java | 8 +- .../react/fabric/FabricComponents.java | 43 + .../react/fabric/FabricJSIModuleProvider.java | 52 +- .../fabric/{jsi => }/FabricSoLoader.java | 2 +- .../react/fabric/FabricUIManager.java | 240 +- .../react/fabric/GuardedFrameCallback.java | 12 +- .../react/fabric/ReactNativeConfig.java | 4 +- .../fabric/{jsi => }/StateWrapperImpl.java | 11 +- .../{jsi => events}/EventBeatManager.java | 5 +- .../{jsi => events}/EventEmitterWrapper.java | 4 +- .../{ => events}/FabricEventEmitter.java | 5 +- .../fabric/{jsi => }/jni/AsyncEventBeat.h | 0 .../facebook/react/fabric/{jsi => }/jni/BUCK | 0 .../react/fabric/{jsi => }/jni/Binding.cpp | 453 +- .../react/fabric/{jsi => }/jni/Binding.h | 46 +- .../jni/ComponentFactoryDelegate.cpp | 0 .../{jsi => }/jni/ComponentFactoryDelegate.h | 2 +- .../fabric/{jsi => }/jni/EventBeatManager.cpp | 0 .../fabric/{jsi => }/jni/EventBeatManager.h | 4 +- .../{jsi => }/jni/EventEmitterWrapper.cpp | 0 .../{jsi => }/jni/EventEmitterWrapper.h | 2 +- .../fabric/{jsi => }/jni/NodeStateWrapper.cpp | 0 .../fabric/{jsi => }/jni/NodeStateWrapper.h | 0 .../react/fabric/{jsi => }/jni/OnLoad.cpp | 0 .../{jsi => }/jni/ReactNativeConfigHolder.cpp | 0 .../{jsi => }/jni/ReactNativeConfigHolder.h | 0 .../fabric/{jsi => }/jni/StateWrapperImpl.cpp | 0 .../fabric/{jsi => }/jni/StateWrapperImpl.h | 2 +- .../react/fabric/jsi/ComponentRegistry.java | 25 - .../fabric/mounting/ContextBasedViewPool.java | 53 - .../fabric/mounting/MountingManager.java | 133 +- .../react/fabric/mounting/ViewFactory.java | 19 - .../fabric/mounting/ViewManagerFactory.java | 35 - .../react/fabric/mounting/ViewPool.java | 64 - .../mounting/mountitems/BatchMountItem.java | 19 +- .../mounting/mountitems/CreateMountItem.java | 36 +- .../mountitems/DispatchCommandMountItem.java | 3 +- .../DispatchStringCommandMountItem.java | 35 + .../mountitems/PreAllocateViewMountItem.java | 7 +- .../UpdateEventEmitterMountItem.java | 2 +- .../mountitems/UpdateLayoutMountItem.java | 30 +- .../mountitems/UpdateLocalDataMountItem.java | 2 +- .../mountitems/UpdatePropsMountItem.java | 2 +- .../react/jscexecutor/JSCExecutor.java | 1 - .../react/jscexecutor/JSCExecutorFactory.java | 12 + .../react/jstasks/HeadlessJsTaskConfig.java | 82 +- .../react/jstasks/HeadlessJsTaskContext.java | 150 +- .../jstasks/HeadlessJsTaskEventListener.java | 15 +- .../jstasks/HeadlessJsTaskRetryPolicy.java | 15 + .../jstasks/LinearCountingRetryPolicy.java | 38 + .../facebook/react/jstasks/NoRetryPolicy.java | 29 + .../react/module/annotations/ReactModule.java | 29 +- .../module/annotations/ReactModuleList.java | 10 +- .../react/module/model/ReactModuleInfo.java | 27 +- .../module/model/ReactModuleInfoProvider.java | 4 +- .../processing/ReactModuleSpecProcessor.java | 120 +- .../AccessibilityInfoModule.java | 249 +- .../react/modules/accessibilityinfo/BUCK | 2 + .../modules/appregistry/AppRegistry.java | 11 +- .../modules/appstate/AppStateModule.java | 30 +- .../java/com/facebook/react/modules/blob/BUCK | 2 + .../react/modules/blob/BlobCollector.java | 27 + .../react/modules/blob/BlobModule.java | 209 +- .../react/modules/blob/BlobProvider.java | 8 +- .../react/modules/blob/FileReaderModule.java | 23 +- .../react/modules/blob/jni/Android.mk | 21 + .../com/facebook/react/modules/blob/jni/BUCK | 22 + .../react/modules/blob/jni/BlobCollector.cpp | 63 + .../react/modules/blob/jni/BlobCollector.h | 39 + .../react/modules/blob/jni/OnLoad.cpp | 13 + .../com/facebook/react/modules/camera/BUCK | 2 + .../modules/camera/CameraRollManager.java | 164 +- .../modules/camera/ImageEditingManager.java | 209 +- .../modules/camera/ImageStoreManager.java | 28 +- .../modules/clipboard/ClipboardModule.java | 18 +- .../modules/common/ModuleDataCleaner.java | 22 +- .../java/com/facebook/react/modules/core/BUCK | 2 + .../modules/core/ChoreographerCompat.java | 42 +- .../core/DefaultHardwareBackBtnHandler.java | 9 +- .../core/DeviceEventManagerModule.java | 50 +- .../modules/core/ExceptionsManagerModule.java | 52 +- .../core/HeadlessJsTaskSupportModule.java | 30 +- .../facebook/react/modules/core/JSTimers.java | 7 +- .../modules/core/PermissionAwareActivity.java | 25 +- .../modules/core/PermissionListener.java | 9 +- .../core/RCTNativeAppEventEmitter.java | 13 +- .../modules/core/ReactChoreographer.java | 95 +- .../facebook/react/modules/core/Timing.java | 126 +- .../datepicker/DatePickerDialogFragment.java | 64 +- .../datepicker/DatePickerDialogModule.java | 51 +- .../modules/datepicker/DatePickerMode.java | 9 +- .../DismissableDatePickerDialog.java | 46 +- .../modules/debug/AnimationsDebugModule.java | 57 +- .../com/facebook/react/modules/debug/BUCK | 2 + .../modules/debug/DevSettingsModule.java | 21 +- .../DidJSUpdateUiDuringFrameDetector.java | 85 +- .../modules/debug/FpsDebugFrameCallback.java | 71 +- .../react/modules/debug/SourceCodeModule.java | 19 +- .../debug/interfaces/DeveloperSettings.java | 43 +- .../facebook/react/modules/deviceinfo/BUCK | 3 + .../modules/deviceinfo/DeviceInfoModule.java | 36 +- .../react/modules/dialog/AlertFragment.java | 20 +- .../react/modules/dialog/DialogModule.java | 62 +- .../react/modules/fabric/ReactFabric.java | 15 +- .../react/modules/fresco/FrescoModule.java | 74 +- .../fresco/ReactNetworkImageRequest.java | 9 +- .../fresco/ReactOkHttpNetworkFetcher.java | 38 +- .../fresco/SystraceRequestListener.java | 81 +- .../i18nmanager/I18nManagerModule.java | 9 +- .../react/modules/i18nmanager/I18nUtil.java | 50 +- .../com/facebook/react/modules/image/BUCK | 2 + .../modules/image/ImageLoaderModule.java | 222 +- .../com/facebook/react/modules/intent/BUCK | 2 + .../react/modules/intent/IntentModule.java | 106 +- .../react/modules/netinfo/NetInfoModule.java | 268 - .../com/facebook/react/modules/network/BUCK | 1 + .../modules/network/CookieJarContainer.java | 6 +- .../modules/network/CountingOutputStream.java | 7 +- .../network/ForwardingCookieHandler.java | 50 +- .../react/modules/network/HeaderUtil.java | 63 +- .../network/NetworkInterceptorCreator.java | 5 +- .../modules/network/NetworkingModule.java | 437 +- .../modules/network/OkHttpClientFactory.java | 7 +- .../modules/network/OkHttpClientProvider.java | 37 +- .../modules/network/ProgressListener.java | 7 +- .../modules/network/ProgressRequestBody.java | 43 +- .../modules/network/ProgressResponseBody.java | 79 +- .../network/ProgressiveStringDecoder.java | 32 +- .../network/ReactCookieJarContainer.java | 16 +- .../modules/network/RequestBodyUtil.java | 34 +- .../react/modules/network/ResponseUtil.java | 50 +- .../modules/network/TLSSocketFactory.java | 89 +- .../permissions/PermissionsModule.java | 136 +- .../react/modules/share/ShareModule.java | 17 +- .../react/modules/{netinfo => sound}/BUCK | 9 +- .../modules/sound/SoundManagerModule.java | 40 + .../modules/statusbar/StatusBarModule.java | 142 +- .../storage/AsyncLocalStorageUtil.java | 69 +- .../storage/AsyncStorageErrorUtil.java | 18 +- .../modules/storage/AsyncStorageModule.java | 111 +- .../com/facebook/react/modules/storage/BUCK | 2 + .../storage/ReactDatabaseSupplier.java | 35 +- .../systeminfo/AndroidInfoHelpers.java | 14 +- .../modules/systeminfo/AndroidInfoModule.java | 45 +- .../facebook/react/modules/systeminfo/BUCK | 4 + .../systeminfo/ReactNativeVersion.java | 4 +- .../DismissableTimePickerDialog.java | 24 +- .../timepicker/TimePickerDialogFragment.java | 74 +- .../timepicker/TimePickerDialogModule.java | 17 +- .../modules/timepicker/TimePickerMode.java | 6 +- .../react/modules/toast/ToastModule.java | 39 +- .../modules/vibration/VibrationModule.java | 15 +- .../com/facebook/react/modules/websocket/BUCK | 2 + .../modules/websocket/WebSocketModule.java | 73 +- .../facebook/react/packagerconnection/BUCK | 2 + .../packagerconnection/FileIoHandler.java | 179 +- .../packagerconnection/JSPackagerClient.java | 46 +- .../NotificationOnlyHandler.java | 13 +- .../PackagerConnectionSettings.java | 21 +- .../ReconnectingWebSocket.java | 54 +- .../packagerconnection/RequestHandler.java | 8 +- .../RequestOnlyHandler.java | 13 +- .../react/packagerconnection/Responder.java | 6 +- .../main/java/com/facebook/react/shell/BUCK | 3 +- .../react/shell/MainPackageConfig.java | 9 +- .../react/shell/MainReactPackage.java | 412 +- .../facebook/react/surface/ReactStage.java | 4 +- .../main/java/com/facebook/react/touch/BUCK | 2 + .../react/touch/JSResponderHandler.java | 19 +- .../touch/OnInterceptTouchEventListener.java | 15 +- .../react/touch/ReactHitSlopView.java | 17 +- .../touch/ReactInterceptingViewGroup.java | 23 +- .../com/facebook/react/turbomodule/core/BUCK | 8 +- .../core/JSCallInvokerHolderImpl.java | 14 +- ...eactPackageTurboModuleManagerDelegate.java | 132 + .../turbomodule/core/TurboModuleManager.java | 82 +- .../core/TurboModuleManagerDelegate.java | 24 +- .../react/turbomodule/core/interfaces/BUCK | 7 +- .../core/interfaces/JSCallInvokerHolder.java | 20 +- .../core/interfaces/TurboModule.java | 14 +- .../core/interfaces/TurboModuleRegistry.java | 28 + .../react/turbomodule/core/jni/Android.mk | 6 +- .../facebook/react/turbomodule/core/jni/BUCK | 13 +- .../JSCallInvokerHolder.cpp | 0 .../JSCallInvokerHolder.h | 2 +- .../jni/{jsireact => ReactCommon}/OnLoad.cpp | 0 .../jni/ReactCommon/TurboModuleManager.cpp | 94 + .../TurboModuleManager.h | 25 +- .../TurboModuleManagerDelegate.h | 6 +- .../core/jni/jsireact/TurboModuleManager.cpp | 74 - .../java/com/facebook/react/uimanager/BUCK | 5 + .../react/uimanager/BaseViewManager.java | 306 +- .../uimanager/BaseViewManagerDelegate.java | 111 + .../react/uimanager/DisplayMetricsHolder.java | 60 +- .../facebook/react/uimanager/FloatUtil.java | 5 +- .../react/uimanager/GuardedFrameCallback.java | 9 +- .../uimanager/IViewManagerWithChildren.java | 19 +- .../IllegalViewOperationException.java | 11 +- .../react/uimanager/JSTouchDispatcher.java | 152 +- .../react/uimanager/LayoutShadowNode.java | 569 +- .../react/uimanager/MatrixMathHelper.java | 384 +- .../uimanager/MeasureSpecAssertions.java | 13 +- .../facebook/react/uimanager/NativeKind.java | 5 +- .../uimanager/NativeViewHierarchyManager.java | 404 +- .../NativeViewHierarchyOptimizer.java | 143 +- .../uimanager/NoSuchNativeViewException.java | 5 +- .../react/uimanager/OnLayoutEvent.java | 13 +- .../facebook/react/uimanager/PixelUtil.java | 46 +- .../react/uimanager/PointerEvents.java | 21 +- .../uimanager/ReactAccessibilityDelegate.java | 157 +- .../uimanager/ReactClippingViewGroup.java | 39 +- .../ReactClippingViewGroupHelper.java | 19 +- .../react/uimanager/ReactCompoundView.java | 6 +- .../uimanager/ReactCompoundViewGroup.java | 17 +- .../ReactInvalidPropertyException.java | 14 +- .../uimanager/ReactPointerEventsView.java | 9 +- .../facebook/react/uimanager/ReactRoot.java | 52 +- .../react/uimanager/ReactShadowNode.java | 7 +- .../react/uimanager/ReactShadowNodeImpl.java | 69 +- .../react/uimanager/ReactStylesDiffMap.java | 49 +- .../uimanager/ReactYogaConfigProvider.java | 5 +- .../uimanager/ReactZIndexedViewGroup.java | 9 +- .../facebook/react/uimanager/RootView.java | 9 +- .../react/uimanager/RootViewManager.java | 9 +- .../react/uimanager/RootViewUtil.java | 10 +- .../react/uimanager/ShadowNodeRegistry.java | 5 +- .../react/uimanager/SimpleViewManager.java | 12 +- .../com/facebook/react/uimanager/Spacing.java | 90 +- .../react/uimanager/StateWrapper.java | 14 +- .../react/uimanager/ThemedReactContext.java | 23 +- .../react/uimanager/TouchTargetHelper.java | 98 +- .../react/uimanager/TransformHelper.java | 42 +- .../com/facebook/react/uimanager/UIBlock.java | 11 +- .../react/uimanager/UIImplementation.java | 260 +- .../uimanager/UIImplementationProvider.java | 29 +- .../react/uimanager/UIManagerHelper.java | 26 +- .../react/uimanager/UIManagerModule.java | 73 +- .../uimanager/UIManagerModuleConstants.java | 55 +- .../UIManagerModuleConstantsHelper.java | 48 +- .../uimanager/UIManagerModuleListener.java | 9 +- .../react/uimanager/UIViewOperationQueue.java | 296 +- .../facebook/react/uimanager/ViewAtIndex.java | 18 +- .../react/uimanager/ViewDefaults.java | 9 +- .../ViewGroupDrawingOrderHelper.java | 67 +- .../react/uimanager/ViewGroupManager.java | 41 +- .../react/uimanager/ViewHierarchyDumper.java | 7 +- .../facebook/react/uimanager/ViewManager.java | 181 +- .../react/uimanager/ViewManagerDelegate.java | 14 + .../uimanager/ViewManagerPropertyUpdater.java | 19 +- .../react/uimanager/ViewManagerRegistry.java | 7 +- .../uimanager/ViewManagersPropertyCache.java | 6 +- .../facebook/react/uimanager/ViewProps.java | 46 +- .../react/uimanager/YogaNodePool.java | 6 +- .../facebook/react/uimanager/annotations/BUCK | 2 + .../uimanager/annotations/ReactProp.java | 75 +- .../uimanager/annotations/ReactPropGroup.java | 43 +- .../annotations/ReactPropertyHolder.java | 3 +- .../react/uimanager/common/UIManagerType.java | 8 +- .../react/uimanager/common/ViewUtil.java | 13 +- ...dSafeViewHierarchyUpdateDebugListener.java | 15 +- .../events/BatchEventDispatchedListener.java | 9 +- .../events/ContentSizeChangeEvent.java | 4 +- .../react/uimanager/events/Event.java | 52 +- .../uimanager/events/EventDispatcher.java | 140 +- .../events/EventDispatcherListener.java | 9 +- .../uimanager/events/NativeGestureUtil.java | 10 +- .../uimanager/events/RCTEventEmitter.java | 14 +- .../uimanager/events/ReactEventEmitter.java | 11 +- .../react/uimanager/events/TouchEvent.java | 50 +- .../events/TouchEventCoalescingKeyHelper.java | 44 +- .../uimanager/events/TouchEventType.java | 9 +- .../react/uimanager/events/TouchesHelper.java | 18 +- .../AbstractLayoutAnimation.java | 39 +- .../layoutanimation/AnimatedPropertyType.java | 4 +- .../layoutanimation/BaseLayoutAnimation.java | 97 +- .../LayoutAnimationController.java | 101 +- .../LayoutAnimationListener.java | 4 +- .../LayoutCreateAnimation.java | 4 +- .../LayoutDeleteAnimation.java | 4 +- .../LayoutHandlingAnimation.java | 26 +- .../LayoutUpdateAnimation.java | 6 +- .../layoutanimation/OpacityAnimation.java | 7 +- .../PositionAndSizeAnimation.java | 6 +- .../SimpleSpringInterpolator.java | 21 +- .../com/facebook/react/uimanager/util/BUCK | 2 + .../uimanager/util/ReactFindViewUtil.java | 47 +- .../main/java/com/facebook/react/util/BUCK | 3 +- .../react/util/ExceptionDataHelper.java | 36 + .../com/facebook/react/util/JSStackTrace.java | 64 +- .../react/views/art/ARTGroupShadowNode.java | 32 +- .../react/views/art/ARTGroupViewManager.java | 4 +- .../views/art/ARTRenderableViewManager.java | 6 +- .../react/views/art/ARTShapeShadowNode.java | 111 +- .../react/views/art/ARTShapeViewManager.java | 4 +- .../react/views/art/ARTSurfaceView.java | 9 +- .../views/art/ARTSurfaceViewManager.java | 38 +- .../views/art/ARTSurfaceViewShadowNode.java | 27 +- .../react/views/art/ARTTextShadowNode.java | 15 +- .../react/views/art/ARTTextViewManager.java | 4 +- .../react/views/art/ARTVirtualNode.java | 13 +- .../java/com/facebook/react/views/art/BUCK | 2 + .../facebook/react/views/art/PropHelper.java | 15 +- .../react/views/checkbox/ReactCheckBox.java | 4 +- .../views/checkbox/ReactCheckBoxEvent.java | 4 +- .../views/checkbox/ReactCheckBoxManager.java | 50 +- .../java/com/facebook/react/views/common/BUCK | 1 + .../react/views/common/ContextUtils.java | 8 +- .../react/views/drawer/ReactDrawerLayout.java | 11 +- .../drawer/ReactDrawerLayoutManager.java | 100 +- .../drawer/events/DrawerClosedEvent.java | 8 +- .../drawer/events/DrawerOpenedEvent.java | 8 +- .../views/drawer/events/DrawerSlideEvent.java | 9 +- .../events/DrawerStateChangedEvent.java | 5 +- .../react/views/image/ImageLoadEvent.java | 25 +- .../react/views/image/ImageResizeMethod.java | 5 +- .../react/views/image/ImageResizeMode.java | 27 +- .../react/views/image/MultiPostprocessor.java | 20 +- .../react/views/image/ReactImageManager.java | 42 +- .../react/views/image/ReactImageView.java | 223 +- .../views/image/ScaleTypeStartInside.java | 5 +- .../com/facebook/react/views/imagehelper/BUCK | 4 + .../react/views/imagehelper/ImageSource.java | 29 +- .../views/imagehelper/MultiSourceHelper.java | 38 +- .../imagehelper/ResourceDrawableIdHelper.java | 31 +- .../java/com/facebook/react/views/modal/BUCK | 4 + .../react/views/modal/ModalHostHelper.java | 19 +- .../views/modal/ModalHostShadowNode.java | 11 +- .../views/modal/ReactModalHostManager.java | 58 +- .../react/views/modal/ReactModalHostView.java | 177 +- .../react/views/modal/RequestCloseEvent.java | 9 +- .../facebook/react/views/modal/ShowEvent.java | 9 +- .../picker/ReactDialogPickerManager.java | 10 +- .../picker/ReactDropdownPickerManager.java | 10 +- .../react/views/picker/ReactPicker.java | 133 +- .../views/picker/ReactPickerAdapter.java | 74 + .../react/views/picker/ReactPickerItem.java | 36 + .../views/picker/ReactPickerManager.java | 105 +- .../picker/events/PickerItemSelectEvent.java | 5 +- .../com/facebook/react/views/progressbar/BUCK | 2 + .../progressbar/ProgressBarContainerView.java | 13 +- .../progressbar/ProgressBarShadowNode.java | 22 +- .../ReactProgressBarViewManager.java | 17 +- .../react/views/scroll/FpsListener.java | 15 +- .../views/scroll/OnScrollDispatchHelper.java | 9 +- .../ReactHorizontalScrollContainerView.java | 6 +- .../scroll/ReactHorizontalScrollView.java | 423 +- .../ReactHorizontalScrollViewManager.java | 101 +- .../react/views/scroll/ReactScrollView.java | 309 +- .../scroll/ReactScrollViewCommandHelper.java | 90 +- .../views/scroll/ReactScrollViewHelper.java | 54 +- .../views/scroll/ReactScrollViewManager.java | 119 +- .../react/views/scroll/ScrollEvent.java | 18 +- .../react/views/scroll/ScrollEventType.java | 9 +- .../react/views/scroll/VelocityHelper.java | 42 +- .../react/views/slider/ReactSlider.java | 4 +- .../react/views/slider/ReactSliderEvent.java | 11 +- .../views/slider/ReactSliderManager.java | 77 +- .../slider/ReactSlidingCompleteEvent.java | 10 +- .../swiperefresh/ReactSwipeRefreshLayout.java | 18 +- .../views/swiperefresh/RefreshEvent.java | 27 +- .../SwipeRefreshLayoutManager.java | 42 +- .../com/facebook/react/views/switchview/BUCK | 2 +- .../react/views/switchview/ReactSwitch.java | 12 +- .../views/switchview/ReactSwitchEvent.java | 79 +- .../views/switchview/ReactSwitchManager.java | 29 +- .../views/text/CustomLetterSpacingSpan.java | 17 +- .../views/text/CustomLineHeightSpan.java | 14 +- .../react/views/text/CustomStyleSpan.java | 37 +- .../views/text/DefaultStyleValuesUtil.java | 11 +- .../react/views/text/FontMetricsUtil.java | 20 +- .../views/text/ReactAbsoluteSizeSpan.java | 5 +- .../views/text/ReactBackgroundColorSpan.java | 5 +- .../views/text/ReactBaseTextShadowNode.java | 114 +- .../react/views/text/ReactFontManager.java | 54 +- .../views/text/ReactForegroundColorSpan.java | 5 +- .../react/views/text/ReactRawTextManager.java | 13 +- .../views/text/ReactRawTextShadowNode.java | 8 +- .../facebook/react/views/text/ReactSpan.java | 8 +- .../views/text/ReactStrikethroughSpan.java | 8 +- .../react/views/text/ReactTagSpan.java | 9 +- .../text/ReactTextAnchorViewManager.java | 58 +- .../text/ReactTextInlineImageShadowNode.java | 16 +- .../react/views/text/ReactTextShadowNode.java | 41 +- .../react/views/text/ReactTextUpdate.java | 60 +- .../react/views/text/ReactTextView.java | 152 +- .../views/text/ReactTextViewManager.java | 16 +- .../react/views/text/ReactUnderlineSpan.java | 8 +- .../text/ReactVirtualTextShadowNode.java | 7 +- .../text/ReactVirtualTextViewManager.java | 8 +- .../react/views/text/ShadowStyleSpan.java | 6 +- .../react/views/text/TextAttributeProps.java | 111 +- .../react/views/text/TextAttributes.java | 92 +- .../react/views/text/TextInlineImageSpan.java | 128 +- .../text/TextInlineViewPlaceholderSpan.java | 19 +- .../react/views/text/TextLayoutManager.java | 180 +- .../react/views/text/TextTransform.java | 17 +- .../react/views/text/frescosupport/BUCK | 2 + ...coBasedReactTextInlineImageShadowNode.java | 61 +- .../FrescoBasedReactTextInlineImageSpan.java | 72 +- ...oBasedReactTextInlineImageViewManager.java | 27 +- .../views/textinput/ContentSizeWatcher.java | 5 +- .../ReactContentSizeChangedEvent.java | 14 +- .../react/views/textinput/ReactEditText.java | 129 +- .../ReactEditTextInputConnectionWrapper.java | 69 +- .../textinput/ReactTextChangedEvent.java | 14 +- .../textinput/ReactTextInputBlurEvent.java | 9 +- .../ReactTextInputEndEditingEvent.java | 13 +- .../views/textinput/ReactTextInputEvent.java | 15 +- .../textinput/ReactTextInputFocusEvent.java | 9 +- .../ReactTextInputKeyPressEvent.java | 9 +- .../textinput/ReactTextInputLocalData.java | 7 +- .../textinput/ReactTextInputManager.java | 402 +- .../ReactTextInputSelectionEvent.java | 17 +- .../textinput/ReactTextInputShadowNode.java | 38 +- .../ReactTextInputSubmitEditingEvent.java | 13 +- .../react/views/textinput/ScrollWatcher.java | 5 +- .../views/textinput/SelectionWatcher.java | 9 +- .../com/facebook/react/views/toolbar/BUCK | 30 - .../toolbar/DrawableWithIntrinsicSize.java | 47 - .../react/views/toolbar/ReactToolbar.java | 332 - .../views/toolbar/ReactToolbarManager.java | 267 - .../toolbar/events/ToolbarClickEvent.java | 49 - .../ReactUnimplementedView.java | 9 +- .../ReactUnimplementedViewManager.java | 11 +- .../java/com/facebook/react/views/view/BUCK | 2 +- .../facebook/react/views/view/ColorUtil.java | 14 +- .../react/views/view/MeasureUtil.java | 1 - .../react/views/view/ReactDrawableHelper.java | 53 +- .../view/ReactViewBackgroundDrawable.java | 200 +- .../view/ReactViewBackgroundManager.java | 4 +- .../react/views/view/ReactViewGroup.java | 146 +- .../react/views/view/ReactViewManager.java | 220 +- .../react/views/view/ViewGroupClickEvent.java | 5 +- .../views/viewpager/PageScrollEvent.java | 21 +- .../PageScrollStateChangedEvent.java | 12 +- .../views/viewpager/PageSelectedEvent.java | 12 +- .../react/views/viewpager/ReactViewPager.java | 48 +- .../viewpager/ReactViewPagerManager.java | 78 +- .../java/com/facebook/systrace/Systrace.java | 57 +- .../facebook/systrace/SystraceMessage.java | 14 +- .../com/facebook/systrace/TraceListener.java | 1 + .../com/facebook/yoga/LayoutPassReason.java | 42 + .../java/com/facebook/yoga/YogaConfig.java | 1 - .../com/facebook/yoga/YogaLayoutType.java | 34 + .../java/com/facebook/yoga/YogaNative.java | 4 +- .../main/java/com/facebook/yoga/YogaNode.java | 4 +- .../java/com/facebook/yoga/YogaNodeJNI.java | 186 - .../com/facebook/yoga/YogaNodeJNIBase.java | 182 +- .../facebook/yoga/YogaNodeJNIBatching.java | 177 - .../facebook/yoga/YogaNodeJNIFinalizer.java | 34 + .../facebook/yoga/YogaNodeJNIPhantomRefs.java | 41 + ReactAndroid/src/main/jni/Application.mk | 4 +- ReactAndroid/src/main/jni/first-party/fb/BUCK | 1 + .../fb/include/fb/fbjni/CoreClasses.h | 2 +- .../fb/include/fb/fbjni/Iterator.h | 2 +- .../jni/first-party/fb/include/fbjni/fbjni.h | 10 + .../jni/first-party/fb/jni/Exceptions.cpp | 4 +- .../main/jni/first-party/hermes/Android.mk | 5 + .../jni/first-party/yogajni/jni/YGJNI.cpp | 220 +- .../jni/first-party/yogajni/jni/YGJTypes.cpp | 2 +- .../jni/first-party/yogajni/jni/YGJTypes.h | 37 +- .../src/main/jni/react/jni/Android.mk | 12 + ReactAndroid/src/main/jni/react/jni/BUCK | 2 +- .../jni/react/jni/CatalystInstanceImpl.cpp | 2 +- .../main/jni/react/jni/CatalystInstanceImpl.h | 4 +- .../jni/react/jni/ModuleRegistryBuilder.cpp | 16 +- .../jni/react/jni/ModuleRegistryBuilder.h | 2 +- .../src/main/jni/react/perftests/BUCK | 6 +- .../src/main/jni/third-party/folly/Android.mk | 14 +- .../main/res/devsupport/values/strings.xml | 38 +- .../res/devsupport/xml/rn_dev_preferences.xml | 11 +- .../main/res/views/uimanager/values/ids.xml | 3 + .../uimanager/values/strings_unlocalized.xml | 4 + .../java/com/facebook/common/logging/BUCK | 1 + .../common/logging/FakeLoggingDelegate.java | 44 +- .../react/CompositeReactPackageTest.java | 55 +- .../java/com/facebook/react/RootViewTest.java | 173 +- .../NativeAnimatedInterpolationTest.java | 80 +- .../NativeAnimatedNodeTraversalTest.java | 765 +- .../react/bridge/BaseJavaModuleTest.java | 23 +- .../bridge/FallbackJSBundleLoaderTest.java | 115 +- .../react/bridge/InstanceHandleHelper.java | 6 +- .../react/bridge/JavaOnlyArrayTest.java | 45 +- .../facebook/react/bridge/JsonWriterTest.java | 98 - .../react/bridge/ReactTestHelper.java | 57 +- .../devsupport/BundleDeltaClientTest.java | 82 +- .../JSDebuggerWebSocketClientTest.java | 53 +- .../devsupport/MultipartStreamReaderTest.java | 120 +- .../devsupport/StackTraceHelperTest.java | 15 +- .../react/modules/blob/BlobModuleTest.java | 54 +- .../modules/camera/ImageStoreManagerTest.java | 27 +- .../clipboard/ClipboardModuleTest.java | 19 +- .../modules/dialog/DialogModuleTest.java | 33 +- .../react/modules/network/HeaderUtilTest.java | 12 +- .../modules/network/NetworkingModuleTest.java | 636 +- .../network/ProgressiveStringDecoderTest.java | 129 +- .../network/ReactCookieJarContainerTest.java | 45 +- .../react/modules/share/ShareModuleTest.java | 94 +- .../storage/AsyncStorageModuleTest.java | 83 +- .../modules/timing/TimingModuleTest.java | 77 +- .../JSPackagerClientTest.java | 54 +- .../react/uimanager/BaseViewManagerTest.java | 14 +- .../LayoutPropertyApplicatorTest.java | 217 +- .../react/uimanager/MatrixMathHelperTest.java | 35 +- .../ReactPropAnnotationSetterSpecTest.java | 51 +- .../ReactPropAnnotationSetterTest.java | 79 +- .../uimanager/ReactPropConstantsTest.java | 133 +- .../ReactPropForShadowNodeSetterTest.java | 29 +- .../ReactPropForShadowNodeSpecTest.java | 11 +- .../uimanager/SimpleViewPropertyTest.java | 47 +- .../UIManagerModuleConstantsTest.java | 78 +- .../react/uimanager/UIManagerModuleTest.java | 235 +- .../layoutanimation/InterpolatorTypeTest.java | 18 +- .../facebook/react/util/JSStackTraceTest.java | 105 +- .../views/image/ImageResizeModeTest.java | 31 +- .../views/image/ReactImagePropertyTest.java | 51 +- .../views/slider/ReactSliderPropertyTest.java | 16 +- .../views/text/CustomLineHeightSpanTest.java | 9 +- .../react/views/text/ReactTextTest.java | 327 +- .../textinput/ReactTextInputPropertyTest.java | 95 +- .../react/views/textinput/TextInputTest.java | 81 +- .../react/views/view/ColorUtilTest.java | 17 +- .../configuration/MockitoConfiguration.java | 2 +- ReactCommon/React-Fabric.podspec | 2 +- ReactCommon/ReactCommon.podspec | 69 + ReactCommon/better/BUCK | 3 +- ReactCommon/config/BUCK | 4 +- ReactCommon/cxxreact/Android.mk | 4 +- ReactCommon/cxxreact/CxxModule.h | 2 + ReactCommon/cxxreact/JSBigString.cpp | 5 +- ReactCommon/cxxreact/JSBigString.h | 2 +- ReactCommon/cxxreact/MethodCall.cpp | 6 +- ReactCommon/cxxreact/ModuleRegistry.h | 9 +- ReactCommon/cxxreact/NativeToJsBridge.cpp | 2 +- ReactCommon/cxxreact/React-cxxreact.podspec | 6 +- ReactCommon/cxxreact/SampleCxxModule.cpp | 6 +- ReactCommon/cxxreact/SampleCxxModule.h | 4 +- ReactCommon/cxxreact/re_worker_requirements | 6 + ReactCommon/cxxreact/tests/BUCK | 2 +- ReactCommon/fabric/attributedstring/BUCK | 5 +- .../attributedstring/TextAttributes.cpp | 1 + .../fabric/attributedstring/conversions.h | 8 +- .../fabric/components/activityindicator/BUCK | 20 +- ReactCommon/fabric/components/image/BUCK | 8 +- .../fabric/components/image/conversions.h | 11 +- ReactCommon/fabric/components/modal/BUCK | 12 +- .../modal/ModalHostViewComponentDescriptor.h | 4 + .../components/modal/ModalHostViewState.cpp | 7 +- .../components/modal/ModalHostViewState.h | 10 +- ReactCommon/fabric/components/root/BUCK | 8 +- .../fabric/components/root/RootProps.cpp | 14 +- .../fabric/components/root/RootProps.h | 16 +- ReactCommon/fabric/components/scrollview/BUCK | 8 +- ReactCommon/fabric/components/slider/BUCK | 16 +- .../android/SliderMeasurementsManager.cpp | 3 +- ReactCommon/fabric/components/text/BUCK | 18 +- .../text/basetext/BaseTextProps.cpp | 2 +- .../paragraph/ParagraphComponentDescriptor.h | 2 +- .../text/paragraph/ParagraphLocalData.cpp | 58 - .../text/paragraph/ParagraphLocalData.h | 58 - .../text/paragraph/ParagraphProps.cpp | 8 +- .../text/paragraph/ParagraphProps.h | 6 +- .../text/paragraph/ParagraphShadowNode.cpp | 42 +- .../text/paragraph/ParagraphShadowNode.h | 16 +- .../text/paragraph/ParagraphState.cpp | 23 + .../text/paragraph/ParagraphState.h | 52 + .../components/text/paragraph/conversions.h | 15 +- .../text/tests/ParagraphLocalDataTest.cpp | 10 +- ReactCommon/fabric/components/view/BUCK | 8 +- .../components/view/ConcreteViewShadowNode.h | 7 - ReactCommon/fabric/components/view/Touch.cpp | 36 + ReactCommon/fabric/components/view/Touch.h | 88 + .../fabric/components/view/TouchEvent.cpp | 33 + .../fabric/components/view/TouchEvent.h | 54 + .../components/view/TouchEventEmitter.cpp | 22 +- .../components/view/TouchEventEmitter.h | 105 +- .../fabric/components/view/ViewEventEmitter.h | 1 + .../view/accessibility/AccessibilityProps.cpp | 6 +- .../view/accessibility/AccessibilityProps.h | 30 +- .../accessibility/AccessibleShadowNode.cpp | 25 - .../view/accessibility/AccessibleShadowNode.h | 36 - .../fabric/components/view/propsConversions.h | 142 +- .../view/yoga/YogaLayoutableShadowNode.cpp | 19 +- .../view/yoga/YogaLayoutableShadowNode.h | 12 +- .../view/yoga/YogaStylableProps.cpp | 8 +- .../components/view/yoga/YogaStylableProps.h | 12 +- ReactCommon/fabric/core/BUCK | 45 +- .../componentdescriptor/ComponentDescriptor.h | 4 +- .../ConcreteComponentDescriptor.h | 13 +- ReactCommon/fabric/core/conversions.h | 11 + ReactCommon/fabric/core/events/EventBeat.h | 2 +- .../fabric/core/events/EventDispatcher.cpp | 10 +- ReactCommon/fabric/core/events/EventEmitter.h | 2 +- .../fabric/core/layout/LayoutMetrics.h | 2 +- .../fabric/core/layout/LayoutPrimitives.h | 2 +- .../fabric/core/layout/LayoutableShadowNode.h | 6 +- .../fabric/core/primitives/RawProps.cpp | 88 + ReactCommon/fabric/core/primitives/RawProps.h | 100 +- .../fabric/core/primitives/RawPropsKey.cpp | 61 + .../fabric/core/primitives/RawPropsKey.h | 42 + .../fabric/core/primitives/RawPropsKeyMap.cpp | 88 + .../fabric/core/primitives/RawPropsKeyMap.h | 59 + .../fabric/core/primitives/RawPropsParser.cpp | 106 + .../fabric/core/primitives/RawPropsParser.h | 77 + .../core/primitives/RawPropsPrimitives.h | 53 + ReactCommon/fabric/core/primitives/RawValue.h | 5 +- .../fabric/core/primitives/ReactPrimitives.h | 2 +- .../fabric/core/primitives/Sealable.cpp | 2 +- ReactCommon/fabric/core/propsConversions.h | 43 +- .../core/shadownode/ConcreteShadowNode.h | 15 +- .../fabric/core/shadownode/LocalData.h | 2 +- .../fabric/core/shadownode/ShadowNode.cpp | 15 +- .../fabric/core/shadownode/ShadowNode.h | 11 +- .../fabric/core/shadownode/ShadowNodeFamily.h | 4 +- ReactCommon/fabric/core/state/State.cpp | 7 +- ReactCommon/fabric/core/state/State.h | 2 +- ReactCommon/fabric/core/state/StateData.cpp | 30 - ReactCommon/fabric/core/state/StateData.h | 19 +- ReactCommon/fabric/core/state/StateTarget.cpp | 1 + .../core/tests/ComponentDescriptorTest.cpp | 12 +- .../fabric/core/tests/ShadowNodeTest.cpp | 9 +- ReactCommon/fabric/core/tests/TestComponent.h | 2 - .../tests/benchmarks/RawPropsBenchmark.cpp | 80 + ReactCommon/fabric/debug/BUCK | 5 +- .../fabric/debug/DebugStringConvertible.h | 26 +- ReactCommon/fabric/graphics/BUCK | 20 +- .../fabric/graphics/React-graphics.podspec | 2 +- ReactCommon/fabric/graphics/Transform.h | 2 +- .../platform/{android => cxx}/Color.cpp | 0 .../platform/{android => cxx}/Color.h | 0 .../platform/{android => cxx}/Float.h | 0 ReactCommon/fabric/imagemanager/BUCK | 15 +- .../fabric/imagemanager/ImageRequest.h | 2 +- .../fabric/imagemanager/ImageResponse.h | 2 +- .../{android => cxx}/ImageManager.cpp | 0 .../{android => cxx}/ImageRequest.cpp | 0 .../imagemanager/platform/ios/ImageManager.mm | 8 +- .../platform/ios/RCTImageManager.mm | 12 +- ReactCommon/fabric/mapbuffer/BUCK | 66 + ReactCommon/fabric/mapbuffer/MapBuffer.cpp | 18 + ReactCommon/fabric/mapbuffer/MapBuffer.h | 37 + .../fabric/mapbuffer/tests/MapBufferTest.cpp | 10 +- ReactCommon/fabric/mounting/BUCK | 5 +- .../fabric/mounting/Differentiator.cpp | 29 +- ReactCommon/fabric/mounting/Differentiator.h | 7 + .../fabric/mounting/MountingCoordinator.cpp | 7 +- .../fabric/mounting/MountingCoordinator.h | 4 - .../fabric/mounting/MountingTelemetry.cpp | 53 +- .../fabric/mounting/MountingTelemetry.h | 13 +- ReactCommon/fabric/mounting/ShadowView.cpp | 2 +- ReactCommon/fabric/mounting/ShadowView.h | 30 +- .../fabric/mounting/stubs/StubView.cpp | 30 + ReactCommon/fabric/mounting/stubs/StubView.h | 12 + .../fabric/mounting/stubs/StubViewTree.cpp | 5 + .../fabric/mounting/stubs/StubViewTree.h | 3 + ReactCommon/fabric/mounting/stubs/stubs.cpp | 37 +- ReactCommon/fabric/textlayoutmanager/BUCK | 45 +- .../platform/android/TextLayoutManager.cpp | 3 +- .../platform/cxx/TextLayoutManager.cpp | 27 + .../platform/cxx/TextLayoutManager.h | 54 + .../platform/ios/RCTAttributedTextUtils.mm | 163 +- .../platform/ios/RCTFontProperties.h | 12 +- .../platform/ios/RCTFontUtils.mm | 118 +- ReactCommon/fabric/uimanager/BUCK | 5 +- .../ComponentDescriptorProviderRegistry.cpp | 2 + .../uimanager/ComponentDescriptorRegistry.cpp | 29 +- .../uimanager/ComponentDescriptorRegistry.h | 6 +- ReactCommon/fabric/uimanager/Scheduler.cpp | 139 +- ReactCommon/fabric/uimanager/Scheduler.h | 16 +- .../fabric/uimanager/SchedulerDelegate.h | 21 +- .../fabric/uimanager/SchedulerToolbox.cpp | 6 + .../fabric/uimanager/SchedulerToolbox.h | 47 + ReactCommon/fabric/uimanager/UIManager.cpp | 28 +- ReactCommon/fabric/uimanager/UIManager.h | 13 +- .../fabric/uimanager/UIManagerBinding.cpp | 123 +- .../fabric/uimanager/UIManagerBinding.h | 2 +- .../fabric/uimanager/UIManagerDelegate.h | 25 +- ReactCommon/fabric/uimanager/primitives.h | 11 +- ReactCommon/hermes/inspector/.clang-format | 87 + ReactCommon/hermes/inspector/Android.mk | 26 + .../hermes/inspector/AsyncPauseState.h | 29 + ReactCommon/hermes/inspector/DEFS.bzl | 7 + ReactCommon/hermes/inspector/Exceptions.h | 44 + ReactCommon/hermes/inspector/Inspector.cpp | 582 + ReactCommon/hermes/inspector/Inspector.h | 306 + .../hermes/inspector/InspectorState.cpp | 476 + ReactCommon/hermes/inspector/InspectorState.h | 400 + ReactCommon/hermes/inspector/README.md | 113 + .../hermes/inspector/RuntimeAdapter.cpp | 25 + ReactCommon/hermes/inspector/RuntimeAdapter.h | 59 + .../inspector/chrome/AutoAttachUtils.cpp | 127 + .../hermes/inspector/chrome/AutoAttachUtils.h | 19 + .../hermes/inspector/chrome/Connection.cpp | 668 + .../hermes/inspector/chrome/Connection.h | 58 + .../inspector/chrome/ConnectionDemux.cpp | 137 + .../hermes/inspector/chrome/ConnectionDemux.h | 52 + .../inspector/chrome/MessageConverters.cpp | 215 + .../inspector/chrome/MessageConverters.h | 121 + .../inspector/chrome/MessageInterfaces.h | 69 + .../hermes/inspector/chrome/MessageTypes.cpp | 902 + .../hermes/inspector/chrome/MessageTypes.h | 499 + .../inspector/chrome/MessageTypesInlines.h | 154 + .../hermes/inspector/chrome/Registration.cpp | 33 + .../hermes/inspector/chrome/Registration.h | 34 + .../inspector/chrome/RemoteObjectsTable.cpp | 141 + .../inspector/chrome/RemoteObjectsTable.h | 119 + .../hermes/inspector/chrome/cli/main.cpp | 197 + .../chrome/tests/AsyncHermesRuntime.cpp | 131 + .../chrome/tests/AsyncHermesRuntime.h | 109 + .../chrome/tests/ConnectionDemuxTests.cpp | 142 + .../chrome/tests/ConnectionTests.cpp | 2151 ++ .../inspector/chrome/tests/MessageTests.cpp | 439 + .../chrome/tests/RemoteObjectsTableTest.cpp | 106 + .../inspector/chrome/tests/SyncConnection.cpp | 123 + .../inspector/chrome/tests/SyncConnection.h | 62 + .../inspector/detail/SerialExecutor.cpp | 57 + .../hermes/inspector/detail/SerialExecutor.h | 52 + .../hermes/inspector/detail/Thread.cpp | 34 + ReactCommon/hermes/inspector/detail/Thread.h | 78 + .../detail/tests/SerialExecutorTests.cpp | 36 + .../inspector/docs/GenerateInspectorFSM.sh | 3 + .../hermes/inspector/docs/InspectorFSM.gv | 39 + .../hermes/inspector/docs/InspectorFSM.pdf | Bin 0 -> 18808 bytes .../hermes/inspector/tests/InspectorTests.cpp | 405 + ReactCommon/hermes/inspector/tools/format | 10 + .../hermes/inspector/tools/message_types.txt | 19 + .../hermes/inspector/tools/msggen/.babelrc | 9 + .../hermes/inspector/tools/msggen/.flowconfig | 16 + .../hermes/inspector/tools/msggen/.gitignore | 3 + .../tools/msggen/__tests__/CommandTest.js | 65 + .../tools/msggen/__tests__/EventTest.js | 50 + .../tools/msggen/__tests__/GraphTest.js | 81 + .../msggen/__tests__/HeaderWriterTest.js | 131 + .../__tests__/ImplementationWriterTest.js | 174 + .../tools/msggen/__tests__/PropertyTest.js | 134 + .../tools/msggen/__tests__/TypeTest.js | 53 + .../inspector/tools/msggen/package.json | 37 + .../inspector/tools/msggen/src/Command.js | 80 + .../inspector/tools/msggen/src/Converters.js | 36 + .../inspector/tools/msggen/src/Event.js | 58 + .../tools/msggen/src/GeneratedHeader.js | 15 + .../inspector/tools/msggen/src/Graph.js | 91 + .../tools/msggen/src/HeaderWriter.js | 324 + .../tools/msggen/src/ImplementationWriter.js | 409 + .../inspector/tools/msggen/src/Property.js | 228 + .../inspector/tools/msggen/src/TestHelpers.js | 42 + .../hermes/inspector/tools/msggen/src/Type.js | 99 + .../inspector/tools/msggen/src/index.js | 228 + .../hermes/inspector/tools/msggen/yarn.lock | 3700 +++ ReactCommon/hermes/inspector/tools/run_msggen | 26 + .../tools/sandcastle/build_and_test.sh | 9 + .../inspector/tools/sandcastle/setup.sh | 30 + ReactCommon/jscallinvoker/Android.mk | 6 +- ReactCommon/jscallinvoker/BUCK | 16 +- .../BridgeJSCallInvoker.cpp | 2 +- .../BridgeJSCallInvoker.h | 2 +- .../{jsireact => ReactCommon}/JSCallInvoker.h | 0 ReactCommon/jsi/JSCRuntime.cpp | 6 +- ReactCommon/jsi/jsi/JSIDynamic.cpp | 2 +- ReactCommon/jsi/jsi/JSIDynamic.h | 14 +- ReactCommon/jsi/jsi/decorator.h | 14 +- ReactCommon/jsi/jsi/instrumentation.h | 2 +- ReactCommon/jsi/jsi/jsi-inl.h | 2 +- ReactCommon/jsi/jsi/jsi.cpp | 4 +- ReactCommon/jsi/jsi/jsi.h | 6 +- ReactCommon/jsi/jsi/jsilib-posix.cpp | 2 +- ReactCommon/jsi/jsi/jsilib-windows.cpp | 2 +- ReactCommon/jsi/jsi/jsilib.h | 2 +- ReactCommon/jsi/jsi/test/testlib.cpp | 1198 + ReactCommon/jsi/jsi/test/testlib.h | 48 + ReactCommon/jsi/jsi/threadsafe.h | 2 +- .../jsiexecutor/jsireact/JSIExecutor.cpp | 47 +- .../jsiexecutor/jsireact/JSIExecutor.h | 12 +- ReactCommon/turbomodule/core/BUCK | 6 +- .../turbomodule/core/LongLivedObject.cpp | 2 +- .../turbomodule/core/LongLivedObject.h | 22 +- .../turbomodule/core/TurboCxxModule.cpp | 107 +- ReactCommon/turbomodule/core/TurboCxxModule.h | 19 +- ReactCommon/turbomodule/core/TurboModule.cpp | 25 +- ReactCommon/turbomodule/core/TurboModule.h | 25 +- .../turbomodule/core/TurboModuleBinding.cpp | 33 +- .../turbomodule/core/TurboModuleBinding.h | 12 +- .../turbomodule/core/TurboModuleUtils.cpp | 23 +- .../turbomodule/core/TurboModuleUtils.h | 67 +- .../core/platform/android/JavaTurboModule.cpp | 443 +- .../core/platform/android/JavaTurboModule.h | 45 +- .../core/platform/ios/RCTTurboModule.h | 41 +- .../core/platform/ios/RCTTurboModule.mm | 228 +- .../core/platform/ios/RCTTurboModuleManager.h | 8 +- .../platform/ios/RCTTurboModuleManager.mm | 164 +- ReactCommon/turbomodule/samples/BUCK | 7 +- .../NativeSampleTurboCxxModuleSpecJSI.cpp | 141 + .../NativeSampleTurboCxxModuleSpecJSI.h | 17 +- .../samples/SampleTurboCxxModule.cpp | 94 + .../samples/SampleTurboCxxModule.h | 44 + .../ios/NativeSampleTurboCxxModuleSpecJSI.cpp | 74 - .../ios/RCTNativeSampleTurboModuleSpec.h | 26 +- .../ios/RCTNativeSampleTurboModuleSpec.mm | 103 +- .../platform/ios/RCTSampleTurboCxxModule.h | 36 +- .../platform/ios/RCTSampleTurboCxxModule.mm | 69 +- .../platform/ios/RCTSampleTurboModule.h | 2 +- .../platform/ios/RCTSampleTurboModule.mm | 50 +- .../ios/SampleTurboCxxModuleLegacyImpl.cpp | 156 +- .../ios/SampleTurboCxxModuleLegacyImpl.h | 16 +- ReactCommon/utils/BUCK | 5 +- ReactCommon/utils/ContextContainer.h | 12 +- ReactCommon/utils/RuntimeExecutor.h | 25 + ReactCommon/yoga/Android.mk | 1 + ReactCommon/yoga/BUCK | 4 +- .../yoga/{yoga.podspec => Yoga.podspec} | 7 +- ReactCommon/yoga/yoga/Bitfield.h | 144 + ReactCommon/yoga/yoga/CompactValue.h | 2 +- ReactCommon/yoga/yoga/Utils.cpp | 2 +- ReactCommon/yoga/yoga/Utils.h | 8 +- ReactCommon/yoga/yoga/YGConfig.cpp | 2 +- ReactCommon/yoga/yoga/YGConfig.h | 4 +- ReactCommon/yoga/yoga/YGEnums.cpp | 2 +- ReactCommon/yoga/yoga/YGEnums.h | 2 +- ReactCommon/yoga/yoga/YGFloatOptional.h | 2 +- ReactCommon/yoga/yoga/YGLayout.cpp | 5 +- ReactCommon/yoga/yoga/YGLayout.h | 50 +- ReactCommon/yoga/yoga/YGMacros.h | 14 +- ReactCommon/yoga/yoga/YGMarker.h | 90 - ReactCommon/yoga/yoga/YGNode.cpp | 73 +- ReactCommon/yoga/yoga/YGNode.h | 78 +- ReactCommon/yoga/yoga/YGNodePrint.cpp | 2 +- ReactCommon/yoga/yoga/YGNodePrint.h | 2 +- ReactCommon/yoga/yoga/YGStyle.cpp | 2 +- ReactCommon/yoga/yoga/YGStyle.h | 254 +- ReactCommon/yoga/yoga/YGValue.cpp | 2 +- ReactCommon/yoga/yoga/YGValue.h | 2 +- ReactCommon/yoga/yoga/Yoga-internal.h | 8 +- ReactCommon/yoga/yoga/Yoga.cpp | 333 +- ReactCommon/yoga/yoga/Yoga.h | 9 +- ReactCommon/yoga/yoga/event/event.cpp | 81 +- ReactCommon/yoga/yoga/event/event.h | 73 +- ReactCommon/yoga/yoga/instrumentation.h | 63 - .../yoga/yoga/internal/experiments-inl.h | 31 + .../yoga/yoga/internal/experiments.cpp | 37 + ReactCommon/yoga/yoga/internal/experiments.h | 25 + ReactCommon/yoga/yoga/log.cpp | 2 +- ReactCommon/yoga/yoga/log.h | 2 +- .../BasicBuild/ReactAndroid/NuGet.Config | 17 + .../ReactAndroid/ReactAndroid.nuspec | 123 + .../BasicBuild/ReactAndroid/build.gradle | 25 + .../BasicBuild/ReactAndroid/packages.config | 8 + .../V8Integration/ReactAndroid/build.gradle | 62 + .../react/ReactInstanceManagerBuilder.java | 28 + .../react/bridge/ReactMarkerConstants.java | 12 + .../react/uimanager/ViewManagerRegistry.java | 63 + .../com/facebook/react/v8executor/Android.mk | 24 + .../com/facebook/react/v8executor/OnLoad.cpp | 54 + .../facebook/react/v8executor/V8Executor.java | 35 + .../react/v8executor/V8ExecutorFactory.cpp | 44 + .../react/v8executor/V8ExecutorFactory.h | 20 + .../react/v8executor/V8ExecutorFactory.java | 96 + .../src/main/jni/react/jni/Android.mk | 7 + .../src/main/jni/react/jni/JReactMarker.cpp | 18 + .../src/main/jni/third-party/v8/Android.mk | 11 + .../src/main/jni/third-party/v8/base.mk | 15 + .../main/jni/third-party/v8base/Android.mk | 10 + .../jni/third-party/v8platform/Android.mk | 10 + .../ReactCommon/cxxreact/ReactMarker.h | 14 + .../V8Integration/ReactCommon/jsi/Android.mk | 38 + .../ReactCommon/jsi/FileUtils.cpp | 111 + .../V8Integration/ReactCommon/jsi/FileUtils.h | 24 + .../ReactCommon/jsi/V8Platform.cpp | 199 + .../ReactCommon/jsi/V8Platform.h | 140 + .../V8Integration/ReactCommon/jsi/V8Runtime.h | 70 + .../ReactCommon/jsi/V8Runtime_basic.cpp | 104 + .../ReactCommon/jsi/V8Runtime_droid.cpp | 160 + .../ReactCommon/jsi/V8Runtime_impl.h | 467 + .../ReactCommon/jsi/V8Runtime_shared.cpp | 778 + .../ReactCommon/jsi/V8Runtime_win.cpp | 32 + bots/IssueCommands.txt | 70 - bots/README.md | 27 +- .../circleci => bots}/code-analysis-bot.js | 15 +- bots/dangerfile.js | 6 +- bots/package.json | 5 +- bots/yarn.lock | 657 +- build.gradle.kts | 4 +- flow/Map.js | 40 - flow/Set.js | 36 - flow/jest.js | 20 +- gradle/wrapper/gradle-wrapper.properties | 2 +- jest-preset.js | 8 - jest.config.js | 39 +- jest/__tests__/hasteImpl-test.js | 93 - jest/hasteImpl.js | 123 - jest/preprocessor.js | 10 +- jest/renderer.js | 7 +- jest/setup.js | 501 +- lib/InitializeJavaScriptAppEngine.js | 15 - lib/RCTEventEmitter.js | 15 - lib/TextInputState.js | 15 - lib/UIManager.js | 15 - lib/UIManagerStatTracker.js | 15 - lib/View.js | 15 - lib/deepDiffer.js | 15 - lib/deepFreezeAndThrowOnMutationInDev.js | 15 - lib/flattenStyle.js | 15 - .../HelloWorld.xcodeproj/project.pbxproj | 44 +- .../generator-macos/templates/macos/Podfile | 56 +- metro.config.js | 3 +- package.json | 48 +- .../babel-plugin-inline-view-configs/BUCK | 23 + .../__test_fixtures__/failures.js | 79 + .../__test_fixtures__/fixtures.js | 62 + .../__snapshots__/index-test.js.snap | 76 + .../__tests__/index-test.js | 43 + .../babel-plugin-inline-view-configs/index.js | 133 + .../package.json | 19 + .../index.js | 17 +- .../package.json | 4 + .../yarn.lock | 12 + .../README.md | 21 + .../index.js | 6 +- .../no-haste-imports.js | 73 + .../package.json | 14 + packages/react-native-codegen/BUCK | 192 +- packages/react-native-codegen/DEFS.bzl | 183 +- .../combine-js-to-schema-test.js.snap | 14 - .../__tests__/combine-js-to-schema-test.js | 52 - .../buck_tests/combine-js-to-schema.js | 29 - .../buck_tests/copy-fixture.js | 33 - .../buck_tests/emptyFile.cpp | 18 +- .../buck_tests/emptyFile.mm | 10 + .../buck_tests/generate-tests.js | 18 +- .../{generate_tests.sh => generate-tests.sh} | 0 .../buck_tests/generate-view-configs-cli.js | 36 - .../buck_tests/generate-view-configs.js | 68 - .../buck_tests/generate-view-configs.sh | 15 - .../ArrayPropsNativeComponentViewManager.java | 54 + ...BooleanPropNativeComponentViewManager.java | 29 + .../ColorPropNativeComponentViewManager.java | 29 + .../EnumPropNativeComponentViewManager.java | 29 + ...ObjectPropsNativeComponentViewManager.java | 30 + .../EventPropsNativeComponentViewManager.java | 29 + .../FloatPropsNativeComponentViewManager.java | 44 + .../ImagePropNativeComponentViewManager.java | 30 + ...IntegerPropNativeComponentViewManager.java | 35 + ...terfaceOnlyNativeComponentViewManager.java | 30 + ...iNativePropNativeComponentViewManager.java | 40 + ...opsNoEventsNativeComponentViewManager.java | 27 + .../ObjectPropsNativeComponentManager.java | 36 + .../PointPropNativeComponentViewManager.java | 30 + .../StringPropNativeComponentViewManager.java | 32 + .../components/ArrayPropsNativeComponent.js | 44 + .../components/BooleanPropNativeComponent.js | 27 + .../components/ColorPropNativeComponent.js | 27 + .../components/EnumPropNativeComponent.js | 27 + .../EventNestedObjectPropsNativeComponent.js | 44 + .../components/EventPropsNativeComponent.js | 65 + .../components/FloatPropsNativeComponent.js | 35 + .../components/ImagePropNativeComponent.js | 27 + .../components/IntegerPropNativeComponent.js | 32 + .../InterfaceOnlyNativeComponent.js | 37 + .../MultiNativePropNativeComponent.js | 34 + .../NoPropsNoEventsNativeComponent.js | 25 + .../components/ObjectPropsNativeComponent.js | 51 + .../components/PointPropNativeComponent.js | 27 + .../components/StringPropNativeComponent.js | 28 + .../modules/NativeArrayTurboModule.js | 27 + .../modules/NativeBooleanTurboModule.js | 26 + .../modules/NativeCallbackTurboModule.js | 26 + .../modules/NativeNullableTurboModule.js | 25 + .../modules/NativeNumberTurboModule.js | 26 + .../modules/NativeObjectTurboModule.js | 65 + .../NativeOptionalObjectTurboModule.js | 40 + .../modules/NativePromiseTurboModule.js | 26 + .../modules/NativeSampleTurboModule.js | 36 + .../modules/NativeStringTurboModule.js | 26 + packages/react-native-codegen/package.json | 8 +- .../react-native-codegen/src/CodegenSchema.js | 208 +- .../src/SchemaValidator.js | 6 - .../src/__tests__/SchemaValidator-test.js | 26 +- .../SchemaValidator-test.js.snap | 6 - .../cli/combine}/combine-js-to-schema-cli.js | 0 .../src/cli/combine/combine-js-to-schema.js | 38 + .../cli/combine}/combine_js_to_schema.sh | 6 +- .../src/cli/parser/parser-cli.js | 18 + .../src/cli/parser/parser.js | 24 + .../cli/parser/parser.sh} | 4 +- .../src/generators/EventEmitterHelpers.js | 27 - .../src/generators/GeneratePropsH.js | 352 - .../src/generators/GenerateViewConfigJs.js | 324 - .../src/generators/RNCodegen.js | 63 +- .../GenerateComponentDescriptorH-test.js | 95 - .../GenerateViewConfigJs-test.js.snap | 820 - .../generators/{ => components}/CppHelpers.js | 25 +- .../GenerateComponentDescriptorH.js | 8 +- .../components/GenerateComponentHObjCpp.js | 318 + .../GenerateEventEmitterCpp.js | 78 +- .../{ => components}/GenerateEventEmitterH.js | 89 +- .../{ => components}/GeneratePropsCpp.js | 12 +- .../generators/components/GeneratePropsH.js | 664 + .../components/GeneratePropsJavaDelegate.js | 285 + .../components/GeneratePropsJavaInterface.js | 214 + .../{ => components}/GenerateShadowNodeCpp.js | 8 +- .../{ => components}/GenerateShadowNodeH.js | 8 +- .../{ => components}/GenerateTests.js | 29 +- .../components/GenerateViewConfigJs.js | 427 + .../src/generators/components/JavaHelpers.js | 92 + .../__test_fixtures__/fixtures.js | 506 +- .../GenerateComponentDescriptorH-test.js | 29 + .../GenerateComponentHObjCpp-test.js | 29 + .../__tests__/GenerateEventEmitterCpp-test.js | 4 +- .../__tests__/GenerateEventEmitterH-test.js | 4 +- .../__tests__/GeneratePropsCpp-test.js | 4 +- .../__tests__/GeneratePropsH-test.js | 4 +- .../GeneratePropsJavaDelegate-test.js | 29 + .../GeneratePropsJavaInterface-test.js | 29 + .../__tests__/GenerateShadowNodeCpp-test.js | 4 +- .../__tests__/GenerateShadowNodeH-test.js | 4 +- .../__tests__/GenerateTests-test.js | 4 +- .../__tests__/GenerateViewConfigJs-test.js | 52 + .../GenerateComponentDescriptorH-test.js.snap | 254 +- .../GenerateComponentHObjCpp-test.js.snap | 607 + .../GenerateEventEmitterCpp-test.js.snap | 161 + .../GenerateEventEmitterH-test.js.snap | 179 + .../GeneratePropsCpp-test.js.snap | 187 +- .../__snapshots__/GeneratePropsH-test.js.snap | 387 + .../GeneratePropsJavaDelegate-test.js.snap | 757 + .../GeneratePropsJavaInterface-test.js.snap | 355 + .../GenerateShadowNodeCpp-test.js.snap | 138 + .../GenerateShadowNodeH-test.js.snap | 191 + .../__snapshots__/GenerateTests-test.js.snap | 383 +- .../GenerateViewConfigJs-test.js.snap | 920 + .../generators/modules/GenerateModuleCpp.js | 154 + .../src/generators/modules/GenerateModuleH.js | 154 + .../modules/GenerateModuleHObjCpp.js | 271 + .../generators/modules/GenerateModuleMm.js | 280 + .../modules/ObjCppUtils/GenerateStructs.js | 184 + .../GenerateStructsForConstants.js | 211 + .../generators/modules/ObjCppUtils/Utils.js | 91 + .../modules/__test_fixtures__/fixtures.js | 473 + .../__test_fixtures__/structFixtures.js | 202 + .../__tests__/GenerateModuleCpp-test.js | 29 + .../__tests__/GenerateModuleH-test.js} | 8 +- .../__tests__/GenerateModuleHObjCpp-test.js | 29 + .../__tests__/GenerateModuleMm-test.js | 29 + .../modules/__tests__/GenerateStructs-test.js | 31 + .../GenerateModuleCpp-test.js.snap | 222 + .../GenerateModuleH-test.js.snap | 189 + .../GenerateModuleHObjCpp-test.js.snap | 450 + .../GenerateModuleMm-test.js.snap | 243 + .../GenerateStructs-test.js.snap | 273 + .../components/__test_fixtures__/failures.js | 418 + .../components/__test_fixtures__/fixtures.js | 898 + .../component-parser-test.js.snap | 6629 +++++ .../__tests__/component-parser-test.js | 39 + .../src/parsers/flow/components/commands.js | 105 + .../src/parsers/flow/components/events.js | 229 + .../src/parsers/flow/components/extends.js | 66 + .../src/parsers/flow/components/index.js | 211 + .../src/parsers/flow/components/options.js | 81 + .../src/parsers/flow/components/props.js | 386 + .../src/parsers/flow/components/schema.js | 60 + .../src/parsers/flow/index.js | 133 + .../modules/__test_fixtures__/failures.js | 221 + .../modules/__test_fixtures__/fixtures.js | 449 + .../__snapshots__/module-parser-test.js.snap | 1032 + .../modules/__tests__/module-parser-test.js | 39 + .../src/parsers/flow/modules/index.js | 47 + .../src/parsers/flow/modules/methods.js | 446 + .../src/parsers/flow/modules/schema.js | 38 + .../src/parsers/flow/utils.js | 28 + .../RNParser.js => parsers/schema/index.js} | 2 +- react-native.config.js | 2 +- react.gradle | 158 +- runXcodeTests.sh | 2 +- scripts/android-e2e-test.js | 11 +- scripts/android-setup.sh | 2 +- scripts/autolink-ios.rb | 27 +- scripts/circleci/analyze_code.sh | 8 +- scripts/circleci/analyze_scripts.sh | 38 +- scripts/circleci/gradle_download_deps.sh | 4 - scripts/compose-source-maps.js | 61 + scripts/generate-rncore.sh | 3 +- scripts/launchPackager.bat | 3 +- scripts/objc-test-ios.sh | 31 - scripts/objc-test-tvos.sh | 31 - scripts/objc-test.sh | 31 +- scripts/packager.sh | 5 +- scripts/react-native-xcode.sh | 29 +- scripts/run-ci-e2e-tests.js | 97 +- scripts/test-manual-e2e.sh | 20 +- scripts/validate-ios-test-env.sh | 2 +- .../versiontemplates/RCTVersion.m.template | 14 +- template/App.js | 25 +- template/_flowconfig | 34 +- template/_gitignore | 2 +- template/_prettierrc.js | 6 + template/android/app/build.gradle | 38 +- .../java/com/helloworld/MainActivity.java | 16 +- .../java/com/helloworld/MainApplication.java | 68 +- template/android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../ios/HelloWorldTests/HelloWorldTests.m | 8 +- template/ios/Podfile | 16 +- template/package.json | 22 +- third-party-podspecs/Folly.podspec | 2 +- tools/build_defs/oss/rn_defs.bzl | 31 + yarn.lock | 1142 +- 2380 files changed, 196089 insertions(+), 72627 deletions(-) create mode 100644 IntegrationTests/GlobalEvalWithSourceUrlTest.js delete mode 100644 Libraries/ART/ART.xcodeproj/project.pbxproj create mode 100644 Libraries/ActionSheetIOS/NativeActionSheetManager.js delete mode 100644 Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj create mode 100644 Libraries/Alert/NativeAlertManager.js create mode 100644 Libraries/Animated/src/NativeAnimatedModule.js create mode 100644 Libraries/Animated/src/__tests__/TimingAnimation-test.js create mode 100644 Libraries/Blob/NativeBlobModule.js create mode 100644 Libraries/Blob/NativeFileReaderModule.js delete mode 100755 Libraries/Blob/RCTBlob.xcodeproj/project.pbxproj create mode 100644 Libraries/BugReporting/NativeBugReporting.js delete mode 100644 Libraries/CameraRoll/CameraRoll.js delete mode 100644 Libraries/CameraRoll/ImagePickerIOS.js delete mode 100644 Libraries/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj delete mode 100644 Libraries/CameraRoll/React-RCTCameraRoll.podspec create mode 100644 Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js create mode 100644 Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js delete mode 100644 Libraries/Components/ActivityIndicator/ActivityIndicatorSchema.js rename Libraries/Components/ActivityIndicator/{RCTActivityIndicatorViewNativeComponent.js => ActivityIndicatorViewNativeComponent.js} (63%) create mode 100644 Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js create mode 100644 Libraries/Components/Clipboard/NativeClipboard.js create mode 100644 Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js create mode 100644 Libraries/Components/Keyboard/NativeKeyboardObserver.js delete mode 100644 Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutSchema.js rename Libraries/Components/RefreshControl/{RCTRefreshControlNativeComponent.js => PullToRefreshViewNativeComponent.js} (59%) delete mode 100644 Libraries/Components/RefreshControl/PullToRefreshViewSchema.js delete mode 100644 Libraries/Components/Slider/RCTSliderNativeComponent.js create mode 100644 Libraries/Components/Slider/SliderNativeComponent.js delete mode 100644 Libraries/Components/Slider/SliderSchema.js create mode 100644 Libraries/Components/Sound/NativeSoundManager.js create mode 100644 Libraries/Components/Sound/SoundManager.js create mode 100644 Libraries/Components/StatusBar/NativeStatusBarManager.js create mode 100644 Libraries/Components/Switch/AndroidSwitchNativeComponent.js delete mode 100644 Libraries/Components/Switch/SwitchSchema.js create mode 100644 Libraries/Components/TimePickerAndroid/NativeTimePickerAndroid.js delete mode 100644 Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js rename Libraries/Components/TimePickerAndroid/{TimePickerAndroid.android.js => TimePickerAndroid.js} (82%) delete mode 100644 Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js create mode 100644 Libraries/Components/ToastAndroid/NativeToastAndroid.js delete mode 100644 Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js delete mode 100644 Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js delete mode 100644 Libraries/Components/Touchable/ensureComponentIsNative.js delete mode 100644 Libraries/Components/UnimplementedViews/UnimplementedNativeView.js create mode 100644 Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js delete mode 100644 Libraries/Components/UnimplementedViews/UnimplementedNativeViewSchema.js create mode 100644 Libraries/Components/View/ReactNativeViewViewConfigAndroid.js create mode 100644 Libraries/Components/View/ReactNativeViewViewConfigMacOS.js delete mode 100644 Libraries/Components/ViewPager/AndroidViewPagerNativeComponent.js delete mode 100644 Libraries/Components/ViewPager/ViewPagerAndroid.android.js delete mode 100644 Libraries/Components/WKWebView/WKWebView.ios.js delete mode 100644 Libraries/Core/Devtools/setupDevtools.js create mode 100644 Libraries/Core/NativeExceptionsManager.js create mode 100644 Libraries/Core/ReactFiberErrorDialog.js create mode 100644 Libraries/Core/Timers/NativeTiming.js create mode 100644 Libraries/Core/__tests__/ExceptionsManager-test.js delete mode 100644 Libraries/Core/__tests__/MapAndSetPolyfills-test.js delete mode 100644 Libraries/Core/polyfillES6Collections.js create mode 100644 Libraries/Core/setUpReactRefresh.js create mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js rename Libraries/{Text/TextStylePropTypes.js => DeprecatedPropTypes/DeprecatedTextStylePropTypes.js} (57%) create mode 100644 Libraries/FBLazyVector/BUCK rename Libraries/{fishhook/React-fishhook.podspec => FBLazyVector/FBLazyVector.podspec} (77%) create mode 100644 Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h create mode 100644 Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h create mode 100644 Libraries/FBReactNativeSpec/BUCK rename ReactCommon/turbomodule/core/React-turbomodule-core.podspec => Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec (60%) create mode 100644 Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm create mode 100644 Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h rename Libraries/{Utilities => HeapCapture}/HeapCapture.js (80%) create mode 100644 Libraries/HeapCapture/NativeHeapCapture.js delete mode 100644 Libraries/Image/ImageEditor.js create mode 100644 Libraries/Image/ImagePickerIOS.js delete mode 100644 Libraries/Image/ImageStore.js create mode 100644 Libraries/Image/NativeImageLoader.js create mode 100644 Libraries/Image/NativeImagePickerIOS.js create mode 100644 Libraries/Image/RCTAnimatedImage.h create mode 100644 Libraries/Image/RCTAnimatedImage.m delete mode 100644 Libraries/Image/RCTImage.xcodeproj/project.pbxproj create mode 100644 Libraries/Image/RCTImageDataDecoder.h delete mode 100644 Libraries/Image/RCTImageEditingManager.m delete mode 100644 Libraries/Image/RCTImageLoader.h create mode 100644 Libraries/Image/RCTImageLoaderProtocol.h create mode 100644 Libraries/Image/RCTImageURLLoader.h create mode 100644 Libraries/Image/RCTUIImageViewAnimated.h create mode 100644 Libraries/Image/RCTUIImageViewAnimated.m create mode 100644 Libraries/Interaction/NativeFrameRateLogger.js delete mode 100644 Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj delete mode 100644 Libraries/Modal/ModalSchema.js create mode 100644 Libraries/Modal/NativeModalManager.js delete mode 100644 Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj create mode 100644 Libraries/NativeModules/specs/NativeAnimationsDebugModule.js create mode 100644 Libraries/NativeModules/specs/NativeDevSettings.js create mode 100644 Libraries/NativeModules/specs/NativeDeviceEventManager.js create mode 100644 Libraries/NativeModules/specs/NativeDialogManagerAndroid.js create mode 100644 Libraries/NativeModules/specs/NativeRedBox.js create mode 100644 Libraries/NativeModules/specs/NativeSourceCode.js create mode 100644 Libraries/Network/NativeNetworkingAndroid.js create mode 100644 Libraries/Network/NativeNetworkingIOS.js delete mode 100644 Libraries/Network/RCTNetwork.xcodeproj/project.pbxproj create mode 100644 Libraries/Performance/NativeJSCSamplingProfiler.js create mode 100644 Libraries/PermissionsAndroid/NativePermissionsAndroid.js create mode 100644 Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js delete mode 100644 Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj create mode 100644 Libraries/RCTRequired/BUCK rename React/React-DevSupport.podspec => Libraries/RCTRequired/RCTRequired.podspec (74%) create mode 100644 Libraries/RCTRequired/RCTRequired/RCTRequired.h create mode 100644 Libraries/ReactNative/DummyUIManager.js rename Libraries/{CameraRoll/__mocks__/CameraRoll.js => ReactNative/HeadlessJsTaskError.js} (79%) create mode 100644 Libraries/ReactNative/NativeHeadlessJsTaskSupport.js create mode 100644 Libraries/ReactNative/NativeI18nManager.js create mode 100644 Libraries/ReactNative/NativeUIManager.js create mode 100644 Libraries/ReactNative/PaperUIManager.js create mode 100644 Libraries/ReactNative/RootTagContext.js rename {lib => Libraries/ReactPrivate}/README (53%) rename Libraries/{react-native/React.js => ReactPrivate/ReactNativePrivateInitializeCore.js} (78%) create mode 100644 Libraries/ReactPrivate/ReactNativePrivateInterface.js create mode 100644 Libraries/Renderer/implementations/ReactFabric-dev.fb.js rename Libraries/Renderer/{oss => implementations}/ReactFabric-dev.js (75%) create mode 100644 Libraries/Renderer/implementations/ReactFabric-prod.fb.js rename Libraries/Renderer/{oss => implementations}/ReactFabric-prod.js (74%) create mode 100644 Libraries/Renderer/implementations/ReactFabric-profiling.fb.js rename Libraries/Renderer/{oss => implementations}/ReactFabric-profiling.js (74%) create mode 100644 Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js rename Libraries/Renderer/{oss => implementations}/ReactNativeRenderer-dev.js (78%) create mode 100644 Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js rename Libraries/Renderer/{oss => implementations}/ReactNativeRenderer-prod.js (74%) create mode 100644 Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js rename Libraries/Renderer/{oss => implementations}/ReactNativeRenderer-profiling.js (75%) delete mode 100644 Libraries/Sample/Sample.xcodeproj/project.pbxproj create mode 100644 Libraries/Settings/NativeSettingsManager.js delete mode 100644 Libraries/Settings/RCTSettings.xcodeproj/project.pbxproj create mode 100644 Libraries/Share/NativeShareModule.js create mode 100644 Libraries/Storage/NativeAsyncStorage.js create mode 100644 Libraries/StyleSheet/processColorArray.js delete mode 100644 Libraries/Text/RCTText.xcodeproj/project.pbxproj delete mode 100644 Libraries/Text/TextPropTypes.js create mode 100644 Libraries/TypeSafety/RCTConvertHelpers.h create mode 100644 Libraries/TypeSafety/RCTConvertHelpers.mm rename ReactCommon/jscallinvoker/React-jscallinvoker.podspec => Libraries/TypeSafety/RCTTypeSafety.podspec (66%) create mode 100644 Libraries/TypeSafety/RCTTypedModuleConstants.h create mode 100644 Libraries/TypeSafety/RCTTypedModuleConstants.mm create mode 100644 Libraries/Types/CodegenTypes.js create mode 100644 Libraries/Utilities/HMRClientProdShim.js delete mode 100644 Libraries/Utilities/HMRLoadingView.android.js delete mode 100644 Libraries/Utilities/HMRLoadingView.js create mode 100644 Libraries/Utilities/LoadingView.android.js create mode 100644 Libraries/Utilities/LoadingView.ios.js rename RNTester/js/ToolbarAndroidExample.ios.js => Libraries/Utilities/LoadingView.js (71%) create mode 100644 Libraries/Utilities/LoadingView.macos.js create mode 100644 Libraries/Utilities/NativeDevLoadingView.js create mode 100644 Libraries/Utilities/NativeDeviceInfo.js create mode 100644 Libraries/Utilities/NativeJSDevSupport.js create mode 100644 Libraries/Utilities/NativePlatformConstantsAndroid.js create mode 100644 Libraries/Utilities/NativePlatformConstantsIOS.js create mode 100644 Libraries/Utilities/NativePlatformConstantsMacOS.js create mode 100644 Libraries/Utilities/__tests__/codegenNativeComponent-test.js create mode 100644 Libraries/Utilities/codegenNativeCommands.js create mode 100644 Libraries/Utilities/codegenNativeComponent.js create mode 100644 Libraries/Utilities/registerGeneratedViewConfig.js create mode 100644 Libraries/Utilities/useWindowDimensions.js create mode 100644 Libraries/Vibration/NativeVibration.js delete mode 100644 Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj create mode 100644 Libraries/WebSocket/NativeWebSocketModule.js delete mode 100644 Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj delete mode 100644 Libraries/WebSocket/React-RCTWebSocket.podspec delete mode 100755 Libraries/fishhook/LICENSE delete mode 100755 Libraries/fishhook/README.md delete mode 100755 Libraries/fishhook/fishhook.c delete mode 100755 Libraries/fishhook/fishhook.h delete mode 100644 Libraries/vendor/core/Map.js delete mode 100644 Libraries/vendor/core/Set.js delete mode 100644 Libraries/vendor/core/_shouldPolyfillES6Collection.js delete mode 100644 RNTester/.gitignore create mode 100644 RNTester/Gemfile delete mode 100644 RNTester/RCTTest/RCTTest.xcodeproj/project.pbxproj delete mode 100644 RNTester/RNTester.xcodeproj/project.pbxproj create mode 100644 RNTester/RNTester/RNTester.entitlements delete mode 100644 RNTester/RNTesterBundle-macOS/Info.plist create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testARTExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testLayoutExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testScrollViewExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSliderExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSwitchExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testTextExample_1_macOS.png create mode 100644 RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testViewExample_1_macOS.png rename RNTester/{RNTester.xcodeproj/xcshareddata/xcschemes/RNTester-tvOS.xcscheme => RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme} (51%) rename RNTester/{RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme => RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterUnitTests.xcscheme} (57%) create mode 100644 RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosDeviceBuild.xcscheme create mode 100644 RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosSimulatorBuild.xcscheme create mode 100644 RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/macOSBuild.xcscheme create mode 100644 RNTester/RNTesterUnitTests/RCTUtilsTests.m delete mode 100644 RNTester/e2e/__tests__/Button-test.js~HEAD delete mode 100644 RNTester/js/AssetScaledImageExample.js delete mode 100644 RNTester/js/CameraRollExample.js delete mode 100644 RNTester/js/CameraRollView.js delete mode 100644 RNTester/js/ImageEditingExample.js delete mode 100644 RNTester/js/RNTesterList.android.js delete mode 100644 RNTester/js/ToolbarAndroidExample.android.js delete mode 100644 RNTester/js/ViewPagerAndroidExample.android.js delete mode 100644 RNTester/js/XHRExampleFormData.js rename RNTester/js/{Thumbnails => assets}/bandaged.png (100%) rename RNTester/js/{ => assets}/bunny.png (100%) rename RNTester/js/{Thumbnails => assets}/call.png (100%) rename RNTester/js/{Thumbnails => assets}/dislike.png (100%) rename RNTester/js/{Thumbnails => assets}/fist.png (100%) rename RNTester/js/{Thumbnails => assets}/flowers.png (100%) rename RNTester/js/{ => assets}/flux@3x.png (100%) rename RNTester/js/{ => assets}/hawk.png (100%) rename RNTester/js/{Thumbnails => assets}/heart.png (100%) rename RNTester/js/{ => assets}/helloworld.html (100%) rename RNTester/js/{ => assets}/imageMask.png (100%) rename RNTester/js/{Thumbnails => assets}/like.png (100%) rename RNTester/js/{Thumbnails => assets}/liking.png (100%) rename RNTester/js/{ => assets}/messagingtest.html (100%) rename RNTester/js/{Thumbnails => assets}/party.png (100%) rename RNTester/js/{Thumbnails => assets}/poke.png (100%) rename RNTester/js/{ => assets}/relay@3x.png (100%) rename RNTester/js/{ => assets}/slider-left.png (100%) rename RNTester/js/{ => assets}/slider-left@2x.png (100%) rename RNTester/js/{ => assets}/slider-right.png (100%) rename RNTester/js/{ => assets}/slider-right@2x.png (100%) rename RNTester/js/{ => assets}/slider.png (100%) rename RNTester/js/{ => assets}/slider@2x.png (100%) rename RNTester/js/{Thumbnails => assets}/superlike.png (100%) rename RNTester/js/{AnimatedGratuitousApp => assets}/trees.jpg (100%) rename RNTester/js/{ => assets}/tumblr_mfqekpMktw1rn90umo1_500.gif (100%) rename RNTester/js/{ => assets}/uie_comment_highlighted@2x.png (100%) rename RNTester/js/{ => assets}/uie_comment_normal@2x.png (100%) rename RNTester/js/{ => assets}/uie_thumb_big.png (100%) rename RNTester/js/{ => assets}/uie_thumb_normal@2x.png (100%) rename RNTester/js/{ => assets}/uie_thumb_selected@2x.png (100%) rename RNTester/js/{Thumbnails => assets}/victory.png (100%) rename RNTester/js/{ => components}/ListExampleShared.js (86%) rename RNTester/js/{ => components}/RNTesterBlock.js (95%) rename RNTester/js/{ => components}/RNTesterButton.js (90%) rename RNTester/js/{ => components}/RNTesterExampleContainer.js (74%) rename RNTester/js/{ => components}/RNTesterExampleFilter.js (96%) rename RNTester/js/{ => components}/RNTesterExampleList.js (91%) rename RNTester/js/{ => components}/RNTesterPage.js (94%) rename RNTester/js/{ => components}/RNTesterSettingSwitchRow.js (89%) rename RNTester/js/{ => components}/RNTesterTitle.js (97%) rename RNTester/js/{Shared => components}/TextInlineView.js (93%) rename RNTester/js/{Shared => components}/TextLegend.js (97%) rename RNTester/js/{ => components}/createExamplePage.js (91%) rename RNTester/js/{ => examples/ART}/ARTExample.js (100%) rename RNTester/js/{ => examples/Accessibility}/AccessibilityAndroidExample.android.js (97%) rename RNTester/js/{ => examples/Accessibility}/AccessibilityExample.js (87%) rename RNTester/js/{ => examples/Accessibility}/AccessibilityIOSExample.js (96%) rename RNTester/js/{ => examples/ActionSheetIOS}/ActionSheetIOSExample.js (100%) rename RNTester/js/{ => examples/ActivityIndicator}/ActivityIndicatorExample.js (88%) rename RNTester/js/{ => examples/Alert}/AlertExample.js (98%) rename RNTester/js/{ => examples/Alert}/AlertIOSExample.js (98%) rename RNTester/js/{ => examples/Animated}/AnimatedExample.js (75%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExApp.js (94%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExBobble.js (89%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExChained.js (86%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExScroll.js (99%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExSet.js (96%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExSlides.md (100%) rename RNTester/js/{ => examples/Animated}/AnimatedGratuitousApp/AnExTilt.js (85%) rename RNTester/js/{ => examples/AppState}/AppStateExample.js (98%) rename RNTester/js/{ => examples/AsyncStorage}/AsyncStorageExample.js (100%) rename RNTester/js/{ => examples/Border}/BorderExample.js (97%) rename RNTester/js/{ => examples/BoxShadow}/BoxShadowExample.js (97%) rename RNTester/js/{ => examples/Button}/ButtonExample.js (84%) rename RNTester/js/{ => examples/CheckBox}/CheckBoxExample.js (100%) rename RNTester/js/{ => examples/Clipboard}/ClipboardExample.js (98%) rename RNTester/js/{ => examples/Crash}/CrashExample.js (92%) rename RNTester/js/{ => examples/DarkModeExample}/DarkModeExample.js (98%) rename RNTester/js/{ => examples/DatePicker}/DatePickerAndroidExample.js (95%) rename RNTester/js/{ => examples/DatePicker}/DatePickerIOSExample.js (95%) rename RNTester/js/{ => examples/DatePicker}/DatePickerMacOSExample.js (100%) rename RNTester/js/{ => examples/Dimensions}/DimensionsExample.js (66%) rename RNTester/js/{ => examples/FlatList}/FlatListExample.js (79%) rename RNTester/js/{ => examples/FocusEventsExample}/FocusEventsExample.js (99%) rename RNTester/js/{ => examples/Image}/ImageCapInsetsExample.js (81%) rename RNTester/js/{ => examples/Image}/ImageExample.js (88%) rename RNTester/js/{ => examples/InputAccessoryView}/InputAccessoryViewExample.js (100%) create mode 100644 RNTester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js rename RNTester/js/{ => examples/KeyboardAvoidingView}/KeyboardAvoidingViewExample.js (95%) rename RNTester/js/{ => examples/Layout}/LayoutAnimationExample.js (100%) rename RNTester/js/{ => examples/Layout}/LayoutEventsExample.js (93%) rename RNTester/js/{ => examples/Layout}/LayoutExample.js (97%) rename RNTester/js/{ => examples/Linking}/LinkingExample.js (93%) rename RNTester/js/{ => examples/MaskedView}/MaskedViewExample.js (97%) rename RNTester/js/{ => examples/Modal}/ModalExample.js (99%) rename RNTester/js/{ => examples/MultiColumn}/MultiColumnExample.js (90%) rename RNTester/js/{ => examples/NativeAnimation}/NativeAnimationsExample.js (92%) rename RNTester/js/{ => examples/NewAppScreen}/NewAppScreenExample.js (97%) rename RNTester/js/{ => examples/OrientationChange}/OrientationChangeExample.js (91%) rename RNTester/js/{ => examples/PanResponder}/PanResponderExample.js (93%) rename RNTester/js/{PermissionsExampleAndroid.android.js => examples/PermissionsAndroid/PermissionsExample.js} (98%) rename RNTester/js/{ => examples/Picker}/PickerExample.js (91%) rename RNTester/js/{ => examples/Picker}/PickerIOSExample.js (96%) rename RNTester/js/{ => examples/PointerEvents}/PointerEventsExample.js (96%) rename RNTester/js/{ => examples/ProgressBarAndroid}/ProgressBarAndroidExample.android.js (91%) rename RNTester/js/{ => examples/ProgressViewIOS}/ProgressViewIOSExample.js (98%) rename RNTester/js/{ => examples/PushNotificationIOS}/PushNotificationIOSExample.js (100%) rename RNTester/js/{ => examples/RCTRootView}/RCTRootViewIOSExample.js (100%) rename RNTester/js/{ => examples/RTL}/RTLExample.js (95%) rename RNTester/js/{ => examples/RefreshControl}/RefreshControlExample.js (100%) rename RNTester/js/{ => examples/RootViewSizeFlexibilityExample}/RootViewSizeFlexibilityExampleApp.js (98%) rename RNTester/js/{ => examples/SafeAreaView}/SafeAreaViewExample.js (91%) create mode 100644 RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js rename RNTester/js/{ => examples/ScrollView}/ScrollViewExample.js (98%) rename RNTester/js/{ => examples/ScrollView}/ScrollViewSimpleExample.js (94%) rename RNTester/js/{ => examples/SectionList}/SectionListExample.js (93%) rename RNTester/js/{ => examples/SegmentedControlIOS}/SegmentedControlIOSExample.js (99%) rename RNTester/js/{ => examples/SetPropertiesExample}/SetPropertiesExampleApp.js (96%) rename RNTester/js/{ => examples/Share}/ShareExample.js (99%) rename RNTester/js/{ => examples/Slider}/SliderExample.js (85%) rename RNTester/js/{ => examples/Snapshot}/SnapshotExample.js (100%) rename RNTester/js/{ => examples/Snapshot}/SnapshotViewIOS.android.js (68%) rename RNTester/js/{ => examples/Snapshot}/SnapshotViewIOS.ios.js (81%) rename RNTester/js/{ => examples/StatusBar}/StatusBarExample.js (98%) rename RNTester/js/{ => examples/Switch}/SwitchExample.js (100%) rename RNTester/js/{ => examples/TVEventHandler}/TVEventHandlerExample.js (98%) rename RNTester/js/{ => examples/Text}/TextExample.android.js (98%) rename RNTester/js/{ => examples/Text}/TextExample.ios.js (94%) rename RNTester/js/{ => examples/TextInput}/TextInputExample.android.js (100%) rename RNTester/js/{ => examples/TextInput}/TextInputExample.ios.js (96%) rename RNTester/js/{ => examples/TimePicker}/TimePickerAndroidExample.js (94%) rename RNTester/js/{ => examples/Timer}/TimerExample.js (94%) rename RNTester/js/{ => examples/ToastAndroid}/ToastAndroidExample.android.js (96%) rename RNTester/js/{ => examples/Touchable}/TouchableExample.js (94%) rename RNTester/js/{ => examples/Transform}/TransformExample.js (96%) rename RNTester/js/{ => examples/TransparentHitTest}/TransparentHitTestExample.js (100%) rename RNTester/js/{ => examples/TurboModule}/SampleTurboModuleExample.js (97%) rename RNTester/js/{ => examples/TurboModule}/TurboModuleExample.js (100%) rename RNTester/js/{ => examples/Vibration}/VibrationExample.js (95%) rename RNTester/js/{ => examples/View}/ViewExample.js (96%) rename RNTester/js/{ => examples/WebSocket}/WebSocketExample.js (98%) rename RNTester/js/{ => examples/WebSocket}/http_test_server.js (100%) rename RNTester/js/{ => examples/WebSocket}/websocket_test_server.js (100%) rename RNTester/js/{ => examples/XHR}/XHRExample.js (76%) rename RNTester/js/{ => examples/XHR}/XHRExampleAbortController.js (98%) rename RNTester/js/{ => examples/XHR}/XHRExampleBinaryUpload.js (96%) rename RNTester/js/{ => examples/XHR}/XHRExampleDownload.js (99%) rename RNTester/js/{ => examples/XHR}/XHRExampleFetch.js (99%) rename RNTester/js/{ => examples/XHR}/XHRExampleHeaders.js (100%) rename RNTester/js/{ => examples/XHR}/XHRExampleOnTimeOut.js (98%) rename RNTester/js/{Shared => types}/RNTesterTypes.js (90%) rename RNTester/js/{ => utils}/RNTesterActions.js (100%) create mode 100644 RNTester/js/utils/RNTesterList.android.js rename RNTester/js/{ => utils}/RNTesterList.ios.js (50%) rename RNTester/js/{ => utils}/RNTesterList.macos.js (51%) rename RNTester/js/{ => utils}/RNTesterNavigationReducer.js (93%) rename RNTester/js/{ => utils}/RNTesterStatePersister.js (100%) rename RNTester/js/{ => utils}/URIActionMap.js (93%) create mode 100644 React-Core.podspec delete mode 100644 React/Base/RCTPlatform.m create mode 100644 React/Base/RCTWeakProxy.h create mode 100644 React/Base/RCTWeakProxy.m create mode 100644 React/CoreModules/BUCK create mode 100644 React/CoreModules/CoreModulesPlugins.h create mode 100644 React/CoreModules/CoreModulesPlugins.mm rename React/{Modules => CoreModules}/RCTExceptionsManager.h (88%) rename React/{Modules/RCTExceptionsManager.m => CoreModules/RCTExceptionsManager.mm} (63%) rename {Libraries/Image => React/CoreModules}/RCTImageEditingManager.h (100%) create mode 100644 React/CoreModules/RCTImageEditingManager.m create mode 100644 React/CoreModules/RCTImageLoader.h rename Libraries/Image/RCTImageLoader.m => React/CoreModules/RCTImageLoader.mm (91%) rename {Libraries/Image => React/CoreModules}/RCTImageStoreManager.h (100%) rename {Libraries/Image => React/CoreModules}/RCTImageStoreManager.m (99%) rename React/{Base => CoreModules}/RCTPlatform.h (100%) create mode 100644 React/CoreModules/RCTPlatform.mm rename ReactCommon/turbomodule/samples/React-turbomodule-samples.podspec => React/CoreModules/React-CoreModules.podspec (55%) create mode 100644 React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h create mode 100644 React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm create mode 100644 React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h create mode 100644 React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm rename React/Fabric/Mounting/ComponentViews/ScrollView/{RNPullToRefreshViewComponentView.h => RCTPullToRefreshViewComponentView.h} (88%) rename React/Fabric/Mounting/ComponentViews/ScrollView/{RNPullToRefreshViewComponentView.mm => RCTPullToRefreshViewComponentView.mm} (85%) rename React/Fabric/Utils/{RNGenericDelegateSplitter.h => RCTGenericDelegateSplitter.h} (96%) rename React/Fabric/Utils/{RNGenericDelegateSplitter.mm => RCTGenericDelegateSplitter.mm} (84%) delete mode 100644 React/React-Core.podspec delete mode 100644 React/React.xcodeproj/project.pbxproj delete mode 100644 React/Views/RCTWKWebViewManager.h~HEAD create mode 100644 ReactAndroid/src/debug/java/com/facebook/flipper/ReactNativeFlipper.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/Android.mk create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/BUCK create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/HermesMemoryDumper.h create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/HermesMemoryDumper.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/HermesSamplingProfiler.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/HermesSamplingProfiler.h create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/HermesSamplingProfiler.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/OnLoad.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/Android.mk create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/BUCK create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.h create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java rename ReactCommon/yoga/yoga/YGMarker.cpp => ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.cpp (50%) rename ReactAndroid/src/main/java/com/facebook/{yoga/YogaEventListener.java => hermes/reactexecutor/JSITracing.h} (57%) create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/fbjni.pro create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/unicode/AndroidUnicodeUtils.java create mode 100644 ReactAndroid/src/main/java/com/facebook/hermes/unicode/BUCK create mode 100644 ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleType.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/bridge/JsonWriter.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/bridge/WindowFocusChangeListener.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCSamplingProfiler.java rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/Binding.java (59%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/ComponentFactoryDelegate.java (67%) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/FabricSoLoader.java (96%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/StateWrapperImpl.java (84%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => events}/EventBeatManager.java (91%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => events}/EventEmitterWrapper.java (94%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{ => events}/FabricEventEmitter.java (97%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/AsyncEventBeat.h (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/BUCK (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/Binding.cpp (51%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/Binding.h (58%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/ComponentFactoryDelegate.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/ComponentFactoryDelegate.h (93%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/EventBeatManager.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/EventBeatManager.h (92%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/EventEmitterWrapper.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/EventEmitterWrapper.h (92%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/NodeStateWrapper.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/NodeStateWrapper.h (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/OnLoad.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/ReactNativeConfigHolder.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/ReactNativeConfigHolder.h (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/StateWrapperImpl.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/fabric/{jsi => }/jni/StateWrapperImpl.h (93%) delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/ComponentRegistry.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/ContextBasedViewPool.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/ViewFactory.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/ViewManagerFactory.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/ViewPool.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchStringCommandMountItem.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskRetryPolicy.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/jstasks/LinearCountingRetryPolicy.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BUCK create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.h create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/OnLoad.cpp delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/netinfo/NetInfoModule.java rename ReactAndroid/src/main/java/com/facebook/react/modules/{netinfo => sound}/BUCK (61%) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/ReactPackageTurboModuleManagerDelegate.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModuleRegistry.java rename ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/{jsireact => ReactCommon}/JSCallInvokerHolder.cpp (100%) rename ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/{jsireact => ReactCommon}/JSCallInvokerHolder.h (95%) rename ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/{jsireact => ReactCommon}/OnLoad.cpp (100%) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp rename ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/{jsireact => ReactCommon}/TurboModuleManager.h (61%) rename ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/{jsireact => ReactCommon}/TurboModuleManagerDelegate.h (81%) delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/jsireact/TurboModuleManager.cpp create mode 100644 ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerDelegate.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerDelegate.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/util/ExceptionDataHelper.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java create mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/toolbar/BUCK delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/toolbar/DrawableWithIntrinsicSize.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbar.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbarManager.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/toolbar/events/ToolbarClickEvent.java create mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/LayoutPassReason.java create mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/YogaLayoutType.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNI.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBatching.java create mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.java create mode 100644 ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIPhantomRefs.java create mode 100644 ReactAndroid/src/main/jni/first-party/fb/include/fbjni/fbjni.h create mode 100644 ReactAndroid/src/main/jni/first-party/hermes/Android.mk delete mode 100644 ReactAndroid/src/test/java/com/facebook/react/bridge/JsonWriterTest.java create mode 100644 ReactCommon/ReactCommon.podspec create mode 100644 ReactCommon/cxxreact/re_worker_requirements delete mode 100644 ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp delete mode 100644 ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h create mode 100644 ReactCommon/fabric/components/text/paragraph/ParagraphState.cpp create mode 100644 ReactCommon/fabric/components/text/paragraph/ParagraphState.h create mode 100644 ReactCommon/fabric/components/view/Touch.cpp create mode 100644 ReactCommon/fabric/components/view/Touch.h create mode 100644 ReactCommon/fabric/components/view/TouchEvent.cpp create mode 100644 ReactCommon/fabric/components/view/TouchEvent.h delete mode 100644 ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.cpp delete mode 100644 ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.h create mode 100644 ReactCommon/fabric/core/primitives/RawPropsKey.cpp create mode 100644 ReactCommon/fabric/core/primitives/RawPropsKey.h create mode 100644 ReactCommon/fabric/core/primitives/RawPropsKeyMap.cpp create mode 100644 ReactCommon/fabric/core/primitives/RawPropsKeyMap.h create mode 100644 ReactCommon/fabric/core/primitives/RawPropsParser.cpp create mode 100644 ReactCommon/fabric/core/primitives/RawPropsParser.h create mode 100644 ReactCommon/fabric/core/primitives/RawPropsPrimitives.h delete mode 100644 ReactCommon/fabric/core/state/StateData.cpp create mode 100644 ReactCommon/fabric/core/tests/benchmarks/RawPropsBenchmark.cpp rename ReactCommon/fabric/graphics/platform/{android => cxx}/Color.cpp (100%) rename ReactCommon/fabric/graphics/platform/{android => cxx}/Color.h (100%) rename ReactCommon/fabric/graphics/platform/{android => cxx}/Float.h (100%) rename ReactCommon/fabric/imagemanager/platform/{android => cxx}/ImageManager.cpp (100%) rename ReactCommon/fabric/imagemanager/platform/{android => cxx}/ImageRequest.cpp (100%) create mode 100644 ReactCommon/fabric/mapbuffer/BUCK create mode 100644 ReactCommon/fabric/mapbuffer/MapBuffer.cpp create mode 100644 ReactCommon/fabric/mapbuffer/MapBuffer.h rename Libraries/Components/ViewPager/ViewPagerAndroid.ios.js => ReactCommon/fabric/mapbuffer/tests/MapBufferTest.cpp (66%) create mode 100644 ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.cpp create mode 100644 ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.h create mode 100644 ReactCommon/fabric/uimanager/SchedulerToolbox.cpp create mode 100644 ReactCommon/fabric/uimanager/SchedulerToolbox.h create mode 100644 ReactCommon/hermes/inspector/.clang-format create mode 100644 ReactCommon/hermes/inspector/Android.mk create mode 100644 ReactCommon/hermes/inspector/AsyncPauseState.h create mode 100644 ReactCommon/hermes/inspector/DEFS.bzl create mode 100644 ReactCommon/hermes/inspector/Exceptions.h create mode 100644 ReactCommon/hermes/inspector/Inspector.cpp create mode 100644 ReactCommon/hermes/inspector/Inspector.h create mode 100644 ReactCommon/hermes/inspector/InspectorState.cpp create mode 100644 ReactCommon/hermes/inspector/InspectorState.h create mode 100644 ReactCommon/hermes/inspector/README.md create mode 100644 ReactCommon/hermes/inspector/RuntimeAdapter.cpp create mode 100644 ReactCommon/hermes/inspector/RuntimeAdapter.h create mode 100644 ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/AutoAttachUtils.h create mode 100644 ReactCommon/hermes/inspector/chrome/Connection.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/Connection.h create mode 100644 ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/ConnectionDemux.h create mode 100644 ReactCommon/hermes/inspector/chrome/MessageConverters.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/MessageConverters.h create mode 100644 ReactCommon/hermes/inspector/chrome/MessageInterfaces.h create mode 100644 ReactCommon/hermes/inspector/chrome/MessageTypes.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/MessageTypes.h create mode 100644 ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h create mode 100644 ReactCommon/hermes/inspector/chrome/Registration.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/Registration.h create mode 100644 ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.h create mode 100644 ReactCommon/hermes/inspector/chrome/cli/main.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.h create mode 100644 ReactCommon/hermes/inspector/chrome/tests/ConnectionDemuxTests.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/RemoteObjectsTableTest.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp create mode 100644 ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h create mode 100644 ReactCommon/hermes/inspector/detail/SerialExecutor.cpp create mode 100644 ReactCommon/hermes/inspector/detail/SerialExecutor.h create mode 100644 ReactCommon/hermes/inspector/detail/Thread.cpp create mode 100644 ReactCommon/hermes/inspector/detail/Thread.h create mode 100644 ReactCommon/hermes/inspector/detail/tests/SerialExecutorTests.cpp create mode 100755 ReactCommon/hermes/inspector/docs/GenerateInspectorFSM.sh create mode 100644 ReactCommon/hermes/inspector/docs/InspectorFSM.gv create mode 100644 ReactCommon/hermes/inspector/docs/InspectorFSM.pdf create mode 100644 ReactCommon/hermes/inspector/tests/InspectorTests.cpp create mode 100755 ReactCommon/hermes/inspector/tools/format create mode 100644 ReactCommon/hermes/inspector/tools/message_types.txt create mode 100644 ReactCommon/hermes/inspector/tools/msggen/.babelrc create mode 100644 ReactCommon/hermes/inspector/tools/msggen/.flowconfig create mode 100644 ReactCommon/hermes/inspector/tools/msggen/.gitignore create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/GraphTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/HeaderWriterTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/ImplementationWriterTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/package.json create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Command.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Converters.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Event.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/GeneratedHeader.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Graph.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/ImplementationWriter.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Property.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/TestHelpers.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/Type.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/src/index.js create mode 100644 ReactCommon/hermes/inspector/tools/msggen/yarn.lock create mode 100755 ReactCommon/hermes/inspector/tools/run_msggen create mode 100755 ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh create mode 100755 ReactCommon/hermes/inspector/tools/sandcastle/setup.sh rename ReactCommon/jscallinvoker/{jsireact => ReactCommon}/BridgeJSCallInvoker.cpp (93%) rename ReactCommon/jscallinvoker/{jsireact => ReactCommon}/BridgeJSCallInvoker.h (96%) rename ReactCommon/jscallinvoker/{jsireact => ReactCommon}/JSCallInvoker.h (100%) create mode 100644 ReactCommon/jsi/jsi/test/testlib.cpp create mode 100644 ReactCommon/jsi/jsi/test/testlib.h create mode 100644 ReactCommon/turbomodule/samples/NativeSampleTurboCxxModuleSpecJSI.cpp rename ReactCommon/turbomodule/samples/{platform/ios => }/NativeSampleTurboCxxModuleSpecJSI.h (78%) create mode 100644 ReactCommon/turbomodule/samples/SampleTurboCxxModule.cpp create mode 100644 ReactCommon/turbomodule/samples/SampleTurboCxxModule.h delete mode 100644 ReactCommon/turbomodule/samples/platform/ios/NativeSampleTurboCxxModuleSpecJSI.cpp create mode 100644 ReactCommon/utils/RuntimeExecutor.h rename ReactCommon/yoga/{yoga.podspec => Yoga.podspec} (90%) create mode 100644 ReactCommon/yoga/yoga/Bitfield.h delete mode 100644 ReactCommon/yoga/yoga/YGMarker.h delete mode 100644 ReactCommon/yoga/yoga/instrumentation.h create mode 100644 ReactCommon/yoga/yoga/internal/experiments-inl.h create mode 100644 ReactCommon/yoga/yoga/internal/experiments.cpp create mode 100644 ReactCommon/yoga/yoga/internal/experiments.h create mode 100644 android-patches/patches-0.61.5/BasicBuild/ReactAndroid/NuGet.Config create mode 100644 android-patches/patches-0.61.5/BasicBuild/ReactAndroid/ReactAndroid.nuspec create mode 100644 android-patches/patches-0.61.5/BasicBuild/ReactAndroid/build.gradle create mode 100644 android-patches/patches-0.61.5/BasicBuild/ReactAndroid/packages.config create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/build.gradle create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/OnLoad.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/V8Executor.java create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/V8ExecutorFactory.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/V8ExecutorFactory.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/java/com/facebook/react/v8executor/V8ExecutorFactory.java create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/react/jni/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/third-party/v8/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/third-party/v8/base.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/third-party/v8base/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactAndroid/src/main/jni/third-party/v8platform/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/cxxreact/ReactMarker.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/Android.mk create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/FileUtils.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/FileUtils.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Platform.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Platform.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime_basic.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime_droid.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime_impl.h create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime_shared.cpp create mode 100644 android-patches/patches-0.61.5/V8Integration/ReactCommon/jsi/V8Runtime_win.cpp delete mode 100644 bots/IssueCommands.txt rename {scripts/circleci => bots}/code-analysis-bot.js (93%) delete mode 100644 flow/Map.js delete mode 100644 flow/Set.js delete mode 100644 jest/__tests__/hasteImpl-test.js delete mode 100644 jest/hasteImpl.js delete mode 100644 lib/InitializeJavaScriptAppEngine.js delete mode 100644 lib/RCTEventEmitter.js delete mode 100644 lib/TextInputState.js delete mode 100644 lib/UIManager.js delete mode 100644 lib/UIManagerStatTracker.js delete mode 100644 lib/View.js delete mode 100644 lib/deepDiffer.js delete mode 100644 lib/deepFreezeAndThrowOnMutationInDev.js delete mode 100644 lib/flattenStyle.js create mode 100644 packages/babel-plugin-inline-view-configs/BUCK create mode 100644 packages/babel-plugin-inline-view-configs/__test_fixtures__/failures.js create mode 100644 packages/babel-plugin-inline-view-configs/__test_fixtures__/fixtures.js create mode 100644 packages/babel-plugin-inline-view-configs/__tests__/__snapshots__/index-test.js.snap create mode 100644 packages/babel-plugin-inline-view-configs/__tests__/index-test.js create mode 100644 packages/babel-plugin-inline-view-configs/index.js create mode 100644 packages/babel-plugin-inline-view-configs/package.json create mode 100644 packages/eslint-plugin-react-native-community/README.md rename Libraries/Components/ToolbarAndroid/ToolbarAndroid.ios.js => packages/eslint-plugin-react-native-community/index.js (70%) create mode 100644 packages/eslint-plugin-react-native-community/no-haste-imports.js create mode 100644 packages/eslint-plugin-react-native-community/package.json delete mode 100644 packages/react-native-codegen/buck_tests/__tests__/__snapshots__/combine-js-to-schema-test.js.snap delete mode 100644 packages/react-native-codegen/buck_tests/__tests__/combine-js-to-schema-test.js delete mode 100644 packages/react-native-codegen/buck_tests/combine-js-to-schema.js delete mode 100644 packages/react-native-codegen/buck_tests/copy-fixture.js create mode 100644 packages/react-native-codegen/buck_tests/emptyFile.mm rename packages/react-native-codegen/buck_tests/{generate_tests.sh => generate-tests.sh} (100%) delete mode 100644 packages/react-native-codegen/buck_tests/generate-view-configs-cli.js delete mode 100644 packages/react-native-codegen/buck_tests/generate-view-configs.js delete mode 100755 packages/react-native-codegen/buck_tests/generate-view-configs.sh create mode 100644 packages/react-native-codegen/buck_tests/java/ArrayPropsNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/BooleanPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/ColorPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/EnumPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/EventNestedObjectPropsNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/EventPropsNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/FloatPropsNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/ImagePropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/IntegerPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/InterfaceOnlyNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/MultiNativePropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/NoPropsNoEventsNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/PointPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/buck_tests/java/StringPropNativeComponentViewManager.java create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js create mode 100644 packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js rename packages/react-native-codegen/{buck_tests => src/cli/combine}/combine-js-to-schema-cli.js (100%) create mode 100644 packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js rename packages/react-native-codegen/{buck_tests => src/cli/combine}/combine_js_to_schema.sh (63%) create mode 100644 packages/react-native-codegen/src/cli/parser/parser-cli.js create mode 100644 packages/react-native-codegen/src/cli/parser/parser.js rename packages/react-native-codegen/{buck_tests/copy_fixture.sh => src/cli/parser/parser.sh} (61%) delete mode 100644 packages/react-native-codegen/src/generators/EventEmitterHelpers.js delete mode 100644 packages/react-native-codegen/src/generators/GeneratePropsH.js delete mode 100644 packages/react-native-codegen/src/generators/GenerateViewConfigJs.js delete mode 100644 packages/react-native-codegen/src/generators/__tests__/GenerateComponentDescriptorH-test.js delete mode 100644 packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap rename packages/react-native-codegen/src/generators/{ => components}/CppHelpers.js (71%) rename packages/react-native-codegen/src/generators/{ => components}/GenerateComponentDescriptorH.js (91%) create mode 100644 packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js rename packages/react-native-codegen/src/generators/{ => components}/GenerateEventEmitterCpp.js (73%) rename packages/react-native-codegen/src/generators/{ => components}/GenerateEventEmitterH.js (71%) rename packages/react-native-codegen/src/generators/{ => components}/GeneratePropsCpp.js (92%) create mode 100644 packages/react-native-codegen/src/generators/components/GeneratePropsH.js create mode 100644 packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js create mode 100644 packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js rename packages/react-native-codegen/src/generators/{ => components}/GenerateShadowNodeCpp.js (91%) rename packages/react-native-codegen/src/generators/{ => components}/GenerateShadowNodeH.js (94%) rename packages/react-native-codegen/src/generators/{ => components}/GenerateTests.js (85%) create mode 100644 packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js create mode 100644 packages/react-native-codegen/src/generators/components/JavaHelpers.js rename packages/react-native-codegen/src/generators/{ => components}/__test_fixtures__/fixtures.js (57%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentDescriptorH-test.js create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentHObjCpp-test.js rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GenerateEventEmitterCpp-test.js (85%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GenerateEventEmitterH-test.js (84%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GeneratePropsCpp-test.js (84%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GeneratePropsH-test.js (84%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaInterface-test.js rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GenerateShadowNodeCpp-test.js (84%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GenerateShadowNodeH-test.js (84%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/GenerateTests-test.js (84%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/GenerateViewConfigJs-test.js rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap (55%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap (69%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap (68%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap (72%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GeneratePropsH-test.js.snap (55%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap (72%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap (74%) rename packages/react-native-codegen/src/generators/{ => components}/__tests__/__snapshots__/GenerateTests-test.js.snap (59%) create mode 100644 packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js create mode 100644 packages/react-native-codegen/src/generators/modules/GenerateModuleH.js create mode 100644 packages/react-native-codegen/src/generators/modules/GenerateModuleHObjCpp.js create mode 100644 packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js create mode 100644 packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructs.js create mode 100644 packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructsForConstants.js create mode 100644 packages/react-native-codegen/src/generators/modules/ObjCppUtils/Utils.js create mode 100644 packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js create mode 100644 packages/react-native-codegen/src/generators/modules/__test_fixtures__/structFixtures.js create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleCpp-test.js rename packages/react-native-codegen/src/generators/{__tests__/GenerateViewConfigJs-test.js => modules/__tests__/GenerateModuleH-test.js} (72%) create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/GenerateStructs-test.js create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap create mode 100644 packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateStructs-test.js.snap create mode 100644 packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap create mode 100644 packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/commands.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/events.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/extends.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/index.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/options.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/props.js create mode 100644 packages/react-native-codegen/src/parsers/flow/components/schema.js create mode 100644 packages/react-native-codegen/src/parsers/flow/index.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-test.js.snap create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-test.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/index.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/methods.js create mode 100644 packages/react-native-codegen/src/parsers/flow/modules/schema.js create mode 100644 packages/react-native-codegen/src/parsers/flow/utils.js rename packages/react-native-codegen/src/{generators/RNParser.js => parsers/schema/index.js} (88%) create mode 100755 scripts/compose-source-maps.js delete mode 100755 scripts/objc-test-ios.sh delete mode 100755 scripts/objc-test-tvos.sh create mode 100644 template/_prettierrc.js diff --git a/.ado/android-pr.yml b/.ado/android-pr.yml index 15ca618a20ec0f..a7c4b1bc37fabc 100644 --- a/.ado/android-pr.yml +++ b/.ado/android-pr.yml @@ -78,10 +78,10 @@ jobs: #verbosityPack: 'Detailed' # Options: quiet, normal, detailed #arguments: # Required when command == Custom - - task: CmdLine@2 - displayName: Setup Build Dependencies - inputs: - script: .ado\setup_droid_deps.bat +# - task: CmdLine@2 +# displayName: Setup Build Dependencies +# inputs: +# script: .ado\setup_droid_deps.bat - task: CmdLine@2 displayName: Remove RNTesterApp.android.bundle @@ -95,8 +95,8 @@ jobs: - task: Gradle@1 displayName: gradlew installArchives - env: - REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps +# env: +# REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps inputs: gradleWrapperFile: gradlew # workingDirectory: src\react-native\ diff --git a/.ado/publish.yml b/.ado/publish.yml index 57f088b307a20e..15324a87fd56cf 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -157,15 +157,15 @@ jobs: #verbosityPack: 'Detailed' # Options: quiet, normal, detailed #arguments: # Required when command == Custom - - task: CmdLine@2 - displayName: Setup Build Dependencies - inputs: - script: .ado\setup_droid_deps.bat +# - task: CmdLine@2 +# displayName: Setup Build Dependencies +# inputs: +# script: .ado\setup_droid_deps.bat - task: Gradle@1 displayName: gradlew installArchives - env: - REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps +# env: +# REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps inputs: gradleWrapperFile: gradlew # workingDirectory: src\react-native\ diff --git a/.ado/templates/apple-droid-node-patching.yml b/.ado/templates/apple-droid-node-patching.yml index 6906d373537dfc..3b56bbbb9a99fb 100644 --- a/.ado/templates/apple-droid-node-patching.yml +++ b/.ado/templates/apple-droid-node-patching.yml @@ -5,4 +5,4 @@ steps: - task: CmdLine@2 displayName: Apply Android specific patches for Office consumption inputs: - script: node $(System.DefaultWorkingDirectory)/android-patches/bundle/bundle.js patch $(System.DefaultWorkingDirectory) BuildAndThirdPartyFixes DialogModule UIEditText UIScroll UITextFont Accessibility OfficeRNHost SecurityFixes V8Integration AnnotationProcessing --patch-store $(System.DefaultWorkingDirectory)/android-patches/patches-droid-office-grouped --log-folder $(System.DefaultWorkingDirectory)/android-patches/logs --confirm ${{ parameters.apply_office_patches }} + script: node $(System.DefaultWorkingDirectory)/android-patches/bundle/bundle.js patch $(System.DefaultWorkingDirectory) BasicBuild V8Integration --patch-store $(System.DefaultWorkingDirectory)/android-patches/patches-0.61.5 --log-folder $(System.DefaultWorkingDirectory)/android-patches/logs --confirm ${{ parameters.apply_office_patches }} diff --git a/.ado/templates/apple-job-react-native.yml b/.ado/templates/apple-job-react-native.yml index da7d019b998943..32192ab8e36f71 100644 --- a/.ado/templates/apple-job-react-native.yml +++ b/.ado/templates/apple-job-react-native.yml @@ -32,6 +32,13 @@ steps: inputs: script: yarn install + - task: CmdLine@2 + displayName: pod install + inputs: + script: | + cd RNTester + pod install + - task: ShellScript@2 displayName: 'Setup packager and WebSocket test server' inputs: @@ -50,7 +57,7 @@ steps: parameters: xcode_sdk: ${{ parameters.xcode_sdk }} xcode_configuration: Debug - xcode_workspacePath: RNTester/RNTester.xcodeproj + xcode_workspacePath: RNTester/RNTesterPods.xcworkspace xcode_scheme: ${{ parameters.xcode_scheme }} xcode_actions: ${{ parameters.xcode_actions_debug }} xcode_useXcpretty: true @@ -60,7 +67,7 @@ steps: parameters: xcode_sdk: ${{ parameters.xcode_sdk }} xcode_configuration: Release - xcode_workspacePath: RNTester/RNTester.xcodeproj + xcode_workspacePath: RNTester/RNTesterPods.xcworkspace xcode_scheme: ${{ parameters.xcode_scheme }} xcode_actions: ${{ parameters.xcode_actions_release }} xcode_useXcpretty: false diff --git a/.ado/templates/prep-android-nuget.yml b/.ado/templates/prep-android-nuget.yml index c890912c4b7b14..e7aec17def62f5 100644 --- a/.ado/templates/prep-android-nuget.yml +++ b/.ado/templates/prep-android-nuget.yml @@ -14,5 +14,5 @@ steps: inputs: targetType: inline # filePath | inline script: | - (Get-Content android\com\facebook\react\react-native\0.60.0\react-native-0.60.0.pom).replace('0.60.0', '1000.0.0-master') | Set-Content android\com\facebook\react\react-native\0.60.0\react-native-0.60.0.pom + (Get-Content android\com\facebook\react\react-native\0.61.5\react-native-0.61.5.pom).replace('0.61.5', '1000.0.0-master') | Set-Content android\com\facebook\react\react-native\0.61.5\react-native-0.61.5.pom diff --git a/.appveyor/config.yml b/.appveyor/config.yml index 545f955abeeaa2..ed8162cf135899 100644 --- a/.appveyor/config.yml +++ b/.appveyor/config.yml @@ -1,13 +1,13 @@ environment: ANDROID_HOME: "C:\\android-sdk-windows" - ANDROID_NDK: "C:\\android-sdk-windows\\android-ndk-r17c" + ANDROID_NDK: "C:\\android-sdk-windows\\android-ndk-r19c" ANDROID_BUILD_VERSION: 28 ANDROID_TOOLS_VERSION: 28.0.3 GRADLE_OPTS: -Dorg.gradle.daemon=false SDK_TOOLS_URL: https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip - NDK_TOOLS_URL: https://dl.google.com/android/repository/android-ndk-r17c-windows-x86_64.zip + NDK_TOOLS_URL: https://dl.google.com/android/repository/android-ndk-r19c-windows-x86_64.zip matrix: - nodejs_version: 8 @@ -38,7 +38,7 @@ build_script: - yarn run flow-check-android - yarn run flow-check-ios - yarn run test - - gradlew.bat RNTester:android:app:assembleRelease + # - gradlew.bat RNTester:android:app:assembleRelease cache: - node_modules diff --git a/.circleci/config.yml b/.circleci/config.yml index 5205521678b026..0c9449e4c9bb44 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,143 +1,4 @@ -# ------------------------- -# ALIASES -# ------------------------- -aliases: - # ------------------------- - # ALIASES: Caches - # ------------------------- - - &restore-yarn-cache - keys: - - v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }} - - v1-yarn-cache-{{ arch }} - - - &save-yarn-cache - paths: - - ~/.cache/yarn - key: v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }} - - - &restore-brew-cache - keys: - - v1-brew - - - &save-brew-cache - paths: - - /usr/local/Homebrew - - ~/Library/Caches/Homebrew - key: v1-brew - - # Android - - &restore-buck-downloads-cache - keys: - - v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}} - - v3-buck-v2019.01.10.01- - - &save-buck-downloads-cache - paths: - - ~/buck - - ~/okbuck - key: v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }} - - - &restore-gradle-downloads-cache - keys: - - v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} - - v1-gradle- - - - &save-gradle-downloads-cache - paths: - - ~/.gradle - - ReactAndroid/build/downloads - - ReactAndroid/build/third-party-ndk - key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} - - # ------------------------- - # ALIASES: Shared Commands - # ------------------------- - - &yarn - name: Run Yarn - command: | - # Skip yarn install on metro bump commits as the package is not yet - # available on npm - if [[ $(echo "$GIT_COMMIT_DESC" | grep -c "Bump metro@") -eq 0 ]]; then - yarn install --non-interactive --cache-folder ~/.cache/yarn - fi - - - &setup-artifacts - name: Initial Setup - command: | - mkdir -p ~/react-native/reports/buck/ - mkdir -p ~/react-native/reports/build/ - mkdir -p ~/react-native/reports/junit/ - mkdir -p ~/react-native/reports/outputs/ - - # Android - - &download-dependencies-buck - name: Download Dependencies Using Buck - command: ./scripts/circleci/buck_fetch.sh - - - &download-dependencies-gradle - name: Download Dependencies Using Gradle - command: ./scripts/circleci/gradle_download_deps.sh - - # JavaScript - - &run-js-tests - name: JavaScript Test Suite - command: yarn test-ci - - # ------------------------- - # ALIASES: Disabled Tests - # ------------------------- - - &run-podspec-tests - name: Test CocoaPods - command: ./scripts/process-podspecs.sh - - &run-e2e-tests - name: End-to-End Test Suite - command: ./scripts/run-ci-e2e-tests.js --android --ios --js --retries 3; - - &run-android-e2e-tests - name: Android End-to-End Test Suite - command: node ./scripts/run-ci-e2e-tests.js --android --retries 3; - - - # ------------------------- - # ALIASES: Branch Filters - # ------------------------- - - &filter-only-master - branches: - only: master - - - &filter-only-master-stable - branches: - only: - - /.*-stable/ - - master - - - &filter-only-stable - branches: - only: - - /.*-stable/ - - - &filter-ignore-gh-pages - branches: - ignore: gh-pages - - - &filter-only-version-tags - # Both of the following conditions must be included! - # Ignore any commit on any branch by default. - branches: - ignore: /.*/ - # Only act on version tags. - tags: - only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ - - - &filter-only-forked-pull-requests - branches: - only: /^pull\/.*$/ - - # ------------------------- - # ALIASES: Workflows - # ------------------------- - - &run-after-checkout - filters: *filter-ignore-gh-pages - requires: - - checkout_code +version: 2.1 # ------------------------- # DEFAULTS @@ -147,50 +8,194 @@ defaults: &defaults environment: - GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1 -# JavaScript -js_defaults: &js_defaults - <<: *defaults - docker: - - image: node:8 - -# Android -android_defaults: &android_defaults - <<: *defaults - docker: - - image: reactnativecommunity/react-native-android:2019-5-29 - resource_class: "large" - environment: - - TERM: "dumb" - - ADB_INSTALL_TIMEOUT: 10 - - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" - - GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"' - - BUILD_THREADS: 2 - -# iOS -macos_defaults: &macos_defaults - <<: *defaults - macos: - xcode: "10.2.0" +# ------------------------- +# EXECUTORS +# ------------------------- +executors: + node8: + <<: *defaults + docker: + - image: circleci/node:8 + nodelts: + <<: *defaults + docker: + - image: circleci/node:lts + reactnativeandroid: + <<: *defaults + docker: + - image: reactnativecommunity/react-native-android:2019-6-4 + resource_class: "large" + environment: + - TERM: "dumb" + - ADB_INSTALL_TIMEOUT: 10 + - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" + - GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"' + - BUILD_THREADS: 2 + reactnativeios: + <<: *defaults + macos: + xcode: "10.2.1" + +# ------------------------- +# COMMANDS +# ------------------------- +commands: + restore_cache_checkout: + parameters: + checkout_type: + type: string + default: node + steps: + - restore_cache: + key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}-<< parameters.checkout_type >> + + setup_artifacts: + steps: + - run: + name: Initial Setup + command: mkdir -p ~/reports/{buck,build,junit,outputs} + + run_yarn: + steps: + - restore_cache: + keys: + - v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + - v4-yarn-cache-{{ arch }} + - run: + name: Run Yarn + command: | + # Skip yarn install on metro bump commits as the package is not yet + # available on npm + if [[ $(echo "$GIT_COMMIT_DESC" | grep -c "Bump metro@") -eq 0 ]]; then + yarn install --non-interactive --cache-folder ~/.cache/yarn + fi + - save_cache: + paths: + - ~/.cache/yarn + key: v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + + install_buck_tooling: + steps: + - restore_cache: + keys: + - v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}} + - v4-buck-v2019.01.10.01- + - run: + name: Install BUCK + command: | + buck --version + # Install related tooling + if [[ ! -e ~/okbuck ]]; then + git clone https://github.com/uber/okbuck.git ~/okbuck --depth=1 + fi + - save_cache: + paths: + - ~/buck + - ~/okbuck + key: v4-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }} + + brew_install: + parameters: + package: + description: Homebrew package to install + type: string + steps: + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install << parameters.package >> >/dev/null + + with_brew_cache_span: + parameters: + steps: + type: steps + steps: + - restore_cache: + keys: + - v1-brew + - steps: << parameters.steps >> + - save_cache: + paths: + - /usr/local/Homebrew + - ~/Library/Caches/Homebrew + key: v1-brew + + with_pods_cache_span: + parameters: + steps: + type: steps + steps: + - run: + name: Setup CocoaPods cache + # Copy RNTester/Podfile.lock since it can be changed by pod install + command: cp RNTester/Podfile.lock RNTester/Podfile.lock.bak + - restore_cache: + keys: + - v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }} + - v1-pods-{{ .Environment.CIRCLE_JOB }}- + - steps: << parameters.steps >> + - save_cache: + paths: + - RNTester/Pods + key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }} + + download_gradle_dependencies: + steps: + - restore_cache: + keys: + - v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + - v1-gradle- + - run: + name: Download Dependencies Using Gradle + command: ./scripts/circleci/gradle_download_deps.sh + - save_cache: + paths: + - ~/.gradle + - ReactAndroid/build/downloads + - ReactAndroid/build/third-party-ndk + key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + + download_buck_dependencies: + steps: + - run: + name: Download Dependencies Using Buck + command: ./scripts/circleci/buck_fetch.sh + + # ------------------------- + # COMMANDS: Disabled Tests + # ------------------------- + run_podspec_tests: + steps: + - run: + name: Test CocoaPods + command: ./scripts/process-podspecs.sh + run_e2e_tests: + steps: + - run: + name: Full End-to-End Test Suite + command: node ./scripts/run-ci-e2e-tests.js --android --ios --js --retries 3; + run_android_e2e_tests: + steps: + - run: + name: Android End-to-End Test Suite + command: node ./scripts/run-ci-e2e-tests.js --android --retries 3; # ------------------------- # JOBS # ------------------------- -version: 2 jobs: - # Set up a Node environment for downstream jobs - checkout_code: - <<: *js_defaults + setup: + parameters: + executor: + type: executor + default: node8 + checkout_type: + type: string + default: node + executor: << parameters.executor >> steps: - checkout - - run: *setup-artifacts - - - restore-cache: *restore-yarn-cache - - run: *yarn - - save-cache: *save-yarn-cache - - - persist_to_workspace: - root: . - paths: . + - save_cache: + key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}-<< parameters.checkout_type >> + paths: + - ~/react-native # ------------------------- # JOBS: Analyze PR @@ -199,9 +204,7 @@ jobs: # Issues will be posted to the PR itself via GitHub bots. # This workflow should only fail if the bots fail to run. analyze_pr: - <<: *defaults - docker: - - image: node:lts + executor: nodelts # The public github tokens are publicly visible by design environment: - PUBLIC_PULLBOT_GITHUB_TOKEN_A: "a6edf8e8d40ce4e8b11a" @@ -210,62 +213,42 @@ jobs: - PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: "b1a98e0bbd56ff1ccba1" steps: - - checkout - - run: *setup-artifacts - - - restore-cache: *restore-yarn-cache - - run: *yarn + - restore_cache_checkout: + checkout_type: node + - run_yarn - run: - name: Analyze Shell Scripts + name: Install dependencies command: | - echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m" - apt update && apt install -y shellcheck jq - yarn add @octokit/rest@15.18.0 - echo -e "\\x1B[36mAnalyzing shell scripts\\x1B[0m"; \ - GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" \ - GITHUB_OWNER="$CIRCLE_PROJECT_USERNAME" \ - GITHUB_REPO="$CIRCLE_PROJECT_REPONAME" \ - GITHUB_PR_NUMBER="$CIRCLE_PR_NUMBER" \ - ./scripts/circleci/analyze_scripts.sh - when: always + sudo apt update && sudo apt install -y shellcheck jq + cd bots && yarn install --non-interactive --cache-folder ~/.cache/yarn - run: - name: Analyze Code - command: | - echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m"; yarn add @octokit/rest@15.18.0 - echo -e "\\x1B[36mAnalyzing code\\x1B[0m"; \ - GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" \ - GITHUB_OWNER="$CIRCLE_PROJECT_USERNAME" \ - GITHUB_REPO="$CIRCLE_PROJECT_REPONAME" \ - GITHUB_PR_NUMBER="$CIRCLE_PR_NUMBER" \ - ./scripts/circleci/analyze_code.sh + name: Run linters against modified files (analysis-bot) + command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" yarn lint-ci when: always - run: - name: Analyze Pull Request + name: Analyze Pull Request (pull-bot) command: | - echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m" cd bots - yarn install --non-interactive --cache-folder ~/.cache/yarn - echo -e "\\x1B[36mAnalyzing pull request\\x1B[0m"; \ - DANGER_GITHUB_API_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" \ - yarn danger ci --use-github-checks + DANGER_GITHUB_API_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" yarn danger ci --use-github-checks when: always - - save-cache: *save-yarn-cache # ------------------------- # JOBS: Analyze Code # ------------------------- - analyze: - <<: *js_defaults + analyze_code: + executor: node8 steps: - - attach_workspace: - at: ~/react-native + - restore_cache_checkout: + checkout_type: node + - setup_artifacts + - run_yarn - run: name: Lint code - command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml + command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/reports/junit/eslint/results.xml when: always - run: @@ -291,173 +274,91 @@ jobs: when: always - store_test_results: - path: ~/react-native/reports/junit - - store_artifacts: - path: ~/react-native/yarn.lock + path: ~/reports/junit # ------------------------- # JOBS: Test JavaScript # ------------------------- - # Runs JavaScript tests on Node 8 - test_javascript: - <<: *js_defaults - steps: - - attach_workspace: - at: ~/react-native - - - run: - name: JavaScript Test Suite - command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2 - - - store_test_results: - path: ~/react-native/reports/junit - - # Run JavaScript tests on Node LTS - test_node_lts: - <<: *defaults - docker: - - image: node:lts + # Runs JavaScript tests + test_js: + parameters: + executor: + type: executor + default: node8 + executor: << parameters.executor >> steps: - - checkout - - run: *setup-artifacts - - - run: *yarn + - restore_cache_checkout: + checkout_type: node + - setup_artifacts + - run_yarn - run: name: JavaScript Test Suite command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2 - store_test_results: - path: ~/react-native/reports/junit - + path: ~/reports/junit # ------------------------- # JOBS: Test iOS # ------------------------- # Runs unit tests on iOS devices test_ios: - <<: *macos_defaults + executor: reactnativeios + parameters: + use_frameworks: + type: boolean + default: false environment: - REPORTS_DIR: "./reports" steps: - - attach_workspace: - at: ~/react-native + - restore_cache_checkout: + checkout_type: ios + - setup_artifacts + - run_yarn + - run: | + cd RNTester + bundle check || bundle install - run: - name: Print Xcode environment - command: xcodebuild -version - - - run: - name: List available devices - command: instruments -s devices - - - run: - name: Boot iOS Simulator + name: Boot iPhone Simulator command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true - - restore-cache: *restore-brew-cache - - run: - name: Install Watchman - command: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman >/dev/null - touch .watchmanconfig - - save-cache: *save-brew-cache - - - run: - name: Start Metro packager - command: yarn start --max-workers=1 || echo "Can't start packager automatically" - background: true - - - run: - name: Start WebSocket test server - command: open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically" - background: true - - - run: - name: Verify RNTester can be built - command: | - source ./scripts/.tests.env - xcodebuild \ - -project RNTester/RNTester.xcodeproj \ - -scheme RNTester \ - -sdk iphonesimulator \ - -destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \ - -UseModernBuildSystem=NO \ - build | \ - xcpretty --report junit --output "$REPORTS_DIR/junit/ios_buiild/results.xml" && \ - exit "${PIPESTATUS[0]}" - - - run: - name: Wait for Metro packager - command: | - max_attempts=60 - attempt_num=1 - until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do - if (( attempt_num == max_attempts )); then - echo "Packager did not respond in time. No more attempts left." - exit 1 - else - (( attempt_num++ )) - echo "Packager did not respond. Retrying for attempt number $attempt_num..." - sleep 1 - fi - done - echo "Packager is ready!" - - - run: - name: Preload the RNTesterApp bundles - command: | - curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' --output /dev/null - curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' --output /dev/null - curl --silent 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' --output /dev/null - curl --silent 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' --output /dev/null - - run: - name: Run RNTester Unit Tests + name: Fetch CocoaPods Specs command: | - source ./scripts/.tests.env - xcodebuild \ - -project RNTester/RNTester.xcodeproj \ - -scheme RNTester \ - -sdk iphonesimulator \ - -destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \ - -UseModernBuildSystem=NO \ - -only-testing:RNTesterUnitTests \ - build test | \ - xcpretty --report junit --output "$REPORTS_DIR/junit/ios_unit_tests/results.xml" && \ - exit "${PIPESTATUS[0]}" - - - run: - name: Run RNTester Integration Tests - command: | - source ./scripts/.tests.env - xcodebuild \ - -project RNTester/RNTester.xcodeproj \ - -scheme RNTester \ - -sdk iphonesimulator \ - -destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \ - -UseModernBuildSystem=NO \ - -only-testing:RNTesterIntegrationTests \ - build test | \ - xcpretty --report junit --output "$REPORTS_DIR/junit/ios_integration_tests/results.xml" && \ - exit "${PIPESTATUS[0]}" - - - run: - name: Stop Metro packager and WebSocket test server - command: | - # kill whatever is occupying port 8081 (packager) - lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill - # kill whatever is occupying port 5555 (web socket server) - lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill - + curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf + + - when: + condition: << parameters.use_frameworks >> + steps: + - run: + name: Set USE_FRAMEWORKS=1 + command: echo "export USE_FRAMEWORKS=1" >> $BASH_ENV + + - with_pods_cache_span: + steps: + - run: + name: Generate RNTesterPods Workspace + command: cd RNTester && pod install --verbose + + - with_brew_cache_span: + steps: + - brew_install: + package: watchman + - run: touch .watchmanconfig + + - run: yarn test-ios - store_test_results: - path: ~/react-native/reports/junit + path: ~/reports/junit - # Runs end-to-end tests - test_end_to_end: - <<: *macos_defaults + # Runs iOS end-to-end tests + test_ios_e2e: + executor: reactnativeios steps: - - attach_workspace: - at: ~/react-native + - restore_cache_checkout: + checkout_type: ios + - setup_artifacts + - run_yarn - run: name: Boot iPhone Simulator @@ -470,41 +371,32 @@ jobs: source $BASH_ENV # Brew - - restore-cache: *restore-brew-cache - - run: - name: Configure Detox Environment - command: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install node@8 >/dev/null - HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null - HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null - touch .watchmanconfig - node -v - - save-cache: *save-brew-cache + - with_brew_cache_span: + steps: + - brew_install: + package: node@8 + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null + - brew_install: + package: applesimutils + - brew_install: + package: watchman + # Configure Watchman + - run: touch .watchmanconfig - # Yarn install - - restore-cache: *restore-yarn-cache - - run: *yarn - - save-cache: *save-yarn-cache + - restore_cache: + keys: + - v1-cocoapods-{{ checksum "template/ios/Podfile" }} + - v1-cocoapods- - # Xcode build - - run: - name: Build app for Detox iOS End-to-End Tests - command: yarn run build-ios-e2e + - run: pod setup - # Test - run: - name: Run Detox iOS End-to-End Tests - command: yarn run test-ios-e2e - when: always + name: Generate RNTesterPods Workspace + command: pushd RNTester && pod install --verbose && popd - run: - name: Run JavaScript End-to-End Tests - command: | - # free up port 8081 for the packager before running tests - set +eo pipefail - lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill - set -eo pipefail - node ./scripts/run-ci-e2e-tests.js --js --retries 3 + name: Run Detox iOS End-to-End Tests + command: yarn run build-ios-e2e && yarn run test-ios-e2e when: always - run: @@ -517,16 +409,38 @@ jobs: node ./scripts/run-ci-e2e-tests.js --ios --retries 3; when: always + - save_cache: + paths: + - ~/.cocoapods/repos + key: v1-cocoapods-{{ checksum "template/ios/Podfile" }} + + test_js_e2e: + executor: node8 + steps: + - restore_cache_checkout: + checkout_type: node + - setup_artifacts + - run_yarn + - run: sudo apt-get install rsync + + - run: + name: Run JavaScript End-to-End Tests + command: node ./scripts/run-ci-e2e-tests.js --js --retries 3 + + - store_test_results: + path: ~/reports/junit # ------------------------- # JOBS: Test Android # ------------------------- # Run Android tests test_android: - <<: *android_defaults + executor: reactnativeandroid steps: - - attach_workspace: - at: ~/react-native + - restore_cache_checkout: + checkout_type: android + - setup_artifacts + - run_yarn # Validate Android SDK installation and packages - run: @@ -544,31 +458,15 @@ jobs: # Keep configuring Android dependencies while AVD boots up - - restore-cache: *restore-buck-downloads-cache - - run: - name: Install Buck - command: | - buck --version - # Install related tooling - if [[ ! -e ~/okbuck ]]; then - git clone https://github.com/uber/okbuck.git ~/okbuck --depth=1 - fi - mkdir -p ~/react-native/tooling/junit - cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/. - - save-cache: *save-buck-downloads-cache + - install_buck_tooling # Validate Android test environment (including Buck) - run: name: Validate Android Test Environment command: ./scripts/validate-android-test-env.sh - # Download dependencies using Buck - - run: *download-dependencies-buck - - # Download dependencies using Gradle - - restore-cache: *restore-gradle-downloads-cache - - run: *download-dependencies-gradle - - save-cache: *save-gradle-downloads-cache + - download_buck_dependencies + - download_gradle_dependencies # Build and compile - run: @@ -594,7 +492,7 @@ jobs: # Test Suite - run: name: Run Unit Tests - command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS --xml ~/react-native/reports/buck/all-results-raw.xml + command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS --xml ~/reports/buck/all-results-raw.xml - run: name: Run Instrumentation Tests @@ -612,19 +510,21 @@ jobs: - run: name: Collect Test Results command: | - find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/react-native/reports/build/ \; - find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/react-native/reports/outputs/ \; - find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/react-native/reports/buck/ \; - ./tooling/junit/buck_to_junit.sh ~/react-native/reports/buck/all-results-raw.xml ~/react-native/reports/junit/all-results-junit.xml + find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/reports/build/ \; + find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/reports/outputs/ \; + find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/reports/buck/ \; + if [ -f ~/react-native/reports/buck/all-results-raw.xml ]; then + ./tooling/junit/buck_to_junit.sh ~/react-native/reports/buck/all-results-raw.xml ~/react-native/reports/junit/all-results-junit.xml + fi when: always - store_test_results: - path: ~/react-native/reports/junit + path: ~/reports/junit # ------------------------- - # JOBS: Test Docker Build + # JOBS: Test Docker # ------------------------- - test_docker_build: + test_docker: machine: true steps: - checkout @@ -643,16 +543,17 @@ jobs: # ------------------------- # Collect JavaScript test coverage js_coverage: - <<: *js_defaults + executor: node8 environment: - CI_BRANCH: $CIRCLE_BRANCH - CI_PULL_REQUEST: $CIRCLE_PULL_REQUEST - CI_BUILD_NUMBER: $CIRCLE_BUILD_NUM - CI_BUILD_URL: $CIRCLE_BUILD_URL steps: - - checkout - - restore-cache: *restore-yarn-cache - - run: *yarn + - restore_cache_checkout: + checkout_type: node + - setup_artifacts + - run_yarn - run: name: Test coverage command: | @@ -668,74 +569,123 @@ jobs: # Publishes new version onto npm # Only works on stable branches when a properly tagged commit is pushed publish_npm_package: - <<: *android_defaults + executor: reactnativeandroid steps: - - checkout - - - restore-cache: *restore-yarn-cache - - run: *yarn - - # Fetch dependencies using Buck - - restore-cache: *restore-buck-downloads-cache - - run: *download-dependencies-buck - - # Fetch dependencies using Gradle - - restore-cache: *restore-gradle-downloads-cache - - run: *download-dependencies-gradle - - - run: - name: Authenticate with npm - command: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc - - - run: - name: Authenticate git user - command: | - git config --global user.email "react-native-bot@users.noreply.github.com" - git config --global user.name "npm Deployment Script" - echo "machine github.com login react-native-bot password $GITHUB_TOKEN" > ~/.netrc - - # Build and publish release. Requires an Android environment. - - run: - name: Publish React Native Package - command: node ./scripts/publish-npm.js + - restore_cache_checkout: + checkout_type: android + - run_yarn + - install_buck_tooling + - download_buck_dependencies + - download_gradle_dependencies + - run: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc + - run: | + git config --global user.email "react-native-bot@users.noreply.github.com" + git config --global user.name "npm Deployment Script" + echo "machine github.com login react-native-bot password $GITHUB_TOKEN" > ~/.netrc + - run: node ./scripts/publish-npm.js # ------------------------- # WORK FLOWS # ------------------------- workflows: - version: 2 - tests: jobs: - - test_node_lts: - filters: *filter-ignore-gh-pages - - - checkout_code: - filters: *filter-ignore-gh-pages - - - analyze: *run-after-checkout - - test_javascript: *run-after-checkout - - test_android: *run-after-checkout - - test_ios: *run-after-checkout - - test_end_to_end: *run-after-checkout - - test_docker_build: - filters: *filter-ignore-gh-pages - + - setup: + name: setup_js + filters: + branches: + ignore: gh-pages + - setup: + name: setup_ios + checkout_type: ios + executor: reactnativeios + filters: + branches: + ignore: gh-pages + - setup: + name: setup_android + checkout_type: android + executor: reactnativeandroid + filters: + branches: + ignore: gh-pages + - test_js: + requires: + - setup_js + - test_js_e2e: + requires: + - setup_js + - test_js + - test_android: + requires: + - setup_android + - test_ios: + requires: + - setup_ios + - test_ios: + name: test_ios_frameworks + use_frameworks: true + requires: + - setup_ios + - test_ios_e2e: + requires: + - setup_ios + - test_js + - test_js: + name: test_js_lts + executor: nodelts + requires: + - setup_js + - test_docker: + filters: + branches: + ignore: gh-pages releases: jobs: - - checkout_code: - filters: *filter-only-version-tags + - setup: + name: setup_android + checkout_type: android + executor: reactnativeandroid + filters: + # Both of the following conditions must be included! + # Ignore any commit on any branch by default. + branches: + ignore: /.*/ + # Only act on version tags. + tags: + only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ - publish_npm_package: - filters: *filter-only-version-tags requires: - - checkout_code + - setup_android + filters: + # Both of the following conditions must be included! + # Ignore any commit on any branch by default. + branches: + ignore: /.*/ + # Only act on version tags. + tags: + only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ analysis: jobs: + - setup + # Run lints on every commit other than those to the gh-pages branch + - analyze_code: + requires: + - setup + filters: + branches: + ignore: gh-pages + # Run code checks on PRs from forks - analyze_pr: - filters: *filter-only-forked-pull-requests + requires: + - setup + filters: + branches: + only: /^pull\/.*$/ - # Gather coverage on master + # Gather coverage - js_coverage: - filters: *filter-only-master \ No newline at end of file + requires: + - setup \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index dadac3a2b6d50b..45dc2a9a3fecd4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true diff --git a/.eslintrc b/.eslintrc index d18f7eb8286127..9c36dc1804f899 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,6 +6,14 @@ ], "overrides": [ + { + "files": [ + "Libraries/**/*.js", + ], + rules: { + '@react-native-community/no-haste-imports': 2 + } + }, { "files": [ "**/__fixtures__/**/*.js", diff --git a/.flowconfig b/.flowconfig index cba3e883ea9d48..9e6dd708c0d5e1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -13,17 +13,6 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js - -; Ignore polyfills -.*/Libraries/polyfills/.* - ; Ignore metro.config.js /metro.config.js @@ -32,7 +21,7 @@ .*/node_modules/warning/.* ; Flow doesn't support platforms -.*/Libraries/Utilities/HMRLoadingView.js +.*/Libraries/Utilities/LoadingView.js [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -53,35 +42,17 @@ module.file_ext=.js module.file_ext=.json module.file_ext=.ios.js -module.system=haste -module.system.haste.use_name_reducers=true -# keep the following in sync with server/haste/hasteImpl.js -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -# TODO(macOS ISS#2323203): -module.system.haste.name_reducers='^\(.*\)\.macos$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.whitelist=/Libraries/.* -module.system.haste.paths.whitelist=/RNTester/.* -module.system.haste.paths.whitelist=/IntegrationTests/.* -module.system.haste.paths.blacklist=/Libraries/react-native/react-native-implementation.js -module.system.haste.paths.blacklist=/Libraries/Animated/src/polyfills/.* - munge_underscores=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.name_mapper='^react-native$' -> '/Libraries/react-native/react-native-implementation' +module.name_mapper='^react-native/\(.*\)$' -> '/\1' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState +suppress_type=$FlowFixMeEmpty suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ @@ -110,4 +81,4 @@ untyped-import untyped-type-import [version] -^0.98.0 +^0.105.0 diff --git a/.flowconfig.android b/.flowconfig.android index 3eadd57a134b56..9368fd544cab41 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -13,17 +13,6 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js - -; Ignore polyfills -.*/Libraries/polyfills/.* - ; TODO(macOS ISS#2323203): Ignore metro.config.js /metro.config.js @@ -41,7 +30,7 @@ .*/node_modules/warning/.* ; Flow doesn't support platforms -.*/Libraries/Utilities/HMRLoadingView.js +.*/Libraries/Utilities/LoadingView.js [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -62,35 +51,19 @@ module.file_ext=.js module.file_ext=.json module.file_ext=.android.js -module.system=haste -module.system.haste.use_name_reducers=true -# keep the following in sync with server/haste/hasteImpl.js -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .android suffix -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' # TODO(macOS ISS#2323203): module.system.haste.name_reducers='^\(.*\)\.macos$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.whitelist=/Libraries/.* -module.system.haste.paths.whitelist=/RNTester/.* -module.system.haste.paths.whitelist=/IntegrationTests/.* -module.system.haste.paths.blacklist=/Libraries/react-native/react-native-implementation.js -module.system.haste.paths.blacklist=/Libraries/Animated/src/polyfills/.* - munge_underscores=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.name_mapper='^react-native$' -> '/Libraries/react-native/react-native-implementation' +module.name_mapper='^react-native/\(.*\)$' -> '/\1' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState +suppress_type=$FlowFixMeEmpty suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_android\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_android\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ @@ -119,4 +92,4 @@ untyped-import untyped-type-import [version] -^0.98.0 +^0.105.0 diff --git a/.flowconfig.macos b/.flowconfig.macos index da9a2ac9be58c8..5898f1bb0031f0 100644 --- a/.flowconfig.macos +++ b/.flowconfig.macos @@ -13,17 +13,6 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js - -; Ignore polyfills -.*/Libraries/polyfills/.* - ; Ignore metro.config.js /metro.config.js @@ -32,7 +21,7 @@ .*/node_modules/warning/.* ; Flow doesn't support platforms -.*/Libraries/Utilities/HMRLoadingView.js +.*/Libraries/Utilities/LoadingView.js [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -53,34 +42,17 @@ module.file_ext=.js module.file_ext=.json module.file_ext=.macos.js -module.system=haste -module.system.haste.use_name_reducers=true -# keep the following in sync with server/haste/hasteImpl.js -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .macos suffix -module.system.haste.name_reducers='^\(.*\)\.macos$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.whitelist=/Libraries/.* -module.system.haste.paths.whitelist=/RNTester/.* -module.system.haste.paths.whitelist=/IntegrationTests/.* -module.system.haste.paths.blacklist=/Libraries/react-native/react-native-implementation.js -module.system.haste.paths.blacklist=/Libraries/Animated/src/polyfills/.* - munge_underscores=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.name_mapper='^react-native$' -> '/Libraries/react-native/react-native-implementation' +module.name_mapper='^react-native/\(.*\)$' -> '/\1' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState +suppress_type=$FlowFixMeEmpty suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ @@ -109,4 +81,4 @@ untyped-import untyped-type-import [version] -^0.98.0 +^0.105.0 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 09c71aff836751..0856e966039493 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -29,12 +29,12 @@ React Native version: Describe what you expected to happen: -Snack, code example, or link to a repository: - +Snack, code example, screenshot, or link to a repository: diff --git a/.gitignore b/.gitignore index f831efb12ac614..94dbd79416fca2 100644 --- a/.gitignore +++ b/.gitignore @@ -86,7 +86,13 @@ RNTester/build # CocoaPods /template/ios/Pods/ /template/ios/Podfile.lock +/RNTester/Gemfile.lock +# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here. +RNTester/Pods/* +!RNTester/Pods/__offline_mirrors + +# NuGet *.nupkg #vscode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 42cb49e62135ee..28ddd7ac89c652 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ If you are eager to start contributing code right away, we have a list of [good There are other ways you can contribute without writing a single line of code. Here are a few things you can do to help out: -1. **Replying and handling open issues.** We get a lot of issues every day, and some of them may lack necessary information. You can help out by guiding people through the process of filling out the issue template, asking for clarifying information, or pointing them to existing issues that match their description of the problem. We'll cover more about this process later, in [Handling Issues](http://github.com/facebook/react-native/wiki/Handling-Issues). +1. **Replying and handling open issues.** We get a lot of issues every day, and some of them may lack necessary information. You can help out by guiding people through the process of filling out the issue template, asking for clarifying information, or pointing them to existing issues that match their description of the problem. We cover more about this process in the [Issue Triage wiki](https://github.com/facebook/react-native/wiki/Issues#triage). 2. **Reviewing pull requests for the docs.** Reviewing [documentation updates](https://github.com/facebook/react-native-website/pulls) can be as simple as checking for spelling and grammar. If you encounter situations that can be explained better in the docs, click **Edit** at the top of most docs pages to get started with your own contribution. 3. **Help people write test plans.** Some pull requests sent to the main repository may lack a proper test plan. These help reviewers understand how the change was tested, and can speed up the time it takes for a contribution to be accepted. @@ -30,6 +30,7 @@ We use GitHub issues and pull requests to keep track of bug reports and contribu You can learn more about the contribution process in the following documents: +* [Issues](https://github.com/facebook/react-native/wiki/Issues) * [Pull Requests](https://github.com/facebook/react-native/wiki/Pull-Requests) We also have a thriving community of contributors who would be happy to help you get set up. You can reach out to us through [@ReactNative](http://twitter.com/reactnative) (the React Native team) and [@ReactNativeComm](http://twitter.com/reactnativecomm) (the React Native Community organization). @@ -47,9 +48,9 @@ There are a few other repositories you might want to familiarize yourself with: Browsing through these repositories should provide some insight into how the React Native open source project is managed. -## Handling Issues +## GitHub Issues -We use GitHub issues to track bugs exclusively. You can report an issue by filing a [Bug Report](https://github.com/facebook/react-native/issues/new/choose). Watch this space for more details on how to get involved and triage issues. +We use GitHub issues to track bugs exclusively. We have documented our issue handling processes in the [Issues wiki](https://github.com/facebook/react-native/wiki/Issues). ### Security Bugs @@ -82,7 +83,7 @@ Code-level contributions to React Native generally come in the form of [pull req 7. Create a pull request to the React Native repository. 8. Review and address comments on your pull request. 1. A bot may comment with suggestions. Generally we ask you to resolve these first before a maintainer will review your code. -9. If you haven't already, complete the Contributor License Agreement ("CLA"). +9. If you haven't already, please complete the [Contributor License Agreement](https://github.com/facebook/react-native/wiki/Contributor-License-Agreement) ("CLA"). **[Complete your CLA here.](https://code.facebook.com/cla)** If all goes well, your pull request will be merged. If it is not merged, maintainers will do their best to explain the reason why. diff --git a/IntegrationTests/AccessibilityManagerTest.js b/IntegrationTests/AccessibilityManagerTest.js index b05aea774056e4..313b8990346671 100644 --- a/IntegrationTests/AccessibilityManagerTest.js +++ b/IntegrationTests/AccessibilityManagerTest.js @@ -14,11 +14,18 @@ const React = require('react'); const ReactNative = require('react-native'); const {View} = ReactNative; const RCTDeviceEventEmitter = require('react-native/Libraries/EventEmitter/RCTDeviceEventEmitter'); -const {TestModule, AccessibilityManager} = ReactNative.NativeModules; +const {TestModule} = ReactNative.NativeModules; +import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager'; +import invariant from 'invariant'; class AccessibilityManagerTest extends React.Component<{}> { componentDidMount() { - AccessibilityManager.setAccessibilityContentSizeMultipliers({ + invariant( + NativeAccessibilityManager, + "NativeAccessibilityManager doesn't exist", + ); + + NativeAccessibilityManager.setAccessibilityContentSizeMultipliers({ extraSmall: 1.0, small: 2.0, medium: 3.0, diff --git a/IntegrationTests/AppEventsTest.js b/IntegrationTests/AppEventsTest.js index a109f42e4c35c6..4bc0b0649c16fa 100644 --- a/IntegrationTests/AppEventsTest.js +++ b/IntegrationTests/AppEventsTest.js @@ -36,7 +36,7 @@ class AppEventsTest extends React.Component<{}, State> { this.setState({sent: event}); } - receiveEvent = (event: any) => { + receiveEvent: (event: any) => void = (event: any) => { if (deepDiffer(event.data, TEST_PAYLOAD)) { throw new Error('Received wrong event: ' + JSON.stringify(event)); } @@ -46,7 +46,7 @@ class AppEventsTest extends React.Component<{}, State> { }); }; - render() { + render(): React.Node { return ( {JSON.stringify(this.state, null, ' ')} diff --git a/IntegrationTests/AsyncStorageTest.js b/IntegrationTests/AsyncStorageTest.js index e1a4de758b00cc..81325c752504ee 100644 --- a/IntegrationTests/AsyncStorageTest.js +++ b/IntegrationTests/AsyncStorageTest.js @@ -177,7 +177,7 @@ function testOptimizedMultiGet() { } class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> { - state = { + state: any | $TEMPORARY$object<{|done: boolean, messages: string|}> = { messages: 'Initializing...', done: false, }; @@ -194,7 +194,7 @@ class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> { AsyncStorage.clear(testSetAndGet); } - render() { + render(): React.Node { return ( diff --git a/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/IntegrationTests/GlobalEvalWithSourceUrlTest.js new file mode 100644 index 00000000000000..0fd59bc26441fe --- /dev/null +++ b/IntegrationTests/GlobalEvalWithSourceUrlTest.js @@ -0,0 +1,80 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +const React = require('react'); +const ReactNative = require('react-native'); +const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack'); +const {View} = ReactNative; + +const {TestModule} = ReactNative.NativeModules; + +class GlobalEvalWithSourceUrlTest extends React.Component<{}> { + componentDidMount() { + if (typeof global.globalEvalWithSourceUrl !== 'function') { + throw new Error( + 'Expected to find globalEvalWithSourceUrl function on global object but found ' + + typeof global.globalEvalWithSourceUrl, + ); + } + const value = global.globalEvalWithSourceUrl('42'); + if (value !== 42) { + throw new Error( + 'Expected globalEvalWithSourceUrl(expression) to return a value', + ); + } + let syntaxError; + try { + global.globalEvalWithSourceUrl('{'); + } catch (e) { + syntaxError = e; + } + if (!syntaxError) { + throw new Error( + 'Expected globalEvalWithSourceUrl to throw on a syntax error', + ); + } + if (!(syntaxError instanceof SyntaxError)) { + throw new Error( + 'Expected globalEvalWithSourceUrl to throw SyntaxError on a syntax error', + ); + } + const url = 'http://example.com/foo.js'; + let error; + try { + global.globalEvalWithSourceUrl('throw new Error()', url); + } catch (e) { + error = e; + } + if (!error) { + throw new Error( + 'Expected globalEvalWithSourceUrl to throw an Error object', + ); + } + const parsedStack = parseErrorStack(error); + if (parsedStack[0].file !== url) { + throw new Error( + `Expected first eval stack frame to be in ${url} but found ${String( + parsedStack[0].file, + )}`, + ); + } + TestModule.markTestCompleted(); + } + + render(): React.Node { + return ; + } +} + +GlobalEvalWithSourceUrlTest.displayName = 'GlobalEvalWithSourceUrlTest'; + +module.exports = GlobalEvalWithSourceUrlTest; diff --git a/IntegrationTests/ImageCachePolicyTest.js b/IntegrationTests/ImageCachePolicyTest.js index 0dae9812cf6e24..d25e6c2b86ede3 100644 --- a/IntegrationTests/ImageCachePolicyTest.js +++ b/IntegrationTests/ImageCachePolicyTest.js @@ -36,9 +36,9 @@ type State = { }; class ImageCachePolicyTest extends React.Component { - state = {}; + state: $FlowFixMe | $TEMPORARY$object<{||}> = {}; - shouldComponentUpdate(nextProps: Props, nextState: State) { + shouldComponentUpdate(nextProps: Props, nextState: State): boolean { const results: Array = TESTS.map(x => nextState[x]); if (!results.includes(undefined)) { @@ -56,7 +56,7 @@ class ImageCachePolicyTest extends React.Component { this.setState({[name]: pass}); } - render() { + render(): React.Node { return ( Hello diff --git a/IntegrationTests/ImageSnapshotTest.js b/IntegrationTests/ImageSnapshotTest.js index c4ffaae51c2ec4..495423ae006340 100644 --- a/IntegrationTests/ImageSnapshotTest.js +++ b/IntegrationTests/ImageSnapshotTest.js @@ -22,11 +22,11 @@ class ImageSnapshotTest extends React.Component<{}> { } } - done = (success: boolean) => { + done: (success: boolean) => void = (success: boolean) => { TestModule.markTestPassed(success); }; - render() { + render(): React.Node { return ( { - state = { + state: State = { done: false, }; @@ -38,7 +39,7 @@ class IntegrationTestHarnessTest extends React.Component { } } - runTest = () => { + runTest: () => void = () => { if (this.props.shouldThrow) { throw new Error('Throwing error because shouldThrow'); } @@ -52,7 +53,7 @@ class IntegrationTestHarnessTest extends React.Component { }); }; - render() { + render(): React.Node { return ( diff --git a/IntegrationTests/IntegrationTestsApp.js b/IntegrationTests/IntegrationTestsApp.js index de3d6004b8e353..a7ad8113abb5a2 100644 --- a/IntegrationTests/IntegrationTestsApp.js +++ b/IntegrationTests/IntegrationTestsApp.js @@ -25,17 +25,18 @@ const { // Keep this list in sync with RNTesterIntegrationTests.m const TESTS = [ require('./IntegrationTestHarnessTest'), - // require('./TimersTest'), + // require('./TimersTest'), require('./AsyncStorageTest'), + // require('./LayoutEventsTest'), require('./AppEventsTest'), + require('./SimpleSnapshotTest'), // require('./ImageCachePolicyTest'), // require('./ImageSnapshotTest'), - // require('./LayoutEventsTest'), - require('./SimpleSnapshotTest'), - require('./SyncMethodTest'), require('./PromiseTest'), + require('./SyncMethodTest'), require('./WebSocketTest'), require('./AccessibilityManagerTest'), + require('./GlobalEvalWithSourceUrlTest'), ]; TESTS.forEach( diff --git a/IntegrationTests/LayoutEventsTest.js b/IntegrationTests/LayoutEventsTest.js index 81919b0bb7cc41..ce7ec5fab61076 100644 --- a/IntegrationTests/LayoutEventsTest.js +++ b/IntegrationTests/LayoutEventsTest.js @@ -10,10 +10,10 @@ 'use strict'; -const Platform = require('Platform'); const React = require('react'); const ReactNative = require('react-native'); const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; +const {Platform} = ReactNative; // TODO(macOS ISS#2323203) const {TestModule} = ReactNative.NativeModules; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; @@ -53,8 +53,8 @@ class LayoutEventsTest extends React.Component { animateViewLayout() { debug('animateViewLayout invoked'); LayoutAnimation.configureNext( - Platform.OS === 'macos' - ? LayoutAnimation.Presets.easeInEaseOut + Platform.OS === 'macos' // [TODO(macOS ISS#2323203) + ? LayoutAnimation.Presets.easeInEaseOut // ]TODO(macOS ISS#2323203) : LayoutAnimation.Presets.spring, () => { debug('animateViewLayout done'); @@ -64,7 +64,7 @@ class LayoutEventsTest extends React.Component { this.setState({viewStyle: {margin: 60}}); } - addWrapText = () => { + addWrapText: () => void = () => { debug('addWrapText invoked'); this.setState( {extraText: ' And a bunch more text to wrap around a few lines.'}, @@ -72,14 +72,14 @@ class LayoutEventsTest extends React.Component { ); }; - changeContainer = () => { + changeContainer: () => void = () => { debug('changeContainer invoked'); this.setState({containerStyle: {width: 280}}, () => this.checkLayout(TestModule.markTestCompleted), ); }; - checkLayout = (next?: ?() => void) => { + checkLayout: (next?: ?() => void) => void = (next?: ?() => void) => { const view = this._view; const txt = this._txt; const img = this._img; @@ -123,22 +123,22 @@ class LayoutEventsTest extends React.Component { } } - onViewLayout = (e: LayoutEvent) => { + onViewLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => { debug('received view layout event\n', e.nativeEvent); this.setState({viewLayout: e.nativeEvent.layout}, this.checkLayout); }; - onTextLayout = (e: LayoutEvent) => { + onTextLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => { debug('received text layout event\n', e.nativeEvent); this.setState({textLayout: e.nativeEvent.layout}, this.checkLayout); }; - onImageLayout = (e: LayoutEvent) => { + onImageLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => { debug('received image layout event\n', e.nativeEvent); this.setState({imageLayout: e.nativeEvent.layout}, this.checkLayout); }; - render() { + render(): React.Node { const viewStyle = [styles.view, this.state.viewStyle]; const textLayout = this.state.textLayout || {width: '?', height: '?'}; const imageLayout = this.state.imageLayout || {x: '?', y: '?'}; diff --git a/IntegrationTests/PromiseTest.js b/IntegrationTests/PromiseTest.js index c36d3beb017b69..b35c971fc34816 100644 --- a/IntegrationTests/PromiseTest.js +++ b/IntegrationTests/PromiseTest.js @@ -16,10 +16,10 @@ const {View} = ReactNative; const {TestModule} = ReactNative.NativeModules; class PromiseTest extends React.Component<{}> { - shouldResolve = false; - shouldReject = false; - shouldSucceedAsync = false; - shouldThrowAsync = false; + shouldResolve: boolean = false; + shouldReject: boolean = false; + shouldSucceedAsync: boolean = false; + shouldThrowAsync: boolean = false; componentDidMount() { Promise.all([ @@ -37,19 +37,19 @@ class PromiseTest extends React.Component<{}> { ); } - testShouldResolve = () => { + testShouldResolve: () => any = () => { return TestModule.shouldResolve() .then(() => (this.shouldResolve = true)) .catch(() => (this.shouldResolve = false)); }; - testShouldReject = () => { + testShouldReject: () => any = () => { return TestModule.shouldReject() .then(() => (this.shouldReject = false)) .catch(() => (this.shouldReject = true)); }; - testShouldSucceedAsync = async (): Promise => { + testShouldSucceedAsync: () => Promise = async (): Promise => { try { await TestModule.shouldResolve(); this.shouldSucceedAsync = true; @@ -58,7 +58,7 @@ class PromiseTest extends React.Component<{}> { } }; - testShouldThrowAsync = async (): Promise => { + testShouldThrowAsync: () => Promise = async (): Promise => { try { await TestModule.shouldReject(); this.shouldThrowAsync = false; diff --git a/IntegrationTests/ReactContentSizeUpdateTest.js b/IntegrationTests/ReactContentSizeUpdateTest.js index ad87bb6ed42f08..47373d6f2a8978 100644 --- a/IntegrationTests/ReactContentSizeUpdateTest.js +++ b/IntegrationTests/ReactContentSizeUpdateTest.js @@ -10,9 +10,9 @@ 'use strict'; +const RCTNativeAppEventEmitter = require('react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter'); const React = require('react'); const ReactNative = require('react-native'); -const RCTNativeAppEventEmitter = require('react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter'); const {View} = ReactNative; @@ -35,7 +35,7 @@ class ReactContentSizeUpdateTest extends React.Component { _timeoutID: ?TimeoutID = null; _subscription: ?EmitterSubscription = null; - state = { + state: State = { height: reactViewHeight, width: reactViewWidth, }; @@ -70,7 +70,9 @@ class ReactContentSizeUpdateTest extends React.Component { }); } - rootViewDidChangeIntrinsicSize = (intrinsicSize: State) => { + rootViewDidChangeIntrinsicSize: (intrinsicSize: State) => void = ( + intrinsicSize: State, + ) => { if ( intrinsicSize.height === newReactViewHeight && intrinsicSize.width === newReactViewWidth @@ -79,7 +81,7 @@ class ReactContentSizeUpdateTest extends React.Component { } }; - render() { + render(): React.Node { return ( ); diff --git a/IntegrationTests/SimpleSnapshotTest.js b/IntegrationTests/SimpleSnapshotTest.js index 6ebf24fd25ac3a..90cb3f1e17c475 100644 --- a/IntegrationTests/SimpleSnapshotTest.js +++ b/IntegrationTests/SimpleSnapshotTest.js @@ -12,6 +12,7 @@ const React = require('react'); const ReactNative = require('react-native'); + const requestAnimationFrame = require('fbjs/lib/requestAnimationFrame'); const {StyleSheet, View} = ReactNative; @@ -25,11 +26,11 @@ class SimpleSnapshotTest extends React.Component<{}> { requestAnimationFrame(() => TestModule.verifySnapshot(this.done)); } - done = (success: boolean) => { + done: (success: boolean) => void = (success: boolean) => { TestModule.markTestPassed(success); }; - render() { + render(): React.Node { return ( diff --git a/IntegrationTests/SizeFlexibilityUpdateTest.js b/IntegrationTests/SizeFlexibilityUpdateTest.js index 2da24f0b920f9a..419083c57a319a 100644 --- a/IntegrationTests/SizeFlexibilityUpdateTest.js +++ b/IntegrationTests/SizeFlexibilityUpdateTest.js @@ -10,9 +10,9 @@ 'use strict'; +const RCTNativeAppEventEmitter = require('react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter'); const React = require('react'); const ReactNative = require('react-native'); -const RCTNativeAppEventEmitter = require('react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter'); const {View} = ReactNative; const {TestModule} = ReactNative.NativeModules; @@ -46,15 +46,15 @@ class SizeFlexibilityUpdateTest extends React.Component { } } - markPassed = () => { + markPassed: () => void = () => { TestModule.markTestPassed(true); finalState = true; }; - rootViewDidChangeIntrinsicSize = (intrinsicSize: { - width: number, + rootViewDidChangeIntrinsicSize: (intrinsicSize: { height: number, - }) => { + width: number, + }) => void = (intrinsicSize: {width: number, height: number}) => { if (finalState) { // If a test reaches its final state, it is not expected to do anything more TestModule.markTestPassed(false); @@ -99,7 +99,7 @@ class SizeFlexibilityUpdateTest extends React.Component { } }; - render() { + render(): React.Node { return ; } } diff --git a/IntegrationTests/TimersTest.js b/IntegrationTests/TimersTest.js index c7eefb915333c3..8550c6f00eec6b 100644 --- a/IntegrationTests/TimersTest.js +++ b/IntegrationTests/TimersTest.js @@ -33,7 +33,7 @@ class TimersTest extends React.Component { _immediateIDs: Set = new Set(); _animationFrameIDs: Set = new Set(); - state = { + state: State = { count: 0, done: false, }; @@ -228,7 +228,7 @@ class TimersTest extends React.Component { } } - render() { + render(): React.Node { return ( diff --git a/IntegrationTests/WebSocketTest.js b/IntegrationTests/WebSocketTest.js index 0d2cd5e0b4d9e7..fcc2d74cb8d35c 100644 --- a/IntegrationTests/WebSocketTest.js +++ b/IntegrationTests/WebSocketTest.js @@ -113,7 +113,7 @@ class WebSocketTest extends React.Component<{}, State> { this.testConnect(); } - testConnect = () => { + testConnect: () => void = () => { this._connect(); this._waitFor(this._socketIsConnected, 5, connectSucceeded => { if (!connectSucceeded) { @@ -124,7 +124,7 @@ class WebSocketTest extends React.Component<{}, State> { }); }; - testSendAndReceive = () => { + testSendAndReceive: () => void = () => { this._sendTestMessage(); this._waitFor(this._receivedTestExpectedResponse, 5, messageReceived => { if (!messageReceived) { @@ -135,7 +135,7 @@ class WebSocketTest extends React.Component<{}, State> { }); }; - testDisconnect = () => { + testDisconnect: () => void = () => { this._disconnect(); this._waitFor(this._socketIsDisconnected, 5, disconnectSucceeded => { TestModule.markTestPassed(disconnectSucceeded); diff --git a/Libraries/ART/ART.xcodeproj/project.pbxproj b/Libraries/ART/ART.xcodeproj/project.pbxproj deleted file mode 100644 index a78db70bb3ceaf..00000000000000 --- a/Libraries/ART/ART.xcodeproj/project.pbxproj +++ /dev/null @@ -1,669 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; }; - 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; }; - 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; }; - 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; }; - 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; }; - 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; }; - 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; }; - 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; }; - 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; }; - 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; }; - 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; }; - 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; }; - 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; }; - 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; }; - 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; }; - 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; }; - 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; }; - 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; }; - 325CF7AD1E5F2ABA00AC9606 /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; }; - 325CF7AE1E5F2ABA00AC9606 /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; }; - 325CF7AF1E5F2ABA00AC9606 /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; }; - 325CF7B01E5F2ABA00AC9606 /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; }; - 325CF7B11E5F2ABA00AC9606 /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; }; - 325CF7B21E5F2ABA00AC9606 /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; }; - 325CF7B31E5F2ABA00AC9606 /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; }; - 325CF7B41E5F2ABA00AC9606 /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; }; - 325CF7B51E5F2ABA00AC9606 /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; }; - 325CF7B61E5F2ABA00AC9606 /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; }; - 325CF7B71E5F2ABA00AC9606 /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; }; - 325CF7B81E5F2ABA00AC9606 /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; }; - 325CF7B91E5F2ABA00AC9606 /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; }; - 325CF7BA1E5F2ABA00AC9606 /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; }; - 325CF7BB1E5F2ABA00AC9606 /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; }; - 325CF7BC1E5F2ABA00AC9606 /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; }; - 325CF7BD1E5F2ABA00AC9606 /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; }; - 325CF7BE1E5F2ABA00AC9606 /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; }; - 6431E8A01F9A30AD00BA05C9 /* ARTTextFrame.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */; }; - 6431E8A11F9A30AD00BA05C9 /* RCTConvert+ART.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */; }; - 6431E8A21F9A30B300BA05C9 /* ARTSurfaceView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */; }; - 6431E8A31F9A30B700BA05C9 /* ARTContainer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */; }; - 6431E8A41F9A30BA00BA05C9 /* ARTCGFloatArray.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */; }; - 6431E8A51F9A30BD00BA05C9 /* ARTBrush.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */; }; - 6431E8A61F9A312000BA05C9 /* ARTBrush.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */; }; - 6431E8A71F9A312000BA05C9 /* ARTCGFloatArray.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */; }; - 6431E8A81F9A312000BA05C9 /* ARTContainer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */; }; - 6431E8A91F9A312000BA05C9 /* ARTSurfaceView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */; }; - 6431E8AA1F9A312000BA05C9 /* ARTTextFrame.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */; }; - 6431E8AB1F9A312000BA05C9 /* RCTConvert+ART.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */; }; - 6431E8AC1F9A316D00BA05C9 /* ARTBrush.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */; }; - 6431E8AD1F9A316D00BA05C9 /* ARTCGFloatArray.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */; }; - 6431E8AE1F9A316D00BA05C9 /* ARTContainer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */; }; - 6431E8AF1F9A316D00BA05C9 /* ARTSurfaceView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */; }; - 6431E8B01F9A316E00BA05C9 /* ARTTextFrame.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */; }; - 6431E8B11F9A316E00BA05C9 /* RCTConvert+ART.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */; }; - 647647631F0BC33500C2D89B /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; }; - 647647641F0BC33500C2D89B /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; }; - 647647651F0BC33500C2D89B /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; }; - 647647661F0BC33500C2D89B /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; }; - 647647671F0BC33500C2D89B /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; }; - 647647681F0BC33500C2D89B /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; }; - 647647691F0BC33500C2D89B /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; }; - 6476476A1F0BC33500C2D89B /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; }; - 6476476B1F0BC33500C2D89B /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; }; - 6476476C1F0BC33500C2D89B /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; }; - 6476476D1F0BC33500C2D89B /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; }; - 6476476E1F0BC33500C2D89B /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; }; - 6476476F1F0BC33500C2D89B /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; }; - 647647701F0BC33500C2D89B /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; }; - 647647711F0BC33500C2D89B /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; }; - 647647721F0BC33500C2D89B /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; }; - 647647731F0BC33500C2D89B /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; }; - 647647741F0BC33500C2D89B /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 0CF68ABF1AF0540F00FF9E5C /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - 6431E8AC1F9A316D00BA05C9 /* ARTBrush.h in Copy Headers */, - 6431E8AD1F9A316D00BA05C9 /* ARTCGFloatArray.h in Copy Headers */, - 6431E8AE1F9A316D00BA05C9 /* ARTContainer.h in Copy Headers */, - 6431E8AF1F9A316D00BA05C9 /* ARTSurfaceView.h in Copy Headers */, - 6431E8B01F9A316E00BA05C9 /* ARTTextFrame.h in Copy Headers */, - 6431E8B11F9A316E00BA05C9 /* RCTConvert+ART.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12851E5F266B004975B8 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/ART; - dstSubfolderSpec = 16; - files = ( - 6431E8A61F9A312000BA05C9 /* ARTBrush.h in Copy Headers */, - 6431E8A71F9A312000BA05C9 /* ARTCGFloatArray.h in Copy Headers */, - 6431E8A81F9A312000BA05C9 /* ARTContainer.h in Copy Headers */, - 6431E8A91F9A312000BA05C9 /* ARTSurfaceView.h in Copy Headers */, - 6431E8AA1F9A312000BA05C9 /* ARTTextFrame.h in Copy Headers */, - 6431E8AB1F9A312000BA05C9 /* RCTConvert+ART.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 647647761F0BC33500C2D89B /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/ART; - dstSubfolderSpec = 16; - files = ( - 6431E8A01F9A30AD00BA05C9 /* ARTTextFrame.h in Copy Headers */, - 6431E8A11F9A30AD00BA05C9 /* RCTConvert+ART.h in Copy Headers */, - 6431E8A21F9A30B300BA05C9 /* ARTSurfaceView.h in Copy Headers */, - 6431E8A51F9A30BD00BA05C9 /* ARTBrush.h in Copy Headers */, - 6431E8A41F9A30BA00BA05C9 /* ARTCGFloatArray.h in Copy Headers */, - 6431E8A31F9A30B700BA05C9 /* ARTContainer.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0CF68AC11AF0540F00FF9E5C /* libART.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libART.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTCGFloatArray.h; sourceTree = ""; }; - 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTContainer.h; sourceTree = ""; }; - 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroup.h; sourceTree = ""; }; - 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroup.m; sourceTree = ""; }; - 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNode.h; sourceTree = ""; }; - 0CF68AE01AF0549300FF9E5C /* ARTNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNode.m; sourceTree = ""; }; - 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderable.h; sourceTree = ""; }; - 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderable.m; sourceTree = ""; }; - 0CF68AE31AF0549300FF9E5C /* ARTShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShape.h; sourceTree = ""; }; - 0CF68AE41AF0549300FF9E5C /* ARTShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShape.m; sourceTree = ""; }; - 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceView.h; sourceTree = ""; }; - 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceView.m; sourceTree = ""; }; - 0CF68AE71AF0549300FF9E5C /* ARTText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTText.h; sourceTree = ""; }; - 0CF68AE81AF0549300FF9E5C /* ARTText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTText.m; sourceTree = ""; }; - 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextFrame.h; sourceTree = ""; }; - 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTBrush.h; sourceTree = ""; }; - 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTBrush.m; sourceTree = ""; }; - 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTLinearGradient.h; sourceTree = ""; }; - 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTLinearGradient.m; sourceTree = ""; }; - 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTPattern.h; sourceTree = ""; }; - 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTPattern.m; sourceTree = ""; }; - 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRadialGradient.h; sourceTree = ""; }; - 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRadialGradient.m; sourceTree = ""; }; - 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSolidColor.h; sourceTree = ""; }; - 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSolidColor.m; sourceTree = ""; }; - 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+ART.h"; sourceTree = ""; }; - 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+ART.m"; sourceTree = ""; }; - 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroupManager.h; sourceTree = ""; }; - 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroupManager.m; sourceTree = ""; }; - 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNodeManager.h; sourceTree = ""; }; - 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNodeManager.m; sourceTree = ""; }; - 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderableManager.h; sourceTree = ""; }; - 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderableManager.m; sourceTree = ""; }; - 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShapeManager.h; sourceTree = ""; }; - 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShapeManager.m; sourceTree = ""; }; - 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceViewManager.h; sourceTree = ""; }; - 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceViewManager.m; sourceTree = ""; }; - 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextManager.h; sourceTree = ""; }; - 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTTextManager.m; sourceTree = ""; }; - 323A12871E5F266B004975B8 /* libART-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libART-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6476477A1F0BC33500C2D89B /* libART-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libART-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0CF68ABE1AF0540F00FF9E5C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12841E5F266B004975B8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 647647751F0BC33500C2D89B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0CF68AB81AF0540F00FF9E5C = { - isa = PBXGroup; - children = ( - 0CF68AEA1AF0549300FF9E5C /* Brushes */, - 0CF68AF81AF0549300FF9E5C /* ViewManagers */, - 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */, - 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */, - 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */, - 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */, - 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */, - 0CF68AE01AF0549300FF9E5C /* ARTNode.m */, - 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */, - 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */, - 0CF68AE31AF0549300FF9E5C /* ARTShape.h */, - 0CF68AE41AF0549300FF9E5C /* ARTShape.m */, - 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */, - 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */, - 0CF68AE71AF0549300FF9E5C /* ARTText.h */, - 0CF68AE81AF0549300FF9E5C /* ARTText.m */, - 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */, - 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */, - 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */, - 0CF68AC21AF0540F00FF9E5C /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 0CF68AC21AF0540F00FF9E5C /* Products */ = { - isa = PBXGroup; - children = ( - 0CF68AC11AF0540F00FF9E5C /* libART.a */, - 323A12871E5F266B004975B8 /* libART-tvOS.a */, - 6476477A1F0BC33500C2D89B /* libART-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 0CF68AEA1AF0549300FF9E5C /* Brushes */ = { - isa = PBXGroup; - children = ( - 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */, - 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */, - 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */, - 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */, - 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */, - 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */, - 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */, - 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */, - 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */, - 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */, - ); - path = Brushes; - sourceTree = ""; - }; - 0CF68AF81AF0549300FF9E5C /* ViewManagers */ = { - isa = PBXGroup; - children = ( - 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */, - 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */, - 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */, - 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */, - 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */, - 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */, - 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */, - 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */, - 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */, - 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */, - 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */, - 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */, - ); - path = ViewManagers; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 0CF68AC01AF0540F00FF9E5C /* ART */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */; - buildPhases = ( - 0CF68ABD1AF0540F00FF9E5C /* Sources */, - 0CF68ABE1AF0540F00FF9E5C /* Frameworks */, - 0CF68ABF1AF0540F00FF9E5C /* Copy Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ART; - productName = ART; - productReference = 0CF68AC11AF0540F00FF9E5C /* libART.a */; - productType = "com.apple.product-type.library.static"; - }; - 323A12861E5F266B004975B8 /* ART-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 323A128D1E5F266B004975B8 /* Build configuration list for PBXNativeTarget "ART-tvOS" */; - buildPhases = ( - 323A12831E5F266B004975B8 /* Sources */, - 323A12841E5F266B004975B8 /* Frameworks */, - 323A12851E5F266B004975B8 /* Copy Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ART-tvOS"; - productName = "ART-tvOS"; - productReference = 323A12871E5F266B004975B8 /* libART-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 647647611F0BC33500C2D89B /* ART-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 647647771F0BC33500C2D89B /* Build configuration list for PBXNativeTarget "ART-macOS" */; - buildPhases = ( - 647647621F0BC33500C2D89B /* Sources */, - 647647751F0BC33500C2D89B /* Frameworks */, - 647647761F0BC33500C2D89B /* Copy Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ART-macOS"; - productName = ART; - productReference = 6476477A1F0BC33500C2D89B /* libART-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0CF68AB91AF0540F00FF9E5C /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - TargetAttributes = { - 0CF68AC01AF0540F00FF9E5C = { - CreatedOnToolsVersion = 6.2; - }; - 323A12861E5F266B004975B8 = { - CreatedOnToolsVersion = 6.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 0CF68AB81AF0540F00FF9E5C; - productRefGroup = 0CF68AC21AF0540F00FF9E5C /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0CF68AC01AF0540F00FF9E5C /* ART */, - 323A12861E5F266B004975B8 /* ART-tvOS */, - 647647611F0BC33500C2D89B /* ART-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 0CF68ABD1AF0540F00FF9E5C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */, - 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */, - 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */, - 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */, - 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */, - 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */, - 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */, - 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */, - 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */, - 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */, - 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */, - 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */, - 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */, - 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */, - 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */, - 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */, - 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */, - 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12831E5F266B004975B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 325CF7B71E5F2ABA00AC9606 /* ARTTextManager.m in Sources */, - 325CF7B21E5F2ABA00AC9606 /* ARTGroupManager.m in Sources */, - 325CF7AF1E5F2ABA00AC9606 /* ARTPattern.m in Sources */, - 325CF7BD1E5F2ABA00AC9606 /* ARTText.m in Sources */, - 325CF7B31E5F2ABA00AC9606 /* ARTNodeManager.m in Sources */, - 325CF7B81E5F2ABA00AC9606 /* ARTGroup.m in Sources */, - 325CF7B41E5F2ABA00AC9606 /* ARTRenderableManager.m in Sources */, - 325CF7BC1E5F2ABA00AC9606 /* ARTSurfaceView.m in Sources */, - 325CF7B01E5F2ABA00AC9606 /* ARTRadialGradient.m in Sources */, - 325CF7B61E5F2ABA00AC9606 /* ARTSurfaceViewManager.m in Sources */, - 325CF7BB1E5F2ABA00AC9606 /* ARTShape.m in Sources */, - 325CF7BA1E5F2ABA00AC9606 /* ARTRenderable.m in Sources */, - 325CF7BE1E5F2ABA00AC9606 /* RCTConvert+ART.m in Sources */, - 325CF7B91E5F2ABA00AC9606 /* ARTNode.m in Sources */, - 325CF7B11E5F2ABA00AC9606 /* ARTSolidColor.m in Sources */, - 325CF7AE1E5F2ABA00AC9606 /* ARTLinearGradient.m in Sources */, - 325CF7AD1E5F2ABA00AC9606 /* ARTBrush.m in Sources */, - 325CF7B51E5F2ABA00AC9606 /* ARTShapeManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 647647621F0BC33500C2D89B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 647647631F0BC33500C2D89B /* ARTTextManager.m in Sources */, - 647647641F0BC33500C2D89B /* ARTGroupManager.m in Sources */, - 647647651F0BC33500C2D89B /* ARTPattern.m in Sources */, - 647647661F0BC33500C2D89B /* ARTText.m in Sources */, - 647647671F0BC33500C2D89B /* ARTNodeManager.m in Sources */, - 647647681F0BC33500C2D89B /* ARTGroup.m in Sources */, - 647647691F0BC33500C2D89B /* ARTRenderableManager.m in Sources */, - 6476476A1F0BC33500C2D89B /* ARTSurfaceView.m in Sources */, - 6476476B1F0BC33500C2D89B /* ARTRadialGradient.m in Sources */, - 6476476C1F0BC33500C2D89B /* ARTSurfaceViewManager.m in Sources */, - 6476476D1F0BC33500C2D89B /* ARTShape.m in Sources */, - 6476476E1F0BC33500C2D89B /* ARTRenderable.m in Sources */, - 6476476F1F0BC33500C2D89B /* RCTConvert+ART.m in Sources */, - 647647701F0BC33500C2D89B /* ARTNode.m in Sources */, - 647647711F0BC33500C2D89B /* ARTSolidColor.m in Sources */, - 647647721F0BC33500C2D89B /* ARTLinearGradient.m in Sources */, - 647647731F0BC33500C2D89B /* ARTBrush.m in Sources */, - 647647741F0BC33500C2D89B /* ARTShapeManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0CF68AD31AF0540F00FF9E5C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 0CF68AD41AF0540F00FF9E5C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 0CF68AD61AF0540F00FF9E5C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 0CF68AD71AF0540F00FF9E5C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 323A128E1E5F266B004975B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 323A128F1E5F266B004975B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 647647781F0BC33500C2D89B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 647647791F0BC33500C2D89B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0CF68AD31AF0540F00FF9E5C /* Debug */, - 0CF68AD41AF0540F00FF9E5C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0CF68AD61AF0540F00FF9E5C /* Debug */, - 0CF68AD71AF0540F00FF9E5C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 323A128D1E5F266B004975B8 /* Build configuration list for PBXNativeTarget "ART-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 323A128E1E5F266B004975B8 /* Debug */, - 323A128F1E5F266B004975B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 647647771F0BC33500C2D89B /* Build configuration list for PBXNativeTarget "ART-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 647647781F0BC33500C2D89B /* Debug */, - 647647791F0BC33500C2D89B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0CF68AB91AF0540F00FF9E5C /* Project object */; -} diff --git a/Libraries/ART/ARTGroup.m b/Libraries/ART/ARTGroup.m index 56699114f4a3f2..da4a77141f27ff 100644 --- a/Libraries/ART/ARTGroup.m +++ b/Libraries/ART/ARTGroup.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTGroup.h" +#import @implementation ARTGroup diff --git a/Libraries/ART/ARTNode.m b/Libraries/ART/ARTNode.m index be09b6400c1a05..1fdbf5176199cc 100644 --- a/Libraries/ART/ARTNode.m +++ b/Libraries/ART/ARTNode.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTNode.h" +#import -#import "ARTContainer.h" +#import @implementation ARTNode diff --git a/Libraries/ART/ARTRenderable.m b/Libraries/ART/ARTRenderable.m index 88349f8296e7b0..0d3ce7c3e48218 100644 --- a/Libraries/ART/ARTRenderable.m +++ b/Libraries/ART/ARTRenderable.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTRenderable.h" +#import @implementation ARTRenderable diff --git a/Libraries/ART/ARTShape.m b/Libraries/ART/ARTShape.m index 8a1a7d6979f3e9..6b2d983ec7c4d8 100644 --- a/Libraries/ART/ARTShape.m +++ b/Libraries/ART/ARTShape.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTShape.h" +#import @implementation ARTShape diff --git a/Libraries/ART/ARTSurfaceView.m b/Libraries/ART/ARTSurfaceView.m index 8fbbda8ace58ab..0311a1146500cc 100644 --- a/Libraries/ART/ARTSurfaceView.m +++ b/Libraries/ART/ARTSurfaceView.m @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTSurfaceView.h" +#import #import -#import "ARTNode.h" +#import @implementation ARTSurfaceView diff --git a/Libraries/ART/ARTText.m b/Libraries/ART/ARTText.m index 5bcebdf5559942..924257cabea819 100644 --- a/Libraries/ART/ARTText.m +++ b/Libraries/ART/ARTText.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTText.h" +#import #import diff --git a/Libraries/ART/Brushes/ARTBrush.m b/Libraries/ART/Brushes/ARTBrush.m index 969ad5d7edb363..9743ac57e133db 100644 --- a/Libraries/ART/Brushes/ARTBrush.m +++ b/Libraries/ART/Brushes/ARTBrush.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTBrush.h" +#import #import diff --git a/Libraries/ART/Brushes/ARTLinearGradient.m b/Libraries/ART/Brushes/ARTLinearGradient.m index 20bd1af6233b4e..da98ac007877d7 100644 --- a/Libraries/ART/Brushes/ARTLinearGradient.m +++ b/Libraries/ART/Brushes/ARTLinearGradient.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTLinearGradient.h" +#import #import diff --git a/Libraries/ART/Brushes/ARTPattern.m b/Libraries/ART/Brushes/ARTPattern.m index 70e0bd25f367b7..bb4a3844c07946 100644 --- a/Libraries/ART/Brushes/ARTPattern.m +++ b/Libraries/ART/Brushes/ARTPattern.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTPattern.h" +#import #import diff --git a/Libraries/ART/Brushes/ARTRadialGradient.m b/Libraries/ART/Brushes/ARTRadialGradient.m index c36f6ce57fc1fc..309667115e2003 100644 --- a/Libraries/ART/Brushes/ARTRadialGradient.m +++ b/Libraries/ART/Brushes/ARTRadialGradient.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTRadialGradient.h" +#import #import diff --git a/Libraries/ART/Brushes/ARTSolidColor.m b/Libraries/ART/Brushes/ARTSolidColor.m index 2ef02d43d98592..24d1d7ae70cb78 100644 --- a/Libraries/ART/Brushes/ARTSolidColor.m +++ b/Libraries/ART/Brushes/ARTSolidColor.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTSolidColor.h" +#import #import diff --git a/Libraries/ART/RCTConvert+ART.m b/Libraries/ART/RCTConvert+ART.m index 3312e319436369..c1207e60210e36 100644 --- a/Libraries/ART/RCTConvert+ART.m +++ b/Libraries/ART/RCTConvert+ART.m @@ -10,10 +10,10 @@ #import #import -#import "ARTLinearGradient.h" -#import "ARTPattern.h" -#import "ARTRadialGradient.h" -#import "ARTSolidColor.h" +#import +#import +#import +#import @implementation RCTConvert (ART) diff --git a/Libraries/ART/React-ART.podspec b/Libraries/ART/React-ART.podspec index 8cf20a6e1199a8..09b53374abfa32 100644 --- a/Libraries/ART/React-ART.podspec +++ b/Libraries/ART/React-ART.podspec @@ -26,9 +26,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "**/*.{h,m}" + s.source_files = "**/*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "ART" - s.dependency "React-Core", version + s.dependency "React-Core/ARTHeaders", version end diff --git a/Libraries/ART/ViewManagers/ARTGroupManager.m b/Libraries/ART/ViewManagers/ARTGroupManager.m index 9fb45d71bbdf4d..da035d0257aab8 100644 --- a/Libraries/ART/ViewManagers/ARTGroupManager.m +++ b/Libraries/ART/ViewManagers/ARTGroupManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTGroupManager.h" +#import -#import "ARTGroup.h" +#import #import "RCTConvert+ART.h" @implementation ARTGroupManager diff --git a/Libraries/ART/ViewManagers/ARTNodeManager.m b/Libraries/ART/ViewManagers/ARTNodeManager.m index 52bbb86c6102e6..e5d08136ee4e64 100644 --- a/Libraries/ART/ViewManagers/ARTNodeManager.m +++ b/Libraries/ART/ViewManagers/ARTNodeManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTNodeManager.h" +#import -#import "ARTNode.h" +#import @implementation ARTNodeManager diff --git a/Libraries/ART/ViewManagers/ARTRenderableManager.m b/Libraries/ART/ViewManagers/ARTRenderableManager.m index ad0264965391e5..4d0e224c49312f 100644 --- a/Libraries/ART/ViewManagers/ARTRenderableManager.m +++ b/Libraries/ART/ViewManagers/ARTRenderableManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTRenderableManager.h" +#import #import "RCTConvert+ART.h" diff --git a/Libraries/ART/ViewManagers/ARTShapeManager.m b/Libraries/ART/ViewManagers/ARTShapeManager.m index cb056e5d268877..c5e5a919adeee0 100644 --- a/Libraries/ART/ViewManagers/ARTShapeManager.m +++ b/Libraries/ART/ViewManagers/ARTShapeManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTShapeManager.h" +#import -#import "ARTShape.h" +#import #import "RCTConvert+ART.h" @implementation ARTShapeManager diff --git a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m index dd734a377955d3..1d8b155559381f 100644 --- a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m +++ b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTSurfaceViewManager.h" +#import -#import "ARTSurfaceView.h" +#import @implementation ARTSurfaceViewManager diff --git a/Libraries/ART/ViewManagers/ARTTextManager.m b/Libraries/ART/ViewManagers/ARTTextManager.m index 35c53811fd9509..9ded7cd6772352 100644 --- a/Libraries/ART/ViewManagers/ARTTextManager.m +++ b/Libraries/ART/ViewManagers/ARTTextManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "ARTTextManager.h" +#import -#import "ARTText.h" +#import #import "RCTConvert+ART.h" @implementation ARTTextManager diff --git a/Libraries/ActionSheetIOS/ActionSheetIOS.js b/Libraries/ActionSheetIOS/ActionSheetIOS.js index f8dfab12dd3d34..5484f47b0fe8dd 100644 --- a/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -9,11 +9,11 @@ */ 'use strict'; -const RCTActionSheetManager = require('../BatchedBridge/NativeModules') - .ActionSheetManager; +import RCTActionSheetManager from './NativeActionSheetManager'; const invariant = require('invariant'); const processColor = require('../StyleSheet/processColor'); +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) /** * Display action sheets and share sheets on iOS. @@ -45,7 +45,7 @@ const ActionSheetIOS = { +destructiveButtonIndex?: ?number, +cancelButtonIndex?: ?number, +anchor?: ?number, - +tintColor?: number | string, + +tintColor?: number | string | NativeOrDynamicColorType, // TODO(macOS ISS#2323203) |}, callback: (buttonIndex: number) => void, ) { @@ -54,9 +54,12 @@ const ActionSheetIOS = { 'Options must be a valid object', ); invariant(typeof callback === 'function', 'Must provide a valid callback'); + invariant(RCTActionSheetManager, "ActionSheetManager does't exist"); + + const {tintColor, ...remainingOptions} = options; RCTActionSheetManager.showActionSheetWithOptions( - {...options, tintColor: processColor(options.tintColor)}, + {...remainingOptions, tintColor: processColor(tintColor)}, callback, ); }, @@ -101,6 +104,7 @@ const ActionSheetIOS = { typeof successCallback === 'function', 'Must provide a valid successCallback', ); + invariant(RCTActionSheetManager, "ActionSheetManager does't exist"); RCTActionSheetManager.showShareActionSheetWithOptions( {...options, tintColor: processColor(options.tintColor)}, failureCallback, diff --git a/Libraries/ActionSheetIOS/NativeActionSheetManager.js b/Libraries/ActionSheetIOS/NativeActionSheetManager.js new file mode 100644 index 00000000000000..d4514083807e6e --- /dev/null +++ b/Libraries/ActionSheetIOS/NativeActionSheetManager.js @@ -0,0 +1,51 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +showActionSheetWithOptions: ( + options: {| + +title?: ?string, + +message?: ?string, + +options: ?Array, + // Supports Array as well. + +destructiveButtonIndex?: ?number, + +cancelButtonIndex?: ?number, + +anchor?: ?number, + +tintColor?: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + |}, + callback: (buttonIndex: number) => void, + ) => void; + +showShareActionSheetWithOptions: ( + options: {| + +message?: ?string, + +url?: ?string, + +subject?: ?string, + +anchor?: ?number, + +tintColor?: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + +excludedActivityTypes?: ?Array, + |}, + failureCallback: (error: {| + +domain: string, + +code: string, + +userInfo?: ?Object, + +message: string, + |}) => void, + successCallback: (completed: boolean, activityType: ?string) => void, + ) => void; +} + +export default (TurboModuleRegistry.get('ActionSheetManager'): ?Spec); diff --git a/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj b/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj deleted file mode 100644 index a810665841af7e..00000000000000 --- a/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj +++ /dev/null @@ -1,328 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */; }; - 649D87CE1F69D9BC0005AF18 /* RCTActionSheetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTActionSheet.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTActionSheetManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTActionSheetManager.m; sourceTree = ""; }; - 649D87D21F69D9BC0005AF18 /* libRCTActionSheet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTActionSheet.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */, - 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 649D87D21F69D9BC0005AF18 /* libRCTActionSheet.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* RCTActionSheet */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTActionSheet; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */; - productType = "com.apple.product-type.library.static"; - }; - 649D87CC1F69D9BC0005AF18 /* RCTActionSheet-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 649D87CF1F69D9BC0005AF18 /* Build configuration list for PBXNativeTarget "RCTActionSheet-macOS" */; - buildPhases = ( - 649D87CD1F69D9BC0005AF18 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTActionSheet-macOS"; - productName = RCTDataManager; - productReference = 649D87D21F69D9BC0005AF18 /* libRCTActionSheet.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTActionSheet */, - 649D87CC1F69D9BC0005AF18 /* RCTActionSheet-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 649D87CD1F69D9BC0005AF18 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 649D87CE1F69D9BC0005AF18 /* RCTActionSheetManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - 649D87D01F69D9BC0005AF18 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 649D87D11F69D9BC0005AF18 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 649D87CF1F69D9BC0005AF18 /* Build configuration list for PBXNativeTarget "RCTActionSheet-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 649D87D01F69D9BC0005AF18 /* Debug */, - 649D87D11F69D9BC0005AF18 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/ActionSheetIOS/RCTActionSheetManager.m b/Libraries/ActionSheetIOS/RCTActionSheetManager.m index e0e3a033807b90..88683524020142 100644 --- a/Libraries/ActionSheetIOS/RCTActionSheetManager.m +++ b/Libraries/ActionSheetIOS/RCTActionSheetManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTActionSheetManager.h" +#import #import #import @@ -233,7 +233,7 @@ - (void)presentViewController:(UIViewController *)alertController shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) { if (activityError) { failureCallback(activityError); - } else { + } else if (completed) { successCallback(@[@(completed), RCTNullIfNil(activityType)]); } }; diff --git a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec index aff1f81e67b454..75c9e8c455fa95 100644 --- a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +++ b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec @@ -27,9 +27,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTActionSheet" - s.dependency "React-Core", version + s.dependency "React-Core/RCTActionSheetHeaders", version end diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index 6d91d6901f1113..57d07fb542393f 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -10,11 +10,19 @@ 'use strict'; -const AlertMacOS = require('AlertMacOS'); // TODO(macOS ISS#2323203) -const NativeModules = require('../BatchedBridge/NativeModules'); -const RCTAlertManager = NativeModules.AlertManager; -const Platform = require('../Utilities/Platform'); +import AlertMacOS from './AlertMacOS'; // TODO(macOS ISS#2323203) +import Platform from '../Utilities/Platform'; +import NativeDialogManagerAndroid, { + type DialogOptions, +} from '../NativeModules/specs/NativeDialogManagerAndroid'; +import RCTAlertManager from './RCTAlertManager'; +export type AlertType = + | 'default' + | 'plain-text' + | 'secure-text' + | 'login-password'; +export type AlertButtonStyle = 'default' | 'cancel' | 'destructive'; export type Buttons = Array<{ text?: string, onPress?: ?Function, @@ -23,22 +31,9 @@ export type Buttons = Array<{ type Options = { cancelable?: ?boolean, - onDismiss?: ?Function, + onDismiss?: ?() => void, }; -export type AlertType = $Keys<{ - default: string, - 'plain-text': string, - 'secure-text': string, - 'login-password': string, -}>; // added export TODO(macOS ISS#2323203) - -export type AlertButtonStyle = $Keys<{ - default: string, - cancel: string, - destructive: string, -}>; - /** * Launches an alert dialog with the specified title and message. * @@ -56,55 +51,55 @@ class Alert { } else if (Platform.OS === 'macos' /* TODO[(macOS ISS#2323203) */) { AlertMacOS.prompt(title, message, buttons); // TODO](macOS ISS#2323203) } else if (Platform.OS === 'android') { - let config = { + if (!NativeDialogManagerAndroid) { + return; + } + const constants = NativeDialogManagerAndroid.getConstants(); + + const config: DialogOptions = { title: title || '', message: message || '', cancelable: false, }; - if (options) { - config = {...config, cancelable: options.cancelable}; + if (options && options.cancelable) { + config.cancelable = options.cancelable; } // At most three buttons (neutral, negative, positive). Ignore rest. // The text 'OK' should be probably localized. iOS Alert does that in native. + const defaultPositiveText = 'OK'; const validButtons: Buttons = buttons ? buttons.slice(0, 3) - : [{text: 'OK'}]; + : [{text: defaultPositiveText}]; const buttonPositive = validButtons.pop(); const buttonNegative = validButtons.pop(); const buttonNeutral = validButtons.pop(); + if (buttonNeutral) { - config = {...config, buttonNeutral: buttonNeutral.text || ''}; + config.buttonNeutral = buttonNeutral.text || ''; } if (buttonNegative) { - config = {...config, buttonNegative: buttonNegative.text || ''}; + config.buttonNegative = buttonNegative.text || ''; } if (buttonPositive) { - config = {...config, buttonPositive: buttonPositive.text || ''}; + config.buttonPositive = buttonPositive.text || defaultPositiveText; } - NativeModules.DialogManagerAndroid.showAlert( - config, - errorMessage => console.warn(errorMessage), - (action, buttonKey) => { - if (action === NativeModules.DialogManagerAndroid.buttonClicked) { - if ( - buttonKey === NativeModules.DialogManagerAndroid.buttonNeutral - ) { - buttonNeutral.onPress && buttonNeutral.onPress(); - } else if ( - buttonKey === NativeModules.DialogManagerAndroid.buttonNegative - ) { - buttonNegative.onPress && buttonNegative.onPress(); - } else if ( - buttonKey === NativeModules.DialogManagerAndroid.buttonPositive - ) { - buttonPositive.onPress && buttonPositive.onPress(); - } - } else if (action === NativeModules.DialogManagerAndroid.dismissed) { - options && options.onDismiss && options.onDismiss(); + + const onAction = (action, buttonKey) => { + if (action === constants.buttonClicked) { + if (buttonKey === constants.buttonNeutral) { + buttonNeutral.onPress && buttonNeutral.onPress(); + } else if (buttonKey === constants.buttonNegative) { + buttonNegative.onPress && buttonNegative.onPress(); + } else if (buttonKey === constants.buttonPositive) { + buttonPositive.onPress && buttonPositive.onPress(); } - }, - ); + } else if (action === constants.dismissed) { + options && options.onDismiss && options.onDismiss(); + } + }; + const onError = errorMessage => console.warn(errorMessage); + NativeDialogManagerAndroid.showAlert(config, onError, onAction); } } @@ -130,7 +125,7 @@ class Alert { { title: title || '', type: 'plain-text', - defaultValue: message, + defaultValue: message || '', }, (id, value) => { callback(value); diff --git a/Libraries/Alert/AlertMacOS.js b/Libraries/Alert/AlertMacOS.js index 97b5ff5f989f79..2535c7f52bb534 100644 --- a/Libraries/Alert/AlertMacOS.js +++ b/Libraries/Alert/AlertMacOS.js @@ -13,9 +13,9 @@ 'use strict'; -import type {AlertType, AlertButtonStyle} from 'Alert'; +import type {AlertType, AlertButtonStyle} from './Alert'; -var RCTAlertManager = require('NativeModules').AlertManager; +var RCTAlertManager = require('../BatchedBridge/NativeModules').AlertManager; /** * Array or buttons diff --git a/Libraries/Alert/NativeAlertManager.js b/Libraries/Alert/NativeAlertManager.js new file mode 100644 index 00000000000000..345fd08c6e65a2 --- /dev/null +++ b/Libraries/Alert/NativeAlertManager.js @@ -0,0 +1,34 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export type Args = {| + title?: string, + message?: string, + buttons?: Object, // TODO: have a better type + type?: string, + defaultValue?: string, + cancelButtonKey?: string, + destructiveButtonKey?: string, + keyboardType?: string, +|}; + +export interface Spec extends TurboModule { + +alertWithArgs: ( + args: Args, + callback: (id: number, value: string) => void, + ) => void; +} + +export default (TurboModuleRegistry.get('AlertManager'): ?Spec); diff --git a/Libraries/Alert/RCTAlertManager.android.js b/Libraries/Alert/RCTAlertManager.android.js index 843dec92fe47cb..43f49a94e50bb1 100644 --- a/Libraries/Alert/RCTAlertManager.android.js +++ b/Libraries/Alert/RCTAlertManager.android.js @@ -9,14 +9,18 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManagerAndroid'; function emptyCallback() {} module.exports = { alertWithArgs: function(args, callback) { // TODO(5998984): Polyfill it correctly with DialogManagerAndroid - NativeModules.DialogManagerAndroid.showAlert( + if (!NativeDialogManagerAndroid) { + return; + } + + NativeDialogManagerAndroid.showAlert( args, emptyCallback, callback || emptyCallback, diff --git a/Libraries/Alert/RCTAlertManager.ios.js b/Libraries/Alert/RCTAlertManager.ios.js index 246967358982b9..8ededddf4b463c 100644 --- a/Libraries/Alert/RCTAlertManager.ios.js +++ b/Libraries/Alert/RCTAlertManager.ios.js @@ -10,6 +10,17 @@ 'use strict'; -const RCTAlertManager = require('../BatchedBridge/NativeModules').AlertManager; +import NativeAlertManager from './NativeAlertManager'; +import type {Args} from './NativeAlertManager'; -module.exports = RCTAlertManager; +module.exports = { + alertWithArgs( + args: Args, + callback: (id: number, value: string) => void, + ): void { + if (NativeAlertManager == null) { + return; + } + NativeAlertManager.alertWithArgs(args, callback); + }, +}; diff --git a/Libraries/Alert/RCTAlertManager.macos.js b/Libraries/Alert/RCTAlertManager.macos.js index 9e620057f70bac..c59417d2bb3b7f 100644 --- a/Libraries/Alert/RCTAlertManager.macos.js +++ b/Libraries/Alert/RCTAlertManager.macos.js @@ -12,6 +12,6 @@ 'use strict'; -var RCTAlertManager = require('NativeModules').AlertManager; +var RCTAlertManager = require('../BatchedBridge/NativeModules').AlertManager; module.exports = RCTAlertManager; diff --git a/Libraries/Animated/release/.gitignore b/Libraries/Animated/release/.gitignore index 4c422f3bc92283..3d2bc62692c4b0 100644 --- a/Libraries/Animated/release/.gitignore +++ b/Libraries/Animated/release/.gitignore @@ -1,3 +1,2 @@ -/lib/ /dist/ /node_modules/ diff --git a/Libraries/Animated/release/package.json b/Libraries/Animated/release/package.json index ec7fec05fd599f..0541b32e6d1cb0 100644 --- a/Libraries/Animated/release/package.json +++ b/Libraries/Animated/release/package.json @@ -30,5 +30,8 @@ "run-sequence": "^1.1.2", "webpack": "1.11.0", "webpack-stream": "^2.1.0" - } + }, + "beachball": { + "shouldPublish": false + } } diff --git a/Libraries/Animated/src/Animated.js b/Libraries/Animated/src/Animated.js index 594a1b82fc1451..a14bf98f4c9e44 100644 --- a/Libraries/Animated/src/Animated.js +++ b/Libraries/Animated/src/Animated.js @@ -12,28 +12,31 @@ import Platform from '../../Utilities/Platform'; -const AnimatedImplementation = Platform.isTesting - ? require('./AnimatedMock') - : require('./AnimatedImplementation'); +const AnimatedMock = require('./AnimatedMock'); +const AnimatedImplementation = require('./AnimatedImplementation'); + +const Animated = ((Platform.isTesting + ? AnimatedMock + : AnimatedImplementation): typeof AnimatedMock); module.exports = { - get FlatList() { + get FlatList(): any { return require('./components/AnimatedFlatList'); }, - get Image() { + get Image(): any { return require('./components/AnimatedImage'); }, - get ScrollView() { + get ScrollView(): any { return require('./components/AnimatedScrollView'); }, - get SectionList() { + get SectionList(): any { return require('./components/AnimatedSectionList'); }, - get Text() { + get Text(): any { return require('./components/AnimatedText'); }, - get View() { + get View(): any { return require('./components/AnimatedView'); }, - ...AnimatedImplementation, + ...Animated, }; diff --git a/Libraries/Animated/src/AnimatedEvent.js b/Libraries/Animated/src/AnimatedEvent.js index e06918ce5262e9..8e8c9c24068ce9 100644 --- a/Libraries/Animated/src/AnimatedEvent.js +++ b/Libraries/Animated/src/AnimatedEvent.js @@ -14,6 +14,7 @@ const NativeAnimatedHelper = require('./NativeAnimatedHelper'); const ReactNative = require('../../Renderer/shims/ReactNative'); const invariant = require('invariant'); + const {shouldUseNativeDriver} = require('./NativeAnimatedHelper'); export type Mapping = {[key: string]: Mapping} | AnimatedValue; @@ -26,7 +27,7 @@ function attachNativeEvent( viewRef: any, eventName: string, argMapping: Array, -) { +): $TEMPORARY$object<{|detach: () => void|}> { // Find animated values in `argMapping` and create an array representing their // key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x']. const eventMappings = []; @@ -130,7 +131,7 @@ class AnimatedEvent { this._attachedEvent && this._attachedEvent.detach(); } - __getHandler() { + __getHandler(): any | ((...args: any) => void) { if (this.__isNative) { return this._callListeners; } diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 6195d9be811546..5ab98a5ce89ad6 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -403,7 +403,12 @@ const parallel = function( const delay = function(time: number): CompositeAnimation { // Would be nice to make a specialized implementation - return timing(new AnimatedValue(0), {toValue: 0, delay: time, duration: 0}); + return timing(new AnimatedValue(0), { + toValue: 0, + delay: time, + duration: 0, + useNativeDriver: false, + }); }; const stagger = function( diff --git a/Libraries/Animated/src/AnimatedMock.js b/Libraries/Animated/src/AnimatedMock.js index 2800560f5926b7..aed90a5ad05c19 100644 --- a/Libraries/Animated/src/AnimatedMock.js +++ b/Libraries/Animated/src/AnimatedMock.js @@ -110,7 +110,7 @@ const stagger = function( return emptyAnimation; }; -type LoopAnimationConfig = {iterations: number}; +type LoopAnimationConfig = {iterations: number, resetBeforeIteration?: boolean}; const loop = function( animation: CompositeAnimation, diff --git a/Libraries/Animated/src/AnimatedWeb.js b/Libraries/Animated/src/AnimatedWeb.js index 995db03f67b2b6..648c8a0bcccf64 100644 --- a/Libraries/Animated/src/AnimatedWeb.js +++ b/Libraries/Animated/src/AnimatedWeb.js @@ -14,7 +14,7 @@ const AnimatedImplementation = require('./AnimatedImplementation'); module.exports = { ...AnimatedImplementation, - div: AnimatedImplementation.createAnimatedComponent('div'), - span: AnimatedImplementation.createAnimatedComponent('span'), - img: AnimatedImplementation.createAnimatedComponent('img'), + div: (AnimatedImplementation.createAnimatedComponent('div'): $FlowFixMe), + span: (AnimatedImplementation.createAnimatedComponent('span'): $FlowFixMe), + img: (AnimatedImplementation.createAnimatedComponent('img'): $FlowFixMe), }; diff --git a/Libraries/Animated/src/Easing.js b/Libraries/Animated/src/Easing.js index 423c250fab4935..253a3e785aaa8a 100644 --- a/Libraries/Animated/src/Easing.js +++ b/Libraries/Animated/src/Easing.js @@ -61,14 +61,14 @@ class Easing { /** * A stepping function, returns 1 for any positive value of `n`. */ - static step0(n: number) { + static step0(n: number): number { return n > 0 ? 1 : 0; } /** * A stepping function, returns 1 if `n` is greater than or equal to 1. */ - static step1(n: number) { + static step1(n: number): number { return n >= 1 ? 1 : 0; } @@ -78,7 +78,7 @@ class Easing { * * http://cubic-bezier.com/#0,0,1,1 */ - static linear(t: number) { + static linear(t: number): number { return t; } @@ -101,7 +101,7 @@ class Easing { * * http://easings.net/#easeInQuad */ - static quad(t: number) { + static quad(t: number): number { return t * t; } @@ -111,7 +111,7 @@ class Easing { * * http://easings.net/#easeInCubic */ - static cubic(t: number) { + static cubic(t: number): number { return t * t * t; } @@ -121,7 +121,7 @@ class Easing { * n = 4: http://easings.net/#easeInQuart * n = 5: http://easings.net/#easeInQuint */ - static poly(n: number) { + static poly(n: number): (t: number) => number { return (t: number) => Math.pow(t, n); } @@ -130,7 +130,7 @@ class Easing { * * http://easings.net/#easeInSine */ - static sin(t: number) { + static sin(t: number): number { return 1 - Math.cos((t * Math.PI) / 2); } @@ -139,7 +139,7 @@ class Easing { * * http://easings.net/#easeInCirc */ - static circle(t: number) { + static circle(t: number): number { return 1 - Math.sqrt(1 - t * t); } @@ -148,7 +148,7 @@ class Easing { * * http://easings.net/#easeInExpo */ - static exp(t: number) { + static exp(t: number): number { return Math.pow(2, 10 * (t - 1)); } diff --git a/Libraries/Animated/src/NativeAnimatedHelper.js b/Libraries/Animated/src/NativeAnimatedHelper.js index 05bd6e37a8a4d2..238a8fd2ba9d71 100644 --- a/Libraries/Animated/src/NativeAnimatedHelper.js +++ b/Libraries/Animated/src/NativeAnimatedHelper.js @@ -4,67 +4,82 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict-local * @format */ 'use strict'; -const NativeAnimatedModule = require('../../BatchedBridge/NativeModules') - .NativeAnimatedModule; -const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter'); - -const invariant = require('invariant'); - -import type {AnimationConfig} from './animations/Animation'; +import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter'; import type {EventConfig} from './AnimatedEvent'; +import NativeAnimatedModule from './NativeAnimatedModule'; +import type { + EventMapping, + AnimatedNodeConfig, + AnimatingNodeConfig, +} from './NativeAnimatedModule'; +import type {AnimationConfig, EndCallback} from './animations/Animation'; +import type {InterpolationConfigType} from './nodes/AnimatedInterpolation'; +import invariant from 'invariant'; let __nativeAnimatedNodeTagCount = 1; /* used for animated nodes */ let __nativeAnimationIdCount = 1; /* used for started animations */ -type EndResult = {finished: boolean}; -type EndCallback = (result: EndResult) => void; -type EventMapping = { - nativeEventPath: Array, - animatedValueTag: ?number, -}; - let nativeEventEmitter; +let queueConnections = false; +let queue = []; + /** - * Simple wrappers around NativeAnimatedModule to provide flow and autocmplete support for + * Simple wrappers around NativeAnimatedModule to provide flow and autocomplete support for * the native module methods */ const API = { - createAnimatedNode: function(tag: ?number, config: Object): void { - assertNativeAnimatedModule(); + enableQueue: function(): void { + queueConnections = true; + }, + disableQueue: function(): void { + invariant(NativeAnimatedModule, 'Native animated module is not available'); + queueConnections = false; + for (let q = 0, l = queue.length; q < l; q++) { + const args = queue[q]; + NativeAnimatedModule.connectAnimatedNodes(args[0], args[1]); + } + queue.length = 0; + }, + createAnimatedNode: function(tag: ?number, config: AnimatedNodeConfig): void { + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.createAnimatedNode(tag, config); }, startListeningToAnimatedNodeValue: function(tag: ?number) { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.startListeningToAnimatedNodeValue(tag); }, stopListeningToAnimatedNodeValue: function(tag: ?number) { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.stopListeningToAnimatedNodeValue(tag); }, connectAnimatedNodes: function(parentTag: ?number, childTag: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); + if (queueConnections) { + queue.push([parentTag, childTag]); + return; + } NativeAnimatedModule.connectAnimatedNodes(parentTag, childTag); }, disconnectAnimatedNodes: function( parentTag: ?number, childTag: ?number, ): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.disconnectAnimatedNodes(parentTag, childTag); }, startAnimatingNode: function( animationId: ?number, nodeTag: ?number, - config: Object, + config: AnimatingNodeConfig, endCallback: EndCallback, ): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.startAnimatingNode( animationId, nodeTag, @@ -73,41 +88,41 @@ const API = { ); }, stopAnimation: function(animationId: ?number) { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.stopAnimation(animationId); }, setAnimatedNodeValue: function(nodeTag: ?number, value: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.setAnimatedNodeValue(nodeTag, value); }, setAnimatedNodeOffset: function(nodeTag: ?number, offset: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.setAnimatedNodeOffset(nodeTag, offset); }, flattenAnimatedNodeOffset: function(nodeTag: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.flattenAnimatedNodeOffset(nodeTag); }, extractAnimatedNodeOffset: function(nodeTag: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.extractAnimatedNodeOffset(nodeTag); }, connectAnimatedNodeToView: function( nodeTag: ?number, viewTag: ?number, ): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.connectAnimatedNodeToView(nodeTag, viewTag); }, disconnectAnimatedNodeFromView: function( nodeTag: ?number, viewTag: ?number, ): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.disconnectAnimatedNodeFromView(nodeTag, viewTag); }, dropAnimatedNode: function(tag: ?number): void { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.dropAnimatedNode(tag); }, addAnimatedEventToView: function( @@ -115,7 +130,7 @@ const API = { eventName: string, eventMapping: EventMapping, ) { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.addAnimatedEventToView( viewTag, eventName, @@ -127,7 +142,7 @@ const API = { eventName: string, animatedNodeTag: ?number, ) { - assertNativeAnimatedModule(); + invariant(NativeAnimatedModule, 'Native animated module is not available'); NativeAnimatedModule.removeAnimatedEventFromView( viewTag, eventName, @@ -174,6 +189,7 @@ const TRANSFORM_WHITELIST = { rotate: true, rotateX: true, rotateY: true, + rotateZ: true, perspective: true, }; @@ -197,7 +213,12 @@ function addWhitelistedInterpolationParam(param: string): void { SUPPORTED_INTERPOLATION_PARAMS[param] = true; } -function validateTransform(configs: Array): void { +function validateTransform( + configs: Array< + | {type: 'animated', property: string, nodeTag: ?number} + | {type: 'static', property: string, value: number | string}, + >, +): void { configs.forEach(config => { if (!TRANSFORM_WHITELIST.hasOwnProperty(config.property)) { throw new Error( @@ -209,7 +230,7 @@ function validateTransform(configs: Array): void { }); } -function validateStyles(styles: Object): void { +function validateStyles(styles: {[key: string]: ?number}): void { for (const key in styles) { if (!STYLES_WHITELIST.hasOwnProperty(key)) { throw new Error( @@ -219,7 +240,7 @@ function validateStyles(styles: Object): void { } } -function validateInterpolation(config: Object): void { +function validateInterpolation(config: InterpolationConfigType): void { for (const key in config) { if (!SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(key)) { throw new Error( @@ -244,7 +265,7 @@ function assertNativeAnimatedModule(): void { let _warnedMissingNativeAnimated = false; function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean { - if (config.useNativeDriver && !NativeAnimatedModule) { + if (config.useNativeDriver === true && !NativeAnimatedModule) { if (!_warnedMissingNativeAnimated) { console.warn( 'Animated: `useNativeDriver` is not supported because the native ' + @@ -261,7 +282,7 @@ function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean { return config.useNativeDriver || false; } -function transformDataType(value: any): number { +function transformDataType(value: number | string): number | string { // Change the string type to number type so we can reuse the same logic in // iOS and Android platform if (typeof value !== 'string') { @@ -272,8 +293,7 @@ function transformDataType(value: any): number { const radians = (degrees * Math.PI) / 180.0; return radians; } else { - // Assume radians - return parseFloat(value) || 0; + return value; } } @@ -290,7 +310,8 @@ module.exports = { assertNativeAnimatedModule, shouldUseNativeDriver, transformDataType, - get nativeEventEmitter() { + // $FlowExpectedError - unsafe getter lint suppresion + get nativeEventEmitter(): NativeEventEmitter { if (!nativeEventEmitter) { nativeEventEmitter = new NativeEventEmitter(NativeAnimatedModule); } diff --git a/Libraries/Animated/src/NativeAnimatedModule.js b/Libraries/Animated/src/NativeAnimatedModule.js new file mode 100644 index 00000000000000..7fcdfc4d871361 --- /dev/null +++ b/Libraries/Animated/src/NativeAnimatedModule.js @@ -0,0 +1,70 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +type EndResult = {finished: boolean}; +type EndCallback = (result: EndResult) => void; + +export type EventMapping = {| + nativeEventPath: Array, + animatedValueTag: ?number, +|}; + +export type AnimatedNodeConfig = {| + // TODO: Type this with better enums. + type: string, +|}; + +export type AnimatingNodeConfig = {| + // TODO: Type this with better enums. + type: string, +|}; + +export interface Spec extends TurboModule { + +createAnimatedNode: (tag: ?number, config: AnimatedNodeConfig) => void; + +startListeningToAnimatedNodeValue: (tag: ?number) => void; + +stopListeningToAnimatedNodeValue: (tag: ?number) => void; + +connectAnimatedNodes: (parentTag: ?number, childTag: ?number) => void; + +disconnectAnimatedNodes: (parentTag: ?number, childTag: ?number) => void; + +startAnimatingNode: ( + animationId: ?number, + nodeTag: ?number, + config: AnimatingNodeConfig, + endCallback: EndCallback, + ) => void; + +stopAnimation: (animationId: ?number) => void; + +setAnimatedNodeValue: (nodeTag: ?number, value: ?number) => void; + +setAnimatedNodeOffset: (nodeTag: ?number, offset: ?number) => void; + +flattenAnimatedNodeOffset: (nodeTag: ?number) => void; + +extractAnimatedNodeOffset: (nodeTag: ?number) => void; + +connectAnimatedNodeToView: (nodeTag: ?number, viewTag: ?number) => void; + +disconnectAnimatedNodeFromView: (nodeTag: ?number, viewTag: ?number) => void; + +dropAnimatedNode: (tag: ?number) => void; + +addAnimatedEventToView: ( + viewTag: ?number, + eventName: string, + eventMapping: EventMapping, + ) => void; + +removeAnimatedEventFromView: ( + viewTag: ?number, + eventName: string, + animatedNodeTag: ?number, + ) => void; + + // Events + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get('NativeAnimatedModule'): ?Spec); diff --git a/Libraries/Animated/src/__tests__/Animated-test.js b/Libraries/Animated/src/__tests__/Animated-test.js index 11c1ad922efede..4e74cb6200e3c0 100644 --- a/Libraries/Animated/src/__tests__/Animated-test.js +++ b/Libraries/Animated/src/__tests__/Animated-test.js @@ -10,6 +10,15 @@ 'use strict'; +jest.mock('../../../BatchedBridge/NativeModules', () => ({ + NativeAnimatedModule: {}, + PlatformConstants: { + getConstants() { + return {}; + }, + }, +})); + let Animated = require('../Animated'); describe('Animated tests', () => { beforeEach(() => { diff --git a/Libraries/Animated/src/__tests__/AnimatedNative-test.js b/Libraries/Animated/src/__tests__/AnimatedNative-test.js index e90f2341b7d90c..09b087ce5d5be0 100644 --- a/Libraries/Animated/src/__tests__/AnimatedNative-test.js +++ b/Libraries/Animated/src/__tests__/AnimatedNative-test.js @@ -22,9 +22,15 @@ jest .setMock('../../../Lists/FlatList', ClassComponentMock) .setMock('../../../Lists/SectionList', ClassComponentMock) .setMock('react', {Component: class {}}) - .setMock('../../../BatchedBridge/NativeModules', { + .mock('../../../BatchedBridge/NativeModules', () => ({ NativeAnimatedModule: {}, - }) + PlatformConstants: { + getConstants() { + return {}; + }, + }, + })) + .mock('../NativeAnimatedModule') .mock('../../../EventEmitter/NativeEventEmitter') // findNodeHandle is imported from ReactNative so mock that whole module. .setMock('../../../Renderer/shims/ReactNative', {findNodeHandle: () => 1}); @@ -43,8 +49,7 @@ function createAndMountComponent(ComponentClass, props) { } describe('Native Animated', () => { - const nativeAnimatedModule = require('../../../BatchedBridge/NativeModules') - .NativeAnimatedModule; + const nativeAnimatedModule = require('../NativeAnimatedModule').default; beforeEach(() => { nativeAnimatedModule.addAnimatedEventToView = jest.fn(); diff --git a/Libraries/Animated/src/__tests__/TimingAnimation-test.js b/Libraries/Animated/src/__tests__/TimingAnimation-test.js new file mode 100644 index 00000000000000..d63f44b3928514 --- /dev/null +++ b/Libraries/Animated/src/__tests__/TimingAnimation-test.js @@ -0,0 +1,32 @@ +/** + * 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. + * + * @format + * @emails oncall+react_native + */ + +'use strict'; + +const TimingAnimation = require('../animations/TimingAnimation'); + +describe('Timing Animation', () => { + it('should return array of 61 items', () => { + const timingAnim = new TimingAnimation({duration: 1000}); + const config = timingAnim.__getNativeAnimationConfig(); + + expect(config.frames.length).toBe(61); + expect(config.frames[60]).toBe(1); + expect(config.frames[59]).toBeLessThan(1); + }); + + it('should cope with zero duration', () => { + const timingAnim = new TimingAnimation({duration: 0}); + const config = timingAnim.__getNativeAnimationConfig(); + + expect(config.frames.length).toBe(1); + expect(config.frames[0]).toBe(1); + }); +}); diff --git a/Libraries/Animated/src/__tests__/bezier-test.js b/Libraries/Animated/src/__tests__/bezier-test.js index e70026dca8d614..bab93c372a408a 100644 --- a/Libraries/Animated/src/__tests__/bezier-test.js +++ b/Libraries/Animated/src/__tests__/bezier-test.js @@ -115,7 +115,7 @@ describe('bezier', function() { }); }); }); - describe('symetric curves', function() { + describe('symmetric curves', function() { it('should have a central value y~=0.5 at x=0.5', function() { repeat(10)(function() { const a = Math.random(), diff --git a/Libraries/Animated/src/animations/Animation.js b/Libraries/Animated/src/animations/Animation.js index 32ccb1e72f0832..cb175e1ecbf2ee 100644 --- a/Libraries/Animated/src/animations/Animation.js +++ b/Libraries/Animated/src/animations/Animation.js @@ -18,7 +18,7 @@ export type EndCallback = (result: EndResult) => void; export type AnimationConfig = { isInteraction?: boolean, - useNativeDriver?: boolean, + useNativeDriver: boolean, onComplete?: ?EndCallback, iterations?: number, }; @@ -56,7 +56,9 @@ class Animation { onEnd && onEnd(result); } __startNativeAnimation(animatedValue: AnimatedValue): void { + NativeAnimatedHelper.API.enableQueue(); animatedValue.__makeNative(); + NativeAnimatedHelper.API.disableQueue(); this.__nativeId = NativeAnimatedHelper.generateNewAnimationId(); NativeAnimatedHelper.API.startAnimatingNode( this.__nativeId, diff --git a/Libraries/Animated/src/animations/DecayAnimation.js b/Libraries/Animated/src/animations/DecayAnimation.js index a79f9c3ed42912..27ec5d8dd51c54 100644 --- a/Libraries/Animated/src/animations/DecayAnimation.js +++ b/Libraries/Animated/src/animations/DecayAnimation.js @@ -13,8 +13,8 @@ const Animation = require('./Animation'); const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); -import type {AnimationConfig, EndCallback} from './Animation'; import type AnimatedValue from '../nodes/AnimatedValue'; +import type {AnimationConfig, EndCallback} from './Animation'; export type DecayAnimationConfig = AnimationConfig & { velocity: number | {x: number, y: number}, @@ -45,7 +45,12 @@ class DecayAnimation extends Animation { this.__iterations = config.iterations ?? 1; } - __getNativeAnimationConfig() { + __getNativeAnimationConfig(): $TEMPORARY$object<{| + deceleration: number, + iterations: number, + type: $TEMPORARY$string<'decay'>, + velocity: number, + |}> { return { type: 'decay', deceleration: this._deceleration, diff --git a/Libraries/Animated/src/animations/SpringAnimation.js b/Libraries/Animated/src/animations/SpringAnimation.js index a7ffac480ac688..9a16bde6b71c5e 100644 --- a/Libraries/Animated/src/animations/SpringAnimation.js +++ b/Libraries/Animated/src/animations/SpringAnimation.js @@ -15,6 +15,7 @@ const Animation = require('./Animation'); const SpringConfig = require('../SpringConfig'); const invariant = require('invariant'); + const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); import type {AnimationConfig, EndCallback} from './Animation'; @@ -137,7 +138,18 @@ class SpringAnimation extends Animation { invariant(this._mass > 0, 'Mass value must be greater than 0'); } - __getNativeAnimationConfig() { + __getNativeAnimationConfig(): $TEMPORARY$object<{| + damping: number, + initialVelocity: number, + iterations: number, + mass: number, + overshootClamping: boolean, + restDisplacementThreshold: number, + restSpeedThreshold: number, + stiffness: number, + toValue: any, + type: $TEMPORARY$string<'spring'>, + |}> { return { type: 'spring', overshootClamping: this._overshootClamping, diff --git a/Libraries/Animated/src/animations/TimingAnimation.js b/Libraries/Animated/src/animations/TimingAnimation.js index b73794f1333e44..8458ef9712f678 100644 --- a/Libraries/Animated/src/animations/TimingAnimation.js +++ b/Libraries/Animated/src/animations/TimingAnimation.js @@ -66,8 +66,9 @@ class TimingAnimation extends Animation { __getNativeAnimationConfig(): any { const frameDuration = 1000.0 / 60.0; const frames = []; - for (let dt = 0.0; dt < this._duration; dt += frameDuration) { - frames.push(this._easing(dt / this._duration)); + const numFrames = Math.round(this._duration / frameDuration); + for (let frame = 0; frame < numFrames; frame++) { + frames.push(this._easing(frame / numFrames)); } frames.push(this._easing(1)); return { diff --git a/Libraries/Animated/src/bezier.js b/Libraries/Animated/src/bezier.js index 727872b848aacd..94fe109d784677 100644 --- a/Libraries/Animated/src/bezier.js +++ b/Libraries/Animated/src/bezier.js @@ -84,7 +84,7 @@ module.exports = function bezier( mY1: number, mX2: number, mY2: number, -) { +): (x: number) => number { if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) { throw new Error('bezier x values must be in [0, 1] range'); } diff --git a/Libraries/Animated/src/components/AnimatedFlatList.js b/Libraries/Animated/src/components/AnimatedFlatList.js index 9e91e84d9a18d1..2cc3704df4f2e0 100644 --- a/Libraries/Animated/src/components/AnimatedFlatList.js +++ b/Libraries/Animated/src/components/AnimatedFlatList.js @@ -14,6 +14,6 @@ const FlatList = require('../../../Lists/FlatList'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(FlatList, { +module.exports = (createAnimatedComponent(FlatList, { scrollEventThrottle: 0.0001, -}); +}): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedImage.js b/Libraries/Animated/src/components/AnimatedImage.js index 9f5bad944b6eb1..89fee4d29ea8da 100644 --- a/Libraries/Animated/src/components/AnimatedImage.js +++ b/Libraries/Animated/src/components/AnimatedImage.js @@ -14,4 +14,4 @@ const Image = require('../../../Image/Image'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(Image); +module.exports = (createAnimatedComponent(Image): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedScrollView.js b/Libraries/Animated/src/components/AnimatedScrollView.js index 16169dcefe8b2f..5913fb939a159a 100644 --- a/Libraries/Animated/src/components/AnimatedScrollView.js +++ b/Libraries/Animated/src/components/AnimatedScrollView.js @@ -14,6 +14,6 @@ const ScrollView = require('../../../Components/ScrollView/ScrollView'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(ScrollView, { +module.exports = (createAnimatedComponent(ScrollView, { scrollEventThrottle: 0.0001, -}); +}): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedSectionList.js b/Libraries/Animated/src/components/AnimatedSectionList.js index 115e48d443cc3f..6a4a6389fbf668 100644 --- a/Libraries/Animated/src/components/AnimatedSectionList.js +++ b/Libraries/Animated/src/components/AnimatedSectionList.js @@ -14,6 +14,6 @@ const SectionList = require('../../../Lists/SectionList'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(SectionList, { +module.exports = (createAnimatedComponent(SectionList, { scrollEventThrottle: 0.0001, -}); +}): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedText.js b/Libraries/Animated/src/components/AnimatedText.js index 73f9f5e3d68b66..81b016cca18d41 100644 --- a/Libraries/Animated/src/components/AnimatedText.js +++ b/Libraries/Animated/src/components/AnimatedText.js @@ -14,4 +14,4 @@ const Text = require('../../../Text/Text'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(Text); +module.exports = (createAnimatedComponent(Text): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedView.js b/Libraries/Animated/src/components/AnimatedView.js index 6958289d509187..7684dbf3f50da7 100644 --- a/Libraries/Animated/src/components/AnimatedView.js +++ b/Libraries/Animated/src/components/AnimatedView.js @@ -14,4 +14,4 @@ const View = require('../../../Components/View/View'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = createAnimatedComponent(View); +module.exports = (createAnimatedComponent(View): $FlowFixMe); diff --git a/Libraries/Animated/src/createAnimatedComponent.js b/Libraries/Animated/src/createAnimatedComponent.js index d31a12976da399..a6013a716f6223 100644 --- a/Libraries/Animated/src/createAnimatedComponent.js +++ b/Libraries/Animated/src/createAnimatedComponent.js @@ -63,7 +63,7 @@ function createAnimatedComponent(Component: any, defaultProps: any): any { _attachNativeEvents() { // Make sure to get the scrollable node for components that implement // `ScrollResponder.Mixin`. - const scrollableNode = this._component.getScrollableNode + const scrollableNode = this._component?.getScrollableNode ? this._component.getScrollableNode() : this._component; diff --git a/Libraries/Animated/src/nodes/AnimatedInterpolation.js b/Libraries/Animated/src/nodes/AnimatedInterpolation.js index 29b7791b341f66..f13d3fe9bab5bb 100644 --- a/Libraries/Animated/src/nodes/AnimatedInterpolation.js +++ b/Libraries/Animated/src/nodes/AnimatedInterpolation.js @@ -184,7 +184,7 @@ function colorToRgba(input: string): string { return `rgba(${r}, ${g}, ${b}, ${a})`; } -const stringShapeRegex = /[0-9\.-]+/g; +const stringShapeRegex = /[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g; /** * Supports string shapes by extracting numbers so new values can be computed, @@ -245,10 +245,11 @@ function createInterpolationFromStringOutputRange( // -> // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' return outputRange[0].replace(stringShapeRegex, () => { - const val = +interpolations[i++](input); - const rounded = - shouldRound && i < 4 ? Math.round(val) : Math.round(val * 1000) / 1000; - return String(rounded); + let val = +interpolations[i++](input); + if (shouldRound) { + val = i < 4 ? Math.round(val) : Math.round(val * 1000) / 1000; + } + return String(val); }); }; } @@ -309,7 +310,9 @@ function checkInfiniteRange(name: string, arr: Array) { class AnimatedInterpolation extends AnimatedWithChildren { // Export for testing. - static __createInterpolation = createInterpolation; + static __createInterpolation: ( + config: InterpolationConfigType, + ) => (input: number) => number | string = createInterpolation; _parent: AnimatedNode; _config: InterpolationConfigType; @@ -349,7 +352,7 @@ class AnimatedInterpolation extends AnimatedWithChildren { super.__detach(); } - __transformDataType(range: Array) { + __transformDataType(range: Array): Array { return range.map(NativeAnimatedHelper.transformDataType); } diff --git a/Libraries/Animated/src/nodes/AnimatedNode.js b/Libraries/Animated/src/nodes/AnimatedNode.js index b90b4c185b8ec6..f6bb39648a80fe 100644 --- a/Libraries/Animated/src/nodes/AnimatedNode.js +++ b/Libraries/Animated/src/nodes/AnimatedNode.js @@ -157,11 +157,11 @@ class AnimatedNode { ); if (this.__nativeTag == null) { const nativeTag: ?number = NativeAnimatedHelper.generateNewNodeTag(); + this.__nativeTag = nativeTag; NativeAnimatedHelper.API.createAnimatedNode( nativeTag, this.__getNativeConfig(), ); - this.__nativeTag = nativeTag; this.__shouldUpdateListenersForNewNativeTag = true; } return this.__nativeTag; diff --git a/Libraries/Animated/src/nodes/AnimatedProps.js b/Libraries/Animated/src/nodes/AnimatedProps.js index 23866ed4356aff..d6914d23bd8a31 100644 --- a/Libraries/Animated/src/nodes/AnimatedProps.js +++ b/Libraries/Animated/src/nodes/AnimatedProps.js @@ -151,6 +151,7 @@ class AnimatedProps extends AnimatedNode { for (const propKey in this._props) { const value = this._props[propKey]; if (value instanceof AnimatedNode) { + value.__makeNative(); propsConfig[propKey] = value.__getNativeTag(); } } diff --git a/Libraries/Animated/src/nodes/AnimatedStyle.js b/Libraries/Animated/src/nodes/AnimatedStyle.js index 4830b2e8d0c1a4..1219bda5962fa4 100644 --- a/Libraries/Animated/src/nodes/AnimatedStyle.js +++ b/Libraries/Animated/src/nodes/AnimatedStyle.js @@ -108,7 +108,9 @@ class AnimatedStyle extends AnimatedWithChildren { const styleConfig = {}; for (const styleKey in this._style) { if (this._style[styleKey] instanceof AnimatedNode) { - styleConfig[styleKey] = this._style[styleKey].__getNativeTag(); + const style = this._style[styleKey]; + style.__makeNative(); + styleConfig[styleKey] = style.__getNativeTag(); } // Non-animated styles are set using `setNativeProps`, no need // to pass those as a part of the node config diff --git a/Libraries/AppState/AppState.js b/Libraries/AppState/AppState.js index 24b7da77d01481..e848978a106894 100644 --- a/Libraries/AppState/AppState.js +++ b/Libraries/AppState/AppState.js @@ -25,6 +25,7 @@ const invariant = require('invariant'); */ class AppState extends NativeEventEmitter { _eventHandlers: Object; + _supportedEvents = ['change', 'memoryWarning', 'blur', 'focus']; currentState: ?string; isAvailable: boolean; @@ -32,10 +33,10 @@ class AppState extends NativeEventEmitter { super(NativeAppState); this.isAvailable = true; - this._eventHandlers = { - change: new Map(), - memoryWarning: new Map(), - }; + this._eventHandlers = this._supportedEvents.reduce((handlers, key) => { + handlers[key] = new Map(); + return handlers; + }, {}); this.currentState = NativeAppState.getConstants().initialAppState; @@ -75,22 +76,43 @@ class AppState extends NativeEventEmitter { */ addEventListener(type: string, handler: Function) { invariant( - ['change', 'memoryWarning'].indexOf(type) !== -1, + this._supportedEvents.indexOf(type) !== -1, 'Trying to subscribe to unknown event: "%s"', type, ); - if (type === 'change') { - this._eventHandlers[type].set( - handler, - this.addListener('appStateDidChange', appStateData => { - handler(appStateData.app_state); - }), - ); - } else if (type === 'memoryWarning') { - this._eventHandlers[type].set( - handler, - this.addListener('memoryWarning', handler), - ); + + switch (type) { + case 'change': { + this._eventHandlers[type].set( + handler, + this.addListener('appStateDidChange', appStateData => { + handler(appStateData.app_state); + }), + ); + break; + } + case 'memoryWarning': { + this._eventHandlers[type].set( + handler, + this.addListener('memoryWarning', handler), + ); + break; + } + + case 'blur': + case 'focus': { + this._eventHandlers[type].set( + handler, + this.addListener('appStateFocusChange', hasFocus => { + if (type === 'blur' && !hasFocus) { + handler(); + } + if (type === 'focus' && hasFocus) { + handler(); + } + }), + ); + } } } @@ -101,7 +123,7 @@ class AppState extends NativeEventEmitter { */ removeEventListener(type: string, handler: Function) { invariant( - ['change', 'memoryWarning'].indexOf(type) !== -1, + this._supportedEvents.indexOf(type) !== -1, 'Trying to remove listener for unknown event: "%s"', type, ); diff --git a/Libraries/AppState/NativeAppState.js b/Libraries/AppState/NativeAppState.js index d5d13a392acb94..1146bf588dbbb6 100644 --- a/Libraries/AppState/NativeAppState.js +++ b/Libraries/AppState/NativeAppState.js @@ -10,8 +10,8 @@ 'use strict'; -import type {TurboModule} from 'RCTExport'; -import * as TurboModuleRegistry from 'TurboModuleRegistry'; +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { +getConstants: () => {| @@ -27,4 +27,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default TurboModuleRegistry.getEnforcing('AppState'); +export default (TurboModuleRegistry.getEnforcing('AppState'): Spec); diff --git a/Libraries/BatchedBridge/BatchedBridge.js b/Libraries/BatchedBridge/BatchedBridge.js index 5cd0138b48e131..b68e9873e393ba 100644 --- a/Libraries/BatchedBridge/BatchedBridge.js +++ b/Libraries/BatchedBridge/BatchedBridge.js @@ -12,7 +12,7 @@ const MessageQueue = require('./MessageQueue'); -const BatchedBridge = new MessageQueue(); +const BatchedBridge: MessageQueue = new MessageQueue(); // Wire up the batched bridge on the global object so that we can call into it. // Ideally, this would be the inverse relationship. I.e. the native environment diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js index 8fce2a7e67c301..93ac7436c1953f 100644 --- a/Libraries/BatchedBridge/MessageQueue.js +++ b/Libraries/BatchedBridge/MessageQueue.js @@ -16,6 +16,7 @@ const Systrace = require('../Performance/Systrace'); const deepFreezeAndThrowOnMutationInDev = require('../Utilities/deepFreezeAndThrowOnMutationInDev'); const invariant = require('invariant'); const stringifySafe = require('../Utilities/stringifySafe'); +const warnOnce = require('../Utilities/warnOnce'); export type SpyData = { type: number, @@ -40,8 +41,8 @@ const DEBUG_INFO_LIMIT = 32; class MessageQueue { _lazyCallableModules: {[key: string]: (void) => Object}; _queue: [number[], number[], any[], number]; - _successCallbacks: {[key: number]: ?Function}; - _failureCallbacks: {[key: number]: ?Function}; + _successCallbacks: Map; + _failureCallbacks: Map; _callID: number; _lastFlush: number; _eventLoopStartTime: number; @@ -49,15 +50,15 @@ class MessageQueue { _debugInfo: {[number]: [number, number]}; _remoteModuleTable: {[number]: string}; - _remoteMethodTable: {[number]: string[]}; + _remoteMethodTable: {[number]: $ReadOnlyArray}; __spy: ?(data: SpyData) => void; constructor() { this._lazyCallableModules = {}; this._queue = [[], [], [], 0]; - this._successCallbacks = {}; - this._failureCallbacks = {}; + this._successCallbacks = new Map(); + this._failureCallbacks = new Map(); this._callID = 0; this._lastFlush = 0; this._eventLoopStartTime = Date.now(); @@ -101,7 +102,11 @@ class MessageQueue { } } - callFunctionReturnFlushedQueue(module: string, method: string, args: any[]) { + callFunctionReturnFlushedQueue( + module: string, + method: string, + args: any[], + ): null | [Array, Array, Array, number] { this.__guard(() => { this.__callFunction(module, method, args); }); @@ -113,7 +118,7 @@ class MessageQueue { module: string, method: string, args: any[], - ) { + ): $TEMPORARY$array, Array, Array, number]> { let result; this.__guard(() => { result = this.__callFunction(module, method, args); @@ -122,7 +127,10 @@ class MessageQueue { return [result, this.flushedQueue()]; } - invokeCallbackAndReturnFlushedQueue(cbID: number, args: any[]) { + invokeCallbackAndReturnFlushedQueue( + cbID: number, + args: any[], + ): null | [Array, Array, Array, number] { this.__guard(() => { this.__invokeCallback(cbID, args); }); @@ -130,7 +138,7 @@ class MessageQueue { return this.flushedQueue(); } - flushedQueue() { + flushedQueue(): null | [Array, Array, Array, number] { this.__guard(() => { this.__callImmediates(); }); @@ -140,7 +148,7 @@ class MessageQueue { return queue[0].length ? queue : null; } - getEventLoopRunningTime() { + getEventLoopRunningTime(): number { return Date.now() - this._eventLoopStartTime; } @@ -160,7 +168,7 @@ class MessageQueue { }; } - getCallableModule(name: string) { + getCallableModule(name: string): any | null { const getValue = this._lazyCallableModules[name]; return getValue ? getValue() : null; } @@ -171,7 +179,7 @@ class MessageQueue { params: any[], onFail: ?Function, onSucc: ?Function, - ) { + ): any { if (__DEV__) { invariant( global.nativeCallSyncHook, @@ -182,7 +190,19 @@ class MessageQueue { ); } this.processCallbacks(moduleID, methodID, params, onFail, onSucc); - return global.nativeCallSyncHook(moduleID, methodID, params); + try { + return global.nativeCallSyncHook(moduleID, methodID, params); + } catch (e) { + if ( + typeof e === 'object' && + e != null && + typeof e.framesToPop === 'undefined' && + /^Exception in HostFunction: /.test(e.message) + ) { + e.framesToPop = 2; + } + throw e; + } } processCallbacks( @@ -198,6 +218,23 @@ class MessageQueue { if (this._callID > DEBUG_INFO_LIMIT) { delete this._debugInfo[this._callID - DEBUG_INFO_LIMIT]; } + if (this._successCallbacks.size > 500) { + const info = {}; + this._successCallbacks.forEach((_, callID) => { + const debug = this._debugInfo[callID]; + const module = debug && this._remoteModuleTable[debug[0]]; + const method = debug && this._remoteMethodTable[debug[0]][debug[1]]; + info[callID] = {module, method}; + }); + warnOnce( + 'excessive-number-of-pending-callbacks', + `Please report: Excessive number of pending callbacks: ${ + this._successCallbacks.size + }. Some pending callbacks that might have leaked by never being called from native code: ${stringifySafe( + info, + )}`, + ); + } } // Encode callIDs into pairs of callback identifiers by shifting left and using the rightmost bit // to indicate fail (0) or success (1) @@ -205,8 +242,8 @@ class MessageQueue { onFail && params.push(this._callID << 1); // eslint-disable-next-line no-bitwise onSucc && params.push((this._callID << 1) | 1); - this._successCallbacks[this._callID] = onSucc; - this._failureCallbacks[this._callID] = onFail; + this._successCallbacks.set(this._callID, onSucc); + this._failureCallbacks.set(this._callID, onFail); } if (__DEV__) { global.nativeTraceBeginAsyncFlow && @@ -317,10 +354,14 @@ class MessageQueue { } } - createDebugLookup(moduleID: number, name: string, methods: string[]) { + createDebugLookup( + moduleID: number, + name: string, + methods: ?$ReadOnlyArray, + ) { if (__DEV__) { this._remoteModuleTable[moduleID] = name; - this._remoteMethodTable[moduleID] = methods; + this._remoteMethodTable[moduleID] = methods || []; } } @@ -352,7 +393,7 @@ class MessageQueue { // This makes stacktraces to be placed at MessageQueue rather than at where they were launched // The parameter DebuggerInternal.shouldPauseOnThrow is used to check before catching all exceptions and // can be configured by the VM or any Inspector - __shouldPauseOnThrow() { + __shouldPauseOnThrow(): boolean { return ( // $FlowFixMe typeof DebuggerInternal !== 'undefined' && @@ -407,8 +448,8 @@ class MessageQueue { // eslint-disable-next-line no-bitwise const isSuccess = cbID & 1; const callback = isSuccess - ? this._successCallbacks[callID] - : this._failureCallbacks[callID]; + ? this._successCallbacks.get(callID) + : this._failureCallbacks.get(callID); if (__DEV__) { const debug = this._debugInfo[callID]; @@ -437,8 +478,8 @@ class MessageQueue { return; } - delete this._successCallbacks[callID]; - delete this._failureCallbacks[callID]; + this._successCallbacks.delete(callID); + this._failureCallbacks.delete(callID); callback(...args); if (__DEV__) { diff --git a/Libraries/BatchedBridge/NativeModules.js b/Libraries/BatchedBridge/NativeModules.js index df60fc87001d4e..703d9dbe4472da 100644 --- a/Libraries/BatchedBridge/NativeModules.js +++ b/Libraries/BatchedBridge/NativeModules.js @@ -16,12 +16,12 @@ const invariant = require('invariant'); import type {ExtendedError} from '../Core/Devtools/parseErrorStack'; -type ModuleConfig = [ +export type ModuleConfig = [ string /* name */, ?Object /* constants */, - Array /* functions */, - Array /* promise method IDs */, - Array /* sync method IDs */, + ?$ReadOnlyArray /* functions */, + ?$ReadOnlyArray /* promise method IDs */, + ?$ReadOnlyArray /* sync method IDs */, ]; export type MethodType = 'async' | 'promise' | 'sync'; @@ -95,13 +95,17 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { let fn = null; if (type === 'promise') { fn = function(...args: Array) { + // In case we reject, capture a useful stack trace here. + const enqueueingFrameError: ExtendedError = new Error(); + enqueueingFrameError.framesToPop = 1; return new Promise((resolve, reject) => { BatchedBridge.enqueueNativeCall( moduleID, methodID, args, data => resolve(data), - errorData => reject(createErrorFromErrorData(errorData)), + errorData => + reject(updateErrorWithErrorData(errorData, enqueueingFrameError)), ); }); }; @@ -143,15 +147,15 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { return fn; } -function arrayContains(array: Array, value: T): boolean { +function arrayContains(array: $ReadOnlyArray, value: T): boolean { return array.indexOf(value) !== -1; } -function createErrorFromErrorData(errorData: {message: string}): ExtendedError { - const {message, ...extraErrorInfo} = errorData || {}; - const error: ExtendedError = new Error(message); - error.framesToPop = 1; - return Object.assign(error, extraErrorInfo); +function updateErrorWithErrorData( + errorData: {message: string}, + error: ExtendedError, +): ExtendedError { + return Object.assign(error, errorData || {}); } let NativeModules: {[moduleName: string]: Object} = {}; diff --git a/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js b/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js index bb50f5d2fa7b50..6491c81c7eca56 100644 --- a/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +++ b/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js @@ -6,13 +6,29 @@ * * These don't actually exist anywhere in the code. * + * @flow strict-local * @format */ 'use strict'; -const remoteModulesConfig = [ - ['RemoteModule1', null, ['remoteMethod', 'promiseMethod'], []], - ['RemoteModule2', null, ['remoteMethod', 'promiseMethod'], []], + +import type {ModuleConfig} from '../NativeModules'; + +const remoteModulesConfig: $ReadOnlyArray = [ + [ + 'RemoteModule1', + null, + ['remoteMethod', 'promiseMethod', 'promiseReturningMethod', 'syncMethod'], + [2 /* promiseReturningMethod */], + [3 /* syncMethod */], + ], + [ + 'RemoteModule2', + null, + ['remoteMethod', 'promiseMethod', 'promiseReturningMethod', 'syncMethod'], + [2 /* promiseReturningMethod */], + [3 /* syncMethod */], + ], ]; const MessageQueueTestConfig = { diff --git a/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js b/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js index 37425cd7652706..667799a42f4bbf 100644 --- a/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +++ b/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js @@ -11,7 +11,7 @@ /** * Dummy module that only exists for the sake of proving that the message queue - * correctly dispatches to commonJS modules. The `testHook` is overriden by test + * correctly dispatches to commonJS modules. The `testHook` is overridden by test * cases. */ const MessageQueueTestModule = { diff --git a/Libraries/BatchedBridge/__tests__/MessageQueue-test.js b/Libraries/BatchedBridge/__tests__/MessageQueue-test.js index f8568cae72d172..85c2ca97130507 100644 --- a/Libraries/BatchedBridge/__tests__/MessageQueue-test.js +++ b/Libraries/BatchedBridge/__tests__/MessageQueue-test.js @@ -33,7 +33,7 @@ describe('MessageQueue', function() { beforeEach(function() { jest.resetModules(); MessageQueue = require('../MessageQueue'); - MessageQueueTestModule = require('MessageQueueTestModule'); + MessageQueueTestModule = require('../__mocks__/MessageQueueTestModule'); queue = new MessageQueue(); queue.registerCallableModule( 'MessageQueueTestModule', @@ -125,7 +125,7 @@ describe('MessageQueue', function() { expect(factory).toHaveBeenCalledTimes(1); }); - it('should check if the global error handler is not overriden by the DebuggerInternal object', () => { + it('should check if the global error handler is not overridden by the DebuggerInternal object', () => { const dummyModule = { dummy: function() {}, }; @@ -137,7 +137,7 @@ describe('MessageQueue', function() { expect(queue.__shouldPauseOnThrow).toHaveBeenCalledTimes(2); }); - it('should check if the global error handler is overriden by the DebuggerInternal object', () => { + it('should check if the global error handler is overridden by the DebuggerInternal object', () => { const dummyModule = { dummy: function() {}, }; diff --git a/Libraries/BatchedBridge/__tests__/NativeModules-test.js b/Libraries/BatchedBridge/__tests__/NativeModules-test.js index 6457385f233acb..498eeab8b7c0d5 100644 --- a/Libraries/BatchedBridge/__tests__/NativeModules-test.js +++ b/Libraries/BatchedBridge/__tests__/NativeModules-test.js @@ -14,6 +14,8 @@ jest.unmock('../NativeModules'); let BatchedBridge; let NativeModules; +let fs; +let parseErrorStack; const MODULE_IDS = 0; const METHOD_IDS = 1; @@ -40,9 +42,11 @@ describe('MessageQueue', function() { beforeEach(function() { jest.resetModules(); - global.__fbBatchedBridgeConfig = require('MessageQueueTestConfig'); + global.__fbBatchedBridgeConfig = require('../__mocks__/MessageQueueTestConfig'); BatchedBridge = require('../BatchedBridge'); NativeModules = require('../NativeModules'); + fs = require('fs'); + parseErrorStack = require('../../Core/Devtools/parseErrorStack'); }); it('should generate native modules', () => { @@ -112,4 +116,167 @@ describe('MessageQueue', function() { expect(onFail.mock.calls.length).toBe(1); expect(onSucc.mock.calls.length).toBe(1); }); + + it('promise-returning methods (type=promise)', async function() { + // Perform communication + const promise1 = NativeModules.RemoteModule1.promiseReturningMethod( + 'paloAlto', + 'menloPark', + ); + const promise2 = NativeModules.RemoteModule2.promiseReturningMethod( + 'mac', + 'windows', + ); + + const resultingRemoteInvocations = BatchedBridge.flushedQueue(); + + // As always, the message queue has four fields + expect(resultingRemoteInvocations.length).toBe(4); + expect(resultingRemoteInvocations[MODULE_IDS].length).toBe(2); + expect(resultingRemoteInvocations[METHOD_IDS].length).toBe(2); + expect(resultingRemoteInvocations[PARAMS].length).toBe(2); + expect(typeof resultingRemoteInvocations[CALL_ID]).toEqual('number'); + + expect(resultingRemoteInvocations[0][0]).toBe(0); // `RemoteModule1` + expect(resultingRemoteInvocations[1][0]).toBe(2); // `promiseReturningMethod` + expect([ + // the arguments + resultingRemoteInvocations[2][0][0], + resultingRemoteInvocations[2][0][1], + ]).toEqual(['paloAlto', 'menloPark']); + // For promise-returning methods, the order of callbacks is flipped from + // regular async methods. + const firstSuccCBID = resultingRemoteInvocations[2][0][2]; + const firstFailCBID = resultingRemoteInvocations[2][0][3]; + + expect(resultingRemoteInvocations[0][1]).toBe(1); // `RemoteModule2` + expect(resultingRemoteInvocations[1][1]).toBe(2); // `promiseReturningMethod` + expect([ + // the arguments + resultingRemoteInvocations[2][1][0], + resultingRemoteInvocations[2][1][1], + ]).toEqual(['mac', 'windows']); + const secondSuccCBID = resultingRemoteInvocations[2][1][2]; + const secondFailCBID = resultingRemoteInvocations[2][1][3]; + + // Handle the first remote invocation by signaling failure. + BatchedBridge.__invokeCallback(firstFailCBID, [{message: 'firstFailure'}]); + // The failure callback was already invoked, the success is no longer valid + expect(function() { + BatchedBridge.__invokeCallback(firstSuccCBID, ['firstSucc']); + }).toThrow(); + await expect(promise1).rejects.toBeInstanceOf(Error); + await expect(promise1).rejects.toMatchObject({message: 'firstFailure'}); + // Check that we get a useful stack trace from failures. + const error = await promise1.catch(x => x); + expect(getLineFromFrame(parseErrorStack(error)[0])).toContain( + 'NativeModules.RemoteModule1.promiseReturningMethod(', + ); + + // Handle the second remote invocation by signaling success. + BatchedBridge.__invokeCallback(secondSuccCBID, ['secondSucc']); + // The success callback was already invoked, the fail cb is no longer valid + expect(function() { + BatchedBridge.__invokeCallback(secondFailCBID, ['secondFail']); + }).toThrow(); + await promise2; + }); + + describe('sync methods', () => { + afterEach(function() { + delete global.nativeCallSyncHook; + }); + + it('throwing an exception', function() { + global.nativeCallSyncHook = jest.fn(() => { + throw new Error('firstFailure'); + }); + + let error; + try { + NativeModules.RemoteModule1.syncMethod('paloAlto', 'menloPark'); + } catch (e) { + error = e; + } + + expect(global.nativeCallSyncHook).toBeCalledTimes(1); + expect(global.nativeCallSyncHook).toBeCalledWith( + 0, // `RemoteModule1` + 3, // `syncMethod` + ['paloAlto', 'menloPark'], + ); + expect(error).toBeInstanceOf(Error); + expect(error).toMatchObject({ + message: 'firstFailure', + }); + }); + + it('throwing a "native" exception gets framesToPop = 2', function() { + global.nativeCallSyncHook = () => { + throw new Error('Exception in HostFunction: foo'); + }; + let error; + try { + NativeModules.RemoteModule1.syncMethod('paloAlto', 'menloPark'); + } catch (e) { + error = e; + } + // We can't test this behaviour with `getLineFromFrame` because our mock + // function adds an extra frame, so check `framesToPop` directly instead. + expect(error.framesToPop).toBe(2); + }); + + it('throwing a "native" exception preserves framesToPop if set', function() { + global.nativeCallSyncHook = () => { + const e = new Error('Exception in HostFunction: foo'); + e.framesToPop = 42; + throw e; + }; + let error; + try { + NativeModules.RemoteModule1.syncMethod('paloAlto', 'menloPark'); + } catch (e) { + error = e; + } + expect(error.framesToPop).toBe(42); + }); + + it('returning a value', function() { + global.nativeCallSyncHook = jest.fn(() => { + return 'secondSucc'; + }); + + const result = NativeModules.RemoteModule2.syncMethod('mac', 'windows'); + + expect(global.nativeCallSyncHook).toBeCalledTimes(1); + expect(global.nativeCallSyncHook).toBeCalledWith( + 1, // `RemoteModule2` + 3, // `syncMethod` + ['mac', 'windows'], + ); + + expect(result).toBe('secondSucc'); + }); + }); }); + +const linesByFile = new Map(); + +function getLineFromFrame({lineNumber /* 1-based */, file}) { + if (file == null) { + return null; + } + const cleanedFile = cleanFileName(file); + const lines = + linesByFile.get(cleanedFile) || + fs.readFileSync(cleanedFile, 'utf8').split('\n'); + if (!linesByFile.has(cleanedFile)) { + linesByFile.set(cleanedFile, lines); + } + return (lines[lineNumber - 1] || '').trim(); +} + +// Works around a parseErrorStack bug involving `new X` stack frames. +function cleanFileName(file) { + return file.replace(/^.+? \((?=\/)/, ''); +} diff --git a/Libraries/Blob/BlobManager.js b/Libraries/Blob/BlobManager.js index 20e81ee67a5fc0..e12512392a3e78 100644 --- a/Libraries/Blob/BlobManager.js +++ b/Libraries/Blob/BlobManager.js @@ -12,9 +12,10 @@ const Blob = require('./Blob'); const BlobRegistry = require('./BlobRegistry'); -const {BlobModule} = require('../BatchedBridge/NativeModules'); import type {BlobData, BlobOptions, BlobCollector} from './BlobTypes'; +import NativeBlobModule from './NativeBlobModule'; +import invariant from 'invariant'; /*eslint-disable no-bitwise */ /*eslint-disable eqeqeq */ @@ -53,7 +54,7 @@ class BlobManager { /** * If the native blob module is available. */ - static isAvailable = !!BlobModule; + static isAvailable: boolean = !!NativeBlobModule; /** * Create blob from existing array of blobs. @@ -62,6 +63,8 @@ class BlobManager { parts: Array, options?: BlobOptions, ): Blob { + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + const blobId = uuidv4(); const items = parts.map(part => { if ( @@ -92,7 +95,7 @@ class BlobManager { } }, 0); - BlobModule.createFromParts(items, blobId); + NativeBlobModule.createFromParts(items, blobId); return BlobManager.createFromOptions({ blobId, @@ -127,11 +130,13 @@ class BlobManager { * Deallocate resources for a blob. */ static release(blobId: string): void { + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + BlobRegistry.unregister(blobId); if (BlobRegistry.has(blobId)) { return; } - BlobModule.release(blobId); + NativeBlobModule.release(blobId); } /** @@ -139,7 +144,9 @@ class BlobManager { * requests and responses. */ static addNetworkingHandler(): void { - BlobModule.addNetworkingHandler(); + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + + NativeBlobModule.addNetworkingHandler(); } /** @@ -147,7 +154,9 @@ class BlobManager { * messages. */ static addWebSocketHandler(socketId: number): void { - BlobModule.addWebSocketHandler(socketId); + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + + NativeBlobModule.addWebSocketHandler(socketId); } /** @@ -155,14 +164,18 @@ class BlobManager { * binary messages. */ static removeWebSocketHandler(socketId: number): void { - BlobModule.removeWebSocketHandler(socketId); + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + + NativeBlobModule.removeWebSocketHandler(socketId); } /** * Send a blob message to a websocket. */ static sendOverSocket(blob: Blob, socketId: number): void { - BlobModule.sendOverSocket(blob.data, socketId); + invariant(NativeBlobModule, 'NativeBlobModule is available.'); + + NativeBlobModule.sendOverSocket(blob.data, socketId); } } diff --git a/Libraries/Blob/BlobRegistry.js b/Libraries/Blob/BlobRegistry.js index cfd0475a53ea07..f3cd13ebc48fbb 100644 --- a/Libraries/Blob/BlobRegistry.js +++ b/Libraries/Blob/BlobRegistry.js @@ -27,7 +27,7 @@ const unregister = (id: string) => { } }; -const has = (id: string) => { +const has = (id: string): number | boolean => { return registry[id] && registry[id] > 0; }; diff --git a/Libraries/Blob/FileReader.js b/Libraries/Blob/FileReader.js index 7d8116fce9c37c..fc769f8a544a72 100644 --- a/Libraries/Blob/FileReader.js +++ b/Libraries/Blob/FileReader.js @@ -10,9 +10,10 @@ 'use strict'; -const EventTarget = require('event-target-shim'); const Blob = require('./Blob'); -const {FileReaderModule} = require('../BatchedBridge/NativeModules'); +const EventTarget = require('event-target-shim'); + +import NativeFileReaderModule from './NativeFileReaderModule'; type ReadyState = | 0 // EMPTY @@ -34,14 +35,14 @@ const EMPTY = 0; const LOADING = 1; const DONE = 2; -class FileReader extends EventTarget(...READER_EVENTS) { - static EMPTY = EMPTY; - static LOADING = LOADING; - static DONE = DONE; +class FileReader extends (EventTarget(...READER_EVENTS): any) { + static EMPTY: number = EMPTY; + static LOADING: number = LOADING; + static DONE: number = DONE; - EMPTY = EMPTY; - LOADING = LOADING; - DONE = DONE; + EMPTY: number = EMPTY; + LOADING: number = LOADING; + DONE: number = DONE; _readyState: ReadyState; _error: ?Error; @@ -87,7 +88,7 @@ class FileReader extends EventTarget(...READER_EVENTS) { readAsDataURL(blob: Blob) { this._aborted = false; - FileReaderModule.readAsDataURL(blob.data).then( + NativeFileReaderModule.readAsDataURL(blob.data).then( (text: string) => { if (this._aborted) { return; @@ -108,7 +109,7 @@ class FileReader extends EventTarget(...READER_EVENTS) { readAsText(blob: Blob, encoding: string = 'UTF-8') { this._aborted = false; - FileReaderModule.readAsText(blob.data, encoding).then( + NativeFileReaderModule.readAsText(blob.data, encoding).then( (text: string) => { if (this._aborted) { return; diff --git a/Libraries/Blob/NativeBlobModule.js b/Libraries/Blob/NativeBlobModule.js new file mode 100644 index 00000000000000..2949b755951b5a --- /dev/null +++ b/Libraries/Blob/NativeBlobModule.js @@ -0,0 +1,26 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {|BLOB_URI_SCHEME: string, BLOB_URI_HOST: ?string|}; + +addNetworkingHandler: () => void; + +addWebSocketHandler: (id: number) => void; + +removeWebSocketHandler: (id: number) => void; + +sendOverSocket: (blob: Object, id: number) => void; + +createFromParts: (parts: Array, blobId: string) => void; + +release: (blobId: string) => void; +} + +export default (TurboModuleRegistry.get('BlobModule'): ?Spec); diff --git a/Libraries/Blob/NativeFileReaderModule.js b/Libraries/Blob/NativeFileReaderModule.js new file mode 100644 index 00000000000000..ac135db7394d19 --- /dev/null +++ b/Libraries/Blob/NativeFileReaderModule.js @@ -0,0 +1,23 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +readAsDataURL: (data: Object) => Promise; + +readAsText: (data: Object, encoding: string) => Promise; +} + +export default (TurboModuleRegistry.getEnforcing( + 'FileReaderModule', +): Spec); diff --git a/Libraries/Blob/RCTBlob.xcodeproj/project.pbxproj b/Libraries/Blob/RCTBlob.xcodeproj/project.pbxproj deleted file mode 100755 index 5857ccbb305582..00000000000000 --- a/Libraries/Blob/RCTBlob.xcodeproj/project.pbxproj +++ /dev/null @@ -1,499 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1946172A225F085900E4E008 /* RCTBlobCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 19461728225F085900E4E008 /* RCTBlobCollector.h */; }; - 1946172B225F085900E4E008 /* RCTBlobCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 19461728225F085900E4E008 /* RCTBlobCollector.h */; }; - 1946172C225F085900E4E008 /* RCTBlobCollector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 19461729225F085900E4E008 /* RCTBlobCollector.mm */; }; - 1946172D225F085900E4E008 /* RCTBlobCollector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 19461729225F085900E4E008 /* RCTBlobCollector.mm */; }; - 19BA88FE1F84391700741C5A /* RCTFileReaderModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - 19BA88FF1F84392900741C5A /* RCTFileReaderModule.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - 19BA89001F84392F00741C5A /* RCTFileReaderModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - 19BA89011F84393D00741C5A /* RCTFileReaderModule.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDFBA6B1F33455F0064C998 /* RCTFileReaderModule.m */; }; - 19D9CA2622820DA40021BD26 /* RCTBlobCollector.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 19461728225F085900E4E008 /* RCTBlobCollector.h */; }; - 9F5C1891230DD18300E3E5A7 /* RCTBlobCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 19461728225F085900E4E008 /* RCTBlobCollector.h */; }; - 9F5C1892230DD18300E3E5A7 /* RCTFileReaderModule.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - 9F5C1893230DD18300E3E5A7 /* RCTBlobManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - 9F5C1894230DD18C00E3E5A7 /* RCTBlobCollector.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 19461728225F085900E4E008 /* RCTBlobCollector.h */; }; - 9F5C1895230DD18C00E3E5A7 /* RCTFileReaderModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - 9F5C1896230DD18C00E3E5A7 /* RCTBlobManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - 9F5C1897230DD19300E3E5A7 /* RCTBlobCollector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 19461729225F085900E4E008 /* RCTBlobCollector.mm */; }; - 9F5C1898230DD19300E3E5A7 /* RCTFileReaderModule.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDFBA6B1F33455F0064C998 /* RCTFileReaderModule.m */; }; - 9F5C1899230DD19300E3E5A7 /* RCTBlobManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD9A43C21DFC7126008DC588 /* RCTBlobManager.mm */; }; - AD0871131E215B28007D136D /* RCTBlobManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - AD0871161E215EC9007D136D /* RCTBlobManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - AD0871181E215ED1007D136D /* RCTBlobManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - AD08711A1E2162C8007D136D /* RCTBlobManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */; }; - AD9A43C31DFC7126008DC588 /* RCTBlobManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD9A43C21DFC7126008DC588 /* RCTBlobManager.mm */; }; - ADD01A711E09404A00F6D226 /* RCTBlobManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD9A43C21DFC7126008DC588 /* RCTBlobManager.mm */; }; - ADDFBA6C1F33455F0064C998 /* RCTFileReaderModule.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */; }; - ADDFBA6D1F33455F0064C998 /* RCTFileReaderModule.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDFBA6B1F33455F0064C998 /* RCTFileReaderModule.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 358F4ED51D1E81A9004DF814 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTBlob; - dstSubfolderSpec = 16; - files = ( - 19D9CA2622820DA40021BD26 /* RCTBlobCollector.h in Copy Headers */, - 19BA88FE1F84391700741C5A /* RCTFileReaderModule.h in Copy Headers */, - AD08711A1E2162C8007D136D /* RCTBlobManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 6484CE50201A74FA004275A4 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTBlob; - dstSubfolderSpec = 16; - files = ( - 9F5C1894230DD18C00E3E5A7 /* RCTBlobCollector.h in Copy Headers */, - 9F5C1895230DD18C00E3E5A7 /* RCTFileReaderModule.h in Copy Headers */, - 9F5C1896230DD18C00E3E5A7 /* RCTBlobManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - AD0871121E215B16007D136D /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTBlob; - dstSubfolderSpec = 16; - files = ( - 19BA89001F84392F00741C5A /* RCTFileReaderModule.h in Copy Headers */, - AD0871131E215B28007D136D /* RCTBlobManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 19461728225F085900E4E008 /* RCTBlobCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBlobCollector.h; sourceTree = ""; }; - 19461729225F085900E4E008 /* RCTBlobCollector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTBlobCollector.mm; sourceTree = ""; }; - 358F4ED71D1E81A9004DF814 /* libRCTBlob.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTBlob.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 6484CE57201A74FA004275A4 /* libRCTBlob-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTBlob-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTBlobManager.h; sourceTree = ""; }; - AD9A43C21DFC7126008DC588 /* RCTBlobManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTBlobManager.mm; sourceTree = ""; }; - ADD01A681E09402E00F6D226 /* libRCTBlob-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTBlob-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTFileReaderModule.h; sourceTree = ""; }; - ADDFBA6B1F33455F0064C998 /* RCTFileReaderModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFileReaderModule.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 358F4ECE1D1E81A9004DF814 = { - isa = PBXGroup; - children = ( - 19461728225F085900E4E008 /* RCTBlobCollector.h */, - 19461729225F085900E4E008 /* RCTBlobCollector.mm */, - ADDFBA6A1F33455F0064C998 /* RCTFileReaderModule.h */, - ADDFBA6B1F33455F0064C998 /* RCTFileReaderModule.m */, - AD9A43C11DFC7126008DC588 /* RCTBlobManager.h */, - AD9A43C21DFC7126008DC588 /* RCTBlobManager.mm */, - 358F4ED81D1E81A9004DF814 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 358F4ED81D1E81A9004DF814 /* Products */ = { - isa = PBXGroup; - children = ( - 358F4ED71D1E81A9004DF814 /* libRCTBlob.a */, - ADD01A681E09402E00F6D226 /* libRCTBlob-tvOS.a */, - 6484CE57201A74FA004275A4 /* libRCTBlob-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 6484CE4E201A74FA004275A4 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F5C1891230DD18300E3E5A7 /* RCTBlobCollector.h in Headers */, - 9F5C1892230DD18300E3E5A7 /* RCTFileReaderModule.h in Headers */, - 9F5C1893230DD18300E3E5A7 /* RCTBlobManager.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AD0871151E215EB7007D136D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AD0871161E215EC9007D136D /* RCTBlobManager.h in Headers */, - 1946172A225F085900E4E008 /* RCTBlobCollector.h in Headers */, - ADDFBA6C1F33455F0064C998 /* RCTFileReaderModule.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AD0871171E215ECC007D136D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 19BA88FF1F84392900741C5A /* RCTFileReaderModule.h in Headers */, - 1946172B225F085900E4E008 /* RCTBlobCollector.h in Headers */, - AD0871181E215ED1007D136D /* RCTBlobManager.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 358F4ED61D1E81A9004DF814 /* RCTBlob */ = { - isa = PBXNativeTarget; - buildConfigurationList = 358F4EE01D1E81A9004DF814 /* Build configuration list for PBXNativeTarget "RCTBlob" */; - buildPhases = ( - AD0871151E215EB7007D136D /* Headers */, - 358F4ED51D1E81A9004DF814 /* Copy Headers */, - 358F4ED31D1E81A9004DF814 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTBlob; - productName = SLKBlobs; - productReference = 358F4ED71D1E81A9004DF814 /* libRCTBlob.a */; - productType = "com.apple.product-type.library.static"; - }; - 6484CE4D201A74FA004275A4 /* RCTBlob-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6484CE54201A74FA004275A4 /* Build configuration list for PBXNativeTarget "RCTBlob-macOS" */; - buildPhases = ( - 6484CE4E201A74FA004275A4 /* Headers */, - 6484CE50201A74FA004275A4 /* Copy Headers */, - 6484CE52201A74FA004275A4 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTBlob-macOS"; - productName = SLKBlobs; - productReference = 6484CE57201A74FA004275A4 /* libRCTBlob-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; - ADD01A671E09402E00F6D226 /* RCTBlob-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = ADD01A6E1E09402E00F6D226 /* Build configuration list for PBXNativeTarget "RCTBlob-tvOS" */; - buildPhases = ( - AD0871171E215ECC007D136D /* Headers */, - AD0871121E215B16007D136D /* Copy Headers */, - ADD01A641E09402E00F6D226 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTBlob-tvOS"; - productName = "RCTBlob-tvOS"; - productReference = ADD01A681E09402E00F6D226 /* libRCTBlob-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 358F4ECF1D1E81A9004DF814 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 358F4ED61D1E81A9004DF814 = { - CreatedOnToolsVersion = 7.3; - }; - ADD01A671E09402E00F6D226 = { - CreatedOnToolsVersion = 8.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 358F4ED21D1E81A9004DF814 /* Build configuration list for PBXProject "RCTBlob" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = 358F4ECE1D1E81A9004DF814; - productRefGroup = 358F4ED81D1E81A9004DF814 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 358F4ED61D1E81A9004DF814 /* RCTBlob */, - ADD01A671E09402E00F6D226 /* RCTBlob-tvOS */, - 6484CE4D201A74FA004275A4 /* RCTBlob-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 358F4ED31D1E81A9004DF814 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1946172C225F085900E4E008 /* RCTBlobCollector.mm in Sources */, - ADDFBA6D1F33455F0064C998 /* RCTFileReaderModule.m in Sources */, - AD9A43C31DFC7126008DC588 /* RCTBlobManager.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6484CE52201A74FA004275A4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F5C1897230DD19300E3E5A7 /* RCTBlobCollector.mm in Sources */, - 9F5C1898230DD19300E3E5A7 /* RCTFileReaderModule.m in Sources */, - 9F5C1899230DD19300E3E5A7 /* RCTBlobManager.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ADD01A641E09402E00F6D226 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1946172D225F085900E4E008 /* RCTBlobCollector.mm in Sources */, - 19BA89011F84393D00741C5A /* RCTFileReaderModule.m in Sources */, - ADD01A711E09404A00F6D226 /* RCTBlobManager.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 358F4EDE1D1E81A9004DF814 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 358F4EDF1D1E81A9004DF814 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 358F4EE11D1E81A9004DF814 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 358F4EE21D1E81A9004DF814 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 6484CE55201A74FA004275A4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 6484CE56201A74FA004275A4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - }; - name = Release; - }; - ADD01A6F1E09402E00F6D226 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.1; - }; - name = Debug; - }; - ADD01A701E09402E00F6D226 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.1; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 358F4ED21D1E81A9004DF814 /* Build configuration list for PBXProject "RCTBlob" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 358F4EDE1D1E81A9004DF814 /* Debug */, - 358F4EDF1D1E81A9004DF814 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 358F4EE01D1E81A9004DF814 /* Build configuration list for PBXNativeTarget "RCTBlob" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 358F4EE11D1E81A9004DF814 /* Debug */, - 358F4EE21D1E81A9004DF814 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6484CE54201A74FA004275A4 /* Build configuration list for PBXNativeTarget "RCTBlob-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6484CE55201A74FA004275A4 /* Debug */, - 6484CE56201A74FA004275A4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - ADD01A6E1E09402E00F6D226 /* Build configuration list for PBXNativeTarget "RCTBlob-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - ADD01A6F1E09402E00F6D226 /* Debug */, - ADD01A701E09402E00F6D226 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 358F4ECF1D1E81A9004DF814 /* Project object */; -} diff --git a/Libraries/Blob/RCTBlobCollector.mm b/Libraries/Blob/RCTBlobCollector.mm index 284b52b5a4e8dd..1b928a3e11615a 100644 --- a/Libraries/Blob/RCTBlobCollector.mm +++ b/Libraries/Blob/RCTBlobCollector.mm @@ -8,7 +8,7 @@ #import "RCTBlobCollector.h" #import -#import "RCTBlobManager.h" +#import namespace facebook { namespace react { diff --git a/Libraries/Blob/RCTBlobManager.mm b/Libraries/Blob/RCTBlobManager.mm index 9e8faeb7b149ca..04aba9b637eb01 100755 --- a/Libraries/Blob/RCTBlobManager.mm +++ b/Libraries/Blob/RCTBlobManager.mm @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBlobManager.h" +#import #import diff --git a/Libraries/Blob/RCTFileReaderModule.m b/Libraries/Blob/RCTFileReaderModule.m index 26b33f63e471a9..50fae382019463 100644 --- a/Libraries/Blob/RCTFileReaderModule.m +++ b/Libraries/Blob/RCTFileReaderModule.m @@ -6,12 +6,12 @@ */ -#import "RCTFileReaderModule.h" +#import #import #import -#import "RCTBlobManager.h" +#import @implementation RCTFileReaderModule diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index 189e7564139b0b..7564ddd0f4d63f 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -26,11 +26,13 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m,mm}" + # RCTBlobCollector.h is not included in the React module as it has C++ code + s.source_files = "*.{m,mm}", "RCTBlobCollector.h" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTBlob" - s.dependency "React-Core", version + s.dependency "React-Core/RCTBlobHeaders", version + s.dependency "React-Core/RCTWebSocket", version s.dependency "React-RCTNetwork", version - s.dependency "React-RCTWebSocket", version + s.dependency "React-jsi", version end diff --git a/Libraries/Blob/URL.js b/Libraries/Blob/URL.js index 520b5fc63a0c94..9869dcbeaded11 100644 --- a/Libraries/Blob/URL.js +++ b/Libraries/Blob/URL.js @@ -11,14 +11,18 @@ const Blob = require('./Blob'); -const {BlobModule} = require('../BatchedBridge/NativeModules'); +import NativeBlobModule from './NativeBlobModule'; let BLOB_URL_PREFIX = null; -if (BlobModule && typeof BlobModule.BLOB_URI_SCHEME === 'string') { - BLOB_URL_PREFIX = BlobModule.BLOB_URI_SCHEME + ':'; - if (typeof BlobModule.BLOB_URI_HOST === 'string') { - BLOB_URL_PREFIX += `//${BlobModule.BLOB_URI_HOST}/`; +if ( + NativeBlobModule && + typeof NativeBlobModule.getConstants().BLOB_URI_SCHEME === 'string' +) { + const constants = NativeBlobModule.getConstants(); + BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':'; + if (typeof constants.BLOB_URI_HOST === 'string') { + BLOB_URL_PREFIX += `//${constants.BLOB_URI_HOST}/`; } } @@ -126,7 +130,12 @@ export class URL { constructor(url: string, base: string) { let baseUrl = null; - if (base) { + if (!base || validateBaseUrl(url)) { + this._url = url; + if (!this._url.endsWith('/')) { + this._url += '/'; + } + } else { if (typeof base === 'string') { baseUrl = base; if (!validateBaseUrl(baseUrl)) { @@ -142,11 +151,6 @@ export class URL { url = ''; } this._url = `${baseUrl}${url}`; - } else { - this._url = url; - if (!this._url.endsWith('/')) { - this._url += '/'; - } } } diff --git a/Libraries/Blob/__mocks__/FileReaderModule.js b/Libraries/Blob/__mocks__/FileReaderModule.js index da687eca470b1d..a3cdbf6848cd1a 100644 --- a/Libraries/Blob/__mocks__/FileReaderModule.js +++ b/Libraries/Blob/__mocks__/FileReaderModule.js @@ -8,10 +8,10 @@ * @format */ const FileReaderModule = { - async readAsText() { + async readAsText(): Promise { return ''; }, - async readAsDataURL() { + async readAsDataURL(): Promise { return 'data:text/plain;base64,NDI='; }, }; diff --git a/Libraries/Blob/__tests__/URL-test.js b/Libraries/Blob/__tests__/URL-test.js index 8ca71feb025315..281649ce7821d7 100644 --- a/Libraries/Blob/__tests__/URL-test.js +++ b/Libraries/Blob/__tests__/URL-test.js @@ -31,5 +31,7 @@ describe('URL', function() { // expect(g.href).toBe('https://developer.mozilla.org/en-US/docs'); const h = new URL('/en-US/docs', a); expect(h.href).toBe('https://developer.mozilla.org/en-US/docs'); + const i = new URL('http://github.com', 'http://google.com'); + expect(i.href).toBe('http://github.com/'); }); }); diff --git a/Libraries/BugReporting/BugReporting.js b/Libraries/BugReporting/BugReporting.js index ed5bdfc61d6b4b..c4eaf60a78f307 100644 --- a/Libraries/BugReporting/BugReporting.js +++ b/Libraries/BugReporting/BugReporting.js @@ -14,6 +14,8 @@ const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); const infoLog = require('../Utilities/infoLog'); import type EmitterSubscription from '../vendor/emitter/EmitterSubscription'; +import NativeBugReporting from './NativeBugReporting'; +import NativeRedBox from '../NativeModules/specs/NativeRedBox'; type ExtraData = {[key: string]: string}; type SourceCallback = () => string; @@ -121,16 +123,14 @@ class BugReporting { fileData[key] = callback(); } infoLog('BugReporting extraData:', extraData); - const BugReportingNativeModule = require('../BatchedBridge/NativeModules') - .BugReporting; - BugReportingNativeModule && - BugReportingNativeModule.setExtraData && - BugReportingNativeModule.setExtraData(extraData, fileData); - - const RedBoxNativeModule = require('../BatchedBridge/NativeModules').RedBox; - RedBoxNativeModule && - RedBoxNativeModule.setExtraData && - RedBoxNativeModule.setExtraData(extraData, 'From BugReporting.js'); + + if (NativeBugReporting != null && NativeBugReporting.setExtraData != null) { + NativeBugReporting.setExtraData(extraData, fileData); + } + + if (NativeRedBox != null && NativeRedBox.setExtraData != null) { + NativeRedBox.setExtraData(extraData, 'From BugReporting.js'); + } return {extras: extraData, files: fileData}; } diff --git a/Libraries/BugReporting/NativeBugReporting.js b/Libraries/BugReporting/NativeBugReporting.js new file mode 100644 index 00000000000000..236b34e17a93b6 --- /dev/null +++ b/Libraries/BugReporting/NativeBugReporting.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @format + * @flow + */ + +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; +import type {TurboModule} from '../TurboModule/RCTExport'; + +export interface Spec extends TurboModule { + +startReportAProblemFlow: () => void; + +setExtraData: (extraData: Object, extraFiles: Object) => void; + +setCategoryID: (categoryID: string) => void; +} + +export default TurboModuleRegistry.get('BugReporting'); diff --git a/Libraries/BugReporting/dumpReactTree.js b/Libraries/BugReporting/dumpReactTree.js index 2ef17ecf034784..0960662911cc3a 100644 --- a/Libraries/BugReporting/dumpReactTree.js +++ b/Libraries/BugReporting/dumpReactTree.js @@ -23,7 +23,7 @@ const MAX_STRING_LENGTH = 50; * it best to get the content but ultimately relies on implementation details * of React and will fail in future versions. */ -function dumpReactTree() { +function dumpReactTree(): string { try { return getReactTree(); } catch (e) { diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js deleted file mode 100644 index bc791fde36f2b5..00000000000000 --- a/Libraries/CameraRoll/CameraRoll.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ -'use strict'; - -const PropTypes = require('prop-types'); -const {checkPropTypes} = PropTypes; -const RCTCameraRollManager = require('../BatchedBridge/NativeModules') - .CameraRollManager; - -const deprecatedCreateStrictShapeTypeChecker = require('../DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker'); -const invariant = require('invariant'); - -const GROUP_TYPES_OPTIONS = { - Album: 'Album', - All: 'All', - Event: 'Event', - Faces: 'Faces', - Library: 'Library', - PhotoStream: 'PhotoStream', - SavedPhotos: 'SavedPhotos', // default -}; - -const ASSET_TYPE_OPTIONS = { - All: 'All', - Videos: 'Videos', - Photos: 'Photos', -}; - -export type GroupTypes = $Keys; - -export type GetPhotosParams = { - first: number, - after?: string, - groupTypes?: GroupTypes, - groupName?: string, - assetType?: $Keys, - mimeTypes?: Array, -}; - -/** - * Shape of the param arg for the `getPhotos` function. - */ -const getPhotosParamChecker = deprecatedCreateStrictShapeTypeChecker({ - /** - * The number of photos wanted in reverse order of the photo application - * (i.e. most recent first for SavedPhotos). - */ - first: PropTypes.number.isRequired, - - /** - * A cursor that matches `page_info { end_cursor }` returned from a previous - * call to `getPhotos` - */ - after: PropTypes.string, - - /** - * Specifies which group types to filter the results to. - */ - groupTypes: PropTypes.oneOf(Object.keys(GROUP_TYPES_OPTIONS)), - - /** - * Specifies filter on group names, like 'Recent Photos' or custom album - * titles. - */ - groupName: PropTypes.string, - - /** - * Specifies filter on asset type - */ - assetType: PropTypes.oneOf(Object.keys(ASSET_TYPE_OPTIONS)), - - /** - * Filter by mimetype (e.g. image/jpeg). - */ - mimeTypes: PropTypes.arrayOf(PropTypes.string), -}); - -export type PhotoIdentifier = { - node: { - type: string, - group_name: string, - image: { - filename: string, - uri: string, - height: number, - width: number, - isStored?: boolean, - playableDuration: number, - }, - timestamp: number, - location?: { - latitude?: number, - longitude?: number, - altitude?: number, - heading?: number, - speed?: number, - }, - }, -}; - -export type PhotoIdentifiersPage = { - edges: Array, - page_info: { - has_next_page: boolean, - start_cursor?: string, - end_cursor?: string, - }, -}; - -/** - * Shape of the return value of the `getPhotos` function. - */ -const getPhotosReturnChecker = deprecatedCreateStrictShapeTypeChecker({ - edges: PropTypes.arrayOf( - /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.66 was deployed. To see the error delete this - * comment and run Flow. */ - deprecatedCreateStrictShapeTypeChecker({ - node: deprecatedCreateStrictShapeTypeChecker({ - type: PropTypes.string.isRequired, - group_name: PropTypes.string.isRequired, - image: deprecatedCreateStrictShapeTypeChecker({ - uri: PropTypes.string.isRequired, - height: PropTypes.number.isRequired, - width: PropTypes.number.isRequired, - isStored: PropTypes.bool, - playableDuration: PropTypes.number.isRequired, - }).isRequired, - timestamp: PropTypes.number.isRequired, - location: deprecatedCreateStrictShapeTypeChecker({ - latitude: PropTypes.number, - longitude: PropTypes.number, - altitude: PropTypes.number, - heading: PropTypes.number, - speed: PropTypes.number, - }), - }).isRequired, - }), - ).isRequired, - page_info: deprecatedCreateStrictShapeTypeChecker({ - has_next_page: PropTypes.bool.isRequired, - start_cursor: PropTypes.string, - end_cursor: PropTypes.string, - }).isRequired, -}); - -/** - * `CameraRoll` provides access to the local camera roll or photo library. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html - */ -class CameraRoll { - static GroupTypesOptions = GROUP_TYPES_OPTIONS; - static AssetTypeOptions = ASSET_TYPE_OPTIONS; - - /** - * `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead. - */ - static saveImageWithTag(tag: string): Promise { - console.warn( - '`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.', - ); - return this.saveToCameraRoll(tag, 'photo'); - } - - static deletePhotos(photos: Array) { - return RCTCameraRollManager.deletePhotos(photos); - } - - /** - * Saves the photo or video to the camera roll or photo library. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html#savetocameraroll - */ - static saveToCameraRoll( - tag: string, - type?: 'photo' | 'video', - ): Promise { - invariant( - typeof tag === 'string', - 'CameraRoll.saveToCameraRoll must be a valid string.', - ); - - invariant( - type === 'photo' || type === 'video' || type === undefined, - `The second argument to saveToCameraRoll must be 'photo' or 'video'. You passed ${type || - 'unknown'}`, - ); - - let mediaType = 'photo'; - if (type) { - mediaType = type; - } else if (['mov', 'mp4'].indexOf(tag.split('.').slice(-1)[0]) >= 0) { - mediaType = 'video'; - } - - return RCTCameraRollManager.saveToCameraRoll(tag, mediaType); - } - - /** - * Returns a Promise with photo identifier objects from the local camera - * roll of the device matching shape defined by `getPhotosReturnChecker`. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos - */ - static getPhotos(params: GetPhotosParams): Promise { - if (__DEV__) { - checkPropTypes( - {params: getPhotosParamChecker}, - {params}, - 'params', - 'CameraRoll.getPhotos', - ); - } - if (arguments.length > 1) { - console.warn( - 'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead', - ); - let successCallback = arguments[1]; - if (__DEV__) { - const callback = arguments[1]; - successCallback = response => { - checkPropTypes( - {response: getPhotosReturnChecker}, - {response}, - 'response', - 'CameraRoll.getPhotos callback', - ); - callback(response); - }; - } - const errorCallback = arguments[2] || (() => {}); - RCTCameraRollManager.getPhotos(params).then( - successCallback, - errorCallback, - ); - } - // TODO: Add the __DEV__ check back in to verify the Promise result - return RCTCameraRollManager.getPhotos(params); - } -} - -module.exports = CameraRoll; diff --git a/Libraries/CameraRoll/ImagePickerIOS.js b/Libraries/CameraRoll/ImagePickerIOS.js deleted file mode 100644 index 0254e222c5c42c..00000000000000 --- a/Libraries/CameraRoll/ImagePickerIOS.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const RCTImagePicker = require('../BatchedBridge/NativeModules').ImagePickerIOS; - -const ImagePickerIOS = { - canRecordVideos: function(callback: Function) { - return RCTImagePicker.canRecordVideos(callback); - }, - canUseCamera: function(callback: Function) { - return RCTImagePicker.canUseCamera(callback); - }, - openCameraDialog: function( - config: Object, - successCallback: Function, - cancelCallback: Function, - ) { - config = { - videoMode: false, - ...config, - }; - return RCTImagePicker.openCameraDialog( - config, - successCallback, - cancelCallback, - ); - }, - openSelectDialog: function( - config: Object, - successCallback: Function, - cancelCallback: Function, - ) { - config = { - showImages: true, - showVideos: false, - ...config, - }; - return RCTImagePicker.openSelectDialog( - config, - successCallback, - cancelCallback, - ); - }, -}; - -module.exports = ImagePickerIOS; diff --git a/Libraries/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj b/Libraries/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj deleted file mode 100644 index 3884e1cfba3d01..00000000000000 --- a/Libraries/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj +++ /dev/null @@ -1,310 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 137620351B31C53500677FF0 /* RCTImagePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137620341B31C53500677FF0 /* RCTImagePickerManager.m */; }; - 143879351AAD238D00F088A5 /* RCTCameraRollManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */; }; - 8312EAEE1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */; }; - 8312EAF11B85F071001867A2 /* RCTPhotoLibraryImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B5115B1A9E6B3D00147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 137620331B31C53500677FF0 /* RCTImagePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImagePickerManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 137620341B31C53500677FF0 /* RCTImagePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImagePickerManager.m; sourceTree = ""; }; - 143879331AAD238D00F088A5 /* RCTCameraRollManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTCameraRollManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTCameraRollManager.m; sourceTree = ""; }; - 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTCameraRoll.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 8312EAEC1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAssetsLibraryRequestHandler.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAssetsLibraryRequestHandler.m; sourceTree = ""; }; - 8312EAEF1B85F071001867A2 /* RCTPhotoLibraryImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPhotoLibraryImageLoader.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPhotoLibraryImageLoader.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B5115A1A9E6B3D00147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 58B511541A9E6B3D00147676 = { - isa = PBXGroup; - children = ( - 8312EAEC1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.h */, - 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */, - 143879331AAD238D00F088A5 /* RCTCameraRollManager.h */, - 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */, - 137620331B31C53500677FF0 /* RCTImagePickerManager.h */, - 137620341B31C53500677FF0 /* RCTImagePickerManager.m */, - 8312EAEF1B85F071001867A2 /* RCTPhotoLibraryImageLoader.h */, - 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */, - 58B5115E1A9E6B3D00147676 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5115E1A9E6B3D00147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B5115C1A9E6B3D00147676 /* RCTCameraRoll */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTCameraRoll" */; - buildPhases = ( - 58B511591A9E6B3D00147676 /* Sources */, - 58B5115A1A9E6B3D00147676 /* Frameworks */, - 58B5115B1A9E6B3D00147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTCameraRoll; - productName = RCTNetworkImage; - productReference = 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511551A9E6B3D00147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B5115C1A9E6B3D00147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTCameraRoll" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511541A9E6B3D00147676; - productRefGroup = 58B5115E1A9E6B3D00147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5115C1A9E6B3D00147676 /* RCTCameraRoll */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511591A9E6B3D00147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8312EAEE1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m in Sources */, - 8312EAF11B85F071001867A2 /* RCTPhotoLibraryImageLoader.m in Sources */, - 137620351B31C53500677FF0 /* RCTImagePickerManager.m in Sources */, - 143879351AAD238D00F088A5 /* RCTCameraRollManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B5116F1A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - "-Wno-deprecated-declarations", - ); - }; - name = Debug; - }; - 58B511701A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - "-Wno-deprecated-declarations", - ); - }; - name = Release; - }; - 58B511721A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTCameraRoll; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511731A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTCameraRoll; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTCameraRoll" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B5116F1A9E6B3D00147676 /* Debug */, - 58B511701A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTCameraRoll" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511721A9E6B3D00147676 /* Debug */, - 58B511731A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511551A9E6B3D00147676 /* Project object */; -} diff --git a/Libraries/CameraRoll/RCTCameraRollManager.m b/Libraries/CameraRoll/RCTCameraRollManager.m index b6eb668b328c19..8745bccaba0642 100644 --- a/Libraries/CameraRoll/RCTCameraRollManager.m +++ b/Libraries/CameraRoll/RCTCameraRollManager.m @@ -143,7 +143,7 @@ static void requestPhotoLibraryAccess(RCTPromiseRejectBlock reject, PhotosAuthor inputURI = request.URL; saveBlock(); } else { - [self.bridge.imageLoader loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) { + [[self.bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) { if (error) { reject(kErrorUnableToLoad, nil, error); return; diff --git a/Libraries/CameraRoll/RCTImagePickerManager.m b/Libraries/CameraRoll/RCTImagePickerManager.m index d7b57c7b7a2a11..4e73ad65c030fb 100644 --- a/Libraries/CameraRoll/RCTImagePickerManager.m +++ b/Libraries/CameraRoll/RCTImagePickerManager.m @@ -35,6 +35,7 @@ @implementation RCTImagePickerManager NSMutableArray *_pickers; NSMutableArray *_pickerCallbacks; NSMutableArray *_pickerCancelCallbacks; + NSMutableDictionary *> *_pendingVideoInfo; } RCT_EXPORT_MODULE(ImagePickerIOS); @@ -131,6 +132,24 @@ - (dispatch_queue_t)methodQueue cancelCallback:cancelCallback]; } +// In iOS 13, the URLs provided when selecting videos from the library are only valid while the +// info object provided by the delegate is retained. +// This method provides a way to clear out all retained pending info objects. +RCT_EXPORT_METHOD(clearAllPendingVideos) +{ + [_pendingVideoInfo removeAllObjects]; + _pendingVideoInfo = [NSMutableDictionary new]; +} + +// In iOS 13, the URLs provided when selecting videos from the library are only valid while the +// info object provided by the delegate is retained. +// This method provides a way to release the info object for a particular file url when the application +// is done with it, for example after the video has been uploaded or copied locally. +RCT_EXPORT_METHOD(removePendingVideo:(NSString *)url) +{ + [_pendingVideoInfo removeObjectForKey:url]; +} + - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { @@ -146,7 +165,15 @@ - (void)imagePickerController:(UIImagePickerController *)picker width = @(image.size.width); } if (imageURL) { - [self _dismissPicker:picker args:@[imageURL.absoluteString, RCTNullIfNil(height), RCTNullIfNil(width)]]; + NSString *imageURLString = imageURL.absoluteString; + // In iOS 13, video URLs are only valid while info dictionary is retained + if (@available(iOS 13.0, *)) { + if (isMovie) { + _pendingVideoInfo[imageURLString] = info; + } + } + + [self _dismissPicker:picker args:@[imageURLString, RCTNullIfNil(height), RCTNullIfNil(width)]]; return; } @@ -174,6 +201,7 @@ - (void)_presentPicker:(UIImagePickerController *)imagePicker _pickers = [NSMutableArray new]; _pickerCallbacks = [NSMutableArray new]; _pickerCancelCallbacks = [NSMutableArray new]; + _pendingVideoInfo = [NSMutableDictionary new]; } [_pickers addObject:imagePicker]; diff --git a/Libraries/CameraRoll/React-RCTCameraRoll.podspec b/Libraries/CameraRoll/React-RCTCameraRoll.podspec deleted file mode 100644 index d0d83cc881e4ff..00000000000000 --- a/Libraries/CameraRoll/React-RCTCameraRoll.podspec +++ /dev/null @@ -1,39 +0,0 @@ -# coding: utf-8 -# 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. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "React-RCTCameraRoll" - s.version = version - s.summary = "An API that provides access to the local camera roll or photo library." - s.homepage = "http://facebook.github.io/react-native/" - s.documentation_url = "https://facebook.github.io/react-native/docs/cameraroll" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) - s.source = source - s.source_files = "*.{h,m}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" - - s.dependency "React-Core", version - s.dependency "React-RCTImage", version - - s.osx.exclude_files = "RCTImagePickerManager.*", "RCTAssetsLibraryRequestHandler.*" # TODO(macOS GH#214) - -end diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index c1c3a40477580d..c32b8c0f460a93 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -32,7 +32,7 @@ function normalizeColor( // [TODO(macOS ISS#2323203) if (typeof color === 'object' && color !== null) { - const normalizeColorObject = require('normalizeColorObject'); // TODO(macOS ISS#2323203) + const normalizeColorObject = require('./normalizeColorObject'); // TODO(macOS ISS#2323203) const normalizedColorObj = normalizeColorObject(color); diff --git a/Libraries/Color/normalizeColorObject.android.js b/Libraries/Color/normalizeColorObject.android.js index cf4c181dc136a6..bbd5acc0384444 100644 --- a/Libraries/Color/normalizeColorObject.android.js +++ b/Libraries/Color/normalizeColorObject.android.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from './NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 38436280e2057e..d3f77888dd4d87 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from './NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, @@ -19,7 +19,7 @@ function normalizeColorObject( // a macos semantic color return color; } else if ('dynamic' in color && color.dynamic !== undefined) { - const normalizeColor = require('normalizeColor'); + const normalizeColor = require('./normalizeColor'); // a dynamic, appearance aware color const dynamic = color.dynamic; diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index 38436280e2057e..d3f77888dd4d87 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from './NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, @@ -19,7 +19,7 @@ function normalizeColorObject( // a macos semantic color return color; } else if ('dynamic' in color && color.dynamic !== undefined) { - const normalizeColor = require('normalizeColor'); + const normalizeColor = require('./normalizeColor'); // a dynamic, appearance aware color const dynamic = color.dynamic; diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js index bd89906110480c..5c9ab848d2ecff 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js @@ -10,12 +10,11 @@ 'use strict'; -const NativeModules = require('../../BatchedBridge/NativeModules'); +import NativeAccessibilityInfo from './NativeAccessibilityInfo'; + const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter'); const UIManager = require('../../ReactNative/UIManager'); -const RCTAccessibilityInfo = NativeModules.AccessibilityInfo; - const REDUCE_MOTION_EVENT = 'reduceMotionDidChange'; const TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange'; @@ -61,7 +60,11 @@ const AccessibilityInfo = { isReduceMotionEnabled: function(): Promise { return new Promise((resolve, reject) => { - RCTAccessibilityInfo.isReduceMotionEnabled(resolve); + if (NativeAccessibilityInfo) { + NativeAccessibilityInfo.isReduceMotionEnabled(resolve); + } else { + reject(false); + } }); }, @@ -74,7 +77,11 @@ const AccessibilityInfo = { isScreenReaderEnabled: function(): Promise { return new Promise((resolve, reject) => { - RCTAccessibilityInfo.isTouchExplorationEnabled(resolve); + if (NativeAccessibilityInfo) { + NativeAccessibilityInfo.isTouchExplorationEnabled(resolve); + } else { + reject(false); + } }); }, @@ -132,7 +139,7 @@ const AccessibilityInfo = { setAccessibilityFocus: function(reactTag: number): void { UIManager.sendAccessibilityEvent( reactTag, - UIManager.AccessibilityEventTypes.typeViewFocused, + UIManager.getConstants().AccessibilityEventTypes.typeViewFocused, ); }, @@ -142,7 +149,9 @@ const AccessibilityInfo = { * See http://facebook.github.io/react-native/docs/accessibilityinfo.html#announceforaccessibility */ announceForAccessibility: function(announcement: string): void { - RCTAccessibilityInfo.announceForAccessibility(announcement); + if (NativeAccessibilityInfo) { + NativeAccessibilityInfo.announceForAccessibility(announcement); + } }, }; diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js index c759491c62ea51..9a86653d452849 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js @@ -10,11 +10,10 @@ 'use strict'; -const NativeModules = require('../../BatchedBridge/NativeModules'); const Promise = require('../../Promise'); const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter'); -const AccessibilityManager = NativeModules.AccessibilityManager; +import NativeAccessibilityManager from './NativeAccessibilityManager'; const CHANGE_EVENT_NAME = { announcementFinished: 'announcementFinished', @@ -59,7 +58,11 @@ const AccessibilityInfo = { */ isBoldTextEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentBoldTextState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentBoldTextState(resolve, reject); + } else { + reject(reject); + } }); }, @@ -73,7 +76,11 @@ const AccessibilityInfo = { */ isGrayscaleEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentGrayscaleState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentGrayscaleState(resolve, reject); + } else { + reject(reject); + } }); }, @@ -87,7 +94,11 @@ const AccessibilityInfo = { */ isInvertColorsEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentInvertColorsState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentInvertColorsState(resolve, reject); + } else { + reject(reject); + } }); }, @@ -101,7 +112,11 @@ const AccessibilityInfo = { */ isReduceMotionEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentReduceMotionState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentReduceMotionState(resolve, reject); + } else { + reject(reject); + } }); }, @@ -115,7 +130,14 @@ const AccessibilityInfo = { */ isReduceTransparencyEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentReduceTransparencyState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentReduceTransparencyState( + resolve, + reject, + ); + } else { + reject(reject); + } }); }, @@ -129,7 +151,11 @@ const AccessibilityInfo = { */ isScreenReaderEnabled: function(): Promise { return new Promise((resolve, reject) => { - AccessibilityManager.getCurrentVoiceOverState(resolve, reject); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.getCurrentVoiceOverState(resolve, reject); + } else { + reject(reject); + } }); }, @@ -138,7 +164,7 @@ const AccessibilityInfo = { * * Same as `isScreenReaderEnabled` */ - get fetch() { + get fetch(): $FlowFixMe { return this.isScreenReaderEnabled; }, @@ -204,7 +230,9 @@ const AccessibilityInfo = { * See http://facebook.github.io/react-native/docs/accessibilityinfo.html#setaccessibilityfocus */ setAccessibilityFocus: function(reactTag: number): void { - AccessibilityManager.setAccessibilityFocus(reactTag); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.setAccessibilityFocus(reactTag); + } }, /** @@ -213,7 +241,9 @@ const AccessibilityInfo = { * See http://facebook.github.io/react-native/docs/accessibilityinfo.html#announceforaccessibility */ announceForAccessibility: function(announcement: string): void { - AccessibilityManager.announceForAccessibility(announcement); + if (NativeAccessibilityManager) { + NativeAccessibilityManager.announceForAccessibility(announcement); + } }, /** diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js new file mode 100644 index 00000000000000..ef2b968652082c --- /dev/null +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js @@ -0,0 +1,27 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +isReduceMotionEnabled: ( + onSuccess: (isReduceMotionEnabled: boolean) => void, + ) => void; + +isTouchExplorationEnabled: ( + onSuccess: (isScreenReaderEnabled: boolean) => void, + ) => void; + +setAccessibilityFocus: (reactTag: number) => void; + +announceForAccessibility: (announcement: string) => void; +} + +export default (TurboModuleRegistry.get('AccessibilityInfo'): ?Spec); diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js new file mode 100644 index 00000000000000..c9b042a665bbb4 --- /dev/null +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js @@ -0,0 +1,59 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getCurrentBoldTextState: ( + onSuccess: (isBoldTextEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +getCurrentGrayscaleState: ( + onSuccess: (isGrayscaleEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +getCurrentInvertColorsState: ( + onSuccess: (isInvertColorsEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +getCurrentReduceMotionState: ( + onSuccess: (isReduceMotionEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +getCurrentReduceTransparencyState: ( + onSuccess: (isReduceTransparencyEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +getCurrentVoiceOverState: ( + onSuccess: (isScreenReaderEnabled: boolean) => void, + onError: (error: Object) => void, + ) => void; + +setAccessibilityContentSizeMultipliers: (JSMultiipliers: {| + +extraSmall?: ?number, + +small?: ?number, + +medium?: ?number, + +large?: ?number, + +extraLarge?: ?number, + +extraExtraLarge?: ?number, + +extraExtraExtraLarge?: ?number, + +accessibilityMedium?: ?number, + +accessibilityLarge?: ?number, + +accessibilityExtraLarge?: ?number, + +accessibilityExtraExtraLarge?: ?number, + +accessibilityExtraExtraExtraLarge?: ?number, + |}) => void; + +setAccessibilityFocus: (reactTag: number) => void; + +announceForAccessibility: (announcement: string) => void; +} + +export default (TurboModuleRegistry.get('AccessibilityManager'): ?Spec); diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 5f67851f6398fa..effe52006edbe3 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -15,16 +15,14 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../View/View'); -const RCTActivityIndicatorViewNativeComponent = require('./RCTActivityIndicatorViewNativeComponent'); - import type {NativeComponent} from '../../Renderer/shims/ReactNative'; import type {ViewProps} from '../View/ViewPropTypes'; import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) -const RCTActivityIndicator = +const PlatformActivityIndicator = Platform.OS === 'android' ? require('../ProgressBarAndroid/ProgressBarAndroid') - : RCTActivityIndicatorViewNativeComponent; + : require('./ActivityIndicatorViewNativeComponent').default; const GRAY = '#999999'; @@ -94,6 +92,9 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => { ref: forwardedRef, style: sizeStyle, size: sizeProp, + }; + + const androidProps = { styleAttr: 'Normal', indeterminate: true, }; @@ -105,9 +106,12 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => { styles.container, style, )}> - {/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was - * found when making Flow check .android.js files. */} - + {Platform.OS === 'android' ? ( + // $FlowFixMe Flow doesn't know when this is the android component + + ) : ( + + )} ); }; diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicatorSchema.js b/Libraries/Components/ActivityIndicator/ActivityIndicatorSchema.js deleted file mode 100644 index 7da1cbc1c27f0c..00000000000000 --- a/Libraries/Components/ActivityIndicator/ActivityIndicatorSchema.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const SwitchSchema: SchemaType = { - modules: { - ActivityIndicatorSchema: { - components: { - ActivityIndicatorView: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [ - { - name: 'hidesWhenStopped', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'animating', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'styleAttr', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - { - name: 'color', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'size', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'small', - options: [ - { - name: 'small', - }, - { - name: 'large', - }, - ], - }, - }, - { - name: 'intermediate', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = SwitchSchema; diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js similarity index 63% rename from Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js rename to Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js index 3c278b2f80a6bf..a8282dc69e98e5 100644 --- a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js @@ -10,11 +10,13 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +import type {WithDefault} from '../../Types/CodegenTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; + +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) type NativeProps = $ReadOnly<{| @@ -25,21 +27,21 @@ type NativeProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#hideswhenstopped */ - hidesWhenStopped?: ?boolean, + hidesWhenStopped?: WithDefault, /** * Whether to show the indicator (true, the default) or hide it (false). * * See http://facebook.github.io/react-native/docs/activityindicator.html#animating */ - animating?: ?boolean, + animating?: WithDefault, /** * The foreground color of the spinner (default is gray). * * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ - color?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + color?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) /** * Size of the indicator (default is 'small'). @@ -47,15 +49,9 @@ type NativeProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#size */ - size?: ?('small' | 'large'), - - style?: ?ViewStyleProp, - styleAttr?: ?string, - indeterminate?: ?boolean, + size?: WithDefault<'small' | 'large', 'small'>, |}>; -type ActivityIndicatorNativeType = Class>; - -module.exports = ((requireNativeComponent( - 'RCTActivityIndicatorView', -): any): ActivityIndicatorNativeType); +export default (codegenNativeComponent('ActivityIndicatorView', { + paperComponentName: 'RCTActivityIndicatorView', +}): NativeComponentType); diff --git a/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap b/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap index 51f69150ab5916..fcd667d5670b89 100644 --- a/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap +++ b/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap @@ -22,7 +22,6 @@ exports[` should render as when not mocked 1`] = ` animating={true} color="#0000ff" hidesWhenStopped={true} - indeterminate={true} size="large" style={ Object { @@ -30,7 +29,6 @@ exports[` should render as when not mocked 1`] = ` "width": 36, } } - styleAttr="Normal" /> `; diff --git a/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js b/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js new file mode 100644 index 00000000000000..97edfcdf99c5d3 --- /dev/null +++ b/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js @@ -0,0 +1,23 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get( + 'TVNavigationEventEmitter', +): ?Spec); diff --git a/Libraries/Components/AppleTV/TVEventHandler.js b/Libraries/Components/AppleTV/TVEventHandler.js index debaa0f3418a03..852038ba12f57a 100644 --- a/Libraries/Components/AppleTV/TVEventHandler.js +++ b/Libraries/Components/AppleTV/TVEventHandler.js @@ -11,10 +11,10 @@ 'use strict'; const Platform = require('../../Utilities/Platform'); -const TVNavigationEventEmitter = require('../../BatchedBridge/NativeModules') - .TVNavigationEventEmitter; const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter'); +import NativeTVNavigationEventEmitter from './NativeTVNavigationEventEmitter'; + function TVEventHandler() { this.__nativeTVNavigationEventListener = null; this.__nativeTVNavigationEventEmitter = null; @@ -24,12 +24,12 @@ TVEventHandler.prototype.enable = function( component: ?any, callback: Function, ) { - if (Platform.OS === 'ios' && !TVNavigationEventEmitter) { + if (Platform.OS === 'ios' && !NativeTVNavigationEventEmitter) { return; } this.__nativeTVNavigationEventEmitter = new NativeEventEmitter( - TVNavigationEventEmitter, + NativeTVNavigationEventEmitter, ); this.__nativeTVNavigationEventListener = this.__nativeTVNavigationEventEmitter.addListener( 'onHWKeyEvent', diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index 3c4117c21a0989..8e5fae6eafa4c1 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -131,7 +131,7 @@ type ButtonProps = $ReadOnly<{| */ class Button extends React.Component { - render() { + render(): React.Node { const { accessibilityLabel, accessibilityHint, // TODO(OSS Candidate ISS#2710739) diff --git a/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js b/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js index 4c68a279f5813a..ca34641522189b 100644 --- a/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js +++ b/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js @@ -14,7 +14,7 @@ const requireNativeComponent = require('../../ReactNative/requireNativeComponent import type {ViewProps} from '../View/ViewPropTypes'; import type {SyntheticEvent} from '../../Types/CoreEventTypes'; import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type CheckBoxEvent = SyntheticEvent< $ReadOnly<{| @@ -45,8 +45,8 @@ type NativeProps = $ReadOnly<{| enabled?: boolean, tintColors: | {| - true: ?(number | NativeOrDynamicColorType), - false: ?(number | NativeOrDynamicColorType), + true: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + false: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) |} | typeof undefined, |}>; diff --git a/Libraries/Components/Clipboard/Clipboard.js b/Libraries/Components/Clipboard/Clipboard.js index 59b595fd8789a9..d58b2285473a78 100644 --- a/Libraries/Components/Clipboard/Clipboard.js +++ b/Libraries/Components/Clipboard/Clipboard.js @@ -10,7 +10,7 @@ 'use strict'; -const Clipboard = require('../../BatchedBridge/NativeModules').Clipboard; +import NativeClipboard from './NativeClipboard'; /** * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android @@ -25,7 +25,7 @@ module.exports = { * ``` */ getString(): Promise { - return Clipboard.getString(); + return NativeClipboard.getString(); }, /** * Set content of string type. You can use following code to set clipboard content @@ -37,6 +37,6 @@ module.exports = { * @param the content to be stored in the clipboard. */ setString(content: string) { - Clipboard.setString(content); + NativeClipboard.setString(content); }, }; diff --git a/Libraries/Components/Clipboard/NativeClipboard.js b/Libraries/Components/Clipboard/NativeClipboard.js new file mode 100644 index 00000000000000..93fc92873eecda --- /dev/null +++ b/Libraries/Components/Clipboard/NativeClipboard.js @@ -0,0 +1,22 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +getString: () => Promise; + +setString: (content: string) => void; +} + +export default (TurboModuleRegistry.getEnforcing('Clipboard'): Spec); diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index 9550619e9eb096..c01a3c495dd664 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -13,16 +13,15 @@ 'use strict'; +const RCTDatePickerNativeComponent = require('./RCTDatePickerNativeComponent'); const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../View/View'); const invariant = require('invariant'); -import type {ViewProps} from '../View/ViewPropTypes'; import type {SyntheticEvent} from '../../Types/CoreEventTypes'; - -const RCTDatePickerNativeComponent = require('./RCTDatePickerNativeComponent'); +import type {ViewProps} from '../View/ViewPropTypes'; type Event = SyntheticEvent< $ReadOnly<{| @@ -113,7 +112,9 @@ type Props = $ReadOnly<{| * source of truth. */ class DatePickerIOS extends React.Component { - static DefaultProps = { + static DefaultProps: $TEMPORARY$object<{| + mode: $TEMPORARY$string<'datetime'>, + |}> = { mode: 'datetime', }; @@ -137,7 +138,7 @@ class DatePickerIOS extends React.Component { this.props.onChange && this.props.onChange(event); }; - render() { + render(): React.Node { const props = this.props; invariant( props.date || props.initialDate, diff --git a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js index 92a78b35dab6da..4f9358e21a88ef 100644 --- a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +++ b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js @@ -10,9 +10,8 @@ 'use strict'; -const DatePickerModule = require('../../BatchedBridge/NativeModules') - .DatePickerAndroid; import type {Options, DatePickerOpenAction} from './DatePickerAndroidTypes'; +import NativeDatePickerAndroid from './NativeDatePickerAndroid'; /** * Convert a Date to a timestamp. @@ -74,7 +73,7 @@ class DatePickerAndroid { _toMillis(optionsMs, 'minDate'); _toMillis(optionsMs, 'maxDate'); } - return DatePickerModule.open(options); + return NativeDatePickerAndroid.open(options); } /** diff --git a/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js b/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js new file mode 100644 index 00000000000000..778befa4ebc84a --- /dev/null +++ b/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js @@ -0,0 +1,22 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +open: (options: Object) => Promise; +} + +export default (TurboModuleRegistry.getEnforcing( + 'DatePickerAndroid', +): Spec); diff --git a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js index e2e2aae1a536c7..e0c3c74490ac01 100644 --- a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js +++ b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js @@ -9,10 +9,10 @@ 'use strict'; -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var View = require('View'); +var React = require('react'); +var StyleSheet = require('../../StyleSheet/StyleSheet'); +var Text = require('../../Text/Text'); +var View = require('../View/View'); class DummyDatePickerMacOS extends React.Component { render() { diff --git a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js index e2e2aae1a536c7..e0c3c74490ac01 100644 --- a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js +++ b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js @@ -9,10 +9,10 @@ 'use strict'; -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var View = require('View'); +var React = require('react'); +var StyleSheet = require('../../StyleSheet/StyleSheet'); +var Text = require('../../Text/Text'); +var View = require('../View/View'); class DummyDatePickerMacOS extends React.Component { render() { diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index e879fcd7c23f3e..778b609fc29103 100644 --- a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +++ b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js @@ -10,37 +10,39 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import type {Element, Node} from 'react'; -import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) - -type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) - -type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; +import type { + WithDefault, + DirectEventHandler, + Int32, + Float, +} from 'react-native/Libraries/Types/CodegenTypes'; +import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import * as React from 'react'; + +type DrawerStateEvent = $ReadOnly<{| + drawerState: Int32, +|}>; -type DrawerStateEvent = SyntheticEvent< - $ReadOnly<{| - drawerState: number, - |}>, ->; +type DrawerSlideEvent = $ReadOnly<{| + offset: Float, +|}>; -type DrawerSlideEvent = SyntheticEvent< - $ReadOnly<{| - offset: number, - |}>, ->; +interface NativeCommands { + +openDrawer: (viewRef: React.Ref<'AndroidDrawerLayout'>) => void; + +closeDrawer: (viewRef: React.Ref<'AndroidDrawerLayout'>) => void; +} type NativeProps = $ReadOnly<{| + ...ViewProps, /** * Determines whether the keyboard gets dismissed in response to a drag. * - 'none' (the default), drags do not dismiss the keyboard. * - 'on-drag', the keyboard is dismissed when a drag begins. */ - keyboardDismissMode?: ?('none' | 'on-drag'), + keyboardDismissMode?: WithDefault<'none' | 'on-drag', 'none'>, /** * Specifies the background color of the drawer. The default value is white. @@ -58,13 +60,14 @@ type NativeProps = $ReadOnly<{| /** * Specifies the side of the screen from which the drawer will slide in. */ - drawerPosition: ?number, + drawerPosition?: WithDefault<'left' | 'right', 'left'>, /** * Specifies the width of the drawer, more precisely the width of the view that be pulled in * from the edge of the window. */ - drawerWidth?: ?number, + + drawerWidth?: ?Float, /** * Specifies the lock mode of the drawer. The drawer can be locked in 3 states: @@ -73,12 +76,15 @@ type NativeProps = $ReadOnly<{| * - locked-open, meaning that the drawer will stay opened and not respond to gestures. * The drawer may still be opened and closed programmatically (`openDrawer`/`closeDrawer`). */ - drawerLockMode?: ?('unlocked' | 'locked-closed' | 'locked-open'), + drawerLockMode?: WithDefault< + 'unlocked' | 'locked-closed' | 'locked-open', + 'unlocked', + >, /** * Function called whenever there is an interaction with the navigation view. */ - onDrawerSlide?: ?(event: DrawerSlideEvent) => mixed, + onDrawerSlide?: ?DirectEventHandler, /** * Function called when the drawer state has changed. The drawer can be in 3 states: @@ -87,22 +93,17 @@ type NativeProps = $ReadOnly<{| * - Settling, meaning that there was an interaction with the navigation view, and the * navigation view is now finishing its closing or opening animation */ - onDrawerStateChanged?: ?(state: DrawerStateEvent) => mixed, + onDrawerStateChanged?: ?DirectEventHandler, /** * Function called whenever the navigation view has been opened. */ - onDrawerOpen?: ?() => mixed, + onDrawerOpen?: ?DirectEventHandler, /** * Function called whenever the navigation view has been closed. */ - onDrawerClose?: ?() => mixed, - - /** - * The navigation view that will be rendered to the side of the screen and can be pulled in. - */ - renderNavigationView: () => Element, + onDrawerClose?: ?DirectEventHandler, /** * Make the drawer take the entire screen and draw the background of the @@ -110,13 +111,10 @@ type NativeProps = $ReadOnly<{| * effect on API 21+. */ statusBarBackgroundColor?: ?ColorValue, - - children?: Node, - style?: ?ViewStyleProp, |}>; -type AndroidDrawerLayoutNativeType = Class>; +export const Commands: NativeCommands = codegenNativeCommands({ + supportedCommands: ['openDrawer', 'closeDrawer'], +}); -module.exports = ((requireNativeComponent( - 'AndroidDrawerLayout', -): any): AndroidDrawerLayoutNativeType); +export default codegenNativeComponent('AndroidDrawerLayout'); diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index b7d2419a2ab7ca..5807013f55e1b1 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -12,23 +12,21 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); -const ReactNative = require('../../Renderer/shims/ReactNative'); const StatusBar = require('../StatusBar/StatusBar'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -const UIManager = require('../../ReactNative/UIManager'); const View = require('../View/View'); const nullthrows = require('nullthrows'); -const DrawerConsts = UIManager.getViewManagerConfig('AndroidDrawerLayout') - .Constants; const dismissKeyboard = require('../../Utilities/dismissKeyboard'); -const AndroidDrawerLayoutNativeComponent = require('./AndroidDrawerLayoutNativeComponent'); +import AndroidDrawerLayoutNativeComponent, { + Commands, +} from './AndroidDrawerLayoutNativeComponent'; const DRAWER_STATES = ['Idle', 'Dragging', 'Settling']; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import type {DirectEventHandler} from '../../Types/CodegenTypes'; import type { MeasureOnSuccessCallback, MeasureInWindowOnSuccessCallback, @@ -37,17 +35,9 @@ import type { type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; -type DrawerStateEvent = SyntheticEvent< - $ReadOnly<{| - drawerState: number, - |}>, ->; - -type DrawerSlideEvent = SyntheticEvent< - $ReadOnly<{| - offset: number, - |}>, ->; +type DrawerSlideEvent = $ReadOnly<{| + offset: number, +|}>; type Props = $ReadOnly<{| /** @@ -73,7 +63,7 @@ type Props = $ReadOnly<{| /** * Specifies the side of the screen from which the drawer will slide in. */ - drawerPosition: ?number, + drawerPosition: ?('left' | 'right'), /** * Specifies the width of the drawer, more precisely the width of the view that be pulled in @@ -93,7 +83,7 @@ type Props = $ReadOnly<{| /** * Function called whenever there is an interaction with the navigation view. */ - onDrawerSlide?: ?(event: DrawerSlideEvent) => mixed, + onDrawerSlide?: ?DirectEventHandler, /** * Function called when the drawer state has changed. The drawer can be in 3 states: @@ -154,7 +144,7 @@ type State = {| * return ( * navigationView}> * * Hello @@ -166,17 +156,29 @@ type State = {| * ``` */ class DrawerLayoutAndroid extends React.Component { - static positions = DrawerConsts.DrawerPosition; + static get positions(): mixed { + console.warn( + 'Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value "left" or "right"', + ); + + return {Left: 'left', Right: 'right'}; + } static defaultProps = { drawerBackgroundColor: 'white', }; - _nativeRef = React.createRef>>(); + _nativeRef = React.createRef(); state = {statusBarBackgroundColor: null}; render() { - const {onDrawerStateChanged, ...props} = this.props; + const { + onDrawerStateChanged, + renderNavigationView, + onDrawerOpen, + onDrawerClose, + ...props + } = this.props; const drawStatusBar = Platform.Version >= 21 && this.props.statusBarBackgroundColor; const drawerViewWrapper = ( @@ -189,7 +191,7 @@ class DrawerLayoutAndroid extends React.Component { }, ]} collapsable={false}> - {this.props.renderNavigationView()} + {renderNavigationView()} {drawStatusBar && } ); @@ -233,7 +235,7 @@ class DrawerLayoutAndroid extends React.Component { ); } - _onDrawerSlide = (event: DrawerSlideEvent) => { + _onDrawerSlide = event => { if (this.props.onDrawerSlide) { this.props.onDrawerSlide(event); } @@ -254,7 +256,7 @@ class DrawerLayoutAndroid extends React.Component { } }; - _onDrawerStateChanged = (event: DrawerStateEvent) => { + _onDrawerStateChanged = event => { if (this.props.onDrawerStateChanged) { this.props.onDrawerStateChanged( DRAWER_STATES[event.nativeEvent.drawerState], @@ -266,23 +268,14 @@ class DrawerLayoutAndroid extends React.Component { * Opens the drawer. */ openDrawer() { - UIManager.dispatchViewManagerCommand( - this._getDrawerLayoutHandle(), - UIManager.getViewManagerConfig('AndroidDrawerLayout').Commands.openDrawer, - null, - ); + Commands.openDrawer(nullthrows(this._nativeRef.current)); } /** * Closes the drawer. */ closeDrawer() { - UIManager.dispatchViewManagerCommand( - this._getDrawerLayoutHandle(), - UIManager.getViewManagerConfig('AndroidDrawerLayout').Commands - .closeDrawer, - null, - ); + Commands.closeDrawer(nullthrows(this._nativeRef.current)); } /** @@ -320,9 +313,6 @@ class DrawerLayoutAndroid extends React.Component { * * ) */ - _getDrawerLayoutHandle() { - return ReactNative.findNodeHandle(this._nativeRef.current); - } /** * Native methods diff --git a/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js b/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js index e9747a088b26fe..91c800f59c347c 100644 --- a/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js +++ b/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js @@ -12,7 +12,9 @@ 'use strict'; const React = require('react'); -// $FlowFixMe +/* $FlowFixMe(>=0.99.0 site=react_native_ios_fb) This comment suppresses an + * error found when Flow v0.99 was deployed. To see the error, delete this + * comment and run Flow. */ const DrawerLayoutAndroid = require('../DrawerLayoutAndroid.android'); const View = require('../../View/View'); @@ -23,7 +25,7 @@ describe('', () => { const instance = render.create( } />, ); @@ -34,7 +36,7 @@ describe('', () => { const output = render.shallow( } />, ); @@ -47,7 +49,7 @@ describe('', () => { const output = render.shallow( } />, ); @@ -60,7 +62,7 @@ describe('', () => { const instance = render.create( } />, ); diff --git a/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap b/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap index 7c52a48073776b..88f8eeca1714f5 100644 --- a/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap +++ b/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap @@ -3,13 +3,12 @@ exports[` should render as when mocked 1`] = ` should render as when moc exports[` should render as when not mocked 1`] = ` should render as when not exports[` should shallow render as when mocked 1`] = ` @@ -118,7 +116,7 @@ exports[` should shallow render as exports[` should shallow render as when not mocked 1`] = ` diff --git a/Libraries/Components/Keyboard/Keyboard.js b/Libraries/Components/Keyboard/Keyboard.js index 4e5674fb984c85..a024a447861bcd 100644 --- a/Libraries/Components/Keyboard/Keyboard.js +++ b/Libraries/Components/Keyboard/Keyboard.js @@ -11,12 +11,13 @@ 'use strict'; const LayoutAnimation = require('../../LayoutAnimation/LayoutAnimation'); -const invariant = require('invariant'); const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter'); -const KeyboardObserver = require('../../BatchedBridge/NativeModules') - .KeyboardObserver; + const dismissKeyboard = require('../../Utilities/dismissKeyboard'); -const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver); +const invariant = require('invariant'); + +import NativeKeyboardObserver from './NativeKeyboardObserver'; +const KeyboardEventEmitter = new NativeEventEmitter(NativeKeyboardObserver); export type KeyboardEventName = | 'keyboardWillShow' @@ -33,18 +34,30 @@ export type KeyboardEventEasing = | 'linear' | 'keyboard'; -type ScreenRect = $ReadOnly<{| +export type KeyboardEventCoordinates = $ReadOnly<{| screenX: number, screenY: number, width: number, height: number, |}>; -export type KeyboardEvent = $ReadOnly<{| +export type KeyboardEvent = AndroidKeyboardEvent | IOSKeyboardEvent; + +type BaseKeyboardEvent = {| duration: number, easing: KeyboardEventEasing, - endCoordinates: ScreenRect, - startCoordinates: ScreenRect, + endCoordinates: KeyboardEventCoordinates, +|}; + +export type AndroidKeyboardEvent = $ReadOnly<{| + ...BaseKeyboardEvent, + duration: 0, + easing: 'keyboard', +|}>; + +export type IOSKeyboardEvent = $ReadOnly<{| + ...BaseKeyboardEvent, + startCoordinates: KeyboardEventCoordinates, isEventFromThisApp: boolean, |}>; @@ -96,7 +109,21 @@ type KeyboardEventListener = (e: KeyboardEvent) => void; *``` */ -let Keyboard = { +let Keyboard: + | NativeEventEmitter + | $TEMPORARY$object<{| + addListener: ( + eventName: KeyboardEventName, + callback: KeyboardEventListener, + ) => $FlowFixMe, + dismiss: () => $FlowFixMe, + removeAllListeners: (eventName: KeyboardEventName) => $FlowFixMe, + removeListener: ( + eventName: KeyboardEventName, + callback: KeyboardEventListener, + ) => $FlowFixMe, + scheduleLayoutAnimation: (event: KeyboardEvent) => $FlowFixMe, + |}> = { /** * The `addListener` function connects a JavaScript function to an identified native * keyboard notification event. diff --git a/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 9f9bbbfc608185..ae0dd37fb0814c 100644 --- a/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -17,8 +17,8 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../View/View'); -import type EmitterSubscription from '../../vendor/emitter/EmitterSubscription'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; +import type EmitterSubscription from '../../vendor/emitter/EmitterSubscription'; import type { ViewProps, ViewLayout, @@ -61,7 +61,10 @@ type State = {| * adjusting its height, position, or bottom padding. */ class KeyboardAvoidingView extends React.Component { - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + enabled: boolean, + keyboardVerticalOffset: number, + |}> = { enabled: true, keyboardVerticalOffset: 0, }; diff --git a/Libraries/Components/Keyboard/NativeKeyboardObserver.js b/Libraries/Components/Keyboard/NativeKeyboardObserver.js new file mode 100644 index 00000000000000..e26598dd4cec3e --- /dev/null +++ b/Libraries/Components/Keyboard/NativeKeyboardObserver.js @@ -0,0 +1,21 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get('KeyboardObserver'): ?Spec); diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js index 67ff1d2d4dee2c..4a32d29836f8d0 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js @@ -11,9 +11,9 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../View/View'); -const RCTMaskedViewNativeComponent = require('./RCTMaskedViewNativeComponent'); import type {ViewProps} from '../View/ViewPropTypes'; +import RCTMaskedViewNativeComponent from './RCTMaskedViewNativeComponent'; type Props = $ReadOnly<{| ...ViewProps, @@ -65,7 +65,7 @@ type Props = $ReadOnly<{| class MaskedViewIOS extends React.Component { _hasWarnedInvalidRenderMask = false; - render() { + render(): React.Node { const {maskElement, children, ...otherViewProps} = this.props; if (!React.isValidElement(maskElement)) { diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.macos.js b/Libraries/Components/MaskedView/MaskedViewIOS.macos.js index 478913ae557277..37fbb0f7b523c3 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.macos.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.macos.js @@ -12,4 +12,4 @@ 'use strict'; -module.exports = require('UnimplementedView'); +module.exports = require('../UnimplementedViews/UnimplementedView'); diff --git a/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js b/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js index fcde810db52e90..f9c3de50ccdad1 100644 --- a/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js +++ b/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js @@ -8,17 +8,14 @@ * @flow */ -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, |}>; -type RCTMaskedViewNativeType = Class>; - -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'RCTMaskedView', -): any): RCTMaskedViewNativeType); +): NativeComponentType); diff --git a/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js b/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js index 5ca15e2febd833..759c6117d300f3 100644 --- a/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js +++ b/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js @@ -10,38 +10,45 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import {requireNativeComponent} from 'react-native'; +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +import type { + DirectEventHandler, + Int32, + WithDefault, +} from '../../Types/CodegenTypes'; import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type {ViewProps} from '../../Components/View/ViewPropTypes'; -type PickerAndroidChangeEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -type Item = $ReadOnly<{| +type PickerItem = $ReadOnly<{| label: string, - value: ?(number | string), - color?: ?number, + color?: ?Int32 | ?NativeOrDynamicColorType, // TODO(macOS ISS#2323203) +|}>; + +type PickerItemSelectEvent = $ReadOnly<{| + position: Int32, |}>; type NativeProps = $ReadOnly<{| - enabled?: ?boolean, - items: $ReadOnlyArray, - mode?: ?('dialog' | 'dropdown'), - onSelect?: (event: PickerAndroidChangeEvent) => void, - selected: number, - prompt?: ?string, - testID?: string, + ...ViewProps, style?: ?TextStyleProp, - accessibilityLabel?: ?string, + + // Props + color?: ?ColorValue, + enabled?: WithDefault, + items: $ReadOnlyArray, + prompt?: WithDefault, + selected: Int32, + + // Events + onSelect?: DirectEventHandler, |}>; -type DialogPickerNativeType = Class>; +type ReactPicker = Class>; module.exports = ((requireNativeComponent( 'AndroidDialogPicker', -): any): DialogPickerNativeType); +): any): ReactPicker); diff --git a/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js b/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js index 0992db755551c6..e837e9a86bd121 100644 --- a/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js +++ b/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js @@ -10,38 +10,45 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import {requireNativeComponent} from 'react-native'; +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +import type { + DirectEventHandler, + Int32, + WithDefault, +} from '../../Types/CodegenTypes'; import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type {ViewProps} from '../../Components/View/ViewPropTypes'; -type PickerAndroidChangeEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -type Item = $ReadOnly<{| +type PickerItem = $ReadOnly<{| label: string, - value: ?(number | string), - color?: ?number, + color?: ?Int32 | ?NativeOrDynamicColorType, // TODO(macOS ISS#2323203) +|}>; + +type PickerItemSelectEvent = $ReadOnly<{| + position: Int32, |}>; type NativeProps = $ReadOnly<{| - enabled?: ?boolean, - items: $ReadOnlyArray, - mode?: ?('dialog' | 'dropdown'), - onSelect?: (event: PickerAndroidChangeEvent) => void, - selected: number, - prompt?: ?string, - testID?: string, + ...ViewProps, style?: ?TextStyleProp, - accessibilityLabel?: ?string, + + // Props + color?: ?ColorValue, + enabled?: WithDefault, + items: $ReadOnlyArray, + prompt?: WithDefault, + selected: Int32, + + // Events + onSelect?: DirectEventHandler, |}>; -type DropdownPickerNativeType = Class>; +type ReactPicker = Class>; module.exports = ((requireNativeComponent( 'AndroidDropdownPicker', -): any): DropdownPickerNativeType); +): any): ReactPicker); diff --git a/Libraries/Components/Picker/Picker.js b/Libraries/Components/Picker/Picker.js index c3147754d70dc9..1f058486bb7478 100644 --- a/Libraries/Components/Picker/Picker.js +++ b/Libraries/Components/Picker/Picker.js @@ -121,20 +121,22 @@ class Picker extends React.Component { /** * On Android, display the options in a dialog. */ - static MODE_DIALOG = MODE_DIALOG; + static MODE_DIALOG: $TEMPORARY$string<'dialog'> = MODE_DIALOG; /** * On Android, display the options in a dropdown (this is the default). */ - static MODE_DROPDOWN = MODE_DROPDOWN; + static MODE_DROPDOWN: $TEMPORARY$string<'dropdown'> = MODE_DROPDOWN; - static Item = PickerItem; + static Item: typeof PickerItem = PickerItem; - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + mode: $TEMPORARY$string<'dialog'>, + |}> = { mode: MODE_DIALOG, }; - render() { + render(): React.Node { if ( Platform.OS === 'ios' || Platform.OS === 'macos' /* TODO(macOS ISS#2323203) */ diff --git a/Libraries/Components/Picker/PickerAndroid.android.js b/Libraries/Components/Picker/PickerAndroid.android.js index d6aafd918add3d..4fddefb8014887 100644 --- a/Libraries/Components/Picker/PickerAndroid.android.js +++ b/Libraries/Components/Picker/PickerAndroid.android.js @@ -10,138 +10,107 @@ 'use strict'; -const AndroidDropdownPickerNativeComponent = require('./AndroidDropdownPickerNativeComponent'); -const AndroidDialogPickerNativeComponent = require('./AndroidDialogPickerNativeComponent'); -const React = require('react'); -const StyleSheet = require('../../StyleSheet/StyleSheet'); - -const processColor = require('../../StyleSheet/processColor'); - -const REF_PICKER = 'picker'; -const MODE_DROPDOWN = 'dropdown'; +import AndroidDropdownPickerNativeComponent from './AndroidDropdownPickerNativeComponent'; +import AndroidDialogPickerNativeComponent from './AndroidDialogPickerNativeComponent'; +import * as React from 'react'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import processColor from '../../StyleSheet/processColor'; import type {SyntheticEvent} from '../../Types/CoreEventTypes'; import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; -type PickerAndroidChangeEvent = SyntheticEvent< +type PickerItemSelectSyntheticEvent = SyntheticEvent< $ReadOnly<{| position: number, |}>, >; -type PickerAndroidProps = $ReadOnly<{| +type PickerItemValue = number | string; + +type Props = $ReadOnly<{| + accessibilityLabel?: ?Stringish, children?: React.Node, style?: ?TextStyleProp, - selectedValue?: ?(number | string), + selectedValue?: ?PickerItemValue, enabled?: ?boolean, mode?: ?('dialog' | 'dropdown'), - onValueChange?: ?(itemValue: ?(string | number), itemIndex: number) => mixed, + onValueChange?: ?(itemValue: ?PickerItemValue, itemIndex: number) => mixed, prompt?: ?string, testID?: string, |}>; -type Item = $ReadOnly<{| - label: string, - value: ?(number | string), - color?: ?number, -|}>; - -type PickerAndroidState = {| - selectedIndex: number, - items: $ReadOnlyArray, -|}; - /** * Not exposed as a public API - use instead. */ +function PickerAndroid(props: Props): React.Node { + const pickerRef = React.useRef(null); -class PickerAndroid extends React.Component< - PickerAndroidProps, - PickerAndroidState, -> { - static getDerivedStateFromProps( - props: PickerAndroidProps, - ): PickerAndroidState { - let selectedIndex = 0; + const [items, selected] = React.useMemo(() => { + // eslint-disable-next-line no-shadow + let selected = 0; + // eslint-disable-next-line no-shadow const items = React.Children.map(props.children, (child, index) => { if (child === null) { - return; + return null; } if (child.props.value === props.selectedValue) { - selectedIndex = index; + selected = index; } - const childProps = { - value: child.props.value, - label: child.props.label, + const {color, label} = child.props; + return { + color: color == null ? null : processColor(color), + label, }; - if (child.props.color) { - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was - * found when making Flow check .android.js files. */ - childProps.color = processColor(child.props.color); - } - return childProps; }); - return {selectedIndex, items}; - } - - state = PickerAndroid.getDerivedStateFromProps(this.props); - - render() { - const Picker = - this.props.mode === MODE_DROPDOWN - ? AndroidDropdownPickerNativeComponent - : AndroidDialogPickerNativeComponent; - - const nativeProps = { - enabled: this.props.enabled, - items: this.state.items, - mode: this.props.mode, - onSelect: this._onChange, - prompt: this.props.prompt, - selected: this.state.selectedIndex, - testID: this.props.testID, - style: [styles.pickerAndroid, this.props.style], - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - accessibilityLabel: this.props.accessibilityLabel, - }; - - return ; - } - - _onChange = (event: PickerAndroidChangeEvent) => { - if (this.props.onValueChange) { - const position = event.nativeEvent.position; - if (position >= 0) { - const children = React.Children.toArray(this.props.children).filter( - item => item != null, - ); - const value = children[position].props.value; - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was - * found when making Flow check .android.js files. */ - if (this.props.selectedValue !== value) { - this.props.onValueChange(value, position); + return [items, selected]; + }, [props.children, props.selectedValue]); + + const onSelect = React.useCallback( + ({nativeEvent}: PickerItemSelectSyntheticEvent) => { + const {position} = nativeEvent; + const onValueChange = props.onValueChange; + + if (onValueChange != null) { + if (position >= 0) { + const children = React.Children.toArray(props.children).filter( + item => item != null, + ); + const value = children[position].props.value; + if (props.selectedValue !== value) { + onValueChange(value, position); + } + } else { + onValueChange(null, position); } - } else { - this.props.onValueChange(null, position); } - } - // The picker is a controlled component. This means we expect the - // on*Change handlers to be in charge of updating our - // `selectedValue` prop. That way they can also - // disallow/undo/mutate the selection of certain values. In other - // words, the embedder of this component should be the source of - // truth, not the native component. - if ( - this.refs[REF_PICKER] && - this.state.selectedIndex !== event.nativeEvent.position - ) { - this.refs[REF_PICKER].setNativeProps({ - selected: this.state.selectedIndex, - }); - } + const {current} = pickerRef; + if (current != null && position !== selected) { + current.setNativeProps({selected}); + } + }, + [props.children, props.onValueChange, props.selectedValue, selected], + ); + + const rootProps = { + accessibilityLabel: props.accessibilityLabel, + enabled: props.enabled, + items, + onSelect, + prompt: props.prompt, + ref: pickerRef, + selected, + style: StyleSheet.compose( + styles.pickerAndroid, + props.style, + ), + testID: props.testID, }; + return props.mode === 'dropdown' ? ( + + ) : ( + + ); } const styles = StyleSheet.create({ diff --git a/Libraries/Components/Picker/PickerAndroid.macos.js b/Libraries/Components/Picker/PickerAndroid.macos.js index 6fd9ef11d2bae6..f18dc0c217731c 100644 --- a/Libraries/Components/Picker/PickerAndroid.macos.js +++ b/Libraries/Components/Picker/PickerAndroid.macos.js @@ -11,4 +11,4 @@ 'use strict'; -module.exports = require('UnimplementedView'); +module.exports = require('../UnimplementedViews/UnimplementedView'); diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index d3dc5658649428..1fba7f6f2b395c 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -13,18 +13,18 @@ 'use strict'; +const RCTPickerNativeComponent = require('./RCTPickerNativeComponent'); const React = require('react'); const ReactNative = require('../../Renderer/shims/ReactNative'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../View/View'); const Platform = require('../../Utilities/Platform'); // TODO(macOS ISS#2323203) const processColor = require('../../StyleSheet/processColor'); -const RCTPickerNativeComponent = require('./RCTPickerNativeComponent'); -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {SyntheticEvent} from '../../Types/CoreEventTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {TextStyleProp} from '../../StyleSheet/StyleSheet'; import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< @@ -76,19 +76,19 @@ type ItemProps = $ReadOnly<{| color?: ?ColorValue, |}>; -const PickerIOSItem = (props: ItemProps) => { +const PickerIOSItem = (props: ItemProps): null => { return null; }; class PickerIOS extends React.Component { _picker: ?React.ElementRef = null; - state = { + state: State = { selectedIndex: 0, items: [], }; - static Item = PickerIOSItem; + static Item: (props: ItemProps) => null = PickerIOSItem; static getDerivedStateFromProps(props: Props): State { let selectedIndex = 0; @@ -108,7 +108,7 @@ class PickerIOS extends React.Component { return {selectedIndex, items}; } - render() { + render(): React.Node { return ( , + animating?: WithDefault, + color?: ?ColorValue, + testID?: WithDefault, |}>; -type ProgressBarAndroidType = Class>; - -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'AndroidProgressBar', -): any): ProgressBarAndroidType); +): NativeComponentType); diff --git a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js index 9f479341b0658f..ccce645eb49aa5 100644 --- a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js +++ b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js @@ -12,7 +12,9 @@ 'use strict'; const React = require('react'); -// $FlowFixMe +/* $FlowFixMe(>=0.99.0 site=react_native_ios_fb) This comment suppresses an + * error found when Flow v0.99 was deployed. To see the error, delete this + * comment and run Flow. */ const ProgressBarAndroid = require('../ProgressBarAndroid.android'); const render = require('../../../../jest/renderer'); diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js index dd6dcf51804790..05eb6ccea03e99 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js @@ -13,8 +13,7 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -const RCTProgressViewNativeComponent = require('./RCTProgressViewNativeComponent'); - +import RCTProgressViewNativeComponent from './RCTProgressViewNativeComponent'; import type {ImageSource} from '../../Image/ImageSource'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js index dbe907b051ce21..ab2b63b7b02ca5 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js @@ -15,8 +15,7 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -const RCTProgressViewNativeComponent = require('./RCTProgressViewNativeComponent'); - +import RCTProgressViewNativeComponent from './RCTProgressViewNativeComponent'; import type {ImageSource} from '../../Image/ImageSource'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; diff --git a/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js index c88004fb374539..42b436d2a70f62 100644 --- a/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +++ b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js @@ -10,25 +10,26 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type {Float, WithDefault} from '../../Types/CodegenTypes'; import type {ImageSource} from '../../Image/ImageSource'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; + type NativeProps = $ReadOnly<{| ...ViewProps, - progressViewStyle?: ?('default' | 'bar'), - progress?: ?number, + + // Props + progressViewStyle?: WithDefault<'default' | 'bar', 'default'>, + progress?: WithDefault, progressTintColor?: ?ColorValue, trackTintColor?: ?ColorValue, progressImage?: ?ImageSource, trackImage?: ?ImageSource, |}>; -type NativeProgressViewIOS = Class>; - -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'RCTProgressView', -): any): NativeProgressViewIOS); +): NativeComponentType); diff --git a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js index 487dcf9ae56208..37fd4e67842e75 100644 --- a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js @@ -10,18 +10,17 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; +import type { + DirectEventHandler, + Float, + Int32, + WithDefault, +} from '../../Types/CodegenTypes'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; - -const AndroidSwipeRefreshLayout = require('../../ReactNative/UIManager').getViewManagerConfig( - 'AndroidSwipeRefreshLayout', -); -const RefreshLayoutConsts = AndroidSwipeRefreshLayout - ? AndroidSwipeRefreshLayout.Constants - : {SIZE: {}}; type NativeProps = $ReadOnly<{| ...ViewProps, @@ -29,7 +28,7 @@ type NativeProps = $ReadOnly<{| /** * Whether the pull to refresh functionality is enabled. */ - enabled?: ?boolean, + enabled?: WithDefault, /** * The colors (at least one) that will be used to draw the refresh indicator. */ @@ -40,20 +39,25 @@ type NativeProps = $ReadOnly<{| progressBackgroundColor?: ?ColorValue, /** * Size of the refresh indicator, see RefreshControl.SIZE. + * + * This type isn't currently accurate. It really is specific numbers + * hard coded in the Android platform. + * + * Also, 1 isn't actually a safe default. We are able to set this here + * because native code isn't currently consuming the generated artifact. + * This will end up being + * size?: WithDefault<'default' | 'large', 'default'>, */ - size?: ?( - | typeof RefreshLayoutConsts.SIZE.DEFAULT - | typeof RefreshLayoutConsts.SIZE.LARGE - ), + size?: WithDefault, /** * Progress view top offset */ - progressViewOffset?: ?number, + progressViewOffset?: WithDefault, /** * Called when the view starts refreshing. */ - onRefresh?: ?() => mixed, + onRefresh?: ?DirectEventHandler, /** * Whether the view should be indicating an active refresh. @@ -61,8 +65,6 @@ type NativeProps = $ReadOnly<{| refreshing: boolean, |}>; -type AndroidSwipeRefreshLayoutNativeType = Class>; - -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'AndroidSwipeRefreshLayout', -): any): AndroidSwipeRefreshLayoutNativeType); +): NativeComponentType); diff --git a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutSchema.js b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutSchema.js deleted file mode 100644 index 5b7de36bbf2a90..00000000000000 --- a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutSchema.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ -'use strict'; - -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const AndroidSwipeRefreshLayoutSchema: SchemaType = { - modules: { - AndroidSwipeRefreshLayout: { - components: { - AndroidSwipeRefreshLayout: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [ - { - name: 'onRefresh', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - ], - props: [ - { - name: 'enabled', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: true, - }, - }, - { - name: 'colors', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - }, - { - name: 'progressBackgroundColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'size', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: 1, - }, - }, - { - name: 'progressViewOffset', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0, - }, - }, - { - name: 'refreshing', - optional: false, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = AndroidSwipeRefreshLayoutSchema; diff --git a/Libraries/Components/RefreshControl/RCTRefreshControlNativeComponent.js b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js similarity index 59% rename from Libraries/Components/RefreshControl/RCTRefreshControlNativeComponent.js rename to Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js index 1a20adadb2b7b2..24db172eb0c68f 100644 --- a/Libraries/Components/RefreshControl/RCTRefreshControlNativeComponent.js +++ b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js @@ -10,13 +10,14 @@ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - +import type {DirectEventHandler, WithDefault} from '../../Types/CodegenTypes'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -export type NativeProps = $ReadOnly<{| +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; + +type NativeProps = $ReadOnly<{| ...ViewProps, /** @@ -30,12 +31,12 @@ export type NativeProps = $ReadOnly<{| /** * The title displayed under the refresh indicator. */ - title?: ?string, + title?: WithDefault, /** * Called when the view starts refreshing. */ - onRefresh?: ?() => mixed, + onRefresh?: ?DirectEventHandler, /** * Whether the view should be indicating an active refresh. @@ -43,8 +44,6 @@ export type NativeProps = $ReadOnly<{| refreshing: boolean, |}>; -type PullToRefreshView = Class>; - -module.exports = ((requireNativeComponent( - 'RCTRefreshControl', -): any): PullToRefreshView); +export default (codegenNativeComponent('PullToRefreshView', { + paperComponentName: 'RCTRefreshControl', +}): NativeComponentType); diff --git a/Libraries/Components/RefreshControl/PullToRefreshViewSchema.js b/Libraries/Components/RefreshControl/PullToRefreshViewSchema.js deleted file mode 100644 index b6b08102ee8268..00000000000000 --- a/Libraries/Components/RefreshControl/PullToRefreshViewSchema.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const PullToRefreshViewSchema: SchemaType = { - modules: { - PullToRefreshView: { - components: { - PullToRefreshView: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [ - { - name: 'onRefresh', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - ], - props: [ - { - name: 'tintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'titleColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'title', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - { - name: 'refreshing', - optional: false, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = PullToRefreshViewSchema; diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index cb432db07b6839..1313e8e4c12497 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -12,16 +12,15 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); -const {NativeComponent} = require('../../Renderer/shims/ReactNative'); -const AndroidSwipeRefreshLayoutNativeComponent = require('./AndroidSwipeRefreshLayoutNativeComponent'); -const RCTRefreshControlNativeComponent = require('./RCTRefreshControlNativeComponent'); const nullthrows = require('nullthrows'); import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; +import AndroidSwipeRefreshLayoutNativeComponent from './AndroidSwipeRefreshLayoutNativeComponent'; +import PullToRefreshViewNativeComponent from './PullToRefreshViewNativeComponent'; -let RefreshLayoutConsts; +let RefreshLayoutConsts: any; if (Platform.OS === 'android') { const AndroidSwipeRefreshLayout = require('../../ReactNative/UIManager').getViewManagerConfig( 'AndroidSwipeRefreshLayout', @@ -82,7 +81,7 @@ export type RefreshControlProps = $ReadOnly<{| /** * Called when the view starts refreshing. */ - onRefresh?: ?() => mixed, + onRefresh?: ?() => void, /** * Whether the view should be indicating an active refresh. @@ -136,7 +135,7 @@ export type RefreshControlProps = $ReadOnly<{| * in the `onRefresh` function otherwise the refresh indicator will stop immediately. */ class RefreshControl extends React.Component { - static SIZE = RefreshLayoutConsts.SIZE; + static SIZE: any = RefreshLayoutConsts.SIZE; _setNativePropsOnRef: ?({refreshing: boolean}) => void; _lastNativeRefreshing = false; @@ -162,7 +161,7 @@ class RefreshControl extends React.Component { } } - render() { + render(): React.Node { const setRef = ref => (this._setNativePropsOnRef = ref ? ref.setNativeProps.bind(ref) : null); if (Platform.OS === 'ios') { @@ -175,7 +174,7 @@ class RefreshControl extends React.Component { ...props } = this.props; return ( - { componentDidMount() { RefreshControlMock.latestRef = this; } - render() { + render(): React.Element { return ; } } diff --git a/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js index b7b146b7d3cbb1..bbf4c52307b768 100644 --- a/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +++ b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js @@ -5,21 +5,24 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +'use strict'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type {WithDefault} from '../../Types/CodegenTypes'; + +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, - emulateUnlessSupported?: boolean, -|}>; -type RCTSafeAreaViewNativeType = Class>; + // Props + emulateUnlessSupported?: WithDefault, +|}>; -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'RCTSafeAreaView', -): any): RCTSafeAreaViewNativeType); +): NativeComponentType); diff --git a/Libraries/Components/SafeAreaView/SafeAreaView.js b/Libraries/Components/SafeAreaView/SafeAreaView.js index 55a226d761b875..198d4ba4f09708 100644 --- a/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -12,15 +12,15 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); const View = require('../View/View'); -import type {ViewProps} from '../View/ViewPropTypes'; import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type {ViewProps} from '../View/ViewPropTypes'; type Props = $ReadOnly<{| ...ViewProps, emulateUnlessSupported?: boolean, |}>; -let exported; +let exported: Class> | Class>; /** * Renders nested content and automatically applies paddings reflect the portion @@ -45,7 +45,8 @@ if (Platform.OS !== 'ios') { SafeAreaViewRef.displayName = 'SafeAreaView'; exported = ((SafeAreaViewRef: any): Class>); } else { - const RCTSafeAreaViewNativeComponent = require('./RCTSafeAreaViewNativeComponent'); + const RCTSafeAreaViewNativeComponent = require('./RCTSafeAreaViewNativeComponent') + .default; const SafeAreaView = ( props: Props, diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 67a24003d9b4c9..70f3aadba38087 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -27,19 +27,19 @@ const requireNativeComponent = require('../../ReactNative/requireNativeComponent const resolveAssetSource = require('../../Image/resolveAssetSource'); const splitLayoutProps = require('../../StyleSheet/splitLayoutProps'); +import type {NativeMethodsMixinType} from '../../Renderer/shims/ReactNativeTypes'; +import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; +import type {PointProp} from '../../StyleSheet/PointPropType'; +import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type { PressEvent, ScrollEvent, LayoutEvent, } from '../../Types/CoreEventTypes'; -import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; -import type {NativeMethodsMixinType} from '../../Renderer/shims/ReactNativeTypes'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import type {ViewProps} from '../View/ViewPropTypes'; -import type {PointProp} from '../../StyleSheet/PointPropType'; - -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {State as ScrollResponderState} from '../ScrollResponder'; +import type {ViewProps} from '../View/ViewPropTypes'; +import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader'; let AndroidScrollView; let AndroidHorizontalScrollContentView; @@ -367,6 +367,10 @@ type VRProps = $ReadOnly<{| scrollBarThumbImage?: ?($ReadOnly<{||}> | number), // Opaque type returned by import IMAGE from './image.jpg' |}>; +type StickyHeaderComponentType = React.ComponentType & { + setNextHeaderY: number => void, +}; + export type Props = $ReadOnly<{| ...ViewProps, ...TouchableProps, @@ -515,6 +519,13 @@ export type Props = $ReadOnly<{| * with `horizontal={true}`. */ stickyHeaderIndices?: ?$ReadOnlyArray, + /** + * A React Component that will be used to render sticky headers. + * To be used together with `stickyHeaderIndices` or with `SectionList`, defaults to `ScrollViewStickyHeader`. + * You may need to set this if your sticky header uses custom transforms (eg. translation), + * for example when you want your list to have an animated hidable header. + */ + StickyHeaderComponent?: StickyHeaderComponentType, /** * When set, causes the scroll view to stop at multiples of the value of * `snapToInterval`. This can be used for paginating through children @@ -534,7 +545,7 @@ export type Props = $ReadOnly<{| */ snapToOffsets?: ?$ReadOnlyArray, /** - * Use in conjuction with `snapToOffsets`. By default, the beginning + * Use in conjunction with `snapToOffsets`. By default, the beginning * of the list counts as a snap offset. Set `snapToStart` to false to disable * this behavior and allow the list to scroll freely between its start and * the first `snapToOffsets` offset. @@ -542,7 +553,7 @@ export type Props = $ReadOnly<{| */ snapToStart?: ?boolean, /** - * Use in conjuction with `snapToOffsets`. By default, the end + * Use in conjunction with `snapToOffsets`. By default, the end * of the list counts as a snap offset. Set `snapToEnd` to false to disable * this behavior and allow the list to scroll freely between its end and * the last `snapToOffsets` offset. @@ -563,7 +574,7 @@ export type Props = $ReadOnly<{| * * See [RefreshControl](docs/refreshcontrol.html). */ - // $FlowFixMe - how to handle generic type without existential opereator? + // $FlowFixMe - how to handle generic type without existential operator? refreshControl?: ?React.Element, children?: React.Node, |}>; @@ -588,6 +599,13 @@ function createScrollResponder( return scrollResponder; } +type ContextType = {|horizontal: boolean|} | null; +const Context = React.createContext(null); +const standardHorizontalContext: ContextType = Object.freeze({ + horizontal: true, +}); +const standardVerticalContext: ContextType = Object.freeze({horizontal: false}); + /** * Component that wraps platform ScrollView while providing * integration with touch locking "responder" system. @@ -624,6 +642,7 @@ function createScrollResponder( * supports out of the box. */ class ScrollView extends React.Component { + static Context: React$Context = Context; /** * Part 1: Removing ScrollResponder.Mixin: * @@ -680,10 +699,10 @@ class ScrollView extends React.Component { 0, ); _scrollAnimatedValueAttachment: ?{detach: () => void} = null; - _stickyHeaderRefs: Map = new Map(); + _stickyHeaderRefs: Map = new Map(); _headerLayoutYs: Map = new Map(); - state = { + state: State = { contentKey: 1, // TODO(macOS ISS#2323203) layoutHeight: null, ...ScrollResponder.Mixin.scrollResponderMixinGetInitialState(), @@ -695,10 +714,7 @@ class ScrollView extends React.Component { this.props.contentOffset ? this.props.contentOffset.y : 0, ); this._scrollAnimatedValue.setOffset( - /* $FlowFixMe(>=0.98.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.98 was deployed. To see the error delete this - * comment and run Flow. */ - this.props.contentInset ? this.props.contentInset.top : 0, + this.props.contentInset ? this.props.contentInset.top || 0 : 0, ); this._stickyHeaderRefs = new Map(); this._headerLayoutYs = new Map(); @@ -851,7 +867,7 @@ class ScrollView extends React.Component { } } - _setStickyHeaderRef(key, ref) { + _setStickyHeaderRef(key: string, ref: ?StickyHeaderComponentType) { if (ref) { this._stickyHeaderRefs.set(key, ref); } else { @@ -879,7 +895,9 @@ class ScrollView extends React.Component { const previousHeader = this._stickyHeaderRefs.get( this._getKeyForIndex(previousHeaderIndex, childArray), ); - previousHeader && previousHeader.setNextHeaderY(layoutY); + previousHeader && + previousHeader.setNextHeaderY && + previousHeader.setNextHeaderY(layoutY); } } @@ -1016,7 +1034,7 @@ class ScrollView extends React.Component { this._innerViewRef = ref; }; - render() { + render(): React.Node | React.Element { let ScrollViewClass; let ScrollContentContainerViewClass; if (Platform.OS === 'android') { @@ -1077,9 +1095,12 @@ class ScrollView extends React.Component { if (indexOfIndex > -1) { const key = child.key; const nextIndex = stickyHeaderIndices[indexOfIndex + 1]; + const StickyHeaderComponent = + this.props.StickyHeaderComponent || ScrollViewStickyHeader; return ( - this._setStickyHeaderRef(key, ref)} nextHeaderLayoutY={this._headerLayoutYs.get( this._getKeyForIndex(nextIndex, childArray), @@ -1089,13 +1110,23 @@ class ScrollView extends React.Component { inverted={this.props.invertStickyHeaders} scrollViewHeight={this.state.layoutHeight}> {child} - + ); } else { return child; } }); } + children = ( + + {children} + + ); const hasStickyHeaders = Array.isArray(stickyHeaderIndices) && stickyHeaderIndices.length > 0; diff --git a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 0510fae6b58fc9..c9a967f9c85602 100644 --- a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -18,7 +18,7 @@ import type {LayoutEvent} from '../../Types/CoreEventTypes'; const AnimatedView = AnimatedImplementation.createAnimatedComponent(View); -type Props = { +export type Props = { children?: React.Element, nextHeaderLayoutY: ?number, onLayout: (event: LayoutEvent) => void, @@ -38,7 +38,7 @@ type State = { }; class ScrollViewStickyHeader extends React.Component { - state = { + state: State = { measured: false, layoutY: 0, layoutHeight: 0, @@ -63,7 +63,7 @@ class ScrollViewStickyHeader extends React.Component { } }; - render() { + render(): React.Node { const {inverted, scrollViewHeight} = this.props; const {measured, layoutHeight, layoutY, nextHeaderLayoutY} = this.state; const inputRange: Array = [-1, 0]; diff --git a/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js b/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js index 85195684ca7cca..7360b7778dcaff 100644 --- a/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js +++ b/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js @@ -19,10 +19,10 @@ const requireNativeComponent = require('../../../ReactNative/requireNativeCompon const RCTScrollView = requireNativeComponent('RCTScrollView'); -const ScrollViewComponent = jest.genMockFromModule('../ScrollView'); +const ScrollViewComponent: $FlowFixMe = jest.genMockFromModule('../ScrollView'); class ScrollViewMock extends ScrollViewComponent { - render() { + render(): React.Element { return ( {this.props.refreshControl} diff --git a/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js b/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js index 68c9f7e52105e2..4d45a02b363377 100644 --- a/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +++ b/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js @@ -9,59 +9,35 @@ */ 'use strict'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; +import type { + BubblingEventHandler, + WithDefault, + Int32, +} from '../../Types/CodegenTypes'; +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; -type Event = SyntheticEvent< - $ReadOnly<{| - value: number, - selectedSegmentIndex: number, - |}>, ->; +export type OnChangeEvent = $ReadOnly<{| + value: Int32, + selectedSegmentIndex: Int32, +|}>; -type SegmentedControlIOSProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{| ...ViewProps, - /** - * The labels for the control's segment buttons, in order. - */ + + // Props values?: $ReadOnlyArray, - /** - * The index in `props.values` of the segment to be (pre)selected. - */ - selectedIndex?: ?number, - /** - * Callback that is called when the user taps a segment; - * passes the segment's value as an argument - */ - onValueChange?: ?(value: number) => mixed, - /** - * Callback that is called when the user taps a segment; - * passes the event as an argument - */ - onChange?: ?(event: Event) => mixed, - /** - * If false the user won't be able to interact with the control. - * Default value is true. - */ - enabled?: boolean, - /** - * Accent color of the control. - */ - tintColor?: ?string, - /** - * If true, then selecting a segment won't persist visually. - * The `onValueChange` callback will still work as expected. - */ - momentary?: ?boolean, -|}>; + selectedIndex?: WithDefault, + enabled?: WithDefault, + tintColor?: ?ColorValue, + momentary?: WithDefault, -type NativeSegmentedControlIOS = Class< - NativeComponent, ->; + // Events + onChange?: ?BubblingEventHandler, +|}>; -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'RCTSegmentedControl', -): any): NativeSegmentedControlIOS); +): NativeComponentType); diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js index 7e9f99b93da555..f438b1b8573a65 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js @@ -10,20 +10,12 @@ 'use strict'; -const React = require('react'); -const StyleSheet = require('../../StyleSheet/StyleSheet'); - -const RCTSegmentedControlNativeComponent = require('./RCTSegmentedControlNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import * as React from 'react'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import type {OnChangeEvent} from './RCTSegmentedControlNativeComponent'; import type {ViewProps} from '../View/ViewPropTypes'; - -type Event = SyntheticEvent< - $ReadOnly<{| - value: number, - selectedSegmentIndex: number, - |}>, ->; +import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent'; +import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; type SegmentedControlIOSProps = $ReadOnly<{| ...ViewProps, @@ -35,19 +27,8 @@ type SegmentedControlIOSProps = $ReadOnly<{| * The index in `props.values` of the segment to be (pre)selected. */ selectedIndex?: ?number, - /** - * Callback that is called when the user taps a segment; - * passes the segment's value as an argument - */ - onValueChange?: ?(value: number) => mixed, - /** - * Callback that is called when the user taps a segment; - * passes the event as an argument - */ - onChange?: ?(event: Event) => mixed, /** * If false the user won't be able to interact with the control. - * Default value is true. */ enabled?: boolean, /** @@ -59,6 +40,15 @@ type SegmentedControlIOSProps = $ReadOnly<{| * The `onValueChange` callback will still work as expected. */ momentary?: ?boolean, + /** + * Callback that is called when the user taps a segment + */ + onChange?: ?(event: SyntheticEvent) => void, + /** + * Callback that is called when the user taps a segment; + * passes the segment's value as an argument + */ + onValueChange?: ?(value: number) => mixed, |}>; type Props = $ReadOnly<{| @@ -93,19 +83,19 @@ class SegmentedControlIOS extends React.Component { enabled: true, }; - _onChange = (event: Event) => { + _onChange = (event: SyntheticEvent) => { this.props.onChange && this.props.onChange(event); this.props.onValueChange && this.props.onValueChange(event.nativeEvent.value); }; render() { - const {forwardedRef, ...props} = this.props; + const {forwardedRef, onValueChange, style, ...props} = this.props; return ( ); diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js index 9eda9b6d1580f7..533e322f67e042 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js @@ -12,21 +12,12 @@ 'use strict'; -const React = require('React'); -const StyleSheet = require('StyleSheet'); - -const requireNativeComponent = require('requireNativeComponent'); - -import type {SyntheticEvent} from 'CoreEventTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'ReactNative'; - -type Event = SyntheticEvent< - $ReadOnly<{| - value: number, - selectedSegmentIndex: number, - |}>, ->; +import * as React from 'react'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import type {OnChangeEvent} from './RCTSegmentedControlNativeComponent'; +import type {ViewProps} from '../View/ViewPropTypes'; +import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent'; +import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; type SegmentedControlIOSProps = $ReadOnly<{| ...ViewProps, @@ -38,16 +29,6 @@ type SegmentedControlIOSProps = $ReadOnly<{| * The index in `props.values` of the segment to be (pre)selected. */ selectedIndex?: ?number, - /** - * Callback that is called when the user taps a segment; - * passes the segment's value as an argument - */ - onValueChange?: ?(value: number) => mixed, - /** - * Callback that is called when the user taps a segment; - * passes the event as an argument - */ - onChange?: ?(event: Event) => mixed, /** * If false the user won't be able to interact with the control. * Default value is true. @@ -62,17 +43,22 @@ type SegmentedControlIOSProps = $ReadOnly<{| * The `onValueChange` callback will still work as expected. */ momentary?: ?boolean, + /** + * Callback that is called when the user taps a segment + */ + onChange?: ?(event: SyntheticEvent) => void, + /** + * Callback that is called when the user taps a segment; + * passes the segment's value as an argument + */ + onValueChange?: ?(value: number) => mixed, |}>; type Props = $ReadOnly<{| ...SegmentedControlIOSProps, - forwardedRef: ?React.Ref, + forwardedRef: ?React.Ref, |}>; -type NativeSegmentedControlIOS = Class< - NativeComponent, ->; - /** * Use `SegmentedControlIOS` to render a UISegmentedControl iOS. * @@ -94,29 +80,25 @@ type NativeSegmentedControlIOS = Class< * ```` */ -const RCTSegmentedControl = ((requireNativeComponent( - 'RCTSegmentedControl', -): any): NativeSegmentedControlIOS); - class SegmentedControlIOS extends React.Component { static defaultProps = { values: [], enabled: true, }; - _onChange = (event: Event) => { + _onChange = (event: SyntheticEvent) => { this.props.onChange && this.props.onChange(event); this.props.onValueChange && this.props.onValueChange(event.nativeEvent.value); }; render() { - const {forwardedRef, ...props} = this.props; + const {forwardedRef, onValueChange, style, ...props} = this.props; return ( - ); @@ -129,11 +111,10 @@ const styles = StyleSheet.create({ }, }); -// $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet. const SegmentedControlIOSWithRef = React.forwardRef( ( props: SegmentedControlIOSProps, - forwardedRef: ?React.Ref, + forwardedRef: ?React.Ref, ) => { return ; }, @@ -142,5 +123,4 @@ const SegmentedControlIOSWithRef = React.forwardRef( /* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this * comment and run Flow. */ -// $FlowFixMe module.exports = (SegmentedControlIOSWithRef: NativeSegmentedControlIOS); diff --git a/Libraries/Components/Slider/RCTSliderNativeComponent.js b/Libraries/Components/Slider/RCTSliderNativeComponent.js deleted file mode 100644 index 71e20a3f8eaaee..00000000000000 --- a/Libraries/Components/Slider/RCTSliderNativeComponent.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; -import type {ImageSource} from '../../Image/ImageSource'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ViewProps} from '../View/ViewPropTypes'; - -type Event = SyntheticEvent< - $ReadOnly<{| - value: number, - fromUser?: boolean, - |}>, ->; - -type NativeProps = $ReadOnly<{| - ...ViewProps, - disabled?: ?boolean, - enabled?: ?boolean, - maximumTrackImage?: ?ImageSource, - maximumTrackTintColor?: ?ColorValue, - maximumValue?: ?number, - minimumTrackImage?: ?ImageSource, - minimumTrackTintColor?: ?ColorValue, - minimumValue?: ?number, - onChange?: ?(event: Event) => void, - onSlidingComplete?: ?(event: Event) => void, - onValueChange?: ?(event: Event) => void, - step?: ?number, - testID?: ?string, - thumbImage?: ?ImageSource, - thumbTintColor?: ?ColorValue, - trackImage?: ?ImageSource, - value?: ?number, -|}>; - -type RCTSliderType = Class>; - -module.exports = ((requireNativeComponent('RCTSlider'): any): RCTSliderType); diff --git a/Libraries/Components/Slider/Slider.js b/Libraries/Components/Slider/Slider.js index 618a1490362a39..f75af5c341d7e0 100644 --- a/Libraries/Components/Slider/Slider.js +++ b/Libraries/Components/Slider/Slider.js @@ -11,7 +11,7 @@ 'use strict'; const Platform = require('../../Utilities/Platform'); -const RCTSliderNativeComponent = require('./RCTSliderNativeComponent'); +import SliderNativeComponent from './SliderNativeComponent'; const React = require('react'); const ReactNative = require('../../Renderer/shims/ReactNative'); const StyleSheet = require('../../StyleSheet/StyleSheet'); @@ -197,7 +197,7 @@ type Props = $ReadOnly<{| */ const Slider = ( props: Props, - forwardedRef?: ?React.Ref, + forwardedRef?: ?React.Ref, ) => { const style = StyleSheet.compose( styles.slider, @@ -227,7 +227,7 @@ const Slider = ( : null; return ( - ; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + + // Props + disabled?: WithDefault, + enabled?: WithDefault, + maximumTrackImage?: ?ImageSource, + maximumTrackTintColor?: ?ColorValue, + maximumValue?: WithDefault, + minimumTrackImage?: ?ImageSource, + minimumTrackTintColor?: ?ColorValue, + minimumValue?: WithDefault, + step?: WithDefault, + testID?: WithDefault, + thumbImage?: ?ImageSource, + thumbTintColor?: ?ColorValue, + trackImage?: ?ImageSource, + value?: WithDefault, + + // Events + onChange?: ?BubblingEventHandler, + onValueChange?: ?BubblingEventHandler, + onSlidingComplete?: ?DirectEventHandler, +|}>; + +export default (codegenNativeComponent('Slider', { + interfaceOnly: true, + paperComponentName: 'RCTSlider', +}): NativeComponentType); diff --git a/Libraries/Components/Slider/SliderSchema.js b/Libraries/Components/Slider/SliderSchema.js deleted file mode 100644 index f3e75ad491abc8..00000000000000 --- a/Libraries/Components/Slider/SliderSchema.js +++ /dev/null @@ -1,218 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const SliderSchema: SchemaType = { - modules: { - SliderSchema: { - components: { - Slider: { - interfaceOnly: true, - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [ - { - name: 'onChange', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [ - { - type: 'FloatTypeAnnotation', - name: 'value', - optional: false, - }, - { - type: 'BooleanTypeAnnotation', - name: 'fromUser', - optional: false, - }, - ], - }, - }, - }, - { - name: 'onSlidingComplete', - optional: true, - bubblingType: 'direct', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [ - { - type: 'FloatTypeAnnotation', - name: 'value', - optional: false, - }, - { - type: 'BooleanTypeAnnotation', - name: 'fromUser', - optional: false, - }, - ], - }, - }, - }, - { - name: 'onValueChange', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [ - { - type: 'FloatTypeAnnotation', - name: 'value', - optional: false, - }, - { - type: 'BooleanTypeAnnotation', - name: 'fromUser', - optional: false, - }, - ], - }, - }, - }, - ], - props: [ - { - name: 'disabled', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'enabled', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'maximumTrackImage', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'maximumTrackTintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'maximumValue', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 1, - }, - }, - { - name: 'minimumTrackImage', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'minimumTrackTintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'minimumValue', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0, - }, - }, - { - name: 'step', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0, - }, - }, - { - name: 'testID', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - { - name: 'thumbImage', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'trackImage', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'thumbTintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'value', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0, - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = SliderSchema; diff --git a/Libraries/Components/Sound/NativeSoundManager.js b/Libraries/Components/Sound/NativeSoundManager.js new file mode 100644 index 00000000000000..80ba8743fde455 --- /dev/null +++ b/Libraries/Components/Sound/NativeSoundManager.js @@ -0,0 +1,23 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +/** + * Native Module used for playing sounds in native platform. + */ +export interface Spec extends TurboModule { + +playTouchSound: () => void; +} + +export default (TurboModuleRegistry.getEnforcing('SoundManager'): Spec); diff --git a/Libraries/Components/Sound/SoundManager.js b/Libraries/Components/Sound/SoundManager.js new file mode 100644 index 00000000000000..71847bd788317b --- /dev/null +++ b/Libraries/Components/Sound/SoundManager.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; +import NativeSoundManager from './NativeSoundManager'; + +const SoundManager = { + playTouchSound: function(): void { + NativeSoundManager.playTouchSound(); + }, +}; + +module.exports = SoundManager; diff --git a/Libraries/Components/StaticContainer.react.js b/Libraries/Components/StaticContainer.react.js index 948e16ef85c5c0..aab461272d19ff 100644 --- a/Libraries/Components/StaticContainer.react.js +++ b/Libraries/Components/StaticContainer.react.js @@ -43,7 +43,7 @@ class StaticContainer extends React.Component { return !!nextProps.shouldUpdate; } - render() { + render(): null | React$Node { const child = this.props.children; return child === null || child === false ? null diff --git a/Libraries/Components/StatusBar/NativeStatusBarManager.js b/Libraries/Components/StatusBar/NativeStatusBarManager.js new file mode 100644 index 00000000000000..2d6db94160add9 --- /dev/null +++ b/Libraries/Components/StatusBar/NativeStatusBarManager.js @@ -0,0 +1,54 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +export interface Spec extends TurboModule { + // Android only + +getConstants: () => {| + +HEIGHT: number, + +DEFAULT_BACKGROUND_COLOR: number, + |}; + +setColor: ( + color: number | NativeOrDynamicColorType, // TODO(macOS ISS#2323203) + animated: boolean, + ) => void; + +setTranslucent: (translucent: boolean) => void; + + // iOS only + // TODO(T47754272) Can we remove this method? + +getHeight: (callback: (result: {|height: number|}) => void) => void; + +setNetworkActivityIndicatorVisible: (visible: boolean) => void; + +addListener: (eventType: string) => void; + +removeListeners: (count: number) => void; + + // Android and iOS + /** + * - animated is iOS only + * - statusBarStyles can be: + * - 'default' (iOS and Android) + * - 'dark-content' (iOS and Android) + * - 'light-content' (iOS) + */ + +setStyle: (statusBarStyle?: ?string, animated?: ?boolean) => void; + /** + * - withAnimation is iOS only + * - withAnimation can be: 'none' | 'fade' | 'slide' + */ + +setHidden: (hidden: boolean, withAnimation?: ?string) => void; +} + +export default (TurboModuleRegistry.getEnforcing( + 'StatusBarManager', +): Spec); diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index a9d1b5232d3d91..0f6fdca7bb908d 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -10,15 +10,14 @@ 'use strict'; -const React = require('react'); const Platform = require('../../Utilities/Platform'); +const React = require('react'); const processColor = require('../../StyleSheet/processColor'); -const StatusBarManager = require('../../BatchedBridge/NativeModules') - .StatusBarManager; +import NativeStatusBarManager from './NativeStatusBarManager'; -import type {ColorValue} from 'StyleSheetTypes'; // TODO(macOS ISS#2323203) +import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; // TODO(macOS ISS#2323203) /** * Status bar style @@ -225,7 +224,9 @@ class StatusBar extends React.Component { animated: false, showHideTransition: 'fade', backgroundColor: Platform.select({ - android: StatusBarManager.DEFAULT_BACKGROUND_COLOR ?? 'black', + android: + NativeStatusBarManager.getConstants().DEFAULT_BACKGROUND_COLOR ?? + 'black', ios: 'black', }), barStyle: 'default', @@ -247,7 +248,7 @@ class StatusBar extends React.Component { * * @platform android */ - static currentHeight = StatusBarManager.HEIGHT; + static currentHeight: number = NativeStatusBarManager.getConstants().HEIGHT; // Provide an imperative API as static functions of the component. // See the corresponding prop for more detail. @@ -262,9 +263,9 @@ class StatusBar extends React.Component { animation = animation || 'none'; StatusBar._defaultProps.hidden.value = hidden; if (Platform.OS === 'ios') { - StatusBarManager.setHidden(hidden, animation); + NativeStatusBarManager.setHidden(hidden, animation); } else if (Platform.OS === 'android') { - StatusBarManager.setHidden(hidden); + NativeStatusBarManager.setHidden(hidden); } } @@ -277,9 +278,9 @@ class StatusBar extends React.Component { animated = animated || false; StatusBar._defaultProps.barStyle.value = style; if (Platform.OS === 'ios') { - StatusBarManager.setStyle(style, animated); + NativeStatusBarManager.setStyle(style, animated); } else if (Platform.OS === 'android') { - StatusBarManager.setStyle(style); + NativeStatusBarManager.setStyle(style); } } @@ -295,7 +296,7 @@ class StatusBar extends React.Component { return; } StatusBar._defaultProps.networkActivityIndicatorVisible = visible; - StatusBarManager.setNetworkActivityIndicatorVisible(visible); + NativeStatusBarManager.setNetworkActivityIndicatorVisible(visible); } /** @@ -310,7 +311,16 @@ class StatusBar extends React.Component { } animated = animated || false; StatusBar._defaultProps.backgroundColor.value = color; - StatusBarManager.setColor(processColor(color), animated); + + const processedColor = processColor(color); + if (processedColor == null) { + console.warn( + `\`StatusBar.setBackgroundColor\`: Color ${color} parsed to null or undefined`, + ); + return; + } + + NativeStatusBarManager.setColor(processedColor, animated); } /** @@ -323,7 +333,7 @@ class StatusBar extends React.Component { return; } StatusBar._defaultProps.translucent = translucent; - StatusBarManager.setTranslucent(translucent); + NativeStatusBarManager.setTranslucent(translucent); } /** @@ -332,7 +342,7 @@ class StatusBar extends React.Component { * * @param props Object containing the StatusBar props to use in the stack entry. */ - static pushStackEntry(props: any) { + static pushStackEntry(props: any): any { const entry = createStackEntry(props); StatusBar._propsStack.push(entry); StatusBar._updatePropsStack(); @@ -358,7 +368,7 @@ class StatusBar extends React.Component { * @param entry Entry returned from `pushStackEntry` to replace. * @param props Object containing the StatusBar props to use in the replacement stack entry. */ - static replaceStackEntry(entry: any, props: any) { + static replaceStackEntry(entry: any, props: any): any { const newEntry = createStackEntry(props); const index = StatusBar._propsStack.indexOf(entry); if (index !== -1) { @@ -368,7 +378,10 @@ class StatusBar extends React.Component { return newEntry; } - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + animated: boolean, + showHideTransition: $TEMPORARY$string<'fade'>, + |}> = { animated: false, showHideTransition: 'fade', }; @@ -379,7 +392,7 @@ class StatusBar extends React.Component { // Every time a StatusBar component is mounted, we push it's prop to a stack // and always update the native status bar with the props from the top of then // stack. This allows having multiple StatusBar components and the one that is - // added last or is deeper in the view hierachy will have priority. + // added last or is deeper in the view hierarchy will have priority. this._stackEntry = StatusBar.pushStackEntry(this.props); } @@ -415,13 +428,13 @@ class StatusBar extends React.Component { !oldProps || oldProps.barStyle.value !== mergedProps.barStyle.value ) { - StatusBarManager.setStyle( + NativeStatusBarManager.setStyle( mergedProps.barStyle.value, mergedProps.barStyle.animated || false, ); } if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) { - StatusBarManager.setHidden( + NativeStatusBarManager.setHidden( mergedProps.hidden.value, mergedProps.hidden.animated ? mergedProps.hidden.transition @@ -434,7 +447,7 @@ class StatusBar extends React.Component { oldProps.networkActivityIndicatorVisible !== mergedProps.networkActivityIndicatorVisible ) { - StatusBarManager.setNetworkActivityIndicatorVisible( + NativeStatusBarManager.setNetworkActivityIndicatorVisible( mergedProps.networkActivityIndicatorVisible, ); } @@ -443,22 +456,33 @@ class StatusBar extends React.Component { !oldProps || oldProps.barStyle.value !== mergedProps.barStyle.value ) { - StatusBarManager.setStyle(mergedProps.barStyle.value); + NativeStatusBarManager.setStyle(mergedProps.barStyle.value); } if ( !oldProps || oldProps.backgroundColor.value !== mergedProps.backgroundColor.value ) { - StatusBarManager.setColor( - processColor(mergedProps.backgroundColor.value), - mergedProps.backgroundColor.animated, + const processedColor = processColor( + mergedProps.backgroundColor.value, ); + if (processedColor == null) { + console.warn( + `\`StatusBar._updatePropsStack\`: Color ${ + mergedProps.backgroundColor.value + } parsed to null or undefined`, + ); + } else { + NativeStatusBarManager.setColor( + processedColor, + mergedProps.backgroundColor.animated, + ); + } } if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) { - StatusBarManager.setHidden(mergedProps.hidden.value); + NativeStatusBarManager.setHidden(mergedProps.hidden.value); } if (!oldProps || oldProps.translucent !== mergedProps.translucent) { - StatusBarManager.setTranslucent(mergedProps.translucent); + NativeStatusBarManager.setTranslucent(mergedProps.translucent); } } // Update the current prop values. diff --git a/Libraries/Components/StatusBar/StatusBarIOS.ios.js b/Libraries/Components/StatusBar/StatusBarIOS.ios.js index 7dd0f818ec23bb..f3ebbf4d98824c 100644 --- a/Libraries/Components/StatusBar/StatusBarIOS.ios.js +++ b/Libraries/Components/StatusBar/StatusBarIOS.ios.js @@ -11,11 +11,12 @@ 'use strict'; const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter'); -const {StatusBarManager} = require('../../BatchedBridge/NativeModules'); + +import NativeStatusBarManager from './NativeStatusBarManager'; /** * Use `StatusBar` for mutating the status bar. */ class StatusBarIOS extends NativeEventEmitter {} -module.exports = new StatusBarIOS(StatusBarManager); +module.exports = (new StatusBarIOS(NativeStatusBarManager): StatusBarIOS); diff --git a/Libraries/Components/Switch/AndroidSwitchNativeComponent.js b/Libraries/Components/Switch/AndroidSwitchNativeComponent.js new file mode 100644 index 00000000000000..90217d18e6e4ea --- /dev/null +++ b/Libraries/Components/Switch/AndroidSwitchNativeComponent.js @@ -0,0 +1,49 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +const {NativeComponent} = require('../../Renderer/shims/ReactNative'); + +const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); + +import type {SyntheticEvent} from '../../Types/CoreEventTypes'; +import type {ViewProps} from '../View/ViewPropTypes'; +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +type SwitchChangeEvent = SyntheticEvent< + $ReadOnly<{| + value: boolean, + |}>, +>; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + + // Props + disabled?: ?boolean, + enabled?: ?boolean, + thumbColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackColorForFalse?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackColorForTrue?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + value?: ?boolean, + on?: ?boolean, + thumbTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + + // Events + onChange?: ?(event: SwitchChangeEvent) => mixed, +|}>; + +type SwitchNativeComponentType = Class>; + +module.exports = ((requireNativeComponent( + 'AndroidSwitch', +): any): SwitchNativeComponentType); diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index d47c61b00b04b0..3eb9f092f883d6 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -10,15 +10,21 @@ 'use strict'; -const SwitchNativeComponent = require('./SwitchNativeComponent'); +const AndroidSwitchNativeComponent = require('./AndroidSwitchNativeComponent'); const Platform = require('../../Utilities/Platform'); const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -import type {SwitchChangeEvent} from '../../Types/CoreEventTypes'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; +import type {SyntheticEvent} from '../../Types/CoreEventTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeAndroidProps, NativeIOSProps} from './SwitchNativeComponent'; +import SwitchNativeComponent from './SwitchNativeComponent'; + +type SwitchChangeEvent = SyntheticEvent< + $ReadOnly<{| + value: boolean, + |}>, +>; export type Props = $ReadOnly<{| ...ViewProps, @@ -83,9 +89,11 @@ export type Props = $ReadOnly<{| * supplied `value` prop instead of the expected result of any user actions. */ class Switch extends React.Component { - _nativeSwitchRef: ?React.ElementRef; + _nativeSwitchRef: ?React.ElementRef< + typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent, + >; - render() { + render(): React.Node { const { disabled, ios_backgroundColor, @@ -130,37 +138,50 @@ class Switch extends React.Component { } } - const platformProps = - Platform.OS === 'android' - ? ({ - enabled: disabled !== true, - on: value === true, - style, - thumbTintColor: _thumbColor, - trackColorForFalse: _trackColorForFalse, - trackColorForTrue: _trackColorForTrue, - trackTintColor: - value === true ? _trackColorForTrue : _trackColorForFalse, - }: NativeAndroidProps) - : ({ - disabled, - onTintColor: _trackColorForTrue, - style: StyleSheet.compose( - {height: 31, width: 51}, - StyleSheet.compose( - style, - ios_backgroundColor == null - ? null - : { - backgroundColor: ios_backgroundColor, - borderRadius: 16, - }, - ), - ), - thumbTintColor: _thumbColor, - tintColor: _trackColorForFalse, - value: value === true, - }: NativeIOSProps); + if (Platform.OS === 'android') { + const platformProps = { + enabled: disabled !== true, + on: value === true, + style, + thumbTintColor: _thumbColor, + trackColorForFalse: _trackColorForFalse, + trackColorForTrue: _trackColorForTrue, + trackTintColor: + value === true ? _trackColorForTrue : _trackColorForFalse, + }; + + return ( + + ); + } + + const platformProps = { + disabled, + onTintColor: _trackColorForTrue, + style: StyleSheet.compose( + {height: 31, width: 51}, + StyleSheet.compose( + style, + ios_backgroundColor == null + ? null + : { + backgroundColor: ios_backgroundColor, + borderRadius: 16, + }, + ), + ), + thumbTintColor: _thumbColor, + tintColor: _trackColorForFalse, + value: value === true, + }; return ( { }; _handleSwitchNativeComponentRef = ( - ref: ?React.ElementRef, + ref: ?React.ElementRef< + typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent, + >, ) => { this._nativeSwitchRef = ref; }; diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index 20b2254648131e..a1af1f39ed487c 100644 --- a/Libraries/Components/Switch/SwitchNativeComponent.js +++ b/Libraries/Components/Switch/SwitchNativeComponent.js @@ -10,57 +10,37 @@ 'use strict'; -const Platform = require('../../Utilities/Platform'); -const ReactNative = require('../../Renderer/shims/ReactNative'); - -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {SwitchChangeEvent} from '../../Types/CoreEventTypes'; +import type {BubblingEventHandler, WithDefault} from '../../Types/CodegenTypes'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) -type SwitchProps = $ReadOnly<{| - ...ViewProps, - disabled?: ?boolean, - onChange?: ?(event: SwitchChangeEvent) => mixed, - thumbColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - trackColorForFalse?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - trackColorForTrue?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - value?: ?boolean, -|}>; - -// @see ReactSwitchManager.java -export type NativeAndroidProps = $ReadOnly<{| - ...SwitchProps, +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; - enabled?: ?boolean, - on?: ?boolean, - thumbTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - trackTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) +type SwitchChangeEvent = $ReadOnly<{| + value: boolean, |}>; -// @see RCTSwitchManager.m -export type NativeIOSProps = $ReadOnly<{| - ...SwitchProps, +type NativeProps = $ReadOnly<{| + ...ViewProps, - onTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - thumbTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) - tintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) -|}>; + // Props + disabled?: WithDefault, + value?: WithDefault, + tintColor?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + onTintColor?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + thumbTintColor?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) -type SwitchNativeComponentType = Class< - ReactNative.NativeComponent< - $ReadOnly<{| - ...NativeAndroidProps, - ...NativeIOSProps, - |}>, - >, ->; + // Deprecated props + thumbColor?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackColorForFalse?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackColorForTrue?: ?(ColorValue | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) -const SwitchNativeComponent: SwitchNativeComponentType = - Platform.OS === 'android' - ? (requireNativeComponent('AndroidSwitch'): any) - : (requireNativeComponent('RCTSwitch'): any); + // Events + onChange?: ?BubblingEventHandler, +|}>; -module.exports = SwitchNativeComponent; +export default (codegenNativeComponent('Switch', { + paperComponentName: 'RCTSwitch', +}): NativeComponentType); diff --git a/Libraries/Components/Switch/SwitchSchema.js b/Libraries/Components/Switch/SwitchSchema.js deleted file mode 100644 index 47f4491133f4d4..00000000000000 --- a/Libraries/Components/Switch/SwitchSchema.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -/* $FlowFixMe */ -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const SwitchSchema: SchemaType = { - modules: { - Switch: { - components: { - Switch: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [ - { - name: 'onChange', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [ - { - type: 'BooleanTypeAnnotation', - name: 'value', - optional: false, - }, - ], - }, - }, - }, - ], - props: [ - { - name: 'disabled', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'value', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'tintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'onTintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'thumbTintColor', - optional: true, - typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = SwitchSchema; diff --git a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index aa6b88ea8a7a55..baf644cbb250a4 100644 --- a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -12,7 +12,7 @@ import {requireNativeComponent} from 'react-native'; -const AndroidTextInputNativeComponent = requireNativeComponent( +const AndroidTextInputNativeComponent: string = requireNativeComponent( 'AndroidTextInput', ); diff --git a/Libraries/Components/TextInput/InputAccessoryView.js b/Libraries/Components/TextInput/InputAccessoryView.js index 10c933e2cd283e..e9b8f1c670591a 100644 --- a/Libraries/Components/TextInput/InputAccessoryView.js +++ b/Libraries/Components/TextInput/InputAccessoryView.js @@ -14,7 +14,7 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -const RCTInputAccessoryViewNativeComponent = require('./RCTInputAccessoryViewNativeComponent'); +import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; diff --git a/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js b/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js index f66701fc747093..152615a45e799e 100644 --- a/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +++ b/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js @@ -9,26 +9,17 @@ */ 'use strict'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; +import type {ViewProps} from '../View/ViewPropTypes'; -const React = require('react'); -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| - +children: React.Node, - /** - * An ID which is used to associate this `InputAccessoryView` to - * specified TextInput(s). - */ - nativeID?: ?string, - style?: ?ViewStyleProp, + ...ViewProps, backgroundColor?: ?ColorValue, |}>; -type NativeInputAccessoryView = Class>; - -module.exports = ((requireNativeComponent( +export default (codegenNativeComponent( 'RCTInputAccessoryView', -): any): NativeInputAccessoryView); +): NativeComponentType); diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index b5f1d3f10a4e8f..e0301cbcf26e64 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -9,12 +9,10 @@ */ 'use strict'; -const DeprecatedColorPropType = require('../../DeprecatedPropTypes/DeprecatedColorPropType'); -const DeprecatedViewPropTypes = require('../../DeprecatedPropTypes/DeprecatedViewPropTypes'); +const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes'); const DocumentSelectionState = require('../../vendor/document/selection/DocumentSelectionState'); const NativeMethodsMixin = require('../../Renderer/shims/NativeMethodsMixin'); const Platform = require('../../Utilities/Platform'); -const PropTypes = require('prop-types'); const React = require('react'); const ReactNative = require('../../Renderer/shims/ReactNative'); const StyleSheet = require('../../StyleSheet/StyleSheet'); @@ -126,34 +124,25 @@ export type EditingEvent = SyntheticEvent< |}>, >; -const DataDetectorTypes = [ - // iOS+macOS - 'phoneNumber', - 'link', - 'address', - 'calendarEvent', - // iOS-only - 'none', - 'all', - // macOS-only // [TODO(macOS ISS#2323203) - 'ortography', - 'spelling', - 'grammar', - 'quote', - 'dash', - 'replacement', - 'correction', - 'regularExpression', - 'transitInformation', // ]TODO(macOS ISS#2323203) -]; - type DataDetectorTypesType = + // iOS+macOS | 'phoneNumber' | 'link' | 'address' | 'calendarEvent' + // iOS-only | 'none' - | 'all'; + | 'all' + // macOS-only // [TODO(macOS ISS#2323203) + | 'ortography' + | 'spelling' + | 'grammar' + | 'quote' + | 'dash' + | 'replacement' + | 'correction' + | 'regularExpression' + | 'transitInformation'; // ]TODO(macOS ISS#2323203) export type KeyboardType = // Cross Platform @@ -193,51 +182,161 @@ export type ReturnKeyType = export type AutoCapitalize = 'none' | 'sentences' | 'words' | 'characters'; +export type TextContentType = + | 'none' + | 'URL' + | 'addressCity' + | 'addressCityAndState' + | 'addressState' + | 'countryName' + | 'creditCardNumber' + | 'emailAddress' + | 'familyName' + | 'fullStreetAddress' + | 'givenName' + | 'jobTitle' + | 'location' + | 'middleName' + | 'name' + | 'namePrefix' + | 'nameSuffix' + | 'nickname' + | 'organizationName' + | 'postalCode' + | 'streetAddressLine1' + | 'streetAddressLine2' + | 'sublocality' + | 'telephoneNumber' + | 'username' + | 'password' + | 'newPassword' + | 'oneTimeCode'; + +type PasswordRules = string; + type IOSProps = $ReadOnly<{| + /** + * If `false`, disables spell-check style (i.e. red underlines). + * The default value is inherited from `autoCorrect`. + * @platform ios + */ spellCheck?: ?boolean, + + /** + * Determines the color of the keyboard. + * @platform ios + */ keyboardAppearance?: ?('default' | 'light' | 'dark'), + + /** + * If `true`, the keyboard disables the return key when there is no text and + * automatically enables it when there is text. The default value is `false`. + * @platform ios + */ enablesReturnKeyAutomatically?: ?boolean, + + /** + * An instance of `DocumentSelectionState`, this is some state that is responsible for + * maintaining selection information for a document. + * + * Some functionality that can be performed with this instance is: + * + * - `blur()` + * - `focus()` + * - `update()` + * + * > You can reference `DocumentSelectionState` in + * > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js) + * + * @platform ios + */ selectionState?: ?DocumentSelectionState, + + /** + * When the clear button should appear on the right side of the text view. + * This property is supported only for single-line TextInput component. + * @platform ios + */ clearButtonMode?: ?('never' | 'while-editing' | 'unless-editing' | 'always'), + + /** + * If `true`, clears the text field automatically when editing begins. + * @platform ios + */ clearTextOnFocus?: ?boolean, + + /** + * Determines the types of data converted to clickable URLs in the text input. + * Only valid if `multiline={true}` and `editable={false}`. + * By default no data types are detected. + * + * You can provide one type or an array of many types. + * + * Possible values for `dataDetectorTypes` are: + * + * - `'phoneNumber'` + * - `'link'` + * - `'address'` + * - `'calendarEvent'` + * - `'none'` + * - `'all'` + * + * @platform ios + */ dataDetectorTypes?: | ?DataDetectorTypesType | $ReadOnlyArray, + + /** + * An optional identifier which links a custom InputAccessoryView to + * this text input. The InputAccessoryView is rendered above the + * keyboard when this text input is focused. + * @platform ios + */ inputAccessoryViewID?: ?string, - textContentType?: ?( - | 'none' - | 'URL' - | 'addressCity' - | 'addressCityAndState' - | 'addressState' - | 'countryName' - | 'creditCardNumber' - | 'emailAddress' - | 'familyName' - | 'fullStreetAddress' - | 'givenName' - | 'jobTitle' - | 'location' - | 'middleName' - | 'name' - | 'namePrefix' - | 'nameSuffix' - | 'nickname' - | 'organizationName' - | 'postalCode' - | 'streetAddressLine1' - | 'streetAddressLine2' - | 'sublocality' - | 'telephoneNumber' - | 'username' - | 'password' - | 'newPassword' - | 'oneTimeCode' - ), + + /** + * Give the keyboard and the system information about the + * expected semantic meaning for the content that users enter. + * @platform ios + */ + textContentType?: ?TextContentType, + + PasswordRules?: ?PasswordRules, + + /** + * If `false`, scrolling of the text view will be disabled. + * The default value is `true`. Does only work with 'multiline={true}'. + * @platform ios + */ scrollEnabled?: ?boolean, |}>; type AndroidProps = $ReadOnly<{| + /** + * Determines which content to suggest on auto complete, e.g.`username`. + * To disable auto complete, use `off`. + * + * *Android Only* + * + * The following values work on Android only: + * + * - `username` + * - `password` + * - `email` + * - `name` + * - `tel` + * - `street-address` + * - `postal-code` + * - `cc-number` + * - `cc-csc` + * - `cc-exp` + * - `cc-exp-month` + * - `cc-exp-year` + * - `off` + * + * @platform android + */ autoCompleteType?: ?( | 'cc-csc' | 'cc-exp' @@ -253,13 +352,62 @@ type AndroidProps = $ReadOnly<{| | 'username' | 'off' ), + + /** + * Sets the return key to the label. Use it instead of `returnKeyType`. + * @platform android + */ returnKeyLabel?: ?string, + + /** + * Sets the number of lines for a `TextInput`. Use it with multiline set to + * `true` to be able to fill the lines. + * @platform android + */ numberOfLines?: ?number, + + /** + * When `false`, if there is a small amount of space available around a text input + * (e.g. landscape orientation on a phone), the OS may choose to have the user edit + * the text inside of a full screen text input mode. When `true`, this feature is + * disabled and users will always edit the text directly inside of the text input. + * Defaults to `false`. + * @platform android + */ disableFullscreenUI?: ?boolean, + + /** + * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` + * The default value is `simple`. + * @platform android + */ textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'), + + /** + * The color of the `TextInput` underline. + * @platform android + */ underlineColorAndroid?: ?ColorValue, + + /** + * If defined, the provided image resource will be rendered on the left. + * The image resource must be inside `/android/app/src/main/res/drawable` and referenced + * like + * ``` + * + * ``` + * @platform android + */ inlineImageLeft?: ?string, + + /** + * Padding between the inline image, if any, and the text input itself. + * @platform android + */ inlineImagePadding?: ?number, + importantForAutofill?: ?( | 'auto' | 'no' @@ -267,47 +415,295 @@ type AndroidProps = $ReadOnly<{| | 'yes' | 'yesExcludeDescendants' ), + + /** + * When `false`, it will prevent the soft keyboard from showing when the field is focused. + * Defaults to `true`. + * @platform android + */ + showSoftInputOnFocus?: ?boolean, |}>; type Props = $ReadOnly<{| ...$Diff>, ...IOSProps, ...AndroidProps, + + /** + * Can tell `TextInput` to automatically capitalize certain characters. + * + * - `characters`: all characters. + * - `words`: first letter of each word. + * - `sentences`: first letter of each sentence (*default*). + * - `none`: don't auto capitalize anything. + */ autoCapitalize?: ?AutoCapitalize, + + /** + * If `false`, disables auto-correct. The default value is `true`. + */ autoCorrect?: ?boolean, + + /** + * If `true`, focuses the input on `componentDidMount`. + * The default value is `false`. + */ autoFocus?: ?boolean, + + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. The + * default is `true`. + */ allowFontScaling?: ?boolean, + + /** + * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. + * Possible values: + * `null/undefined` (default): inherit from the parent node or the global default (0) + * `0`: no max, ignore parent/global default + * `>= 1`: sets the maxFontSizeMultiplier of this node to this value + */ maxFontSizeMultiplier?: ?number, + + /** + * If `false`, text is not editable. The default value is `true`. + */ editable?: ?boolean, + + /** + * Determines which keyboard to open, e.g.`numeric`. + * + * The following values work across platforms: + * + * - `default` + * - `numeric` + * - `number-pad` + * - `decimal-pad` + * - `email-address` + * - `phone-pad` + * + * *iOS Only* + * + * The following values work on iOS only: + * + * - `ascii-capable` + * - `numbers-and-punctuation` + * - `url` + * - `name-phone-pad` + * - `twitter` + * - `web-search` + * + * *Android Only* + * + * The following values work on Android only: + * + * - `visible-password` + */ keyboardType?: ?KeyboardType, + + /** + * Determines how the return key should look. On Android you can also use + * `returnKeyLabel`. + * + * *Cross platform* + * + * The following values work across platforms: + * + * - `done` + * - `go` + * - `next` + * - `search` + * - `send` + * + * *Android Only* + * + * The following values work on Android only: + * + * - `none` + * - `previous` + * + * *iOS Only* + * + * The following values work on iOS only: + * + * - `default` + * - `emergency-call` + * - `google` + * - `join` + * - `route` + * - `yahoo` + */ returnKeyType?: ?ReturnKeyType, + + /** + * Limits the maximum number of characters that can be entered. Use this + * instead of implementing the logic in JS to avoid flicker. + */ maxLength?: ?number, + + /** + * If `true`, the text input can be multiple lines. + * The default value is `false`. + */ multiline?: ?boolean, + + /** + * Callback that is called when the text input is blurred. + */ onBlur?: ?(e: BlurEvent) => mixed, + + /** + * Callback that is called when the text input is focused. + */ onFocus?: ?(e: FocusEvent) => mixed, + + /** + * Callback that is called when the text input's text changes. + */ onChange?: ?(e: ChangeEvent) => mixed, + + /** + * Callback that is called when the text input's text changes. + * Changed text is passed as an argument to the callback handler. + */ onChangeText?: ?(text: string) => mixed, + + /** + * Callback that is called when the text input's content size changes. + * This will be called with + * `{ nativeEvent: { contentSize: { width, height } } }`. + * + * Only called for multiline text inputs. + */ onContentSizeChange?: ?(e: ContentSizeChangeEvent) => mixed, + onTextInput?: ?(e: TextInputEvent) => mixed, + + /** + * Callback that is called when text input ends. + */ onEndEditing?: ?(e: EditingEvent) => mixed, + + /** + * Callback that is called when the text input selection is changed. + * This will be called with + * `{ nativeEvent: { selection: { start, end } } }`. + */ onSelectionChange?: ?(e: SelectionChangeEvent) => mixed, + + /** + * Callback that is called when the text input's submit button is pressed. + * Invalid if `multiline={true}` is specified. + */ onSubmitEditing?: ?(e: EditingEvent) => mixed, + + /** + * Callback that is called when a key is pressed. + * This will be called with `{ nativeEvent: { key: keyValue } }` + * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and + * the typed-in character otherwise including `' '` for space. + * Fires before `onChange` callbacks. + */ onKeyPress?: ?(e: KeyPressEvent) => mixed, + + /** + * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. + * May also contain other properties from ScrollEvent but on Android contentSize + * is not provided for performance reasons. + */ onScroll?: ?(e: ScrollEvent) => mixed, + + /** + * The string that will be rendered before text input has been entered. + */ placeholder?: ?Stringish, + + /** + * The text color of the placeholder string. + */ placeholderTextColor?: ?ColorValue, + + /** + * If `true`, the text input obscures the text entered so that sensitive text + * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. + */ secureTextEntry?: ?boolean, + + /** + * The highlight and cursor color of the text input. + */ selectionColor?: ?ColorValue, + + /** + * The start and end of the text input's selection. Set start and end to + * the same value to position the cursor. + */ selection?: ?$ReadOnly<{| start: number, end?: ?number, |}>, + + /** + * The value to show for the text input. `TextInput` is a controlled + * component, which means the native value will be forced to match this + * value prop if provided. For most uses, this works great, but in some + * cases this may cause flickering - one common cause is preventing edits + * by keeping value the same. In addition to simply setting the same value, + * either set `editable={false}`, or set/update `maxLength` to prevent + * unwanted edits without flicker. + */ value?: ?Stringish, + + /** + * Provides an initial value that will change when the user starts typing. + * Useful for simple use-cases where you do not want to deal with listening + * to events and updating the value prop to keep the controlled state in sync. + */ defaultValue?: ?Stringish, + + /** + * If `true`, all text will automatically be selected on focus. + */ selectTextOnFocus?: ?boolean, + + /** + * If `true`, the text field will blur when submitted. + * The default value is true for single-line fields and false for + * multiline fields. Note that for multiline fields, setting `blurOnSubmit` + * to `true` means that pressing return will blur the field and trigger the + * `onSubmitEditing` event instead of inserting a newline into the field. + * Ignored on Android, if Hardware Keyboard is connected. // TODO(android ISS) + */ blurOnSubmit?: ?boolean, + + /** + * Note that not all Text styles are supported, an incomplete list of what is not supported includes: + * + * - `borderLeftWidth` + * - `borderTopWidth` + * - `borderRightWidth` + * - `borderBottomWidth` + * - `borderTopLeftRadius` + * - `borderTopRightRadius` + * - `borderBottomRightRadius` + * - `borderBottomLeftRadius` + * + * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) + * for more detail. + * + * [Styles](docs/style.html) + */ style?: ?TextStyleProp, + + /** + * If `true`, caret is hidden. The default value is `false`. + * This property is supported only for single-line TextInput component on iOS. + */ caretHidden?: ?boolean, + + /* + * If `true`, contextMenuHidden is hidden. The default value is `false`. + */ contextMenuHidden?: ?boolean, |}>; @@ -423,6 +819,19 @@ const emptyFunctionThatReturnsTrue = () => true; * in AndroidManifest.xml ( https://developer.android.com/guide/topics/manifest/activity-element.html ) * or control this param programmatically with native code. * + * + * The following values work on macOS only: + * + * - `'ortography'` + * - `'spelling'` + * - `'grammar'` + * - `'quote'` + * - `'dash'` + * - `'replacement'` + * - `'correction'` + * - `'regularExpression'` + * - `'transitInformation'` + * */ const TextInput = createReactClass({ @@ -434,534 +843,7 @@ const TextInput = createReactClass({ blurTextInput: TextInputState.blurTextInput, }, }, - propTypes: { - ...DeprecatedViewPropTypes, - /** - * Can tell `TextInput` to automatically capitalize certain characters. - * - * - `characters`: all characters. - * - `words`: first letter of each word. - * - `sentences`: first letter of each sentence (*default*). - * - `none`: don't auto capitalize anything. - */ - autoCapitalize: PropTypes.oneOf([ - 'none', - 'sentences', - 'words', - 'characters', - ]), - /** - * Determines which content to suggest on auto complete, e.g.`username`. - * To disable auto complete, use `off`. - * - * *Android Only* - * - * The following values work on Android only: - * - * - `username` - * - `password` - * - `email` - * - `name` - * - `tel` - * - `street-address` - * - `postal-code` - * - `cc-number` - * - `cc-csc` - * - `cc-exp` - * - `cc-exp-month` - * - `cc-exp-year` - * - `off` - * - * @platform android - */ - autoCompleteType: PropTypes.oneOf([ - 'cc-csc', - 'cc-exp', - 'cc-exp-month', - 'cc-exp-year', - 'cc-number', - 'email', - 'name', - 'password', - 'postal-code', - 'street-address', - 'tel', - 'username', - 'off', - ]), - /** - * If `false`, disables auto-correct. The default value is `true`. - */ - autoCorrect: PropTypes.bool, - /** - * If `false`, disables spell-check style (i.e. red underlines). - * The default value is inherited from `autoCorrect`. - * @platform ios - */ - spellCheck: PropTypes.bool, - /** - * If `true`, focuses the input on `componentDidMount`. - * The default value is `false`. - */ - autoFocus: PropTypes.bool, - /** - * Specifies whether fonts should scale to respect Text Size accessibility settings. The - * default is `true`. - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * If `false`, text is not editable. The default value is `true`. - */ - editable: PropTypes.bool, - /** - * Determines which keyboard to open, e.g.`numeric`. - * - * The following values work across platforms: - * - * - `default` - * - `numeric` - * - `number-pad` - * - `decimal-pad` - * - `email-address` - * - `phone-pad` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `ascii-capable` - * - `numbers-and-punctuation` - * - `url` - * - `name-phone-pad` - * - `twitter` - * - `web-search` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `visible-password` - */ - keyboardType: PropTypes.oneOf([ - // Cross-platform - 'default', - 'email-address', - 'numeric', - 'phone-pad', - 'number-pad', - // iOS-only - 'ascii-capable', - 'numbers-and-punctuation', - 'url', - 'name-phone-pad', - 'decimal-pad', - 'twitter', - 'web-search', - // Android-only - 'visible-password', - ]), - /** - * Determines the color of the keyboard. - * @platform ios - */ - keyboardAppearance: PropTypes.oneOf(['default', 'light', 'dark']), - /** - * Determines how the return key should look. On Android you can also use - * `returnKeyLabel`. - * - * *Cross platform* - * - * The following values work across platforms: - * - * - `done` - * - `go` - * - `next` - * - `search` - * - `send` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `none` - * - `previous` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `default` - * - `emergency-call` - * - `google` - * - `join` - * - `route` - * - `yahoo` - */ - returnKeyType: PropTypes.oneOf([ - // Cross-platform - 'done', - 'go', - 'next', - 'search', - 'send', - // Android-only - 'none', - 'previous', - // iOS-only - 'default', - 'emergency-call', - 'google', - 'join', - 'route', - 'yahoo', - ]), - /** - * Sets the return key to the label. Use it instead of `returnKeyType`. - * @platform android - */ - returnKeyLabel: PropTypes.string, - /** - * Limits the maximum number of characters that can be entered. Use this - * instead of implementing the logic in JS to avoid flicker. - */ - maxLength: PropTypes.number, - /** - * Sets the number of lines for a `TextInput`. Use it with multiline set to - * `true` to be able to fill the lines. - * @platform android - */ - numberOfLines: PropTypes.number, - /** - * When `false`, if there is a small amount of space available around a text input - * (e.g. landscape orientation on a phone), the OS may choose to have the user edit - * the text inside of a full screen text input mode. When `true`, this feature is - * disabled and users will always edit the text directly inside of the text input. - * Defaults to `false`. - * @platform android - */ - disableFullscreenUI: PropTypes.bool, - /** - * If `true`, the keyboard disables the return key when there is no text and - * automatically enables it when there is text. The default value is `false`. - * @platform ios - */ - enablesReturnKeyAutomatically: PropTypes.bool, - /** - * If `true`, the text input can be multiple lines. - * The default value is `false`. - */ - multiline: PropTypes.bool, - /** - * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` - * The default value is `simple`. - * @platform android - */ - textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), - /** - * Callback that is called when the text input is blurred. - */ - onBlur: PropTypes.func, - /** - * Callback that is called when the text input is focused. - */ - onFocus: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - */ - onChange: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - * Changed text is passed as an argument to the callback handler. - */ - onChangeText: PropTypes.func, - /** - * Callback that is called when the text input's content size changes. - * This will be called with - * `{ nativeEvent: { contentSize: { width, height } } }`. - * - * Only called for multiline text inputs. - */ - onContentSizeChange: PropTypes.func, - onTextInput: PropTypes.func, - /** - * Callback that is called when text input ends. - */ - onEndEditing: PropTypes.func, - /** - * Callback that is called when the text input selection is changed. - * This will be called with - * `{ nativeEvent: { selection: { start, end } } }`. - */ - onSelectionChange: PropTypes.func, - /** - * Callback that is called when the text input's submit button is pressed. - * Invalid if `multiline={true}` is specified. - */ - onSubmitEditing: PropTypes.func, - /** - * Callback that is called when a key is pressed. - * This will be called with `{ nativeEvent: { key: keyValue } }` - * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and - * the typed-in character otherwise including `' '` for space. - * Fires before `onChange` callbacks. - */ - onKeyPress: PropTypes.func, - /** - * Invoked on mount and layout changes with `{x, y, width, height}`. - */ - onLayout: PropTypes.func, - /** - * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. - * May also contain other properties from ScrollEvent but on Android contentSize - * is not provided for performance reasons. - */ - onScroll: PropTypes.func, - /** - * The string that will be rendered before text input has been entered. - */ - placeholder: PropTypes.string, - /** - * The text color of the placeholder string. - */ - placeholderTextColor: DeprecatedColorPropType, - /** - * If `false`, scrolling of the text view will be disabled. - * The default value is `true`. Does only work with 'multiline={true}'. - * @platform ios - */ - scrollEnabled: PropTypes.bool, - /** - * If `true`, the text input obscures the text entered so that sensitive text - * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. - */ - secureTextEntry: PropTypes.bool, - /** - * The highlight and cursor color of the text input. - */ - selectionColor: DeprecatedColorPropType, - /** - * An instance of `DocumentSelectionState`, this is some state that is responsible for - * maintaining selection information for a document. - * - * Some functionality that can be performed with this instance is: - * - * - `blur()` - * - `focus()` - * - `update()` - * - * > You can reference `DocumentSelectionState` in - * > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js) - * - * @platform ios - */ - selectionState: PropTypes.instanceOf(DocumentSelectionState), - /** - * The start and end of the text input's selection. Set start and end to - * the same value to position the cursor. - */ - selection: PropTypes.shape({ - start: PropTypes.number.isRequired, - end: PropTypes.number, - }), - /** - * The value to show for the text input. `TextInput` is a controlled - * component, which means the native value will be forced to match this - * value prop if provided. For most uses, this works great, but in some - * cases this may cause flickering - one common cause is preventing edits - * by keeping value the same. In addition to simply setting the same value, - * either set `editable={false}`, or set/update `maxLength` to prevent - * unwanted edits without flicker. - */ - value: PropTypes.string, - /** - * Provides an initial value that will change when the user starts typing. - * Useful for simple use-cases where you do not want to deal with listening - * to events and updating the value prop to keep the controlled state in sync. - */ - defaultValue: PropTypes.string, - /** - * When the clear button should appear on the right side of the text view. - * This property is supported only for single-line TextInput component. - * @platform ios - */ - clearButtonMode: PropTypes.oneOf([ - 'never', - 'while-editing', - 'unless-editing', - 'always', - ]), - /** - * If `true`, clears the text field automatically when editing begins. - * @platform ios - */ - clearTextOnFocus: PropTypes.bool, - /** - * If `true`, all text will automatically be selected on focus. - */ - selectTextOnFocus: PropTypes.bool, - /** - * If `true`, the text field will blur when submitted. - * The default value is true for single-line fields and false for - * multiline fields. Note that for multiline fields, setting `blurOnSubmit` - * to `true` means that pressing return will blur the field and trigger the - * `onSubmitEditing` event instead of inserting a newline into the field. - * Ignored on Android, if Hardware Keyboard is connected. // TODO(android ISS) - */ - blurOnSubmit: PropTypes.bool, - /** - * Note that not all Text styles are supported, an incomplete list of what is not supported includes: - * - * - `borderLeftWidth` - * - `borderTopWidth` - * - `borderRightWidth` - * - `borderBottomWidth` - * - `borderTopLeftRadius` - * - `borderTopRightRadius` - * - `borderBottomRightRadius` - * - `borderBottomLeftRadius` - * - * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) - * for more detail. - * - * [Styles](docs/style.html) - */ - style: Text.propTypes.style, - /** - * The color of the `TextInput` underline. - * @platform android - */ - underlineColorAndroid: DeprecatedColorPropType, - - /** - * If defined, the provided image resource will be rendered on the left. - * The image resource must be inside `/android/app/src/main/res/drawable` and referenced - * like - * ``` - * - * ``` - * @platform android - */ - inlineImageLeft: PropTypes.string, - - /** - * Padding between the inline image, if any, and the text input itself. - * @platform android - */ - inlineImagePadding: PropTypes.number, - - /** - * If `true`, allows TextInput to pass touch events to the parent component. - * This allows components such as SwipeableListView to be swipeable from the TextInput on iOS, - * as is the case on Android by default. - * If `false`, TextInput always asks to handle the input (except when disabled). - * @platform ios - */ - rejectResponderTermination: PropTypes.bool, - - /** - * Determines the types of data converted to clickable URLs in the text input. - * Only valid if `multiline={true}` and `editable={false}`. - * By default no data types are detected. - * - * You can provide one type or an array of many types. - * - * Possible values for `dataDetectorTypes` are: - * - * *iOS + macOS* - * - * - `'phoneNumber'` - * - `'link'` - * - `'address'` - * - `'calendarEvent'` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `'none'` - * - `'all'` - * - * *macOS Only* - * - * The following values work on macOS only: - * - * - `'ortography'` - * - `'spelling'` - * - `'grammar'` - * - `'quote'` - * - `'dash'` - * - `'replacement'` - * - `'correction'` - * - `'regularExpression'` - * - `'transitInformation'` - * - */ - dataDetectorTypes: PropTypes.oneOfType([ - PropTypes.oneOf(DataDetectorTypes), - PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), - ]), - /** - * If `true`, caret is hidden. The default value is `false`. - * This property is supported only for single-line TextInput component on iOS. - */ - caretHidden: PropTypes.bool, - /* - * If `true`, contextMenuHidden is hidden. The default value is `false`. - */ - contextMenuHidden: PropTypes.bool, - /** - * An optional identifier which links a custom InputAccessoryView to - * this text input. The InputAccessoryView is rendered above the - * keyboard when this text input is focused. - * @platform ios - */ - inputAccessoryViewID: PropTypes.string, - /** - * Give the keyboard and the system information about the - * expected semantic meaning for the content that users enter. - * @platform ios - */ - textContentType: PropTypes.oneOf([ - 'none', - 'URL', - 'addressCity', - 'addressCityAndState', - 'addressState', - 'countryName', - 'creditCardNumber', - 'emailAddress', - 'familyName', - 'fullStreetAddress', - 'givenName', - 'jobTitle', - 'location', - 'middleName', - 'name', - 'namePrefix', - 'nameSuffix', - 'nickname', - 'organizationName', - 'postalCode', - 'streetAddressLine1', - 'streetAddressLine2', - 'sublocality', - 'telephoneNumber', - 'username', - 'password', - 'newPassword', - 'oneTimeCode', - ]), - }, + propTypes: DeprecatedTextInputPropTypes, getDefaultProps() { return { allowFontScaling: true, @@ -1149,6 +1031,7 @@ const TextInput = createReactClass({ accessibilityHint={props.accessibilityHint} // TODO(macOS ISS#2323203) accessibilityRole={props.accessibilityRole} accessibilityStates={props.accessibilityStates} + accessibilityState={props.accessibilityState} nativeID={this.props.nativeID} testID={props.testID}> {textContainer} @@ -1201,6 +1084,7 @@ const TextInput = createReactClass({ accessibilityLabel={props.accessibilityLabel} accessibilityRole={props.accessibilityRole} accessibilityStates={props.accessibilityStates} + accessibilityState={props.accessibilityState} nativeID={this.props.nativeID} testID={props.testID}> {textContainer} @@ -1211,9 +1095,7 @@ const TextInput = createReactClass({ _renderAndroid: function() { const props = Object.assign({}, this.props); props.style = [this.props.style]; - props.autoCapitalize = UIManager.getViewManagerConfig( - 'AndroidTextInput', - ).Constants.AutoCapitalizationType[props.autoCapitalize || 'sentences']; + props.autoCapitalize = props.autoCapitalize || 'sentences'; let children = this.props.children; let childCount = 0; React.Children.forEach(children, () => ++childCount); @@ -1259,6 +1141,7 @@ const TextInput = createReactClass({ accessibilityRole={this.props.accessibilityRole} accessibilityHint={this.props.accessibilityHint} // TODO(macOS ISS#2323203) accessibilityStates={this.props.accessibilityStates} + accessibilityState={this.props.accessibilityState} nativeID={this.props.nativeID} testID={this.props.testID}> {textContainer} diff --git a/Libraries/Components/TextInput/TextInputState.js b/Libraries/Components/TextInput/TextInputState.js index 861a7786c8c81f..c484e95548ebfe 100644 --- a/Libraries/Components/TextInput/TextInputState.js +++ b/Libraries/Components/TextInput/TextInputState.js @@ -76,6 +76,7 @@ function blurTextInput(textFieldID: ?number) { } } } + function registerInput(textFieldID: number) { inputs.add(textFieldID); } @@ -84,7 +85,7 @@ function unregisterInput(textFieldID: number) { inputs.delete(textFieldID); } -function isTextInput(textFieldID: number) { +function isTextInput(textFieldID: number): boolean { return inputs.has(textFieldID); } diff --git a/Libraries/Components/TimePickerAndroid/NativeTimePickerAndroid.js b/Libraries/Components/TimePickerAndroid/NativeTimePickerAndroid.js new file mode 100644 index 00000000000000..ac4aa7e6eb3e18 --- /dev/null +++ b/Libraries/Components/TimePickerAndroid/NativeTimePickerAndroid.js @@ -0,0 +1,33 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export type TimePickerOptions = {| + hour?: number, + minute?: number, + is24Hour?: boolean, + mode?: string, +|}; + +export type TimePickerResult = {| + action: string, + hour: number, + minute: number, +|}; + +export interface Spec extends TurboModule { + +open: (options: TimePickerOptions) => Promise; +} + +export default (TurboModuleRegistry.get('TimePickerAndroid'): ?Spec); diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js deleted file mode 100644 index 3de6ca4aa06560..00000000000000 --- a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type { - TimePickerOptions, - TimePickerResult, -} from './TimePickerAndroidTypes'; - -const TimePickerAndroid = { - async open(options: TimePickerOptions): Promise { - return Promise.reject({ - message: 'TimePickerAndroid is not supported on this platform.', - }); - }, -}; - -module.exports = TimePickerAndroid; diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.js similarity index 82% rename from Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js rename to Libraries/Components/TimePickerAndroid/TimePickerAndroid.js index 8b25e19868b2c0..5c2aab9cf52cc1 100644 --- a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js +++ b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.js @@ -10,13 +10,10 @@ 'use strict'; -const TimePickerModule = require('../../BatchedBridge/NativeModules') - .TimePickerAndroid; - -import type { - TimePickerOptions, - TimePickerResult, -} from './TimePickerAndroidTypes'; +import NativeTimePickerAndroid, { + type TimePickerOptions, + type TimePickerResult, +} from './NativeTimePickerAndroid'; /** * Opens the standard Android time picker dialog. @@ -58,8 +55,16 @@ class TimePickerAndroid { * still be resolved with action being `TimePickerAndroid.dismissedAction` and all the other keys * being undefined. **Always** check whether the `action` before reading the values. */ - static async open(options: TimePickerOptions): Promise { - return TimePickerModule.open(options); + static async open( + options: TimePickerOptions, + ): Promise<$ReadOnly> { + if (NativeTimePickerAndroid) { + return NativeTimePickerAndroid.open(options); + } else { + return Promise.reject({ + message: 'TimePickerAndroid is not supported on this platform.', + }); + } } /** diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js index c540f40983c973..c6eb27cb52100e 100644 --- a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js +++ b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js @@ -12,10 +12,10 @@ 'use strict'; -import type { - TimePickerOptions, - TimePickerResult, -} from './TimePickerAndroidTypes'; +import NativeTimePickerAndroid, { + type TimePickerOptions, + type TimePickerResult, +} from './NativeTimePickerAndroid'; const TimePickerAndroid = { async open(options: TimePickerOptions): Promise { diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js deleted file mode 100644 index aafa572be6c052..00000000000000 --- a/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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. - * - * @format - * @flow strict-local - */ - -'use strict'; - -export type TimePickerOptions = {| - hour?: number, - minute?: number, - is24Hour?: boolean, - mode?: 'clock' | 'spinner' | 'default', -|}; - -export type TimePickerResult = $ReadOnly<{| - action: string, - hour: number, - minute: number, -|}>; diff --git a/Libraries/Components/ToastAndroid/NativeToastAndroid.js b/Libraries/Components/ToastAndroid/NativeToastAndroid.js new file mode 100644 index 00000000000000..f61d11bbc034e5 --- /dev/null +++ b/Libraries/Components/ToastAndroid/NativeToastAndroid.js @@ -0,0 +1,39 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + SHORT: number, + LONG: number, + TOP: number, + BOTTOM: number, + CENTER: number, + |}; + +show: (message: string, duration: number) => void; + +showWithGravity: ( + message: string, + duration: number, + gravity: number, + ) => void; + +showWithGravityAndOffset: ( + message: string, + duration: number, + gravity: number, + xOffset: number, + yOffset: number, + ) => void; +} + +export default (TurboModuleRegistry.getEnforcing('ToastAndroid'): Spec); diff --git a/Libraries/Components/ToastAndroid/ToastAndroid.android.js b/Libraries/Components/ToastAndroid/ToastAndroid.android.js index 30207d30a9ce71..ff1db3cf90bf88 100644 --- a/Libraries/Components/ToastAndroid/ToastAndroid.android.js +++ b/Libraries/Components/ToastAndroid/ToastAndroid.android.js @@ -9,9 +9,7 @@ */ 'use strict'; - -const RCTToastAndroid = require('../../BatchedBridge/NativeModules') - .ToastAndroid; +import NativeToastAndroid from './NativeToastAndroid'; /** * This exposes the native ToastAndroid module as a JS module. This has a function 'show' @@ -36,16 +34,15 @@ const RCTToastAndroid = require('../../BatchedBridge/NativeModules') const ToastAndroid = { // Toast duration constants - SHORT: RCTToastAndroid.SHORT, - LONG: RCTToastAndroid.LONG, - + SHORT: NativeToastAndroid.getConstants().SHORT, + LONG: NativeToastAndroid.getConstants().LONG, // Toast gravity constants - TOP: RCTToastAndroid.TOP, - BOTTOM: RCTToastAndroid.BOTTOM, - CENTER: RCTToastAndroid.CENTER, + TOP: NativeToastAndroid.getConstants().TOP, + BOTTOM: NativeToastAndroid.getConstants().BOTTOM, + CENTER: NativeToastAndroid.getConstants().CENTER, show: function(message: string, duration: number): void { - RCTToastAndroid.show(message, duration); + NativeToastAndroid.show(message, duration); }, showWithGravity: function( @@ -53,7 +50,7 @@ const ToastAndroid = { duration: number, gravity: number, ): void { - RCTToastAndroid.showWithGravity(message, duration, gravity); + NativeToastAndroid.showWithGravity(message, duration, gravity); }, showWithGravityAndOffset: function( @@ -63,7 +60,7 @@ const ToastAndroid = { xOffset: number, yOffset: number, ): void { - RCTToastAndroid.showWithGravityAndOffset( + NativeToastAndroid.showWithGravityAndOffset( message, duration, gravity, diff --git a/Libraries/Components/ToastAndroid/ToastAndroid.ios.js b/Libraries/Components/ToastAndroid/ToastAndroid.ios.js index ed5fcf02f40116..d0528ff65dc35e 100644 --- a/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +++ b/Libraries/Components/ToastAndroid/ToastAndroid.ios.js @@ -16,6 +16,24 @@ const ToastAndroid = { show: function(message: string, duration: number): void { warning(false, 'ToastAndroid is not supported on this platform.'); }, + + showWithGravity: function( + message: string, + duration: number, + gravity: number, + ): void { + warning(false, 'ToastAndroid is not supported on this platform.'); + }, + + showWithGravityAndOffset: function( + message: string, + duration: number, + gravity: number, + xOffset: number, + yOffset: number, + ): void { + warning(false, 'ToastAndroid is not supported on this platform.'); + }, }; module.exports = ToastAndroid; diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js deleted file mode 100644 index fdfbde63567274..00000000000000 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js +++ /dev/null @@ -1,251 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const React = require('react'); -const UIManager = require('../../ReactNative/UIManager'); - -const ToolbarAndroidNativeComponent = require('./ToolbarAndroidNativeComponent'); -const resolveAssetSource = require('../../Image/resolveAssetSource'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ImageSource} from '../../Image/ImageSource'; -import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; -import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; - -/** - * React component that wraps the Android-only [`Toolbar` widget][0]. A Toolbar can display a logo, - * navigation icon (e.g. hamburger menu), a title & subtitle and a list of actions. The title and - * subtitle are expanded so the logo and navigation icons are displayed on the left, title and - * subtitle in the middle and the actions on the right. - * - * If the toolbar has an only child, it will be displayed between the title and actions. - * - * Although the Toolbar supports remote images for the logo, navigation and action icons, this - * should only be used in DEV mode where `require('./some_icon.png')` translates into a packager - * URL. In release mode you should always use a drawable resource for these icons. Using - * `require('./some_icon.png')` will do this automatically for you, so as long as you don't - * explicitly use e.g. `{uri: 'http://...'}`, you will be good. - * - * Example: - * - * ``` - * render: function() { - * return ( - * - * ) - * }, - * onActionSelected: function(position) { - * if (position === 0) { // index of 'Settings' - * showSettings(); - * } - * } - * ``` - * - * [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html - */ - -type Action = $ReadOnly<{| - title: string, - icon?: ?ImageSource, - show?: 'always' | 'ifRoom' | 'never', - showWithText?: boolean, -|}>; - -type ToolbarAndroidChangeEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -type ToolbarAndroidProps = $ReadOnly<{| - ...ViewProps, - /** - * or text on the right side of the widget. If they don't fit they are placed in an 'overflow' - * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons - * menu. - * - * This property takes an array of objects, where each object has the following keys: - * - * * `title`: **required**, the title of this action - * * `icon`: the icon for this action, e.g. `require('./some_icon.png')` - * * `show`: when to show this action as an icon or hide it in the overflow menu: `always`, - * `ifRoom` or `never` - * * `showWithText`: boolean, whether to show text alongside the icon or not - */ - actions?: ?Array, - /** - * Sets the toolbar logo. - */ - logo?: ?ImageSource, - /** - * Sets the navigation icon. - */ - navIcon?: ?ImageSource, - /** - * Callback that is called when an action is selected. The only argument that is passed to the - * callback is the position of the action in the actions array. - */ - onActionSelected?: ?(position: number) => void, - /** - * Callback called when the icon is selected. - */ - onIconClicked?: ?() => void, - /** - * Sets the overflow icon. - */ - overflowIcon?: ?ImageSource, - /** - * Sets the toolbar subtitle. - */ - subtitle?: ?string, - /** - * Sets the toolbar subtitle color. - */ - subtitleColor?: ?ColorValue, - /** - * Sets the toolbar title. - */ - title?: ?Stringish, - /** - * Sets the toolbar title color. - */ - titleColor?: ?ColorValue, - /** - * Sets the content inset for the toolbar starting edge. - * - * The content inset affects the valid area for Toolbar content other than - * the navigation button and menu. Insets define the minimum margin for - * these components and can be used to effectively align Toolbar content - * along well-known gridlines. - */ - contentInsetStart?: ?number, - /** - * Sets the content inset for the toolbar ending edge. - * - * The content inset affects the valid area for Toolbar content other than - * the navigation button and menu. Insets define the minimum margin for - * these components and can be used to effectively align Toolbar content - * along well-known gridlines. - */ - contentInsetEnd?: ?number, - /** - * Used to set the toolbar direction to RTL. - * In addition to this property you need to add - * - * android:supportsRtl="true" - * - * to your application AndroidManifest.xml and then call - * `setLayoutDirection(LayoutDirection.RTL)` in your MainActivity - * `onCreate` method. - */ - rtl?: ?boolean, - /** - * Used to locate this view in end-to-end tests. - */ - testID?: ?string, -|}>; - -type Props = $ReadOnly<{| - ...ToolbarAndroidProps, - forwardedRef: ?React.Ref, -|}>; - -class ToolbarAndroid extends React.Component { - _onSelect = (event: ToolbarAndroidChangeEvent) => { - const position = event.nativeEvent.position; - if (position === -1) { - this.props.onIconClicked && this.props.onIconClicked(); - } else { - this.props.onActionSelected && this.props.onActionSelected(position); - } - }; - - render() { - const { - onIconClicked, - onActionSelected, - forwardedRef, - ...otherProps - } = this.props; - - const nativeProps: {...typeof otherProps, nativeActions?: Array} = { - ...otherProps, - }; - - if (this.props.logo) { - nativeProps.logo = resolveAssetSource(this.props.logo); - } - - if (this.props.navIcon) { - nativeProps.navIcon = resolveAssetSource(this.props.navIcon); - } - - if (this.props.overflowIcon) { - nativeProps.overflowIcon = resolveAssetSource(this.props.overflowIcon); - } - - if (this.props.actions) { - const nativeActions = []; - for (let i = 0; i < this.props.actions.length; i++) { - const action = { - icon: this.props.actions[i].icon, - show: this.props.actions[i].show, - }; - - if (action.icon) { - action.icon = resolveAssetSource(action.icon); - } - if (action.show) { - action.show = UIManager.getViewManagerConfig( - 'ToolbarAndroid', - ).Constants.ShowAsAction[action.show]; - } - - nativeActions.push({ - ...this.props.actions[i], - ...action, - }); - } - - nativeProps.nativeActions = nativeActions; - } - - return ( - - ); - } -} - -const ToolbarAndroidToExport = React.forwardRef( - ( - props: ToolbarAndroidProps, - forwardedRef: ?React.Ref, - ) => { - return ; - }, -); - -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -module.exports = (ToolbarAndroidToExport: Class< - NativeComponent, ->); diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js deleted file mode 100644 index 72ec072710ce5f..00000000000000 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ImageSource} from '../../Image/ImageSource'; -import type {ViewProps} from '../View/ViewPropTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) - -type Action = $ReadOnly<{| - title: string, - icon?: ?ImageSource, - show?: 'always' | 'ifRoom' | 'never', - showWithText?: boolean, -|}>; - -type ToolbarAndroidChangeEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -type NativeProps = $ReadOnly<{| - onSelect: (event: ToolbarAndroidChangeEvent) => mixed, - nativeActions?: Array, -|}>; - -type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) - -type ToolbarAndroidProps = $ReadOnly<{| - ...ViewProps, - ...NativeProps, - /** - * or text on the right side of the widget. If they don't fit they are placed in an 'overflow' - * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons - * menu. - * - * This property takes an array of objects, where each object has the following keys: - * - * * `title`: **required**, the title of this action - * * `icon`: the icon for this action, e.g. `require('./some_icon.png')` - * * `show`: when to show this action as an icon or hide it in the overflow menu: `always`, - * `ifRoom` or `never` - * * `showWithText`: boolean, whether to show text alongside the icon or not - */ - actions?: ?Array, - /** - * Sets the toolbar logo. - */ - logo?: ?ImageSource, - /** - * Sets the navigation icon. - */ - navIcon?: ?ImageSource, - /** - * Callback that is called when an action is selected. The only argument that is passed to the - * callback is the position of the action in the actions array. - */ - onActionSelected?: ?(position: number) => void, - /** - * Callback called when the icon is selected. - */ - onIconClicked?: ?() => void, - /** - * Sets the overflow icon. - */ - overflowIcon?: ?ImageSource, - /** - * Sets the toolbar subtitle. - */ - subtitle?: ?string, - /** - * Sets the toolbar subtitle color. - */ - subtitleColor?: ?ColorValue, - /** - * Sets the toolbar title. - */ - title?: ?Stringish, - /** - * Sets the toolbar title color. - */ - titleColor?: ?ColorValue, - /** - * Sets the content inset for the toolbar starting edge. - * - * The content inset affects the valid area for Toolbar content other than - * the navigation button and menu. Insets define the minimum margin for - * these components and can be used to effectively align Toolbar content - * along well-known gridlines. - */ - contentInsetStart?: ?number, - /** - * Sets the content inset for the toolbar ending edge. - * - * The content inset affects the valid area for Toolbar content other than - * the navigation button and menu. Insets define the minimum margin for - * these components and can be used to effectively align Toolbar content - * along well-known gridlines. - */ - contentInsetEnd?: ?number, - /** - * Used to set the toolbar direction to RTL. - * In addition to this property you need to add - * - * android:supportsRtl="true" - * - * to your application AndroidManifest.xml and then call - * `setLayoutDirection(LayoutDirection.RTL)` in your MainActivity - * `onCreate` method. - */ - rtl?: ?boolean, - /** - * Used to locate this view in end-to-end tests. - */ - testID?: ?string, -|}>; - -type NativeToolbarAndroidProps = Class>; - -module.exports = ((requireNativeComponent( - 'ToolbarAndroid', -): any): NativeToolbarAndroidProps); diff --git a/Libraries/Components/Touchable/Touchable.js b/Libraries/Components/Touchable/Touchable.js index 0170576855d5c0..a37a4fa24d4f78 100644 --- a/Libraries/Components/Touchable/Touchable.js +++ b/Libraries/Components/Touchable/Touchable.js @@ -23,8 +23,8 @@ const View = require('../View/View'); const keyMirror = require('fbjs/lib/keyMirror'); const normalizeColor = require('../../Color/normalizeColor'); -import type {PressEvent} from '../../Types/CoreEventTypes'; import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; +import type {PressEvent} from '../../Types/CoreEventTypes'; const extractSingleTouch = nativeEvent => { const touches = nativeEvent.touches; @@ -409,7 +409,9 @@ const TouchableMixin = { * @return {object} State object to be placed inside of * `this.state.touchable`. */ - touchableGetInitialState: function() { + touchableGetInitialState: function(): $TEMPORARY$object<{| + touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>, + |}> { return { touchable: {touchState: undefined, responderID: null}, }; @@ -419,21 +421,21 @@ const TouchableMixin = { /** * Must return true if embedded in a native platform scroll view. */ - touchableHandleResponderTerminationRequest: function() { + touchableHandleResponderTerminationRequest: function(): any { return !this.props.rejectResponderTermination; }, /** * Must return true to start the process of `Touchable`. */ - touchableHandleStartShouldSetResponder: function() { + touchableHandleStartShouldSetResponder: function(): any { return !this.props.disabled; }, /** * Return true to cancel press on long press. */ - touchableLongPressCancelsPress: function() { + touchableLongPressCancelsPress: function(): boolean { return true; }, @@ -784,7 +786,7 @@ const TouchableMixin = { this.longPressDelayTimeout = null; }, - _isHighlight: function(state: State) { + _isHighlight: function(state: State): boolean { return ( state === States.RESPONDER_ACTIVE_PRESS_IN || state === States.RESPONDER_ACTIVE_LONG_PRESS_IN @@ -805,7 +807,7 @@ const TouchableMixin = { aY: number, bX: number, bY: number, - ) { + ): number { const deltaX = aX - bX; const deltaY = aY - bY; return Math.sqrt(deltaX * deltaX + deltaY * deltaY); @@ -907,7 +909,7 @@ const TouchableMixin = { } }, - withoutDefaultFocusAndBlur: {}, + withoutDefaultFocusAndBlur: ({}: $TEMPORARY$object<{||}>), }; /** @@ -935,7 +937,7 @@ const Touchable = { }: { color: string | number, hitSlop: EdgeInsetsProp, - }) => { + }): null | React.Node => { if (!Touchable.TOUCH_TARGET_DEBUG) { return null; } diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 5e290076f63416..560831621a6d0c 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -181,7 +181,9 @@ const TouchableBounce = ((createReactClass({ accessibilityHint={this.props.accessibilityHint} accessibilityRole={this.props.accessibilityRole} accessibilityStates={this.props.accessibilityStates} - onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739) + accessibilityState={this.props.accessibilityState} + accessibilityActions={this.props.accessibilityActions} + onAccessibilityAction={this.props.onAccessibilityAction} acceptsKeyboardFocus={ (this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && @@ -196,8 +198,8 @@ const TouchableBounce = ((createReactClass({ nativeID={this.props.nativeID} testID={this.props.testID} hitSlop={this.props.hitSlop} - clickable={ - this.props.clickable !== false && + focusable={ + this.props.focusable !== false && this.props.onPress !== undefined && !this.props.disabled } @@ -209,9 +211,6 @@ const TouchableBounce = ((createReactClass({ onResponderGrant={this.touchableHandleResponderGrant} onResponderMove={this.touchableHandleResponderMove} onResponderRelease={this.touchableHandleResponderRelease} - /* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete - * this comment and run Flow. */ onResponderTerminate={this.touchableHandleResponderTerminate} tooltip={this.props.tooltip} // TODO(macOS/win ISS#2323203) onMouseEnter={this.props.onMouseEnter} // [TODO(macOS ISS#2323203) diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index c7dd4144a14480..b7c8bf1158737f 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -408,7 +408,9 @@ const TouchableHighlight = ((createReactClass({ accessibilityHint={this.props.accessibilityHint} // TODO(OSS Candidate ISS#2710739) accessibilityRole={this.props.accessibilityRole} accessibilityStates={this.props.accessibilityStates} - onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739) + accessibilityState={this.props.accessibilityState} + accessibilityActions={this.props.accessibilityActions} + onAccessibilityAction={this.props.onAccessibilityAction} acceptsKeyboardFocus={ (this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && @@ -434,8 +436,8 @@ const TouchableHighlight = ((createReactClass({ nextFocusLeft={this.props.nextFocusLeft} nextFocusRight={this.props.nextFocusRight} nextFocusUp={this.props.nextFocusUp} - clickable={ - this.props.clickable !== false && this.props.onPress !== undefined + focusable={ + this.props.focusable !== false && this.props.onPress !== undefined } onClick={this.touchableHandlePress} onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder} diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index 45ad1e66e39b20..9263cbc7c782e8 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -24,7 +24,7 @@ const ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); const processColor = require('../../StyleSheet/processColor'); import type {PressEvent} from '../../Types/CoreEventTypes'; -import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from '../../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) const rippleBackgroundPropType = PropTypes.shape({ type: PropTypes.oneOf(['RippleAndroid']), @@ -316,7 +316,9 @@ const TouchableNativeFeedback = createReactClass({ accessibilityHint: this.props.accessibilityHint, // TODO(OSS Candidate ISS#2710739) accessibilityRole: this.props.accessibilityRole, accessibilityStates: this.props.accessibilityStates, - onAccessibilityTap: this.props.onAccessibilityTap, // TODO(OSS Candidate ISS#2710739) + accessibilityState: this.props.accessibilityState, + accessibilityActions: this.props.accessibilityActions, + onAccessibilityAction: this.props.onAccessibilityAction, children, testID: this.props.testID, onLayout: this.props.onLayout, @@ -328,8 +330,8 @@ const TouchableNativeFeedback = createReactClass({ nextFocusRight: this.props.nextFocusRight, nextFocusUp: this.props.nextFocusUp, hasTVPreferredFocus: this.props.hasTVPreferredFocus, - clickable: - this.props.clickable !== false && + focusable: + this.props.focusable !== false && this.props.onPress !== undefined && !this.props.disabled, onClick: this.touchableHandlePress, diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 31dcc6ff389379..5a8ae9d3d19c45 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -52,7 +52,7 @@ type Props = $ReadOnly<{| * On press down, the opacity of the wrapped view is decreased, dimming it. * * Opacity is controlled by wrapping the children in an Animated.View, which is - * added to the view hiearchy. Be aware that this can affect layout. + * added to the view hierarchy. Be aware that this can affect layout. * * Example: * @@ -311,7 +311,9 @@ const TouchableOpacity = ((createReactClass({ accessibilityHint={this.props.accessibilityHint} // TODO(OSS Candidate ISS#2710739) accessibilityRole={this.props.accessibilityRole} accessibilityStates={this.props.accessibilityStates} - onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739) + accessibilityState={this.props.accessibilityState} + accessibilityActions={this.props.accessibilityActions} + onAccessibilityAction={this.props.onAccessibilityAction} acceptsKeyboardFocus={ (this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && @@ -336,8 +338,8 @@ const TouchableOpacity = ((createReactClass({ hasTVPreferredFocus={this.props.hasTVPreferredFocus} tvParallaxProperties={this.props.tvParallaxProperties} hitSlop={this.props.hitSlop} - clickable={ - this.props.clickable !== false && this.props.onPress !== undefined + focusable={ + this.props.focusable !== false && this.props.onPress !== undefined } onClick={this.touchableHandlePress} onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder} @@ -354,9 +356,6 @@ const TouchableOpacity = ((createReactClass({ onDragLeave={this.props.onDragLeave} onDrop={this.props.onDrop} draggedTypes={this.props.draggedTypes} // ]TODO(macOS ISS#2323203) - /* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete - * this comment and run Flow. */ onResponderTerminate={this.touchableHandleResponderTerminate}> {this.props.children} {Touchable.renderDebugView({ diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 9378b37e7a83b3..9cf5530d57065d 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -21,7 +21,6 @@ const ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); const { DeprecatedAccessibilityRoles, - DeprecatedAccessibilityStates, } = require('../../DeprecatedPropTypes/DeprecatedViewAccessibility'); import type { @@ -33,11 +32,14 @@ import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; import type { AccessibilityRole, AccessibilityStates, + AccessibilityState, + AccessibilityActionInfo, + AccessibilityActionEvent, } from '../View/ViewAccessibility'; // [TODO(macOS ISS#2323203) -const {DraggedTypes} = require('DraggedType'); -import type {DraggedTypesType} from 'DraggedType'; +const {DraggedTypes} = require('../View/DraggedType'); +import type {DraggedTypesType} from '../View/DraggedType'; // ]TODO(macOS ISS#2323203) type TargetEvent = SyntheticEvent< @@ -57,6 +59,9 @@ const OVERRIDE_PROPS = [ 'accessibilityIgnoresInvertColors', 'accessibilityRole', 'accessibilityStates', + 'accessibilityState', + 'accessibilityActions', + 'onAccessibilityAction', 'hitSlop', 'nativeID', 'onBlur', @@ -72,6 +77,8 @@ export type Props = $ReadOnly<{| accessibilityIgnoresInvertColors?: ?boolean, accessibilityRole?: ?AccessibilityRole, accessibilityStates?: ?AccessibilityStates, + accessibilityState?: ?AccessibilityState, + accessibilityActions?: ?$ReadOnlyArray, children?: ?React.Node, delayLongPress?: ?number, delayPressIn?: ?number, @@ -87,7 +94,7 @@ export type Props = $ReadOnly<{| onPress?: ?(event: PressEvent) => mixed, onPressIn?: ?(event: PressEvent) => mixed, onPressOut?: ?(event: PressEvent) => mixed, - onAccessibilityTap?: ?Function, // TODO(OSS Candidate ISS#2710739) + onAccessibilityAction?: ?(event: AccessibilityActionEvent) => void, acceptsKeyboardFocus?: ?boolean, // [TODO(macOS ISS#2323203) onMouseEnter?: ?Function, onMouseLeave?: ?Function, @@ -119,10 +126,10 @@ const TouchableWithoutFeedback = ((createReactClass({ accessibilityHint: PropTypes.string, accessibilityIgnoresInvertColors: PropTypes.bool, accessibilityRole: PropTypes.oneOf(DeprecatedAccessibilityRoles), - accessibilityStates: PropTypes.arrayOf( - PropTypes.oneOf(DeprecatedAccessibilityStates), - ), - onAccessibilityTap: PropTypes.func, // TODO(OSS Candidate ISS#2710739) + accessibilityStates: PropTypes.array, + accessibilityState: PropTypes.object, + accessibilityActions: PropTypes.array, + onAccessibilityAction: PropTypes.func, tabIndex: PropTypes.number, // TODO(macOS/win ISS#2323203) /** * When `accessible` is true (which is the default) this may be called when @@ -316,7 +323,7 @@ const TouchableWithoutFeedback = ((createReactClass({ accessibilityHint: this.props.accessibilityHint, accessibilityRole: this.props.accessibilityRole, accessibilityStates: this.props.accessibilityStates, - onAccessibilityTap: this.props.onAccessibilityTap, // TODO(OSS Candidate ISS#2710739) + onAccessibilityAction: this.props.onAccessibilityAction, // TODO(OSS Candidate ISS#2710739) acceptsKeyboardFocus: (this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && @@ -328,8 +335,8 @@ const TouchableWithoutFeedback = ((createReactClass({ testID: this.props.testID, onLayout: this.props.onLayout, hitSlop: this.props.hitSlop, - clickable: - this.props.clickable !== false && this.props.onPress !== undefined, + focusable: + this.props.focusable !== false && this.props.onPress !== undefined, onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder, onResponderTerminationRequest: this .touchableHandleResponderTerminationRequest, @@ -340,10 +347,10 @@ const TouchableWithoutFeedback = ((createReactClass({ tooltip: this.props.tooltip, // TODO(macOS/win ISS#2323203) onClick: this.touchableHandlePress, // TODO(android ISS) onMouseEnter: this.props.onMouseEnter, // [TODO(macOS ISS#2323203) - onMouseLeave: this.props.onMouseLeave, // [TODO(macOS ISS#2323203) - onDragEnter: this.props.onDragEnter, // [TODO(macOS ISS#2323203) - onDragLeave: this.props.onDragLeave, // [TODO(macOS ISS#2323203) - onDrop: this.props.onDrop, // [TODO(macOS ISS#2323203) + onMouseLeave: this.props.onMouseLeave, + onDragEnter: this.props.onDragEnter, + onDragLeave: this.props.onDragLeave, + onDrop: this.props.onDrop, draggedTypes: this.props.draggedTypes, // ]TODO(macOS ISS#2323203) children, }); diff --git a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap index 883d311bd25517..a19b74e58c4360 100644 --- a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap +++ b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap @@ -4,8 +4,8 @@ exports[`TouchableHighlight renders correctly 1`] = ` ; - -type UnimplementedViewNativeType = Class>; - -module.exports = ((requireNativeComponent( - 'UnimplementedNativeView', -): any): UnimplementedViewNativeType); diff --git a/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js b/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js new file mode 100644 index 00000000000000..cea9d45a2020e5 --- /dev/null +++ b/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js @@ -0,0 +1,28 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; + +import type {WithDefault} from '../../Types/CodegenTypes'; +import type {ViewProps} from '../View/ViewPropTypes'; + +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../../Utilities/codegenNativeComponent'; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + name?: WithDefault, +|}>; + +// NOTE: This component is not implemented in paper +// Do not require this file in paper builds +export default (codegenNativeComponent( + 'UnimplementedNativeView', +): NativeComponentType); diff --git a/Libraries/Components/UnimplementedViews/UnimplementedNativeViewSchema.js b/Libraries/Components/UnimplementedViews/UnimplementedNativeViewSchema.js deleted file mode 100644 index 99773adcc18119..00000000000000 --- a/Libraries/Components/UnimplementedViews/UnimplementedNativeViewSchema.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js'; - -const UnimplementedNativeViewSchema: SchemaType = { - modules: { - UnimplementedNativeViewSchema: { - components: { - UnimplementedNativeView: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [ - { - name: 'name', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = UnimplementedNativeViewSchema; diff --git a/Libraries/Components/UnimplementedViews/UnimplementedView.js b/Libraries/Components/UnimplementedViews/UnimplementedView.js index d507629710e16c..59725244cefa6e 100644 --- a/Libraries/Components/UnimplementedViews/UnimplementedView.js +++ b/Libraries/Components/UnimplementedViews/UnimplementedView.js @@ -17,13 +17,7 @@ const StyleSheet = require('../../StyleSheet/StyleSheet'); * View component and renders its children. */ class UnimplementedView extends React.Component<$FlowFixMeProps> { - setNativeProps() { - // Do nothing. - // This method is required in order to use this view as a Touchable* child. - // See ensureComponentIsNative.js for more info - } - - render() { + render(): React.Node { // Workaround require cycle from requireNativeComponent const View = require('../View/View'); return ( diff --git a/Libraries/Components/View/PlatformViewPropTypes.macos.js b/Libraries/Components/View/PlatformViewPropTypes.macos.js index a9036f945756fa..cf5d82afb5bd3b 100644 --- a/Libraries/Components/View/PlatformViewPropTypes.macos.js +++ b/Libraries/Components/View/PlatformViewPropTypes.macos.js @@ -9,4 +9,6 @@ // TODO(macOS ISS#2323203) -module.exports = {}; +'use strict'; + +export type PlatformViewPropTypes = {}; diff --git a/Libraries/Components/View/ReactNativeStyleAttributes.js b/Libraries/Components/View/ReactNativeStyleAttributes.js index 8264f1f3779dd1..c1126c724e554b 100644 --- a/Libraries/Components/View/ReactNativeStyleAttributes.js +++ b/Libraries/Components/View/ReactNativeStyleAttributes.js @@ -11,7 +11,7 @@ 'use strict'; const DeprecatedImageStylePropTypes = require('../../DeprecatedPropTypes/DeprecatedImageStylePropTypes'); -const TextStylePropTypes = require('../../Text/TextStylePropTypes'); +const DeprecatedTextStylePropTypes = require('../../DeprecatedPropTypes/DeprecatedTextStylePropTypes'); const DeprecatedViewStylePropTypes = require('../../DeprecatedPropTypes/DeprecatedViewStylePropTypes'); const processColor = require('../../StyleSheet/processColor'); @@ -22,7 +22,7 @@ const ReactNativeStyleAttributes = {}; for (const attributeName of Object.keys({ ...DeprecatedViewStylePropTypes, - ...TextStylePropTypes, + ...DeprecatedTextStylePropTypes, ...DeprecatedImageStylePropTypes, })) { ReactNativeStyleAttributes[attributeName] = true; diff --git a/Libraries/Components/View/ReactNativeViewAttributes.js b/Libraries/Components/View/ReactNativeViewAttributes.js index 4a060234dadecc..8f9ba3b2189558 100644 --- a/Libraries/Components/View/ReactNativeViewAttributes.js +++ b/Libraries/Components/View/ReactNativeViewAttributes.js @@ -12,9 +12,7 @@ const ReactNativeStyleAttributes = require('./ReactNativeStyleAttributes'); -const ReactNativeViewAttributes = {}; - -ReactNativeViewAttributes.UIView = { +const UIView = { pointerEvents: true, accessible: true, accessibilityActions: true, @@ -22,6 +20,7 @@ ReactNativeViewAttributes.UIView = { accessibilityLiveRegion: true, accessibilityRole: true, accessibilityStates: true, + accessibilityState: true, accessibilityHint: true, acceptsKeyboardFocus: true, // TODO(macOS ISS#2323203) enableFocusRing: true, // TODO(macOS ISS#2323203) @@ -47,8 +46,8 @@ ReactNativeViewAttributes.UIView = { style: ReactNativeStyleAttributes, }; -ReactNativeViewAttributes.RCTView = { - ...ReactNativeViewAttributes.UIView, +const RCTView = { + ...UIView, // This is a special performance property exposed by RCTView and useful for // scrolling content when there are many subviews, most of which are offscreen. @@ -58,4 +57,9 @@ ReactNativeViewAttributes.RCTView = { removeClippedSubviews: true, }; +const ReactNativeViewAttributes = { + UIView: UIView, + RCTView: RCTView, +}; + module.exports = ReactNativeViewAttributes; diff --git a/Libraries/Components/View/ReactNativeViewViewConfig.js b/Libraries/Components/View/ReactNativeViewViewConfig.js index 7a70e54eebedf1..a4cf78746409c0 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfig.js +++ b/Libraries/Components/View/ReactNativeViewViewConfig.js @@ -9,14 +9,17 @@ */ 'use strict'; +import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid'; +import ReactNativeViewViewConfigMacOS from './ReactNativeViewViewConfigMacOS'; // TODO(macOS ISS#2323203) const ReactNativeViewConfig = { uiViewClassName: 'RCTView', baseModuleName: null, Manager: 'ViewManager', - Commands: {}, - Constants: {}, + Commands: ({}: $TEMPORARY$object<{||}>), + Constants: ({}: $TEMPORARY$object<{||}>), bubblingEventTypes: { + ...ReactNativeViewViewConfigAndroid.bubblingEventTypes, topBlur: { phasedRegistrationNames: { bubbled: 'onBlur', @@ -85,6 +88,8 @@ const ReactNativeViewConfig = { }, }, directEventTypes: { + ...ReactNativeViewViewConfigAndroid.directEventTypes, + ...ReactNativeViewViewConfigMacOS.directEventTypes, // TODO(macOS ISS#2323203) topAccessibilityAction: { registrationName: 'onAccessibilityAction', }, @@ -100,8 +105,18 @@ const ReactNativeViewConfig = { topMagicTap: { registrationName: 'onMagicTap', }, + // Events for react-native-gesture-handler (T45765076) + // Remove once this library can handle JS View Configs + onGestureHandlerEvent: { + registrationName: 'onGestureHandlerEvent', + }, + onGestureHandlerStateChange: { + registrationName: 'onGestureHandlerStateChange', + }, }, validAttributes: { + ...ReactNativeViewViewConfigAndroid.validAttributes, + ...ReactNativeViewViewConfigMacOS.validAttributes, // TODO(macOS ISS#2323203) accessibilityActions: true, accessibilityElementsHidden: true, accessibilityHint: true, @@ -110,6 +125,7 @@ const ReactNativeViewConfig = { accessibilityLiveRegion: true, accessibilityRole: true, accessibilityStates: true, + accessibilityState: true, accessibilityViewIsModal: true, accessible: true, alignContent: true, @@ -117,25 +133,25 @@ const ReactNativeViewConfig = { alignSelf: true, aspectRatio: true, backfaceVisibility: true, - backgroundColor: {process: require('processColor')}, - borderBottomColor: {process: require('processColor')}, + backgroundColor: {process: require('../../StyleSheet/processColor')}, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, borderBottomEndRadius: true, borderBottomLeftRadius: true, borderBottomRightRadius: true, borderBottomStartRadius: true, borderBottomWidth: true, - borderColor: {process: require('processColor')}, - borderEndColor: {process: require('processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderEndColor: {process: require('../../StyleSheet/processColor')}, borderEndWidth: true, - borderLeftColor: {process: require('processColor')}, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, borderLeftWidth: true, borderRadius: true, - borderRightColor: {process: require('processColor')}, + borderRightColor: {process: require('../../StyleSheet/processColor')}, borderRightWidth: true, - borderStartColor: {process: require('processColor')}, + borderStartColor: {process: require('../../StyleSheet/processColor')}, borderStartWidth: true, borderStyle: true, - borderTopColor: {process: require('processColor')}, + borderTopColor: {process: require('../../StyleSheet/processColor')}, borderTopEndRadius: true, borderTopLeftRadius: true, borderTopRightRadius: true, @@ -156,7 +172,7 @@ const ReactNativeViewConfig = { flexShrink: true, flexWrap: true, height: true, - hitSlop: {diff: (require('insetsDiffer'): any)}, + hitSlop: {diff: (require('../../Utilities/differ/insetsDiffer'): any)}, importantForAccessibility: true, justifyContent: true, left: true, @@ -199,8 +215,8 @@ const ReactNativeViewConfig = { rotation: true, scaleX: true, scaleY: true, - shadowColor: {process: require('processColor')}, - shadowOffset: {diff: require('sizesDiffer')}, + shadowColor: {process: require('../../StyleSheet/processColor')}, + shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')}, shadowOpacity: true, shadowRadius: true, shouldRasterizeIOS: true, @@ -211,25 +227,25 @@ const ReactNativeViewConfig = { alignSelf: true, aspectRatio: true, backfaceVisibility: true, - backgroundColor: {process: require('processColor')}, - borderBottomColor: {process: require('processColor')}, + backgroundColor: {process: require('../../StyleSheet/processColor')}, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, borderBottomEndRadius: true, borderBottomLeftRadius: true, borderBottomRightRadius: true, borderBottomStartRadius: true, borderBottomWidth: true, - borderColor: {process: require('processColor')}, - borderEndColor: {process: require('processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderEndColor: {process: require('../../StyleSheet/processColor')}, borderEndWidth: true, - borderLeftColor: {process: require('processColor')}, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, borderLeftWidth: true, borderRadius: true, - borderRightColor: {process: require('processColor')}, + borderRightColor: {process: require('../../StyleSheet/processColor')}, borderRightWidth: true, - borderStartColor: {process: require('processColor')}, + borderStartColor: {process: require('../../StyleSheet/processColor')}, borderStartWidth: true, borderStyle: true, - borderTopColor: {process: require('processColor')}, + borderTopColor: {process: require('../../StyleSheet/processColor')}, borderTopEndRadius: true, borderTopLeftRadius: true, borderTopRightRadius: true, @@ -237,7 +253,7 @@ const ReactNativeViewConfig = { borderTopWidth: true, borderWidth: true, bottom: true, - color: {process: require('processColor')}, + color: {process: require('../../StyleSheet/processColor')}, decomposedMatrix: true, direction: true, display: true, @@ -275,7 +291,7 @@ const ReactNativeViewConfig = { minWidth: true, opacity: true, overflow: true, - overlayColor: {process: require('processColor')}, + overlayColor: {process: require('../../StyleSheet/processColor')}, padding: true, paddingBottom: true, paddingEnd: true, @@ -291,23 +307,23 @@ const ReactNativeViewConfig = { rotation: true, scaleX: true, scaleY: true, - shadowColor: {process: require('processColor')}, - shadowOffset: {diff: require('sizesDiffer')}, + shadowColor: {process: require('../../StyleSheet/processColor')}, + shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')}, shadowOpacity: true, shadowRadius: true, start: true, textAlign: true, textAlignVertical: true, - textDecorationColor: {process: require('processColor')}, + textDecorationColor: {process: require('../../StyleSheet/processColor')}, textDecorationLine: true, textDecorationStyle: true, - textShadowColor: {process: require('processColor')}, + textShadowColor: {process: require('../../StyleSheet/processColor')}, textShadowOffset: true, textShadowRadius: true, textTransform: true, - tintColor: {process: require('processColor')}, + tintColor: {process: require('../../StyleSheet/processColor')}, top: true, - transform: {diff: require('matricesDiffer')}, + transform: {diff: require('../../Utilities/differ/matricesDiffer')}, transformMatrix: true, translateX: true, translateY: true, @@ -317,7 +333,7 @@ const ReactNativeViewConfig = { }, testID: true, top: true, - transform: {diff: require('matricesDiffer')}, + transform: {diff: require('../../Utilities/differ/matricesDiffer')}, translateX: true, translateY: true, width: true, diff --git a/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js new file mode 100644 index 00000000000000..250b0634bae3f4 --- /dev/null +++ b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js @@ -0,0 +1,74 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +const ReactNativeViewViewConfigAndroid = { + uiViewClassName: 'RCTView', + bubblingEventTypes: { + topSelect: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture', + }, + }, + }, + directEventTypes: { + topClick: { + registrationName: 'onClick', + }, + topContentSizeChange: { + registrationName: 'onContentSizeChange', + }, + topLoadingError: { + registrationName: 'onLoadingError', + }, + topLoadingFinish: { + registrationName: 'onLoadingFinish', + }, + topLoadingStart: { + registrationName: 'onLoadingStart', + }, + topMessage: { + registrationName: 'onMessage', + }, + topMomentumScrollBegin: { + registrationName: 'onMomentumScrollBegin', + }, + topMomentumScrollEnd: { + registrationName: 'onMomentumScrollEnd', + }, + topScroll: { + registrationName: 'onScroll', + }, + topScrollBeginDrag: { + registrationName: 'onScrollBeginDrag', + }, + topScrollEndDrag: { + registrationName: 'onScrollEndDrag', + }, + topSelectionChange: { + registrationName: 'onSelectionChange', + }, + }, + validAttributes: { + hasTVPreferredFocus: true, + focusable: true, + nativeBackgroundAndroid: true, + nativeForegroundAndroid: true, + nextFocusDown: true, + nextFocusForward: true, + nextFocusLeft: true, + nextFocusRight: true, + nextFocusUp: true, + }, +}; + +module.exports = ReactNativeViewViewConfigAndroid; diff --git a/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js new file mode 100644 index 00000000000000..88de4c4752541a --- /dev/null +++ b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js @@ -0,0 +1,55 @@ +/** + * 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. + * + * @flow + * @format + */ + +// TODO(macOS ISS#2323203) + +'use strict'; + +const ReactNativeViewViewConfigMacOS = { + uiViewClassName: 'RCTView', + directEventTypes: { + topDoubleClick: { + registrationName: 'topDoubleClick', + }, + topDragEnter: { + registrationName: 'topDragEnter', + }, + topDragLeave: { + registrationName: 'topDragLeave', + }, + topDrop: { + registrationName: 'topDrop', + }, + topMouseEnter: { + registrationName: 'topMouseEnter', + }, + topMouseLeave: { + registrationName: 'topMouseLeave', + }, + }, + validAttributes: { + acceptsKeyboardFocus: true, + accessibilityTraits: true, + draggedTypes: true, + enableFocusRing: true, + onBlur: true, + onClick: true, + onDoubleClick: true, + onDragEnter: true, + onDragLeave: true, + onDrop: true, + onFocus: true, + onMouseEnter: true, + onMouseLeave: true, + tooltip: true, + }, +}; + +module.exports = ReactNativeViewViewConfigMacOS; diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index c321d7f87a7cbc..bd2c26f0e5d7d0 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -10,10 +10,8 @@ 'use strict'; -const React = require('react'); -const ViewNativeComponent = require('./ViewNativeComponent'); - import type {ViewProps} from './ViewPropTypes'; +import type {ViewNativeComponentType} from './ViewNativeComponent'; export type Props = ViewProps; @@ -24,19 +22,5 @@ export type Props = ViewProps; * * @see http://facebook.github.io/react-native/docs/view.html */ - -let ViewToExport = ViewNativeComponent; -if (__DEV__) { - if (!global.__RCTProfileIsProfiling) { - const View = ( - props: Props, - forwardedRef: React.Ref, - ) => { - return ; - }; - ViewToExport = React.forwardRef(View); - ViewToExport.displayName = 'View'; - } -} - -module.exports = ((ViewToExport: $FlowFixMe): typeof ViewNativeComponent); +module.exports = (require('./ViewNativeComponent') + .default: ViewNativeComponentType); diff --git a/Libraries/Components/View/ViewAccessibility.js b/Libraries/Components/View/ViewAccessibility.js index f54ef112ac98c8..04258e2f99a32b 100644 --- a/Libraries/Components/View/ViewAccessibility.js +++ b/Libraries/Components/View/ViewAccessibility.js @@ -10,7 +10,7 @@ 'use strict'; -import type {SyntheticEvent} from 'CoreEventTypes'; +import type {SyntheticEvent} from '../../Types/CoreEventTypes'; // [TODO(android ISS) export type AccessibilityNodeInfoProp = { @@ -71,3 +71,11 @@ export type AccessibilityActionEvent = SyntheticEvent< actionName: string, }>, >; + +export type AccessibilityState = { + disabled?: boolean, + selected?: boolean, + checked?: ?boolean | 'mixed', + busy?: boolean, + expanded?: boolean, +}; diff --git a/Libraries/Components/View/ViewNativeComponent.js b/Libraries/Components/View/ViewNativeComponent.js index 21e57c8a437ab5..f954a2d6c2f474 100644 --- a/Libraries/Components/View/ViewNativeComponent.js +++ b/Libraries/Components/View/ViewNativeComponent.js @@ -10,14 +10,61 @@ 'use strict'; +const Platform = require('../../Utilities/Platform'); const ReactNative = require('../../Renderer/shims/ReactNative'); +const ReactNativeViewViewConfigAndroid = require('./ReactNativeViewViewConfigAndroid'); +const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); import type {ViewProps} from './ViewPropTypes'; -type ViewNativeComponentType = Class>; +export type ViewNativeComponentType = Class< + ReactNative.NativeComponent, +>; -const NativeViewComponent = requireNativeComponent('RCTView'); +let NativeViewComponent; +let viewConfig: + | $TEMPORARY$object<{||}> + | $TEMPORARY$object<{| + bubblingEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{| + phasedRegistrationNames: $ReadOnly<{| + bubbled: string, + captured: string, + |}>, + |}>, + }>, + directEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{|registrationName: string|}>, + }>, + uiViewClassName: string, + validAttributes?: { + [propName: string]: + | true + | $ReadOnly<{| + diff?: (arg1: any, arg2: any) => boolean, + process?: (arg1: any) => any, + |}>, + }, + |}>; -module.exports = ((NativeViewComponent: any): ViewNativeComponentType); +// Only use the JS view config in DEV +if (__DEV__) { + // On Android, View extends the base component with additional view-only props + // On iOS, the base component is View + if (Platform.OS === 'android') { + viewConfig = ReactNativeViewViewConfigAndroid; + registerGeneratedViewConfig('RCTView', ReactNativeViewViewConfigAndroid); + } else { + viewConfig = {}; + registerGeneratedViewConfig('RCTView', {uiViewClassName: 'RCTView'}); + } + + NativeViewComponent = 'RCTView'; +} else { + NativeViewComponent = requireNativeComponent('RCTView'); +} + +export const __INTERNAL_VIEW_CONFIG = viewConfig; +export default ((NativeViewComponent: any): ViewNativeComponentType); diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 8c8fde418c1321..01116548725ae8 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -23,13 +23,14 @@ import type {TVViewProps} from '../AppleTV/TVViewPropTypes'; import type { AccessibilityRole, AccessibilityStates, + AccessibilityState, AccessibilityActionEvent, AccessibilityActionInfo, AccessibilityNodeInfoProp, // TODO(android ISS) } from './ViewAccessibility'; // [TODO(macOS ISS#2323203) -import type {DraggedTypesType} from 'DraggedType'; +import type {DraggedTypesType} from '../View/DraggedType'; // ]TODO(macOS ISS#2323203) export type ViewLayout = Layout; @@ -289,7 +290,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android */ - clickable?: ?boolean, // TODO(android ISS) + focusable?: ?boolean, // TODO(android ISS) /** * When `clickable` is true, the system will try to invoke this function @@ -366,8 +367,9 @@ type AndroidViewProps = $ReadOnly<{| nextFocusUp?: ?number, /** - * When `clickable` is true, the system will try to invoke this function + * Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard. * when the user performs a click. + focusable?: boolean, * * @platform android */ @@ -472,6 +474,7 @@ export type ViewProps = $ReadOnly<{| * Indicates to accessibility services that UI Component is in a specific State. */ accessibilityStates?: ?AccessibilityStates, + accessibilityState?: ?AccessibilityState, /** * Provides an array of custom actions available for accessibility. diff --git a/Libraries/Components/ViewPager/AndroidViewPagerNativeComponent.js b/Libraries/Components/ViewPager/AndroidViewPagerNativeComponent.js deleted file mode 100644 index 82c7e18fb65d4b..00000000000000 --- a/Libraries/Components/ViewPager/AndroidViewPagerNativeComponent.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; -import type {Node} from 'react'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; - -type PageScrollState = 'idle' | 'dragging' | 'settling'; - -type PageScrollEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - offset: number, - |}>, ->; - -type PageScrollStateChangedEvent = SyntheticEvent< - $ReadOnly<{| - pageScrollState: PageScrollState, - |}>, ->; - -type PageSelectedEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -type NativeProps = $ReadOnly<{| - /** - * Index of initial page that should be selected. Use `setPage` method to - * update the page, and `onPageSelected` to monitor page changes - */ - initialPage?: ?number, - - /** - * Executed when transitioning between pages (ether because of animation for - * the requested page change or when user is swiping/dragging between pages) - * The `event.nativeEvent` object for this callback will carry following data: - * - position - index of first page from the left that is currently visible - * - offset - value from range [0,1) describing stage between page transitions. - * Value x means that (1 - x) fraction of the page at "position" index is - * visible, and x fraction of the next page is visible. - */ - onPageScroll?: ?(e: PageScrollEvent) => void, - - /** - * Function called when the page scrolling state has changed. - * The page scrolling state can be in 3 states: - * - idle, meaning there is no interaction with the page scroller happening at the time - * - dragging, meaning there is currently an interaction with the page scroller - * - settling, meaning that there was an interaction with the page scroller, and the - * page scroller is now finishing it's closing or opening animation - */ - onPageScrollStateChanged?: ?(e: PageScrollStateChangedEvent) => void, - - /** - * This callback will be called once ViewPager finish navigating to selected page - * (when user swipes between pages). The `event.nativeEvent` object passed to this - * callback will have following fields: - * - position - index of page that has been selected - */ - onPageSelected?: ?(e: PageSelectedEvent) => void, - - /** - * Blank space to show between pages. This is only visible while scrolling, pages are still - * edge-to-edge. - */ - pageMargin?: ?number, - - /** - * Whether enable showing peekFraction or not. If this is true, the preview of - * last and next page will show in current screen. Defaults to false. - */ - - peekEnabled?: ?boolean, - - /** - * Determines whether the keyboard gets dismissed in response to a drag. - * - 'none' (the default), drags do not dismiss the keyboard. - * - 'on-drag', the keyboard is dismissed when a drag begins. - */ - keyboardDismissMode?: ?('none' | 'on-drag'), - - /** - * When false, the content does not scroll. - * The default value is true. - */ - scrollEnabled?: ?boolean, - - children?: Node, - - style?: ?ViewStyleProp, -|}>; - -type ViewPagerNativeType = Class>; - -module.exports = ((requireNativeComponent( - 'AndroidViewPager', -): any): ViewPagerNativeType); diff --git a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js deleted file mode 100644 index 1763a0ccd0450e..00000000000000 --- a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js +++ /dev/null @@ -1,281 +0,0 @@ -/** - * 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. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const React = require('react'); -const ReactNative = require('../../Renderer/shims/ReactNative'); -const UIManager = require('../../ReactNative/UIManager'); - -const dismissKeyboard = require('../../Utilities/dismissKeyboard'); - -const NativeAndroidViewPager = require('./AndroidViewPagerNativeComponent'); - -import type {SyntheticEvent} from '../../Types/CoreEventTypes'; -import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; - -const VIEWPAGER_REF = 'viewPager'; - -type PageScrollState = 'idle' | 'dragging' | 'settling'; - -type PageScrollEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - offset: number, - |}>, ->; - -type PageScrollStateChangedEvent = SyntheticEvent< - $ReadOnly<{| - pageScrollState: PageScrollState, - |}>, ->; - -type PageSelectedEvent = SyntheticEvent< - $ReadOnly<{| - position: number, - |}>, ->; - -export type ViewPagerScrollState = $Keys<{ - idle: string, - dragging: string, - settling: string, -}>; - -type Props = $ReadOnly<{| - /** - * Index of initial page that should be selected. Use `setPage` method to - * update the page, and `onPageSelected` to monitor page changes - */ - initialPage?: ?number, - - /** - * Executed when transitioning between pages (ether because of animation for - * the requested page change or when user is swiping/dragging between pages) - * The `event.nativeEvent` object for this callback will carry following data: - * - position - index of first page from the left that is currently visible - * - offset - value from range [0,1) describing stage between page transitions. - * Value x means that (1 - x) fraction of the page at "position" index is - * visible, and x fraction of the next page is visible. - */ - onPageScroll?: ?(e: PageScrollEvent) => void, - - /** - * Function called when the page scrolling state has changed. - * The page scrolling state can be in 3 states: - * - idle, meaning there is no interaction with the page scroller happening at the time - * - dragging, meaning there is currently an interaction with the page scroller - * - settling, meaning that there was an interaction with the page scroller, and the - * page scroller is now finishing it's closing or opening animation - */ - onPageScrollStateChanged?: ?(e: PageScrollStateChangedEvent) => void, - - /** - * This callback will be called once ViewPager finish navigating to selected page - * (when user swipes between pages). The `event.nativeEvent` object passed to this - * callback will have following fields: - * - position - index of page that has been selected - */ - onPageSelected?: ?(e: PageSelectedEvent) => void, - - /** - * Blank space to show between pages. This is only visible while scrolling, pages are still - * edge-to-edge. - */ - pageMargin?: ?number, - - /** - * Whether enable showing peekFraction or not. If this is true, the preview of - * last and next page will show in current screen. Defaults to false. - */ - - peekEnabled?: ?boolean, - - /** - * Determines whether the keyboard gets dismissed in response to a drag. - * - 'none' (the default), drags do not dismiss the keyboard. - * - 'on-drag', the keyboard is dismissed when a drag begins. - */ - keyboardDismissMode?: ?('none' | 'on-drag'), - - /** - * When false, the content does not scroll. - * The default value is true. - */ - scrollEnabled?: ?boolean, - - children?: React.Node, - - style?: ?ViewStyleProp, -|}>; - -/** - * Container that allows to flip left and right between child views. Each - * child view of the `ViewPagerAndroid` will be treated as a separate page - * and will be stretched to fill the `ViewPagerAndroid`. - * - * It is important all children are ``s and not composite components. - * You can set style properties like `padding` or `backgroundColor` for each - * child. It is also important that each child have a `key` prop. - * - * Example: - * - * ``` - * render: function() { - * return ( - * - * - * First page - * - * - * Second page - * - * - * ); - * } - * - * ... - * - * var styles = { - * ... - * viewPager: { - * flex: 1 - * }, - * pageStyle: { - * alignItems: 'center', - * padding: 20, - * } - * } - * ``` - */ - -class ViewPagerAndroid extends React.Component { - componentDidMount() { - if (this.props.initialPage != null) { - this.setPageWithoutAnimation(this.props.initialPage); - } - } - - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - getInnerViewNode = (): ReactComponent => { - return this.refs[VIEWPAGER_REF].getInnerViewNode(); - }; - - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - _childrenWithOverridenStyle = (): Array => { - // Override styles so that each page will fill the parent. Native component - // will handle positioning of elements, so it's not important to offset - // them correctly. - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - return React.Children.map(this.props.children, function(child) { - if (!child) { - return null; - } - const newProps = { - ...child.props, - style: [ - child.props.style, - { - position: 'absolute', - left: 0, - top: 0, - right: 0, - bottom: 0, - width: undefined, - height: undefined, - }, - ], - collapsable: false, - }; - if ( - child.type && - child.type.displayName && - child.type.displayName !== 'RCTView' && - child.type.displayName !== 'View' - ) { - console.warn( - 'Each ViewPager child must be a . Was ' + - child.type.displayName, - ); - } - return React.createElement(child.type, newProps); - }); - }; - - _onPageScroll = (e: PageScrollEvent) => { - if (this.props.onPageScroll) { - this.props.onPageScroll(e); - } - if (this.props.keyboardDismissMode === 'on-drag') { - dismissKeyboard(); - } - }; - - _onPageScrollStateChanged = (e: PageScrollStateChangedEvent) => { - if (this.props.onPageScrollStateChanged) { - this.props.onPageScrollStateChanged(e); - } - }; - - _onPageSelected = (e: PageSelectedEvent) => { - if (this.props.onPageSelected) { - this.props.onPageSelected(e); - } - }; - - /** - * A helper function to scroll to a specific page in the ViewPager. - * The transition between pages will be animated. - */ - setPage = (selectedPage: number) => { - UIManager.dispatchViewManagerCommand( - ReactNative.findNodeHandle(this), - UIManager.getViewManagerConfig('AndroidViewPager').Commands.setPage, - [selectedPage], - ); - }; - - /** - * A helper function to scroll to a specific page in the ViewPager. - * The transition between pages will *not* be animated. - */ - setPageWithoutAnimation = (selectedPage: number) => { - UIManager.dispatchViewManagerCommand( - ReactNative.findNodeHandle(this), - UIManager.getViewManagerConfig('AndroidViewPager').Commands - .setPageWithoutAnimation, - [selectedPage], - ); - }; - - render() { - return ( - =0.78.0 site=react_native_android_fb) This issue was - * found when making Flow check .android.js files. */ - style={this.props.style} - onPageScroll={this._onPageScroll} - onPageScrollStateChanged={this._onPageScrollStateChanged} - onPageSelected={this._onPageSelected} - children={this._childrenWithOverridenStyle()} - /> - ); - } -} - -module.exports = ViewPagerAndroid; diff --git a/Libraries/Components/WKWebView/WKWebView.ios.js b/Libraries/Components/WKWebView/WKWebView.ios.js deleted file mode 100644 index 24ee4ac83135a3..00000000000000 --- a/Libraries/Components/WKWebView/WKWebView.ios.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2015-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. - * - * @format - * @flow - * @providesModule WKWebView - */ - -const React = require('react'); - -const requireNativeComponent = require('requireNativeComponent'); - -const RCTWKWebView = requireNativeComponent('RCTWKWebView'); - -type RCTWKWebViewProps = { - allowsInlineMediaPlayback?: boolean, - mediaPlaybackRequiresUserAction?: boolean, - dataDetectorTypes?: boolean, -}; - -class WKWebView extends React.Component { - componentWillReceiveProps(nextProps: RCTWKWebViewProps) { - this.showRedboxOnPropChanges(nextProps, 'allowsInlineMediaPlayback'); - this.showRedboxOnPropChanges(nextProps, 'mediaPlaybackRequiresUserAction'); - this.showRedboxOnPropChanges(nextProps, 'dataDetectorTypes'); - } - - showRedboxOnPropChanges(nextProps: RCTWKWebViewProps, propName: string) { - if (this.props[propName] !== nextProps[propName]) { - console.error( - `Changes to property ${propName} do nothing after the initial render.`, - ); - } - } - - render() { - return ; - } -} - -module.exports = WKWebView; diff --git a/Libraries/Core/Devtools/getDevServer.js b/Libraries/Core/Devtools/getDevServer.js index 1de83592dc3b43..845640847c8d29 100644 --- a/Libraries/Core/Devtools/getDevServer.js +++ b/Libraries/Core/Devtools/getDevServer.js @@ -10,7 +10,7 @@ 'use strict'; -const {SourceCode} = require('../../BatchedBridge/NativeModules'); +import NativeSourceCode from '../../NativeModules/specs/NativeSourceCode'; let _cachedDevServerURL: ?string; const FALLBACK = 'http://localhost:8081/'; @@ -26,10 +26,9 @@ type DevServerInfo = { */ function getDevServer(): DevServerInfo { if (_cachedDevServerURL === undefined) { - const match = - SourceCode && - SourceCode.scriptURL && - SourceCode.scriptURL.match(/^https?:\/\/.*?\//); + const match = NativeSourceCode.getConstants().scriptURL.match( + /^https?:\/\/.*?\//, + ); _cachedDevServerURL = match ? match[0] : null; } diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index a826630355df32..6c9ffb710e4953 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -10,16 +10,13 @@ 'use strict'; -export type StackFrame = { - column: ?number, - file: string, - lineNumber: number, - methodName: string, -}; +import type {StackFrame} from '../NativeExceptionsManager'; export type ExtendedError = Error & { framesToPop?: number, jsEngine?: string, + preventSymbolication?: boolean, + componentStack?: string, }; function parseErrorStack(e: ExtendedError): Array { diff --git a/Libraries/Core/Devtools/setupDevtools.js b/Libraries/Core/Devtools/setupDevtools.js deleted file mode 100644 index 43ca374d50cdbd..00000000000000 --- a/Libraries/Core/Devtools/setupDevtools.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -let register = function() { - // noop -}; - -if (__DEV__) { - const AppState = require('../../AppState/AppState'); - const reactDevTools = require('react-devtools-core'); - const getDevServer = require('./getDevServer'); - - // Don't steal the DevTools from currently active app. - // Note: if you add any AppState subscriptions to this file, - // you will also need to guard against `AppState.isAvailable`, - // or the code will throw for bundles that don't have it. - const isAppActive = () => AppState.currentState !== 'background'; - - // Get hostname from development server (packager) - const devServer = getDevServer(); - const host = devServer.bundleLoadedFromServer - ? devServer.url.replace(/https?:\/\//, '').split(':')[0] - : 'localhost'; - - reactDevTools.connectToDevTools({ - isAppActive, - host, - // Read the optional global variable for backward compatibility. - // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0. - port: window.__REACT_DEVTOOLS_PORT__, - resolveRNStyle: require('../../StyleSheet/flattenStyle'), - }); -} - -module.exports = { - register, -}; diff --git a/Libraries/Core/Devtools/symbolicateStackTrace.js b/Libraries/Core/Devtools/symbolicateStackTrace.js index f7cc031e300787..1dbcd389b1dbf0 100644 --- a/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -12,12 +12,12 @@ const getDevServer = require('./getDevServer'); -const {SourceCode} = require('../../BatchedBridge/NativeModules'); +import NativeSourceCode from '../../NativeModules/specs/NativeSourceCode'; // Avoid requiring fetch on load of this module; see symbolicateStackTrace let fetch; -import type {StackFrame} from './parseErrorStack'; +import type {StackFrame} from '../NativeExceptionsManager'; function isSourcedFromDisk(sourcePath: string): boolean { return !/^http/.test(sourcePath) && /[\\/]/.test(sourcePath); @@ -48,16 +48,21 @@ async function symbolicateStackTrace( let stackCopy = stack; - if (SourceCode.scriptURL) { + const {scriptURL} = NativeSourceCode.getConstants(); + if (scriptURL) { let foundInternalSource: boolean = false; stackCopy = stack.map((frame: StackFrame) => { + if (frame.file == null) { + return frame; + } + // If the sources exist on disk rather than appearing to come from the packager, // replace the location with the packager URL until we reach an internal source // which does not have a path (no slashes), indicating a switch from within // the application to a surrounding debugging environment. if (!foundInternalSource && isSourcedFromDisk(frame.file)) { // Copy frame into new object and replace 'file' property - return {...frame, file: SourceCode.scriptURL}; + return {...frame, file: scriptURL}; } foundInternalSource = true; diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index 24ca07b5891b9a..7060fdd618947d 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -5,100 +5,125 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; import type {ExtendedError} from './Devtools/parseErrorStack'; -const INTERNAL_CALLSITES_REGEX = new RegExp( - [ - '/Libraries/Renderer/oss/ReactNativeRenderer-dev\\.js$', - '/Libraries/BatchedBridge/MessageQueue\\.js$', - ].join('|'), -); +class SyntheticError extends Error { + name: string = ''; +} /** * Handles the developer-visible aspect of errors and exceptions */ let exceptionID = 0; function reportException(e: ExtendedError, isFatal: boolean) { - const {ExceptionsManager} = require('../BatchedBridge/NativeModules'); - if (ExceptionsManager) { + const NativeExceptionsManager = require('./NativeExceptionsManager').default; + if (NativeExceptionsManager) { const parseErrorStack = require('./Devtools/parseErrorStack'); const stack = parseErrorStack(e); const currentExceptionID = ++exceptionID; - const message = - e.jsEngine == null ? e.message : `${e.message}, js engine: ${e.jsEngine}`; - if (isFatal) { - ExceptionsManager.reportFatalException( - message, - stack, - currentExceptionID, - ); - } else { - ExceptionsManager.reportSoftException(message, stack, currentExceptionID); + const originalMessage = e.message || ''; + let message = originalMessage; + if (e.componentStack != null) { + message += `\n\nThis error is located at:${e.componentStack}`; + } + const namePrefix = e.name == null || e.name === '' ? '' : `${e.name}: `; + const isFromConsoleError = e.name === 'console.error'; + + if (!message.startsWith(namePrefix)) { + message = namePrefix + message; + } + + // Errors created by `console.error` have already been printed. + if (!isFromConsoleError) { + if (console._errorOriginal) { + console._errorOriginal(message); + } else { + console.error(message); + } } + + message = + e.jsEngine == null ? message : `${message}, js engine: ${e.jsEngine}`; + NativeExceptionsManager.reportException({ + message, + originalMessage: message === originalMessage ? null : originalMessage, + name: e.name == null || e.name === '' ? null : e.name, + componentStack: + typeof e.componentStack === 'string' ? e.componentStack : null, + stack, + id: currentExceptionID, + isFatal, + extraData: { + jsEngine: e.jsEngine, + rawStack: e.stack, + framesPopped: e.framesToPop, + }, + }); if (__DEV__) { + if (e.preventSymbolication === true) { + return; + } const symbolicateStackTrace = require('./Devtools/symbolicateStackTrace'); symbolicateStackTrace(stack) .then(prettyStack => { if (prettyStack) { - const stackWithoutInternalCallsites = prettyStack.filter( - frame => - frame.file && - frame.file.match(INTERNAL_CALLSITES_REGEX) === null, + const stackWithoutCollapsedFrames = prettyStack.filter( + frame => !frame.collapse, ); - ExceptionsManager.updateExceptionMessage( + NativeExceptionsManager.updateExceptionMessage( message, - stackWithoutInternalCallsites, + stackWithoutCollapsedFrames, currentExceptionID, ); } else { throw new Error('The stack is null'); } }) - .catch(error => - console.warn('Unable to symbolicate stack trace: ' + error.message), - ); + .catch(error => { + console.log('Unable to symbolicate stack trace: ' + error.message); + }); } } } declare var console: typeof console & { - _errorOriginal: Function, + _errorOriginal: typeof console.error, reportErrorsAsExceptions: boolean, }; /** * Logs exceptions to the (native) console and displays them */ -function handleException(e: Error, isFatal: boolean) { - // Workaround for reporting errors caused by `throw 'some string'` - // Unfortunately there is no way to figure out the stacktrace in this - // case, so if you ended up here trying to trace an error, look for - // `throw ''` somewhere in your codebase. - if (!e.message) { - e = new Error(e); - } - if (console._errorOriginal) { - console._errorOriginal(e.message); +function handleException(e: mixed, isFatal: boolean) { + let error: Error; + if (e instanceof Error) { + error = e; } else { - console.error(e.message); + // Workaround for reporting errors caused by `throw 'some string'` + // Unfortunately there is no way to figure out the stacktrace in this + // case, so if you ended up here trying to trace an error, look for + // `throw ''` somewhere in your codebase. + error = new SyntheticError(e); } - reportException(e, isFatal); + reportException(error, isFatal); } function reactConsoleErrorHandler() { - console._errorOriginal.apply(console, arguments); if (!console.reportErrorsAsExceptions) { + console._errorOriginal.apply(console, arguments); return; } if (arguments[0] && arguments[0].stack) { + // reportException will console.error this with high enough fidelity. reportException(arguments[0], /* isFatal */ false); } else { + console._errorOriginal.apply(console, arguments); const stringifySafe = require('../Utilities/stringifySafe'); const str = Array.prototype.map.call(arguments, stringifySafe).join(', '); if (str.slice(0, 10) === '"Warning: ') { @@ -107,8 +132,9 @@ function reactConsoleErrorHandler() { // (Note: Logic duplicated in polyfills/console.js.) return; } - const error: ExtendedError = new Error('console.error: ' + str); - error.framesToPop = 1; + const error: ExtendedError = new SyntheticError(str); + error.name = 'console.error'; + error.framesToPop = (error.framesToPop || 0) + 1; reportException(error, /* isFatal */ false); } } @@ -132,4 +158,4 @@ function installConsoleErrorReporter() { } } -module.exports = {handleException, installConsoleErrorReporter}; +module.exports = {handleException, installConsoleErrorReporter, SyntheticError}; diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 263001547b6132..8b9a6a490739d1 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -28,7 +28,6 @@ const start = Date.now(); require('./setUpGlobals'); -require('./polyfillES6Collections'); require('./setUpSystrace'); require('./setUpErrorHandling'); require('./polyfillPromise'); diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js new file mode 100644 index 00000000000000..eb6f4f257b38f7 --- /dev/null +++ b/Libraries/Core/NativeExceptionsManager.js @@ -0,0 +1,116 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export type StackFrame = {| + column: ?number, + file: ?string, + lineNumber: ?number, + methodName: string, + collapse?: boolean, +|}; + +export type ExceptionData = { + message: string, + originalMessage: ?string, + name: ?string, + componentStack: ?string, + stack: Array, + id: number, + isFatal: boolean, + // flowlint-next-line unclear-type:off + extraData?: Object, +}; + +export interface Spec extends TurboModule { + // Deprecated: Use `reportException` + +reportFatalException: ( + message: string, + stack: Array, + exceptionId: number, + ) => void; + // Deprecated: Use `reportException` + +reportSoftException: ( + message: string, + stack: Array, + exceptionId: number, + ) => void; + // TODO(T53311281): This is a noop on iOS now. Implement it. + +reportException?: (data: ExceptionData) => void; + +updateExceptionMessage: ( + message: string, + stack: Array, + exceptionId: number, + ) => void; + // TODO(T53311281): This is a noop on iOS now. Implement it. + +dismissRedbox?: () => void; +} + +const Platform = require('../Utilities/Platform'); + +const NativeModule = TurboModuleRegistry.getEnforcing( + 'ExceptionsManager', +); + +const ExceptionsManager = { + reportFatalException( + message: string, + stack: Array, + exceptionId: number, + ) { + NativeModule.reportFatalException(message, stack, exceptionId); + }, + reportSoftException( + message: string, + stack: Array, + exceptionId: number, + ) { + NativeModule.reportSoftException(message, stack, exceptionId); + }, + updateExceptionMessage( + message: string, + stack: Array, + exceptionId: number, + ) { + NativeModule.updateExceptionMessage(message, stack, exceptionId); + }, + dismissRedbox(): void { + if ( + Platform.OS !== 'ios' && + Platform.OS !== 'macos' /* TODO(macOS ISS#2323203) */ && + NativeModule.dismissRedbox + ) { + // TODO(T53311281): This is a noop on iOS now. Implement it. + NativeModule.dismissRedbox(); + } + }, + reportException(data: ExceptionData): void { + if ( + Platform.OS !== 'ios' && + Platform.OS !== 'macos' /* TODO(macOS ISS#2323203) */ && + NativeModule.reportException + ) { + // TODO(T53311281): This is a noop on iOS now. Implement it. + NativeModule.reportException(data); + return; + } + if (data.isFatal) { + ExceptionsManager.reportFatalException(data.message, data.stack, data.id); + } else { + ExceptionsManager.reportSoftException(data.message, data.stack, data.id); + } + }, +}; + +export default ExceptionsManager; diff --git a/Libraries/Core/ReactFiberErrorDialog.js b/Libraries/Core/ReactFiberErrorDialog.js new file mode 100644 index 00000000000000..936f716e6a507d --- /dev/null +++ b/Libraries/Core/ReactFiberErrorDialog.js @@ -0,0 +1,54 @@ +/** + * 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. + * + * @format + * @flow + */ + +export type CapturedError = { + +componentName: ?string, + +componentStack: string, + +error: mixed, + +errorBoundary: ?{}, + +errorBoundaryFound: boolean, + +errorBoundaryName: string | null, + +willRetry: boolean, +}; + +import type {ExtendedError} from './Devtools/parseErrorStack'; + +import {handleException, SyntheticError} from './ExceptionsManager'; + +/** + * Intercept lifecycle errors and ensure they are shown with the correct stack + * trace within the native redbox component. + */ +function showErrorDialog(capturedError: CapturedError): boolean { + const {componentStack, error} = capturedError; + + let errorToHandle; + + // Typically Errors are thrown but eg strings or null can be thrown as well. + if (error instanceof Error) { + errorToHandle = (error: ExtendedError); + } else if (typeof error === 'string') { + errorToHandle = (new SyntheticError(error): ExtendedError); + } else { + errorToHandle = (new SyntheticError('Unspecified error'): ExtendedError); + } + try { + errorToHandle.componentStack = componentStack; + } catch (e) {} + handleException(errorToHandle, false); + + // Return false here to prevent ReactFiberErrorLogger default behavior of + // logging error details to console.error. Calls to console.error are + // automatically routed to the native redbox controller, which we've already + // done above by calling ExceptionsManager. + return false; +} + +module.exports = {showErrorDialog}; diff --git a/Libraries/Core/ReactNativeVersion.js b/Libraries/Core/ReactNativeVersion.js index 54ff9067c8f923..a3a0a005fd0593 100644 --- a/Libraries/Core/ReactNativeVersion.js +++ b/Libraries/Core/ReactNativeVersion.js @@ -11,7 +11,7 @@ exports.version = { major: 0, - minor: 60, - patch: 0, + minor: 61, + patch: 5, prerelease: null, }; diff --git a/Libraries/Core/ReactNativeVersionCheck.js b/Libraries/Core/ReactNativeVersionCheck.js index 30264918c79221..a2eb4d050fc90c 100644 --- a/Libraries/Core/ReactNativeVersionCheck.js +++ b/Libraries/Core/ReactNativeVersionCheck.js @@ -9,7 +9,7 @@ */ 'use strict'; -const {PlatformConstants} = require('../BatchedBridge/NativeModules'); +import Platform from '../Utilities/Platform'; const ReactNativeVersion = require('./ReactNativeVersion'); /** @@ -22,11 +22,7 @@ const ReactNativeVersion = require('./ReactNativeVersion'); * and rely on its existence as a separate module. */ exports.checkVersions = function checkVersions(): void { - if (!PlatformConstants) { - return; - } - - const nativeVersion = PlatformConstants.reactNativeVersion; + const nativeVersion = Platform.constants.reactNativeVersion; if ( ReactNativeVersion.version.major !== nativeVersion.major || ReactNativeVersion.version.minor !== nativeVersion.minor @@ -46,6 +42,7 @@ exports.checkVersions = function checkVersions(): void { function _formatVersion(version): string { return ( `${version.major}.${version.minor}.${version.patch}` + - (version.prerelease !== null ? `-${version.prerelease}` : '') + // eslint-disable-next-line eqeqeq + (version.prerelease != undefined ? `-${version.prerelease}` : '') ); } diff --git a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js index 38319e03456d68..1e5d9b4deca8ad 100644 --- a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +++ b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js @@ -18,6 +18,11 @@ export interface Spec extends TurboModule { options: Object, // flowlint-line unclear-type: off callback: (error: ?Object) => void, // flowlint-line unclear-type: off ) => void; + +getSegment?: ( + segmentId: number, + options: Object, // flowlint-line unclear-type: off + callback: (error: ?Object, path: ?string) => void, // flowlint-line unclear-type: off + ) => void; } -export default TurboModuleRegistry.getEnforcing('SegmentFetcher'); +export default (TurboModuleRegistry.getEnforcing('SegmentFetcher'): Spec); diff --git a/Libraries/Core/Timers/JSTimers.js b/Libraries/Core/Timers/JSTimers.js index 54d86d44f18197..e877680f778aad 100644 --- a/Libraries/Core/Timers/JSTimers.js +++ b/Libraries/Core/Timers/JSTimers.js @@ -9,14 +9,14 @@ */ 'use strict'; +const BatchedBridge = require('../../BatchedBridge/BatchedBridge'); const Platform = require('../../Utilities/Platform'); const Systrace = require('../../Performance/Systrace'); const invariant = require('invariant'); -const {Timing} = require('../../BatchedBridge/NativeModules'); -const BatchedBridge = require('../../BatchedBridge/BatchedBridge'); import type {ExtendedError} from '../Devtools/parseErrorStack'; +import NativeTiming from './NativeTiming'; let _performanceNow = null; function performanceNow() { @@ -221,7 +221,7 @@ function _freeCallback(timerID: number) { _clearIndex(index); const type = types[index]; if (type !== 'setImmediate' && type !== 'requestIdleCallback') { - Timing.deleteTimer(timerID); + deleteTimer(timerID); } } } @@ -250,7 +250,7 @@ const JSTimers = { () => func.apply(undefined, args), 'setTimeout', ); - Timing.createTimer(id, duration || 0, Date.now(), /* recurring */ false); + createTimer(id, duration || 0, Date.now(), /* recurring */ false); return id; }, @@ -276,7 +276,7 @@ const JSTimers = { () => func.apply(undefined, args), 'setInterval', ); - Timing.createTimer(id, duration || 0, Date.now(), /* recurring */ true); + createTimer(id, duration || 0, Date.now(), /* recurring */ true); return id; }, @@ -298,7 +298,7 @@ const JSTimers = { */ requestAnimationFrame: function(func: Function) { const id = _allocateCallback(func, 'requestAnimationFrame'); - Timing.createTimer(id, 1, Date.now(), /* recurring */ false); + createTimer(id, 1, Date.now(), /* recurring */ false); return id; }, @@ -309,7 +309,7 @@ const JSTimers = { */ requestIdleCallback: function(func: Function, options: ?Object) { if (requestIdleCallbacks.length === 0) { - Timing.setSendIdleEvents(true); + setSendIdleEvents(true); } const timeout = options && options.timeout; @@ -337,7 +337,7 @@ const JSTimers = { } delete requestIdleCallbackTimeouts[id]; if (requestIdleCallbacks.length === 0) { - Timing.setSendIdleEvents(false); + setSendIdleEvents(false); } }, timeout); requestIdleCallbackTimeouts[id] = timeoutId; @@ -359,7 +359,7 @@ const JSTimers = { } if (requestIdleCallbacks.length === 0) { - Timing.setSendIdleEvents(false); + setSendIdleEvents(false); } }, @@ -437,7 +437,7 @@ const JSTimers = { } if (requestIdleCallbacks.length === 0) { - Timing.setSendIdleEvents(false); + setSendIdleEvents(false); } if (errors) { @@ -477,8 +477,43 @@ const JSTimers = { }, }; -let ExportedJSTimers; -if (!Timing) { +function createTimer( + callbackID: number, + duration: number, + jsSchedulingTime: number, + repeats: boolean, +): void { + invariant(NativeTiming, 'NativeTiming is available'); + NativeTiming.createTimer(callbackID, duration, jsSchedulingTime, repeats); +} + +function deleteTimer(timerID: number): void { + invariant(NativeTiming, 'NativeTiming is available'); + NativeTiming.deleteTimer(timerID); +} + +function setSendIdleEvents(sendIdleEvents: boolean): void { + invariant(NativeTiming, 'NativeTiming is available'); + NativeTiming.setSendIdleEvents(sendIdleEvents); +} + +let ExportedJSTimers: $TEMPORARY$object<{| + callIdleCallbacks: (frameTime: number) => any | void, + callImmediates: () => void, + callTimers: (timersToCall: Array) => any | void, + cancelAnimationFrame: (timerID: number) => void, + cancelIdleCallback: (timerID: number) => void, + clearImmediate: (timerID: number) => void, + clearInterval: (timerID: number) => void, + clearTimeout: (timerID: number) => void, + emitTimeDriftWarning: (warningMessage: string) => any | void, + requestAnimationFrame: (func: any) => any | number, + requestIdleCallback: (func: any, options: ?any) => any | number, + setImmediate: (func: any, ...args: any) => number, + setInterval: (func: any, duration: number, ...args: any) => number, + setTimeout: (func: any, duration: number, ...args: any) => number, +|}>; +if (!NativeTiming) { console.warn("Timing native module is not available, can't set timers."); // $FlowFixMe: we can assume timers are generally available ExportedJSTimers = ({ diff --git a/Libraries/Core/Timers/NativeTiming.js b/Libraries/Core/Timers/NativeTiming.js new file mode 100644 index 00000000000000..0070adb906e615 --- /dev/null +++ b/Libraries/Core/Timers/NativeTiming.js @@ -0,0 +1,27 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +createTimer: ( + callbackID: number, + duration: number, + jsSchedulingTime: number, + repeats: boolean, + ) => void; + +deleteTimer: (timerID: number) => void; + +setSendIdleEvents: (sendIdleEvents: boolean) => void; +} + +export default (TurboModuleRegistry.get('Timing'): ?Spec); diff --git a/Libraries/Core/__tests__/ExceptionsManager-test.js b/Libraries/Core/__tests__/ExceptionsManager-test.js new file mode 100644 index 00000000000000..f76b93a585ea4b --- /dev/null +++ b/Libraries/Core/__tests__/ExceptionsManager-test.js @@ -0,0 +1,481 @@ +/** + * 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. + * + * @format + * @emails oncall+react_native + */ +'use strict'; + +const fs = require('fs'); + +const capturedErrorDefaults = { + componentName: 'A', + componentStack: '\n in A\n in B\n in C', + errorBoundary: null, + errorBoundaryFound: false, + errorBoundaryName: null, + willRetry: false, +}; + +describe('ExceptionsManager', () => { + let ReactFiberErrorDialog, + ExceptionsManager, + NativeExceptionsManager, + nativeReportException; + beforeEach(() => { + jest.resetModules(); + jest.mock('../NativeExceptionsManager', () => { + return { + default: { + reportException: jest.fn(), + // Used to show symbolicated messages, not part of this test. + updateExceptionMessage: () => {}, + }, + }; + }); + // Make symbolication a no-op. + jest.mock('../Devtools/symbolicateStackTrace', () => { + return async function symbolicateStackTrace(stack) { + return stack; + }; + }); + jest.spyOn(console, 'error').mockImplementation(() => {}); + ReactFiberErrorDialog = require('../ReactFiberErrorDialog'); + NativeExceptionsManager = require('../NativeExceptionsManager').default; + nativeReportException = NativeExceptionsManager.reportException; + ExceptionsManager = require('../ExceptionsManager'); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + describe('ReactFiberErrorDialog.showErrorDialog', () => { + test('forwards error instance to reportException', () => { + const error = new ReferenceError('Some error happened'); + // Copy all the data we care about before any possible mutation. + const {message, name} = error; + + const logToConsoleInReact = ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = + 'ReferenceError: ' + + message + + '\n\n' + + 'This error is located at:' + + capturedErrorDefaults.componentStack; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.name).toBe(name); + expect(exceptionData.componentStack).toBe( + capturedErrorDefaults.componentStack, + ); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = new ReferenceError('Some error happened');", + ); + expect(exceptionData.isFatal).toBe(false); + expect(logToConsoleInReact).toBe(false); + expect(console.error).toBeCalledWith(formattedMessage); + }); + + test('pops frames off the stack with framesToPop', () => { + function createError() { + const error = new Error('Some error happened'); + error.framesToPop = 1; + return error; + } + const error = createError(); + + ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + 'const error = createError();', + ); + }); + + test('adds the JS engine to the message', () => { + const error = new Error('Some error happened'); + error.jsEngine = 'hermes'; + // Copy all the data we care about before any possible mutation. + const {message, jsEngine} = error; + + ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(exceptionData.message).toBe( + 'Error: ' + + message + + '\n\n' + + 'This error is located at:' + + capturedErrorDefaults.componentStack + + ', js engine: ' + + jsEngine, + ); + expect(console.error).toBeCalledWith( + 'Error: ' + + message + + '\n\n' + + 'This error is located at:' + + capturedErrorDefaults.componentStack, + // JS engine omitted here! + ); + }); + + test('wraps string in an Error and sends to handleException', () => { + const message = 'Some error happened'; + + const logToConsoleInReact = ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error: message, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = + message + + '\n\n' + + 'This error is located at:' + + capturedErrorDefaults.componentStack; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.componentStack).toBe( + capturedErrorDefaults.componentStack, + ); + expect(exceptionData.stack[0].file).toMatch(/ReactFiberErrorDialog\.js$/); + expect(exceptionData.isFatal).toBe(false); + expect(logToConsoleInReact).toBe(false); + expect(console.error).toBeCalledWith(formattedMessage); + }); + + test('reports "Unspecified error" if error is null', () => { + const logToConsoleInReact = ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error: null, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = + 'Unspecified error' + + '\n\n' + + 'This error is located at:' + + capturedErrorDefaults.componentStack; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe('Unspecified error'); + expect(exceptionData.name).toBe(null); + expect(exceptionData.componentStack).toBe( + capturedErrorDefaults.componentStack, + ); + expect(exceptionData.stack[0].file).toMatch(/ReactFiberErrorDialog\.js$/); + expect(exceptionData.isFatal).toBe(false); + expect(logToConsoleInReact).toBe(false); + expect(console.error).toBeCalledWith(formattedMessage); + }); + + test('works with a frozen error object', () => { + const error = Object.freeze(new Error('Some error happened')); + + ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = Object.freeze(new Error('Some error happened'));", + ); + }); + + test('does not mutate the message', () => { + const error = new ReferenceError('Some error happened'); + const {message} = error; + + ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + error, + }); + + expect(nativeReportException).toHaveBeenCalled(); + expect(error.message).toBe(message); + }); + + test('can safely process the same error multiple times', () => { + const error = new ReferenceError('Some error happened'); + // Copy all the data we care about before any possible mutation. + const {message} = error; + const componentStacks = [ + '\n in A\n in B\n in C', + '\n in X\n in Y\n in Z', + ]; + for (const componentStack of componentStacks) { + nativeReportException.mockClear(); + const formattedMessage = + 'ReferenceError: ' + + message + + '\n\n' + + 'This error is located at:' + + componentStack; + const logToConsoleInReact = ReactFiberErrorDialog.showErrorDialog({ + ...capturedErrorDefaults, + componentStack, + error, + }); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.componentStack).toBe(componentStack); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = new ReferenceError('Some error happened');", + ); + expect(exceptionData.isFatal).toBe(false); + expect(logToConsoleInReact).toBe(false); + expect(console.error).toBeCalledWith(formattedMessage); + } + }); + }); + + describe('console.error handler', () => { + let mockError; + beforeEach(() => { + // NOTE: We initialise a fresh mock every time using spyOn, above. + // We can't use `console._errorOriginal` for this, because that's a bound + // (=wrapped) version of the mock and Jest does not approve. + mockError = console.error; + ExceptionsManager.installConsoleErrorReporter(); + }); + + afterEach(() => { + // There is no uninstallConsoleErrorReporter. Do this so the next install + // works. + console.error = console._errorOriginal; + delete console._errorOriginal; + delete console.reportErrorsAsExceptions; + }); + + test('logging an Error', () => { + const error = new Error('Some error happened'); + const {message, name} = error; + + console.error(error); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = 'Error: ' + message; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.name).toBe(name); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = new Error('Some error happened');", + ); + expect(exceptionData.isFatal).toBe(false); + expect(mockError.mock.calls[0]).toHaveLength(1); + expect(mockError.mock.calls[0][0]).toBe(formattedMessage); + }); + + test('logging a string', () => { + const message = 'Some error happened'; + + console.error(message); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(exceptionData.message).toBe( + 'console.error: "Some error happened"', + ); + expect(exceptionData.originalMessage).toBe('"Some error happened"'); + expect(exceptionData.name).toBe('console.error'); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + 'console.error(message);', + ); + expect(exceptionData.isFatal).toBe(false); + expect(mockError.mock.calls[0]).toEqual([message]); + }); + + test('logging arbitrary arguments', () => { + const args = [42, true, Symbol(), {x: undefined, y: null}]; + + console.error(...args); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(exceptionData.message).toBe( + 'console.error: 42, true, ["symbol" failed to stringify], {"y":null}', + ); + expect(exceptionData.originalMessage).toBe( + '42, true, ["symbol" failed to stringify], {"y":null}', + ); + expect(exceptionData.name).toBe('console.error'); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + 'console.error(...args);', + ); + expect(exceptionData.isFatal).toBe(false); + + expect(mockError).toHaveBeenCalledTimes(1); + // Shallowly compare the mock call arguments with `args` + expect(mockError.mock.calls[0]).toHaveLength(args.length); + for (let i = 0; i < args.length; ++i) { + expect(mockError.mock.calls[0][i]).toBe(args[i]); + } + }); + + test('logging a warning', () => { + const message = 'Warning: Some mild issue happened'; + + console.error(message); + + expect(nativeReportException).not.toHaveBeenCalled(); + expect(mockError.mock.calls[0]).toEqual([message]); + }); + + test('logging a warning with more arguments', () => { + const args = ['Warning: Some mild issue happened', 42]; + + console.error(...args); + + expect(nativeReportException).not.toHaveBeenCalled(); + expect(mockError.mock.calls[0]).toEqual(args); + }); + + test('reportErrorsAsExceptions = false', () => { + console.reportErrorsAsExceptions = false; + const message = 'Some error happened'; + + console.error(message); + + expect(nativeReportException).not.toHaveBeenCalled(); + expect(mockError.mock.calls[0]).toEqual([message]); + }); + + test('pops frames off the stack with framesToPop', () => { + function createError() { + const error = new Error('Some error happened'); + error.framesToPop = 1; + return error; + } + const error = createError(); + + console.error(error); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + 'const error = createError();', + ); + }); + }); + + describe('handleException', () => { + test('handling a fatal Error', () => { + const error = new Error('Some error happened'); + const {message} = error; + + ExceptionsManager.handleException(error, true); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = 'Error: ' + message; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.name).toBe('Error'); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = new Error('Some error happened');", + ); + expect(exceptionData.isFatal).toBe(true); + expect(console.error.mock.calls[0]).toHaveLength(1); + expect(console.error.mock.calls[0][0]).toBe(formattedMessage); + }); + + test('handling a non-fatal Error', () => { + const error = new Error('Some error happened'); + const {message} = error; + + ExceptionsManager.handleException(error, false); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + const formattedMessage = 'Error: ' + message; + expect(exceptionData.message).toBe(formattedMessage); + expect(exceptionData.originalMessage).toBe(message); + expect(exceptionData.name).toBe('Error'); + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + "const error = new Error('Some error happened');", + ); + expect(exceptionData.isFatal).toBe(false); + expect(console.error.mock.calls[0]).toHaveLength(1); + expect(console.error.mock.calls[0][0]).toBe(formattedMessage); + }); + + test('handling a thrown string', () => { + const message = 'Some error happened'; + + ExceptionsManager.handleException(message, true); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(exceptionData.message).toBe(message); + expect(exceptionData.originalMessage).toBe(null); + expect(exceptionData.name).toBe(null); + expect(exceptionData.stack[0].file).toMatch(/ExceptionsManager\.js$/); + expect(exceptionData.isFatal).toBe(true); + expect(console.error.mock.calls[0]).toEqual([message]); + }); + + test('pops frames off the stack with framesToPop', () => { + function createError() { + const error = new Error('Some error happened'); + error.framesToPop = 1; + return error; + } + const error = createError(); + + ExceptionsManager.handleException(error, true); + + expect(nativeReportException.mock.calls.length).toBe(1); + const exceptionData = nativeReportException.mock.calls[0][0]; + expect(getLineFromFrame(exceptionData.stack[0])).toBe( + 'const error = createError();', + ); + }); + }); +}); + +const linesByFile = new Map(); + +function getLineFromFrame({lineNumber /* 1-based */, file}) { + if (file == null) { + return null; + } + const cleanedFile = cleanFileName(file); + const lines = + linesByFile.get(cleanedFile) || + fs.readFileSync(cleanedFile, 'utf8').split('\n'); + if (!linesByFile.has(cleanedFile)) { + linesByFile.set(cleanedFile, lines); + } + return (lines[lineNumber - 1] || '').trim(); +} + +// Works around a parseErrorStack bug involving `new X` stack frames. +function cleanFileName(file) { + return file.replace(/^.+? \((?=\/)/, ''); +} diff --git a/Libraries/Core/__tests__/MapAndSetPolyfills-test.js b/Libraries/Core/__tests__/MapAndSetPolyfills-test.js deleted file mode 100644 index 20f54a0e68d9d5..00000000000000 --- a/Libraries/Core/__tests__/MapAndSetPolyfills-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * 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. - * - * @format - * @emails oncall+react_native - */ -'use strict'; - -// Save these methods so that we can restore them afterward. -const {freeze, seal, preventExtensions} = Object; - -function setup() { - jest.setMock('../../vendor/core/_shouldPolyfillES6Collection', () => true); -} - -function cleanup() { - Object.assign(Object, {freeze, seal, preventExtensions}); -} - -describe('Map polyfill', () => { - setup(); - - const Map = require('../../vendor/core/Map'); - - it('is not native', () => { - const getCode = Function.prototype.toString.call(Map.prototype.get); - expect(getCode).not.toContain('[native code]'); - expect(getCode).toContain('getIndex'); - }); - - it('should tolerate non-extensible object keys', () => { - const map = new Map(); - const key = Object.create(null); - Object.freeze(key); - map.set(key, key); - expect(map.size).toBe(1); - expect(map.has(key)).toBe(true); - map.delete(key); - expect(map.size).toBe(0); - expect(map.has(key)).toBe(false); - }); - - it('should not get confused by prototypal inheritance', () => { - const map = new Map(); - const proto = Object.create(null); - const base = Object.create(proto); - map.set(proto, proto); - expect(map.size).toBe(1); - expect(map.has(proto)).toBe(true); - expect(map.has(base)).toBe(false); - map.set(base, base); - expect(map.size).toBe(2); - expect(map.get(proto)).toBe(proto); - expect(map.get(base)).toBe(base); - }); - - afterAll(cleanup); -}); - -describe('Set polyfill', () => { - setup(); - - const Set = require('../../vendor/core/Set'); - - it('is not native', () => { - const addCode = Function.prototype.toString.call(Set.prototype.add); - expect(addCode).not.toContain('[native code]'); - }); - - it('should tolerate non-extensible object elements', () => { - const set = new Set(); - const elem = Object.create(null); - Object.freeze(elem); - set.add(elem); - expect(set.size).toBe(1); - expect(set.has(elem)).toBe(true); - set.add(elem); - expect(set.size).toBe(1); - set.delete(elem); - expect(set.size).toBe(0); - expect(set.has(elem)).toBe(false); - }); - - it('should not get confused by prototypal inheritance', () => { - const set = new Set(); - const proto = Object.create(null); - const base = Object.create(proto); - set.add(proto); - expect(set.size).toBe(1); - expect(set.has(proto)).toBe(true); - expect(set.has(base)).toBe(false); - set.add(base); - expect(set.size).toBe(2); - expect(set.has(proto)).toBe(true); - expect(set.has(base)).toBe(true); - }); - - afterAll(cleanup); -}); diff --git a/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js b/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js index 471a6f00308c3a..70c8abd88e2f24 100644 --- a/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js +++ b/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js @@ -127,9 +127,14 @@ function _mockNativeVersion( patch = 0, prerelease = null, ) { - jest.doMock('../../BatchedBridge/NativeModules', () => ({ - PlatformConstants: { + jest.doMock('../../Utilities/NativePlatformConstantsAndroid', () => ({ + getConstants: () => ({ reactNativeVersion: {major, minor, patch, prerelease}, - }, + }), + })); + jest.doMock('../../Utilities/NativePlatformConstantsIOS', () => ({ + getConstants: () => ({ + reactNativeVersion: {major, minor, patch, prerelease}, + }), })); } diff --git a/Libraries/Core/polyfillES6Collections.js b/Libraries/Core/polyfillES6Collections.js deleted file mode 100644 index b58718540fedca..00000000000000 --- a/Libraries/Core/polyfillES6Collections.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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. - * - * @flow strict-local - * @format - */ -'use strict'; - -const {polyfillGlobal} = require('../Utilities/PolyfillFunctions'); - -/** - * Polyfill ES6 collections (Map and Set). - * If you don't need these polyfills, don't use InitializeCore; just directly - * require the modules you need from InitializeCore for setup. - */ -const _shouldPolyfillCollection = require('../vendor/core/_shouldPolyfillES6Collection'); -if (_shouldPolyfillCollection('Map')) { - // $FlowFixMe: even in strict-local mode Flow expects Map to be Flow-typed - polyfillGlobal('Map', () => require('../vendor/core/Map')); -} -if (_shouldPolyfillCollection('Set')) { - // $FlowFixMe: even in strict-local mode Flow expects Set to be Flow-typed - polyfillGlobal('Set', () => require('../vendor/core/Set')); -} diff --git a/Libraries/Core/setUpBatchedBridge.js b/Libraries/Core/setUpBatchedBridge.js index 680c1398e45b84..7541adb7c9b572 100644 --- a/Libraries/Core/setUpBatchedBridge.js +++ b/Libraries/Core/setUpBatchedBridge.js @@ -10,42 +10,53 @@ 'use strict'; /** - * Set up the BatchedBridge. This must be done after the other steps in - * InitializeCore to ensure that the JS environment has been initialized. - * You can use this module directly, or just require InitializeCore. + * We don't set up the batched bridge in bridgeless mode. Once we've migrated + * everything over to bridgeless we can just delete this file. */ -const BatchedBridge = require('../BatchedBridge/BatchedBridge'); -BatchedBridge.registerLazyCallableModule('Systrace', () => - require('../Performance/Systrace'), -); -BatchedBridge.registerLazyCallableModule('JSTimers', () => - require('./Timers/JSTimers'), -); -BatchedBridge.registerLazyCallableModule('HeapCapture', () => - require('../Utilities/HeapCapture'), -); -BatchedBridge.registerLazyCallableModule('SamplingProfiler', () => - require('../Performance/SamplingProfiler'), -); -BatchedBridge.registerLazyCallableModule('RCTLog', () => - require('../Utilities/RCTLog'), -); -BatchedBridge.registerLazyCallableModule('RCTDeviceEventEmitter', () => - require('../EventEmitter/RCTDeviceEventEmitter'), -); -BatchedBridge.registerLazyCallableModule('RCTNativeAppEventEmitter', () => - require('../EventEmitter/RCTNativeAppEventEmitter'), -); -BatchedBridge.registerLazyCallableModule('GlobalPerformanceLogger', () => - require('../Utilities/GlobalPerformanceLogger'), -); -BatchedBridge.registerLazyCallableModule('JSDevSupportModule', () => - require('../Utilities/JSDevSupportModule'), -); - -if (__DEV__ && !global.__RCTProfileIsProfiling) { - BatchedBridge.registerCallableModule( - 'HMRClient', - require('../Utilities/HMRClient'), +if (!global.RN$Bridgeless) { + /** + * Set up the BatchedBridge. This must be done after the other steps in + * InitializeCore to ensure that the JS environment has been initialized. + * You can use this module directly, or just require InitializeCore. + */ + const BatchedBridge = require('../BatchedBridge/BatchedBridge'); + BatchedBridge.registerLazyCallableModule('Systrace', () => + require('../Performance/Systrace'), + ); + BatchedBridge.registerLazyCallableModule('JSTimers', () => + require('./Timers/JSTimers'), + ); + BatchedBridge.registerLazyCallableModule('HeapCapture', () => + require('../HeapCapture/HeapCapture'), + ); + BatchedBridge.registerLazyCallableModule('SamplingProfiler', () => + require('../Performance/SamplingProfiler'), + ); + BatchedBridge.registerLazyCallableModule('RCTLog', () => + require('../Utilities/RCTLog'), ); + BatchedBridge.registerLazyCallableModule('RCTDeviceEventEmitter', () => + require('../EventEmitter/RCTDeviceEventEmitter'), + ); + BatchedBridge.registerLazyCallableModule('RCTNativeAppEventEmitter', () => + require('../EventEmitter/RCTNativeAppEventEmitter'), + ); + BatchedBridge.registerLazyCallableModule('GlobalPerformanceLogger', () => + require('../Utilities/GlobalPerformanceLogger'), + ); + BatchedBridge.registerLazyCallableModule('JSDevSupportModule', () => + require('../Utilities/JSDevSupportModule'), + ); + + if (__DEV__ && !global.__RCTProfileIsProfiling) { + BatchedBridge.registerCallableModule( + 'HMRClient', + require('../Utilities/HMRClient'), + ); + } else { + BatchedBridge.registerCallableModule( + 'HMRClient', + require('../Utilities/HMRClientProdShim'), + ); + } } diff --git a/Libraries/Core/setUpDeveloperTools.js b/Libraries/Core/setUpDeveloperTools.js index e18b5be9740199..6d3bc326fd15eb 100644 --- a/Libraries/Core/setUpDeveloperTools.js +++ b/Libraries/Core/setUpDeveloperTools.js @@ -9,20 +9,105 @@ */ 'use strict'; +import Platform from '../Utilities/Platform'; + +declare var console: typeof console & { + _isPolyfilled: boolean, +}; + /** * Sets up developer tools for React Native. * You can use this module directly, or just require InitializeCore. */ if (__DEV__) { - if (!global.__RCTProfileIsProfiling) { - // not when debugging in chrome - // TODO(t12832058) This check is broken - if (!window.document) { - require('./Devtools/setupDevtools'); + // TODO (T45803484) Enable devtools for bridgeless RN + if (!global.RN$Bridgeless) { + if (!global.__RCTProfileIsProfiling) { + // not when debugging in chrome + // TODO(t12832058) This check is broken + if (!window.document) { + const AppState = require('../AppState/AppState'); + // $FlowFixMe Module is untyped + const reactDevTools = require('react-devtools-core'); + const getDevServer = require('./Devtools/getDevServer'); + + // Don't steal the DevTools from currently active app. + // Note: if you add any AppState subscriptions to this file, + // you will also need to guard against `AppState.isAvailable`, + // or the code will throw for bundles that don't have it. + const isAppActive = () => AppState.currentState !== 'background'; + + // Get hostname from development server (packager) + const devServer = getDevServer(); + const host = devServer.bundleLoadedFromServer + ? devServer.url.replace(/https?:\/\//, '').split(':')[0] + : 'localhost'; + + reactDevTools.connectToDevTools({ + isAppActive, + host, + // Read the optional global variable for backward compatibility. + // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0. + port: window.__REACT_DEVTOOLS_PORT__, + resolveRNStyle: require('../StyleSheet/flattenStyle'), + }); + } + + // Set up inspector + const JSInspector = require('../JSInspector/JSInspector'); + JSInspector.registerAgent(require('../JSInspector/NetworkAgent')); + } + + // Note we can't check if console is "native" because it would appear "native" in JSC and Hermes. + // We also can't check any properties that don't exist in the Chrome worker environment. + // So we check a navigator property that's set to a particular value ("Netscape") in all real browsers. + const isLikelyARealBrowser = + global.navigator != null && + /* _ + * | | + * _ __ ___| |_ ___ ___ __ _ _ __ ___ + * | '_ \ / _ \ __/ __|/ __/ _` | '_ \ / _ \ + * | | | | __/ |_\__ \ (_| (_| | |_) | __/ + * |_| |_|\___|\__|___/\___\__,_| .__/ \___| + * | | + * |_| + */ + global.navigator.appName === 'Netscape'; // Any real browser + + if (!Platform.isTesting) { + const HMRClient = require('../Utilities/HMRClient'); + + if (console._isPolyfilled) { + // We assume full control over the console and send JavaScript logs to Metro. + [ + 'trace', + 'info', + 'warn', + 'log', + 'group', + 'groupCollapsed', + 'groupEnd', + 'debug', + ].forEach(level => { + const originalFunction = console[level]; + // $FlowFixMe Overwrite console methods + console[level] = function(...args) { + HMRClient.log(level, args); + originalFunction.apply(console, args); + }; + }); + } else { + // We assume the environment has a real rich console (like Chrome), and don't hijack it to log to Metro. + // It's likely the developer is using rich console to debug anyway, and hijacking it would + // lose the filenames in console.log calls: https://github.com/facebook/react-native/issues/26788. + HMRClient.log('log', [ + `JavaScript logs will appear in your ${ + isLikelyARealBrowser ? 'browser' : 'environment' + } console`, + ]); + } } - // Set up inspector - const JSInspector = require('../JSInspector/JSInspector'); - JSInspector.registerAgent(require('../JSInspector/NetworkAgent')); + require('./setUpReactRefresh'); } } diff --git a/Libraries/Core/setUpReactRefresh.js b/Libraries/Core/setUpReactRefresh.js new file mode 100644 index 00000000000000..062171a9b0dc3f --- /dev/null +++ b/Libraries/Core/setUpReactRefresh.js @@ -0,0 +1,48 @@ +/** + * 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. + * + * @flow + * @format + */ +'use strict'; + +if (__DEV__) { + const NativeDevSettings = require('../NativeModules/specs/NativeDevSettings') + .default; + + if (typeof NativeDevSettings.reload !== 'function') { + throw new Error('Could not find the reload() implementation.'); + } + + // This needs to run before the renderer initializes. + const ReactRefreshRuntime = require('react-refresh/runtime'); + ReactRefreshRuntime.injectIntoGlobalHook(global); + + const Refresh = { + performFullRefresh() { + NativeDevSettings.reload(); + }, + + createSignatureFunctionForTransform: + ReactRefreshRuntime.createSignatureFunctionForTransform, + + isLikelyComponentType: ReactRefreshRuntime.isLikelyComponentType, + + getFamilyByType: ReactRefreshRuntime.getFamilyByType, + + register: ReactRefreshRuntime.register, + + performReactRefresh() { + if (ReactRefreshRuntime.hasUnrecoverableErrors()) { + NativeDevSettings.reload(); + return; + } + ReactRefreshRuntime.performReactRefresh(); + }, + }; + + (require: any).Refresh = Refresh; +} diff --git a/Libraries/Core/setUpSegmentFetcher.js b/Libraries/Core/setUpSegmentFetcher.js index dd182a69c91bb7..3d811535ce38ee 100644 --- a/Libraries/Core/setUpSegmentFetcher.js +++ b/Libraries/Core/setUpSegmentFetcher.js @@ -9,13 +9,20 @@ */ 'use strict'; +export type FetchSegmentFunction = typeof __fetchSegment; +export type GetSegmentFunction = typeof __getSegment; + /** * Set up SegmentFetcher. * You can use this module directly, or just require InitializeCore. */ -global.__fetchSegment = function( + +function __fetchSegment( segmentId: number, - options: {|+otaBuildNumber: ?string|}, + options: {| + +otaBuildNumber: ?string, + +requestedModuleName?: ?string, + |}, callback: (?Error) => void, ) { const SegmentFetcher = require('./SegmentFetcher/NativeSegmentFetcher') @@ -33,4 +40,38 @@ global.__fetchSegment = function( callback(null); }, ); -}; +} + +global.__fetchSegment = __fetchSegment; + +function __getSegment( + segmentId: number, + options: {| + +otaBuildNumber: ?string, + +requestedModuleName?: ?string, + |}, + callback: (?Error, ?string) => void, +) { + const SegmentFetcher = require('./SegmentFetcher/NativeSegmentFetcher') + .default; + + if (!SegmentFetcher.getSegment) { + throw new Error('SegmentFetcher.getSegment must be defined'); + } + + SegmentFetcher.getSegment( + segmentId, + options, + (errorObject: ?{message: string, code: string}, path: ?string) => { + if (errorObject) { + const error = new Error(errorObject.message); + (error: any).code = errorObject.code; // flowlint-line unclear-type: off + callback(error); + } + + callback(null, path); + }, + ); +} + +global.__getSegment = __getSegment; diff --git a/Libraries/Core/setUpTimers.js b/Libraries/Core/setUpTimers.js index 8a9b22ecd87efb..536fb1674a46df 100644 --- a/Libraries/Core/setUpTimers.js +++ b/Libraries/Core/setUpTimers.js @@ -9,22 +9,25 @@ */ 'use strict'; -const {polyfillGlobal} = require('../Utilities/PolyfillFunctions'); +// In bridgeless mode, timers are host functions installed from cpp. +if (!global.RN$Bridgeless) { + const {polyfillGlobal} = require('../Utilities/PolyfillFunctions'); -/** - * Set up timers. - * You can use this module directly, or just require InitializeCore. - */ -const defineLazyTimer = name => { - polyfillGlobal(name, () => require('./Timers/JSTimers')[name]); -}; -defineLazyTimer('setTimeout'); -defineLazyTimer('setInterval'); -defineLazyTimer('setImmediate'); -defineLazyTimer('clearTimeout'); -defineLazyTimer('clearInterval'); -defineLazyTimer('clearImmediate'); -defineLazyTimer('requestAnimationFrame'); -defineLazyTimer('cancelAnimationFrame'); -defineLazyTimer('requestIdleCallback'); -defineLazyTimer('cancelIdleCallback'); + /** + * Set up timers. + * You can use this module directly, or just require InitializeCore. + */ + const defineLazyTimer = name => { + polyfillGlobal(name, () => require('./Timers/JSTimers')[name]); + }; + defineLazyTimer('setTimeout'); + defineLazyTimer('setInterval'); + defineLazyTimer('setImmediate'); + defineLazyTimer('clearTimeout'); + defineLazyTimer('clearInterval'); + defineLazyTimer('clearImmediate'); + defineLazyTimer('requestAnimationFrame'); + defineLazyTimer('cancelAnimationFrame'); + defineLazyTimer('requestIdleCallback'); + defineLazyTimer('cancelIdleCallback'); +} diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js index 67a016fffc8d24..f4648be20b10a3 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js @@ -12,7 +12,12 @@ const PropTypes = require('prop-types'); -const DeprecatedEdgeInsetsPropType = PropTypes.shape({ +const DeprecatedEdgeInsetsPropType: React$PropType$Primitive<{ + bottom?: number, + left?: number, + right?: number, + top?: number, +}> = PropTypes.shape({ top: PropTypes.number, left: PropTypes.number, bottom: PropTypes.number, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js index 49e5f1de6ed415..b2d41020de77f8 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js @@ -17,9 +17,11 @@ const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); const PropTypes = require('prop-types'); module.exports = { - style: DeprecatedStyleSheetPropType(DeprecatedImageStylePropTypes), + style: (DeprecatedStyleSheetPropType( + DeprecatedImageStylePropTypes, + ): ReactPropsCheckType), source: DeprecatedImageSourcePropType, - defaultSource: PropTypes.oneOfType([ + defaultSource: (PropTypes.oneOfType([ PropTypes.shape({ uri: PropTypes.string, width: PropTypes.number, @@ -27,7 +29,9 @@ module.exports = { scale: PropTypes.number, }), PropTypes.number, - ]), + ]): React$PropType$Primitive< + {height?: number, scale?: number, uri?: string, width?: number} | number, + >), accessible: PropTypes.bool, @@ -37,15 +41,21 @@ module.exports = { capInsets: DeprecatedEdgeInsetsPropType, - resizeMethod: PropTypes.oneOf(['auto', 'resize', 'scale']), + resizeMethod: (PropTypes.oneOf([ + 'auto', + 'resize', + 'scale', + ]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>), - resizeMode: PropTypes.oneOf([ + resizeMode: (PropTypes.oneOf([ 'cover', 'contain', 'stretch', 'repeat', 'center', - ]), + ]): React$PropType$Primitive< + 'cover' | 'contain' | 'stretch' | 'repeat' | 'center', + >), testID: PropTypes.string, diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js index eab9d6e49c892b..351542d9bfc7b8 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js @@ -11,27 +11,35 @@ const DeprecatedColorPropType = require('./DeprecatedColorPropType'); const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const ReactPropTypes = require('prop-types'); const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); +const ReactPropTypes = require('prop-types'); const ImageStylePropTypes = { ...DeprecatedLayoutPropTypes, ...DeprecatedShadowPropTypesIOS, ...DeprecatedTransformPropTypes, - resizeMode: ReactPropTypes.oneOf([ + resizeMode: (ReactPropTypes.oneOf([ 'center', 'contain', 'cover', 'repeat', 'stretch', - ]), - backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']), + ]): React$PropType$Primitive< + 'center' | 'contain' | 'cover' | 'repeat' | 'stretch', + >), + backfaceVisibility: (ReactPropTypes.oneOf([ + 'visible', + 'hidden', + ]): React$PropType$Primitive<'visible' | 'hidden'>), backgroundColor: DeprecatedColorPropType, borderColor: DeprecatedColorPropType, borderWidth: ReactPropTypes.number, borderRadius: ReactPropTypes.number, - overflow: ReactPropTypes.oneOf(['visible', 'hidden']), + overflow: (ReactPropTypes.oneOf([ + 'visible', + 'hidden', + ]): React$PropType$Primitive<'visible' | 'hidden'>), /** * Changes the color of all the non-transparent pixels to the tintColor. diff --git a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js index 0ebccaa8d07083..4d4488a9171f1a 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js @@ -13,121 +13,129 @@ const ReactPropTypes = require('prop-types'); const LayoutPropTypes = { - display: ReactPropTypes.oneOf(['none', 'flex']), - width: ReactPropTypes.oneOfType([ + display: (ReactPropTypes.oneOf(['none', 'flex']): React$PropType$Primitive< + 'none' | 'flex', + >), + width: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - height: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + height: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - start: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + start: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - end: ReactPropTypes.oneOfType([ReactPropTypes.number, ReactPropTypes.string]), - top: ReactPropTypes.oneOfType([ReactPropTypes.number, ReactPropTypes.string]), - left: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + end: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - right: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + top: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - bottom: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + left: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - minWidth: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + right: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - maxWidth: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + bottom: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - minHeight: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + minWidth: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - maxHeight: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + maxWidth: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - margin: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + minHeight: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginVertical: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + maxHeight: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginHorizontal: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + margin: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginTop: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginVertical: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginBottom: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginHorizontal: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginLeft: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginTop: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginRight: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginBottom: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginStart: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginLeft: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - marginEnd: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginRight: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - padding: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginStart: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingVertical: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + marginEnd: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingHorizontal: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + padding: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingTop: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingVertical: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingBottom: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingHorizontal: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingLeft: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingTop: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingRight: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingBottom: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingStart: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingLeft: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), - paddingEnd: ReactPropTypes.oneOfType([ + ]): React$PropType$Primitive), + paddingRight: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), + ]): React$PropType$Primitive), + paddingStart: (ReactPropTypes.oneOfType([ + ReactPropTypes.number, + ReactPropTypes.string, + ]): React$PropType$Primitive), + paddingEnd: (ReactPropTypes.oneOfType([ + ReactPropTypes.number, + ReactPropTypes.string, + ]): React$PropType$Primitive), borderWidth: ReactPropTypes.number, borderTopWidth: ReactPropTypes.number, borderStartWidth: ReactPropTypes.number, @@ -135,56 +143,91 @@ const LayoutPropTypes = { borderRightWidth: ReactPropTypes.number, borderBottomWidth: ReactPropTypes.number, borderLeftWidth: ReactPropTypes.number, - position: ReactPropTypes.oneOf(['absolute', 'relative']), - flexDirection: ReactPropTypes.oneOf([ + position: (ReactPropTypes.oneOf([ + 'absolute', + 'relative', + ]): React$PropType$Primitive<'absolute' | 'relative'>), + flexDirection: (ReactPropTypes.oneOf([ 'row', 'row-reverse', 'column', 'column-reverse', - ]), - flexWrap: ReactPropTypes.oneOf(['wrap', 'nowrap', 'wrap-reverse']), - justifyContent: ReactPropTypes.oneOf([ + ]): React$PropType$Primitive< + 'row' | 'row-reverse' | 'column' | 'column-reverse', + >), + flexWrap: (ReactPropTypes.oneOf([ + 'wrap', + 'nowrap', + 'wrap-reverse', + ]): React$PropType$Primitive<'wrap' | 'nowrap' | 'wrap-reverse'>), + justifyContent: (ReactPropTypes.oneOf([ 'flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', - ]), - alignItems: ReactPropTypes.oneOf([ + ]): React$PropType$Primitive< + | 'flex-start' + | 'flex-end' + | 'center' + | 'space-between' + | 'space-around' + | 'space-evenly', + >), + alignItems: (ReactPropTypes.oneOf([ 'flex-start', 'flex-end', 'center', 'stretch', 'baseline', - ]), - alignSelf: ReactPropTypes.oneOf([ + ]): React$PropType$Primitive< + 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', + >), + alignSelf: (ReactPropTypes.oneOf([ 'auto', 'flex-start', 'flex-end', 'center', 'stretch', 'baseline', - ]), - alignContent: ReactPropTypes.oneOf([ + ]): React$PropType$Primitive< + 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', + >), + alignContent: (ReactPropTypes.oneOf([ 'flex-start', 'flex-end', 'center', 'stretch', 'space-between', 'space-around', - ]), - overflow: ReactPropTypes.oneOf(['visible', 'hidden', 'scroll']), + ]): React$PropType$Primitive< + | 'flex-start' + | 'flex-end' + | 'center' + | 'stretch' + | 'space-between' + | 'space-around', + >), + overflow: (ReactPropTypes.oneOf([ + 'visible', + 'hidden', + 'scroll', + ]): React$PropType$Primitive<'visible' | 'hidden' | 'scroll'>), flex: ReactPropTypes.number, flexGrow: ReactPropTypes.number, flexShrink: ReactPropTypes.number, - flexBasis: ReactPropTypes.oneOfType([ + flexBasis: (ReactPropTypes.oneOfType([ ReactPropTypes.number, ReactPropTypes.string, - ]), + ]): React$PropType$Primitive), aspectRatio: ReactPropTypes.number, zIndex: ReactPropTypes.number, - direction: ReactPropTypes.oneOf(['inherit', 'ltr', 'rtl']), + direction: (ReactPropTypes.oneOf([ + 'inherit', + 'ltr', + 'rtl', + ]): React$PropType$Primitive<'inherit' | 'ltr' | 'rtl'>), }; module.exports = LayoutPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js index 9ae8c8f9872d5c..1d13e7ed74a5b9 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js @@ -12,7 +12,10 @@ const PropTypes = require('prop-types'); -const PointPropType = PropTypes.shape({ +const PointPropType: React$PropType$Primitive<{ + x?: number, + y?: number, +}> = PropTypes.shape({ x: PropTypes.number, y: PropTypes.number, }); diff --git a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js index f2d73c9578f935..3d0fe41604733e 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js @@ -14,10 +14,10 @@ const ReactPropTypes = require('prop-types'); const DeprecatedShadowPropTypesIOS = { shadowColor: DeprecatedColorPropType, - shadowOffset: ReactPropTypes.shape({ + shadowOffset: (ReactPropTypes.shape({ width: ReactPropTypes.number, height: ReactPropTypes.number, - }), + }): React$PropType$Primitive<{height?: number, width?: number}>), shadowOpacity: ReactPropTypes.number, shadowRadius: ReactPropTypes.number, }; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js new file mode 100644 index 00000000000000..5748999e57fe3b --- /dev/null +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js @@ -0,0 +1,535 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +const PropTypes = require('prop-types'); +const DeprecatedColorPropType = require('./DeprecatedColorPropType'); +const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes'); +const DocumentSelectionState = require('../vendor/document/selection/DocumentSelectionState'); +const Text = require('../Text/Text'); + +const DataDetectorTypes = [ + 'phoneNumber', + 'link', + 'address', + 'calendarEvent', + 'none', + 'all', +]; + +module.exports = { + ...DeprecatedViewPropTypes, + /** + * Can tell `TextInput` to automatically capitalize certain characters. + * + * - `characters`: all characters. + * - `words`: first letter of each word. + * - `sentences`: first letter of each sentence (*default*). + * - `none`: don't auto capitalize anything. + */ + autoCapitalize: PropTypes.oneOf(['none', 'sentences', 'words', 'characters']), + /** + * Determines which content to suggest on auto complete, e.g.`username`. + * To disable auto complete, use `off`. + * + * *Android Only* + * + * The following values work on Android only: + * + * - `username` + * - `password` + * - `email` + * - `name` + * - `tel` + * - `street-address` + * - `postal-code` + * - `cc-number` + * - `cc-csc` + * - `cc-exp` + * - `cc-exp-month` + * - `cc-exp-year` + * - `off` + * + * @platform android + */ + autoCompleteType: PropTypes.oneOf([ + 'cc-csc', + 'cc-exp', + 'cc-exp-month', + 'cc-exp-year', + 'cc-number', + 'email', + 'name', + 'password', + 'postal-code', + 'street-address', + 'tel', + 'username', + 'off', + ]), + /** + * If `false`, disables auto-correct. The default value is `true`. + */ + autoCorrect: PropTypes.bool, + /** + * If `false`, disables spell-check style (i.e. red underlines). + * The default value is inherited from `autoCorrect`. + * @platform ios + */ + spellCheck: PropTypes.bool, + /** + * If `true`, focuses the input on `componentDidMount`. + * The default value is `false`. + */ + autoFocus: PropTypes.bool, + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. The + * default is `true`. + */ + allowFontScaling: PropTypes.bool, + /** + * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. + * Possible values: + * `null/undefined` (default): inherit from the parent node or the global default (0) + * `0`: no max, ignore parent/global default + * `>= 1`: sets the maxFontSizeMultiplier of this node to this value + */ + maxFontSizeMultiplier: PropTypes.number, + /** + * If `false`, text is not editable. The default value is `true`. + */ + editable: PropTypes.bool, + /** + * Determines which keyboard to open, e.g.`numeric`. + * + * The following values work across platforms: + * + * - `default` + * - `numeric` + * - `number-pad` + * - `decimal-pad` + * - `email-address` + * - `phone-pad` + * + * *iOS Only* + * + * The following values work on iOS only: + * + * - `ascii-capable` + * - `numbers-and-punctuation` + * - `url` + * - `name-phone-pad` + * - `twitter` + * - `web-search` + * + * *Android Only* + * + * The following values work on Android only: + * + * - `visible-password` + */ + keyboardType: PropTypes.oneOf([ + // Cross-platform + 'default', + 'email-address', + 'numeric', + 'phone-pad', + 'number-pad', + // iOS-only + 'ascii-capable', + 'numbers-and-punctuation', + 'url', + 'name-phone-pad', + 'decimal-pad', + 'twitter', + 'web-search', + // Android-only + 'visible-password', + ]), + /** + * Determines the color of the keyboard. + * @platform ios + */ + keyboardAppearance: PropTypes.oneOf(['default', 'light', 'dark']), + /** + * Determines how the return key should look. On Android you can also use + * `returnKeyLabel`. + * + * *Cross platform* + * + * The following values work across platforms: + * + * - `done` + * - `go` + * - `next` + * - `search` + * - `send` + * + * *Android Only* + * + * The following values work on Android only: + * + * - `none` + * - `previous` + * + * *iOS Only* + * + * The following values work on iOS only: + * + * - `default` + * - `emergency-call` + * - `google` + * - `join` + * - `route` + * - `yahoo` + */ + returnKeyType: PropTypes.oneOf([ + // Cross-platform + 'done', + 'go', + 'next', + 'search', + 'send', + // Android-only + 'none', + 'previous', + // iOS-only + 'default', + 'emergency-call', + 'google', + 'join', + 'route', + 'yahoo', + ]), + /** + * Sets the return key to the label. Use it instead of `returnKeyType`. + * @platform android + */ + returnKeyLabel: PropTypes.string, + /** + * Limits the maximum number of characters that can be entered. Use this + * instead of implementing the logic in JS to avoid flicker. + */ + maxLength: PropTypes.number, + /** + * Sets the number of lines for a `TextInput`. Use it with multiline set to + * `true` to be able to fill the lines. + * @platform android + */ + numberOfLines: PropTypes.number, + /** + * When `false`, if there is a small amount of space available around a text input + * (e.g. landscape orientation on a phone), the OS may choose to have the user edit + * the text inside of a full screen text input mode. When `true`, this feature is + * disabled and users will always edit the text directly inside of the text input. + * Defaults to `false`. + * @platform android + */ + disableFullscreenUI: PropTypes.bool, + /** + * If `true`, the keyboard disables the return key when there is no text and + * automatically enables it when there is text. The default value is `false`. + * @platform ios + */ + enablesReturnKeyAutomatically: PropTypes.bool, + /** + * If `true`, the text input can be multiple lines. + * The default value is `false`. + */ + multiline: PropTypes.bool, + /** + * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` + * The default value is `simple`. + * @platform android + */ + textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), + /** + * Callback that is called when the text input is blurred. + */ + onBlur: PropTypes.func, + /** + * Callback that is called when the text input is focused. + */ + onFocus: PropTypes.func, + /** + * Callback that is called when the text input's text changes. + */ + onChange: PropTypes.func, + /** + * Callback that is called when the text input's text changes. + * Changed text is passed as an argument to the callback handler. + */ + onChangeText: PropTypes.func, + /** + * Callback that is called when the text input's content size changes. + * This will be called with + * `{ nativeEvent: { contentSize: { width, height } } }`. + * + * Only called for multiline text inputs. + */ + onContentSizeChange: PropTypes.func, + onTextInput: PropTypes.func, + /** + * Callback that is called when text input ends. + */ + onEndEditing: PropTypes.func, + /** + * Callback that is called when the text input selection is changed. + * This will be called with + * `{ nativeEvent: { selection: { start, end } } }`. + */ + onSelectionChange: PropTypes.func, + /** + * Callback that is called when the text input's submit button is pressed. + * Invalid if `multiline={true}` is specified. + */ + onSubmitEditing: PropTypes.func, + /** + * Callback that is called when a key is pressed. + * This will be called with `{ nativeEvent: { key: keyValue } }` + * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and + * the typed-in character otherwise including `' '` for space. + * Fires before `onChange` callbacks. + */ + onKeyPress: PropTypes.func, + /** + * Invoked on mount and layout changes with `{x, y, width, height}`. + */ + onLayout: PropTypes.func, + /** + * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. + * May also contain other properties from ScrollEvent but on Android contentSize + * is not provided for performance reasons. + */ + onScroll: PropTypes.func, + /** + * The string that will be rendered before text input has been entered. + */ + placeholder: PropTypes.string, + /** + * The text color of the placeholder string. + */ + placeholderTextColor: DeprecatedColorPropType, + /** + * If `false`, scrolling of the text view will be disabled. + * The default value is `true`. Does only work with 'multiline={true}'. + * @platform ios + */ + scrollEnabled: PropTypes.bool, + /** + * If `true`, the text input obscures the text entered so that sensitive text + * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. + */ + secureTextEntry: PropTypes.bool, + /** + * The highlight and cursor color of the text input. + */ + selectionColor: DeprecatedColorPropType, + /** + * An instance of `DocumentSelectionState`, this is some state that is responsible for + * maintaining selection information for a document. + * + * Some functionality that can be performed with this instance is: + * + * - `blur()` + * - `focus()` + * - `update()` + * + * > You can reference `DocumentSelectionState` in + * > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js) + * + * @platform ios + */ + selectionState: PropTypes.instanceOf(DocumentSelectionState), + /** + * The start and end of the text input's selection. Set start and end to + * the same value to position the cursor. + */ + selection: PropTypes.shape({ + start: PropTypes.number.isRequired, + end: PropTypes.number, + }), + /** + * The value to show for the text input. `TextInput` is a controlled + * component, which means the native value will be forced to match this + * value prop if provided. For most uses, this works great, but in some + * cases this may cause flickering - one common cause is preventing edits + * by keeping value the same. In addition to simply setting the same value, + * either set `editable={false}`, or set/update `maxLength` to prevent + * unwanted edits without flicker. + */ + value: PropTypes.string, + /** + * Provides an initial value that will change when the user starts typing. + * Useful for simple use-cases where you do not want to deal with listening + * to events and updating the value prop to keep the controlled state in sync. + */ + defaultValue: PropTypes.string, + /** + * When the clear button should appear on the right side of the text view. + * This property is supported only for single-line TextInput component. + * @platform ios + */ + clearButtonMode: PropTypes.oneOf([ + 'never', + 'while-editing', + 'unless-editing', + 'always', + ]), + /** + * If `true`, clears the text field automatically when editing begins. + * @platform ios + */ + clearTextOnFocus: PropTypes.bool, + /** + * If `true`, all text will automatically be selected on focus. + */ + selectTextOnFocus: PropTypes.bool, + /** + * If `true`, the text field will blur when submitted. + * The default value is true for single-line fields and false for + * multiline fields. Note that for multiline fields, setting `blurOnSubmit` + * to `true` means that pressing return will blur the field and trigger the + * `onSubmitEditing` event instead of inserting a newline into the field. + */ + blurOnSubmit: PropTypes.bool, + /** + * Note that not all Text styles are supported, an incomplete list of what is not supported includes: + * + * - `borderLeftWidth` + * - `borderTopWidth` + * - `borderRightWidth` + * - `borderBottomWidth` + * - `borderTopLeftRadius` + * - `borderTopRightRadius` + * - `borderBottomRightRadius` + * - `borderBottomLeftRadius` + * + * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) + * for more detail. + * + * [Styles](docs/style.html) + */ + style: Text.propTypes.style, + /** + * The color of the `TextInput` underline. + * @platform android + */ + underlineColorAndroid: DeprecatedColorPropType, + + /** + * If defined, the provided image resource will be rendered on the left. + * The image resource must be inside `/android/app/src/main/res/drawable` and referenced + * like + * ``` + * + * ``` + * @platform android + */ + inlineImageLeft: PropTypes.string, + + /** + * Padding between the inline image, if any, and the text input itself. + * @platform android + */ + inlineImagePadding: PropTypes.number, + + /** + * If `true`, allows TextInput to pass touch events to the parent component. + * This allows components such as SwipeableListView to be swipeable from the TextInput on iOS, + * as is the case on Android by default. + * If `false`, TextInput always asks to handle the input (except when disabled). + * @platform ios + */ + rejectResponderTermination: PropTypes.bool, + + /** + * Determines the types of data converted to clickable URLs in the text input. + * Only valid if `multiline={true}` and `editable={false}`. + * By default no data types are detected. + * + * You can provide one type or an array of many types. + * + * Possible values for `dataDetectorTypes` are: + * + * - `'phoneNumber'` + * - `'link'` + * - `'address'` + * - `'calendarEvent'` + * - `'none'` + * - `'all'` + * + * @platform ios + */ + dataDetectorTypes: PropTypes.oneOfType([ + PropTypes.oneOf(DataDetectorTypes), + PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), + ]), + /** + * If `true`, caret is hidden. The default value is `false`. + * This property is supported only for single-line TextInput component on iOS. + */ + caretHidden: PropTypes.bool, + /* + * If `true`, contextMenuHidden is hidden. The default value is `false`. + */ + contextMenuHidden: PropTypes.bool, + /** + * An optional identifier which links a custom InputAccessoryView to + * this text input. The InputAccessoryView is rendered above the + * keyboard when this text input is focused. + * @platform ios + */ + inputAccessoryViewID: PropTypes.string, + /** + * Give the keyboard and the system information about the + * expected semantic meaning for the content that users enter. + * @platform ios + */ + textContentType: PropTypes.oneOf([ + 'none', + 'URL', + 'addressCity', + 'addressCityAndState', + 'addressState', + 'countryName', + 'creditCardNumber', + 'emailAddress', + 'familyName', + 'fullStreetAddress', + 'givenName', + 'jobTitle', + 'location', + 'middleName', + 'name', + 'namePrefix', + 'nameSuffix', + 'nickname', + 'organizationName', + 'postalCode', + 'streetAddressLine1', + 'streetAddressLine2', + 'sublocality', + 'telephoneNumber', + 'username', + 'password', + 'newPassword', + 'oneTimeCode', + ]), + /** + * When `false`, it will prevent the soft keyboard from showing when the field is focused. + * Defaults to `true`. + * @platform android + */ + showSoftInputOnFocus: PropTypes.bool, +}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js index 06abb2fc3fd790..f053e8e283d6ce 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js @@ -14,28 +14,145 @@ const DeprecatedColorPropType = require('./DeprecatedColorPropType'); const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); const PropTypes = require('prop-types'); -const TextStylePropTypes = require('../Text/TextStylePropTypes'); +const DeprecatedTextStylePropTypes = require('./DeprecatedTextStylePropTypes'); -const stylePropType = DeprecatedStyleSheetPropType(TextStylePropTypes); +const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( + DeprecatedTextStylePropTypes, +); + +const DataDetectorTypes = ['phoneNumber', 'link', 'email', 'none', 'all']; module.exports = { - ellipsizeMode: PropTypes.oneOf(['head', 'middle', 'tail', 'clip']), + /** + * When `numberOfLines` is set, this prop defines how text will be + * truncated. + * + * See https://facebook.github.io/react-native/docs/text.html#ellipsizemode + */ + ellipsizeMode: (PropTypes.oneOf([ + 'head', + 'middle', + 'tail', + 'clip', + ]): React$PropType$Primitive<'head' | 'middle' | 'tail' | 'clip'>), + /** + * Used to truncate the text with an ellipsis. + * + * See https://facebook.github.io/react-native/docs/text.html#numberoflines + */ numberOfLines: PropTypes.number, - textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), + /** + * Set text break strategy on Android. + * + * See https://facebook.github.io/react-native/docs/text.html#textbreakstrategy + */ + textBreakStrategy: (PropTypes.oneOf([ + 'simple', + 'highQuality', + 'balanced', + ]): React$PropType$Primitive<'simple' | 'highQuality' | 'balanced'>), + /** + * Invoked on mount and layout changes. + * + * See https://facebook.github.io/react-native/docs/text.html#onlayout + */ onLayout: PropTypes.func, + /** + * This function is called on press. + * + * See https://facebook.github.io/react-native/docs/text.html#onpress + */ onPress: PropTypes.func, + /** + * This function is called on long press. + * + * See https://facebook.github.io/react-native/docs/text.html#onlongpress + */ onLongPress: PropTypes.func, + /** + * Defines how far your touch may move off of the button, before + * deactivating the button. + * + * See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset + */ pressRetentionOffset: DeprecatedEdgeInsetsPropType, + /** + * Lets the user select text. + * + * See https://facebook.github.io/react-native/docs/text.html#selectable + */ selectable: PropTypes.bool, + /** + * The highlight color of the text. + * + * See https://facebook.github.io/react-native/docs/text.html#selectioncolor + */ selectionColor: DeprecatedColorPropType, + /** + * When `true`, no visual change is made when text is pressed down. + * + * See https://facebook.github.io/react-native/docs/text.html#supperhighlighting + */ suppressHighlighting: PropTypes.bool, style: stylePropType, + /** + * Used to locate this view in end-to-end tests. + * + * See https://facebook.github.io/react-native/docs/text.html#testid + */ testID: PropTypes.string, + /** + * Used to locate this view from native code. + * + * See https://facebook.github.io/react-native/docs/text.html#nativeid + */ nativeID: PropTypes.string, + /** + * Whether fonts should scale to respect Text Size accessibility settings. + * + * See https://facebook.github.io/react-native/docs/text.html#allowfontscaling + */ allowFontScaling: PropTypes.bool, + /** + * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. + * Possible values: + * `null/undefined` (default): inherit from the parent node or the global default (0) + * `0`: no max, ignore parent/global default + * `>= 1`: sets the maxFontSizeMultiplier of this node to this value + */ maxFontSizeMultiplier: PropTypes.number, + /** + * Indicates whether the view is an accessibility element. + * + * See https://facebook.github.io/react-native/docs/text.html#accessible + */ accessible: PropTypes.bool, + /** + * Whether font should be scaled down automatically. + * + * See https://facebook.github.io/react-native/docs/text.html#adjustsfontsizetofit + */ adjustsFontSizeToFit: PropTypes.bool, + /** + * Smallest possible scale a font can reach. + * + * See https://facebook.github.io/react-native/docs/text.html#minimumfontscale + */ minimumFontScale: PropTypes.number, + /** + * Specifies the disabled state of the text view for testing purposes. + * + * See https://facebook.github.io/react-native/docs/text.html#disabled + */ disabled: PropTypes.bool, + /** + * Determines the types of data converted to clickable URLs in text. + * + * See https://facebook.github.io/react-native/docs/text.html#dataDetectorType + */ + dataDetectorType: (PropTypes.oneOf( + DataDetectorTypes, + ): React$PropType$Primitive< + 'phoneNumber' | 'link' | 'email' | 'none' | 'all', + >), }; diff --git a/Libraries/Text/TextStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js similarity index 57% rename from Libraries/Text/TextStylePropTypes.js rename to Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js index e41f6d833cc5d0..63ab3213ffd6e7 100644 --- a/Libraries/Text/TextStylePropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js @@ -10,23 +10,26 @@ 'use strict'; -const DeprecatedColorPropType = require('../DeprecatedPropTypes/DeprecatedColorPropType'); +const DeprecatedColorPropType = require('./DeprecatedColorPropType'); +const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); const ReactPropTypes = require('prop-types'); -const DeprecatedViewStylePropTypes = require('../DeprecatedPropTypes/DeprecatedViewStylePropTypes'); -const TextStylePropTypes = { +const DeprecatedTextStylePropTypes = { ...DeprecatedViewStylePropTypes, color: DeprecatedColorPropType, fontFamily: ReactPropTypes.string, fontSize: ReactPropTypes.number, - fontStyle: ReactPropTypes.oneOf(['normal', 'italic']), + fontStyle: (ReactPropTypes.oneOf([ + 'normal', + 'italic', + ]): React$PropType$Primitive<'normal' | 'italic'>), /** * Specifies font weight. The values 'normal' and 'bold' are supported for * most fonts. Not all fonts have a variant for each of the numeric values, * in that case the closest one is chosen. */ - fontWeight: ReactPropTypes.oneOf([ + fontWeight: (ReactPropTypes.oneOf([ 'normal' /*default*/, 'bold', '100', @@ -38,11 +41,23 @@ const TextStylePropTypes = { '700', '800', '900', - ]), + ]): React$PropType$Primitive< + | 'normal' + | 'bold' + | '100' + | '200' + | '300' + | '400' + | '500' + | '600' + | '700' + | '800' + | '900', + >), /** * @platform ios */ - fontVariant: ReactPropTypes.arrayOf( + fontVariant: (ReactPropTypes.arrayOf( ReactPropTypes.oneOf([ 'small-caps', 'oldstyle-nums', @@ -50,11 +65,19 @@ const TextStylePropTypes = { 'tabular-nums', 'proportional-nums', ]), - ), - textShadowOffset: ReactPropTypes.shape({ + ): React$PropType$Primitive< + Array< + | 'small-caps' + | 'oldstyle-nums' + | 'lining-nums' + | 'tabular-nums' + | 'proportional-nums', + >, + >), + textShadowOffset: (ReactPropTypes.shape({ width: ReactPropTypes.number, height: ReactPropTypes.number, - }), + }): React$PropType$Primitive<{height?: number, width?: number}>), textShadowRadius: ReactPropTypes.number, textShadowColor: DeprecatedColorPropType, /** @@ -66,22 +89,24 @@ const TextStylePropTypes = { * Specifies text alignment. The value 'justify' is only supported on iOS and * fallbacks to `left` on Android. */ - textAlign: ReactPropTypes.oneOf([ + textAlign: (ReactPropTypes.oneOf([ 'auto' /*default*/, 'left', 'right', 'center', 'justify', - ]), + ]): React$PropType$Primitive< + 'auto' | 'left' | 'right' | 'center' | 'justify', + >), /** * @platform android */ - textAlignVertical: ReactPropTypes.oneOf([ + textAlignVertical: (ReactPropTypes.oneOf([ 'auto' /*default*/, 'top', 'bottom', 'center', - ]), + ]): React$PropType$Primitive<'auto' | 'top' | 'bottom' | 'center'>), /** * Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders. * With some fonts, this padding can make text look slightly misaligned when centered vertically. @@ -89,35 +114,43 @@ const TextStylePropTypes = { * @platform android */ includeFontPadding: ReactPropTypes.bool, - textDecorationLine: ReactPropTypes.oneOf([ + textDecorationLine: (ReactPropTypes.oneOf([ 'none' /*default*/, 'underline', 'line-through', 'underline line-through', - ]), + ]): React$PropType$Primitive< + 'none' | 'underline' | 'line-through' | 'underline line-through', + >), /** * @platform ios */ - textDecorationStyle: ReactPropTypes.oneOf([ + textDecorationStyle: (ReactPropTypes.oneOf([ 'solid' /*default*/, 'double', 'dotted', 'dashed', - ]), + ]): React$PropType$Primitive<'solid' | 'double' | 'dotted' | 'dashed'>), /** * @platform ios */ textDecorationColor: DeprecatedColorPropType, - textTransform: ReactPropTypes.oneOf([ + textTransform: (ReactPropTypes.oneOf([ 'none' /*default*/, 'capitalize', 'uppercase', 'lowercase', - ]), + ]): React$PropType$Primitive< + 'none' | 'capitalize' | 'uppercase' | 'lowercase', + >), /** * @platform ios */ - writingDirection: ReactPropTypes.oneOf(['auto' /*default*/, 'ltr', 'rtl']), + writingDirection: (ReactPropTypes.oneOf([ + 'auto' /*default*/, + 'ltr', + 'rtl', + ]): React$PropType$Primitive<'auto' | 'ltr' | 'rtl'>), }; -module.exports = TextStylePropTypes; +module.exports = DeprecatedTextStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js index d4a408f7e9546c..78b445e754b362 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js @@ -41,7 +41,7 @@ const DecomposedMatrixPropType = function( }; const DeprecatedTransformPropTypes = { - transform: ReactPropTypes.arrayOf( + transform: (ReactPropTypes.arrayOf( ReactPropTypes.oneOfType([ ReactPropTypes.shape({perspective: ReactPropTypes.number}), ReactPropTypes.shape({rotate: ReactPropTypes.string}), @@ -56,29 +56,44 @@ const DeprecatedTransformPropTypes = { ReactPropTypes.shape({skewX: ReactPropTypes.string}), ReactPropTypes.shape({skewY: ReactPropTypes.string}), ]), - ), + ): React$PropType$Primitive< + Array< + | {perspective?: number} + | {rotate?: string} + | {rotateX?: string} + | {rotateY?: string} + | {rotateZ?: string} + | {scale?: number} + | {scaleX?: number} + | {scaleY?: number} + | {translateX?: number} + | {translateY?: number} + | {skewX?: string} + | {skewY?: string}, + >, + >), transformMatrix: TransformMatrixPropType, decomposedMatrix: DecomposedMatrixPropType, - scaleX: deprecatedPropType( + scaleX: (deprecatedPropType( ReactPropTypes.number, 'Use the transform prop instead.', - ), - scaleY: deprecatedPropType( + ): ReactPropsCheckType), + scaleY: (deprecatedPropType( ReactPropTypes.number, 'Use the transform prop instead.', - ), - rotation: deprecatedPropType( + ): ReactPropsCheckType), + rotation: (deprecatedPropType( ReactPropTypes.number, 'Use the transform prop instead.', - ), - translateX: deprecatedPropType( + ): ReactPropsCheckType), + translateX: (deprecatedPropType( ReactPropTypes.number, 'Use the transform prop instead.', - ), - translateY: deprecatedPropType( + ): ReactPropsCheckType), + translateY: (deprecatedPropType( ReactPropTypes.number, 'Use the transform prop instead.', - ), + ): ReactPropsCheckType), }; module.exports = DeprecatedTransformPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js index 01f035858cb607..03fd9a7c1a7691 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js @@ -11,17 +11,17 @@ 'use strict'; const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const PlatformViewPropTypes = require('../Components/View/PlatformViewPropTypes'); -const PropTypes = require('prop-types'); const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); +const PlatformViewPropTypes = require('../Components/View/PlatformViewPropTypes'); +const PropTypes = require('prop-types'); const { DeprecatedAccessibilityRoles, DeprecatedAccessibilityStates, } = require('./DeprecatedViewAccessibility'); -const stylePropType = DeprecatedStyleSheetPropType( +const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( DeprecatedViewStylePropTypes, ); @@ -58,7 +58,9 @@ module.exports = { * * @platform ios */ - accessibilityActions: PropTypes.arrayOf(PropTypes.string), + accessibilityActions: (PropTypes.arrayOf( + PropTypes.string, + ): React$PropType$Primitive>), /** * Prevents view from being inverted if set to true and color inversion is turned on. @@ -70,14 +72,56 @@ module.exports = { /** * Indicates to accessibility services to treat UI component like a specific role. */ - accessibilityRole: PropTypes.oneOf(DeprecatedAccessibilityRoles), + accessibilityRole: (PropTypes.oneOf( + DeprecatedAccessibilityRoles, + ): React$PropType$Primitive< + | 'none' + | 'button' + | 'link' + | 'search' + | 'image' + | 'keyboardkey' + | 'text' + | 'adjustable' + | 'imagebutton' + | 'header' + | 'summary' + | 'alert' + | 'checkbox' + | 'combobox' + | 'menu' + | 'menubar' + | 'menuitem' + | 'progressbar' + | 'radio' + | 'radiogroup' + | 'scrollbar' + | 'spinbutton' + | 'switch' + | 'tab' + | 'tablist' + | 'timer' + | 'toolbar', + >), /** * Indicates to accessibility services that UI Component is in a specific State. */ - accessibilityStates: PropTypes.arrayOf( + accessibilityStates: (PropTypes.arrayOf( PropTypes.oneOf(DeprecatedAccessibilityStates), - ), + ): React$PropType$Primitive< + Array< + | 'selected' + | 'disabled' + | 'checked' + | 'unchecked' + | 'busy' + | 'expanded' + | 'collapsed' + | 'hasPopup', + >, + >), + accessibilityState: PropTypes.object, /** * Indicates to accessibility services whether the user should be notified * when this view changes. Works for Android API >= 19 only. @@ -86,7 +130,11 @@ module.exports = { * * See http://facebook.github.io/react-native/docs/view.html#accessibilityliveregion */ - accessibilityLiveRegion: PropTypes.oneOf(['none', 'polite', 'assertive']), + accessibilityLiveRegion: (PropTypes.oneOf([ + 'none', + 'polite', + 'assertive', + ]): React$PropType$Primitive<'none' | 'polite' | 'assertive'>), /** * Controls how view is important for accessibility which is if it @@ -97,12 +145,12 @@ module.exports = { * * See http://facebook.github.io/react-native/docs/view.html#importantforaccessibility */ - importantForAccessibility: PropTypes.oneOf([ + importantForAccessibility: (PropTypes.oneOf([ 'auto', 'yes', 'no', 'no-hide-descendants', - ]), + ]): React$PropType$Primitive<'auto' | 'yes' | 'no' | 'no-hide-descendants'>), /** * A value indicating whether VoiceOver should ignore the elements @@ -313,7 +361,12 @@ module.exports = { * * See http://facebook.github.io/react-native/docs/view.html#pointerevents */ - pointerEvents: PropTypes.oneOf(['box-none', 'none', 'box-only', 'auto']), + pointerEvents: (PropTypes.oneOf([ + 'box-none', + 'none', + 'box-only', + 'auto', + ]): React$PropType$Primitive<'box-none' | 'none' | 'box-only' | 'auto'>), /** * See http://facebook.github.io/react-native/docs/style.html diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js index 373174edd1eaf2..8b7036bd60761d 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js @@ -12,9 +12,9 @@ const DeprecatedColorPropType = require('./DeprecatedColorPropType'); const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const ReactPropTypes = require('prop-types'); const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); +const ReactPropTypes = require('prop-types'); /** * Warning: Some of these properties may not be supported in all releases. @@ -23,7 +23,10 @@ const DeprecatedViewStylePropTypes = { ...DeprecatedLayoutPropTypes, ...DeprecatedShadowPropTypesIOS, ...DeprecatedTransformPropTypes, - backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']), + backfaceVisibility: (ReactPropTypes.oneOf([ + 'visible', + 'hidden', + ]): React$PropType$Primitive<'visible' | 'hidden'>), backgroundColor: DeprecatedColorPropType, borderColor: DeprecatedColorPropType, borderTopColor: DeprecatedColorPropType, @@ -41,7 +44,11 @@ const DeprecatedViewStylePropTypes = { borderBottomRightRadius: ReactPropTypes.number, borderBottomStartRadius: ReactPropTypes.number, borderBottomEndRadius: ReactPropTypes.number, - borderStyle: ReactPropTypes.oneOf(['solid', 'dotted', 'dashed']), + borderStyle: (ReactPropTypes.oneOf([ + 'solid', + 'dotted', + 'dashed', + ]): React$PropType$Primitive<'solid' | 'dotted' | 'dashed'>), borderWidth: ReactPropTypes.number, borderTopWidth: ReactPropTypes.number, borderRightWidth: ReactPropTypes.number, diff --git a/Libraries/EventEmitter/RCTDeviceEventEmitter.js b/Libraries/EventEmitter/RCTDeviceEventEmitter.js index f3192d0bb4f01b..0b4c15d501d6b8 100644 --- a/Libraries/EventEmitter/RCTDeviceEventEmitter.js +++ b/Libraries/EventEmitter/RCTDeviceEventEmitter.js @@ -81,4 +81,4 @@ class RCTDeviceEventEmitter extends EventEmitter { } } -module.exports = new RCTDeviceEventEmitter(); +module.exports = (new RCTDeviceEventEmitter(): RCTDeviceEventEmitter); diff --git a/Libraries/Experimental/Incremental.js b/Libraries/Experimental/Incremental.js index e7f3e82c2126e6..8ccb315d6a8dc0 100644 --- a/Libraries/Experimental/Incremental.js +++ b/Libraries/Experimental/Incremental.js @@ -11,9 +11,8 @@ 'use strict'; const InteractionManager = require('../Interaction/InteractionManager'); -const React = require('react'); - const PropTypes = require('prop-types'); +const React = require('react'); const infoLog = require('../Utilities/infoLog'); @@ -104,11 +103,16 @@ class Incremental extends React.Component { _mounted: boolean; _rendered: boolean; - static defaultProps = { + static defaultProps: $TEMPORARY$object<{|name: string|}> = { name: '', }; - static contextTypes = { + static contextTypes: + | any + | $TEMPORARY$object<{| + incrementalGroup: React$PropType$Primitive, + incrementalGroupEnabled: React$PropType$Primitive, + |}> = { incrementalGroup: PropTypes.object, incrementalGroupEnabled: PropTypes.bool, }; diff --git a/Libraries/Experimental/IncrementalExample.js b/Libraries/Experimental/IncrementalExample.js index 906bb281bcd110..4d551053e4f193 100644 --- a/Libraries/Experimental/IncrementalExample.js +++ b/Libraries/Experimental/IncrementalExample.js @@ -93,8 +93,9 @@ function Block(props: Object) { const Row = (props: Object) => ; class IncrementalExample extends React.Component { - static title = ''; - static description = 'Enables incremental rendering of complex components.'; + static title: string = ''; + static description: string = + 'Enables incremental rendering of complex components.'; start: number; constructor(props: mixed, context: mixed) { super(props, context); diff --git a/Libraries/Experimental/IncrementalPresenter.js b/Libraries/Experimental/IncrementalPresenter.js index a3f8069c93ca74..561da9bbd83f17 100644 --- a/Libraries/Experimental/IncrementalPresenter.js +++ b/Libraries/Experimental/IncrementalPresenter.js @@ -15,9 +15,9 @@ const PropTypes = require('prop-types'); const React = require('react'); const View = require('../Components/View/View'); -import type {Context} from './Incremental'; import type {ViewStyleProp} from '../StyleSheet/StyleSheet'; import type {LayoutEvent} from '../Types/CoreEventTypes'; +import type {Context} from './Incremental'; /** * WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will @@ -44,7 +44,12 @@ class IncrementalPresenter extends React.Component { context: Context; _isDone: boolean; - static contextTypes = { + static contextTypes: + | any + | $TEMPORARY$object<{| + incrementalGroup: React$PropType$Primitive, + incrementalGroupEnabled: React$PropType$Primitive, + |}> = { incrementalGroup: PropTypes.object, incrementalGroupEnabled: PropTypes.bool, }; @@ -67,7 +72,7 @@ class IncrementalPresenter extends React.Component { } this.props.onDone && this.props.onDone(); } - render() { + render(): React.Node { let style: ViewStyleProp; if ( this.props.disabled !== true && diff --git a/Libraries/Experimental/WindowedListView.js b/Libraries/Experimental/WindowedListView.js index fd7af713bce784..05c2fa038f08b0 100644 --- a/Libraries/Experimental/WindowedListView.js +++ b/Libraries/Experimental/WindowedListView.js @@ -151,7 +151,7 @@ type State = { }; class WindowedListView extends React.Component { /** - * Recomputing which rows to render is batched up and run asynchronously to avoid wastful updates, + * Recomputing which rows to render is batched up and run asynchronously to avoid wasteful updates, * e.g. from multiple layout updates in rapid succession. */ _computeRowsToRenderBatcher: Batchinator; @@ -170,7 +170,15 @@ class WindowedListView extends React.Component { _scrollRef: ?ScrollView; _viewabilityHelper: ViewabilityHelper; - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + disableIncrementalRendering: boolean, + initialNumToRender: number, + maxNumToRender: number, + numToRenderAhead: number, + recomputeRowsBatchingPeriod: number, + renderScrollComponent: (props: any) => React.Node, + viewablePercentThreshold: number, + |}> = { initialNumToRender: 10, maxNumToRender: 30, numToRenderAhead: 10, @@ -390,7 +398,7 @@ class WindowedListView extends React.Component { } this._updateVisibleRows(firstVisible, lastVisible); - // Unfortuantely, we can't use to simplify our increment logic in this function + // Unfortunately, we can't use to simplify our increment logic in this function // because we need to make sure that cells are rendered in the right order one at a time when // scrolling back up. @@ -646,7 +654,7 @@ type CellProps = { * after offscreen rendering has completed, includeInLayout will be set true and the finished cell * can be dropped into place. * - * This is coordinated outside this component so the parent can syncronize this re-render with + * This is coordinated outside this component so the parent can synchronize this re-render with * managing the placeholder sizing. */ includeInLayout: boolean, @@ -656,7 +664,7 @@ type CellProps = { */ onNewLayout: (params: {rowKey: string, layout: Object}) => void, /** - * Used to track when rendering is in progress so the parent can avoid wastedful re-renders that + * Used to track when rendering is in progress so the parent can avoid wasteful re-renders that * are just going to be invalidated once the cell finishes. */ onProgressChange: (progress: {rowKey: string, inProgress: boolean}) => void, diff --git a/Libraries/FBLazyVector/BUCK b/Libraries/FBLazyVector/BUCK new file mode 100644 index 00000000000000..7989eb160bc4a4 --- /dev/null +++ b/Libraries/FBLazyVector/BUCK @@ -0,0 +1,11 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "fb_apple_library") + +fb_apple_library( + name = "FBLazyVector", + autoglob = True, + contacts = ["oncall+react_native@xmail.facebook.com"], + enable_exceptions = False, + frameworks = [], + link_whole = False, + visibility = ["PUBLIC"], +) diff --git a/Libraries/fishhook/React-fishhook.podspec b/Libraries/FBLazyVector/FBLazyVector.podspec similarity index 77% rename from Libraries/fishhook/React-fishhook.podspec rename to Libraries/FBLazyVector/FBLazyVector.podspec index bfc0cc64b2829d..9ebd4a996b99d2 100644 --- a/Libraries/fishhook/React-fishhook.podspec +++ b/Libraries/FBLazyVector/FBLazyVector.podspec @@ -18,14 +18,15 @@ else end Pod::Spec.new do |s| - s.name = "React-fishhook" + s.name = "FBLazyVector" s.version = version - s.summary = "A very simple library that enables dynamically rebinding symbols in Mach-O binaries running on iOS in the simulator and on device." + s.summary = "-" # TODO s.homepage = "http://facebook.github.io/react-native/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{c,h}" - s.header_dir = "fishhook" + s.source_files = "**/*.{c,h,m,mm,cpp}" + s.header_dir = "FBLazyVector" + end diff --git a/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h b/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h new file mode 100644 index 00000000000000..b0968282a777e2 --- /dev/null +++ b/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h @@ -0,0 +1,125 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#import +#import + +namespace FB { + +template +class LazyIterator { + public: + using value_type = T; + using pointer = std::unique_ptr; + using reference = T; + using iterator_category = std::random_access_iterator_tag; + using difference_type = std::int32_t; + using size_type = std::int32_t; + using convert_type = std::function; + + public: + LazyIterator() = default; + + LazyIterator(U vector, convert_type convert, size_type i) + : _v(vector), _i(i), _convert(std::move(convert)) {} + + bool operator==(const LazyIterator &other) const { + return _i == other._i && _v == other._v; + } + + bool operator<(const LazyIterator &b) const { + return _i < b._i; + } + + value_type operator*() const { + return _convert(_v[_i]); + } + + std::unique_ptr operator->() const { + return std::make_unique(*this); + } + + LazyIterator operator+(difference_type n) const { + return LazyIterator(_v, _convert, _i + n); + } + + LazyIterator &operator+=(difference_type n) { + _i += n; + return *this; + } + + LazyIterator &operator-=(difference_type n) { + _i -= n; + return *this; + } + + LazyIterator operator-(difference_type n) const { + return LazyIterator(_v, _i - n); + } + + difference_type operator-(const LazyIterator &a) const { + return _i - a._i; + } + + LazyIterator &operator++() { + return *this += 1; + } + + LazyIterator operator++(int) { + auto tmp = *this; + ++*this; + return tmp; + } + + LazyIterator &operator--() { + return *this -= 1; + } + + LazyIterator operator--(int) { + auto tmp = *this; + --*this; + return tmp; + } + + value_type operator[](difference_type n) const { + return _convert(_v[_i + n]); + } + + private: + U _v; + size_type _i; + convert_type _convert; +}; + +template +LazyIterator operator+(typename LazyIterator::difference_type n, + const LazyIterator &i) { + return i + n; +} + +template +bool operator!=(const LazyIterator &a, + const LazyIterator &b) { + return !(a == b); +} + +template +bool operator<=(const LazyIterator &a, + const LazyIterator &b) { + return a < b || a == b; +} + +template +bool operator>(const LazyIterator &a, + const LazyIterator &b) { + return b < a; +} + +template +bool operator>=(const LazyIterator &a, + const LazyIterator &b) { + return a > b || a == b; +} + +} diff --git a/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h b/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h new file mode 100644 index 00000000000000..e1c705576ee876 --- /dev/null +++ b/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h @@ -0,0 +1,99 @@ +/** + * 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. + */ + +#pragma once + +#import +#import +#import + +#import + +namespace FB { + +/** + * Presents a type-safe wrapper around an arbitrary object that represents an _immutable_ array of objects. + * Each item is constructed lazily on demand and reconstructed on each access; there is no caching. + */ +template +class LazyVector { + public: + using value_type = T; + using reference = T; + using const_reference = T; + using const_iterator = LazyIterator; + using iterator = const_iterator; + using size_type = std::int32_t; + using convert_type = std::function; + + static LazyVector fromUnsafeRawValue(U v, size_type size, convert_type convert) { + return {v, size, convert}; + } + + U unsafeRawValue() const { + return _v; + } + + bool empty() const { + return _size == 0; + } + + size_type size() const { + return _size; + } + + const_reference at(size_type pos) const { +#ifndef _LIBCPP_NO_EXCEPTIONS + if (!(pos < _size)) throw std::out_of_range("out of range"); +#else + assert(pos < _size || !"out of range"); +#endif + return _convert(_v[pos]); + } + + const_reference operator[](size_type pos) const { + assert(pos < _size); + return _convert(_v[pos]); + } + + const_reference front() const { + assert(_size); + return (*this)[0]; + } + + const_reference back() const { + assert(_size); + return (*this)[_size - 1]; + } + + const_iterator begin() const { + return const_iterator(_v, _convert, 0); + } + + const_iterator cbegin() const { + return begin(); + } + + const_iterator end() const { + return const_iterator(_v, _convert, _size); + } + + const_iterator cend() const { + return end(); + } + + private: + /** Wrapped vector */ + LazyVector(U vector, size_type size, convert_type convert) + : _v(vector), _size(size), _convert(convert) {} + + U _v; + size_type _size; + convert_type _convert; +}; + +} diff --git a/Libraries/FBReactNativeSpec/BUCK b/Libraries/FBReactNativeSpec/BUCK new file mode 100644 index 00000000000000..1cff97d2bea17f --- /dev/null +++ b/Libraries/FBReactNativeSpec/BUCK @@ -0,0 +1,23 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "fb_apple_library", "react_native_xplat_target_apple", "subdir_glob") + +fb_apple_library( + name = "FBReactNativeSpecApple", + srcs = glob(["FBReactNativeSpec/**/*.mm"]), + exported_headers = subdir_glob( + [ + ("FBReactNativeSpec", "*.h"), + ], + prefix = "FBReactNativeSpec", + ), + contacts = ["oncall+react_native@xmail.facebook.com"], + frameworks = [ + "Foundation", + "UIKit", + ], + reexport_all_header_dependencies = True, + deps = [ + "fbsource//xplat/js/react-native-github:RCTTypeSafety", + "fbsource//xplat/js/react-native-github/Libraries/RCTRequired:RCTRequired", + react_native_xplat_target_apple("turbomodule/core:core"), + ], +) diff --git a/ReactCommon/turbomodule/core/React-turbomodule-core.podspec b/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec similarity index 60% rename from ReactCommon/turbomodule/core/React-turbomodule-core.podspec rename to Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec index 93843198ea8222..2790f90ec9a408 100644 --- a/ReactCommon/turbomodule/core/React-turbomodule-core.podspec +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -6,7 +6,7 @@ require "json" -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) +package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) version = package['version'] source = { :git => 'https://github.com/facebook/react-native.git' } @@ -19,31 +19,30 @@ end folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' folly_version = '2018.10.22.00' -boost_compiler_flags = '-Wno-documentation' Pod::Spec.new do |s| - s.name = "React-turbomodule-core" + s.name = "FBReactNativeSpec" s.version = version s.summary = "-" # TODO s.homepage = "http://facebook.github.io/react-native/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) + s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source - s.source_files = "*.{cpp,h}" - s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" } - s.header_dir = "jsireact" - s.xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_TURBO_MODULE_ENABLED" } + s.source_files = "**/*.{c,h,m,mm,cpp}" + s.header_dir = "FBReactNativeSpec" + s.pod_target_xcconfig = { + "USE_HEADERMAP" => "YES", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/Libraries/FBReactNativeSpec\" \"$(PODS_ROOT)/Folly\"" + } + + s.dependency "Folly", folly_version + s.dependency "RCTRequired", version + s.dependency "RCTTypeSafety", version s.dependency "React-Core", version - s.dependency "React-cxxreact", version s.dependency "React-jsi", version - s.dependency "Folly", folly_version - s.dependency "React-jscallinvoker", version - - s.subspec "core-ios" do |ss| - ss.source_files = "platform/ios/*.{mm,cpp,h}" - ss.header_dir = "jsireact" - end + s.dependency "ReactCommon/turbomodule/core", version end diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm new file mode 100644 index 00000000000000..553779b78b1862 --- /dev/null +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm @@ -0,0 +1,2373 @@ +/** + * 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. + * + * @generated by an internal genrule from Flow types. + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ +#import "FBReactNativeSpec.h" + + + +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAccessibilityInfoSpecJSI_isReduceMotionEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "isReduceMotionEnabled", @selector(isReduceMotionEnabled:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityInfoSpecJSI_isTouchExplorationEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "isTouchExplorationEnabled", @selector(isTouchExplorationEnabled:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityInfoSpecJSI_setAccessibilityFocus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAccessibilityFocus", @selector(setAccessibilityFocus:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityInfoSpecJSI_announceForAccessibility(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "announceForAccessibility", @selector(announceForAccessibility:), args, count); + } + + + NativeAccessibilityInfoSpecJSI::NativeAccessibilityInfoSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AccessibilityInfo", instance, jsInvoker) { + + methodMap_["isReduceMotionEnabled"] = MethodMetadata {1, __hostFunction_NativeAccessibilityInfoSpecJSI_isReduceMotionEnabled}; + + + methodMap_["isTouchExplorationEnabled"] = MethodMetadata {1, __hostFunction_NativeAccessibilityInfoSpecJSI_isTouchExplorationEnabled}; + + + methodMap_["setAccessibilityFocus"] = MethodMetadata {1, __hostFunction_NativeAccessibilityInfoSpecJSI_setAccessibilityFocus}; + + + methodMap_["announceForAccessibility"] = MethodMetadata {1, __hostFunction_NativeAccessibilityInfoSpecJSI_announceForAccessibility}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAccessibilityManager_SpecSetAccessibilityContentSizeMultipliersJSMultiipliers) ++ (RCTManagedPointer *)JS_NativeAccessibilityManager_SpecSetAccessibilityContentSizeMultipliersJSMultiipliers:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentBoldTextState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentBoldTextState", @selector(getCurrentBoldTextState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentGrayscaleState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentGrayscaleState", @selector(getCurrentGrayscaleState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentInvertColorsState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentInvertColorsState", @selector(getCurrentInvertColorsState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentReduceMotionState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentReduceMotionState", @selector(getCurrentReduceMotionState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentReduceTransparencyState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentReduceTransparencyState", @selector(getCurrentReduceTransparencyState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentVoiceOverState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentVoiceOverState", @selector(getCurrentVoiceOverState:onError:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_setAccessibilityContentSizeMultipliers(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAccessibilityContentSizeMultipliers", @selector(setAccessibilityContentSizeMultipliers:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_setAccessibilityFocus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAccessibilityFocus", @selector(setAccessibilityFocus:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAccessibilityManagerSpecJSI_announceForAccessibility(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "announceForAccessibility", @selector(announceForAccessibility:), args, count); + } + + + NativeAccessibilityManagerSpecJSI::NativeAccessibilityManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AccessibilityManager", instance, jsInvoker) { + + methodMap_["getCurrentBoldTextState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentBoldTextState}; + + + methodMap_["getCurrentGrayscaleState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentGrayscaleState}; + + + methodMap_["getCurrentInvertColorsState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentInvertColorsState}; + + + methodMap_["getCurrentReduceMotionState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentReduceMotionState}; + + + methodMap_["getCurrentReduceTransparencyState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentReduceTransparencyState}; + + + methodMap_["getCurrentVoiceOverState"] = MethodMetadata {2, __hostFunction_NativeAccessibilityManagerSpecJSI_getCurrentVoiceOverState}; + + + methodMap_["setAccessibilityContentSizeMultipliers"] = MethodMetadata {1, __hostFunction_NativeAccessibilityManagerSpecJSI_setAccessibilityContentSizeMultipliers}; + + setMethodArgConversionSelector(@"setAccessibilityContentSizeMultipliers", 0, @"JS_NativeAccessibilityManager_SpecSetAccessibilityContentSizeMultipliersJSMultiipliers:"); + + methodMap_["setAccessibilityFocus"] = MethodMetadata {1, __hostFunction_NativeAccessibilityManagerSpecJSI_setAccessibilityFocus}; + + + methodMap_["announceForAccessibility"] = MethodMetadata {1, __hostFunction_NativeAccessibilityManagerSpecJSI_announceForAccessibility}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeActionSheetManager_SpecShowActionSheetWithOptionsOptions) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowActionSheetWithOptionsOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeActionSheetManager_SpecShowShareActionSheetWithOptionsOptions) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowShareActionSheetWithOptionsOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeActionSheetManager_SpecShowShareActionSheetWithOptionsFailureCallbackError) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowShareActionSheetWithOptionsFailureCallbackError:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeActionSheetManagerSpecJSI_showActionSheetWithOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showActionSheetWithOptions", @selector(showActionSheetWithOptions:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeActionSheetManagerSpecJSI_showShareActionSheetWithOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showShareActionSheetWithOptions", @selector(showShareActionSheetWithOptions:failureCallback:successCallback:), args, count); + } + + + NativeActionSheetManagerSpecJSI::NativeActionSheetManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ActionSheetManager", instance, jsInvoker) { + + methodMap_["showActionSheetWithOptions"] = MethodMetadata {2, __hostFunction_NativeActionSheetManagerSpecJSI_showActionSheetWithOptions}; + + setMethodArgConversionSelector(@"showActionSheetWithOptions", 0, @"JS_NativeActionSheetManager_SpecShowActionSheetWithOptionsOptions:"); + + methodMap_["showShareActionSheetWithOptions"] = MethodMetadata {3, __hostFunction_NativeActionSheetManagerSpecJSI_showShareActionSheetWithOptions}; + + setMethodArgConversionSelector(@"showShareActionSheetWithOptions", 0, @"JS_NativeActionSheetManager_SpecShowShareActionSheetWithOptionsOptions:"); + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAlertManager_Args) ++ (RCTManagedPointer *)JS_NativeAlertManager_Args:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAlertManagerSpecJSI_alertWithArgs(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "alertWithArgs", @selector(alertWithArgs:callback:), args, count); + } + + + NativeAlertManagerSpecJSI::NativeAlertManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AlertManager", instance, jsInvoker) { + + methodMap_["alertWithArgs"] = MethodMetadata {2, __hostFunction_NativeAlertManagerSpecJSI_alertWithArgs}; + + setMethodArgConversionSelector(@"alertWithArgs", 0, @"JS_NativeAlertManager_Args:"); + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAnimatedModule_AnimatedNodeConfig) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_AnimatedNodeConfig:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAnimatedModule_AnimatingNodeConfig) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_AnimatingNodeConfig:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAnimatedModule_EndResult) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_EndResult:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAnimatedModule_EventMapping) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_EventMapping:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_createAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createAnimatedNode", @selector(createAnimatedNode:config:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_startListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startListeningToAnimatedNodeValue", @selector(startListeningToAnimatedNodeValue:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_stopListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "stopListeningToAnimatedNodeValue", @selector(stopListeningToAnimatedNodeValue:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_connectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "connectAnimatedNodes", @selector(connectAnimatedNodes:childTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_disconnectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "disconnectAnimatedNodes", @selector(disconnectAnimatedNodes:childTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_startAnimatingNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startAnimatingNode", @selector(startAnimatingNode:nodeTag:config:endCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_stopAnimation(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "stopAnimation", @selector(stopAnimation:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_setAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAnimatedNodeValue", @selector(setAnimatedNodeValue:value:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_setAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAnimatedNodeOffset", @selector(setAnimatedNodeOffset:offset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_flattenAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "flattenAnimatedNodeOffset", @selector(flattenAnimatedNodeOffset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_extractAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "extractAnimatedNodeOffset", @selector(extractAnimatedNodeOffset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_connectAnimatedNodeToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "connectAnimatedNodeToView", @selector(connectAnimatedNodeToView:viewTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_disconnectAnimatedNodeFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "disconnectAnimatedNodeFromView", @selector(disconnectAnimatedNodeFromView:viewTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_dropAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dropAnimatedNode", @selector(dropAnimatedNode:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_addAnimatedEventToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addAnimatedEventToView", @selector(addAnimatedEventToView:eventName:eventMapping:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_removeAnimatedEventFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeAnimatedEventFromView", @selector(removeAnimatedEventFromView:eventName:animatedNodeTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedModuleSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeAnimatedModuleSpecJSI::NativeAnimatedModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AnimatedModule", instance, jsInvoker) { + + methodMap_["createAnimatedNode"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_createAnimatedNode}; + + setMethodArgConversionSelector(@"createAnimatedNode", 1, @"JS_NativeAnimatedModule_AnimatedNodeConfig:"); + + methodMap_["startListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_startListeningToAnimatedNodeValue}; + + + methodMap_["stopListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_stopListeningToAnimatedNodeValue}; + + + methodMap_["connectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_connectAnimatedNodes}; + + + methodMap_["disconnectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_disconnectAnimatedNodes}; + + + methodMap_["startAnimatingNode"] = MethodMetadata {4, __hostFunction_NativeAnimatedModuleSpecJSI_startAnimatingNode}; + + setMethodArgConversionSelector(@"startAnimatingNode", 2, @"JS_NativeAnimatedModule_AnimatingNodeConfig:"); + + methodMap_["stopAnimation"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_stopAnimation}; + + + methodMap_["setAnimatedNodeValue"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_setAnimatedNodeValue}; + + + methodMap_["setAnimatedNodeOffset"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_setAnimatedNodeOffset}; + + + methodMap_["flattenAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_flattenAnimatedNodeOffset}; + + + methodMap_["extractAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_extractAnimatedNodeOffset}; + + + methodMap_["connectAnimatedNodeToView"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_connectAnimatedNodeToView}; + + + methodMap_["disconnectAnimatedNodeFromView"] = MethodMetadata {2, __hostFunction_NativeAnimatedModuleSpecJSI_disconnectAnimatedNodeFromView}; + + + methodMap_["dropAnimatedNode"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_dropAnimatedNode}; + + + methodMap_["addAnimatedEventToView"] = MethodMetadata {3, __hostFunction_NativeAnimatedModuleSpecJSI_addAnimatedEventToView}; + + setMethodArgConversionSelector(@"addAnimatedEventToView", 2, @"JS_NativeAnimatedModule_EventMapping:"); + + methodMap_["removeAnimatedEventFromView"] = MethodMetadata {3, __hostFunction_NativeAnimatedModuleSpecJSI_removeAnimatedEventFromView}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAnimatedModuleSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAnimationsDebugModuleSpecJSI_startRecordingFps(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startRecordingFps", @selector(startRecordingFps), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimationsDebugModuleSpecJSI_stopRecordingFps(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "stopRecordingFps", @selector(stopRecordingFps:), args, count); + } + + + NativeAnimationsDebugModuleSpecJSI::NativeAnimationsDebugModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AnimationsDebugModule", instance, jsInvoker) { + + methodMap_["startRecordingFps"] = MethodMetadata {0, __hostFunction_NativeAnimationsDebugModuleSpecJSI_startRecordingFps}; + + + methodMap_["stopRecordingFps"] = MethodMetadata {1, __hostFunction_NativeAnimationsDebugModuleSpecJSI_stopRecordingFps}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAppState_SpecGetCurrentAppStateSuccessAppState) ++ (RCTManagedPointer *)JS_NativeAppState_SpecGetCurrentAppStateSuccessAppState:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAppStateSpecJSI_getCurrentAppState(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getCurrentAppState", @selector(getCurrentAppState:failure:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAppStateSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAppStateSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAppStateSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeAppStateSpecJSI::NativeAppStateSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AppState", instance, jsInvoker) { + + methodMap_["getCurrentAppState"] = MethodMetadata {2, __hostFunction_NativeAppStateSpecJSI_getCurrentAppState}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAppStateSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAppStateSpecJSI_removeListeners}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeAppStateSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAsyncStorage_SpecMultiGetCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiGetCallbackErrorsElement:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAsyncStorage_SpecMultiSetCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiSetCallbackErrorsElement:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAsyncStorage_SpecMultiMergeCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiMergeCallbackErrorsElement:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAsyncStorage_SpecMultiRemoveCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiRemoveCallbackErrorsElement:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAsyncStorage_SpecClearCallbackError) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecClearCallbackError:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAsyncStorage_SpecGetAllKeysCallbackError) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecGetAllKeysCallbackError:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_multiGet(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "multiGet", @selector(multiGet:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_multiSet(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "multiSet", @selector(multiSet:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_multiMerge(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "multiMerge", @selector(multiMerge:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_multiRemove(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "multiRemove", @selector(multiRemove:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_clear(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clear", @selector(clear:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAsyncStorageSpecJSI_getAllKeys(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getAllKeys", @selector(getAllKeys:), args, count); + } + + + NativeAsyncStorageSpecJSI::NativeAsyncStorageSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("AsyncStorage", instance, jsInvoker) { + + methodMap_["multiGet"] = MethodMetadata {2, __hostFunction_NativeAsyncStorageSpecJSI_multiGet}; + + + methodMap_["multiSet"] = MethodMetadata {2, __hostFunction_NativeAsyncStorageSpecJSI_multiSet}; + + + methodMap_["multiMerge"] = MethodMetadata {2, __hostFunction_NativeAsyncStorageSpecJSI_multiMerge}; + + + methodMap_["multiRemove"] = MethodMetadata {2, __hostFunction_NativeAsyncStorageSpecJSI_multiRemove}; + + + methodMap_["clear"] = MethodMetadata {1, __hostFunction_NativeAsyncStorageSpecJSI_clear}; + + + methodMap_["getAllKeys"] = MethodMetadata {1, __hostFunction_NativeAsyncStorageSpecJSI_getAllKeys}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_addNetworkingHandler(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addNetworkingHandler", @selector(addNetworkingHandler), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_addWebSocketHandler(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addWebSocketHandler", @selector(addWebSocketHandler:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_removeWebSocketHandler(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeWebSocketHandler", @selector(removeWebSocketHandler:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_sendOverSocket(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendOverSocket", @selector(sendOverSocket:id:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_createFromParts(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createFromParts", @selector(createFromParts:blobId:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_release(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "release", @selector(release:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeBlobModuleSpecJSI::NativeBlobModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("BlobModule", instance, jsInvoker) { + + methodMap_["addNetworkingHandler"] = MethodMetadata {0, __hostFunction_NativeBlobModuleSpecJSI_addNetworkingHandler}; + + + methodMap_["addWebSocketHandler"] = MethodMetadata {1, __hostFunction_NativeBlobModuleSpecJSI_addWebSocketHandler}; + + + methodMap_["removeWebSocketHandler"] = MethodMetadata {1, __hostFunction_NativeBlobModuleSpecJSI_removeWebSocketHandler}; + + + methodMap_["sendOverSocket"] = MethodMetadata {2, __hostFunction_NativeBlobModuleSpecJSI_sendOverSocket}; + + + methodMap_["createFromParts"] = MethodMetadata {2, __hostFunction_NativeBlobModuleSpecJSI_createFromParts}; + + + methodMap_["release"] = MethodMetadata {1, __hostFunction_NativeBlobModuleSpecJSI_release}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeBlobModuleSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeBugReportingSpecJSI_startReportAProblemFlow(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startReportAProblemFlow", @selector(startReportAProblemFlow), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBugReportingSpecJSI_setExtraData(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setExtraData", @selector(setExtraData:extraFiles:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeBugReportingSpecJSI_setCategoryID(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setCategoryID", @selector(setCategoryID:), args, count); + } + + + NativeBugReportingSpecJSI::NativeBugReportingSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("BugReporting", instance, jsInvoker) { + + methodMap_["startReportAProblemFlow"] = MethodMetadata {0, __hostFunction_NativeBugReportingSpecJSI_startReportAProblemFlow}; + + + methodMap_["setExtraData"] = MethodMetadata {2, __hostFunction_NativeBugReportingSpecJSI_setExtraData}; + + + methodMap_["setCategoryID"] = MethodMetadata {1, __hostFunction_NativeBugReportingSpecJSI_setCategoryID}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeClipboardSpecJSI_getString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getString", @selector(getString:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeClipboardSpecJSI_setString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setString", @selector(setString:), args, count); + } + + + NativeClipboardSpecJSI::NativeClipboardSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("Clipboard", instance, jsInvoker) { + + methodMap_["getString"] = MethodMetadata {0, __hostFunction_NativeClipboardSpecJSI_getString}; + + + methodMap_["setString"] = MethodMetadata {1, __hostFunction_NativeClipboardSpecJSI_setString}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDatePickerAndroidSpecJSI_open(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "open", @selector(open:resolve:reject:), args, count); + } + + + NativeDatePickerAndroidSpecJSI::NativeDatePickerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DatePickerAndroid", instance, jsInvoker) { + + methodMap_["open"] = MethodMetadata {1, __hostFunction_NativeDatePickerAndroidSpecJSI_open}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDevLoadingViewSpecJSI_showMessage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showMessage", @selector(showMessage:color:backgroundColor:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevLoadingViewSpecJSI_hide(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "hide", @selector(hide), args, count); + } + + + NativeDevLoadingViewSpecJSI::NativeDevLoadingViewSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DevLoadingView", instance, jsInvoker) { + + methodMap_["showMessage"] = MethodMetadata {3, __hostFunction_NativeDevLoadingViewSpecJSI_showMessage}; + + + methodMap_["hide"] = MethodMetadata {0, __hostFunction_NativeDevLoadingViewSpecJSI_hide}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_reload(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "reload", @selector(reload), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_setHotLoadingEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setHotLoadingEnabled", @selector(setHotLoadingEnabled:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_setIsDebuggingRemotely(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setIsDebuggingRemotely", @selector(setIsDebuggingRemotely:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_setLiveReloadEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setLiveReloadEnabled", @selector(setLiveReloadEnabled:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_setProfilingEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setProfilingEnabled", @selector(setProfilingEnabled:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_toggleElementInspector(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "toggleElementInspector", @selector(toggleElementInspector), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDevSettingsSpecJSI_setIsShakeToShowDevMenuEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setIsShakeToShowDevMenuEnabled", @selector(setIsShakeToShowDevMenuEnabled:), args, count); + } + + + NativeDevSettingsSpecJSI::NativeDevSettingsSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DevSettings", instance, jsInvoker) { + + methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeDevSettingsSpecJSI_reload}; + + + methodMap_["setHotLoadingEnabled"] = MethodMetadata {1, __hostFunction_NativeDevSettingsSpecJSI_setHotLoadingEnabled}; + + + methodMap_["setIsDebuggingRemotely"] = MethodMetadata {1, __hostFunction_NativeDevSettingsSpecJSI_setIsDebuggingRemotely}; + + + methodMap_["setLiveReloadEnabled"] = MethodMetadata {1, __hostFunction_NativeDevSettingsSpecJSI_setLiveReloadEnabled}; + + + methodMap_["setProfilingEnabled"] = MethodMetadata {1, __hostFunction_NativeDevSettingsSpecJSI_setProfilingEnabled}; + + + methodMap_["toggleElementInspector"] = MethodMetadata {0, __hostFunction_NativeDevSettingsSpecJSI_toggleElementInspector}; + + + methodMap_["setIsShakeToShowDevMenuEnabled"] = MethodMetadata {1, __hostFunction_NativeDevSettingsSpecJSI_setIsShakeToShowDevMenuEnabled}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDeviceEventManagerSpecJSI_invokeDefaultBackPressHandler(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "invokeDefaultBackPressHandler", @selector(invokeDefaultBackPressHandler), args, count); + } + + + NativeDeviceEventManagerSpecJSI::NativeDeviceEventManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DeviceEventManager", instance, jsInvoker) { + + methodMap_["invokeDefaultBackPressHandler"] = MethodMetadata {0, __hostFunction_NativeDeviceEventManagerSpecJSI_invokeDefaultBackPressHandler}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDeviceInfoSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeDeviceInfoSpecJSI::NativeDeviceInfoSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DeviceInfo", instance, jsInvoker) { + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeDeviceInfoSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeDialogManagerAndroid_DialogOptions) ++ (RCTManagedPointer *)JS_NativeDialogManagerAndroid_DialogOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeDialogManagerAndroidSpecJSI_showAlert(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showAlert", @selector(showAlert:onError:onAction:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeDialogManagerAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeDialogManagerAndroidSpecJSI::NativeDialogManagerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("DialogManagerAndroid", instance, jsInvoker) { + + methodMap_["showAlert"] = MethodMetadata {3, __hostFunction_NativeDialogManagerAndroidSpecJSI_showAlert}; + + setMethodArgConversionSelector(@"showAlert", 0, @"JS_NativeDialogManagerAndroid_DialogOptions:"); + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeDialogManagerAndroidSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeExceptionsManager_StackFrame) ++ (RCTManagedPointer *)JS_NativeExceptionsManager_StackFrame:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeExceptionsManager_ExceptionData) ++ (RCTManagedPointer *)JS_NativeExceptionsManager_ExceptionData:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportFatalException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "reportFatalException", @selector(reportFatalException:stack:exceptionId:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportSoftException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "reportSoftException", @selector(reportSoftException:stack:exceptionId:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "reportException", @selector(reportException:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_updateExceptionMessage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "updateExceptionMessage", @selector(updateExceptionMessage:stack:exceptionId:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_dismissRedbox(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dismissRedbox", @selector(dismissRedbox), args, count); + } + + + NativeExceptionsManagerSpecJSI::NativeExceptionsManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ExceptionsManager", instance, jsInvoker) { + + methodMap_["reportFatalException"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerSpecJSI_reportFatalException}; + + + methodMap_["reportSoftException"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerSpecJSI_reportSoftException}; + + + methodMap_["reportException"] = MethodMetadata {1, __hostFunction_NativeExceptionsManagerSpecJSI_reportException}; + + setMethodArgConversionSelector(@"reportException", 0, @"JS_NativeExceptionsManager_ExceptionData:"); + + methodMap_["updateExceptionMessage"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerSpecJSI_updateExceptionMessage}; + + + methodMap_["dismissRedbox"] = MethodMetadata {0, __hostFunction_NativeExceptionsManagerSpecJSI_dismissRedbox}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeFileReaderModuleSpecJSI_readAsDataURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "readAsDataURL", @selector(readAsDataURL:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeFileReaderModuleSpecJSI_readAsText(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "readAsText", @selector(readAsText:encoding:resolve:reject:), args, count); + } + + + NativeFileReaderModuleSpecJSI::NativeFileReaderModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("FileReaderModule", instance, jsInvoker) { + + methodMap_["readAsDataURL"] = MethodMetadata {1, __hostFunction_NativeFileReaderModuleSpecJSI_readAsDataURL}; + + + methodMap_["readAsText"] = MethodMetadata {2, __hostFunction_NativeFileReaderModuleSpecJSI_readAsText}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeFrameRateLogger_SpecSetGlobalOptionsOptions) ++ (RCTManagedPointer *)JS_NativeFrameRateLogger_SpecSetGlobalOptionsOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeFrameRateLoggerSpecJSI_setGlobalOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setGlobalOptions", @selector(setGlobalOptions:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeFrameRateLoggerSpecJSI_setContext(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setContext", @selector(setContext:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeFrameRateLoggerSpecJSI_beginScroll(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "beginScroll", @selector(beginScroll), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeFrameRateLoggerSpecJSI_endScroll(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "endScroll", @selector(endScroll), args, count); + } + + + NativeFrameRateLoggerSpecJSI::NativeFrameRateLoggerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("FrameRateLogger", instance, jsInvoker) { + + methodMap_["setGlobalOptions"] = MethodMetadata {1, __hostFunction_NativeFrameRateLoggerSpecJSI_setGlobalOptions}; + + setMethodArgConversionSelector(@"setGlobalOptions", 0, @"JS_NativeFrameRateLogger_SpecSetGlobalOptionsOptions:"); + + methodMap_["setContext"] = MethodMetadata {1, __hostFunction_NativeFrameRateLoggerSpecJSI_setContext}; + + + methodMap_["beginScroll"] = MethodMetadata {0, __hostFunction_NativeFrameRateLoggerSpecJSI_beginScroll}; + + + methodMap_["endScroll"] = MethodMetadata {0, __hostFunction_NativeFrameRateLoggerSpecJSI_endScroll}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeHeadlessJsTaskSupportSpecJSI_notifyTaskFinished(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "notifyTaskFinished", @selector(notifyTaskFinished:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeHeadlessJsTaskSupportSpecJSI_notifyTaskRetry(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "notifyTaskRetry", @selector(notifyTaskRetry:resolve:reject:), args, count); + } + + + NativeHeadlessJsTaskSupportSpecJSI::NativeHeadlessJsTaskSupportSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("HeadlessJsTaskSupport", instance, jsInvoker) { + + methodMap_["notifyTaskFinished"] = MethodMetadata {1, __hostFunction_NativeHeadlessJsTaskSupportSpecJSI_notifyTaskFinished}; + + + methodMap_["notifyTaskRetry"] = MethodMetadata {1, __hostFunction_NativeHeadlessJsTaskSupportSpecJSI_notifyTaskRetry}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeHeapCaptureSpecJSI_captureHeap(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "captureHeap", @selector(captureHeap:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeHeapCaptureSpecJSI_captureComplete(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "captureComplete", @selector(captureComplete:error:), args, count); + } + + + NativeHeapCaptureSpecJSI::NativeHeapCaptureSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("HeapCapture", instance, jsInvoker) { + + methodMap_["captureHeap"] = MethodMetadata {1, __hostFunction_NativeHeapCaptureSpecJSI_captureHeap}; + + + methodMap_["captureComplete"] = MethodMetadata {2, __hostFunction_NativeHeapCaptureSpecJSI_captureComplete}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeI18nManagerSpecJSI_allowRTL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "allowRTL", @selector(allowRTL:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeI18nManagerSpecJSI_forceRTL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "forceRTL", @selector(forceRTL:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeI18nManagerSpecJSI_swapLeftAndRightInRTL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "swapLeftAndRightInRTL", @selector(swapLeftAndRightInRTL:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeI18nManagerSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeI18nManagerSpecJSI::NativeI18nManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("I18nManager", instance, jsInvoker) { + + methodMap_["allowRTL"] = MethodMetadata {1, __hostFunction_NativeI18nManagerSpecJSI_allowRTL}; + + + methodMap_["forceRTL"] = MethodMetadata {1, __hostFunction_NativeI18nManagerSpecJSI_forceRTL}; + + + methodMap_["swapLeftAndRightInRTL"] = MethodMetadata {1, __hostFunction_NativeI18nManagerSpecJSI_swapLeftAndRightInRTL}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeI18nManagerSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + + NativeImageLoaderSpecJSI::NativeImageLoaderSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ImageLoader", instance, jsInvoker) { + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeImagePickerIOS_SpecOpenCameraDialogConfig) ++ (RCTManagedPointer *)JS_NativeImagePickerIOS_SpecOpenCameraDialogConfig:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeImagePickerIOS_SpecOpenSelectDialogConfig) ++ (RCTManagedPointer *)JS_NativeImagePickerIOS_SpecOpenSelectDialogConfig:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_canRecordVideos(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "canRecordVideos", @selector(canRecordVideos:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_canUseCamera(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "canUseCamera", @selector(canUseCamera:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_openCameraDialog(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "openCameraDialog", @selector(openCameraDialog:successCallback:cancelCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_openSelectDialog(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "openSelectDialog", @selector(openSelectDialog:successCallback:cancelCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_clearAllPendingVideos(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clearAllPendingVideos", @selector(clearAllPendingVideos), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_removePendingVideo(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removePendingVideo", @selector(removePendingVideo:), args, count); + } + + + NativeImagePickerIOSSpecJSI::NativeImagePickerIOSSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ImagePickerIOS", instance, jsInvoker) { + + methodMap_["canRecordVideos"] = MethodMetadata {1, __hostFunction_NativeImagePickerIOSSpecJSI_canRecordVideos}; + + + methodMap_["canUseCamera"] = MethodMetadata {1, __hostFunction_NativeImagePickerIOSSpecJSI_canUseCamera}; + + + methodMap_["openCameraDialog"] = MethodMetadata {3, __hostFunction_NativeImagePickerIOSSpecJSI_openCameraDialog}; + + setMethodArgConversionSelector(@"openCameraDialog", 0, @"JS_NativeImagePickerIOS_SpecOpenCameraDialogConfig:"); + + methodMap_["openSelectDialog"] = MethodMetadata {3, __hostFunction_NativeImagePickerIOSSpecJSI_openSelectDialog}; + + setMethodArgConversionSelector(@"openSelectDialog", 0, @"JS_NativeImagePickerIOS_SpecOpenSelectDialogConfig:"); + + methodMap_["clearAllPendingVideos"] = MethodMetadata {0, __hostFunction_NativeImagePickerIOSSpecJSI_clearAllPendingVideos}; + + + methodMap_["removePendingVideo"] = MethodMetadata {1, __hostFunction_NativeImagePickerIOSSpecJSI_removePendingVideo}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeJSCSamplingProfilerSpecJSI_operationComplete(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "operationComplete", @selector(operationComplete:result:error:), args, count); + } + + + NativeJSCSamplingProfilerSpecJSI::NativeJSCSamplingProfilerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("JSCSamplingProfiler", instance, jsInvoker) { + + methodMap_["operationComplete"] = MethodMetadata {3, __hostFunction_NativeJSCSamplingProfilerSpecJSI_operationComplete}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeJSDevSupportSpecJSI_onSuccess(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "onSuccess", @selector(onSuccess:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeJSDevSupportSpecJSI_onFailure(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "onFailure", @selector(onFailure:error:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeJSDevSupportSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeJSDevSupportSpecJSI::NativeJSDevSupportSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("JSDevSupport", instance, jsInvoker) { + + methodMap_["onSuccess"] = MethodMetadata {1, __hostFunction_NativeJSDevSupportSpecJSI_onSuccess}; + + + methodMap_["onFailure"] = MethodMetadata {2, __hostFunction_NativeJSDevSupportSpecJSI_onFailure}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeJSDevSupportSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeKeyboardObserverSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeKeyboardObserverSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeKeyboardObserverSpecJSI::NativeKeyboardObserverSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("KeyboardObserver", instance, jsInvoker) { + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeKeyboardObserverSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeKeyboardObserverSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeLinking_SpecSendIntentExtrasElement) ++ (RCTManagedPointer *)JS_NativeLinking_SpecSendIntentExtrasElement:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_getInitialURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getInitialURL", @selector(getInitialURL:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_canOpenURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "canOpenURL", @selector(canOpenURL:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_openURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "openURL", @selector(openURL:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_openSettings(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "openSettings", @selector(openSettings:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_sendIntent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "sendIntent", @selector(sendIntent:extras:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeLinkingSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeLinkingSpecJSI::NativeLinkingSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("Linking", instance, jsInvoker) { + + methodMap_["getInitialURL"] = MethodMetadata {0, __hostFunction_NativeLinkingSpecJSI_getInitialURL}; + + + methodMap_["canOpenURL"] = MethodMetadata {1, __hostFunction_NativeLinkingSpecJSI_canOpenURL}; + + + methodMap_["openURL"] = MethodMetadata {1, __hostFunction_NativeLinkingSpecJSI_openURL}; + + + methodMap_["openSettings"] = MethodMetadata {0, __hostFunction_NativeLinkingSpecJSI_openSettings}; + + + methodMap_["sendIntent"] = MethodMetadata {2, __hostFunction_NativeLinkingSpecJSI_sendIntent}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeLinkingSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeLinkingSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeModalManagerSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeModalManagerSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeModalManagerSpecJSI::NativeModalManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ModalManager", instance, jsInvoker) { + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeModalManagerSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeModalManagerSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeNetworkingAndroid_Header) ++ (RCTManagedPointer *)JS_NativeNetworkingAndroid_Header:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_sendRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendRequest", @selector(sendRequest:url:requestId:headers:data:responseType:useIncrementalUpdates:timeout:withCredentials:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_abortRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "abortRequest", @selector(abortRequest:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_clearCookies(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clearCookies", @selector(clearCookies:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeNetworkingAndroidSpecJSI::NativeNetworkingAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("NetworkingAndroid", instance, jsInvoker) { + + methodMap_["sendRequest"] = MethodMetadata {9, __hostFunction_NativeNetworkingAndroidSpecJSI_sendRequest}; + + + methodMap_["abortRequest"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_abortRequest}; + + + methodMap_["clearCookies"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_clearCookies}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeNetworkingIOS_SpecSendRequestQuery) ++ (RCTManagedPointer *)JS_NativeNetworkingIOS_SpecSendRequestQuery:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeNetworkingIOSSpecJSI_sendRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendRequest", @selector(sendRequest:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingIOSSpecJSI_abortRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "abortRequest", @selector(abortRequest:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingIOSSpecJSI_clearCookies(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clearCookies", @selector(clearCookies:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingIOSSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeNetworkingIOSSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeNetworkingIOSSpecJSI::NativeNetworkingIOSSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("NetworkingIOS", instance, jsInvoker) { + + methodMap_["sendRequest"] = MethodMetadata {2, __hostFunction_NativeNetworkingIOSSpecJSI_sendRequest}; + + setMethodArgConversionSelector(@"sendRequest", 0, @"JS_NativeNetworkingIOS_SpecSendRequestQuery:"); + + methodMap_["abortRequest"] = MethodMetadata {1, __hostFunction_NativeNetworkingIOSSpecJSI_abortRequest}; + + + methodMap_["clearCookies"] = MethodMetadata {1, __hostFunction_NativeNetworkingIOSSpecJSI_clearCookies}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeNetworkingIOSSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeNetworkingIOSSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_checkPermission(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "checkPermission", @selector(checkPermission:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_requestPermission(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "requestPermission", @selector(requestPermission:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_shouldShowRequestPermissionRationale(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "shouldShowRequestPermissionRationale", @selector(shouldShowRequestPermissionRationale:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_requestMultiplePermissions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "requestMultiplePermissions", @selector(requestMultiplePermissions:resolve:reject:), args, count); + } + + + NativePermissionsAndroidSpecJSI::NativePermissionsAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("PermissionsAndroid", instance, jsInvoker) { + + methodMap_["checkPermission"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_checkPermission}; + + + methodMap_["requestPermission"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_requestPermission}; + + + methodMap_["shouldShowRequestPermissionRationale"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_shouldShowRequestPermissionRationale}; + + + methodMap_["requestMultiplePermissions"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_requestMultiplePermissions}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativePlatformConstantsAndroidSpecJSI_getAndroidID(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, StringKind, "getAndroidID", @selector(getAndroidID), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePlatformConstantsAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativePlatformConstantsAndroidSpecJSI::NativePlatformConstantsAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("PlatformConstantsAndroid", instance, jsInvoker) { + + methodMap_["getAndroidID"] = MethodMetadata {0, __hostFunction_NativePlatformConstantsAndroidSpecJSI_getAndroidID}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativePlatformConstantsAndroidSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativePlatformConstantsIOSSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativePlatformConstantsIOSSpecJSI::NativePlatformConstantsIOSSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("PlatformConstantsIOS", instance, jsInvoker) { + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativePlatformConstantsIOSSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativePushNotificationManagerIOS_SpecRequestPermissionsPermission) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_SpecRequestPermissionsPermission:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativePushNotificationManagerIOS_Permissions) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_Permissions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativePushNotificationManagerIOS_Notification) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_Notification:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_onFinishRemoteNotification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "onFinishRemoteNotification", @selector(onFinishRemoteNotification:fetchResult:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_setApplicationIconBadgeNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setApplicationIconBadgeNumber", @selector(setApplicationIconBadgeNumber:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_getApplicationIconBadgeNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getApplicationIconBadgeNumber", @selector(getApplicationIconBadgeNumber:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_requestPermissions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "requestPermissions", @selector(requestPermissions:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_abandonPermissions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "abandonPermissions", @selector(abandonPermissions), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_checkPermissions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "checkPermissions", @selector(checkPermissions:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_presentLocalNotification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "presentLocalNotification", @selector(presentLocalNotification:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_scheduleLocalNotification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "scheduleLocalNotification", @selector(scheduleLocalNotification:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_cancelAllLocalNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "cancelAllLocalNotifications", @selector(cancelAllLocalNotifications), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_cancelLocalNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "cancelLocalNotifications", @selector(cancelLocalNotifications:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_getInitialNotification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getInitialNotification", @selector(getInitialNotification:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_getScheduledLocalNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getScheduledLocalNotifications", @selector(getScheduledLocalNotifications:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeAllDeliveredNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeAllDeliveredNotifications", @selector(removeAllDeliveredNotifications), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeDeliveredNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeDeliveredNotifications", @selector(removeDeliveredNotifications:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_getDeliveredNotifications(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getDeliveredNotifications", @selector(getDeliveredNotifications:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativePushNotificationManagerIOSSpecJSI::NativePushNotificationManagerIOSSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("PushNotificationManagerIOS", instance, jsInvoker) { + + methodMap_["onFinishRemoteNotification"] = MethodMetadata {2, __hostFunction_NativePushNotificationManagerIOSSpecJSI_onFinishRemoteNotification}; + + + methodMap_["setApplicationIconBadgeNumber"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_setApplicationIconBadgeNumber}; + + + methodMap_["getApplicationIconBadgeNumber"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_getApplicationIconBadgeNumber}; + + + methodMap_["requestPermissions"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_requestPermissions}; + + setMethodArgConversionSelector(@"requestPermissions", 0, @"JS_NativePushNotificationManagerIOS_SpecRequestPermissionsPermission:"); + + methodMap_["abandonPermissions"] = MethodMetadata {0, __hostFunction_NativePushNotificationManagerIOSSpecJSI_abandonPermissions}; + + + methodMap_["checkPermissions"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_checkPermissions}; + + + methodMap_["presentLocalNotification"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_presentLocalNotification}; + + setMethodArgConversionSelector(@"presentLocalNotification", 0, @"JS_NativePushNotificationManagerIOS_Notification:"); + + methodMap_["scheduleLocalNotification"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_scheduleLocalNotification}; + + setMethodArgConversionSelector(@"scheduleLocalNotification", 0, @"JS_NativePushNotificationManagerIOS_Notification:"); + + methodMap_["cancelAllLocalNotifications"] = MethodMetadata {0, __hostFunction_NativePushNotificationManagerIOSSpecJSI_cancelAllLocalNotifications}; + + + methodMap_["cancelLocalNotifications"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_cancelLocalNotifications}; + + + methodMap_["getInitialNotification"] = MethodMetadata {0, __hostFunction_NativePushNotificationManagerIOSSpecJSI_getInitialNotification}; + + + methodMap_["getScheduledLocalNotifications"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_getScheduledLocalNotifications}; + + + methodMap_["removeAllDeliveredNotifications"] = MethodMetadata {0, __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeAllDeliveredNotifications}; + + + methodMap_["removeDeliveredNotifications"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeDeliveredNotifications}; + + + methodMap_["getDeliveredNotifications"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_getDeliveredNotifications}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativePushNotificationManagerIOSSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeRedBoxSpecJSI_setExtraData(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setExtraData", @selector(setExtraData:identifier:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeRedBoxSpecJSI_dismiss(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dismiss", @selector(dismiss), args, count); + } + + + NativeRedBoxSpecJSI::NativeRedBoxSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("RedBox", instance, jsInvoker) { + + methodMap_["setExtraData"] = MethodMetadata {2, __hostFunction_NativeRedBoxSpecJSI_setExtraData}; + + + methodMap_["dismiss"] = MethodMetadata {0, __hostFunction_NativeRedBoxSpecJSI_dismiss}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeSegmentFetcherSpecJSI_fetchSegment(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "fetchSegment", @selector(fetchSegment:options:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeSegmentFetcherSpecJSI_getSegment(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getSegment", @selector(getSegment:options:callback:), args, count); + } + + + NativeSegmentFetcherSpecJSI::NativeSegmentFetcherSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("SegmentFetcher", instance, jsInvoker) { + + methodMap_["fetchSegment"] = MethodMetadata {3, __hostFunction_NativeSegmentFetcherSpecJSI_fetchSegment}; + + + methodMap_["getSegment"] = MethodMetadata {3, __hostFunction_NativeSegmentFetcherSpecJSI_getSegment}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeSettingsManagerSpecJSI_setValues(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setValues", @selector(setValues:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeSettingsManagerSpecJSI_deleteValues(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "deleteValues", @selector(deleteValues:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeSettingsManagerSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeSettingsManagerSpecJSI::NativeSettingsManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("SettingsManager", instance, jsInvoker) { + + methodMap_["setValues"] = MethodMetadata {1, __hostFunction_NativeSettingsManagerSpecJSI_setValues}; + + + methodMap_["deleteValues"] = MethodMetadata {1, __hostFunction_NativeSettingsManagerSpecJSI_deleteValues}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSettingsManagerSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeShareModule_SpecShareContent) ++ (RCTManagedPointer *)JS_NativeShareModule_SpecShareContent:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeShareModuleSpecJSI_share(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "share", @selector(share:dialogTitle:resolve:reject:), args, count); + } + + + NativeShareModuleSpecJSI::NativeShareModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ShareModule", instance, jsInvoker) { + + methodMap_["share"] = MethodMetadata {2, __hostFunction_NativeShareModuleSpecJSI_share}; + + setMethodArgConversionSelector(@"share", 0, @"JS_NativeShareModule_SpecShareContent:"); + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeSoundManagerSpecJSI_playTouchSound(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "playTouchSound", @selector(playTouchSound), args, count); + } + + + NativeSoundManagerSpecJSI::NativeSoundManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("SoundManager", instance, jsInvoker) { + + methodMap_["playTouchSound"] = MethodMetadata {0, __hostFunction_NativeSoundManagerSpecJSI_playTouchSound}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeSourceCodeSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeSourceCodeSpecJSI::NativeSourceCodeSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("SourceCode", instance, jsInvoker) { + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSourceCodeSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeStatusBarManager_SpecGetHeightCallbackResult) ++ (RCTManagedPointer *)JS_NativeStatusBarManager_SpecGetHeightCallbackResult:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_setColor(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setColor", @selector(setColor:animated:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_setTranslucent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setTranslucent", @selector(setTranslucent:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_getHeight(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getHeight", @selector(getHeight:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_setNetworkActivityIndicatorVisible(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setNetworkActivityIndicatorVisible", @selector(setNetworkActivityIndicatorVisible:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_setStyle(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setStyle", @selector(setStyle:animated:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_setHidden(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setHidden", @selector(setHidden:withAnimation:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeStatusBarManagerSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeStatusBarManagerSpecJSI::NativeStatusBarManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("StatusBarManager", instance, jsInvoker) { + + methodMap_["setColor"] = MethodMetadata {2, __hostFunction_NativeStatusBarManagerSpecJSI_setColor}; + + + methodMap_["setTranslucent"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerSpecJSI_setTranslucent}; + + + methodMap_["getHeight"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerSpecJSI_getHeight}; + + + methodMap_["setNetworkActivityIndicatorVisible"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerSpecJSI_setNetworkActivityIndicatorVisible}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerSpecJSI_removeListeners}; + + + methodMap_["setStyle"] = MethodMetadata {2, __hostFunction_NativeStatusBarManagerSpecJSI_setStyle}; + + + methodMap_["setHidden"] = MethodMetadata {2, __hostFunction_NativeStatusBarManagerSpecJSI_setHidden}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeStatusBarManagerSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeTVNavigationEventEmitterSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeTVNavigationEventEmitterSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeTVNavigationEventEmitterSpecJSI::NativeTVNavigationEventEmitterSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("TVNavigationEventEmitter", instance, jsInvoker) { + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeTVNavigationEventEmitterSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeTVNavigationEventEmitterSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeTimePickerAndroid_TimePickerOptions) ++ (RCTManagedPointer *)JS_NativeTimePickerAndroid_TimePickerOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeTimePickerAndroidSpecJSI_open(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "open", @selector(open:resolve:reject:), args, count); + } + + + NativeTimePickerAndroidSpecJSI::NativeTimePickerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("TimePickerAndroid", instance, jsInvoker) { + + methodMap_["open"] = MethodMetadata {1, __hostFunction_NativeTimePickerAndroidSpecJSI_open}; + + setMethodArgConversionSelector(@"open", 0, @"JS_NativeTimePickerAndroid_TimePickerOptions:"); + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeTimePickerAndroid_TimePickerResult) ++ (RCTManagedPointer *)JS_NativeTimePickerAndroid_TimePickerResult:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeTimingSpecJSI_createTimer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createTimer", @selector(createTimer:duration:jsSchedulingTime:repeats:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeTimingSpecJSI_deleteTimer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "deleteTimer", @selector(deleteTimer:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeTimingSpecJSI_setSendIdleEvents(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setSendIdleEvents", @selector(setSendIdleEvents:), args, count); + } + + + NativeTimingSpecJSI::NativeTimingSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("Timing", instance, jsInvoker) { + + methodMap_["createTimer"] = MethodMetadata {4, __hostFunction_NativeTimingSpecJSI_createTimer}; + + + methodMap_["deleteTimer"] = MethodMetadata {1, __hostFunction_NativeTimingSpecJSI_deleteTimer}; + + + methodMap_["setSendIdleEvents"] = MethodMetadata {1, __hostFunction_NativeTimingSpecJSI_setSendIdleEvents}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_show(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "show", @selector(show:duration:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_showWithGravity(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showWithGravity", @selector(showWithGravity:duration:gravity:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_showWithGravityAndOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showWithGravityAndOffset", @selector(showWithGravityAndOffset:duration:gravity:xOffset:yOffset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeToastAndroidSpecJSI::NativeToastAndroidSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("ToastAndroid", instance, jsInvoker) { + + methodMap_["show"] = MethodMetadata {2, __hostFunction_NativeToastAndroidSpecJSI_show}; + + + methodMap_["showWithGravity"] = MethodMetadata {3, __hostFunction_NativeToastAndroidSpecJSI_showWithGravity}; + + + methodMap_["showWithGravityAndOffset"] = MethodMetadata {5, __hostFunction_NativeToastAndroidSpecJSI_showWithGravityAndOffset}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeToastAndroidSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_getConstantsForViewManager(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstantsForViewManager", @selector(getConstantsForViewManager:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_getDefaultEventTypes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ArrayKind, "getDefaultEventTypes", @selector(getDefaultEventTypes), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_playTouchSound(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "playTouchSound", @selector(playTouchSound), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_lazilyLoadView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "lazilyLoadView", @selector(lazilyLoadView:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_createView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createView", @selector(createView:viewName:rootTag:props:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_updateView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "updateView", @selector(updateView:viewName:props:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_focus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "focus", @selector(focus:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_blur(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "blur", @selector(blur:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_findSubviewIn(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "findSubviewIn", @selector(findSubviewIn:point:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_dispatchViewManagerCommand(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dispatchViewManagerCommand", @selector(dispatchViewManagerCommand:commandID:commandArgs:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_measure(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "measure", @selector(measure:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_measureInWindow(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "measureInWindow", @selector(measureInWindow:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_viewIsDescendantOf(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "viewIsDescendantOf", @selector(viewIsDescendantOf:ancestorReactTag:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_measureLayout(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "measureLayout", @selector(measureLayout:ancestorReactTag:errorCallback:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_measureLayoutRelativeToParent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "measureLayoutRelativeToParent", @selector(measureLayoutRelativeToParent:errorCallback:callback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_setJSResponder(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setJSResponder", @selector(setJSResponder:blockNativeResponder:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_clearJSResponder(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clearJSResponder", @selector(clearJSResponder), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_configureNextLayoutAnimation(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "configureNextLayoutAnimation", @selector(configureNextLayoutAnimation:callback:errorCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_removeSubviewsFromContainerWithID(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeSubviewsFromContainerWithID", @selector(removeSubviewsFromContainerWithID:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_replaceExistingNonRootView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "replaceExistingNonRootView", @selector(replaceExistingNonRootView:newReactTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_setChildren(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setChildren", @selector(setChildren:reactTags:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_manageChildren(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "manageChildren", @selector(manageChildren:moveFromIndices:moveToIndices:addChildReactTags:addAtIndices:removeAtIndices:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_setLayoutAnimationEnabledExperimental(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setLayoutAnimationEnabledExperimental", @selector(setLayoutAnimationEnabledExperimental:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_sendAccessibilityEvent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendAccessibilityEvent", @selector(sendAccessibilityEvent:eventType:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_showPopupMenu(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showPopupMenu", @selector(showPopupMenu:items:error:success:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_dismissPopupMenu(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dismissPopupMenu", @selector(dismissPopupMenu), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeUIManagerSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); + } + + + NativeUIManagerSpecJSI::NativeUIManagerSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("UIManager", instance, jsInvoker) { + + methodMap_["getConstantsForViewManager"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_getConstantsForViewManager}; + + + methodMap_["getDefaultEventTypes"] = MethodMetadata {0, __hostFunction_NativeUIManagerSpecJSI_getDefaultEventTypes}; + + + methodMap_["playTouchSound"] = MethodMetadata {0, __hostFunction_NativeUIManagerSpecJSI_playTouchSound}; + + + methodMap_["lazilyLoadView"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_lazilyLoadView}; + + + methodMap_["createView"] = MethodMetadata {4, __hostFunction_NativeUIManagerSpecJSI_createView}; + + + methodMap_["updateView"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_updateView}; + + + methodMap_["focus"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_focus}; + + + methodMap_["blur"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_blur}; + + + methodMap_["findSubviewIn"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_findSubviewIn}; + + + methodMap_["dispatchViewManagerCommand"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_dispatchViewManagerCommand}; + + + methodMap_["measure"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_measure}; + + + methodMap_["measureInWindow"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_measureInWindow}; + + + methodMap_["viewIsDescendantOf"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_viewIsDescendantOf}; + + + methodMap_["measureLayout"] = MethodMetadata {4, __hostFunction_NativeUIManagerSpecJSI_measureLayout}; + + + methodMap_["measureLayoutRelativeToParent"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_measureLayoutRelativeToParent}; + + + methodMap_["setJSResponder"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_setJSResponder}; + + + methodMap_["clearJSResponder"] = MethodMetadata {0, __hostFunction_NativeUIManagerSpecJSI_clearJSResponder}; + + + methodMap_["configureNextLayoutAnimation"] = MethodMetadata {3, __hostFunction_NativeUIManagerSpecJSI_configureNextLayoutAnimation}; + + + methodMap_["removeSubviewsFromContainerWithID"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_removeSubviewsFromContainerWithID}; + + + methodMap_["replaceExistingNonRootView"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_replaceExistingNonRootView}; + + + methodMap_["setChildren"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_setChildren}; + + + methodMap_["manageChildren"] = MethodMetadata {6, __hostFunction_NativeUIManagerSpecJSI_manageChildren}; + + + methodMap_["setLayoutAnimationEnabledExperimental"] = MethodMetadata {1, __hostFunction_NativeUIManagerSpecJSI_setLayoutAnimationEnabledExperimental}; + + + methodMap_["sendAccessibilityEvent"] = MethodMetadata {2, __hostFunction_NativeUIManagerSpecJSI_sendAccessibilityEvent}; + + + methodMap_["showPopupMenu"] = MethodMetadata {4, __hostFunction_NativeUIManagerSpecJSI_showPopupMenu}; + + + methodMap_["dismissPopupMenu"] = MethodMetadata {0, __hostFunction_NativeUIManagerSpecJSI_dismissPopupMenu}; + + + methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeUIManagerSpecJSI_getConstants}; + + + + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeVibrationSpecJSI_vibrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "vibrate", @selector(vibrate:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeVibrationSpecJSI_vibrateByPattern(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "vibrateByPattern", @selector(vibrateByPattern:repeat:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeVibrationSpecJSI_cancel(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "cancel", @selector(cancel), args, count); + } + + + NativeVibrationSpecJSI::NativeVibrationSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("Vibration", instance, jsInvoker) { + + methodMap_["vibrate"] = MethodMetadata {1, __hostFunction_NativeVibrationSpecJSI_vibrate}; + + + methodMap_["vibrateByPattern"] = MethodMetadata {2, __hostFunction_NativeVibrationSpecJSI_vibrateByPattern}; + + + methodMap_["cancel"] = MethodMetadata {0, __hostFunction_NativeVibrationSpecJSI_cancel}; + + + + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeWebSocketModule_SpecConnectOptionsHeaders) ++ (RCTManagedPointer *)JS_NativeWebSocketModule_SpecConnectOptionsHeaders:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeWebSocketModule_SpecConnectOptions) ++ (RCTManagedPointer *)JS_NativeWebSocketModule_SpecConnectOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_connect(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "connect", @selector(connect:protocols:options:socketID:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_send(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "send", @selector(send:socketID:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_sendBinary(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendBinary", @selector(sendBinary:socketID:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_ping(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "ping", @selector(ping:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_close(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "close", @selector(close:reason:socketID:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeWebSocketModuleSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeWebSocketModuleSpecJSI::NativeWebSocketModuleSpecJSI(id instance, std::shared_ptr jsInvoker) + : ObjCTurboModule("WebSocketModule", instance, jsInvoker) { + + methodMap_["connect"] = MethodMetadata {4, __hostFunction_NativeWebSocketModuleSpecJSI_connect}; + + setMethodArgConversionSelector(@"connect", 2, @"JS_NativeWebSocketModule_SpecConnectOptions:"); + + methodMap_["send"] = MethodMetadata {2, __hostFunction_NativeWebSocketModuleSpecJSI_send}; + + + methodMap_["sendBinary"] = MethodMetadata {2, __hostFunction_NativeWebSocketModuleSpecJSI_sendBinary}; + + + methodMap_["ping"] = MethodMetadata {1, __hostFunction_NativeWebSocketModuleSpecJSI_ping}; + + + methodMap_["close"] = MethodMetadata {3, __hostFunction_NativeWebSocketModuleSpecJSI_close}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeWebSocketModuleSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeWebSocketModuleSpecJSI_removeListeners}; + + + + } + + } // namespace react +} // namespace facebook diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h new file mode 100644 index 00000000000000..617ec6a9683b84 --- /dev/null +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -0,0 +1,3100 @@ +/** + * 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. + * + * @generated by an internal genrule from Flow types. + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#ifndef __cplusplus +#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. +#endif +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + + +@protocol NativeAccessibilityInfoSpec + +- (void)isReduceMotionEnabled:(RCTResponseSenderBlock)onSuccess; +- (void)isTouchExplorationEnabled:(RCTResponseSenderBlock)onSuccess; +- (void)setAccessibilityFocus:(double)reactTag; +- (void)announceForAccessibility:(NSString *)announcement; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AccessibilityInfo' + */ + + class JSI_EXPORT NativeAccessibilityInfoSpecJSI : public ObjCTurboModule { + public: + NativeAccessibilityInfoSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeAccessibilityManager { + struct SpecSetAccessibilityContentSizeMultipliersJSMultiipliers { + folly::Optional extraSmall() const; + folly::Optional small() const; + folly::Optional medium() const; + folly::Optional large() const; + folly::Optional extraLarge() const; + folly::Optional extraExtraLarge() const; + folly::Optional extraExtraExtraLarge() const; + folly::Optional accessibilityMedium() const; + folly::Optional accessibilityLarge() const; + folly::Optional accessibilityExtraLarge() const; + folly::Optional accessibilityExtraExtraLarge() const; + folly::Optional accessibilityExtraExtraExtraLarge() const; + + SpecSetAccessibilityContentSizeMultipliersJSMultiipliers(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAccessibilityManager_SpecSetAccessibilityContentSizeMultipliersJSMultiipliers) ++ (RCTManagedPointer *)JS_NativeAccessibilityManager_SpecSetAccessibilityContentSizeMultipliersJSMultiipliers:(id)json; +@end +@protocol NativeAccessibilityManagerSpec + +- (void)getCurrentBoldTextState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)getCurrentGrayscaleState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)getCurrentInvertColorsState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)getCurrentReduceMotionState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)getCurrentReduceTransparencyState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)getCurrentVoiceOverState:(RCTResponseSenderBlock)onSuccess + onError:(RCTResponseSenderBlock)onError; +- (void)setAccessibilityContentSizeMultipliers:(JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers &)JSMultiipliers; +- (void)setAccessibilityFocus:(double)reactTag; +- (void)announceForAccessibility:(NSString *)announcement; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AccessibilityManager' + */ + + class JSI_EXPORT NativeAccessibilityManagerSpecJSI : public ObjCTurboModule { + public: + NativeAccessibilityManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeActionSheetManager { + struct SpecShowActionSheetWithOptionsOptions { + NSString *title() const; + NSString *message() const; + folly::Optional> options() const; + folly::Optional destructiveButtonIndex() const; + folly::Optional cancelButtonIndex() const; + folly::Optional anchor() const; + folly::Optional tintColor() const; + + SpecShowActionSheetWithOptionsOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeActionSheetManager_SpecShowActionSheetWithOptionsOptions) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowActionSheetWithOptionsOptions:(id)json; +@end + +namespace JS { + namespace NativeActionSheetManager { + struct SpecShowShareActionSheetWithOptionsOptions { + NSString *message() const; + NSString *url() const; + NSString *subject() const; + folly::Optional anchor() const; + folly::Optional tintColor() const; + folly::Optional> excludedActivityTypes() const; + + SpecShowShareActionSheetWithOptionsOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeActionSheetManager_SpecShowShareActionSheetWithOptionsOptions) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowShareActionSheetWithOptionsOptions:(id)json; +@end + +namespace JS { + namespace NativeActionSheetManager { + struct SpecShowShareActionSheetWithOptionsFailureCallbackError { + NSString *domain() const; + NSString *code() const; + id _Nullable userInfo() const; + NSString *message() const; + + SpecShowShareActionSheetWithOptionsFailureCallbackError(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeActionSheetManager_SpecShowShareActionSheetWithOptionsFailureCallbackError) ++ (RCTManagedPointer *)JS_NativeActionSheetManager_SpecShowShareActionSheetWithOptionsFailureCallbackError:(id)json; +@end +@protocol NativeActionSheetManagerSpec + +- (void)showActionSheetWithOptions:(JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions &)options + callback:(RCTResponseSenderBlock)callback; +- (void)showShareActionSheetWithOptions:(JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions &)options + failureCallback:(RCTResponseSenderBlock)failureCallback + successCallback:(RCTResponseSenderBlock)successCallback; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ActionSheetManager' + */ + + class JSI_EXPORT NativeActionSheetManagerSpecJSI : public ObjCTurboModule { + public: + NativeActionSheetManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeAlertManager { + struct Args { + NSString *title() const; + NSString *message() const; + id _Nullable buttons() const; + NSString *type() const; + NSString *defaultValue() const; + NSString *cancelButtonKey() const; + NSString *destructiveButtonKey() const; + NSString *keyboardType() const; + + Args(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAlertManager_Args) ++ (RCTManagedPointer *)JS_NativeAlertManager_Args:(id)json; +@end +@protocol NativeAlertManagerSpec + +- (void)alertWithArgs:(JS::NativeAlertManager::Args &)args + callback:(RCTResponseSenderBlock)callback; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AlertManager' + */ + + class JSI_EXPORT NativeAlertManagerSpecJSI : public ObjCTurboModule { + public: + NativeAlertManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeAnimatedModule { + struct AnimatedNodeConfig { + NSString *type() const; + + AnimatedNodeConfig(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedModule_AnimatedNodeConfig) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_AnimatedNodeConfig:(id)json; +@end + +namespace JS { + namespace NativeAnimatedModule { + struct AnimatingNodeConfig { + NSString *type() const; + + AnimatingNodeConfig(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedModule_AnimatingNodeConfig) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_AnimatingNodeConfig:(id)json; +@end + +namespace JS { + namespace NativeAnimatedModule { + struct EndResult { + bool finished() const; + + EndResult(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedModule_EndResult) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_EndResult:(id)json; +@end + +namespace JS { + namespace NativeAnimatedModule { + struct EventMapping { + facebook::react::LazyVector nativeEventPath() const; + folly::Optional animatedValueTag() const; + + EventMapping(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedModule_EventMapping) ++ (RCTManagedPointer *)JS_NativeAnimatedModule_EventMapping:(id)json; +@end +@protocol NativeAnimatedModuleSpec + +- (void)createAnimatedNode:(NSNumber *)tag + config:(JS::NativeAnimatedModule::AnimatedNodeConfig &)config; +- (void)startListeningToAnimatedNodeValue:(NSNumber *)tag; +- (void)stopListeningToAnimatedNodeValue:(NSNumber *)tag; +- (void)connectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag; +- (void)disconnectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag; +- (void)startAnimatingNode:(NSNumber *)animationId + nodeTag:(NSNumber *)nodeTag + config:(JS::NativeAnimatedModule::AnimatingNodeConfig &)config + endCallback:(RCTResponseSenderBlock)endCallback; +- (void)stopAnimation:(NSNumber *)animationId; +- (void)setAnimatedNodeValue:(NSNumber *)nodeTag + value:(NSNumber *)value; +- (void)setAnimatedNodeOffset:(NSNumber *)nodeTag + offset:(NSNumber *)offset; +- (void)flattenAnimatedNodeOffset:(NSNumber *)nodeTag; +- (void)extractAnimatedNodeOffset:(NSNumber *)nodeTag; +- (void)connectAnimatedNodeToView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag; +- (void)disconnectAnimatedNodeFromView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag; +- (void)dropAnimatedNode:(NSNumber *)tag; +- (void)addAnimatedEventToView:(NSNumber *)viewTag + eventName:(NSString *)eventName + eventMapping:(JS::NativeAnimatedModule::EventMapping &)eventMapping; +- (void)removeAnimatedEventFromView:(NSNumber *)viewTag + eventName:(NSString *)eventName + animatedNodeTag:(NSNumber *)animatedNodeTag; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AnimatedModule' + */ + + class JSI_EXPORT NativeAnimatedModuleSpecJSI : public ObjCTurboModule { + public: + NativeAnimatedModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeAnimationsDebugModuleSpec + +- (void)startRecordingFps; +- (void)stopRecordingFps:(double)animationStopTimeMs; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AnimationsDebugModule' + */ + + class JSI_EXPORT NativeAnimationsDebugModuleSpecJSI : public ObjCTurboModule { + public: + NativeAnimationsDebugModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeAppState { + struct SpecGetCurrentAppStateSuccessAppState { + NSString *app_state() const; + + SpecGetCurrentAppStateSuccessAppState(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAppState_SpecGetCurrentAppStateSuccessAppState) ++ (RCTManagedPointer *)JS_NativeAppState_SpecGetCurrentAppStateSuccessAppState:(id)json; +@end + +namespace JS { + namespace NativeAppState { + struct Constants { + + struct Builder { + struct Input { + RCTRequired initialAppState; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeAppStateSpec + +- (void)getCurrentAppState:(RCTResponseSenderBlock)success + failure:(RCTResponseSenderBlock)failure; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AppState' + */ + + class JSI_EXPORT NativeAppStateSpecJSI : public ObjCTurboModule { + public: + NativeAppStateSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeAsyncStorage { + struct SpecMultiGetCallbackErrorsElement { + NSString *message() const; + + SpecMultiGetCallbackErrorsElement(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecMultiGetCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiGetCallbackErrorsElement:(id)json; +@end + +namespace JS { + namespace NativeAsyncStorage { + struct SpecMultiSetCallbackErrorsElement { + NSString *message() const; + + SpecMultiSetCallbackErrorsElement(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecMultiSetCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiSetCallbackErrorsElement:(id)json; +@end + +namespace JS { + namespace NativeAsyncStorage { + struct SpecMultiMergeCallbackErrorsElement { + NSString *message() const; + + SpecMultiMergeCallbackErrorsElement(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecMultiMergeCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiMergeCallbackErrorsElement:(id)json; +@end + +namespace JS { + namespace NativeAsyncStorage { + struct SpecMultiRemoveCallbackErrorsElement { + NSString *message() const; + + SpecMultiRemoveCallbackErrorsElement(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecMultiRemoveCallbackErrorsElement) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecMultiRemoveCallbackErrorsElement:(id)json; +@end + +namespace JS { + namespace NativeAsyncStorage { + struct SpecClearCallbackError { + NSString *message() const; + + SpecClearCallbackError(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecClearCallbackError) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecClearCallbackError:(id)json; +@end + +namespace JS { + namespace NativeAsyncStorage { + struct SpecGetAllKeysCallbackError { + NSString *message() const; + + SpecGetAllKeysCallbackError(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAsyncStorage_SpecGetAllKeysCallbackError) ++ (RCTManagedPointer *)JS_NativeAsyncStorage_SpecGetAllKeysCallbackError:(id)json; +@end +@protocol NativeAsyncStorageSpec + +- (void)multiGet:(NSArray *)keys + callback:(RCTResponseSenderBlock)callback; +- (void)multiSet:(NSArray *)kvPairs + callback:(RCTResponseSenderBlock)callback; +- (void)multiMerge:(NSArray *)kvPairs + callback:(RCTResponseSenderBlock)callback; +- (void)multiRemove:(NSArray *)keys + callback:(RCTResponseSenderBlock)callback; +- (void)clear:(RCTResponseSenderBlock)callback; +- (void)getAllKeys:(RCTResponseSenderBlock)callback; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AsyncStorage' + */ + + class JSI_EXPORT NativeAsyncStorageSpecJSI : public ObjCTurboModule { + public: + NativeAsyncStorageSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeBlobModule { + struct Constants { + + struct Builder { + struct Input { + RCTRequired BLOB_URI_SCHEME; + RCTRequired BLOB_URI_HOST; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeBlobModuleSpec + +- (void)addNetworkingHandler; +- (void)addWebSocketHandler:(double)id; +- (void)removeWebSocketHandler:(double)id; +- (void)sendOverSocket:(NSDictionary *)blob + id:(double)id; +- (void)createFromParts:(NSArray *)parts + blobId:(NSString *)blobId; +- (void)release:(NSString *)blobId; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'BlobModule' + */ + + class JSI_EXPORT NativeBlobModuleSpecJSI : public ObjCTurboModule { + public: + NativeBlobModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeBugReportingSpec + +- (void)startReportAProblemFlow; +- (void)setExtraData:(NSDictionary *)extraData + extraFiles:(NSDictionary *)extraFiles; +- (void)setCategoryID:(NSString *)categoryID; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'BugReporting' + */ + + class JSI_EXPORT NativeBugReportingSpecJSI : public ObjCTurboModule { + public: + NativeBugReportingSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeClipboardSpec + +- (void)getString:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)setString:(NSString *)content; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'Clipboard' + */ + + class JSI_EXPORT NativeClipboardSpecJSI : public ObjCTurboModule { + public: + NativeClipboardSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeDatePickerAndroidSpec + +- (void)open:(NSDictionary *)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DatePickerAndroid' + */ + + class JSI_EXPORT NativeDatePickerAndroidSpecJSI : public ObjCTurboModule { + public: + NativeDatePickerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeDevLoadingViewSpec + +- (void)showMessage:(NSString *)message + color:(NSDictionary *)color + backgroundColor:(NSDictionary *)backgroundColor; +- (void)hide; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DevLoadingView' + */ + + class JSI_EXPORT NativeDevLoadingViewSpecJSI : public ObjCTurboModule { + public: + NativeDevLoadingViewSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeDevSettingsSpec + +- (void)reload; +- (void)setHotLoadingEnabled:(BOOL)isHotLoadingEnabled; +- (void)setIsDebuggingRemotely:(BOOL)isDebuggingRemotelyEnabled; +- (void)setLiveReloadEnabled:(BOOL)isLiveReloadEnabled; +- (void)setProfilingEnabled:(BOOL)isProfilingEnabled; +- (void)toggleElementInspector; +- (void)setIsShakeToShowDevMenuEnabled:(BOOL)enabled; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DevSettings' + */ + + class JSI_EXPORT NativeDevSettingsSpecJSI : public ObjCTurboModule { + public: + NativeDevSettingsSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeDeviceEventManagerSpec + +- (void)invokeDefaultBackPressHandler; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DeviceEventManager' + */ + + class JSI_EXPORT NativeDeviceEventManagerSpecJSI : public ObjCTurboModule { + public: + NativeDeviceEventManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeDeviceInfo { + struct Constants { + + struct Builder { + struct Input { + RCTRequired> Dimensions; + folly::Optional isIPhoneX_deprecated; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeDeviceInfoSpec + +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DeviceInfo' + */ + + class JSI_EXPORT NativeDeviceInfoSpecJSI : public ObjCTurboModule { + public: + NativeDeviceInfoSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeDialogManagerAndroid { + struct DialogOptions { + NSString *title() const; + NSString *message() const; + NSString *buttonPositive() const; + NSString *buttonNegative() const; + NSString *buttonNeutral() const; + folly::Optional> items() const; + folly::Optional cancelable() const; + + DialogOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeDialogManagerAndroid_DialogOptions) ++ (RCTManagedPointer *)JS_NativeDialogManagerAndroid_DialogOptions:(id)json; +@end + +namespace JS { + namespace NativeDialogManagerAndroid { + struct Constants { + + struct Builder { + struct Input { + RCTRequired buttonClicked; + RCTRequired dismissed; + RCTRequired buttonPositive; + RCTRequired buttonNegative; + RCTRequired buttonNeutral; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeDialogManagerAndroidSpec + +- (void)showAlert:(JS::NativeDialogManagerAndroid::DialogOptions &)config + onError:(RCTResponseSenderBlock)onError + onAction:(RCTResponseSenderBlock)onAction; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'DialogManagerAndroid' + */ + + class JSI_EXPORT NativeDialogManagerAndroidSpecJSI : public ObjCTurboModule { + public: + NativeDialogManagerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeExceptionsManager { + struct StackFrame { + folly::Optional column() const; + NSString *file() const; + folly::Optional lineNumber() const; + NSString *methodName() const; + folly::Optional collapse() const; + + StackFrame(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeExceptionsManager_StackFrame) ++ (RCTManagedPointer *)JS_NativeExceptionsManager_StackFrame:(id)json; +@end + +namespace JS { + namespace NativeExceptionsManager { + struct ExceptionData { + NSString *message() const; + NSString *originalMessage() const; + NSString *name() const; + NSString *componentStack() const; + facebook::react::LazyVector stack() const; + double id_() const; + bool isFatal() const; + id _Nullable extraData() const; + + ExceptionData(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeExceptionsManager_ExceptionData) ++ (RCTManagedPointer *)JS_NativeExceptionsManager_ExceptionData:(id)json; +@end +@protocol NativeExceptionsManagerSpec + +- (void)reportFatalException:(NSString *)message + stack:(NSArray *)stack + exceptionId:(double)exceptionId; +- (void)reportSoftException:(NSString *)message + stack:(NSArray *)stack + exceptionId:(double)exceptionId; +- (void)reportException:(JS::NativeExceptionsManager::ExceptionData &)data; +- (void)updateExceptionMessage:(NSString *)message + stack:(NSArray *)stack + exceptionId:(double)exceptionId; +- (void)dismissRedbox; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ExceptionsManager' + */ + + class JSI_EXPORT NativeExceptionsManagerSpecJSI : public ObjCTurboModule { + public: + NativeExceptionsManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeFileReaderModuleSpec + +- (void)readAsDataURL:(NSDictionary *)data + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)readAsText:(NSDictionary *)data + encoding:(NSString *)encoding + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'FileReaderModule' + */ + + class JSI_EXPORT NativeFileReaderModuleSpecJSI : public ObjCTurboModule { + public: + NativeFileReaderModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeFrameRateLogger { + struct SpecSetGlobalOptionsOptions { + folly::Optional debug() const; + folly::Optional reportStackTraces() const; + + SpecSetGlobalOptionsOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeFrameRateLogger_SpecSetGlobalOptionsOptions) ++ (RCTManagedPointer *)JS_NativeFrameRateLogger_SpecSetGlobalOptionsOptions:(id)json; +@end +@protocol NativeFrameRateLoggerSpec + +- (void)setGlobalOptions:(JS::NativeFrameRateLogger::SpecSetGlobalOptionsOptions &)options; +- (void)setContext:(NSString *)context; +- (void)beginScroll; +- (void)endScroll; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'FrameRateLogger' + */ + + class JSI_EXPORT NativeFrameRateLoggerSpecJSI : public ObjCTurboModule { + public: + NativeFrameRateLoggerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeHeadlessJsTaskSupportSpec + +- (void)notifyTaskFinished:(double)taskId; +- (void)notifyTaskRetry:(double)taskId + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'HeadlessJsTaskSupport' + */ + + class JSI_EXPORT NativeHeadlessJsTaskSupportSpecJSI : public ObjCTurboModule { + public: + NativeHeadlessJsTaskSupportSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeHeapCaptureSpec + +- (void)captureHeap:(NSString *)path; +- (void)captureComplete:(NSString *)path + error:(NSString * _Nullable)error; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'HeapCapture' + */ + + class JSI_EXPORT NativeHeapCaptureSpecJSI : public ObjCTurboModule { + public: + NativeHeapCaptureSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeI18nManager { + struct Constants { + + struct Builder { + struct Input { + RCTRequired isRTL; + RCTRequired doLeftAndRightSwapInRTL; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeI18nManagerSpec + +- (void)allowRTL:(BOOL)allowRTL; +- (void)forceRTL:(BOOL)forceRTL; +- (void)swapLeftAndRightInRTL:(BOOL)flipStyles; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'I18nManager' + */ + + class JSI_EXPORT NativeI18nManagerSpecJSI : public ObjCTurboModule { + public: + NativeI18nManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeImageLoaderSpec +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ImageLoader' + */ + + class JSI_EXPORT NativeImageLoaderSpecJSI : public ObjCTurboModule { + public: + NativeImageLoaderSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeImagePickerIOS { + struct SpecOpenCameraDialogConfig { + bool unmirrorFrontFacingCamera() const; + bool videoMode() const; + + SpecOpenCameraDialogConfig(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeImagePickerIOS_SpecOpenCameraDialogConfig) ++ (RCTManagedPointer *)JS_NativeImagePickerIOS_SpecOpenCameraDialogConfig:(id)json; +@end + +namespace JS { + namespace NativeImagePickerIOS { + struct SpecOpenSelectDialogConfig { + bool showImages() const; + bool showVideos() const; + + SpecOpenSelectDialogConfig(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeImagePickerIOS_SpecOpenSelectDialogConfig) ++ (RCTManagedPointer *)JS_NativeImagePickerIOS_SpecOpenSelectDialogConfig:(id)json; +@end +@protocol NativeImagePickerIOSSpec + +- (void)canRecordVideos:(RCTResponseSenderBlock)callback; +- (void)canUseCamera:(RCTResponseSenderBlock)callback; +- (void)openCameraDialog:(JS::NativeImagePickerIOS::SpecOpenCameraDialogConfig &)config + successCallback:(RCTResponseSenderBlock)successCallback + cancelCallback:(RCTResponseSenderBlock)cancelCallback; +- (void)openSelectDialog:(JS::NativeImagePickerIOS::SpecOpenSelectDialogConfig &)config + successCallback:(RCTResponseSenderBlock)successCallback + cancelCallback:(RCTResponseSenderBlock)cancelCallback; +- (void)clearAllPendingVideos; +- (void)removePendingVideo:(NSString *)url; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ImagePickerIOS' + */ + + class JSI_EXPORT NativeImagePickerIOSSpecJSI : public ObjCTurboModule { + public: + NativeImagePickerIOSSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeJSCSamplingProfilerSpec + +- (void)operationComplete:(double)token + result:(NSString * _Nullable)result + error:(NSString * _Nullable)error; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'JSCSamplingProfiler' + */ + + class JSI_EXPORT NativeJSCSamplingProfilerSpecJSI : public ObjCTurboModule { + public: + NativeJSCSamplingProfilerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeJSDevSupport { + struct Constants { + + struct Builder { + struct Input { + RCTRequired ERROR_CODE_EXCEPTION; + RCTRequired ERROR_CODE_VIEW_NOT_FOUND; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeJSDevSupportSpec + +- (void)onSuccess:(NSDictionary *)data; +- (void)onFailure:(double)errorCode + error:(NSString *)error; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'JSDevSupport' + */ + + class JSI_EXPORT NativeJSDevSupportSpecJSI : public ObjCTurboModule { + public: + NativeJSDevSupportSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeKeyboardObserverSpec + +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'KeyboardObserver' + */ + + class JSI_EXPORT NativeKeyboardObserverSpecJSI : public ObjCTurboModule { + public: + NativeKeyboardObserverSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeLinking { + struct SpecSendIntentExtrasElement { + NSString *key() const; + id value() const; + + SpecSendIntentExtrasElement(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeLinking_SpecSendIntentExtrasElement) ++ (RCTManagedPointer *)JS_NativeLinking_SpecSendIntentExtrasElement:(id)json; +@end +@protocol NativeLinkingSpec + +- (void)getInitialURL:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)canOpenURL:(NSString *)url + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)openURL:(NSString *)url + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)openSettings:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)sendIntent:(NSString *)action + extras:(NSArray *_Nullable)extras + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'Linking' + */ + + class JSI_EXPORT NativeLinkingSpecJSI : public ObjCTurboModule { + public: + NativeLinkingSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeModalManagerSpec + +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ModalManager' + */ + + class JSI_EXPORT NativeModalManagerSpecJSI : public ObjCTurboModule { + public: + NativeModalManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeNetworkingAndroid { + struct Header { + NSString *first() const; + NSString *second() const; + + Header(NSArray *const v) : _v(v) {} + private: + NSArray *_v; + }; + } +} + +@interface RCTCxxConvert (NativeNetworkingAndroid_Header) ++ (RCTManagedPointer *)JS_NativeNetworkingAndroid_Header:(id)json; +@end +@protocol NativeNetworkingAndroidSpec + +- (void)sendRequest:(NSString *)method + url:(NSString *)url + requestId:(double)requestId + headers:(NSArray *)headers + data:(NSDictionary *)data + responseType:(NSDictionary *)responseType +useIncrementalUpdates:(BOOL)useIncrementalUpdates + timeout:(double)timeout + withCredentials:(BOOL)withCredentials; +- (void)abortRequest:(double)requestId; +- (void)clearCookies:(RCTResponseSenderBlock)callback; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'NetworkingAndroid' + */ + + class JSI_EXPORT NativeNetworkingAndroidSpecJSI : public ObjCTurboModule { + public: + NativeNetworkingAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeNetworkingIOS { + struct SpecSendRequestQuery { + NSString *method() const; + NSString *url() const; + id data() const; + id headers() const; + id responseType() const; + bool incrementalUpdates() const; + double timeout() const; + bool withCredentials() const; + + SpecSendRequestQuery(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeNetworkingIOS_SpecSendRequestQuery) ++ (RCTManagedPointer *)JS_NativeNetworkingIOS_SpecSendRequestQuery:(id)json; +@end +@protocol NativeNetworkingIOSSpec + +- (void)sendRequest:(JS::NativeNetworkingIOS::SpecSendRequestQuery &)query + callback:(RCTResponseSenderBlock)callback; +- (void)abortRequest:(double)requestId; +- (void)clearCookies:(RCTResponseSenderBlock)callback; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'NetworkingIOS' + */ + + class JSI_EXPORT NativeNetworkingIOSSpecJSI : public ObjCTurboModule { + public: + NativeNetworkingIOSSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativePermissionsAndroidSpec + +- (void)checkPermission:(NSString *)permission + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)requestPermission:(NSString *)permission + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)shouldShowRequestPermissionRationale:(NSString *)permission + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)requestMultiplePermissions:(NSArray *)permissions + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'PermissionsAndroid' + */ + + class JSI_EXPORT NativePermissionsAndroidSpecJSI : public ObjCTurboModule { + public: + NativePermissionsAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativePlatformConstantsAndroid { + struct ConstantsReactNativeVersion { + + struct Builder { + struct Input { + RCTRequired major; + RCTRequired minor; + RCTRequired patch; + RCTRequired> prerelease; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing ConstantsReactNativeVersion */ + Builder(ConstantsReactNativeVersion i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static ConstantsReactNativeVersion fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + ConstantsReactNativeVersion(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} + +namespace JS { + namespace NativePlatformConstantsAndroid { + struct Constants { + + struct Builder { + struct Input { + RCTRequired isTesting; + RCTRequired reactNativeVersion; + RCTRequired Version; + RCTRequired Release; + RCTRequired Serial; + RCTRequired Fingerprint; + RCTRequired Model; + RCTRequired ServerHost; + RCTRequired uiMode; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativePlatformConstantsAndroidSpec + +- (NSString *)getAndroidID; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'PlatformConstantsAndroid' + */ + + class JSI_EXPORT NativePlatformConstantsAndroidSpecJSI : public ObjCTurboModule { + public: + NativePlatformConstantsAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativePlatformConstantsIOS { + struct ConstantsReactNativeVersion { + + struct Builder { + struct Input { + RCTRequired major; + RCTRequired minor; + RCTRequired patch; + RCTRequired> prerelease; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing ConstantsReactNativeVersion */ + Builder(ConstantsReactNativeVersion i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static ConstantsReactNativeVersion fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + ConstantsReactNativeVersion(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} + +namespace JS { + namespace NativePlatformConstantsIOS { + struct Constants { + + struct Builder { + struct Input { + RCTRequired isTesting; + RCTRequired reactNativeVersion; + RCTRequired forceTouchAvailable; + RCTRequired osVersion; + RCTRequired systemName; + RCTRequired interfaceIdiom; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativePlatformConstantsIOSSpec + +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'PlatformConstantsIOS' + */ + + class JSI_EXPORT NativePlatformConstantsIOSSpecJSI : public ObjCTurboModule { + public: + NativePlatformConstantsIOSSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativePushNotificationManagerIOS { + struct SpecRequestPermissionsPermission { + folly::Optional alert() const; + folly::Optional badge() const; + folly::Optional sound() const; + + SpecRequestPermissionsPermission(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativePushNotificationManagerIOS_SpecRequestPermissionsPermission) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_SpecRequestPermissionsPermission:(id)json; +@end + +namespace JS { + namespace NativePushNotificationManagerIOS { + struct Permissions { + bool alert() const; + bool badge() const; + bool sound() const; + + Permissions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativePushNotificationManagerIOS_Permissions) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_Permissions:(id)json; +@end + +namespace JS { + namespace NativePushNotificationManagerIOS { + struct Notification { + NSString *alertTitle() const; + folly::Optional fireDate() const; + NSString *alertBody() const; + NSString *alertAction() const; + id _Nullable userInfo() const; + NSString *category() const; + NSString *repeatInterval() const; + folly::Optional applicationIconBadgeNumber() const; + folly::Optional isSilent() const; + + Notification(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativePushNotificationManagerIOS_Notification) ++ (RCTManagedPointer *)JS_NativePushNotificationManagerIOS_Notification:(id)json; +@end +@protocol NativePushNotificationManagerIOSSpec + +- (void)onFinishRemoteNotification:(NSString *)notificationId + fetchResult:(NSString *)fetchResult; +- (void)setApplicationIconBadgeNumber:(double)num; +- (void)getApplicationIconBadgeNumber:(RCTResponseSenderBlock)callback; +- (void)requestPermissions:(JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)permission + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)abandonPermissions; +- (void)checkPermissions:(RCTResponseSenderBlock)callback; +- (void)presentLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification; +- (void)scheduleLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification; +- (void)cancelAllLocalNotifications; +- (void)cancelLocalNotifications:(NSDictionary *)userInfo; +- (void)getInitialNotification:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)getScheduledLocalNotifications:(RCTResponseSenderBlock)callback; +- (void)removeAllDeliveredNotifications; +- (void)removeDeliveredNotifications:(NSArray *)identifiers; +- (void)getDeliveredNotifications:(RCTResponseSenderBlock)callback; +- (void)addListener:(NSString *)eventType; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'PushNotificationManagerIOS' + */ + + class JSI_EXPORT NativePushNotificationManagerIOSSpecJSI : public ObjCTurboModule { + public: + NativePushNotificationManagerIOSSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeRedBoxSpec + +- (void)setExtraData:(NSDictionary *)extraData + identifier:(NSString *)identifier; +- (void)dismiss; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'RedBox' + */ + + class JSI_EXPORT NativeRedBoxSpecJSI : public ObjCTurboModule { + public: + NativeRedBoxSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeSegmentFetcherSpec + +- (void)fetchSegment:(double)segmentId + options:(NSDictionary *)options + callback:(RCTResponseSenderBlock)callback; +- (void)getSegment:(double)segmentId + options:(NSDictionary *)options + callback:(RCTResponseSenderBlock)callback; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'SegmentFetcher' + */ + + class JSI_EXPORT NativeSegmentFetcherSpecJSI : public ObjCTurboModule { + public: + NativeSegmentFetcherSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeSettingsManager { + struct Constants { + + struct Builder { + struct Input { + RCTRequired> settings; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeSettingsManagerSpec + +- (void)setValues:(NSDictionary *)values; +- (void)deleteValues:(NSArray *)values; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'SettingsManager' + */ + + class JSI_EXPORT NativeSettingsManagerSpecJSI : public ObjCTurboModule { + public: + NativeSettingsManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeShareModule { + struct SpecShareContent { + NSString *title() const; + NSString *message() const; + + SpecShareContent(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeShareModule_SpecShareContent) ++ (RCTManagedPointer *)JS_NativeShareModule_SpecShareContent:(id)json; +@end +@protocol NativeShareModuleSpec + +- (void)share:(JS::NativeShareModule::SpecShareContent &)content + dialogTitle:(NSString *)dialogTitle + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ShareModule' + */ + + class JSI_EXPORT NativeShareModuleSpecJSI : public ObjCTurboModule { + public: + NativeShareModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeSoundManagerSpec + +- (void)playTouchSound; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'SoundManager' + */ + + class JSI_EXPORT NativeSoundManagerSpecJSI : public ObjCTurboModule { + public: + NativeSoundManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeSourceCode { + struct Constants { + + struct Builder { + struct Input { + RCTRequired scriptURL; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeSourceCodeSpec + +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'SourceCode' + */ + + class JSI_EXPORT NativeSourceCodeSpecJSI : public ObjCTurboModule { + public: + NativeSourceCodeSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeStatusBarManager { + struct SpecGetHeightCallbackResult { + double height() const; + + SpecGetHeightCallbackResult(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeStatusBarManager_SpecGetHeightCallbackResult) ++ (RCTManagedPointer *)JS_NativeStatusBarManager_SpecGetHeightCallbackResult:(id)json; +@end + +namespace JS { + namespace NativeStatusBarManager { + struct Constants { + + struct Builder { + struct Input { + RCTRequired HEIGHT; + RCTRequired DEFAULT_BACKGROUND_COLOR; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeStatusBarManagerSpec + +- (void)setColor:(double)color + animated:(BOOL)animated; +- (void)setTranslucent:(BOOL)translucent; +- (void)getHeight:(RCTResponseSenderBlock)callback; +- (void)setNetworkActivityIndicatorVisible:(BOOL)visible; +- (void)addListener:(NSString *)eventType; +- (void)removeListeners:(double)count; +- (void)setStyle:(NSString * _Nullable)statusBarStyle + animated:(NSNumber *)animated; +- (void)setHidden:(BOOL)hidden + withAnimation:(NSString * _Nullable)withAnimation; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'StatusBarManager' + */ + + class JSI_EXPORT NativeStatusBarManagerSpecJSI : public ObjCTurboModule { + public: + NativeStatusBarManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeTVNavigationEventEmitterSpec + +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'TVNavigationEventEmitter' + */ + + class JSI_EXPORT NativeTVNavigationEventEmitterSpecJSI : public ObjCTurboModule { + public: + NativeTVNavigationEventEmitterSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeTimePickerAndroid { + struct TimePickerOptions { + folly::Optional hour() const; + folly::Optional minute() const; + folly::Optional is24Hour() const; + NSString *mode() const; + + TimePickerOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeTimePickerAndroid_TimePickerOptions) ++ (RCTManagedPointer *)JS_NativeTimePickerAndroid_TimePickerOptions:(id)json; +@end +@protocol NativeTimePickerAndroidSpec + +- (void)open:(JS::NativeTimePickerAndroid::TimePickerOptions &)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'TimePickerAndroid' + */ + + class JSI_EXPORT NativeTimePickerAndroidSpecJSI : public ObjCTurboModule { + public: + NativeTimePickerAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeTimePickerAndroid { + struct TimePickerResult { + NSString *action() const; + double hour() const; + double minute() const; + + TimePickerResult(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeTimePickerAndroid_TimePickerResult) ++ (RCTManagedPointer *)JS_NativeTimePickerAndroid_TimePickerResult:(id)json; +@end +@protocol NativeTimingSpec + +- (void)createTimer:(double)callbackID + duration:(double)duration + jsSchedulingTime:(double)jsSchedulingTime + repeats:(BOOL)repeats; +- (void)deleteTimer:(double)timerID; +- (void)setSendIdleEvents:(BOOL)sendIdleEvents; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'Timing' + */ + + class JSI_EXPORT NativeTimingSpecJSI : public ObjCTurboModule { + public: + NativeTimingSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeToastAndroid { + struct Constants { + + struct Builder { + struct Input { + RCTRequired SHORT; + RCTRequired LONG; + RCTRequired TOP; + RCTRequired BOTTOM; + RCTRequired CENTER; + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeToastAndroidSpec + +- (void)show:(NSString *)message + duration:(double)duration; +- (void)showWithGravity:(NSString *)message + duration:(double)duration + gravity:(double)gravity; +- (void)showWithGravityAndOffset:(NSString *)message + duration:(double)duration + gravity:(double)gravity + xOffset:(double)xOffset + yOffset:(double)yOffset; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'ToastAndroid' + */ + + class JSI_EXPORT NativeToastAndroidSpecJSI : public ObjCTurboModule { + public: + NativeToastAndroidSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeUIManager { + struct Constants { + + struct Builder { + struct Input { + }; + + /** Initialize with a set of values */ + Builder(const Input i); + /** Initialize with an existing Constants */ + Builder(Constants i); + /** Builds the object. Generally used only by the infrastructure. */ + NSDictionary *buildUnsafeRawValue() const { return _factory(); }; + private: + NSDictionary *(^_factory)(void); + }; + + static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } + NSDictionary *unsafeRawValue() const { return _v; } + private: + Constants(NSDictionary *const v) : _v(v) {} + NSDictionary *_v; + }; + } +} +@protocol NativeUIManagerSpec + +- (NSDictionary *)getConstantsForViewManager:(NSString *)viewManagerName; +- (NSArray *)getDefaultEventTypes; +- (void)playTouchSound; +- (NSDictionary *)lazilyLoadView:(NSString *)name; +- (void)createView:(NSNumber *)reactTag + viewName:(NSString *)viewName + rootTag:(double)rootTag + props:(NSDictionary *)props; +- (void)updateView:(double)reactTag + viewName:(NSString *)viewName + props:(NSDictionary *)props; +- (void)focus:(NSNumber *)reactTag; +- (void)blur:(NSNumber *)reactTag; +- (void)findSubviewIn:(NSNumber *)reactTag + point:(NSArray *)point + callback:(RCTResponseSenderBlock)callback; +- (void)dispatchViewManagerCommand:(NSNumber *)reactTag + commandID:(double)commandID + commandArgs:(NSArray *_Nullable)commandArgs; +- (void)measure:(NSNumber *)reactTag + callback:(RCTResponseSenderBlock)callback; +- (void)measureInWindow:(NSNumber *)reactTag + callback:(RCTResponseSenderBlock)callback; +- (void)viewIsDescendantOf:(NSNumber *)reactTag + ancestorReactTag:(NSNumber *)ancestorReactTag + callback:(RCTResponseSenderBlock)callback; +- (void)measureLayout:(NSNumber *)reactTag + ancestorReactTag:(NSNumber *)ancestorReactTag + errorCallback:(RCTResponseSenderBlock)errorCallback + callback:(RCTResponseSenderBlock)callback; +- (void)measureLayoutRelativeToParent:(NSNumber *)reactTag + errorCallback:(RCTResponseSenderBlock)errorCallback + callback:(RCTResponseSenderBlock)callback; +- (void)setJSResponder:(NSNumber *)reactTag + blockNativeResponder:(BOOL)blockNativeResponder; +- (void)clearJSResponder; +- (void)configureNextLayoutAnimation:(NSDictionary *)config + callback:(RCTResponseSenderBlock)callback + errorCallback:(RCTResponseSenderBlock)errorCallback; +- (void)removeSubviewsFromContainerWithID:(double)containerID; +- (void)replaceExistingNonRootView:(NSNumber *)reactTag + newReactTag:(NSNumber *)newReactTag; +- (void)setChildren:(NSNumber *)containerTag + reactTags:(NSArray *)reactTags; +- (void)manageChildren:(NSNumber *)containerTag + moveFromIndices:(NSArray *)moveFromIndices + moveToIndices:(NSArray *)moveToIndices + addChildReactTags:(NSArray *)addChildReactTags + addAtIndices:(NSArray *)addAtIndices + removeAtIndices:(NSArray *)removeAtIndices; +- (void)setLayoutAnimationEnabledExperimental:(BOOL)enabled; +- (void)sendAccessibilityEvent:(NSNumber *)reactTag + eventType:(double)eventType; +- (void)showPopupMenu:(NSNumber *)reactTag + items:(NSArray *)items + error:(RCTResponseSenderBlock)error + success:(RCTResponseSenderBlock)success; +- (void)dismissPopupMenu; +- (facebook::react::ModuleConstants)constantsToExport; +- (facebook::react::ModuleConstants)getConstants; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'UIManager' + */ + + class JSI_EXPORT NativeUIManagerSpecJSI : public ObjCTurboModule { + public: + NativeUIManagerSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook +@protocol NativeVibrationSpec + +- (void)vibrate:(double)pattern; +- (void)vibrateByPattern:(NSArray *)pattern + repeat:(double)repeat; +- (void)cancel; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'Vibration' + */ + + class JSI_EXPORT NativeVibrationSpecJSI : public ObjCTurboModule { + public: + NativeVibrationSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +namespace JS { + namespace NativeWebSocketModule { + struct SpecConnectOptionsHeaders { + NSString *origin() const; + + SpecConnectOptionsHeaders(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeWebSocketModule_SpecConnectOptionsHeaders) ++ (RCTManagedPointer *)JS_NativeWebSocketModule_SpecConnectOptionsHeaders:(id)json; +@end + +namespace JS { + namespace NativeWebSocketModule { + struct SpecConnectOptions { + folly::Optional headers() const; + + SpecConnectOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeWebSocketModule_SpecConnectOptions) ++ (RCTManagedPointer *)JS_NativeWebSocketModule_SpecConnectOptions:(id)json; +@end +@protocol NativeWebSocketModuleSpec + +- (void)connect:(NSString *)url + protocols:(NSArray *_Nullable)protocols + options:(JS::NativeWebSocketModule::SpecConnectOptions &)options + socketID:(double)socketID; +- (void)send:(NSString *)message + socketID:(double)socketID; +- (void)sendBinary:(NSString *)base64String + socketID:(double)socketID; +- (void)ping:(double)socketID; +- (void)close:(double)code + reason:(NSString *)reason + socketID:(double)socketID; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'WebSocketModule' + */ + + class JSI_EXPORT NativeWebSocketModuleSpecJSI : public ObjCTurboModule { + public: + NativeWebSocketModuleSpecJSI(id instance, std::shared_ptr jsInvoker); + + }; + } // namespace react +} // namespace facebook + +#import + + +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::extraSmall() const +{ + id const p = _v[@"extraSmall"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::small() const +{ + id const p = _v[@"small"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::medium() const +{ + id const p = _v[@"medium"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::large() const +{ + id const p = _v[@"large"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::extraLarge() const +{ + id const p = _v[@"extraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::extraExtraLarge() const +{ + id const p = _v[@"extraExtraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::extraExtraExtraLarge() const +{ + id const p = _v[@"extraExtraExtraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::accessibilityMedium() const +{ + id const p = _v[@"accessibilityMedium"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::accessibilityLarge() const +{ + id const p = _v[@"accessibilityLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::accessibilityExtraLarge() const +{ + id const p = _v[@"accessibilityExtraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::accessibilityExtraExtraLarge() const +{ + id const p = _v[@"accessibilityExtraExtraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultiipliers::accessibilityExtraExtraExtraLarge() const +{ + id const p = _v[@"accessibilityExtraExtraExtraLarge"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::title() const +{ + id const p = _v[@"title"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline folly::Optional> JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::options() const +{ + id const p = _v[@"options"]; + return RCTBridgingToOptionalVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::destructiveButtonIndex() const +{ + id const p = _v[@"destructiveButtonIndex"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::cancelButtonIndex() const +{ + id const p = _v[@"cancelButtonIndex"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::anchor() const +{ + id const p = _v[@"anchor"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions::tintColor() const +{ + id const p = _v[@"tintColor"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::url() const +{ + id const p = _v[@"url"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::subject() const +{ + id const p = _v[@"subject"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::anchor() const +{ + id const p = _v[@"anchor"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::tintColor() const +{ + id const p = _v[@"tintColor"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional> JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsOptions::excludedActivityTypes() const +{ + id const p = _v[@"excludedActivityTypes"]; + return RCTBridgingToOptionalVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsFailureCallbackError::domain() const +{ + id const p = _v[@"domain"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsFailureCallbackError::code() const +{ + id const p = _v[@"code"]; + return RCTBridgingToString(p); +} +inline id _Nullable JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsFailureCallbackError::userInfo() const +{ + id const p = _v[@"userInfo"]; + return p; +} +inline NSString *JS::NativeActionSheetManager::SpecShowShareActionSheetWithOptionsFailureCallbackError::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::title() const +{ + id const p = _v[@"title"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline id _Nullable JS::NativeAlertManager::Args::buttons() const +{ + id const p = _v[@"buttons"]; + return p; +} +inline NSString *JS::NativeAlertManager::Args::type() const +{ + id const p = _v[@"type"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::defaultValue() const +{ + id const p = _v[@"defaultValue"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::cancelButtonKey() const +{ + id const p = _v[@"cancelButtonKey"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::destructiveButtonKey() const +{ + id const p = _v[@"destructiveButtonKey"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAlertManager::Args::keyboardType() const +{ + id const p = _v[@"keyboardType"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAnimatedModule::AnimatedNodeConfig::type() const +{ + id const p = _v[@"type"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAnimatedModule::AnimatingNodeConfig::type() const +{ + id const p = _v[@"type"]; + return RCTBridgingToString(p); +} +inline bool JS::NativeAnimatedModule::EndResult::finished() const +{ + id const p = _v[@"finished"]; + return RCTBridgingToBool(p); +} +inline facebook::react::LazyVector JS::NativeAnimatedModule::EventMapping::nativeEventPath() const +{ + id const p = _v[@"nativeEventPath"]; + return RCTBridgingToVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); +} +inline folly::Optional JS::NativeAnimatedModule::EventMapping::animatedValueTag() const +{ + id const p = _v[@"animatedValueTag"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativeAppState::SpecGetCurrentAppStateSuccessAppState::app_state() const +{ + id const p = _v[@"app_state"]; + return RCTBridgingToString(p); +} +inline JS::NativeAppState::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto initialAppState = i.initialAppState.get(); + d[@"initialAppState"] = initialAppState; + return d; +}) {} +inline JS::NativeAppState::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline NSString *JS::NativeAsyncStorage::SpecMultiGetCallbackErrorsElement::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAsyncStorage::SpecMultiSetCallbackErrorsElement::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAsyncStorage::SpecMultiMergeCallbackErrorsElement::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAsyncStorage::SpecMultiRemoveCallbackErrorsElement::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAsyncStorage::SpecClearCallbackError::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeAsyncStorage::SpecGetAllKeysCallbackError::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline JS::NativeBlobModule::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto BLOB_URI_SCHEME = i.BLOB_URI_SCHEME.get(); + d[@"BLOB_URI_SCHEME"] = BLOB_URI_SCHEME; + auto BLOB_URI_HOST = i.BLOB_URI_HOST.get(); + d[@"BLOB_URI_HOST"] = BLOB_URI_HOST; + return d; +}) {} +inline JS::NativeBlobModule::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline JS::NativeDeviceInfo::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto Dimensions = i.Dimensions.get(); + d[@"Dimensions"] = Dimensions; + auto isIPhoneX_deprecated = i.isIPhoneX_deprecated; + d[@"isIPhoneX_deprecated"] = isIPhoneX_deprecated.hasValue() ? @((BOOL)isIPhoneX_deprecated.value()) : nil; + return d; +}) {} +inline JS::NativeDeviceInfo::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::title() const +{ + id const p = _v[@"title"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonPositive() const +{ + id const p = _v[@"buttonPositive"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonNegative() const +{ + id const p = _v[@"buttonNegative"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonNeutral() const +{ + id const p = _v[@"buttonNeutral"]; + return RCTBridgingToString(p); +} +inline folly::Optional> JS::NativeDialogManagerAndroid::DialogOptions::items() const +{ + id const p = _v[@"items"]; + return RCTBridgingToOptionalVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); +} +inline folly::Optional JS::NativeDialogManagerAndroid::DialogOptions::cancelable() const +{ + id const p = _v[@"cancelable"]; + return RCTBridgingToOptionalBool(p); +} +inline JS::NativeDialogManagerAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto buttonClicked = i.buttonClicked.get(); + d[@"buttonClicked"] = buttonClicked; + auto dismissed = i.dismissed.get(); + d[@"dismissed"] = dismissed; + auto buttonPositive = i.buttonPositive.get(); + d[@"buttonPositive"] = @(buttonPositive); + auto buttonNegative = i.buttonNegative.get(); + d[@"buttonNegative"] = @(buttonNegative); + auto buttonNeutral = i.buttonNeutral.get(); + d[@"buttonNeutral"] = @(buttonNeutral); + return d; +}) {} +inline JS::NativeDialogManagerAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline folly::Optional JS::NativeExceptionsManager::StackFrame::column() const +{ + id const p = _v[@"column"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativeExceptionsManager::StackFrame::file() const +{ + id const p = _v[@"file"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativeExceptionsManager::StackFrame::lineNumber() const +{ + id const p = _v[@"lineNumber"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativeExceptionsManager::StackFrame::methodName() const +{ + id const p = _v[@"methodName"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativeExceptionsManager::StackFrame::collapse() const +{ + id const p = _v[@"collapse"]; + return RCTBridgingToOptionalBool(p); +} +inline NSString *JS::NativeExceptionsManager::ExceptionData::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeExceptionsManager::ExceptionData::originalMessage() const +{ + id const p = _v[@"originalMessage"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeExceptionsManager::ExceptionData::name() const +{ + id const p = _v[@"name"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeExceptionsManager::ExceptionData::componentStack() const +{ + id const p = _v[@"componentStack"]; + return RCTBridgingToString(p); +} +inline facebook::react::LazyVector JS::NativeExceptionsManager::ExceptionData::stack() const +{ + id const p = _v[@"stack"]; + return RCTBridgingToVec(p, ^JS::NativeExceptionsManager::StackFrame(id itemValue_0) { return JS::NativeExceptionsManager::StackFrame(itemValue_0); }); +} +inline double JS::NativeExceptionsManager::ExceptionData::id_() const +{ + id const p = _v[@"id"]; + return RCTBridgingToDouble(p); +} +inline bool JS::NativeExceptionsManager::ExceptionData::isFatal() const +{ + id const p = _v[@"isFatal"]; + return RCTBridgingToBool(p); +} +inline id _Nullable JS::NativeExceptionsManager::ExceptionData::extraData() const +{ + id const p = _v[@"extraData"]; + return p; +} +inline folly::Optional JS::NativeFrameRateLogger::SpecSetGlobalOptionsOptions::debug() const +{ + id const p = _v[@"debug"]; + return RCTBridgingToOptionalBool(p); +} +inline folly::Optional JS::NativeFrameRateLogger::SpecSetGlobalOptionsOptions::reportStackTraces() const +{ + id const p = _v[@"reportStackTraces"]; + return RCTBridgingToOptionalBool(p); +} +inline JS::NativeI18nManager::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto isRTL = i.isRTL.get(); + d[@"isRTL"] = @(isRTL); + auto doLeftAndRightSwapInRTL = i.doLeftAndRightSwapInRTL.get(); + d[@"doLeftAndRightSwapInRTL"] = @(doLeftAndRightSwapInRTL); + return d; +}) {} +inline JS::NativeI18nManager::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline bool JS::NativeImagePickerIOS::SpecOpenCameraDialogConfig::unmirrorFrontFacingCamera() const +{ + id const p = _v[@"unmirrorFrontFacingCamera"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativeImagePickerIOS::SpecOpenCameraDialogConfig::videoMode() const +{ + id const p = _v[@"videoMode"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativeImagePickerIOS::SpecOpenSelectDialogConfig::showImages() const +{ + id const p = _v[@"showImages"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativeImagePickerIOS::SpecOpenSelectDialogConfig::showVideos() const +{ + id const p = _v[@"showVideos"]; + return RCTBridgingToBool(p); +} +inline JS::NativeJSDevSupport::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto ERROR_CODE_EXCEPTION = i.ERROR_CODE_EXCEPTION.get(); + d[@"ERROR_CODE_EXCEPTION"] = @(ERROR_CODE_EXCEPTION); + auto ERROR_CODE_VIEW_NOT_FOUND = i.ERROR_CODE_VIEW_NOT_FOUND.get(); + d[@"ERROR_CODE_VIEW_NOT_FOUND"] = @(ERROR_CODE_VIEW_NOT_FOUND); + return d; +}) {} +inline JS::NativeJSDevSupport::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline NSString *JS::NativeLinking::SpecSendIntentExtrasElement::key() const +{ + id const p = _v[@"key"]; + return RCTBridgingToString(p); +} +inline id JS::NativeLinking::SpecSendIntentExtrasElement::value() const +{ + id const p = _v[@"value"]; + return p; +} +inline NSString *JS::NativeNetworkingAndroid::Header::first() const +{ + id const p = _v[0]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeNetworkingAndroid::Header::second() const +{ + id const p = _v[1]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeNetworkingIOS::SpecSendRequestQuery::method() const +{ + id const p = _v[@"method"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeNetworkingIOS::SpecSendRequestQuery::url() const +{ + id const p = _v[@"url"]; + return RCTBridgingToString(p); +} +inline id JS::NativeNetworkingIOS::SpecSendRequestQuery::data() const +{ + id const p = _v[@"data"]; + return p; +} +inline id JS::NativeNetworkingIOS::SpecSendRequestQuery::headers() const +{ + id const p = _v[@"headers"]; + return p; +} +inline id JS::NativeNetworkingIOS::SpecSendRequestQuery::responseType() const +{ + id const p = _v[@"responseType"]; + return p; +} +inline bool JS::NativeNetworkingIOS::SpecSendRequestQuery::incrementalUpdates() const +{ + id const p = _v[@"incrementalUpdates"]; + return RCTBridgingToBool(p); +} +inline double JS::NativeNetworkingIOS::SpecSendRequestQuery::timeout() const +{ + id const p = _v[@"timeout"]; + return RCTBridgingToDouble(p); +} +inline bool JS::NativeNetworkingIOS::SpecSendRequestQuery::withCredentials() const +{ + id const p = _v[@"withCredentials"]; + return RCTBridgingToBool(p); +} +inline JS::NativePlatformConstantsAndroid::ConstantsReactNativeVersion::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto major = i.major.get(); + d[@"major"] = @(major); + auto minor = i.minor.get(); + d[@"minor"] = @(minor); + auto patch = i.patch.get(); + d[@"patch"] = @(patch); + auto prerelease = i.prerelease.get(); + d[@"prerelease"] = prerelease.hasValue() ? @((double)prerelease.value()) : nil; + return d; +}) {} +inline JS::NativePlatformConstantsAndroid::ConstantsReactNativeVersion::Builder::Builder(ConstantsReactNativeVersion i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline JS::NativePlatformConstantsAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto isTesting = i.isTesting.get(); + d[@"isTesting"] = @(isTesting); + auto reactNativeVersion = i.reactNativeVersion.get(); + d[@"reactNativeVersion"] = reactNativeVersion.buildUnsafeRawValue(); + auto Version = i.Version.get(); + d[@"Version"] = @(Version); + auto Release = i.Release.get(); + d[@"Release"] = Release; + auto Serial = i.Serial.get(); + d[@"Serial"] = Serial; + auto Fingerprint = i.Fingerprint.get(); + d[@"Fingerprint"] = Fingerprint; + auto Model = i.Model.get(); + d[@"Model"] = Model; + auto ServerHost = i.ServerHost.get(); + d[@"ServerHost"] = ServerHost; + auto uiMode = i.uiMode.get(); + d[@"uiMode"] = uiMode; + return d; +}) {} +inline JS::NativePlatformConstantsAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline JS::NativePlatformConstantsIOS::ConstantsReactNativeVersion::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto major = i.major.get(); + d[@"major"] = @(major); + auto minor = i.minor.get(); + d[@"minor"] = @(minor); + auto patch = i.patch.get(); + d[@"patch"] = @(patch); + auto prerelease = i.prerelease.get(); + d[@"prerelease"] = prerelease.hasValue() ? @((double)prerelease.value()) : nil; + return d; +}) {} +inline JS::NativePlatformConstantsIOS::ConstantsReactNativeVersion::Builder::Builder(ConstantsReactNativeVersion i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline JS::NativePlatformConstantsIOS::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto isTesting = i.isTesting.get(); + d[@"isTesting"] = @(isTesting); + auto reactNativeVersion = i.reactNativeVersion.get(); + d[@"reactNativeVersion"] = reactNativeVersion.buildUnsafeRawValue(); + auto forceTouchAvailable = i.forceTouchAvailable.get(); + d[@"forceTouchAvailable"] = @(forceTouchAvailable); + auto osVersion = i.osVersion.get(); + d[@"osVersion"] = osVersion; + auto systemName = i.systemName.get(); + d[@"systemName"] = systemName; + auto interfaceIdiom = i.interfaceIdiom.get(); + d[@"interfaceIdiom"] = interfaceIdiom; + return d; +}) {} +inline JS::NativePlatformConstantsIOS::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline folly::Optional JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission::alert() const +{ + id const p = _v[@"alert"]; + return RCTBridgingToOptionalBool(p); +} +inline folly::Optional JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission::badge() const +{ + id const p = _v[@"badge"]; + return RCTBridgingToOptionalBool(p); +} +inline folly::Optional JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission::sound() const +{ + id const p = _v[@"sound"]; + return RCTBridgingToOptionalBool(p); +} +inline bool JS::NativePushNotificationManagerIOS::Permissions::alert() const +{ + id const p = _v[@"alert"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativePushNotificationManagerIOS::Permissions::badge() const +{ + id const p = _v[@"badge"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativePushNotificationManagerIOS::Permissions::sound() const +{ + id const p = _v[@"sound"]; + return RCTBridgingToBool(p); +} +inline NSString *JS::NativePushNotificationManagerIOS::Notification::alertTitle() const +{ + id const p = _v[@"alertTitle"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativePushNotificationManagerIOS::Notification::fireDate() const +{ + id const p = _v[@"fireDate"]; + return RCTBridgingToOptionalDouble(p); +} +inline NSString *JS::NativePushNotificationManagerIOS::Notification::alertBody() const +{ + id const p = _v[@"alertBody"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativePushNotificationManagerIOS::Notification::alertAction() const +{ + id const p = _v[@"alertAction"]; + return RCTBridgingToString(p); +} +inline id _Nullable JS::NativePushNotificationManagerIOS::Notification::userInfo() const +{ + id const p = _v[@"userInfo"]; + return p; +} +inline NSString *JS::NativePushNotificationManagerIOS::Notification::category() const +{ + id const p = _v[@"category"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativePushNotificationManagerIOS::Notification::repeatInterval() const +{ + id const p = _v[@"repeatInterval"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativePushNotificationManagerIOS::Notification::applicationIconBadgeNumber() const +{ + id const p = _v[@"applicationIconBadgeNumber"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativePushNotificationManagerIOS::Notification::isSilent() const +{ + id const p = _v[@"isSilent"]; + return RCTBridgingToOptionalBool(p); +} +inline JS::NativeSettingsManager::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto settings = i.settings.get(); + d[@"settings"] = settings; + return d; +}) {} +inline JS::NativeSettingsManager::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline NSString *JS::NativeShareModule::SpecShareContent::title() const +{ + id const p = _v[@"title"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeShareModule::SpecShareContent::message() const +{ + id const p = _v[@"message"]; + return RCTBridgingToString(p); +} +inline JS::NativeSourceCode::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto scriptURL = i.scriptURL.get(); + d[@"scriptURL"] = scriptURL; + return d; +}) {} +inline JS::NativeSourceCode::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline double JS::NativeStatusBarManager::SpecGetHeightCallbackResult::height() const +{ + id const p = _v[@"height"]; + return RCTBridgingToDouble(p); +} +inline JS::NativeStatusBarManager::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto HEIGHT = i.HEIGHT.get(); + d[@"HEIGHT"] = @(HEIGHT); + auto DEFAULT_BACKGROUND_COLOR = i.DEFAULT_BACKGROUND_COLOR.get(); + d[@"DEFAULT_BACKGROUND_COLOR"] = @(DEFAULT_BACKGROUND_COLOR); + return d; +}) {} +inline JS::NativeStatusBarManager::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline folly::Optional JS::NativeTimePickerAndroid::TimePickerOptions::hour() const +{ + id const p = _v[@"hour"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeTimePickerAndroid::TimePickerOptions::minute() const +{ + id const p = _v[@"minute"]; + return RCTBridgingToOptionalDouble(p); +} +inline folly::Optional JS::NativeTimePickerAndroid::TimePickerOptions::is24Hour() const +{ + id const p = _v[@"is24Hour"]; + return RCTBridgingToOptionalBool(p); +} +inline NSString *JS::NativeTimePickerAndroid::TimePickerOptions::mode() const +{ + id const p = _v[@"mode"]; + return RCTBridgingToString(p); +} +inline NSString *JS::NativeTimePickerAndroid::TimePickerResult::action() const +{ + id const p = _v[@"action"]; + return RCTBridgingToString(p); +} +inline double JS::NativeTimePickerAndroid::TimePickerResult::hour() const +{ + id const p = _v[@"hour"]; + return RCTBridgingToDouble(p); +} +inline double JS::NativeTimePickerAndroid::TimePickerResult::minute() const +{ + id const p = _v[@"minute"]; + return RCTBridgingToDouble(p); +} +inline JS::NativeToastAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + auto SHORT = i.SHORT.get(); + d[@"SHORT"] = @(SHORT); + auto LONG = i.LONG.get(); + d[@"LONG"] = @(LONG); + auto TOP = i.TOP.get(); + d[@"TOP"] = @(TOP); + auto BOTTOM = i.BOTTOM.get(); + d[@"BOTTOM"] = @(BOTTOM); + auto CENTER = i.CENTER.get(); + d[@"CENTER"] = @(CENTER); + return d; +}) {} +inline JS::NativeToastAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline JS::NativeUIManager::Constants::Builder::Builder(const Input i) : _factory(^{ + NSMutableDictionary *d = [NSMutableDictionary new]; + return d; +}) {} +inline JS::NativeUIManager::Constants::Builder::Builder(Constants i) : _factory(^{ + return i.unsafeRawValue(); +}) {} +inline NSString *JS::NativeWebSocketModule::SpecConnectOptionsHeaders::origin() const +{ + id const p = _v[@"origin"]; + return RCTBridgingToString(p); +} +inline folly::Optional JS::NativeWebSocketModule::SpecConnectOptions::headers() const +{ + id const p = _v[@"headers"]; + return (p == nil ? folly::none : folly::make_optional(JS::NativeWebSocketModule::SpecConnectOptionsHeaders(p))); +} diff --git a/Libraries/Utilities/HeapCapture.js b/Libraries/HeapCapture/HeapCapture.js similarity index 80% rename from Libraries/Utilities/HeapCapture.js rename to Libraries/HeapCapture/HeapCapture.js index 94ae18f1157606..9cbabc60417487 100644 --- a/Libraries/Utilities/HeapCapture.js +++ b/Libraries/HeapCapture/HeapCapture.js @@ -10,6 +10,8 @@ 'use strict'; +import NativeHeapCapture from './NativeHeapCapture'; + const HeapCapture = { captureHeap: function(path: string) { let error = null; @@ -20,10 +22,9 @@ const HeapCapture = { console.log('HeapCapture.captureHeap error: ' + e.toString()); error = e.toString(); } - require('../BatchedBridge/NativeModules').JSCHeapCapture.captureComplete( - path, - error, - ); + if (NativeHeapCapture) { + NativeHeapCapture.captureComplete(path, error); + } }, }; diff --git a/Libraries/HeapCapture/NativeHeapCapture.js b/Libraries/HeapCapture/NativeHeapCapture.js new file mode 100644 index 00000000000000..7374cd357297bb --- /dev/null +++ b/Libraries/HeapCapture/NativeHeapCapture.js @@ -0,0 +1,24 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + // Common interface + +captureHeap: (path: string) => void; + + // Android only + +captureComplete: (path: string, error: ?string) => void; +} + +export default (TurboModuleRegistry.get('HeapCapture'): ?Spec); diff --git a/Libraries/Image/Image.js b/Libraries/Image/Image.js index d9f689152d2b28..ac1d2893cf4989 100644 --- a/Libraries/Image/Image.js +++ b/Libraries/Image/Image.js @@ -50,7 +50,7 @@ function getSizeWithHeaders( headers: {[string]: string}, success: (width: number, height: number) => void, failure?: (error: any) => void, -) { +): any { return ImageViewManager.getSizeWithHeaders({uri, headers}) .then(function(sizes) { success(sizes.width, sizes.height); @@ -63,7 +63,7 @@ function getSizeWithHeaders( ); } -function prefetch(url: string) { +function prefetch(url: string): any { return ImageViewManager.prefetchImage(url); } diff --git a/Libraries/Image/ImageBackground.js b/Libraries/Image/ImageBackground.js index 22d684ba90bf32..f9f694f608446e 100644 --- a/Libraries/Image/ImageBackground.js +++ b/Libraries/Image/ImageBackground.js @@ -14,8 +14,6 @@ const React = require('react'); const StyleSheet = require('../StyleSheet/StyleSheet'); const View = require('../Components/View/View'); -const ensureComponentIsNative = require('../Components/Touchable/ensureComponentIsNative'); - /** * Very simple drop-in replacement for which supports nesting views. * @@ -45,7 +43,6 @@ class ImageBackground extends React.Component<$FlowFixMeProps> { // Work-around flow const viewRef = this._viewRef; if (viewRef) { - ensureComponentIsNative(viewRef); viewRef.setNativeProps(props); } } @@ -56,7 +53,7 @@ class ImageBackground extends React.Component<$FlowFixMeProps> { this._viewRef = ref; }; - render() { + render(): React.Node { const {children, style, imageStyle, imageRef, ...props} = this.props; return ( diff --git a/Libraries/Image/ImageEditor.js b/Libraries/Image/ImageEditor.js deleted file mode 100644 index 75621c7bb3e50e..00000000000000 --- a/Libraries/Image/ImageEditor.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ -'use strict'; - -const RCTImageEditingManager = require('../BatchedBridge/NativeModules') - .ImageEditingManager; - -type ImageCropData = { - /** - * The top-left corner of the cropped image, specified in the original - * image's coordinate space. - */ - offset: {| - x: number, - y: number, - |}, - /** - * The size (dimensions) of the cropped image, specified in the original - * image's coordinate space. - */ - size: {| - width: number, - height: number, - |}, - /** - * (Optional) size to scale the cropped image to. - */ - displaySize?: ?{| - width: number, - height: number, - |}, - /** - * (Optional) the resizing mode to use when scaling the image. If the - * `displaySize` param is not specified, this has no effect. - */ - resizeMode?: ?$Keys<{ - contain: string, - cover: string, - stretch: string, - }>, -}; - -class ImageEditor { - /** - * Crop the image specified by the URI param. If URI points to a remote - * image, it will be downloaded automatically. If the image cannot be - * loaded/downloaded, the failure callback will be called. On Android, a - * downloaded image may be cached in external storage, a publicly accessible - * location, if it has more available space than internal storage. - * - * If the cropping process is successful, the resultant cropped image - * will be stored in the ImageStore, and the URI returned in the success - * callback will point to the image in the store. Remember to delete the - * cropped image from the ImageStore when you are done with it. - */ - static cropImage( - uri: string, - cropData: ImageCropData, - success: (uri: string) => void, - failure: (error: Object) => void, - ) { - RCTImageEditingManager.cropImage(uri, cropData, success, failure); - } -} - -module.exports = ImageEditor; diff --git a/Libraries/Image/ImagePickerIOS.js b/Libraries/Image/ImagePickerIOS.js new file mode 100644 index 00000000000000..a7f0049d548a4d --- /dev/null +++ b/Libraries/Image/ImagePickerIOS.js @@ -0,0 +1,105 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; + +import NativeImagePickerIOS from './NativeImagePickerIOS'; +import invariant from 'invariant'; + +const ImagePickerIOS = { + canRecordVideos: function(callback: (result: boolean) => void): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + return NativeImagePickerIOS.canRecordVideos(callback); + }, + canUseCamera: function(callback: (result: boolean) => void): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + return NativeImagePickerIOS.canUseCamera(callback); + }, + openCameraDialog: function( + config: $ReadOnly<{| + unmirrorFrontFacingCamera?: boolean, + videoMode?: boolean, + |}>, + successCallback: (imageURL: string, height: number, width: number) => void, + cancelCallback: () => void, + ): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + + var newConfig = { + videoMode: true, + unmirrorFrontFacingCamera: false, + }; + + if (config.videoMode != null) { + newConfig.videoMode = config.videoMode; + } + + if (config.unmirrorFrontFacingCamera != null) { + newConfig.unmirrorFrontFacingCamera = config.unmirrorFrontFacingCamera; + } + + return NativeImagePickerIOS.openCameraDialog( + newConfig, + successCallback, + cancelCallback, + ); + }, + openSelectDialog: function( + config: $ReadOnly<{| + showImages?: boolean, + showVideos?: boolean, + |}>, + successCallback: (imageURL: string, height: number, width: number) => void, + cancelCallback: () => void, + ): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + + var newConfig = { + showImages: true, + showVideos: false, + }; + + if (config.showImages != null) { + newConfig.showImages = config.showImages; + } + + if (config.showVideos != null) { + newConfig.showVideos = config.showVideos; + } + + return NativeImagePickerIOS.openSelectDialog( + newConfig, + successCallback, + cancelCallback, + ); + }, + /** + * In iOS 13, the video URLs returned by the Image Picker are invalidated when + * the picker is dismissed, unless reference to it is held. This API allows + * the application to signal when it's finished with the video so that the + * reference can be cleaned up. + * It is safe to call this method for urlsthat aren't video URLs; + * it will be a no-op. + */ + removePendingVideo: function(url: string): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + NativeImagePickerIOS.removePendingVideo(url); + }, + /** + * WARNING: In most cases, removePendingVideo should be used instead because + * clearAllPendingVideos could clear out pending videos made by other callers. + */ + clearAllPendingVideos: function(): void { + invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); + NativeImagePickerIOS.clearAllPendingVideos(); + }, +}; + +module.exports = ImagePickerIOS; diff --git a/Libraries/Image/ImageSource.js b/Libraries/Image/ImageSource.js index 0e03dc78c0f5d1..4607ef14223357 100644 --- a/Libraries/Image/ImageSource.js +++ b/Libraries/Image/ImageSource.js @@ -87,5 +87,4 @@ export type ImageURISource = $ReadOnly<{ // We have to export any because of an issue in Flow with objects that come from Relay: // https://fburl.com/8ljo5tmr // https://fb.facebook.com/groups/flow/permalink/1824103160971624/ -// $FlowFixMe T26861415 export type ImageSource = ImageURISource | number | Array; diff --git a/Libraries/Image/ImageStore.js b/Libraries/Image/ImageStore.js deleted file mode 100644 index e011ffc8022585..00000000000000 --- a/Libraries/Image/ImageStore.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ -'use strict'; - -const RCTImageStoreManager = require('../BatchedBridge/NativeModules') - .ImageStoreManager; - -const Platform = require('../Utilities/Platform'); - -const warnOnce = require('../Utilities/warnOnce'); - -function warnUnimplementedMethod(methodName: string): void { - warnOnce( - `imagestore-${methodName}`, - `react-native: ImageStore.${methodName}() is not implemented on ${ - Platform.OS - }`, - ); -} - -class ImageStore { - /** - * Check if the ImageStore contains image data for the specified URI. - * @platform ios - */ - static hasImageForTag(uri: string, callback: (hasImage: boolean) => void) { - if (RCTImageStoreManager.hasImageForTag) { - RCTImageStoreManager.hasImageForTag(uri, callback); - } else { - warnUnimplementedMethod('hasImageForTag'); - } - } - - /** - * Delete an image from the ImageStore. Images are stored in memory and - * must be manually removed when you are finished with them, otherwise they - * will continue to use up RAM until the app is terminated. It is safe to - * call `removeImageForTag()` without first calling `hasImageForTag()`, it - * will simply fail silently. - * @platform ios - */ - static removeImageForTag(uri: string) { - if (RCTImageStoreManager.removeImageForTag) { - RCTImageStoreManager.removeImageForTag(uri); - } else { - warnUnimplementedMethod('removeImageForTag'); - } - } - - /** - * Stores a base64-encoded image in the ImageStore, and returns a URI that - * can be used to access or display the image later. Images are stored in - * memory only, and must be manually deleted when you are finished with - * them by calling `removeImageForTag()`. - * - * Note that it is very inefficient to transfer large quantities of binary - * data between JS and native code, so you should avoid calling this more - * than necessary. - * @platform ios - */ - static addImageFromBase64( - base64ImageData: string, - success: (uri: string) => void, - failure: (error: any) => void, - ) { - if (RCTImageStoreManager.addImageFromBase64) { - RCTImageStoreManager.addImageFromBase64( - base64ImageData, - success, - failure, - ); - } else { - warnUnimplementedMethod('addImageFromBase64'); - } - } - - /** - * Retrieves the base64-encoded data for an image in the ImageStore. If the - * specified URI does not match an image in the store, the failure callback - * will be called. - * - * Note that it is very inefficient to transfer large quantities of binary - * data between JS and native code, so you should avoid calling this more - * than necessary. To display an image in the ImageStore, you can just pass - * the URI to an `` component; there is no need to retrieve the - * base64 data. - */ - static getBase64ForTag( - uri: string, - success: (base64ImageData: string) => void, - failure: (error: any) => void, - ) { - if (RCTImageStoreManager.getBase64ForTag) { - RCTImageStoreManager.getBase64ForTag(uri, success, failure); - } else { - warnUnimplementedMethod('getBase64ForTag'); - } - } -} - -module.exports = ImageStore; diff --git a/Libraries/Image/ImageViewNativeComponent.js b/Libraries/Image/ImageViewNativeComponent.js index c0dbee693b7339..06722105bdc229 100644 --- a/Libraries/Image/ImageViewNativeComponent.js +++ b/Libraries/Image/ImageViewNativeComponent.js @@ -12,6 +12,6 @@ const requireNativeComponent = require('../ReactNative/requireNativeComponent'); -const ImageViewNativeComponent = requireNativeComponent('RCTImageView'); +const ImageViewNativeComponent: string = requireNativeComponent('RCTImageView'); module.exports = ImageViewNativeComponent; diff --git a/Libraries/Image/NativeImageLoader.js b/Libraries/Image/NativeImageLoader.js new file mode 100644 index 00000000000000..4c36ba7533d2d4 --- /dev/null +++ b/Libraries/Image/NativeImageLoader.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; +} + +export default TurboModuleRegistry.getEnforcing('ImageLoader'); diff --git a/Libraries/Image/NativeImagePickerIOS.js b/Libraries/Image/NativeImagePickerIOS.js new file mode 100644 index 00000000000000..6101c7b0380748 --- /dev/null +++ b/Libraries/Image/NativeImagePickerIOS.js @@ -0,0 +1,40 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +canRecordVideos: (callback: (result: boolean) => void) => void; + +canUseCamera: (callback: (result: boolean) => void) => void; + +openCameraDialog: ( + config: {| + unmirrorFrontFacingCamera: boolean, + videoMode: boolean, + |}, + successCallback: (imageURL: string, height: number, width: number) => void, + cancelCallback: () => void, + ) => void; + +openSelectDialog: ( + config: {| + showImages: boolean, + showVideos: boolean, + |}, + successCallback: (imageURL: string, height: number, width: number) => void, + cancelCallback: () => void, + ) => void; + +clearAllPendingVideos: () => void; + +removePendingVideo: (url: string) => void; +} + +export default (TurboModuleRegistry.get('ImagePickerIOS'): ?Spec); diff --git a/Libraries/Image/RCTAnimatedImage.h b/Libraries/Image/RCTAnimatedImage.h new file mode 100644 index 00000000000000..3c3eb20bb07303 --- /dev/null +++ b/Libraries/Image/RCTAnimatedImage.h @@ -0,0 +1,25 @@ +/** + * 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. + */ + +#import // TODO(macOS ISS#2323203) + +@protocol RCTAnimatedImage +@property (nonatomic, assign, readonly) NSUInteger animatedImageFrameCount; +@property (nonatomic, assign, readonly) NSUInteger animatedImageLoopCount; + +- (nullable UIImage *)animatedImageFrameAtIndex:(NSUInteger)index; +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index; + +@end + +@interface RCTAnimatedImage : UIImage +// [TODO(macOS ISS#2323203) +// This is a known initializer for UIImage, but needs to be exposed publicly for macOS since +// this is not a known initializer for NSImage +- (nullable instancetype)initWithData:(NSData *)data scale:(CGFloat)scale; +// ]TODO(macOS ISS#2323203) +@end diff --git a/Libraries/Image/RCTAnimatedImage.m b/Libraries/Image/RCTAnimatedImage.m new file mode 100644 index 00000000000000..e42b583179e8b5 --- /dev/null +++ b/Libraries/Image/RCTAnimatedImage.m @@ -0,0 +1,176 @@ +/** + * 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. + */ + +#import +#import + +@interface RCTGIFCoderFrame : NSObject + +@property (nonatomic, assign) NSUInteger index; +@property (nonatomic, assign) NSTimeInterval duration; + +@end + +@implementation RCTGIFCoderFrame +@end + +@implementation RCTAnimatedImage { + CGImageSourceRef _imageSource; + CGFloat _scale; + NSUInteger _loopCount; + NSUInteger _frameCount; + NSArray *_frames; +} + +- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale +{ + if (self = [super init]) { + CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!imageSource) { + return nil; + } + + BOOL framesValid = [self scanAndCheckFramesValidWithSource:imageSource]; + if (!framesValid) { + CFRelease(imageSource); + return nil; + } + + _imageSource = imageSource; + + // grab image at the first index + UIImage *image = [self animatedImageFrameAtIndex:0]; + if (!image) { + return nil; + } +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) + self = [image copy]; +#else // ]TODO(macOS ISS#2323203) + self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif // TODO(macOS ISS#2323203) + } + + return self; +} + +- (BOOL)scanAndCheckFramesValidWithSource:(CGImageSourceRef)imageSource +{ + if (!imageSource) { + return NO; + } + NSUInteger frameCount = CGImageSourceGetCount(imageSource); + NSUInteger loopCount = [self imageLoopCountWithSource:imageSource]; + NSMutableArray *frames = [NSMutableArray array]; + + for (size_t i = 0; i < frameCount; i++) { + RCTGIFCoderFrame *frame = [[RCTGIFCoderFrame alloc] init]; + frame.index = i; + frame.duration = [self frameDurationAtIndex:i source:imageSource]; + [frames addObject:frame]; + } + + _frameCount = frameCount; + _loopCount = loopCount; + _frames = [frames copy]; + + return YES; +} + +- (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source +{ + NSUInteger loopCount = 1; + NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(source, nil); + NSDictionary *gifProperties = imageProperties[(__bridge NSString *)kCGImagePropertyGIFDictionary]; + if (gifProperties) { + NSNumber *gifLoopCount = gifProperties[(__bridge NSString *)kCGImagePropertyGIFLoopCount]; + if (gifLoopCount != nil) { + loopCount = gifLoopCount.unsignedIntegerValue; + } + } + return loopCount; +} + +- (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source +{ + float frameDuration = 0.1f; + CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); + if (!cfFrameProperties) { + return frameDuration; + } + NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; + NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; + + NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; + if (delayTimeUnclampedProp != nil) { + frameDuration = [delayTimeUnclampedProp floatValue]; + } else { + NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; + if (delayTimeProp != nil) { + frameDuration = [delayTimeProp floatValue]; + } + } + + CFRelease(cfFrameProperties); + return frameDuration; +} + +- (NSUInteger)animatedImageLoopCount +{ + return _loopCount; +} + +- (NSUInteger)animatedImageFrameCount +{ + return _frameCount; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index +{ + if (index >= _frameCount) { + return 0; + } + return _frames[index].duration; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index +{ + CGImageRef imageRef = CGImageSourceCreateImageAtIndex(_imageSource, index, NULL); + if (!imageRef) { + return nil; + } +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) + UIImage *image = [[NSImage alloc] initWithCGImage:imageRef size:CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef))]; +#else // ]TODO(macOS ISS#2323203) + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:UIImageOrientationUp]; +#endif // TODO(macOS ISS#2323203) + CGImageRelease(imageRef); + return image; +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + if (_imageSource) { + for (size_t i = 0; i < _frameCount; i++) { + CGImageSourceRemoveCacheAtIndex(_imageSource, i); + } + } +} + +- (void)dealloc +{ + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif // TODO(macOS ISS#2323203) +} + +@end diff --git a/Libraries/Image/RCTGIFImageDecoder.h b/Libraries/Image/RCTGIFImageDecoder.h index f9cc0eef4ebf94..5ddbf2a71bbea6 100644 --- a/Libraries/Image/RCTGIFImageDecoder.h +++ b/Libraries/Image/RCTGIFImageDecoder.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import @interface RCTGIFImageDecoder : NSObject diff --git a/Libraries/Image/RCTGIFImageDecoder.m b/Libraries/Image/RCTGIFImageDecoder.m index e030338d6fbd1b..a40b42529d1619 100644 --- a/Libraries/Image/RCTGIFImageDecoder.m +++ b/Libraries/Image/RCTGIFImageDecoder.m @@ -5,12 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTGIFImageDecoder.h" +#import #import #import #import +#import @implementation RCTGIFImageDecoder @@ -30,104 +31,13 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData resizeMode:(RCTResizeMode)resizeMode completionHandler:(RCTImageLoaderCompletionBlock)completionHandler { - CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL); - if (!imageSource) { + RCTAnimatedImage *image = [[RCTAnimatedImage alloc] initWithData:imageData scale:scale]; + + if (!image) { completionHandler(nil, nil); return ^{}; } - NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(imageSource, NULL); - CGFloat loopCount = 0; - if ([[properties[(id)kCGImagePropertyGIFDictionary] allKeys] containsObject:(id)kCGImagePropertyGIFLoopCount]) { - loopCount = [properties[(id)kCGImagePropertyGIFDictionary][(id)kCGImagePropertyGIFLoopCount] unsignedIntegerValue]; - if (loopCount == 0) { - // A loop count of 0 means infinite - loopCount = HUGE_VALF; - } else { - // A loop count of 1 means it should repeat twice, 2 means, thrice, etc. - loopCount += 1; - } - } - - UIImage *image = nil; - size_t imageCount = CGImageSourceGetCount(imageSource); - if (imageCount > 1) { - - NSTimeInterval duration = 0; - NSMutableArray *delays = [NSMutableArray arrayWithCapacity:imageCount]; - NSMutableArray *images = [NSMutableArray arrayWithCapacity:imageCount]; - for (size_t i = 0; i < imageCount; i++) { - - CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, i, NULL); - if (!imageRef) { - continue; - } - if (!image) { -#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) - image = [UIImage imageWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; -#else // [TODO(macOS ISS#2323203) - image = [[NSImage alloc] initWithCGImage:imageRef size:size]; -#endif // ]TODO(macOS ISS#2323203) - } - - NSDictionary *frameProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, i, NULL); - NSDictionary *frameGIFProperties = frameProperties[(id)kCGImagePropertyGIFDictionary]; - - const NSTimeInterval kDelayTimeIntervalDefault = 0.1; - NSNumber *delayTime = frameGIFProperties[(id)kCGImagePropertyGIFUnclampedDelayTime] ?: frameGIFProperties[(id)kCGImagePropertyGIFDelayTime]; - if (delayTime == nil) { - if (delays.count == 0) { - delayTime = @(kDelayTimeIntervalDefault); - } else { - delayTime = delays.lastObject; - } - } - - const NSTimeInterval kDelayTimeIntervalMinimum = 0.02; - if (delayTime.floatValue < (float)kDelayTimeIntervalMinimum - FLT_EPSILON) { - delayTime = @(kDelayTimeIntervalDefault); - } - - duration += delayTime.doubleValue; - [delays addObject:delayTime]; - [images addObject:(__bridge_transfer id)imageRef]; - } - CFRelease(imageSource); - - NSMutableArray *keyTimes = [NSMutableArray arrayWithCapacity:delays.count]; - NSTimeInterval runningDuration = 0; - for (NSNumber *delayNumber in delays) { - [keyTimes addObject:@(runningDuration / duration)]; - runningDuration += delayNumber.doubleValue; - } - - [keyTimes addObject:@1.0]; - - // Create animation - CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; - animation.calculationMode = kCAAnimationDiscrete; - animation.repeatCount = loopCount; - animation.keyTimes = keyTimes; - animation.values = images; - animation.duration = duration; - animation.removedOnCompletion = NO; - animation.fillMode = kCAFillModeForwards; - image.reactKeyframeAnimation = animation; - - } else { - - // Don't bother creating an animation - CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); - if (imageRef) { -#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) - image = [UIImage imageWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; -#else // [TODO(macOS ISS#2323203) - image = [[NSImage alloc] initWithCGImage:imageRef size:size]; -#endif // ]TODO(macOS ISS#2323203) - CFRelease(imageRef); - } - CFRelease(imageSource); - } - + completionHandler(nil, image); return ^{}; } diff --git a/Libraries/Image/RCTImage.xcodeproj/project.pbxproj b/Libraries/Image/RCTImage.xcodeproj/project.pbxproj deleted file mode 100644 index fcdca4a611bb52..00000000000000 --- a/Libraries/Image/RCTImage.xcodeproj/project.pbxproj +++ /dev/null @@ -1,667 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1304D5AB1AA8C4A30002E2BE /* RCTImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */; }; - 1304D5AC1AA8C4A30002E2BE /* RCTImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */; }; - 1304D5B21AA8C50D0002E2BE /* RCTGIFImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */; }; - 134B00A21B54232B00EC8DFB /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; }; - 139A38841C4D587C00862840 /* RCTResizeMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 139A38831C4D587C00862840 /* RCTResizeMode.m */; }; - 13EF7F7F1BC825B1003F47DD /* RCTLocalAssetImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */; }; - 143879381AAD32A300F088A5 /* RCTImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879371AAD32A300F088A5 /* RCTImageLoader.m */; }; - 18B022D11EF83BA700FC19B0 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; }; - 18B022D21EF83BA700FC19B0 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; }; - 18B022D31EF83BA700FC19B0 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; }; - 18B022D41EF83BA700FC19B0 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; }; - 18B022D51EF83BA700FC19B0 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; }; - 18B022D61EF83BA700FC19B0 /* RCTImageShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */; }; - 18B022D71EF83BA700FC19B0 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; }; - 18B022D81EF83BA700FC19B0 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 18B022D91EF83BA700FC19B0 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; }; - 18B022DA1EF83BA700FC19B0 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; }; - 18B022DB1EF83BA700FC19B0 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; }; - 18B022DC1EF83BA700FC19B0 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */; }; - 18B022DD1EF83BB300FC19B0 /* RCTGIFImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */; }; - 18B022DE1EF83BB300FC19B0 /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; }; - 18B022DF1EF83BB300FC19B0 /* RCTImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD34C261D4B8FE900268922 /* RCTImageCache.m */; }; - 18B022E01EF83BB300FC19B0 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; }; - 18B022E11EF83BB300FC19B0 /* RCTImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879371AAD32A300F088A5 /* RCTImageLoader.m */; }; - 18B022E21EF83BB300FC19B0 /* RCTImageShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */; }; - 18B022E31EF83BB300FC19B0 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; }; - 18B022E41EF83BB300FC19B0 /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; }; - 18B022E51EF83BB300FC19B0 /* RCTImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */; }; - 18B022E61EF83BB300FC19B0 /* RCTImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */; }; - 18B022E71EF83BB300FC19B0 /* RCTLocalAssetImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */; }; - 18B022E81EF83BB300FC19B0 /* RCTResizeMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 139A38831C4D587C00862840 /* RCTResizeMode.m */; }; - 18B022EA1EF83BCD00FC19B0 /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 2D3B5F1A1D9B0D0400451313 /* RCTImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD34C261D4B8FE900268922 /* RCTImageCache.m */; }; - 2D3B5F1B1D9B0D0700451313 /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; }; - 2D3B5F1C1D9B0D1300451313 /* RCTResizeMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 139A38831C4D587C00862840 /* RCTResizeMode.m */; }; - 2D3B5F1D1D9B0D1300451313 /* RCTLocalAssetImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */; }; - 2D3B5F1E1D9B0D1300451313 /* RCTGIFImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */; }; - 2D3B5F1F1D9B0D1300451313 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; }; - 2D3B5F201D9B0D1300451313 /* RCTImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879371AAD32A300F088A5 /* RCTImageLoader.m */; }; - 2D3B5F211D9B0D1300451313 /* RCTImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */; }; - 2D3B5F221D9B0D1300451313 /* RCTImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */; }; - 2D3B5F231D9B0D1300451313 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; }; - 2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; }; - 35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; }; - 354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; }; - 3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DA05A5A1EE0312600805843 /* RCTImageShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */; }; - 3DA05A5B1EE0312900805843 /* RCTImageShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */; }; - 3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; }; - 3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; }; - 3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; }; - 3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; }; - 3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; }; - 3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; }; - 3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; }; - 3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; }; - 3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; }; - 3DED3A941DE6F79800336DD7 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */; }; - 3DED3A961DE6F7A400336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; }; - 3DED3A971DE6F7A400336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; }; - 3DED3A981DE6F7A400336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; }; - 3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; }; - 3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; }; - 3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; }; - 3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; }; - 3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; }; - 3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; }; - 3DED3AA01DE6F7A400336DD7 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */; }; - 59AB092A1EDE5DD1009F97B5 /* RCTImageShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */; }; - 59AB092B1EDE5DD1009F97B5 /* RCTImageShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */; }; - CCD34C271D4B8FE900268922 /* RCTImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD34C261D4B8FE900268922 /* RCTImageCache.m */; }; - EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 18B022E91EF83BBC00FC19B0 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTImage; - dstSubfolderSpec = 16; - files = ( - 18B022EA1EF83BCD00FC19B0 /* RCTImageUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302E171DF8225500D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTImage; - dstSubfolderSpec = 16; - files = ( - 3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302F201DF8268700D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTImage; - dstSubfolderSpec = 16; - files = ( - 3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageView.h; sourceTree = ""; }; - 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageView.m; sourceTree = ""; }; - 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageViewManager.h; sourceTree = ""; }; - 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageViewManager.m; sourceTree = ""; }; - 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTGIFImageDecoder.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGIFImageDecoder.m; sourceTree = ""; }; - 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageUtils.h; sourceTree = ""; }; - 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtils.m; sourceTree = ""; }; - 139A38831C4D587C00862840 /* RCTResizeMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTResizeMode.m; sourceTree = ""; }; - 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLocalAssetImageLoader.h; sourceTree = ""; }; - 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLocalAssetImageLoader.m; sourceTree = ""; }; - 143879371AAD32A300F088A5 /* RCTImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoader.m; sourceTree = ""; }; - 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTImage-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageStoreManager.m; sourceTree = ""; }; - 354631661B69857700AA0B86 /* RCTImageEditingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageEditingManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 354631671B69857700AA0B86 /* RCTImageEditingManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageEditingManager.m; sourceTree = ""; }; - 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoader.h; sourceTree = ""; }; - 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageStoreManager.h; sourceTree = ""; }; - 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTResizeMode.h; sourceTree = ""; }; - 3D5FA68C1DE4BA290058FD77 /* libRCTNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libRCTNetwork.a; path = "../Network/build/Debug-iphoneos/libRCTNetwork.a"; sourceTree = ""; }; - 58B5115D1A9E6B3D00147676 /* libRCTImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageShadowView.h; sourceTree = ""; }; - 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageShadowView.m; sourceTree = ""; }; - 6BDE7AEB1ECB9C4400CC951F /* libRCTImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; - CCD34C251D4B8FE900268922 /* RCTImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageCache.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - CCD34C261D4B8FE900268922 /* RCTImageCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageCache.m; sourceTree = ""; }; - EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageBlurUtils.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageBlurUtils.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 3D5FA68B1DE4BA290058FD77 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 3D5FA68C1DE4BA290058FD77 /* libRCTNetwork.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 58B511541A9E6B3D00147676 = { - isa = PBXGroup; - children = ( - 3D5FA68B1DE4BA290058FD77 /* Frameworks */, - 58B5115E1A9E6B3D00147676 /* Products */, - 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */, - 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */, - EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */, - EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */, - CCD34C251D4B8FE900268922 /* RCTImageCache.h */, - CCD34C261D4B8FE900268922 /* RCTImageCache.m */, - 354631661B69857700AA0B86 /* RCTImageEditingManager.h */, - 354631671B69857700AA0B86 /* RCTImageEditingManager.m */, - 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */, - 143879371AAD32A300F088A5 /* RCTImageLoader.m */, - 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */, - 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */, - 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */, - 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */, - 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */, - 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */, - 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */, - 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */, - 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */, - 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */, - 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */, - 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */, - 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */, - 139A38831C4D587C00862840 /* RCTResizeMode.m */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5115E1A9E6B3D00147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5115D1A9E6B3D00147676 /* libRCTImage.a */, - 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */, - 6BDE7AEB1ECB9C4400CC951F /* libRCTImage.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 3DED3A891DE6F78800336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */, - 3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */, - 3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */, - 3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */, - 3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */, - 3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */, - 3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */, - 59AB092A1EDE5DD1009F97B5 /* RCTImageShadowView.h in Headers */, - 3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */, - 3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */, - 3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */, - 3DED3A941DE6F79800336DD7 /* RCTResizeMode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DED3A951DE6F79D00336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3A961DE6F7A400336DD7 /* RCTGIFImageDecoder.h in Headers */, - 3DED3A971DE6F7A400336DD7 /* RCTImageBlurUtils.h in Headers */, - 3DED3A981DE6F7A400336DD7 /* RCTImageCache.h in Headers */, - 3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */, - 3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */, - 3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */, - 3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */, - 3DA05A5A1EE0312600805843 /* RCTImageShadowView.h in Headers */, - 3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */, - 3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */, - 3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */, - 3DED3AA01DE6F7A400336DD7 /* RCTResizeMode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6BDE7ACE1ECB9C4400CC951F /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 18B022D11EF83BA700FC19B0 /* RCTGIFImageDecoder.h in Headers */, - 18B022D21EF83BA700FC19B0 /* RCTImageBlurUtils.h in Headers */, - 18B022D31EF83BA700FC19B0 /* RCTImageCache.h in Headers */, - 18B022D41EF83BA700FC19B0 /* RCTImageEditingManager.h in Headers */, - 18B022D51EF83BA700FC19B0 /* RCTImageLoader.h in Headers */, - 18B022D61EF83BA700FC19B0 /* RCTImageShadowView.h in Headers */, - 18B022D71EF83BA700FC19B0 /* RCTImageStoreManager.h in Headers */, - 18B022D81EF83BA700FC19B0 /* RCTImageUtils.h in Headers */, - 18B022D91EF83BA700FC19B0 /* RCTImageView.h in Headers */, - 18B022DA1EF83BA700FC19B0 /* RCTImageViewManager.h in Headers */, - 18B022DB1EF83BA700FC19B0 /* RCTLocalAssetImageLoader.h in Headers */, - 18B022DC1EF83BA700FC19B0 /* RCTResizeMode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2D2A28391D9B042B00D4039D /* RCTImage-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */; - buildPhases = ( - 3DED3A951DE6F79D00336DD7 /* Headers */, - 3D302F201DF8268700D6DDAE /* Copy Headers */, - 2D2A28361D9B042B00D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTImage-tvOS"; - productName = "RCTImage-tvOS"; - productReference = 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B5115C1A9E6B3D00147676 /* RCTImage */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */; - buildPhases = ( - 3DED3A891DE6F78800336DD7 /* Headers */, - 3D302E171DF8225500D6DDAE /* Copy Headers */, - 58B511591A9E6B3D00147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTImage; - productName = RCTNetworkImage; - productReference = 58B5115D1A9E6B3D00147676 /* libRCTImage.a */; - productType = "com.apple.product-type.library.static"; - }; - 6BDE7ACD1ECB9C4400CC951F /* RCTImage-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6BDE7AE81ECB9C4400CC951F /* Build configuration list for PBXNativeTarget "RCTImage-macOS" */; - buildPhases = ( - 6BDE7ACE1ECB9C4400CC951F /* Headers */, - 18B022E91EF83BBC00FC19B0 /* Copy Headers */, - 6BDE7ADC1ECB9C4400CC951F /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTImage-macOS"; - productName = RCTNetworkImage; - productReference = 6BDE7AEB1ECB9C4400CC951F /* libRCTImage.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511551A9E6B3D00147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28391D9B042B00D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B5115C1A9E6B3D00147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTImage" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511541A9E6B3D00147676; - productRefGroup = 58B5115E1A9E6B3D00147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5115C1A9E6B3D00147676 /* RCTImage */, - 6BDE7ACD1ECB9C4400CC951F /* RCTImage-macOS */, - 2D2A28391D9B042B00D4039D /* RCTImage-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28361D9B042B00D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F231D9B0D1300451313 /* RCTImageStoreManager.m in Sources */, - 2D3B5F1A1D9B0D0400451313 /* RCTImageCache.m in Sources */, - 2D3B5F1D1D9B0D1300451313 /* RCTLocalAssetImageLoader.m in Sources */, - 2D3B5F1F1D9B0D1300451313 /* RCTImageEditingManager.m in Sources */, - 2D3B5F1E1D9B0D1300451313 /* RCTGIFImageDecoder.m in Sources */, - 2D3B5F1C1D9B0D1300451313 /* RCTResizeMode.m in Sources */, - 2D3B5F221D9B0D1300451313 /* RCTImageViewManager.m in Sources */, - 2D3B5F211D9B0D1300451313 /* RCTImageView.m in Sources */, - 3DA05A5B1EE0312900805843 /* RCTImageShadowView.m in Sources */, - 2D3B5F201D9B0D1300451313 /* RCTImageLoader.m in Sources */, - 2D3B5F1B1D9B0D0700451313 /* RCTImageBlurUtils.m in Sources */, - 2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511591A9E6B3D00147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */, - 1304D5AC1AA8C4A30002E2BE /* RCTImageViewManager.m in Sources */, - 1304D5B21AA8C50D0002E2BE /* RCTGIFImageDecoder.m in Sources */, - 143879381AAD32A300F088A5 /* RCTImageLoader.m in Sources */, - 354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */, - 139A38841C4D587C00862840 /* RCTResizeMode.m in Sources */, - 1304D5AB1AA8C4A30002E2BE /* RCTImageView.m in Sources */, - EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */, - 59AB092B1EDE5DD1009F97B5 /* RCTImageShadowView.m in Sources */, - 13EF7F7F1BC825B1003F47DD /* RCTLocalAssetImageLoader.m in Sources */, - 134B00A21B54232B00EC8DFB /* RCTImageUtils.m in Sources */, - CCD34C271D4B8FE900268922 /* RCTImageCache.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6BDE7ADC1ECB9C4400CC951F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 18B022DD1EF83BB300FC19B0 /* RCTGIFImageDecoder.m in Sources */, - 18B022DE1EF83BB300FC19B0 /* RCTImageBlurUtils.m in Sources */, - 18B022DF1EF83BB300FC19B0 /* RCTImageCache.m in Sources */, - 18B022E01EF83BB300FC19B0 /* RCTImageEditingManager.m in Sources */, - 18B022E11EF83BB300FC19B0 /* RCTImageLoader.m in Sources */, - 18B022E21EF83BB300FC19B0 /* RCTImageShadowView.m in Sources */, - 18B022E31EF83BB300FC19B0 /* RCTImageStoreManager.m in Sources */, - 18B022E41EF83BB300FC19B0 /* RCTImageUtils.m in Sources */, - 18B022E51EF83BB300FC19B0 /* RCTImageView.m in Sources */, - 18B022E61EF83BB300FC19B0 /* RCTImageViewManager.m in Sources */, - 18B022E71EF83BB300FC19B0 /* RCTLocalAssetImageLoader.m in Sources */, - 18B022E81EF83BB300FC19B0 /* RCTResizeMode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28401D9B042B00D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28411D9B042B00D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B5116F1A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511701A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511721A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511731A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - 6BDE7AE91ECB9C4400CC951F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 6BDE7AEA1ECB9C4400CC951F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28401D9B042B00D4039D /* Debug */, - 2D2A28411D9B042B00D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTImage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B5116F1A9E6B3D00147676 /* Debug */, - 58B511701A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511721A9E6B3D00147676 /* Debug */, - 58B511731A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6BDE7AE81ECB9C4400CC951F /* Build configuration list for PBXNativeTarget "RCTImage-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6BDE7AE91ECB9C4400CC951F /* Debug */, - 6BDE7AEA1ECB9C4400CC951F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511551A9E6B3D00147676 /* Project object */; -} diff --git a/Libraries/Image/RCTImageBlurUtils.m b/Libraries/Image/RCTImageBlurUtils.m index 6f3a5e6362d2d3..7167f611015ebd 100644 --- a/Libraries/Image/RCTImageBlurUtils.m +++ b/Libraries/Image/RCTImageBlurUtils.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageBlurUtils.h" +#import #import // TODO(macOS ISS#2323203) #import // TODO(macOS ISS#2323203) diff --git a/Libraries/Image/RCTImageCache.h b/Libraries/Image/RCTImageCache.h index b7acc1126ca6cd..e64b1a178d9d01 100644 --- a/Libraries/Image/RCTImageCache.h +++ b/Libraries/Image/RCTImageCache.h @@ -5,9 +5,38 @@ * LICENSE file in the root directory of this source tree. */ +#import // TODO(macOS ISS#2323203) #import -#import +#import + +@interface UIImage (React) + +/** + * Memory bytes of the image with the default calculation of static image or GIF. Custom calculations of decoded bytes can be assigned manually. + */ +@property (nonatomic, assign) NSInteger reactDecodedImageBytes; + +@end + +/** + * Provides an interface to use for providing a image caching strategy. + */ +@protocol RCTImageCache + +- (UIImage *)imageForUrl:(NSString *)url + size:(CGSize)size + scale:(CGFloat)scale + resizeMode:(RCTResizeMode)resizeMode; + +- (void)addImageToCache:(UIImage *)image + URL:(NSString *)url + size:(CGSize)size + scale:(CGFloat)scale + resizeMode:(RCTResizeMode)resizeMode + response:(NSURLResponse *)response; + +@end @interface RCTImageCache : NSObject @end diff --git a/Libraries/Image/RCTImageCache.m b/Libraries/Image/RCTImageCache.m index 90890543a0d0e7..cbacea8fa5da62 100644 --- a/Libraries/Image/RCTImageCache.m +++ b/Libraries/Image/RCTImageCache.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageCache.h" +#import #import @@ -16,7 +16,7 @@ #import #import -#import "RCTImageUtils.h" +#import static const NSUInteger RCTMaxCachableDecodedImageSizeInBytes = 2097152; // 2 MB @@ -77,7 +77,7 @@ - (void)addImageToCache:(UIImage *)image if (!image) { return; } - NSInteger bytes = image.reactDecodedImageBytes; // TODO(macOS ISS#2323203) + NSInteger bytes = image.reactDecodedImageBytes; if (bytes <= RCTMaxCachableDecodedImageSizeInBytes) { [self->_decodedImageCache setObject:image forKey:cacheKey diff --git a/Libraries/Image/RCTImageDataDecoder.h b/Libraries/Image/RCTImageDataDecoder.h new file mode 100644 index 00000000000000..06346296e936a4 --- /dev/null +++ b/Libraries/Image/RCTImageDataDecoder.h @@ -0,0 +1,53 @@ +/** + * 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. + */ + +#import // TODO(macOS ISS#2323203) + +#import +#import +#import +#import + +/** + * Provides the interface needed to register an image decoder. Image decoders + * are also bridge modules, so should be registered using RCT_EXPORT_MODULE(). + */ +@protocol RCTImageDataDecoder + +/** + * Indicates whether this handler is capable of decoding the specified data. + * Typically the handler would examine some sort of header data to determine + * this. + */ +- (BOOL)canDecodeImageData:(NSData *)imageData; + +/** + * Decode an image from the data object. The method should call the + * completionHandler when the decoding operation has finished. The method + * should also return a cancellation block, if applicable. + * + * If you provide a custom image decoder, you most implement scheduling yourself, + * to avoid decoding large amounts of images at the same time. + */ +- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData + size:(CGSize)size + scale:(CGFloat)scale + resizeMode:(RCTResizeMode)resizeMode + completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; + +@optional + +/** + * If more than one RCTImageDataDecoder responds YES to `-canDecodeImageData:` + * then `decoderPriority` is used to determine which one to use. The decoder + * with the highest priority will be selected. Default priority is zero. + * If two or more valid decoders have the same priority, the selection order is + * undefined. + */ +- (float)decoderPriority; + +@end diff --git a/Libraries/Image/RCTImageEditingManager.m b/Libraries/Image/RCTImageEditingManager.m deleted file mode 100644 index c38e74ac0b93ad..00000000000000 --- a/Libraries/Image/RCTImageEditingManager.m +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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. - */ - -#import "RCTImageEditingManager.h" - -#import // TODO(macOS ISS#2323203) - -#import -#import -#import - -#import "RCTImageLoader.h" -#import "RCTImageStoreManager.h" -#import "RCTImageUtils.h" - -@implementation RCTImageEditingManager - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -/** - * Crops an image and adds the result to the image store. - * - * @param imageRequest An image URL - * @param cropData Dictionary with `offset`, `size` and `displaySize`. - * `offset` and `size` are relative to the full-resolution image size. - * `displaySize` is an optimization - if specified, the image will - * be scaled down to `displaySize` rather than `size`. - * All units are in px (not points). - */ -RCT_EXPORT_METHOD(cropImage:(NSURLRequest *)imageRequest - cropData:(NSDictionary *)cropData - successCallback:(RCTResponseSenderBlock)successCallback - errorCallback:(RCTResponseErrorBlock)errorCallback) -{ - CGRect rect = { - [RCTConvert CGPoint:cropData[@"offset"]], - [RCTConvert CGSize:cropData[@"size"]] - }; - - [_bridge.imageLoader loadImageWithURLRequest:imageRequest callback:^(NSError *error, UIImage *image) { - if (error) { - errorCallback(error); - return; - } - - // Crop image - CGSize targetSize = rect.size; - CGRect targetRect = {{-rect.origin.x, -rect.origin.y}, image.size}; - CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); - UIImage *croppedImage = RCTTransformImage(image, targetSize, UIImageGetScale(image), transform); // TODO(macOS ISS#2323203) - - // Scale image - if (cropData[@"displaySize"]) { - targetSize = [RCTConvert CGSize:cropData[@"displaySize"]]; // in pixels - RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropData[@"resizeMode"] ?: @"contain"]; - targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode); - transform = RCTTransformFromTargetRect(croppedImage.size, targetRect); - croppedImage = RCTTransformImage(croppedImage, targetSize, UIImageGetScale(image), transform); // TODO(macOS ISS#2323203) - } - - // Store image - [self->_bridge.imageStoreManager storeImage:croppedImage withBlock:^(NSString *croppedImageTag) { - if (!croppedImageTag) { - NSString *errorMessage = @"Error storing cropped image in RCTImageStoreManager"; - RCTLogWarn(@"%@", errorMessage); - errorCallback(RCTErrorWithMessage(errorMessage)); - return; - } - successCallback(@[croppedImageTag]); - }]; - }]; -} - -@end diff --git a/Libraries/Image/RCTImageLoader.h b/Libraries/Image/RCTImageLoader.h deleted file mode 100644 index 3b54dab8c2f388..00000000000000 --- a/Libraries/Image/RCTImageLoader.h +++ /dev/null @@ -1,264 +0,0 @@ -/** - * 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. - */ - -#import // TODO(macOS ISS#2323203) - -#import -#import -#import - -typedef void (^RCTImageLoaderProgressBlock)(int64_t progress, int64_t total); -typedef void (^RCTImageLoaderPartialLoadBlock)(UIImage *image); -typedef void (^RCTImageLoaderCompletionBlock)(NSError *error, UIImage *image); -typedef dispatch_block_t RCTImageLoaderCancellationBlock; - -@protocol RCTImageURLLoader; -@protocol RCTImageDataDecoder; - -/** - * Provides an interface to use for providing a image caching strategy. - */ -@protocol RCTImageCache - -- (UIImage *)imageForUrl:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode; - -- (void)addImageToCache:(UIImage *)image - URL:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - response:(NSURLResponse *)response; - -@end - -/** - * If available, RCTImageRedirectProtocol is invoked before loading an asset. - * Implementation should return either a new URL or nil when redirection is - * not needed. - */ - -@protocol RCTImageRedirectProtocol - -- (NSURL *)redirectAssetsURL:(NSURL *)URL; - -@end - -@interface UIImage (React) - -@property (nonatomic, copy) CAKeyframeAnimation *reactKeyframeAnimation; - -/** - * Memory bytes of the image with the default calculation of static image or GIF. Custom calculations of decoded bytes can be assigned manually. - */ -@property (nonatomic, assign) NSInteger reactDecodedImageBytes; - -@end - -@interface RCTImageLoader : NSObject - -/** - * The maximum number of concurrent image loading tasks. Loading and decoding - * images can consume a lot of memory, so setting this to a higher value may - * cause memory to spike. If you are seeing out-of-memory crashes, try reducing - * this value. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentLoadingTasks; - -/** - * The maximum number of concurrent image decoding tasks. Decoding large - * images can be especially CPU and memory intensive, so if your are decoding a - * lot of large images in your app, you may wish to adjust this value. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentDecodingTasks; - -/** - * Decoding large images can use a lot of memory, and potentially cause the app - * to crash. This value allows you to throttle the amount of memory used by the - * decoder independently of the number of concurrent threads. This means you can - * still decode a lot of small images in parallel, without allowing the decoder - * to try to decompress multiple huge images at once. Note that this value is - * only a hint, and not an indicator of the total memory used by the app. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentDecodingBytes; - -- (instancetype)init; -- (instancetype)initWithRedirectDelegate:(id)redirectDelegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithRedirectDelegate:(id)redirectDelegate - loadersProvider:(NSArray> * (^)(void))getLoaders - decodersProvider:(NSArray> * (^)(void))getDecoders; - -/** - * Loads the specified image at the highest available resolution. - * Can be called from any thread, will call back on an unspecified thread. - */ -- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - callback:(RCTImageLoaderCompletionBlock)callback; - -/** - * As above, but includes target `size`, `scale` and `resizeMode`, which are used to - * select the optimal dimensions for the loaded image. The `clipped` option - * controls whether the image will be clipped to fit the specified size exactly, - * or if the original aspect ratio should be retained. - * `partialLoadBlock` is meant for custom image loaders that do not ship with the core RN library. - * It is meant to be called repeatedly while loading the image as higher quality versions are decoded, - * for instance with progressive JPEGs. - */ -- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - progressBlock:(RCTImageLoaderProgressBlock)progressBlock - partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; - -/** - * Finds an appropriate image decoder and passes the target `size`, `scale` and - * `resizeMode` for optimal image decoding. The `clipped` option controls - * whether the image will be clipped to fit the specified size exactly, or - * if the original aspect ratio should be retained. Can be called from any - * thread, will call callback on an unspecified thread. - */ -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; - -/** - * Get image size, in pixels. This method will do the least work possible to get - * the information, and won't decode the image if it doesn't have to. - */ -- (RCTImageLoaderCancellationBlock)getImageSizeForURLRequest:(NSURLRequest *)imageURLRequest - block:(void(^)(NSError *error, CGSize size))completionBlock; -/** - * Determines whether given image URLs are cached locally. The `requests` array is expected - * to contain objects convertible to NSURLRequest. The return value maps URLs to strings: - * "disk" for images known to be cached in non-volatile storage, "memory" for images known - * to be cached in memory. Dictionary items corresponding to images that are not known to be - * cached are simply missing. - */ -- (NSDictionary *)getImageCacheStatus:(NSArray *)requests; - -/** - * Allows developers to set their own caching implementation for - * decoded images as long as it conforms to the RCTImageCache - * protocol. This method should be called in bridgeDidInitializeModule. - */ -- (void)setImageCache:(id)cache; - -@end - -@interface RCTBridge (RCTImageLoader) - -/** - * The shared image loader instance - */ -@property (nonatomic, readonly) RCTImageLoader *imageLoader; - -@end - -/** - * Provides the interface needed to register an image loader. Image data - * loaders are also bridge modules, so should be registered using - * RCT_EXPORT_MODULE(). - */ -@protocol RCTImageURLLoader - -/** - * Indicates whether this data loader is capable of processing the specified - * request URL. Typically the handler would examine the scheme/protocol of the - * URL to determine this. - */ -- (BOOL)canLoadImageURL:(NSURL *)requestURL; - -/** - * Send a network request to load the request URL. The method should call the - * progressHandler (if applicable) and the completionHandler when the request - * has finished. The method should also return a cancellation block, if - * applicable. - */ -- (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressHandler:(RCTImageLoaderProgressBlock)progressHandler - partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; - -@optional - -/** - * If more than one RCTImageURLLoader responds YES to `-canLoadImageURL:` - * then `loaderPriority` is used to determine which one to use. The loader - * with the highest priority will be selected. Default priority is zero. If - * two or more valid loaders have the same priority, the selection order is - * undefined. - */ -- (float)loaderPriority; - -/** - * If the loader must be called on the serial url cache queue, and whether the completion - * block should be dispatched off the main thread. If this is NO, the loader will be - * called from the main queue. Defaults to YES. - * - * Use with care: disabling scheduling will reduce RCTImageLoader's ability to throttle - * network requests. - */ -- (BOOL)requiresScheduling; - -/** - * If images loaded by the loader should be cached in the decoded image cache. - * Defaults to YES. - */ -- (BOOL)shouldCacheLoadedImages; - -@end - -/** - * Provides the interface needed to register an image decoder. Image decoders - * are also bridge modules, so should be registered using RCT_EXPORT_MODULE(). - */ -@protocol RCTImageDataDecoder - -/** - * Indicates whether this handler is capable of decoding the specified data. - * Typically the handler would examine some sort of header data to determine - * this. - */ -- (BOOL)canDecodeImageData:(NSData *)imageData; - -/** - * Decode an image from the data object. The method should call the - * completionHandler when the decoding operation has finished. The method - * should also return a cancellation block, if applicable. - * - * If you provide a custom image decoder, you most implement scheduling yourself, - * to avoid decoding large amounts of images at the same time. - */ -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; - -@optional - -/** - * If more than one RCTImageDataDecoder responds YES to `-canDecodeImageData:` - * then `decoderPriority` is used to determine which one to use. The decoder - * with the highest priority will be selected. Default priority is zero. - * If two or more valid decoders have the same priority, the selection order is - * undefined. - */ -- (float)decoderPriority; - -@end diff --git a/Libraries/Image/RCTImageLoaderProtocol.h b/Libraries/Image/RCTImageLoaderProtocol.h new file mode 100644 index 00000000000000..e40f157f919b04 --- /dev/null +++ b/Libraries/Image/RCTImageLoaderProtocol.h @@ -0,0 +1,116 @@ +/** + * 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. + */ + +#import // TODO(macOS ISS#2323203) + +#import +#import +#import +#import +#import +#import + +/** + * If available, RCTImageRedirectProtocol is invoked before loading an asset. + * Implementation should return either a new URL or nil when redirection is + * not needed. + */ + +@protocol RCTImageRedirectProtocol + +- (NSURL *)redirectAssetsURL:(NSURL *)URL; + +@end + +@protocol RCTImageLoaderProtocol + +/** + * The maximum number of concurrent image loading tasks. Loading and decoding + * images can consume a lot of memory, so setting this to a higher value may + * cause memory to spike. If you are seeing out-of-memory crashes, try reducing + * this value. + */ +@property (nonatomic, assign) NSUInteger maxConcurrentLoadingTasks; + +/** + * The maximum number of concurrent image decoding tasks. Decoding large + * images can be especially CPU and memory intensive, so if your are decoding a + * lot of large images in your app, you may wish to adjust this value. + */ +@property (nonatomic, assign) NSUInteger maxConcurrentDecodingTasks; + +/** + * Decoding large images can use a lot of memory, and potentially cause the app + * to crash. This value allows you to throttle the amount of memory used by the + * decoder independently of the number of concurrent threads. This means you can + * still decode a lot of small images in parallel, without allowing the decoder + * to try to decompress multiple huge images at once. Note that this value is + * only a hint, and not an indicator of the total memory used by the app. + */ +@property (nonatomic, assign) NSUInteger maxConcurrentDecodingBytes; + +/** + * Loads the specified image at the highest available resolution. + * Can be called from any thread, will call back on an unspecified thread. + */ +- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest + callback:(RCTImageLoaderCompletionBlock)callback; + +/** + * As above, but includes target `size`, `scale` and `resizeMode`, which are used to + * select the optimal dimensions for the loaded image. The `clipped` option + * controls whether the image will be clipped to fit the specified size exactly, + * or if the original aspect ratio should be retained. + * `partialLoadBlock` is meant for custom image loaders that do not ship with the core RN library. + * It is meant to be called repeatedly while loading the image as higher quality versions are decoded, + * for instance with progressive JPEGs. + */ +- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest + size:(CGSize)size + scale:(CGFloat)scale + clipped:(BOOL)clipped + resizeMode:(RCTResizeMode)resizeMode + progressBlock:(RCTImageLoaderProgressBlock)progressBlock + partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock + completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; + +/** + * Finds an appropriate image decoder and passes the target `size`, `scale` and + * `resizeMode` for optimal image decoding. The `clipped` option controls + * whether the image will be clipped to fit the specified size exactly, or + * if the original aspect ratio should be retained. Can be called from any + * thread, will call callback on an unspecified thread. + */ +- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData + size:(CGSize)size + scale:(CGFloat)scale + clipped:(BOOL)clipped + resizeMode:(RCTResizeMode)resizeMode + completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; + +/** + * Get image size, in pixels. This method will do the least work possible to get + * the information, and won't decode the image if it doesn't have to. + */ +- (RCTImageLoaderCancellationBlock)getImageSizeForURLRequest:(NSURLRequest *)imageURLRequest + block:(void(^)(NSError *error, CGSize size))completionBlock; +/** + * Determines whether given image URLs are cached locally. The `requests` array is expected + * to contain objects convertible to NSURLRequest. The return value maps URLs to strings: + * "disk" for images known to be cached in non-volatile storage, "memory" for images known + * to be cached in memory. Dictionary items corresponding to images that are not known to be + * cached are simply missing. + */ +- (NSDictionary *)getImageCacheStatus:(NSArray *)requests; + +/** + * Allows developers to set their own caching implementation for + * decoded images as long as it conforms to the RCTImageCache + * protocol. This method should be called in bridgeDidInitializeModule. + */ +- (void)setImageCache:(id)cache; +@end diff --git a/Libraries/Image/RCTImageShadowView.m b/Libraries/Image/RCTImageShadowView.m index 9102dc1b3b0b73..df50b36b13142d 100644 --- a/Libraries/Image/RCTImageShadowView.m +++ b/Libraries/Image/RCTImageShadowView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageShadowView.h" +#import #import diff --git a/Libraries/Image/RCTImageURLLoader.h b/Libraries/Image/RCTImageURLLoader.h new file mode 100644 index 00000000000000..6de35a366073e0 --- /dev/null +++ b/Libraries/Image/RCTImageURLLoader.h @@ -0,0 +1,73 @@ +/** + * 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. + */ + +#import // TODO(macOS ISS#2323203) + +#import +#import + +typedef void (^RCTImageLoaderProgressBlock)(int64_t progress, int64_t total); +typedef void (^RCTImageLoaderPartialLoadBlock)(UIImage *image); +typedef void (^RCTImageLoaderCompletionBlock)(NSError *error, UIImage *image); +typedef dispatch_block_t RCTImageLoaderCancellationBlock; + +/** + * Provides the interface needed to register an image loader. Image data + * loaders are also bridge modules, so should be registered using + * RCT_EXPORT_MODULE(). + */ +@protocol RCTImageURLLoader + +/** + * Indicates whether this data loader is capable of processing the specified + * request URL. Typically the handler would examine the scheme/protocol of the + * URL to determine this. + */ +- (BOOL)canLoadImageURL:(NSURL *)requestURL; + +/** + * Send a network request to load the request URL. The method should call the + * progressHandler (if applicable) and the completionHandler when the request + * has finished. The method should also return a cancellation block, if + * applicable. + */ +- (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL + size:(CGSize)size + scale:(CGFloat)scale + resizeMode:(RCTResizeMode)resizeMode + progressHandler:(RCTImageLoaderProgressBlock)progressHandler + partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler + completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; + +@optional + +/** + * If more than one RCTImageURLLoader responds YES to `-canLoadImageURL:` + * then `loaderPriority` is used to determine which one to use. The loader + * with the highest priority will be selected. Default priority is zero. If + * two or more valid loaders have the same priority, the selection order is + * undefined. + */ +- (float)loaderPriority; + +/** + * If the loader must be called on the serial url cache queue, and whether the completion + * block should be dispatched off the main thread. If this is NO, the loader will be + * called from the main queue. Defaults to YES. + * + * Use with care: disabling scheduling will reduce RCTImageLoader's ability to throttle + * network requests. + */ +- (BOOL)requiresScheduling; + +/** + * If images loaded by the loader should be cached in the decoded image cache. + * Defaults to YES. + */ +- (BOOL)shouldCacheLoadedImages; + +@end diff --git a/Libraries/Image/RCTImageUtils.m b/Libraries/Image/RCTImageUtils.m index 8799a6f30667a7..9d46a8e956b96b 100644 --- a/Libraries/Image/RCTImageUtils.m +++ b/Libraries/Image/RCTImageUtils.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageUtils.h" +#import #import diff --git a/Libraries/Image/RCTImageView.m b/Libraries/Image/RCTImageView.m index 21c6c3c999165b..ef507653bdba92 100644 --- a/Libraries/Image/RCTImageView.m +++ b/Libraries/Image/RCTImageView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageView.h" +#import #import #import @@ -14,9 +14,10 @@ #import #import -#import "RCTImageBlurUtils.h" -#import "RCTImageLoader.h" -#import "RCTImageUtils.h" +#import +#import +#import +#import /** * Determines whether an image of `currentSize` should be reloaded for display @@ -126,16 +127,12 @@ @implementation RCTImageView // Whether the latest change of props requires the image to be reloaded BOOL _needsReload; - + + RCTUIImageViewAnimated *_imageView; + #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) // Whether observing changes to the window's backing scale BOOL _subscribedToWindowBackingNotifications; -#endif // ]TODO(macOS ISS#2323203) - -#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) - NSImageView *_imageView; -#else - UIImageView *_imageView; #endif // [TODO(macOS ISS#2323203) } @@ -150,8 +147,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) self.wantsLayer = YES; #endif - -#if !TARGET_OS_OSX // ]TODO(macOS ISS#2323203) +#if !TARGET_OS_OSX NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(clearImageIfDetached) @@ -161,10 +157,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge selector:@selector(clearImageIfDetached) name:UIApplicationDidEnterBackgroundNotification object:nil]; - _imageView = [[UIImageView alloc] init]; -#else - _imageView = [[NSImageView alloc] init]; -#endif // TODO(macOS ISS#2323203) +#endif + _imageView = [[RCTUIImageViewAnimated alloc] init]; _imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:_imageView]; } @@ -329,7 +323,6 @@ - (void)cancelImageLoad - (void)clearImage { [self cancelImageLoad]; - [_imageView.layer removeAnimationForKey:@"contents"]; self.image = nil; _imageSource = nil; } @@ -442,14 +435,14 @@ - (void)reloadImage }; _reloadImageCancellationBlock = - [_bridge.imageLoader loadImageWithURLRequest:source.request - size:imageSize - scale:imageScale - clipped:NO - resizeMode:_resizeMode - progressBlock:progressHandler - partialLoadBlock:partialLoadHandler - completionBlock:completionHandler]; + [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:source.request + size:imageSize + scale:imageScale + clipped:NO + resizeMode:_resizeMode + progressBlock:progressHandler + partialLoadBlock:partialLoadHandler + completionBlock:completionHandler]; } else { [self clearImage]; } @@ -463,6 +456,10 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for } if (error) { + RCTExecuteOnMainQueue(^{ + self.image = nil; + }); + if (_onError) { _onError(@{ @"error": error.localizedDescription }); } @@ -478,23 +475,7 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for self->_pendingImageSource = nil; } - [self->_imageView.layer removeAnimationForKey:@"contents"]; - if (image.reactKeyframeAnimation) { - CGImageRef posterImageRef = (__bridge CGImageRef)[image.reactKeyframeAnimation.values firstObject]; - if (!posterImageRef) { - return; - } - // Apply renderingMode to animated image. -#if TARGET_OS_OSX // TODO(macOS ISS#2323203) - // NSImages don't have rendering modes, so ignore - self->_imageView.image = [[NSImage alloc] initWithCGImage:posterImageRef size:NSZeroSize /* shorthand for same size as CGImageRef */]; -#else // TODO(macOS ISS#2323203) - self->_imageView.image = [[UIImage imageWithCGImage:posterImageRef] imageWithRenderingMode:self->_renderingMode]; -#endif // TODO(macOS ISS#2323203) - [self->_imageView.layer addAnimation:image.reactKeyframeAnimation forKey:@"contents"]; - } else { - self.image = image; - } + self.image = image; if (isPartialLoad) { if (self->_onPartialLoad) { diff --git a/Libraries/Image/RCTImageViewManager.m b/Libraries/Image/RCTImageViewManager.m index 60a3e3d392967a..e0022bb889dae5 100644 --- a/Libraries/Image/RCTImageViewManager.m +++ b/Libraries/Image/RCTImageViewManager.m @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTImageViewManager.h" +#import #import // TODO(macOS ISS#2323203) #import #import -#import "RCTImageLoader.h" -#import "RCTImageShadowView.h" -#import "RCTImageView.h" +#import +#import +#import @implementation RCTImageViewManager @@ -56,28 +56,30 @@ - (RCTPlatformView *)view // TODO(macOS ISS#2323203) successBlock:(RCTResponseSenderBlock)successBlock errorBlock:(RCTResponseErrorBlock)errorBlock) { - [self.bridge.imageLoader getImageSizeForURLRequest:request - block:^(NSError *error, CGSize size) { - if (error) { - errorBlock(error); - } else { - successBlock(@[@(size.width), @(size.height)]); - } - }]; + [[self.bridge moduleForName:@"ImageLoader"] + getImageSizeForURLRequest:request + block:^(NSError *error, CGSize size) { + if (error) { + errorBlock(error); + } else { + successBlock(@[@(size.width), @(size.height)]); + } + }]; } RCT_EXPORT_METHOD(getSizeWithHeaders:(RCTImageSource *)source resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { - [self.bridge.imageLoader getImageSizeForURLRequest:source.request - block:^(NSError *error, CGSize size) { - if (error) { - reject(@"E_GET_SIZE_FAILURE", nil, error); - return; - } - resolve(@{@"width":@(size.width),@"height":@(size.height)}); - }]; + [[self.bridge moduleForName:@"ImageLoader"] + getImageSizeForURLRequest:source.request + block:^(NSError *error, CGSize size) { + if (error) { + reject(@"E_GET_SIZE_FAILURE", nil, error); + return; + } + resolve(@{@"width":@(size.width),@"height":@(size.height)}); + }]; } RCT_EXPORT_METHOD(prefetchImage:(NSURLRequest *)request @@ -89,21 +91,22 @@ - (RCTPlatformView *)view // TODO(macOS ISS#2323203) return; } - [self.bridge.imageLoader loadImageWithURLRequest:request - callback:^(NSError *error, UIImage *image) { - if (error) { - reject(@"E_PREFETCH_FAILURE", nil, error); - return; - } - resolve(@YES); - }]; + [[self.bridge moduleForName:@"ImageLoader"] + loadImageWithURLRequest:request + callback:^(NSError *error, UIImage *image) { + if (error) { + reject(@"E_PREFETCH_FAILURE", nil, error); + return; + } + resolve(@YES); + }]; } RCT_EXPORT_METHOD(queryCache:(NSArray *)requests resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { - resolve([self.bridge.imageLoader getImageCacheStatus:requests]); + resolve([[self.bridge moduleForName:@"ImageLoader"] getImageCacheStatus:requests]); } @end diff --git a/Libraries/Image/RCTLocalAssetImageLoader.h b/Libraries/Image/RCTLocalAssetImageLoader.h index df3918ad548c1a..aab44d184421fd 100644 --- a/Libraries/Image/RCTLocalAssetImageLoader.h +++ b/Libraries/Image/RCTLocalAssetImageLoader.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import @interface RCTLocalAssetImageLoader : NSObject diff --git a/Libraries/Image/RCTLocalAssetImageLoader.m b/Libraries/Image/RCTLocalAssetImageLoader.m index 68407f38064ab0..8348c363cf9eef 100644 --- a/Libraries/Image/RCTLocalAssetImageLoader.m +++ b/Libraries/Image/RCTLocalAssetImageLoader.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTLocalAssetImageLoader.h" +#import #import diff --git a/Libraries/Image/RCTResizeMode.m b/Libraries/Image/RCTResizeMode.m index 34027f8e8a2ec0..f718d5bd15e405 100644 --- a/Libraries/Image/RCTResizeMode.m +++ b/Libraries/Image/RCTResizeMode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTResizeMode.h" +#import @implementation RCTConvert(RCTResizeMode) diff --git a/Libraries/Image/RCTUIImageViewAnimated.h b/Libraries/Image/RCTUIImageViewAnimated.h new file mode 100644 index 00000000000000..30ba461d51450e --- /dev/null +++ b/Libraries/Image/RCTUIImageViewAnimated.h @@ -0,0 +1,17 @@ +/** + * 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. + */ + +#import +#import + +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) +@interface RCTUIImageViewAnimated : NSImageView +#else // ]TODO(macOS ISS#2323203) +@interface RCTUIImageViewAnimated : UIImageView +#endif // TODO(macOS ISS#2323203) + +@end diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m new file mode 100644 index 00000000000000..ffc5534d98ac4d --- /dev/null +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -0,0 +1,337 @@ +/** + * 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. + */ + +#import +#import + +#import +#import + +static NSUInteger RCTDeviceTotalMemory() { + return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory]; +} + +static NSUInteger RCTDeviceFreeMemory() { + mach_port_t host_port = mach_host_self(); + mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); + vm_size_t page_size; + vm_statistics_data_t vm_stat; + kern_return_t kern; + + kern = host_page_size(host_port, &page_size); + if (kern != KERN_SUCCESS) return 0; + kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size); + if (kern != KERN_SUCCESS) return 0; + return vm_stat.free_count * page_size; +} + +@interface RCTUIImageViewAnimated () + +@property (nonatomic, assign) NSUInteger maxBufferSize; +@property (nonatomic, strong, readwrite) UIImage *currentFrame; +@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex; +@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount; +@property (nonatomic, assign) NSUInteger totalFrameCount; +@property (nonatomic, assign) NSUInteger totalLoopCount; +@property (nonatomic, strong) UIImage *animatedImage; +@property (nonatomic, strong) NSMutableDictionary *frameBuffer; +@property (nonatomic, assign) NSTimeInterval currentTime; +@property (nonatomic, assign) BOOL bufferMiss; +@property (nonatomic, assign) NSUInteger maxBufferCount; +@property (nonatomic, strong) NSOperationQueue *fetchQueue; +@property (nonatomic, strong) dispatch_semaphore_t lock; +@property (nonatomic, assign) CGFloat animatedImageScale; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) +@property (nonatomic, strong) CADisplayLink *displayLink; +#endif // TODO(macOS ISS#2323203) +@end + +@implementation RCTUIImageViewAnimated + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + self.lock = dispatch_semaphore_create(1); + #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; + #endif // TODO(macOS ISS#2323203) + } + return self; +} + +- (void)resetAnimatedImage +{ + self.animatedImage = nil; + self.totalFrameCount = 0; + self.totalLoopCount = 0; + self.currentFrame = nil; + self.currentFrameIndex = 0; + self.currentLoopCount = 0; + self.currentTime = 0; + self.bufferMiss = NO; + self.maxBufferCount = 0; + self.animatedImageScale = 1; + [_fetchQueue cancelAllOperations]; + _fetchQueue = nil; + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + [_frameBuffer removeAllObjects]; + _frameBuffer = nil; + dispatch_semaphore_signal(self.lock); +} + +- (void)setImage:(UIImage *)image +{ + if (self.image == image) { + return; + } + +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + [self stop]; +#endif // TODO(macOS ISS#2323203) + + [self resetAnimatedImage]; + + if ([image respondsToSelector:@selector(animatedImageFrameAtIndex:)]) { + NSUInteger animatedImageFrameCount = ((UIImage *)image).animatedImageFrameCount; + + // In case frame count is 0, there is no reason to continue. + if (animatedImageFrameCount == 0) { + return; + } + + self.animatedImage = (UIImage *)image; + self.totalFrameCount = animatedImageFrameCount; + + // Get the current frame and loop count. + self.totalLoopCount = self.animatedImage.animatedImageLoopCount; + + self.animatedImageScale = UIImageGetScale(image); // TODO(macOS ISS#2323203) + + self.currentFrame = image; + + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame; + dispatch_semaphore_signal(self.lock); + +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + // Calculate max buffer size + [self calculateMaxBufferCount]; + + if ([self paused]) { + [self start]; + } +#endif // TODO(macOS ISS#2323203) + + [self.layer setNeedsDisplay]; + } else { + super.image = image; + } +} + +#pragma mark - Private + +- (NSOperationQueue *)fetchQueue +{ + if (!_fetchQueue) { + _fetchQueue = [[NSOperationQueue alloc] init]; + _fetchQueue.maxConcurrentOperationCount = 1; + } + return _fetchQueue; +} + +- (NSMutableDictionary *)frameBuffer +{ + if (!_frameBuffer) { + _frameBuffer = [NSMutableDictionary dictionary]; + } + return _frameBuffer; +} + +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) +- (CADisplayLink *)displayLink +{ + if (!_displayLink) { + _displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:@selector(displayDidRefresh:)]; + NSString *runLoopMode = [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; + [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode]; + } + return _displayLink; +} + +#pragma mark - Animation + +- (void)start +{ + self.displayLink.paused = NO; +} + +- (void)stop +{ + self.displayLink.paused = YES; +} + +- (BOOL)paused +{ + return self.displayLink.isPaused; +} + +- (void)displayDidRefresh:(CADisplayLink *)displayLink +{ +#if TARGET_OS_UIKITFORMAC + // TODO: `displayLink.frameInterval` is not available on UIKitForMac + NSTimeInterval duration = displayLink.duration; +#else + NSTimeInterval duration = displayLink.duration * displayLink.frameInterval; +#endif + NSUInteger totalFrameCount = self.totalFrameCount; + NSUInteger currentFrameIndex = self.currentFrameIndex; + NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount; + + // Check if we have the frame buffer firstly to improve performance + if (!self.bufferMiss) { + // Then check if timestamp is reached + self.currentTime += duration; + NSTimeInterval currentDuration = [self.animatedImage animatedImageDurationAtIndex:currentFrameIndex]; + if (self.currentTime < currentDuration) { + // Current frame timestamp not reached, return + return; + } + self.currentTime -= currentDuration; + NSTimeInterval nextDuration = [self.animatedImage animatedImageDurationAtIndex:nextFrameIndex]; + if (self.currentTime > nextDuration) { + // Do not skip frame + self.currentTime = nextDuration; + } + } + + // Update the current frame + UIImage *currentFrame; + UIImage *fetchFrame; + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + currentFrame = self.frameBuffer[@(currentFrameIndex)]; + fetchFrame = currentFrame ? self.frameBuffer[@(nextFrameIndex)] : nil; + dispatch_semaphore_signal(self.lock); + BOOL bufferFull = NO; + if (currentFrame) { + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + // Remove the frame buffer if need + if (self.frameBuffer.count > self.maxBufferCount) { + self.frameBuffer[@(currentFrameIndex)] = nil; + } + // Check whether we can stop fetch + if (self.frameBuffer.count == totalFrameCount) { + bufferFull = YES; + } + dispatch_semaphore_signal(self.lock); + self.currentFrame = currentFrame; + self.currentFrameIndex = nextFrameIndex; + self.bufferMiss = NO; + [self.layer setNeedsDisplay]; + } else { + self.bufferMiss = YES; + } + + // Update the loop count when last frame rendered + if (nextFrameIndex == 0 && !self.bufferMiss) { + // Update the loop count + self.currentLoopCount++; + // if reached the max loop count, stop animating, 0 means loop indefinitely + NSUInteger maxLoopCount = self.totalLoopCount; + if (maxLoopCount != 0 && (self.currentLoopCount >= maxLoopCount)) { + [self stop]; + return; + } + } + + // Check if we should prefetch next frame or current frame + NSUInteger fetchFrameIndex; + if (self.bufferMiss) { + // When buffer miss, means the decode speed is slower than render speed, we fetch current miss frame + fetchFrameIndex = currentFrameIndex; + } else { + // Or, most cases, the decode speed is faster than render speed, we fetch next frame + fetchFrameIndex = nextFrameIndex; + } + + if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) { + // Prefetch next frame in background queue + UIImage *animatedImage = self.animatedImage; + NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ + UIImage *frame = [animatedImage animatedImageFrameAtIndex:fetchFrameIndex]; + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + self.frameBuffer[@(fetchFrameIndex)] = frame; + dispatch_semaphore_signal(self.lock); + }]; + [self.fetchQueue addOperation:operation]; + } +} + +#pragma mark - CALayerDelegate + +- (void)displayLayer:(CALayer *)layer +{ + if (_currentFrame) { + layer.contentsScale = self.animatedImageScale; + layer.contents = (__bridge id)_currentFrame.CGImage; + } +} + +#pragma mark - Util + +- (void)calculateMaxBufferCount +{ + NSUInteger bytes = CGImageGetBytesPerRow(self.currentFrame.CGImage) * CGImageGetHeight(self.currentFrame.CGImage); + if (bytes == 0) bytes = 1024; + + NSUInteger max = 0; + if (self.maxBufferSize > 0) { + max = self.maxBufferSize; + } else { + // Calculate based on current memory, these factors are by experience + NSUInteger total = RCTDeviceTotalMemory(); + NSUInteger free = RCTDeviceFreeMemory(); + max = MIN(total * 0.2, free * 0.6); + } + + NSUInteger maxBufferCount = (double)max / (double)bytes; + if (!maxBufferCount) { + // At least 1 frame + maxBufferCount = 1; + } + + self.maxBufferCount = maxBufferCount; +} + +#pragma mark - Lifecycle + +- (void)dealloc +{ + // Removes the display link from all run loop modes. + [_displayLink invalidate]; + _displayLink = nil; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + [_fetchQueue cancelAllOperations]; + [_fetchQueue addOperationWithBlock:^{ + NSNumber *currentFrameIndex = @(self.currentFrameIndex); + dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER); + NSArray *keys = self.frameBuffer.allKeys; + // only keep the next frame for later rendering + for (NSNumber * key in keys) { + if (![key isEqualToNumber:currentFrameIndex]) { + [self.frameBuffer removeObjectForKey:key]; + } + } + dispatch_semaphore_signal(self.lock); + }]; +} +#endif // TODO(macOS ISS#2323203) + +@end diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index 977df3de528bc0..96548e9918628a 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -27,10 +27,10 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTImage" - s.dependency "React-Core", version + s.dependency "React-Core/RCTImageHeaders", version s.dependency "React-RCTNetwork", version end diff --git a/Libraries/Image/RelativeImageStub.js b/Libraries/Image/RelativeImageStub.js index 6349a393f59064..040392a75e2e07 100644 --- a/Libraries/Image/RelativeImageStub.js +++ b/Libraries/Image/RelativeImageStub.js @@ -15,7 +15,7 @@ const AssetRegistry = require('./AssetRegistry'); -module.exports = AssetRegistry.registerAsset({ +module.exports = (AssetRegistry.registerAsset({ __packager_asset: true, fileSystemLocation: '/full/path/to/directory', httpServerLocation: '/assets/full/path/to/directory', @@ -25,4 +25,4 @@ module.exports = AssetRegistry.registerAsset({ hash: 'nonsense', name: 'icon', type: 'png', -}); +}): number); diff --git a/Libraries/Image/TextInlineImageNativeComponent.js b/Libraries/Image/TextInlineImageNativeComponent.js index b8cb7a50f8eb59..144e4314f8d645 100644 --- a/Libraries/Image/TextInlineImageNativeComponent.js +++ b/Libraries/Image/TextInlineImageNativeComponent.js @@ -12,6 +12,6 @@ const requireNativeComponent = require('../ReactNative/requireNativeComponent'); -const TextInlineImage = requireNativeComponent('RCTTextInlineImage'); +const TextInlineImage: string = requireNativeComponent('RCTTextInlineImage'); module.exports = TextInlineImage; diff --git a/Libraries/Image/__tests__/resolveAssetSource-test.js b/Libraries/Image/__tests__/resolveAssetSource-test.js index c5afbdf8705587..287e0657beb5ac 100644 --- a/Libraries/Image/__tests__/resolveAssetSource-test.js +++ b/Libraries/Image/__tests__/resolveAssetSource-test.js @@ -10,19 +10,20 @@ 'use strict'; -const AssetRegistry = require('../AssetRegistry'); -const Platform = require('../../Utilities/Platform'); -const NativeModules = require('../../BatchedBridge/NativeModules'); -const resolveAssetSource = require('../resolveAssetSource'); - -function expectResolvesAsset(input, expectedSource) { - const assetId = AssetRegistry.registerAsset(input); - expect(resolveAssetSource(assetId)).toEqual(expectedSource); -} - describe('resolveAssetSource', () => { + let AssetRegistry; + let resolveAssetSource; + let NativeSourceCode; + let Platform; + beforeEach(() => { jest.resetModules(); + + AssetRegistry = require('../AssetRegistry'); + resolveAssetSource = require('../resolveAssetSource'); + NativeSourceCode = require('../../NativeModules/specs/NativeSourceCode') + .default; + Platform = require('../../Utilities/Platform'); }); it('returns same source for simple static and network images', () => { @@ -57,7 +58,9 @@ describe('resolveAssetSource', () => { describe('bundle was loaded from network (DEV)', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = 'http://10.0.0.1:8081/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: 'http://10.0.0.1:8081/main.bundle', + }); Platform.OS = 'ios'; }); @@ -112,8 +115,9 @@ describe('resolveAssetSource', () => { describe('bundle was loaded from file on iOS', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = - 'file:///Path/To/Sample.app/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: 'file:///Path/To/Sample.app/main.bundle', + }); Platform.OS = 'ios'; }); @@ -143,8 +147,9 @@ describe('resolveAssetSource', () => { describe('bundle was loaded from assets on Android', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = - 'assets://Path/To/Simulator/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: 'assets://Path/To/Simulator/main.bundle', + }); Platform.OS = 'android'; }); @@ -174,8 +179,9 @@ describe('resolveAssetSource', () => { describe('bundle was loaded from file on Android', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = - 'file:///sdcard/Path/To/Simulator/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: 'file:///sdcard/Path/To/Simulator/main.bundle', + }); Platform.OS = 'android'; }); @@ -206,8 +212,9 @@ describe('resolveAssetSource', () => { describe('bundle was loaded from raw file on Android', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = - '/sdcard/Path/To/Simulator/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: '/sdcard/Path/To/Simulator/main.bundle', + }); Platform.OS = 'android'; }); @@ -238,8 +245,9 @@ describe('resolveAssetSource', () => { describe('source resolver can be customized', () => { beforeEach(() => { - NativeModules.SourceCode.scriptURL = - 'file:///sdcard/Path/To/Simulator/main.bundle'; + NativeSourceCode.getConstants = () => ({ + scriptURL: 'file:///sdcard/Path/To/Simulator/main.bundle', + }); Platform.OS = 'android'; }); @@ -295,9 +303,16 @@ describe('resolveAssetSource', () => { ); }); }); + + function expectResolvesAsset(input, expectedSource) { + const assetId = AssetRegistry.registerAsset(input); + expect(resolveAssetSource(assetId)).toEqual(expectedSource); + } }); describe('resolveAssetSource.pickScale', () => { + const resolveAssetSource = require('../resolveAssetSource'); + it('picks matching scale', () => { expect(resolveAssetSource.pickScale([1], 2)).toBe(1); expect(resolveAssetSource.pickScale([1, 2, 3], 2)).toBe(2); diff --git a/Libraries/Image/assetPathUtils.js b/Libraries/Image/assetPathUtils.js index 402680cef72779..6281c959984d9c 100644 --- a/Libraries/Image/assetPathUtils.js +++ b/Libraries/Image/assetPathUtils.js @@ -44,7 +44,10 @@ const drawableFileTypes = new Set([ 'xml', ]); -function getAndroidResourceFolderName(asset: PackagerAsset, scale: number) { +function getAndroidResourceFolderName( + asset: PackagerAsset, + scale: number, +): string | $TEMPORARY$string<'raw'> { if (!drawableFileTypes.has(asset.type)) { return 'raw'; } @@ -63,7 +66,7 @@ function getAndroidResourceFolderName(asset: PackagerAsset, scale: number) { return androidFolder; } -function getAndroidResourceIdentifier(asset: PackagerAsset) { +function getAndroidResourceIdentifier(asset: PackagerAsset): string { var folderPath = getBasePath(asset); return (folderPath + '/' + asset.name) .toLowerCase() @@ -72,7 +75,7 @@ function getAndroidResourceIdentifier(asset: PackagerAsset) { .replace(/^assets_/, ''); // Remove "assets_" prefix } -function getBasePath(asset: PackagerAsset) { +function getBasePath(asset: PackagerAsset): string { var basePath = asset.httpServerLocation; if (basePath[0] === '/') { basePath = basePath.substr(1); diff --git a/Libraries/Image/resolveAssetSource.js b/Libraries/Image/resolveAssetSource.js index dd9167af53e086..7d256832fca144 100644 --- a/Libraries/Image/resolveAssetSource.js +++ b/Libraries/Image/resolveAssetSource.js @@ -29,10 +29,9 @@ function getSourceCodeScriptURL(): ?string { let sourceCode = global.nativeExtensions && global.nativeExtensions.SourceCode; if (!sourceCode) { - const NativeModules = require('../BatchedBridge/NativeModules'); - sourceCode = NativeModules && NativeModules.SourceCode; + sourceCode = require('../NativeModules/specs/NativeSourceCode').default; } - _sourceCodeScriptURL = sourceCode.scriptURL; + _sourceCodeScriptURL = sourceCode.getConstants().scriptURL; return _sourceCodeScriptURL; } diff --git a/Libraries/Inspector/BorderBox.js b/Libraries/Inspector/BorderBox.js index 3ab66f10a0fb20..886beb784d5922 100644 --- a/Libraries/Inspector/BorderBox.js +++ b/Libraries/Inspector/BorderBox.js @@ -14,7 +14,7 @@ const React = require('react'); const View = require('../Components/View/View'); class BorderBox extends React.Component<$FlowFixMeProps> { - render() { + render(): $FlowFixMe | React.Node { const box = this.props.box; if (!box) { return this.props.children; diff --git a/Libraries/Inspector/BoxInspector.js b/Libraries/Inspector/BoxInspector.js index bd1f3d376f5f83..e1002f568ca0f4 100644 --- a/Libraries/Inspector/BoxInspector.js +++ b/Libraries/Inspector/BoxInspector.js @@ -14,6 +14,7 @@ const React = require('react'); const StyleSheet = require('../StyleSheet/StyleSheet'); const Text = require('../Text/Text'); const View = require('../Components/View/View'); + const resolveBoxStyle = require('./resolveBoxStyle'); const blank = { @@ -24,7 +25,7 @@ const blank = { }; class BoxInspector extends React.Component<$FlowFixMeProps> { - render() { + render(): React.Node { const frame = this.props.frame; const style = this.props.style; const margin = (style && resolveBoxStyle('margin', style)) || blank; diff --git a/Libraries/Inspector/ElementBox.js b/Libraries/Inspector/ElementBox.js index 9f6c0c4bf204ed..2e67b18f7720d8 100644 --- a/Libraries/Inspector/ElementBox.js +++ b/Libraries/Inspector/ElementBox.js @@ -11,16 +11,16 @@ 'use strict'; const BorderBox = require('./BorderBox'); +const Dimensions = require('../Utilities/Dimensions'); const React = require('react'); const StyleSheet = require('../StyleSheet/StyleSheet'); const View = require('../Components/View/View'); -const Dimensions = require('../Utilities/Dimensions'); const flattenStyle = require('../StyleSheet/flattenStyle'); const resolveBoxStyle = require('./resolveBoxStyle'); class ElementBox extends React.Component<$FlowFixMeProps> { - render() { + render(): React.Node { const style = flattenStyle(this.props.style) || {}; let margin = resolveBoxStyle('margin', style); let padding = resolveBoxStyle('padding', style); diff --git a/Libraries/Inspector/ElementProperties.js b/Libraries/Inspector/ElementProperties.js index 3cc8f4bfa5f1ba..31f74406a9ed11 100644 --- a/Libraries/Inspector/ElementProperties.js +++ b/Libraries/Inspector/ElementProperties.js @@ -38,7 +38,7 @@ type Props = $ReadOnly<{| |}>; class ElementProperties extends React.Component { - render() { + render(): React.Node { const style = flattenStyle(this.props.style); const selection = this.props.selection; let openFileButton; diff --git a/Libraries/Inspector/Inspector.js b/Libraries/Inspector/Inspector.js index a9ddf5919572be..22dd2655b61722 100644 --- a/Libraries/Inspector/Inspector.js +++ b/Libraries/Inspector/Inspector.js @@ -115,7 +115,7 @@ class Inspector extends React.Component< this.setState({inspectedViewTag: newProps.inspectedViewTag}); } - attachToDevtools = (agent: Object) => { + attachToDevtools: (agent: any) => void = (agent: Object) => { let _hideWait = null; const hlSub = agent.sub('highlight', ({node, name, props}) => { clearTimeout(_hideWait); @@ -239,7 +239,7 @@ class Inspector extends React.Component< }); } - render() { + render(): React.Node { const panelContainerStyle = this.state.panelPos === 'bottom' ? {bottom: 0} diff --git a/Libraries/Inspector/InspectorOverlay.js b/Libraries/Inspector/InspectorOverlay.js index 540afb73c1c998..878ee5e6ca1591 100644 --- a/Libraries/Inspector/InspectorOverlay.js +++ b/Libraries/Inspector/InspectorOverlay.js @@ -17,8 +17,8 @@ const StyleSheet = require('../StyleSheet/StyleSheet'); const UIManager = require('../ReactNative/UIManager'); const View = require('../Components/View/View'); -import type {PressEvent} from '../Types/CoreEventTypes'; import type {ViewStyleProp} from '../StyleSheet/StyleSheet'; +import type {PressEvent} from '../Types/CoreEventTypes'; type Inspected = $ReadOnly<{| frame?: Object, @@ -32,7 +32,7 @@ type Props = $ReadOnly<{| |}>; class InspectorOverlay extends React.Component { - findViewForTouchEvent = (e: PressEvent) => { + findViewForTouchEvent: (e: PressEvent) => void = (e: PressEvent) => { const {locationX, locationY} = e.nativeEvent.touches[0]; UIManager.findSubviewIn( this.props.inspectedViewTag, @@ -47,12 +47,12 @@ class InspectorOverlay extends React.Component { ); }; - shouldSetResponser = (e: PressEvent): boolean => { + shouldSetResponser: (e: PressEvent) => boolean = (e: PressEvent): boolean => { this.findViewForTouchEvent(e); return true; }; - render() { + render(): React.Node { let content = null; if (this.props.inspected) { content = ( diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 8aac5987843494..9cf47a83770a0f 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -51,7 +51,7 @@ type Props = $ReadOnly<{| |}>; class InspectorPanel extends React.Component { - renderWaiting() { + renderWaiting(): React.Node { if (this.props.inspecting) { return ( Tap something to inspect it @@ -60,7 +60,7 @@ class InspectorPanel extends React.Component { return Nothing is inspected; } - render() { + render(): React.Node { let contents; if (this.props.inspected) { contents = ( diff --git a/Libraries/Inspector/NetworkOverlay.js b/Libraries/Inspector/NetworkOverlay.js index 4e93151c13a080..b2956a077614ba 100644 --- a/Libraries/Inspector/NetworkOverlay.js +++ b/Libraries/Inspector/NetworkOverlay.js @@ -103,7 +103,7 @@ class NetworkOverlay extends React.Component { // Map of `xhr._index` -> `index in `this.state.requests`. _xhrIdMap: {[key: number]: number} = {}; - state = { + state: State = { detailRowId: null, requests: [], }; @@ -325,7 +325,7 @@ class NetworkOverlay extends React.Component { WebSocketInterceptor.disableInterception(); } - _renderItem = ({item, index}): ?React.Element => { + _renderItem = ({item, index}): React.Element => { const tableRowViewStyle = [ styles.tableRow, index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven, diff --git a/Libraries/Inspector/PerformanceOverlay.js b/Libraries/Inspector/PerformanceOverlay.js index 9d1f63c8c6a435..56b86fb16c53b9 100644 --- a/Libraries/Inspector/PerformanceOverlay.js +++ b/Libraries/Inspector/PerformanceOverlay.js @@ -17,7 +17,7 @@ const Text = require('../Text/Text'); const View = require('../Components/View/View'); class PerformanceOverlay extends React.Component<{}> { - render() { + render(): React.Node { const perfLogs = PerformanceLogger.getTimespans(); const items = []; diff --git a/Libraries/Inspector/StyleInspector.js b/Libraries/Inspector/StyleInspector.js index 332fe22bfed35f..64f001b116d82d 100644 --- a/Libraries/Inspector/StyleInspector.js +++ b/Libraries/Inspector/StyleInspector.js @@ -16,7 +16,7 @@ const Text = require('../Text/Text'); const View = require('../Components/View/View'); class StyleInspector extends React.Component<$FlowFixMeProps> { - render() { + render(): React.Node { if (!this.props.style) { return No style; } diff --git a/Libraries/Inspector/resolveBoxStyle.js b/Libraries/Inspector/resolveBoxStyle.js index 15dfaf3061d810..1f013ed064ba3c 100644 --- a/Libraries/Inspector/resolveBoxStyle.js +++ b/Libraries/Inspector/resolveBoxStyle.js @@ -69,7 +69,8 @@ function resolveBoxStyle( const styleForEnd = style[prefix + 'End']; if (styleForEnd != null) { - if (I18nManager.isRTL && I18nManager.doLeftAndRightSwapInRTL) { + const constants = I18nManager.getConstants(); + if (constants.isRTL && constants.doLeftAndRightSwapInRTL) { result.left = styleForEnd; } else { result.right = styleForEnd; @@ -78,7 +79,8 @@ function resolveBoxStyle( } const styleForStart = style[prefix + 'Start']; if (styleForStart != null) { - if (I18nManager.isRTL && I18nManager.doLeftAndRightSwapInRTL) { + const constants = I18nManager.getConstants(); + if (constants.isRTL && constants.doLeftAndRightSwapInRTL) { result.right = styleForStart; } else { result.left = styleForStart; diff --git a/Libraries/Interaction/FrameRateLogger.js b/Libraries/Interaction/FrameRateLogger.js index 8f8a2837f91aca..73a59454346fed 100644 --- a/Libraries/Interaction/FrameRateLogger.js +++ b/Libraries/Interaction/FrameRateLogger.js @@ -10,7 +10,7 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativeFrameRateLogger from './NativeFrameRateLogger'; const invariant = require('invariant'); @@ -41,21 +41,17 @@ const FrameRateLogger = { }) { if (options.debug !== undefined) { invariant( - NativeModules.FrameRateLogger, + NativeFrameRateLogger, 'Trying to debug FrameRateLogger without the native module!', ); } - if (NativeModules.FrameRateLogger) { - // Freeze the object to avoid the prepack warning (PP0017) about leaking - // unfrozen objects. + if (NativeFrameRateLogger) { // Needs to clone the object first to avoid modifying the argument. const optionsClone = { debug: !!options.debug, reportStackTraces: !!options.reportStackTraces, }; - Object.freeze(optionsClone); - Object.seal(optionsClone); - NativeModules.FrameRateLogger.setGlobalOptions(optionsClone); + NativeFrameRateLogger.setGlobalOptions(optionsClone); } }, @@ -64,8 +60,7 @@ const FrameRateLogger = { * in `AppRegistry`, but navigation is also a common place to hook in. */ setContext: function(context: string) { - NativeModules.FrameRateLogger && - NativeModules.FrameRateLogger.setContext(context); + NativeFrameRateLogger && NativeFrameRateLogger.setContext(context); }, /** @@ -73,8 +68,7 @@ const FrameRateLogger = { * automatically. */ beginScroll() { - NativeModules.FrameRateLogger && - NativeModules.FrameRateLogger.beginScroll(); + NativeFrameRateLogger && NativeFrameRateLogger.beginScroll(); }, /** @@ -82,7 +76,7 @@ const FrameRateLogger = { * automatically. */ endScroll() { - NativeModules.FrameRateLogger && NativeModules.FrameRateLogger.endScroll(); + NativeFrameRateLogger && NativeFrameRateLogger.endScroll(); }, }; diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index 69a51b8145ef6a..8784d9bce5351a 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -18,7 +18,7 @@ const infoLog = require('../Utilities/infoLog'); const invariant = require('invariant'); const keyMirror = require('fbjs/lib/keyMirror'); -type Handle = number; +export type Handle = number; import type {Task} from './TaskQueue'; const _emitter = new EventEmitter(); @@ -139,7 +139,7 @@ const InteractionManager = { _deleteInteractionSet.add(handle); }, - addListener: _emitter.addListener.bind(_emitter), + addListener: (_emitter.addListener.bind(_emitter): $FlowFixMe), /** * A positive number will use setTimeout to schedule any tasks after the diff --git a/Libraries/Interaction/InteractionMixin.js b/Libraries/Interaction/InteractionMixin.js index 38539b60afe72f..fcbd88f5a1958e 100644 --- a/Libraries/Interaction/InteractionMixin.js +++ b/Libraries/Interaction/InteractionMixin.js @@ -11,6 +11,7 @@ 'use strict'; const InteractionManager = require('./InteractionManager'); +import {type Handle} from './InteractionManager'; /** * This mixin provides safe versions of InteractionManager start/end methods @@ -28,13 +29,13 @@ const InteractionMixin = { _interactionMixinHandles: ([]: Array), - createInteractionHandle: function() { + createInteractionHandle: function(): Handle { const handle = InteractionManager.createInteractionHandle(); this._interactionMixinHandles.push(handle); return handle; }, - clearInteractionHandle: function(clearHandle: number) { + clearInteractionHandle: function(clearHandle: number): void { InteractionManager.clearInteractionHandle(clearHandle); this._interactionMixinHandles = this._interactionMixinHandles.filter( handle => handle !== clearHandle, @@ -46,7 +47,7 @@ const InteractionMixin = { * * @param {function} callback */ - runAfterInteractions: function(callback: Function) { + runAfterInteractions: function(callback: Function): void { InteractionManager.runAfterInteractions(callback); }, }; diff --git a/Libraries/Interaction/NativeFrameRateLogger.js b/Libraries/Interaction/NativeFrameRateLogger.js new file mode 100644 index 00000000000000..9780519c171ac0 --- /dev/null +++ b/Libraries/Interaction/NativeFrameRateLogger.js @@ -0,0 +1,24 @@ +/** + * 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. + * + * @format + * @flow + */ + +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; +import type {TurboModule} from '../TurboModule/RCTExport'; + +export interface Spec extends TurboModule { + +setGlobalOptions: (options: {| + +debug?: ?boolean, + +reportStackTraces?: ?boolean, + |}) => void; + +setContext: (context: string) => void; + +beginScroll: () => void; + +endScroll: () => void; +} + +export default TurboModuleRegistry.get('FrameRateLogger'); diff --git a/Libraries/Interaction/PanResponder.js b/Libraries/Interaction/PanResponder.js index 2b20faebe32544..d70797df24cac3 100644 --- a/Libraries/Interaction/PanResponder.js +++ b/Libraries/Interaction/PanResponder.js @@ -383,7 +383,25 @@ const PanResponder = { * accordingly. (numberActiveTouches) may not be totally accurate unless you * are the responder. */ - create(config: PanResponderConfig) { + create( + config: PanResponderConfig, + ): $TEMPORARY$object<{| + getInteractionHandle: () => ?number, + panHandlers: $TEMPORARY$object<{| + onMoveShouldSetResponder: (event: PressEvent) => boolean, + onMoveShouldSetResponderCapture: (event: PressEvent) => boolean, + onResponderEnd: (event: PressEvent) => void, + onResponderGrant: (event: PressEvent) => boolean, + onResponderMove: (event: PressEvent) => void, + onResponderReject: (event: PressEvent) => void, + onResponderRelease: (event: PressEvent) => void, + onResponderStart: (event: PressEvent) => void, + onResponderTerminate: (event: PressEvent) => void, + onResponderTerminationRequest: (event: PressEvent) => boolean, + onStartShouldSetResponder: (event: PressEvent) => boolean, + onStartShouldSetResponderCapture: (event: PressEvent) => boolean, + |}>, + |}> { const interactionState = { handle: (null: ?number), }; diff --git a/Libraries/Interaction/__tests__/InteractionManager-test.js b/Libraries/Interaction/__tests__/InteractionManager-test.js index 83e7ca36164fa1..a9abd62f5c675e 100644 --- a/Libraries/Interaction/__tests__/InteractionManager-test.js +++ b/Libraries/Interaction/__tests__/InteractionManager-test.js @@ -16,7 +16,7 @@ jest const isWindows = process.platform === 'win32'; function expectToBeCalledOnce(fn) { - // todo fix this test case on widnows + // todo fix this test case on windows if (isWindows) { return; } diff --git a/Libraries/JSInspector/NetworkAgent.js b/Libraries/JSInspector/NetworkAgent.js index 7f9c63d63f7a4a..4ad89bae6afb36 100644 --- a/Libraries/JSInspector/NetworkAgent.js +++ b/Libraries/JSInspector/NetworkAgent.js @@ -251,7 +251,7 @@ type EnableArgs = { }; class NetworkAgent extends InspectorAgent { - static DOMAIN = 'Network'; + static DOMAIN: $TEMPORARY$string<'Network'> = 'Network'; _sendEvent: EventSender; _interceptor: ?Interceptor; diff --git a/Libraries/LayoutAnimation/LayoutAnimation.js b/Libraries/LayoutAnimation/LayoutAnimation.js index 20018cf566b20c..4cf9b0db4c4708 100644 --- a/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/Libraries/LayoutAnimation/LayoutAnimation.js @@ -10,9 +10,10 @@ 'use strict'; -import Platform from '../Utilities/Platform'; const UIManager = require('../ReactNative/UIManager'); +import Platform from '../Utilities/Platform'; + type Type = | 'spring' | 'linear' @@ -66,8 +67,12 @@ function create( } const Presets = { - easeInEaseOut: create(300, 'easeInEaseOut', 'opacity'), - linear: create(500, 'linear', 'opacity'), + easeInEaseOut: (create( + 300, + 'easeInEaseOut', + 'opacity', + ): LayoutAnimationConfig), + linear: (create(500, 'linear', 'opacity'): LayoutAnimationConfig), spring: { duration: 700, create: { @@ -132,9 +137,15 @@ const LayoutAnimation = { console.error('LayoutAnimation.checkConfig(...) has been disabled.'); }, Presets, - easeInEaseOut: configureNext.bind(null, Presets.easeInEaseOut), - linear: configureNext.bind(null, Presets.linear), - spring: configureNext.bind(null, Presets.spring), + easeInEaseOut: (configureNext.bind(null, Presets.easeInEaseOut): ( + onAnimationDidEnd?: any, + ) => void), + linear: (configureNext.bind(null, Presets.linear): ( + onAnimationDidEnd?: any, + ) => void), + spring: (configureNext.bind(null, Presets.spring): ( + onAnimationDidEnd?: any, + ) => void), }; module.exports = LayoutAnimation; diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index f15023e55325ec..284f2336a5b3d4 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -117,4 +117,4 @@ class Linking extends NativeEventEmitter { } } -module.exports = new Linking(); +module.exports = (new Linking(): Linking); diff --git a/Libraries/Linking/NativeLinking.js b/Libraries/Linking/NativeLinking.js index 8608a0aaed41b7..cbb7c1a00bdc6f 100644 --- a/Libraries/Linking/NativeLinking.js +++ b/Libraries/Linking/NativeLinking.js @@ -10,8 +10,8 @@ 'use strict'; -import type {TurboModule} from 'RCTExport'; -import * as TurboModuleRegistry from 'TurboModuleRegistry'; +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; import Platform from '../Utilities/Platform'; export interface Spec extends TurboModule { diff --git a/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj b/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj deleted file mode 100644 index 7aedf6b5dbd1f2..00000000000000 --- a/Libraries/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj +++ /dev/null @@ -1,402 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 148699CF1ABD045300480536 /* RCTLinkingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTLinkingManager.m */; }; - 2D3B5F251D9B0DE600451313 /* RCTLinkingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTLinkingManager.m */; }; - D42902C41F1F85F100685AE7 /* RCTLinkingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D42902891F1CDFF300685AE7 /* RCTLinkingManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTLinking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTLinking.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 148699CD1ABD045300480536 /* RCTLinkingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLinkingManager.h; sourceTree = ""; }; - 148699CE1ABD045300480536 /* RCTLinkingManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLinkingManager.m; sourceTree = ""; }; - 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTLinking-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - D42902891F1CDFF300685AE7 /* RCTLinkingManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RCTLinkingManager.m; path = macOS/RCTLinkingManager.m; sourceTree = ""; }; - D4C812E71F1CC42300FFA059 /* libRCTLinking-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTLinking-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTLinking.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - D42902C31F1F853800685AE7 /* macos */, - 148699CD1ABD045300480536 /* RCTLinkingManager.h */, - 148699CE1ABD045300480536 /* RCTLinkingManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - D4C812E71F1CC42300FFA059 /* libRCTLinking-macOS.a */, - 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - D42902C31F1F853800685AE7 /* macos */ = { - isa = PBXGroup; - children = ( - D42902891F1CDFF300685AE7 /* RCTLinkingManager.m */, - ); - name = macos; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28461D9B043800D4039D /* RCTLinking-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A284F1D9B043800D4039D /* Build configuration list for PBXNativeTarget "RCTLinking-tvOS" */; - buildPhases = ( - 2D2A28431D9B043800D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTLinking-tvOS"; - productName = "RCTLinking-tvOS"; - productReference = 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTLinking */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTLinking" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTLinking; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTLinking.a */; - productType = "com.apple.product-type.library.static"; - }; - D4C812E11F1CC42300FFA059 /* RCTLinking-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = D4C812E41F1CC42300FFA059 /* Build configuration list for PBXNativeTarget "RCTLinking-macOS" */; - buildPhases = ( - D4C812E21F1CC42300FFA059 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTLinking-macOS"; - productName = RCTDataManager; - productReference = D4C812E71F1CC42300FFA059 /* libRCTLinking-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28461D9B043800D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTLinking" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTLinking */, - 2D2A28461D9B043800D4039D /* RCTLinking-tvOS */, - D4C812E11F1CC42300FFA059 /* RCTLinking-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28431D9B043800D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F251D9B0DE600451313 /* RCTLinkingManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 148699CF1ABD045300480536 /* RCTLinkingManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D4C812E21F1CC42300FFA059 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D42902C41F1F85F100685AE7 /* RCTLinkingManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A284D1D9B043800D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A284E1D9B043800D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTLinking; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTLinking; - }; - name = Release; - }; - D4C812E51F1CC42300FFA059 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - D4C812E61F1CC42300FFA059 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A284F1D9B043800D4039D /* Build configuration list for PBXNativeTarget "RCTLinking-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A284D1D9B043800D4039D /* Debug */, - 2D2A284E1D9B043800D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTLinking" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTLinking" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D4C812E41F1CC42300FFA059 /* Build configuration list for PBXNativeTarget "RCTLinking-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D4C812E51F1CC42300FFA059 /* Debug */, - D4C812E61F1CC42300FFA059 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/LinkingIOS/RCTLinkingManager.h b/Libraries/LinkingIOS/RCTLinkingManager.h index eca3ab02efb26e..353c93806c3190 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.h +++ b/Libraries/LinkingIOS/RCTLinkingManager.h @@ -13,9 +13,6 @@ @interface RCTLinkingManager : RCTEventEmitter -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) + (void)getUrlEventHandler:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; #else // ]TODO(macOS ISS#2323203) @@ -39,5 +36,3 @@ #endif // TODO(macOS ISS#2323203) @end - -#pragma clang diagnostic pop diff --git a/Libraries/LinkingIOS/RCTLinkingManager.m b/Libraries/LinkingIOS/RCTLinkingManager.m index 0b9f6dd1ef8411..516cd0f1125d3c 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.m +++ b/Libraries/LinkingIOS/RCTLinkingManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTLinkingManager.h" +#import #import #import @@ -101,12 +101,15 @@ - (void)handleOpenURLNotification:(NSNotification *)notification } }]; } else { +#if !TARGET_OS_UIKITFORMAC + // Note: this branch will never be taken on UIKitForMac BOOL opened = [RCTSharedApplication() openURL:URL]; if (opened) { resolve(@YES); } else { reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil); } +#endif } } @@ -170,12 +173,15 @@ - (void)handleOpenURLNotification:(NSNotification *)notification } }]; } else { +#if !TARGET_OS_UIKITFORMAC + // Note: This branch will never be taken on UIKitForMac BOOL opened = [RCTSharedApplication() openURL:url]; if (opened) { resolve(nil); } else { reject(RCTErrorUnspecified, @"Unable to open app settings", nil); } +#endif } } diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index bfb7fcd4bb2634..1d79e1fd5b3074 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -27,11 +27,11 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTLinking" - s.dependency "React-Core", version + s.dependency "React-Core/RCTLinkingHeaders", version s.osx.exclude_files = "RCTLinkingManager.m" s.osx.source_files = "macos/RCTLinkingManager.m" diff --git a/Libraries/Lists/FillRateHelper.js b/Libraries/Lists/FillRateHelper.js index 8e47c55e2f42aa..b5b006bed29753 100644 --- a/Libraries/Lists/FillRateHelper.js +++ b/Libraries/Lists/FillRateHelper.js @@ -16,16 +16,16 @@ const warning = require('fbjs/lib/warning'); export type FillRateInfo = Info; class Info { - any_blank_count = 0; - any_blank_ms = 0; - any_blank_speed_sum = 0; - mostly_blank_count = 0; - mostly_blank_ms = 0; - pixels_blank = 0; - pixels_sampled = 0; - pixels_scrolled = 0; - total_time_spent = 0; - sample_count = 0; + any_blank_count: number = 0; + any_blank_ms: number = 0; + any_blank_speed_sum: number = 0; + mostly_blank_count: number = 0; + mostly_blank_ms: number = 0; + pixels_blank: number = 0; + pixels_sampled: number = 0; + pixels_scrolled: number = 0; + total_time_spent: number = 0; + sample_count: number = 0; } type FrameMetrics = {inLayout?: boolean, length: number, offset: number}; diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index cc91ae793e3157..ffe522853a4781 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -24,15 +24,20 @@ import type { ViewToken, ViewabilityConfigCallbackPair, } from './ViewabilityHelper'; -import type {Props as VirtualizedListProps} from './VirtualizedList'; - -export type SeparatorsObj = { - highlight: () => void, - unhighlight: () => void, - updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, -}; +import type { + Props as VirtualizedListProps, + RenderItemType, + RenderItemProps, +} from './VirtualizedList'; type RequiredProps = { + /** + * For simplicity, data is just a plain array. If you want to use something else, like an + * immutable list, use the underlying `VirtualizedList` directly. + */ + data: ?$ReadOnlyArray, +}; +type OptionalProps = { /** * Takes an item from `data` and renders it into the list. Example usage: * @@ -59,18 +64,7 @@ type RequiredProps = { * `highlight` and `unhighlight` (which set the `highlighted: boolean` prop) are insufficient for * your use-case. */ - renderItem: (info: { - item: ItemT, - index: number, - separators: SeparatorsObj, - }) => ?React.Node, - /** - * For simplicity, data is just a plain array. If you want to use something else, like an - * immutable list, use the underlying `VirtualizedList` directly. - */ - data: ?$ReadOnlyArray, -}; -type OptionalProps = { + renderItem?: ?RenderItemType, /** * Rendered in between each item, but not at the top or bottom. By default, `highlighted` and * `leadingItem` props are provided. `renderItem` provides `separators.highlight`/`unhighlight` @@ -78,6 +72,33 @@ type OptionalProps = { * `separators.updateProps`. */ ItemSeparatorComponent?: ?React.ComponentType, + /** + * Takes an item from `data` and renders it into the list. Example usage: + * + * ( + * + * )} + * data={[{title: 'Title Text', key: 'item1'}]} + * ListItemComponent={({item, separators}) => ( + * this._onPress(item)} + * onShowUnderlay={separators.highlight} + * onHideUnderlay={separators.unhighlight}> + * + * {item.title} + * + * + * )} + * /> + * + * Provides additional metadata like `index` if you need it, as well as a more generic + * `separators.updateProps` function which let's you set whatever props you want to change the + * rendering of either the leading separator or trailing separator in case the more common + * `highlight` and `unhighlight` (which set the `highlighted: boolean` prop) are insufficient for + * your use-case. + */ + ListItemComponent?: ?React.ComponentType, /** * Rendered when the list is empty. Can be a React Component Class, a render function, or * a rendered element. @@ -420,13 +441,13 @@ class FlatList extends React.PureComponent, void> { /** * Provides a handle to the underlying scroll responder. */ - getScrollResponder() { + getScrollResponder(): any { if (this._listRef) { return this._listRef.getScrollResponder(); } } - getScrollableNode() { + getScrollableNode(): any { if (this._listRef) { return this._listRef.getScrollableNode(); } @@ -555,9 +576,6 @@ class FlatList extends React.PureComponent, void> { .map((it, kk) => keyExtractor(it, index * numColumns + kk)) .join(':'); } else { - /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.63 was deployed. To see the error delete this - * comment and run Flow. */ return keyExtractor(items, index); } }; @@ -598,48 +616,72 @@ class FlatList extends React.PureComponent, void> { }; } - _renderItem = (info: Object): ?React.Node => { - const {renderItem, numColumns, columnWrapperStyle} = this.props; - if (numColumns > 1) { - const {item, index, isSelected} = info; // TODO(macOS ISS#2323203) - invariant( - Array.isArray(item), - 'Expected array of items with numColumns > 1', - ); - return ( - - {item.map((it, kk) => { - const element = renderItem({ - item: it, - index: index * numColumns + kk, - isSelected: isSelected, // TODO(macOS ISS#2323203) - separators: info.separators, - }); - return element != null ? ( - {element} - ) : null; - })} - - ); - } else { - return renderItem(info); - } + _renderer = () => { + const { + ListItemComponent, + renderItem, + numColumns, + columnWrapperStyle, + } = this.props; + + let virtualizedListRenderKey = ListItemComponent + ? 'ListItemComponent' + : 'renderItem'; + + const renderer = props => { + if (ListItemComponent) { + return ; + } else if (renderItem) { + return renderItem(props); + } else { + return null; + } + }; + + return { + [virtualizedListRenderKey]: (info: RenderItemProps) => { + if (numColumns > 1) { + const {item, index} = info; + invariant( + Array.isArray(item), + 'Expected array of items with numColumns > 1', + ); + return ( + + {item.map((it, kk) => { + const element = renderer({ + item: it, + index: index * numColumns + kk, + isSelected: info.isSelected, // TODO(macOS ISS#2323203) + separators: info.separators, + }); + return element != null ? ( + {element} + ) : null; + })} + + ); + } else { + return renderer(info); + } + }, + }; }; - render() { + render(): React.Node { return ( ); } diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index 1840d921c4c8ca..fe4d5d9b6fdad5 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -18,6 +18,7 @@ import type {ViewToken} from './ViewabilityHelper'; import type { SectionBase as _SectionBase, Props as VirtualizedSectionListProps, + ScrollToLocationParamsType, } from './VirtualizedSectionList'; type Item = any; @@ -246,13 +247,7 @@ class SectionList> extends React.PureComponent< * Note: cannot scroll to locations outside the render window without specifying the * `getItemLayout` prop. */ - scrollToLocation(params: { - animated?: ?boolean, - itemIndex: number, - sectionIndex: number, - viewOffset?: number, - viewPosition?: number, - }) { + scrollToLocation(params: ScrollToLocationParamsType) { if (this._wrapperListRef != null) { this._wrapperListRef.scrollToLocation(params); } @@ -288,7 +283,7 @@ class SectionList> extends React.PureComponent< } } - getScrollableNode() { + getScrollableNode(): any { const listRef = this._wrapperListRef && this._wrapperListRef.getListRef(); if (listRef) { return listRef.getScrollableNode(); @@ -302,11 +297,8 @@ class SectionList> extends React.PureComponent< } } - render() { + render(): React.Node { return ( - /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.66 was deployed. To see the error delete this - * comment and run Flow. */ > extends React.PureComponent< _wrapperListRef: ?React.ElementRef; _captureRef = ref => { + /* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.99 was deployed. To see the error, delete this + * comment and run Flow. */ this._wrapperListRef = ref; }; } diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index cdbb0de3b11130..e7dfb1dcd4d616 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -38,7 +38,22 @@ import type {ScrollEvent} from '../Types/CoreEventTypes'; // TODO(macOS ISS#2323 type Item = any; -export type renderItemType = (info: any) => ?React.Element; +export type Separators = { + highlight: () => void, + unhighlight: () => void, + updateProps: (select: 'leading' | 'trailing', newProps: Object) => void, +}; + +export type RenderItemProps = { + item: ItemT, + index: number, + isSelected: boolean, // TODO(macOS ISS#2323203) + separators: Separators, +}; + +export type RenderItemType = ( + info: RenderItemProps, +) => React.Node; type ViewabilityHelperCallbackTuple = { viewabilityHelper: ViewabilityHelper, @@ -55,9 +70,6 @@ export type SelectedRowIndexPathType = { }; // ]TODO(macOS ISS#2323203) type RequiredProps = { - // TODO: Conflicts with the optional `renderItem` in - // `VirtualizedSectionList`'s props. - renderItem: $FlowFixMe, /** * The default accessor functions assume this is an Array<{key: string} | {id: string}> but you can override * getItem, getItemCount, and keyExtractor to handle any type of index-based data. @@ -73,6 +85,9 @@ type RequiredProps = { getItemCount: (data: any) => number, }; type OptionalProps = { + // TODO: Conflicts with the optional `renderItem` in + // `VirtualizedSectionList`'s props. + renderItem?: $FlowFixMe>, /** * `debug` will turn on extra logging and visual overlays to aid with debugging both usage and * implementation, but with a significant perf hit. @@ -124,6 +139,11 @@ type OptionalProps = { * or a render function. Defaults to using View. */ CellRendererComponent?: ?React.ComponentType, + /** + * Each data item is rendered using this element. Can be a React Component Class, + * or a render function. + */ + ListItemComponent?: ?React.ComponentType, /** * Rendered when the list is empty. Can be a React Component Class, a render function, or * a rendered element. @@ -155,7 +175,7 @@ type OptionalProps = { listKey?: string, /** * The maximum number of items to render in each incremental render batch. The more rendered at - * once, the better the fill rate, but responsiveness my suffer because rendering content may + * once, the better the fill rate, but responsiveness may suffer because rendering content may * interfere with responding to button taps or other interactions. */ maxToRenderPerBatch: number, @@ -248,6 +268,18 @@ type OptionalProps = { * comment to see the errors */ export type Props = RequiredProps & OptionalProps; +type DefaultProps = {| + disableVirtualization: boolean, + horizontal: boolean, + initialNumToRender: number, + keyExtractor: (item: Item, index: number) => string, + maxToRenderPerBatch: number, + onEndReachedThreshold: number, + scrollEventThrottle: number, + updateCellsBatchingPeriod: number, + windowSize: number, +|}; + let _usedIndexForKey = false; let _keylessItemComponentName: string = ''; @@ -338,7 +370,9 @@ class VirtualizedList extends React.PureComponent { const {animated, index, viewOffset, viewPosition} = params; invariant( index >= 0 && index < getItemCount(data), - `scrollToIndex out of range: ${index} vs ${getItemCount(data) - 1}`, + `scrollToIndex out of range: requested index ${index} but maximum is ${getItemCount( + data, + ) - 1}`, ); if (!getItemLayout && index > this._highestMeasuredFrameIndex) { invariant( @@ -448,13 +482,13 @@ class VirtualizedList extends React.PureComponent { * Note that `this._scrollRef` might not be a `ScrollView`, so we * need to check that it responds to `getScrollResponder` before calling it. */ - getScrollResponder() { + getScrollResponder(): any { if (this._scrollRef && this._scrollRef.getScrollResponder) { return this._scrollRef.getScrollResponder(); } } - getScrollableNode() { + getScrollableNode(): any { if (this._scrollRef && this._scrollRef.getScrollableNode) { return this._scrollRef.getScrollableNode(); } else { @@ -462,7 +496,7 @@ class VirtualizedList extends React.PureComponent { } } - getScrollRef() { + getScrollRef(): any { if (this._scrollRef && this._scrollRef.getScrollRef) { return this._scrollRef.getScrollRef(); } else { @@ -476,7 +510,7 @@ class VirtualizedList extends React.PureComponent { } } - static defaultProps = { + static defaultProps: DefaultProps = { disableVirtualization: false, horizontal: false, initialNumToRender: 10, @@ -500,7 +534,21 @@ class VirtualizedList extends React.PureComponent { windowSize: 21, // multiples of length }; - static contextTypes = { + static contextTypes: + | any + | {| + virtualizedCell: {| + cellKey: React$PropType$Primitive, + |}, + virtualizedList: {| + getScrollMetrics: React$PropType$Primitive, + horizontal: React$PropType$Primitive, + getOutermostParentListRef: React$PropType$Primitive, + getNestedChildState: React$PropType$Primitive, + registerAsNestedChild: React$PropType$Primitive, + unregisterAsNestedChild: React$PropType$Primitive, + |}, + |} = { virtualizedCell: PropTypes.shape({ cellKey: PropTypes.string, }), @@ -514,7 +562,16 @@ class VirtualizedList extends React.PureComponent { }), }; - static childContextTypes = { + static childContextTypes: + | any + | {| + getScrollMetrics: React$PropType$Primitive, + horizontal: React$PropType$Primitive, + getOutermostParentListRef: React$PropType$Primitive, + getNestedChildState: React$PropType$Primitive, + registerAsNestedChild: React$PropType$Primitive, + unregisterAsNestedChild: React$PropType$Primitive, + |} = { virtualizedList: PropTypes.shape({ getScrollMetrics: PropTypes.func, horizontal: PropTypes.bool, @@ -525,7 +582,31 @@ class VirtualizedList extends React.PureComponent { }), }; - getChildContext() { + getChildContext(): {| + virtualizedList: { + getScrollMetrics: () => { + contentLength: number, + dOffset: number, + dt: number, + offset: number, + timestamp: number, + velocity: number, + visibleLength: number, + }, + horizontal: ?boolean, + getOutermostParentListRef: Function, + getNestedChildState: string => ?ChildListState, + registerAsNestedChild: ({ + cellKey: string, + key: string, + ref: VirtualizedList, + }) => ?ChildListState, + unregisterAsNestedChild: ({ + key: string, + state: ChildListState, + }) => void, + }, + |} { return { virtualizedList: { getScrollMetrics: this._getScrollMetrics, @@ -693,7 +774,7 @@ class VirtualizedList extends React.PureComponent { this._fillRateHelper.deactivateAndFlush(); } - static getDerivedStateFromProps(newProps: Props, prevState: State) { + static getDerivedStateFromProps(newProps: Props, prevState: State): State { const {data, getItemCount, maxToRenderPerBatch} = newProps; // first and last could be stale (e.g. if a new, shorter items props is passed in), so we make // sure we're rendering a reasonable range here. @@ -703,6 +784,10 @@ class VirtualizedList extends React.PureComponent { Math.min(prevState.first, getItemCount(data) - 1 - maxToRenderPerBatch), ), last: Math.max(0, Math.min(prevState.last, getItemCount(data) - 1)), + selectedRowIndex: Math.max( + 0, + Math.min(prevState.selectedRowIndex, getItemCount(data)), + ), // TODO(macOS ISS#2323203) }; } @@ -778,7 +863,7 @@ class VirtualizedList extends React.PureComponent { ); } - render() { + render(): React.Node { if (__DEV__) { const flatStyles = flattenStyle(this.props.contentContainerStyle); warning( @@ -1001,7 +1086,7 @@ class VirtualizedList extends React.PureComponent { this._hasMore = this.state.last < this.props.getItemCount(this.props.data) - 1; - const ret = React.cloneElement( + const innerRet = React.cloneElement( (this.props.renderScrollComponent || this._defaultRenderScrollComponent)( scrollProps, ), @@ -1010,6 +1095,29 @@ class VirtualizedList extends React.PureComponent { }, cells, ); + let ret = innerRet; + if (__DEV__) { + ret = ( + + {scrollContext => { + if ( + scrollContext != null && + !scrollContext.horizontal === !this.props.horizontal && + !this._hasWarned.nesting && + this.context.virtualizedList == null + ) { + // TODO (T46547044): use React.warn once 16.9 is sync'd: https://github.com/facebook/react/pull/15170 + console.warn( + 'VirtualizedLists should never be nested inside plain ScrollViews with the same ' + + 'orientation - use another VirtualizedList-backed container instead.', + ); + this._hasWarned.nesting = true; + } + return innerRet; + }} + + ); + } if (this.props.debug) { return ( @@ -1209,7 +1317,7 @@ class VirtualizedList extends React.PureComponent { if (!this._scrollRef) { return; } - // We are asuming that getOutermostParentListRef().getScrollRef() + // We are assuming that getOutermostParentListRef().getScrollRef() // is a non-null reference to a ScrollView this._scrollRef.measureLayout( this.context.virtualizedList @@ -1793,27 +1901,37 @@ class VirtualizedList extends React.PureComponent { } } -class CellRenderer extends React.Component< - { - CellRendererComponent?: ?React.ComponentType, - ItemSeparatorComponent: ?React.ComponentType<*>, - cellKey: string, - fillRateHelper: FillRateHelper, - horizontal: ?boolean, - index: number, - inversionStyle: ViewStyleProp, - isSelected: ?boolean, // TODO(macOS ISS#2323203) - item: Item, - onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader - onUnmount: (cellKey: string) => void, - onUpdateSeparators: (cellKeys: Array, props: Object) => void, - parentProps: { - getItemLayout?: ?Function, - renderItem: renderItemType, - }, - prevCellKey: ?string, +type CellRendererProps = { + CellRendererComponent?: ?React.ComponentType, + ItemSeparatorComponent: ?React.ComponentType<*>, + cellKey: string, + fillRateHelper: FillRateHelper, + horizontal: ?boolean, + index: number, + inversionStyle: ViewStyleProp, + isSelected: ?boolean, // TODO(macOS ISS#2323203) + item: Item, + onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader + onUnmount: (cellKey: string) => void, + onUpdateSeparators: (cellKeys: Array, props: Object) => void, + parentProps: { + getItemLayout?: ?Function, + renderItem?: ?RenderItemType, + ListItemComponent?: ?(React.ComponentType | React.Element), }, - $FlowFixMeState, + prevCellKey: ?string, +}; + +type CellRendererState = { + separatorProps: $ReadOnly<{| + highlighted: boolean, + leadingItem: ?Item, + |}>, +}; + +class CellRenderer extends React.Component< + CellRendererProps, + CellRendererState, > { state = { separatorProps: { @@ -1828,6 +1946,18 @@ class CellRenderer extends React.Component< }), }; + static getDerivedStateFromProps( + props: CellRendererProps, + prevState: CellRendererState, + ): ?CellRendererState { + return { + separatorProps: { + ...prevState.separatorProps, + leadingItem: props.item, + }, + }; + } + getChildContext() { return { virtualizedCell: { @@ -1870,6 +2000,37 @@ class CellRenderer extends React.Component< this.props.onUnmount(this.props.cellKey); } + _renderElement(renderItem, ListItemComponent, item, index, isSelected) { + // TODO(macOS ISS#2323203) + if (renderItem && ListItemComponent) { + console.warn( + 'VirtualizedList: Both ListItemComponent and renderItem props are present. ListItemComponent will take' + + ' precedence over renderItem.', + ); + } + + if (ListItemComponent) { + return React.createElement(ListItemComponent, { + item, + index, + separators: this._separators, + }); + } + + if (renderItem) { + return renderItem({ + item, + index, + separators: this._separators, + }); + } + + invariant( + false, + 'VirtualizedList: Either ListItemComponent or renderItem props are required but none were found.', + ); + } + render() { const { CellRendererComponent, @@ -1882,14 +2043,15 @@ class CellRenderer extends React.Component< isSelected, // TODO(macOS ISS#2323203) parentProps, } = this.props; - const {renderItem, getItemLayout} = parentProps; - invariant(renderItem, 'no renderItem!'); - const element = renderItem({ + const {renderItem, getItemLayout, ListItemComponent} = parentProps; + const element = this._renderElement( + renderItem, + ListItemComponent, item, index, isSelected, // TODO(macOS ISS#2323203) - separators: this._separators, - }); + ); + const onLayout = /* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an * error found when Flow v0.68 was deployed. To see the error delete this @@ -1904,10 +2066,10 @@ class CellRenderer extends React.Component< ); const cellStyle = inversionStyle ? horizontal - ? [{flexDirection: 'row-reverse'}, inversionStyle] - : [{flexDirection: 'column-reverse'}, inversionStyle] + ? [styles.rowReverse, inversionStyle] + : [styles.columnReverse, inversionStyle] : horizontal - ? [{flexDirection: 'row'}, inversionStyle] + ? [styles.row, inversionStyle] : inversionStyle; if (!CellRendererComponent) { return ( @@ -1962,6 +2124,15 @@ const styles = StyleSheet.create({ horizontallyInverted: { transform: [{scaleX: -1}], }, + row: { + flexDirection: 'row', + }, + rowReverse: { + flexDirection: 'row-reverse', + }, + columnReverse: { + flexDirection: 'column-reverse', + }, debug: { flex: 1, }, diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index 785c11b70ebb02..32b557629d1073 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -145,10 +145,19 @@ type OptionalProps> = { export type Props = RequiredProps & OptionalProps & VirtualizedListProps; - -type DefaultProps = typeof VirtualizedList.defaultProps & { +export type ScrollToLocationParamsType = {| + animated?: ?boolean, + itemIndex: number, + sectionIndex: number, + viewOffset?: number, + viewPosition?: number, +|}; + +type DefaultProps = {| + ...typeof VirtualizedList.defaultProps, data: $ReadOnlyArray, -}; +|}; + type State = { childProps: VirtualizedListProps, selectedRowIndexPath: SelectedRowIndexPathType, // TODO(macOS ISS#2323203) @@ -167,22 +176,17 @@ class VirtualizedSectionList< data: [], }; - scrollToLocation(params: { - animated?: ?boolean, - itemIndex: number, - sectionIndex: number, - viewPosition?: number, - }) { + scrollToLocation(params: ScrollToLocationParamsType) { let index = params.itemIndex; for (let i = 0; i < params.sectionIndex; i++) { index += this.props.getItemCount(this.props.sections[i].data) + 2; } - let viewOffset = 0; + let viewOffset = params.viewOffset || 0; if (params.itemIndex > 0 && this.props.stickySectionHeadersEnabled) { const frame = this._listRef._getFrameMetricsApprox( index - params.itemIndex, ); - viewOffset = frame.length; + viewOffset += frame.length; } const toIndexParams = { ...params, @@ -242,7 +246,6 @@ class VirtualizedSectionList< return rowIndexPath; } - const count = this.props.sections[sectionIndex].data.length; let row = rowIndexPath.rowIndex; let rowAbove = row - 1; @@ -339,7 +342,7 @@ class VirtualizedSectionList< } }; // ]TODO(macOS ISS#2323203) - render() { + render(): React.Node { let keyEventHandler = this.props.onScrollKeyDown; // [TODO(macOS ISS#2323203) if (!keyEventHandler) { keyEventHandler = this.props.enableSelectionOnKeyPress @@ -570,7 +573,7 @@ type ItemWithSeparatorProps = $ReadOnly<{| cellKey: string, index: number, item: Item, - isSelected: boolean, + isSelected: boolean, // TODO(macOS ISS#2323203) onUpdateSeparator: (cellKey: string, newProps: Object) => void, prevCellKey?: ?string, renderItem: Function, diff --git a/Libraries/Lists/__flowtests__/FlatList-flowtest.js b/Libraries/Lists/__flowtests__/FlatList-flowtest.js index 71b5f10004cbe2..99db43079f5f70 100644 --- a/Libraries/Lists/__flowtests__/FlatList-flowtest.js +++ b/Libraries/Lists/__flowtests__/FlatList-flowtest.js @@ -18,7 +18,7 @@ function renderMyListItem(info: {item: {title: string}, index: number}) { } module.exports = { - testEverythingIsFine() { + testEverythingIsFine(): React.Node { const data = [ { title: 'Title Text', @@ -28,7 +28,7 @@ module.exports = { return ; }, - testBadDataWithTypicalItem() { + testBadDataWithTypicalItem(): React.Node { const data = [ { // $FlowExpectedError - bad title type 6, should be string @@ -39,7 +39,7 @@ module.exports = { return ; }, - testMissingFieldWithTypicalItem() { + testMissingFieldWithTypicalItem(): React.Node { const data = [ { key: 1, @@ -49,7 +49,7 @@ module.exports = { return ; }, - testGoodDataWithBadCustomRenderItemFunction() { + testGoodDataWithBadCustomRenderItemFunction(): React.Node { const data = [ { widget: 6, @@ -71,7 +71,7 @@ module.exports = { ); }, - testBadRenderItemFunction() { + testBadRenderItemFunction(): $TEMPORARY$array { const data = [ { title: 'foo', @@ -99,7 +99,7 @@ module.exports = { ]; }, - testOtherBadProps() { + testOtherBadProps(): $TEMPORARY$array { return [ // $FlowExpectedError - bad numColumns type "lots" , diff --git a/Libraries/Lists/__flowtests__/SectionList-flowtest.js b/Libraries/Lists/__flowtests__/SectionList-flowtest.js index 9f70f43551fed1..44d8d008b7ba03 100644 --- a/Libraries/Lists/__flowtests__/SectionList-flowtest.js +++ b/Libraries/Lists/__flowtests__/SectionList-flowtest.js @@ -22,7 +22,7 @@ const renderMyHeader = ({section}: {section: {fooNumber: number} & Object}) => ( ); module.exports = { - testGoodDataWithGoodItem() { + testGoodDataWithGoodItem(): React.Node { const sections = [ { key: 'a', @@ -37,7 +37,7 @@ module.exports = { return ; }, - testBadRenderItemFunction() { + testBadRenderItemFunction(): $TEMPORARY$array { const sections = [ { key: 'a', diff --git a/Libraries/Lists/__tests__/FlatList-test.js b/Libraries/Lists/__tests__/FlatList-test.js index e1c605aae11039..1df7e484c76688 100644 --- a/Libraries/Lists/__tests__/FlatList-test.js +++ b/Libraries/Lists/__tests__/FlatList-test.js @@ -25,6 +25,41 @@ describe('FlatList', () => { ); expect(component).toMatchSnapshot(); }); + it('renders simple list (multiple columns)', () => { + const component = ReactTestRenderer.create( + } + numColumns={2} + />, + ); + expect(component).toMatchSnapshot(); + }); + it('renders simple list using ListItemComponent', () => { + function ListItemComponent({item}) { + return ; + } + const component = ReactTestRenderer.create( + , + ); + expect(component).toMatchSnapshot(); + }); + it('renders simple list using ListItemComponent (multiple columns)', () => { + function ListItemComponent({item}) { + return ; + } + const component = ReactTestRenderer.create( + , + ); + expect(component).toMatchSnapshot(); + }); it('renders empty list', () => { const component = ReactTestRenderer.create( } />, diff --git a/Libraries/Lists/__tests__/VirtualizeUtils-test.js b/Libraries/Lists/__tests__/VirtualizeUtils-test.js index fe67ef79fffcd3..86125a3a29b897 100644 --- a/Libraries/Lists/__tests__/VirtualizeUtils-test.js +++ b/Libraries/Lists/__tests__/VirtualizeUtils-test.js @@ -34,7 +34,7 @@ describe('newRangeCount', function() { it('handles front extension', function() { expect(newRangeCount({first: 1, last: 4}, {first: 0, last: 4})).toBe(1); }); - it('handles forward insersect', function() { + it('handles forward intersect', function() { expect(newRangeCount({first: 1, last: 4}, {first: 3, last: 6})).toBe(2); }); it('handles reverse intersect', function() { diff --git a/Libraries/Lists/__tests__/VirtualizedList-test.js b/Libraries/Lists/__tests__/VirtualizedList-test.js index d421d1b9a78591..c4873374e0ef54 100644 --- a/Libraries/Lists/__tests__/VirtualizedList-test.js +++ b/Libraries/Lists/__tests__/VirtualizedList-test.js @@ -28,6 +28,61 @@ describe('VirtualizedList', () => { expect(component).toMatchSnapshot(); }); + it('renders simple list using ListItemComponent', () => { + function ListItemComponent({item}) { + return ; + } + const component = ReactTestRenderer.create( + data[index]} + getItemCount={data => data.length} + />, + ); + expect(component).toMatchSnapshot(); + }); + + it('warns if both renderItem or ListItemComponent are specified. Uses ListItemComponent', () => { + jest.spyOn(global.console, 'warn'); + function ListItemComponent({item}) { + return ; + } + const component = ReactTestRenderer.create( + ( + + )} + getItem={(data, index) => data[index]} + getItemCount={data => data.length} + />, + ); + + expect(console.warn.mock.calls).toEqual([ + [ + 'VirtualizedList: Both ListItemComponent and renderItem props are present. ListItemComponent will take precedence over renderItem.', + ], + ]); + expect(component).toMatchSnapshot(); + console.warn.mockRestore(); + }); + + it('throws if no renderItem or ListItemComponent', () => { + const componentFactory = () => + ReactTestRenderer.create( + data[index]} + getItemCount={data => data.length} + />, + ); + expect(componentFactory).toThrow( + 'VirtualizedList: Either ListItemComponent or renderItem props are required but none were found.', + ); + }); + it('renders empty list', () => { const component = ReactTestRenderer.create( { ); expect(component).toMatchSnapshot(); }); + + describe('scrollToLocation', () => { + const ITEM_HEIGHT = 100; + + const createVirtualizedSectionList = props => { + const component = ReactTestRenderer.create( + } + getItem={(data, key) => data[key]} + getItemCount={data => data.length} + getItemLayout={(data, index) => ({ + length: ITEM_HEIGHT, + offset: ITEM_HEIGHT * index, + index, + })} + {...props} + />, + ); + const instance = component.getInstance(); + const spy = jest.fn(); + instance._listRef.scrollToIndex = spy; + return { + instance, + spy, + }; + }; + + it('when sticky stickySectionHeadersEnabled={true}, header height is added to the developer-provided viewOffset', () => { + const {instance, spy} = createVirtualizedSectionList({ + stickySectionHeadersEnabled: true, + }); + + const viewOffset = 25; + + instance.scrollToLocation({ + sectionIndex: 0, + itemIndex: 1, + viewOffset, + }); + expect(spy).toHaveBeenCalledWith({ + index: 1, + itemIndex: 1, + sectionIndex: 0, + viewOffset: viewOffset + ITEM_HEIGHT, + }); + }); + + it.each([ + [ + // prevents #18098 + {sectionIndex: 0, itemIndex: 0}, + { + index: 0, + itemIndex: 0, + sectionIndex: 0, + viewOffset: 0, + }, + ], + [ + {sectionIndex: 2, itemIndex: 1}, + { + index: 11, + itemIndex: 1, + sectionIndex: 2, + viewOffset: 0, + }, + ], + [ + { + sectionIndex: 0, + itemIndex: 1, + viewOffset: 25, + }, + { + index: 1, + itemIndex: 1, + sectionIndex: 0, + viewOffset: 25, + }, + ], + ])( + 'given sectionIndex, itemIndex and viewOffset, scrollToIndex is called with correct params', + (scrollToLocationParams, expected) => { + const {instance, spy} = createVirtualizedSectionList(); + + instance.scrollToLocation(scrollToLocationParams); + expect(spy).toHaveBeenCalledWith(expected); + }, + ); + }); }); diff --git a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap index a803418ba3a9fb..86376e2b585d27 100644 --- a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap @@ -188,6 +188,85 @@ exports[`FlatList renders null list 1`] = ` `; +exports[`FlatList renders simple list (multiple columns) 1`] = ` + + + + + + + + + + + + + + + +`; + exports[`FlatList renders simple list 1`] = ` `; + +exports[`FlatList renders simple list using ListItemComponent (multiple columns) 1`] = ` + + + + + + + + + + + + + + + +`; + +exports[`FlatList renders simple list using ListItemComponent 1`] = ` + + + + + + + + + + + + + +`; diff --git a/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap index 057799876b3de1..708509db4ff9b6 100644 --- a/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap @@ -822,6 +822,71 @@ exports[`VirtualizedList renders simple list 1`] = ` `; +exports[`VirtualizedList renders simple list using ListItemComponent 1`] = ` + + + + + + + + + + + + + +`; + exports[`VirtualizedList test getItem functionality where data is not an Array 1`] = ` `; + +exports[`VirtualizedList warns if both renderItem or ListItemComponent are specified. Uses ListItemComponent 1`] = ` + + + + + + + +`; diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index e364ec0af7f74c..76274822b50e52 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -13,24 +13,25 @@ const AppContainer = require('../ReactNative/AppContainer'); const I18nManager = require('../ReactNative/I18nManager'); const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativeModalManager from './NativeModalManager'; const Platform = require('../Utilities/Platform'); const React = require('react'); const PropTypes = require('prop-types'); +const ScrollView = require('../Components/ScrollView/ScrollView'); const StyleSheet = require('../StyleSheet/StyleSheet'); const View = require('../Components/View/View'); -const RCTModalHostView = require('./RCTModalHostViewNativeComponent'); +import type {ViewProps} from '../Components/View/ViewPropTypes'; +import type {DirectEventHandler} from '../Types/CodegenTypes'; +import type {SyntheticEvent} from '../Types/CoreEventTypes'; +import type EmitterSubscription from '../vendor/emitter/EmitterSubscription'; +import RCTModalHostView from './RCTModalHostViewNativeComponent'; const ModalEventEmitter = - Platform.OS === 'ios' && NativeModules.ModalManager - ? new NativeEventEmitter(NativeModules.ModalManager) + Platform.OS === 'ios' && NativeModalManager != null + ? new NativeEventEmitter(NativeModalManager) : null; -import type EmitterSubscription from '../vendor/emitter/EmitterSubscription'; -import type {ViewProps} from '../Components/View/ViewPropTypes'; -import type {SyntheticEvent} from '../Types/CoreEventTypes'; - /** * The Modal component is a simple way to present content above an enclosing view. * @@ -43,13 +44,11 @@ import type {SyntheticEvent} from '../Types/CoreEventTypes'; // destroyed before the callback is fired. let uniqueModalIdentifier = 0; -type OrientationChangeEvent = SyntheticEvent< - $ReadOnly<{| - orientation: 'portrait' | 'landscape', - |}>, ->; +type OrientationChangeEvent = $ReadOnly<{| + orientation: 'portrait' | 'landscape', +|}>; -type Props = $ReadOnly<{| +export type Props = $ReadOnly<{| ...ViewProps, /** @@ -102,7 +101,7 @@ type Props = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onrequestclose */ - onRequestClose?: ?(event?: SyntheticEvent) => mixed, + onRequestClose?: ?DirectEventHandler, /** * The `onShow` prop allows passing a function that will be called once the @@ -110,7 +109,7 @@ type Props = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onshow */ - onShow?: ?(event?: SyntheticEvent) => mixed, + onShow?: ?DirectEventHandler, /** * The `onDismiss` prop allows passing a function that will be called once @@ -143,16 +142,21 @@ type Props = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onorientationchange */ - onOrientationChange?: ?(event: OrientationChangeEvent) => mixed, + onOrientationChange?: ?DirectEventHandler, |}>; class Modal extends React.Component { - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + hardwareAccelerated: boolean, + visible: boolean, + |}> = { visible: true, hardwareAccelerated: false, }; - static contextTypes = { + static contextTypes: + | any + | $TEMPORARY$object<{|rootTag: React$PropType$Primitive|}> = { rootTag: PropTypes.number, }; @@ -165,13 +169,15 @@ class Modal extends React.Component { this._identifier = uniqueModalIdentifier++; } - static childContextTypes = { + static childContextTypes: + | any + | $TEMPORARY$object<{|virtualizedList: React$PropType$Primitive|}> = { virtualizedList: PropTypes.object, }; - getChildContext() { + getChildContext(): $TEMPORARY$object<{|virtualizedList: null|}> { // Reset the context so VirtualizedList doesn't get confused by nesting - // in the React tree that doesn't reflect the native component heirarchy. + // in the React tree that doesn't reflect the native component hierarchy. return { virtualizedList: null, }; @@ -261,7 +267,11 @@ class Modal extends React.Component { onStartShouldSetResponder={this._shouldSetResponder} supportedOrientations={this.props.supportedOrientations} onOrientationChange={this.props.onOrientationChange}> - {innerChildren} + + + {innerChildren} + + ); } @@ -272,7 +282,7 @@ class Modal extends React.Component { } } -const side = I18nManager.isRTL ? 'right' : 'left'; +const side = I18nManager.getConstants().isRTL ? 'right' : 'left'; const styles = StyleSheet.create({ modal: { position: 'absolute', diff --git a/Libraries/Modal/ModalSchema.js b/Libraries/Modal/ModalSchema.js deleted file mode 100644 index 7c0b3e9299071e..00000000000000 --- a/Libraries/Modal/ModalSchema.js +++ /dev/null @@ -1,182 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ -'use strict'; - -import type {SchemaType} from '../../packages/react-native-codegen/src/CodegenSchema.js'; - -const ModalSchema: SchemaType = { - modules: { - ModalHostView: { - components: { - ModalHostView: { - interfaceOnly: true, - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [ - { - name: 'onRequestClose', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - { - name: 'onShow', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - { - name: 'onDismiss', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - { - name: 'onOrientationChange', - optional: true, - bubblingType: 'bubble', - typeAnnotation: { - type: 'EventTypeAnnotation', - argument: { - type: 'ObjectTypeAnnotation', - properties: [], - }, - }, - }, - ], - props: [ - { - name: 'animationType', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'none', - options: [ - { - name: 'none', - }, - { - name: 'slide', - }, - { - name: 'fade', - }, - ], - }, - }, - { - name: 'presentationStyle', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'fullScreen', - options: [ - { - name: 'fullScreen', - }, - { - name: 'pageSheet', - }, - { - name: 'formSheet', - }, - { - name: 'overFullScreen', - }, - ], - }, - }, - { - name: 'transparent', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'hardwareAccelerated', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'visible', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: true, - }, - }, - { - name: 'supportedOrientations', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'portrait', - options: [ - { - name: 'portrait', - }, - { - name: 'portrait-upside-down', - }, - { - name: 'landscape', - }, - { - name: 'landscape-left', - }, - { - name: 'landscape-right', - }, - ], - }, - }, - { - name: 'identifier', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: 0, - }, - }, - ], - }, - }, - }, - }, -}; - -module.exports = ModalSchema; diff --git a/Libraries/Modal/NativeModalManager.js b/Libraries/Modal/NativeModalManager.js new file mode 100644 index 00000000000000..5f4e6c146fcc0e --- /dev/null +++ b/Libraries/Modal/NativeModalManager.js @@ -0,0 +1,22 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + // RCTEventEmitter + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get('ModalManager'): ?Spec); diff --git a/Libraries/Modal/RCTModalHostViewNativeComponent.js b/Libraries/Modal/RCTModalHostViewNativeComponent.js index a19c76b92ab8d7..214db2588212ce 100644 --- a/Libraries/Modal/RCTModalHostViewNativeComponent.js +++ b/Libraries/Modal/RCTModalHostViewNativeComponent.js @@ -10,19 +10,22 @@ 'use strict'; -const requireNativeComponent = require('../ReactNative/requireNativeComponent'); +import codegenNativeComponent from '../Utilities/codegenNativeComponent'; +import {type NativeComponentType} from '../Utilities/codegenNativeComponent'; +import type { + WithDefault, + BubblingEventHandler, + DirectEventHandler, + Int32, +} from '../Types/CodegenTypes'; import type {ViewProps} from '../Components/View/ViewPropTypes'; -import type {SyntheticEvent} from '../Types/CoreEventTypes'; -import type {NativeComponent} from '../Renderer/shims/ReactNative'; -type OrientationChangeEvent = SyntheticEvent< - $ReadOnly<{| - orientation: 'portrait' | 'landscape', - |}>, ->; +type OrientationChangeEvent = $ReadOnly<{| + orientation: 'portrait' | 'landscape', +|}>; -type ModalNativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{| ...ViewProps, /** @@ -30,19 +33,17 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#animationtype */ - animationType?: ?('none' | 'slide' | 'fade'), + animationType?: WithDefault<'none' | 'slide' | 'fade', 'none'>, /** * The `presentationStyle` prop controls how the modal appears. * * See https://facebook.github.io/react-native/docs/modal.html#presentationstyle */ - presentationStyle?: ?( - | 'fullScreen' - | 'pageSheet' - | 'formSheet' - | 'overFullScreen' - ), + presentationStyle?: WithDefault< + 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen', + 'fullScreen', + >, /** * The `transparent` prop determines whether your modal will fill the @@ -50,7 +51,7 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#transparent */ - transparent?: ?boolean, + transparent?: WithDefault, /** * The `hardwareAccelerated` prop controls whether to force hardware @@ -58,14 +59,7 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#hardwareaccelerated */ - hardwareAccelerated?: ?boolean, - - /** - * The `visible` prop determines whether your modal is visible. - * - * See https://facebook.github.io/react-native/docs/modal.html#visible - */ - visible?: ?boolean, + hardwareAccelerated?: WithDefault, /** * The `onRequestClose` callback is called when the user taps the hardware @@ -75,7 +69,7 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onrequestclose */ - onRequestClose?: ?(event?: SyntheticEvent) => mixed, + onRequestClose?: ?DirectEventHandler, /** * The `onShow` prop allows passing a function that will be called once the @@ -83,7 +77,7 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onshow */ - onShow?: ?(event?: SyntheticEvent) => mixed, + onShow?: ?DirectEventHandler, /** * The `onDismiss` prop allows passing a function that will be called once @@ -91,24 +85,27 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#ondismiss */ - onDismiss?: ?() => mixed, + onDismiss?: ?BubblingEventHandler, /** * Deprecated. Use the `animationType` prop instead. */ - animated?: ?boolean, + animated?: WithDefault, /** * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. * * See https://facebook.github.io/react-native/docs/modal.html#supportedorientations */ - supportedOrientations?: ?$ReadOnlyArray< - | 'portrait' - | 'portrait-upside-down' - | 'landscape' - | 'landscape-left' - | 'landscape-right', + supportedOrientations?: WithDefault< + $ReadOnlyArray< + | 'portrait' + | 'portrait-upside-down' + | 'landscape' + | 'landscape-left' + | 'landscape-right', + >, + 'portrait', >, /** @@ -116,16 +113,15 @@ type ModalNativeProps = $ReadOnly<{| * * See https://facebook.github.io/react-native/docs/modal.html#onorientationchange */ - onOrientationChange?: ?(event: OrientationChangeEvent) => mixed, + onOrientationChange?: ?DirectEventHandler, /** * The `identifier` is the unique number for identifying Modal components. */ - identifier?: ?number, + identifier?: WithDefault, |}>; -type RCTModalHostViewNativeType = Class>; - -module.exports = ((requireNativeComponent( - 'RCTModalHostView', -): any): RCTModalHostViewNativeType); +export default (codegenNativeComponent('ModalHostView', { + interfaceOnly: true, + paperComponentName: 'RCTModalHostView', +}): NativeComponentType); diff --git a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m index 7b45202af1648b..8ea28df44d8346 100644 --- a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTDecayAnimation.h" +#import #import // TODO(macOS ISS#2323203) #import -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" +#import +#import @interface RCTDecayAnimation () diff --git a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m index 7ae667bb833df0..778c775a2c20a4 100644 --- a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTEventAnimation.h" +#import @implementation RCTEventAnimation { diff --git a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m index 1ca342a95486ab..4241980e2eb2c4 100644 --- a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTFrameAnimation.h" +#import #import // TODO(macOS ISS#2323203) #import #import -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" +#import +#import @interface RCTFrameAnimation () diff --git a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m index 5f05e326c112f3..a8fb5b5dbbde78 100644 --- a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTSpringAnimation.h" +#import #import // TODO(macOS ISS#2323203) #import #import -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" +#import +#import @interface RCTSpringAnimation () diff --git a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m index dfb6f92a2999df..d7bedda903fb47 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTAdditionAnimatedNode.h" +#import @implementation RCTAdditionAnimatedNode diff --git a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h index 376f9e602683f0..b6ad4c1d73de63 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h @@ -31,7 +31,7 @@ - (void)setNeedsUpdate NS_REQUIRES_SUPER; /** - * The node will update its value if necesarry and only after its parents have updated. + * The node will update its value if necessary and only after its parents have updated. */ - (void)updateNodeIfNecessary NS_REQUIRES_SUPER; diff --git a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m index 6f61e084a472a5..ade2cae1b3d86d 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTAnimatedNode.h" +#import #import @@ -110,7 +110,7 @@ - (void)updateNodeIfNecessary - (void)performUpdate { _needsUpdate = NO; - // To be overidden by subclasses + // To be overridden by subclasses // This method is called on a node only if it has been marked for update // during the current update loop } diff --git a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m index 569741722ab74f..4cd29fb42bc059 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTDiffClampAnimatedNode.h" +#import #import diff --git a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m index d2cd3a1336c95c..c186a2cba3db0e 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTDivisionAnimatedNode.h" +#import #import diff --git a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m index 0fbaf57d4b4ac4..921a8db15f013b 100644 --- a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m @@ -5,31 +5,94 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTInterpolationAnimatedNode.h" +#import -#import "RCTAnimationUtils.h" +#import + +static NSRegularExpression *regex; @implementation RCTInterpolationAnimatedNode { __weak RCTValueAnimatedNode *_parentNode; NSArray *_inputRange; NSArray *_outputRange; + NSArray *> *_outputs; + NSArray *_soutputRange; NSString *_extrapolateLeft; NSString *_extrapolateRight; + NSUInteger _numVals; + bool _hasStringOutput; + bool _shouldRound; + NSArray *_matches; } - (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary *)config { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSString *fpRegex = @"[+-]?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?"; + regex = [NSRegularExpression regularExpressionWithPattern:fpRegex options:NSRegularExpressionCaseInsensitive error:nil]; + }); if ((self = [super initWithTag:tag config:config])) { _inputRange = [config[@"inputRange"] copy]; NSMutableArray *outputRange = [NSMutableArray array]; + NSMutableArray *soutputRange = [NSMutableArray array]; + NSMutableArray *> *_outputRanges = [NSMutableArray array]; + + _hasStringOutput = NO; for (id value in config[@"outputRange"]) { if ([value isKindOfClass:[NSNumber class]]) { [outputRange addObject:value]; + } else if ([value isKindOfClass:[NSString class]]) { + /** + * Supports string shapes by extracting numbers so new values can be computed, + * and recombines those values into new strings of the same shape. Supports + * things like: + * + * rgba(123, 42, 99, 0.36) // colors + * -45deg // values with units + */ + NSMutableArray *output = [NSMutableArray array]; + [_outputRanges addObject:output]; + [soutputRange addObject:value]; + + _matches = [regex matchesInString:value options:0 range:NSMakeRange(0, [value length])]; + for (NSTextCheckingResult *match in _matches) { + NSString* strNumber = [value substringWithRange:match.range]; + [output addObject:[NSNumber numberWithDouble:strNumber.doubleValue]]; + } + + _hasStringOutput = YES; + [outputRange addObject:[output objectAtIndex:0]]; + } + } + if (_hasStringOutput) { + // ['rgba(0, 100, 200, 0)', 'rgba(50, 150, 250, 0.5)'] + // -> + // [ + // [0, 50], + // [100, 150], + // [200, 250], + // [0, 0.5], + // ] + _numVals = [_matches count]; + NSString *value = [soutputRange objectAtIndex:0]; + _shouldRound = [value containsString:@"rgb"]; + _matches = [regex matchesInString:value options:0 range:NSMakeRange(0, [value length])]; + NSMutableArray *> *outputs = [NSMutableArray arrayWithCapacity:_numVals]; + NSUInteger size = [soutputRange count]; + for (NSUInteger j = 0; j < _numVals; j++) { + NSMutableArray *output = [NSMutableArray arrayWithCapacity:size]; + [outputs addObject:output]; + for (int i = 0; i < size; i++) { + [output addObject:[[_outputRanges objectAtIndex:i] objectAtIndex:j]]; + } } + _outputs = [outputs copy]; } _outputRange = [outputRange copy]; + _soutputRange = [soutputRange copy]; _extrapolateLeft = config[@"extrapolateLeft"]; _extrapolateRight = config[@"extrapolateRight"]; } @@ -61,11 +124,48 @@ - (void)performUpdate CGFloat inputValue = _parentNode.value; - self.value = RCTInterpolateValueInRange(inputValue, - _inputRange, - _outputRange, - _extrapolateLeft, - _extrapolateRight); + CGFloat interpolated = RCTInterpolateValueInRange(inputValue, + _inputRange, + _outputRange, + _extrapolateLeft, + _extrapolateRight); + self.value = interpolated; + if (_hasStringOutput) { + // 'rgba(0, 100, 200, 0)' + // -> + // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' + if (_numVals > 1) { + NSString *text = _soutputRange[0]; + NSMutableString *formattedText = [NSMutableString stringWithString:text]; + NSUInteger i = _numVals; + for (NSTextCheckingResult *match in [_matches reverseObjectEnumerator]) { + CGFloat val = RCTInterpolateValueInRange(inputValue, + _inputRange, + _outputs[--i], + _extrapolateLeft, + _extrapolateRight); + NSString *str; + if (_shouldRound) { + // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to + // round the opacity (4th column). + bool isAlpha = i == 3; + CGFloat rounded = isAlpha ? round(val * 1000) / 1000 : round(val); + str = isAlpha ? [NSString stringWithFormat:@"%1.3f", rounded] : [NSString stringWithFormat:@"%1.0f", rounded]; + } else { + NSNumber *numberValue = [NSNumber numberWithDouble:val]; + str = [numberValue stringValue]; + } + + [formattedText replaceCharactersInRange:[match range] withString:str]; + } + self.animatedObject = formattedText; + } else { + self.animatedObject = [regex stringByReplacingMatchesInString:_soutputRange[0] + options:0 + range:NSMakeRange(0, _soutputRange[0].length) + withTemplate:[NSString stringWithFormat:@"%1f", interpolated]]; + } + } } @end diff --git a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m index e75391c6dc0728..2165c6984be0a6 100644 --- a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTModuloAnimatedNode.h" +#import @implementation RCTModuloAnimatedNode diff --git a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m index 05a664e2e7483a..05428d3c527ce8 100644 --- a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTMultiplicationAnimatedNode.h" +#import @implementation RCTMultiplicationAnimatedNode diff --git a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m index 0a9a33434fb461..3469d941026fb3 100644 --- a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTPropsAnimatedNode.h" +#import #import #import #import -#import "RCTAnimationUtils.h" -#import "RCTStyleAnimatedNode.h" -#import "RCTValueAnimatedNode.h" +#import +#import +#import @@ -115,8 +115,13 @@ - (void)performUpdate } else if ([parentNode isKindOfClass:[RCTValueAnimatedNode class]]) { NSString *property = [self propertyNameForParentTag:parentTag]; - CGFloat value = [(RCTValueAnimatedNode *)parentNode value]; - self->_propsDictionary[property] = @(value); + id animatedObject = [(RCTValueAnimatedNode *)parentNode animatedObject]; + if (animatedObject) { + self->_propsDictionary[property] = animatedObject; + } else { + CGFloat value = [(RCTValueAnimatedNode *)parentNode value]; + self->_propsDictionary[property] = @(value); + } } } diff --git a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m index 665545be9b4edc..39385726716bce 100644 --- a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTStyleAnimatedNode.h" -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" -#import "RCTTransformAnimatedNode.h" +#import +#import +#import +#import @implementation RCTStyleAnimatedNode { diff --git a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m index c5489d15abb3b8..6aa29f44bf1fbe 100644 --- a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTSubtractionAnimatedNode.h" +#import @implementation RCTSubtractionAnimatedNode diff --git a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m index 337a1555373ae9..d1dc941363f954 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTrackingAnimatedNode.h" -#import "RCTValueAnimatedNode.h" -#import "RCTNativeAnimatedNodesManager.h" +#import +#import +#import @implementation RCTTrackingAnimatedNode { NSNumber *_animationId; diff --git a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m index 708cd846455693..5d1e0889473154 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTransformAnimatedNode.h" -#import "RCTValueAnimatedNode.h" +#import +#import @implementation RCTTransformAnimatedNode { diff --git a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h index e6ce1ff2801f6b..768cbf59dc3079 100644 --- a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h @@ -24,6 +24,7 @@ - (void)extractOffset; @property (nonatomic, assign) CGFloat value; +@property (nonatomic, strong) id animatedObject; @property (nonatomic, weak) id valueObserver; @end diff --git a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m index 949fcad137ff2e..261b6d7aec2081 100644 --- a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTValueAnimatedNode.h" +#import @interface RCTValueAnimatedNode () diff --git a/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj b/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj deleted file mode 100644 index 0089b27939cf49..00000000000000 --- a/Libraries/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj +++ /dev/null @@ -1,893 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 13E501CC1D07A644005F35D8 /* RCTAnimationUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */; }; - 13E501CF1D07A644005F35D8 /* RCTNativeAnimatedModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */; }; - 13E501E81D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */; }; - 13E501E91D07A6C9005F35D8 /* RCTAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */; }; - 13E501EB1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */; }; - 13E501EC1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */; }; - 13E501ED1D07A6C9005F35D8 /* RCTPropsAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */; }; - 13E501EE1D07A6C9005F35D8 /* RCTStyleAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */; }; - 13E501EF1D07A6C9005F35D8 /* RCTTransformAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */; }; - 13E501F01D07A6C9005F35D8 /* RCTValueAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */; }; - 184808BE21658FB600C3C43F /* RCTSubtractionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */; }; - 18B8F9C62143314E00CE911A /* RCTTrackingAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */; }; - 18F3B9ED2142F22C00AD247D /* RCTTrackingAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */; }; - 192F69811E823F4A008692C7 /* RCTAnimationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 192F69821E823F4A008692C7 /* RCTNativeAnimatedModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 192F69831E823F4A008692C7 /* RCTNativeAnimatedNodesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 192F69841E823F4A008692C7 /* RCTAnimationDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 192F69851E823F4A008692C7 /* RCTEventAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 192F69861E823F4A008692C7 /* RCTFrameAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 192F69871E823F4A008692C7 /* RCTSpringAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 192F69881E823F4A008692C7 /* RCTDivisionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 192F69891E823F4A008692C7 /* RCTDiffClampAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 192F698A1E823F4A008692C7 /* RCTAdditionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 192F698B1E823F4A008692C7 /* RCTAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 192F698C1E823F4A008692C7 /* RCTInterpolationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 192F698D1E823F4A008692C7 /* RCTModuloAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 192F698E1E823F4A008692C7 /* RCTMultiplicationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 192F698F1E823F4A008692C7 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 192F69901E823F4A008692C7 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 192F69911E823F4A008692C7 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 192F69941E823F78008692C7 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 192F69951E823F78008692C7 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 192F69961E823F78008692C7 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 192F69971E823F78008692C7 /* RCTAnimationDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 192F69981E823F78008692C7 /* RCTEventAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 192F69991E823F78008692C7 /* RCTFrameAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 192F699A1E823F78008692C7 /* RCTSpringAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 192F699B1E823F78008692C7 /* RCTDivisionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 192F699C1E823F78008692C7 /* RCTDiffClampAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 192F699D1E823F78008692C7 /* RCTAdditionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 192F699E1E823F78008692C7 /* RCTAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 192F699F1E823F78008692C7 /* RCTInterpolationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 192F69A01E823F78008692C7 /* RCTModuloAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 192F69A11E823F78008692C7 /* RCTMultiplicationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 192F69A21E823F78008692C7 /* RCTPropsAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 192F69A31E823F78008692C7 /* RCTStyleAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 192F69A41E823F78008692C7 /* RCTTransformAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 192F69A51E823F78008692C7 /* RCTValueAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 193F64F41D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */; }; - 194804ED1E975D8E00623005 /* RCTDecayAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804EE1E975D8E00623005 /* RCTDecayAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */; }; - 194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F01E975DCF00623005 /* RCTDecayAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F11E975DD700623005 /* RCTDecayAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F21E977DDB00623005 /* RCTDecayAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */; }; - 1980B70E1E80D1C4004DC789 /* RCTAnimationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 1980B7101E80D1C4004DC789 /* RCTNativeAnimatedModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 1980B7121E80D1C4004DC789 /* RCTNativeAnimatedNodesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 1980B7141E80D1C4004DC789 /* RCTAnimationDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 1980B7151E80D1C4004DC789 /* RCTEventAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 1980B7171E80D1C4004DC789 /* RCTFrameAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 1980B7191E80D1C4004DC789 /* RCTSpringAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 1980B71B1E80D1C4004DC789 /* RCTDivisionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 1980B71D1E80D1C4004DC789 /* RCTDiffClampAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 1980B71F1E80D1C4004DC789 /* RCTAdditionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 1980B7211E80D1C4004DC789 /* RCTAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 1980B7231E80D1C4004DC789 /* RCTInterpolationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 1980B7251E80D1C4004DC789 /* RCTModuloAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 1980B7271E80D1C4004DC789 /* RCTMultiplicationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 1980B7291E80D1C4004DC789 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 1980B72B1E80D1C4004DC789 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 1980B72D1E80D1C4004DC789 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 1980B7321E80D259004DC789 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 1980B7351E80DD6F004DC789 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 1980B7361E80DD6F004DC789 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 1980B7371E80DD6F004DC789 /* RCTAnimationDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 1980B7381E80DD6F004DC789 /* RCTEventAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 1980B7391E80DD6F004DC789 /* RCTFrameAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 1980B73A1E80DD6F004DC789 /* RCTSpringAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 1980B73B1E80DD6F004DC789 /* RCTDivisionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 1980B73C1E80DD6F004DC789 /* RCTDiffClampAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 1980B73D1E80DD6F004DC789 /* RCTAdditionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 1980B73E1E80DD6F004DC789 /* RCTAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 1980B73F1E80DD6F004DC789 /* RCTInterpolationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 1980B7401E80DD6F004DC789 /* RCTModuloAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 1980B7411E80DD6F004DC789 /* RCTMultiplicationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 1980B7421E80DD6F004DC789 /* RCTPropsAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 1980B7431E80DD6F004DC789 /* RCTStyleAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 1980B7441E80DD6F004DC789 /* RCTTransformAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 1980B7451E80DD6F004DC789 /* RCTValueAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 19F00F221DC8847500113FEE /* RCTEventAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 19F00F211DC8847500113FEE /* RCTEventAnimation.m */; }; - 19F00F231DC8848E00113FEE /* RCTEventAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 19F00F211DC8847500113FEE /* RCTEventAnimation.m */; }; - 2D3B5EF21D9B0B3100451313 /* RCTAnimationUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */; }; - 2D3B5EF41D9B0B3700451313 /* RCTNativeAnimatedModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */; }; - 2D3B5EF51D9B0B4800451313 /* RCTDivisionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */; }; - 2D3B5EF61D9B0B4800451313 /* RCTDiffClampAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */; }; - 2D3B5EF71D9B0B4800451313 /* RCTAdditionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */; }; - 2D3B5EF81D9B0B4800451313 /* RCTAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */; }; - 2D3B5EFA1D9B0B4800451313 /* RCTInterpolationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */; }; - 2D3B5EFB1D9B0B4800451313 /* RCTModuloAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */; }; - 2D3B5EFC1D9B0B4800451313 /* RCTMultiplicationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */; }; - 2D3B5EFD1D9B0B4800451313 /* RCTPropsAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */; }; - 2D3B5EFE1D9B0B4800451313 /* RCTStyleAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */; }; - 2D3B5EFF1D9B0B4800451313 /* RCTTransformAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */; }; - 2D3B5F001D9B0B4800451313 /* RCTValueAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */; }; - 2D65C80020732E4700C62FDF /* RCTSubtractionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */; }; - 2EC00631206EA19300586E91 /* RCTSubtractionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */; }; - 44DB7D942024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */; }; - 44DB7D952024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */; }; - 44DB7D972024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */; }; - 44DB7D982024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */; }; - 5C9894951D999639008027DB /* RCTDivisionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */; }; - 647647881F0BC7F200C2D89B /* RCTFrameAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */; }; - 647647891F0BC7F200C2D89B /* RCTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */; }; - 6476478A1F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */; }; - 6476478B1F0BC7F200C2D89B /* RCTValueAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */; }; - 6476478C1F0BC7F200C2D89B /* RCTModuloAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */; }; - 6476478D1F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */; }; - 6476478E1F0BC7F200C2D89B /* RCTEventAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 19F00F211DC8847500113FEE /* RCTEventAnimation.m */; }; - 6476478F1F0BC7F200C2D89B /* RCTStyleAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */; }; - 647647901F0BC7F200C2D89B /* RCTAnimationUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */; }; - 647647911F0BC7F200C2D89B /* RCTNativeAnimatedModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */; }; - 647647921F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */; }; - 647647931F0BC7F200C2D89B /* RCTPropsAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */; }; - 647647941F0BC7F200C2D89B /* RCTAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */; }; - 647647951F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */; }; - 647647961F0BC7F200C2D89B /* RCTAdditionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */; }; - 647647971F0BC7F200C2D89B /* RCTDivisionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */; }; - 647647981F0BC7F200C2D89B /* RCTTransformAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */; }; - 647647991F0BC7F200C2D89B /* RCTDecayAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */; }; - 6476479B1F0BC7F200C2D89B /* RCTAnimationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 6476479C1F0BC7F200C2D89B /* RCTNativeAnimatedModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 6476479D1F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 6476479E1F0BC7F200C2D89B /* RCTAnimationDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 6476479F1F0BC7F200C2D89B /* RCTEventAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 647647A01F0BC7F200C2D89B /* RCTDecayAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 647647A11F0BC7F200C2D89B /* RCTFrameAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 647647A21F0BC7F200C2D89B /* RCTSpringAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 647647A31F0BC7F200C2D89B /* RCTDivisionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 647647A41F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 647647A51F0BC7F200C2D89B /* RCTAdditionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 647647A61F0BC7F200C2D89B /* RCTAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 647647A71F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 647647A81F0BC7F200C2D89B /* RCTModuloAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 647647A91F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 647647AA1F0BC7F200C2D89B /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 647647AB1F0BC7F200C2D89B /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 647647AC1F0BC7F200C2D89B /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 647647AD1F0BC7F200C2D89B /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 647647AF1F0BC7F200C2D89B /* RCTDecayAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 647647B01F0BC7F200C2D89B /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 647647B11F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 647647B21F0BC7F200C2D89B /* RCTAnimationDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 647647B31F0BC7F200C2D89B /* RCTEventAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 647647B41F0BC7F200C2D89B /* RCTFrameAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 647647B51F0BC7F200C2D89B /* RCTSpringAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 647647B61F0BC7F200C2D89B /* RCTDivisionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 647647B71F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 647647B81F0BC7F200C2D89B /* RCTAdditionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 647647B91F0BC7F200C2D89B /* RCTAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 647647BA1F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 647647BB1F0BC7F200C2D89B /* RCTModuloAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 647647BC1F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 647647BD1F0BC7F200C2D89B /* RCTPropsAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 647647BE1F0BC7F200C2D89B /* RCTStyleAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 647647BF1F0BC7F200C2D89B /* RCTTransformAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 647647C01F0BC7F200C2D89B /* RCTValueAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 647647C11F0BC7F200C2D89B /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 944244D01DB962DA0032A02B /* RCTFrameAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */; }; - 944244D11DB962DC0032A02B /* RCTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */; }; - 9476E8EC1DC9232D005D5CD1 /* RCTNativeAnimatedNodesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */; }; - 94C129511D40692B0025F25C /* RCTFrameAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */; }; - 94C129521D40692B0025F25C /* RCTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */; }; - 94DA09181DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */; }; - 94DAE3F91D7334A70059942F /* RCTModuloAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 192F69931E823F4F008692C7 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTAnimation; - dstSubfolderSpec = 16; - files = ( - 194804F11E975DD700623005 /* RCTDecayAnimation.h in CopyFiles */, - 192F69941E823F78008692C7 /* RCTAnimationUtils.h in CopyFiles */, - 192F69951E823F78008692C7 /* RCTNativeAnimatedModule.h in CopyFiles */, - 192F69961E823F78008692C7 /* RCTNativeAnimatedNodesManager.h in CopyFiles */, - 192F69971E823F78008692C7 /* RCTAnimationDriver.h in CopyFiles */, - 192F69981E823F78008692C7 /* RCTEventAnimation.h in CopyFiles */, - 192F69991E823F78008692C7 /* RCTFrameAnimation.h in CopyFiles */, - 192F699A1E823F78008692C7 /* RCTSpringAnimation.h in CopyFiles */, - 192F699B1E823F78008692C7 /* RCTDivisionAnimatedNode.h in CopyFiles */, - 192F699C1E823F78008692C7 /* RCTDiffClampAnimatedNode.h in CopyFiles */, - 192F699D1E823F78008692C7 /* RCTAdditionAnimatedNode.h in CopyFiles */, - 192F699E1E823F78008692C7 /* RCTAnimatedNode.h in CopyFiles */, - 192F699F1E823F78008692C7 /* RCTInterpolationAnimatedNode.h in CopyFiles */, - 192F69A01E823F78008692C7 /* RCTModuloAnimatedNode.h in CopyFiles */, - 192F69A11E823F78008692C7 /* RCTMultiplicationAnimatedNode.h in CopyFiles */, - 192F69A21E823F78008692C7 /* RCTPropsAnimatedNode.h in CopyFiles */, - 192F69A31E823F78008692C7 /* RCTStyleAnimatedNode.h in CopyFiles */, - 192F69A41E823F78008692C7 /* RCTTransformAnimatedNode.h in CopyFiles */, - 192F69A51E823F78008692C7 /* RCTValueAnimatedNode.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1980B7311E80D21C004DC789 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTAnimation; - dstSubfolderSpec = 16; - files = ( - 194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */, - 1980B7351E80DD6F004DC789 /* RCTNativeAnimatedModule.h in CopyFiles */, - 1980B7361E80DD6F004DC789 /* RCTNativeAnimatedNodesManager.h in CopyFiles */, - 1980B7371E80DD6F004DC789 /* RCTAnimationDriver.h in CopyFiles */, - 1980B7381E80DD6F004DC789 /* RCTEventAnimation.h in CopyFiles */, - 1980B7391E80DD6F004DC789 /* RCTFrameAnimation.h in CopyFiles */, - 1980B73A1E80DD6F004DC789 /* RCTSpringAnimation.h in CopyFiles */, - 1980B73B1E80DD6F004DC789 /* RCTDivisionAnimatedNode.h in CopyFiles */, - 1980B73C1E80DD6F004DC789 /* RCTDiffClampAnimatedNode.h in CopyFiles */, - 1980B73D1E80DD6F004DC789 /* RCTAdditionAnimatedNode.h in CopyFiles */, - 1980B73E1E80DD6F004DC789 /* RCTAnimatedNode.h in CopyFiles */, - 1980B73F1E80DD6F004DC789 /* RCTInterpolationAnimatedNode.h in CopyFiles */, - 1980B7401E80DD6F004DC789 /* RCTModuloAnimatedNode.h in CopyFiles */, - 1980B7411E80DD6F004DC789 /* RCTMultiplicationAnimatedNode.h in CopyFiles */, - 1980B7421E80DD6F004DC789 /* RCTPropsAnimatedNode.h in CopyFiles */, - 1980B7431E80DD6F004DC789 /* RCTStyleAnimatedNode.h in CopyFiles */, - 1980B7441E80DD6F004DC789 /* RCTTransformAnimatedNode.h in CopyFiles */, - 1980B7451E80DD6F004DC789 /* RCTValueAnimatedNode.h in CopyFiles */, - 1980B7321E80D259004DC789 /* RCTAnimationUtils.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 647647AE1F0BC7F200C2D89B /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTAnimation; - dstSubfolderSpec = 16; - files = ( - 647647AF1F0BC7F200C2D89B /* RCTDecayAnimation.h in CopyFiles */, - 647647B01F0BC7F200C2D89B /* RCTNativeAnimatedModule.h in CopyFiles */, - 647647B11F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.h in CopyFiles */, - 647647B21F0BC7F200C2D89B /* RCTAnimationDriver.h in CopyFiles */, - 647647B31F0BC7F200C2D89B /* RCTEventAnimation.h in CopyFiles */, - 647647B41F0BC7F200C2D89B /* RCTFrameAnimation.h in CopyFiles */, - 647647B51F0BC7F200C2D89B /* RCTSpringAnimation.h in CopyFiles */, - 647647B61F0BC7F200C2D89B /* RCTDivisionAnimatedNode.h in CopyFiles */, - 647647B71F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.h in CopyFiles */, - 647647B81F0BC7F200C2D89B /* RCTAdditionAnimatedNode.h in CopyFiles */, - 647647B91F0BC7F200C2D89B /* RCTAnimatedNode.h in CopyFiles */, - 647647BA1F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.h in CopyFiles */, - 647647BB1F0BC7F200C2D89B /* RCTModuloAnimatedNode.h in CopyFiles */, - 647647BC1F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.h in CopyFiles */, - 647647BD1F0BC7F200C2D89B /* RCTPropsAnimatedNode.h in CopyFiles */, - 647647BE1F0BC7F200C2D89B /* RCTStyleAnimatedNode.h in CopyFiles */, - 647647BF1F0BC7F200C2D89B /* RCTTransformAnimatedNode.h in CopyFiles */, - 647647C01F0BC7F200C2D89B /* RCTValueAnimatedNode.h in CopyFiles */, - 647647C11F0BC7F200C2D89B /* RCTAnimationUtils.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAnimation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAnimationUtils.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtils.m; sourceTree = ""; }; - 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNativeAnimatedModule.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedModule.m; sourceTree = ""; }; - 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAdditionAnimatedNode.h; sourceTree = ""; }; - 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAdditionAnimatedNode.m; sourceTree = ""; }; - 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimatedNode.h; sourceTree = ""; }; - 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimatedNode.m; sourceTree = ""; }; - 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTInterpolationAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInterpolationAnimatedNode.m; sourceTree = ""; }; - 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTMultiplicationAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultiplicationAnimatedNode.m; sourceTree = ""; }; - 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPropsAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPropsAnimatedNode.m; sourceTree = ""; }; - 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTStyleAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStyleAnimatedNode.m; sourceTree = ""; }; - 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTTransformAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTransformAnimatedNode.m; sourceTree = ""; }; - 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTValueAnimatedNode.m; sourceTree = ""; }; - 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDiffClampAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDiffClampAnimatedNode.m; sourceTree = ""; }; - 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDecayAnimation.h; sourceTree = ""; }; - 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDecayAnimation.m; sourceTree = ""; }; - 19F00F201DC8847500113FEE /* RCTEventAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTEventAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 19F00F211DC8847500113FEE /* RCTEventAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventAnimation.m; sourceTree = ""; }; - 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAnimation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 2EC0062F206EA15F00586E91 /* RCTSubtractionAnimatedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTSubtractionAnimatedNode.h; sourceTree = ""; }; - 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTSubtractionAnimatedNode.m; sourceTree = ""; }; - 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTrackingAnimatedNode.h; sourceTree = ""; }; - 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTTrackingAnimatedNode.m; sourceTree = ""; }; - 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDivisionAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDivisionAnimatedNode.m; sourceTree = ""; }; - 647647C51F0BC7F200C2D89B /* libRCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAnimation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAnimationDriver.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTFrameAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTFrameAnimation.m; sourceTree = ""; }; - 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTSpringAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTSpringAnimation.m; sourceTree = ""; }; - 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeAnimatedNodesManager.h; sourceTree = ""; }; - 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedNodesManager.m; sourceTree = ""; }; - 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTModuloAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuloAnimatedNode.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTAnimation.a */, - ); - name = Products; - sourceTree = ""; - }; - 13E501D51D07A6C9005F35D8 /* Nodes */ = { - isa = PBXGroup; - children = ( - 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */, - 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */, - 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */, - 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */, - 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */, - 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */, - 2EC0062F206EA15F00586E91 /* RCTSubtractionAnimatedNode.h */, - 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */, - 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */, - 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */, - 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */, - 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */, - 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */, - 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */, - 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */, - 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */, - 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */, - 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */, - 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */, - 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */, - 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */, - 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */, - 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */, - 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */, - 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */, - 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */, - ); - path = Nodes; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */, - 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */, - 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */, - 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */, - 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */, - 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */, - 94C129491D4069170025F25C /* Drivers */, - 13E501D51D07A6C9005F35D8 /* Nodes */, - 134814211AA4EA7D00B7C361 /* Products */, - 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */, - 647647C51F0BC7F200C2D89B /* libRCTAnimation.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 94C129491D4069170025F25C /* Drivers */ = { - isa = PBXGroup; - children = ( - 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */, - 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */, - 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */, - 19F00F201DC8847500113FEE /* RCTEventAnimation.h */, - 19F00F211DC8847500113FEE /* RCTEventAnimation.m */, - 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */, - 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */, - 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */, - 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */, - ); - path = Drivers; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 192F69801E823F2E008692C7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 194804F01E975DCF00623005 /* RCTDecayAnimation.h in Headers */, - 192F69811E823F4A008692C7 /* RCTAnimationUtils.h in Headers */, - 192F69821E823F4A008692C7 /* RCTNativeAnimatedModule.h in Headers */, - 192F69831E823F4A008692C7 /* RCTNativeAnimatedNodesManager.h in Headers */, - 192F69841E823F4A008692C7 /* RCTAnimationDriver.h in Headers */, - 192F69851E823F4A008692C7 /* RCTEventAnimation.h in Headers */, - 192F69861E823F4A008692C7 /* RCTFrameAnimation.h in Headers */, - 192F69871E823F4A008692C7 /* RCTSpringAnimation.h in Headers */, - 192F69881E823F4A008692C7 /* RCTDivisionAnimatedNode.h in Headers */, - 192F69891E823F4A008692C7 /* RCTDiffClampAnimatedNode.h in Headers */, - 192F698A1E823F4A008692C7 /* RCTAdditionAnimatedNode.h in Headers */, - 192F698B1E823F4A008692C7 /* RCTAnimatedNode.h in Headers */, - 44DB7D952024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */, - 192F698C1E823F4A008692C7 /* RCTInterpolationAnimatedNode.h in Headers */, - 192F698D1E823F4A008692C7 /* RCTModuloAnimatedNode.h in Headers */, - 192F698E1E823F4A008692C7 /* RCTMultiplicationAnimatedNode.h in Headers */, - 192F698F1E823F4A008692C7 /* RCTPropsAnimatedNode.h in Headers */, - 192F69901E823F4A008692C7 /* RCTStyleAnimatedNode.h in Headers */, - 192F69911E823F4A008692C7 /* RCTTransformAnimatedNode.h in Headers */, - 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1980B70D1E80D1B5004DC789 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 1980B70E1E80D1C4004DC789 /* RCTAnimationUtils.h in Headers */, - 1980B7101E80D1C4004DC789 /* RCTNativeAnimatedModule.h in Headers */, - 1980B7121E80D1C4004DC789 /* RCTNativeAnimatedNodesManager.h in Headers */, - 1980B7141E80D1C4004DC789 /* RCTAnimationDriver.h in Headers */, - 1980B7151E80D1C4004DC789 /* RCTEventAnimation.h in Headers */, - 194804ED1E975D8E00623005 /* RCTDecayAnimation.h in Headers */, - 1980B7171E80D1C4004DC789 /* RCTFrameAnimation.h in Headers */, - 1980B7191E80D1C4004DC789 /* RCTSpringAnimation.h in Headers */, - 1980B71B1E80D1C4004DC789 /* RCTDivisionAnimatedNode.h in Headers */, - 1980B71D1E80D1C4004DC789 /* RCTDiffClampAnimatedNode.h in Headers */, - 1980B71F1E80D1C4004DC789 /* RCTAdditionAnimatedNode.h in Headers */, - 1980B7211E80D1C4004DC789 /* RCTAnimatedNode.h in Headers */, - 44DB7D942024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */, - 1980B7231E80D1C4004DC789 /* RCTInterpolationAnimatedNode.h in Headers */, - 1980B7251E80D1C4004DC789 /* RCTModuloAnimatedNode.h in Headers */, - 1980B7271E80D1C4004DC789 /* RCTMultiplicationAnimatedNode.h in Headers */, - 1980B7291E80D1C4004DC789 /* RCTPropsAnimatedNode.h in Headers */, - 1980B72B1E80D1C4004DC789 /* RCTStyleAnimatedNode.h in Headers */, - 1980B72D1E80D1C4004DC789 /* RCTTransformAnimatedNode.h in Headers */, - 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6476479A1F0BC7F200C2D89B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 6476479B1F0BC7F200C2D89B /* RCTAnimationUtils.h in Headers */, - 6476479C1F0BC7F200C2D89B /* RCTNativeAnimatedModule.h in Headers */, - 6476479D1F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.h in Headers */, - 6476479E1F0BC7F200C2D89B /* RCTAnimationDriver.h in Headers */, - 6476479F1F0BC7F200C2D89B /* RCTEventAnimation.h in Headers */, - 647647A01F0BC7F200C2D89B /* RCTDecayAnimation.h in Headers */, - 647647A11F0BC7F200C2D89B /* RCTFrameAnimation.h in Headers */, - 647647A21F0BC7F200C2D89B /* RCTSpringAnimation.h in Headers */, - 647647A31F0BC7F200C2D89B /* RCTDivisionAnimatedNode.h in Headers */, - 647647A41F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.h in Headers */, - 647647A51F0BC7F200C2D89B /* RCTAdditionAnimatedNode.h in Headers */, - 647647A61F0BC7F200C2D89B /* RCTAnimatedNode.h in Headers */, - 18F3B9ED2142F22C00AD247D /* RCTTrackingAnimatedNode.h in Headers */, - 647647A71F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.h in Headers */, - 647647A81F0BC7F200C2D89B /* RCTModuloAnimatedNode.h in Headers */, - 647647A91F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.h in Headers */, - 647647AA1F0BC7F200C2D89B /* RCTPropsAnimatedNode.h in Headers */, - 647647AB1F0BC7F200C2D89B /* RCTStyleAnimatedNode.h in Headers */, - 647647AC1F0BC7F200C2D89B /* RCTTransformAnimatedNode.h in Headers */, - 647647AD1F0BC7F200C2D89B /* RCTValueAnimatedNode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2D2A281F1D9B03D100D4039D /* RCTAnimation-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28281D9B03D100D4039D /* Build configuration list for PBXNativeTarget "RCTAnimation-tvOS" */; - buildPhases = ( - 2D2A281C1D9B03D100D4039D /* Sources */, - 192F69801E823F2E008692C7 /* Headers */, - 192F69931E823F4F008692C7 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTAnimation-tvOS"; - productName = "RCTAnimation-tvOS"; - productReference = 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTAnimation */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTAnimation" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 1980B70D1E80D1B5004DC789 /* Headers */, - 1980B7311E80D21C004DC789 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTAnimation; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTAnimation.a */; - productType = "com.apple.product-type.library.static"; - }; - 647647861F0BC7F200C2D89B /* RCTAnimation-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 647647C21F0BC7F200C2D89B /* Build configuration list for PBXNativeTarget "RCTAnimation-macOS" */; - buildPhases = ( - 647647871F0BC7F200C2D89B /* Sources */, - 6476479A1F0BC7F200C2D89B /* Headers */, - 647647AE1F0BC7F200C2D89B /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTAnimation-macOS"; - productName = RCTDataManager; - productReference = 647647C51F0BC7F200C2D89B /* libRCTAnimation.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A281F1D9B03D100D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTAnimation" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTAnimation */, - 2D2A281F1D9B03D100D4039D /* RCTAnimation-tvOS */, - 647647861F0BC7F200C2D89B /* RCTAnimation-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A281C1D9B03D100D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F001D9B0B4800451313 /* RCTValueAnimatedNode.m in Sources */, - 2D3B5EFB1D9B0B4800451313 /* RCTModuloAnimatedNode.m in Sources */, - 2D3B5EF21D9B0B3100451313 /* RCTAnimationUtils.m in Sources */, - 2D3B5EF51D9B0B4800451313 /* RCTDivisionAnimatedNode.m in Sources */, - 2D3B5EF71D9B0B4800451313 /* RCTAdditionAnimatedNode.m in Sources */, - 19F00F231DC8848E00113FEE /* RCTEventAnimation.m in Sources */, - 2D3B5EF41D9B0B3700451313 /* RCTNativeAnimatedModule.m in Sources */, - 2D3B5EF61D9B0B4800451313 /* RCTDiffClampAnimatedNode.m in Sources */, - 2D3B5EF81D9B0B4800451313 /* RCTAnimatedNode.m in Sources */, - 2D3B5EFE1D9B0B4800451313 /* RCTStyleAnimatedNode.m in Sources */, - 2D3B5EFA1D9B0B4800451313 /* RCTInterpolationAnimatedNode.m in Sources */, - 2D3B5EFF1D9B0B4800451313 /* RCTTransformAnimatedNode.m in Sources */, - 2D3B5EFC1D9B0B4800451313 /* RCTMultiplicationAnimatedNode.m in Sources */, - 44DB7D982024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */, - 2D3B5EFD1D9B0B4800451313 /* RCTPropsAnimatedNode.m in Sources */, - 944244D01DB962DA0032A02B /* RCTFrameAnimation.m in Sources */, - 944244D11DB962DC0032A02B /* RCTSpringAnimation.m in Sources */, - 9476E8EC1DC9232D005D5CD1 /* RCTNativeAnimatedNodesManager.m in Sources */, - 194804F21E977DDB00623005 /* RCTDecayAnimation.m in Sources */, - 2D65C80020732E4700C62FDF /* RCTSubtractionAnimatedNode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 94C129511D40692B0025F25C /* RCTFrameAnimation.m in Sources */, - 94C129521D40692B0025F25C /* RCTSpringAnimation.m in Sources */, - 94DA09181DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m in Sources */, - 13E501F01D07A6C9005F35D8 /* RCTValueAnimatedNode.m in Sources */, - 94DAE3F91D7334A70059942F /* RCTModuloAnimatedNode.m in Sources */, - 193F64F41D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m in Sources */, - 19F00F221DC8847500113FEE /* RCTEventAnimation.m in Sources */, - 13E501EE1D07A6C9005F35D8 /* RCTStyleAnimatedNode.m in Sources */, - 13E501CC1D07A644005F35D8 /* RCTAnimationUtils.m in Sources */, - 13E501CF1D07A644005F35D8 /* RCTNativeAnimatedModule.m in Sources */, - 13E501EC1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m in Sources */, - 13E501ED1D07A6C9005F35D8 /* RCTPropsAnimatedNode.m in Sources */, - 13E501E91D07A6C9005F35D8 /* RCTAnimatedNode.m in Sources */, - 44DB7D972024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */, - 13E501EB1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m in Sources */, - 13E501E81D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m in Sources */, - 5C9894951D999639008027DB /* RCTDivisionAnimatedNode.m in Sources */, - 13E501EF1D07A6C9005F35D8 /* RCTTransformAnimatedNode.m in Sources */, - 194804EE1E975D8E00623005 /* RCTDecayAnimation.m in Sources */, - 2EC00631206EA19300586E91 /* RCTSubtractionAnimatedNode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 647647871F0BC7F200C2D89B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 647647881F0BC7F200C2D89B /* RCTFrameAnimation.m in Sources */, - 647647891F0BC7F200C2D89B /* RCTSpringAnimation.m in Sources */, - 6476478A1F0BC7F200C2D89B /* RCTNativeAnimatedNodesManager.m in Sources */, - 6476478B1F0BC7F200C2D89B /* RCTValueAnimatedNode.m in Sources */, - 6476478C1F0BC7F200C2D89B /* RCTModuloAnimatedNode.m in Sources */, - 6476478D1F0BC7F200C2D89B /* RCTDiffClampAnimatedNode.m in Sources */, - 6476478E1F0BC7F200C2D89B /* RCTEventAnimation.m in Sources */, - 6476478F1F0BC7F200C2D89B /* RCTStyleAnimatedNode.m in Sources */, - 647647901F0BC7F200C2D89B /* RCTAnimationUtils.m in Sources */, - 647647911F0BC7F200C2D89B /* RCTNativeAnimatedModule.m in Sources */, - 647647921F0BC7F200C2D89B /* RCTMultiplicationAnimatedNode.m in Sources */, - 647647931F0BC7F200C2D89B /* RCTPropsAnimatedNode.m in Sources */, - 647647941F0BC7F200C2D89B /* RCTAnimatedNode.m in Sources */, - 18B8F9C62143314E00CE911A /* RCTTrackingAnimatedNode.m in Sources */, - 647647951F0BC7F200C2D89B /* RCTInterpolationAnimatedNode.m in Sources */, - 647647961F0BC7F200C2D89B /* RCTAdditionAnimatedNode.m in Sources */, - 647647971F0BC7F200C2D89B /* RCTDivisionAnimatedNode.m in Sources */, - 647647981F0BC7F200C2D89B /* RCTTransformAnimatedNode.m in Sources */, - 647647991F0BC7F200C2D89B /* RCTDecayAnimation.m in Sources */, - 184808BE21658FB600C3C43F /* RCTSubtractionAnimatedNode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28261D9B03D100D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = appletvos; - }; - name = Debug; - }; - 2D2A28271D9B03D100D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = appletvos; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - }; - name = Release; - }; - 647647C31F0BC7F200C2D89B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = macosx; - }; - name = Debug; - }; - 647647C41F0BC7F200C2D89B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28281D9B03D100D4039D /* Build configuration list for PBXNativeTarget "RCTAnimation-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28261D9B03D100D4039D /* Debug */, - 2D2A28271D9B03D100D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTAnimation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTAnimation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 647647C21F0BC7F200C2D89B /* Build configuration list for PBXNativeTarget "RCTAnimation-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 647647C31F0BC7F200C2D89B /* Debug */, - 647647C41F0BC7F200C2D89B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/NativeAnimation/RCTAnimationUtils.m b/Libraries/NativeAnimation/RCTAnimationUtils.m index bd4b2c33e249ce..5d719109d8dcf8 100644 --- a/Libraries/NativeAnimation/RCTAnimationUtils.m +++ b/Libraries/NativeAnimation/RCTAnimationUtils.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTAnimationUtils.h" +#import #import diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.m b/Libraries/NativeAnimation/RCTNativeAnimatedModule.m index 08deab3e512015..c7f4a0be9fa6e2 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.m +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.m @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -#import "RCTNativeAnimatedModule.h" +#import -#import "RCTNativeAnimatedNodesManager.h" +#import typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager); @@ -14,7 +14,7 @@ @implementation RCTNativeAnimatedModule { RCTNativeAnimatedNodesManager *_nodesManager; - // Oparations called after views have been updated. + // Operations called after views have been updated. NSMutableArray *_operations; // Operations called before views have been updated. NSMutableArray *_preOperations; @@ -87,10 +87,14 @@ - (void)setBridge:(RCTBridge *)bridge [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { [nodesManager startAnimatingNode:animationId nodeTag:nodeTag config:config endCallback:callBack]; }]; - if ([_nodesManager isNodeManagedByFabric:nodeTag]) { - _animIdIsManagedByFabric[animationId] = @YES; - [self flushOperationQueues]; - } + __weak RCTNativeAnimatedModule *weakSelf = self; + RCTExecuteOnMainQueue(^{ + __strong RCTNativeAnimatedModule *strongSelf = weakSelf; + if (strongSelf && [strongSelf->_nodesManager isNodeManagedByFabric:nodeTag]) { + strongSelf->_animIdIsManagedByFabric[animationId] = @YES; + [strongSelf flushOperationQueues]; + } + }); } RCT_EXPORT_METHOD(stopAnimation:(nonnull NSNumber *)animationId) @@ -232,27 +236,31 @@ - (void)flushOperationQueues - (void)willMountComponentsWithRootTag:(NSInteger)rootTag { RCTAssertMainQueue(); - __block NSArray *preOperations; - RCTUnsafeExecuteOnUIManagerQueueSync(^{ - preOperations = self->_preOperations; + RCTExecuteOnUIManagerQueue(^{ + NSArray *preOperations = self->_preOperations; self->_preOperations = [NSMutableArray new]; + + RCTExecuteOnMainQueue(^{ + for (AnimatedOperation preOperation in preOperations) { + preOperation(self->_nodesManager); + } + }); }); - for (AnimatedOperation operation in preOperations) { - operation(self->_nodesManager); - } } - (void)didMountComponentsWithRootTag:(NSInteger)rootTag { RCTAssertMainQueue(); - __block NSArray *operations; - RCTUnsafeExecuteOnUIManagerQueueSync(^{ - operations = self->_operations; + RCTExecuteOnUIManagerQueue(^{ + NSArray *operations = self->_operations; self->_operations = [NSMutableArray new]; + + RCTExecuteOnMainQueue(^{ + for (AnimatedOperation operation in operations) { + operation(self->_nodesManager); + } + }); }); - for (AnimatedOperation operation in operations) { - operation(self->_nodesManager); - } } #pragma mark - RCTUIManagerObserver diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h index fa846f62de72c9..82a2327c74ce2b 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h @@ -12,8 +12,6 @@ @protocol RCTValueAnimatedNodeObserver; -@protocol RCTValueAnimatedNodeObserver; - @interface RCTNativeAnimatedNodesManager : NSObject - (nonnull instancetype)initWithBridge:(nonnull RCTBridge *)bridge; diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m index 0cf4fb3e3ecb59..97f039ae0f263d 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m @@ -5,28 +5,43 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTNativeAnimatedNodesManager.h" +#import #import -#import "RCTAdditionAnimatedNode.h" -#import "RCTAnimatedNode.h" -#import "RCTAnimationDriver.h" -#import "RCTDiffClampAnimatedNode.h" -#import "RCTDivisionAnimatedNode.h" -#import "RCTEventAnimation.h" -#import "RCTFrameAnimation.h" -#import "RCTDecayAnimation.h" -#import "RCTInterpolationAnimatedNode.h" -#import "RCTModuloAnimatedNode.h" -#import "RCTMultiplicationAnimatedNode.h" -#import "RCTPropsAnimatedNode.h" -#import "RCTSpringAnimation.h" -#import "RCTStyleAnimatedNode.h" -#import "RCTSubtractionAnimatedNode.h" -#import "RCTTransformAnimatedNode.h" -#import "RCTValueAnimatedNode.h" -#import "RCTTrackingAnimatedNode.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// We do some normalizing of the event names in RCTEventDispatcher#RCTNormalizeInputEventName. +// To make things simpler just get rid of the parts we change in the event names we use here. +// This is a lot easier than trying to denormalize because there would be multiple possible +// denormalized forms for a single input. +static NSString *RCTNormalizeAnimatedEventName(NSString *eventName) +{ + if ([eventName hasPrefix:@"on"]) { + return [eventName substringFromIndex:2]; + } + if ([eventName hasPrefix:@"top"]) { + return [eventName substringFromIndex:3]; + } + return eventName; +} @implementation RCTNativeAnimatedNodesManager { @@ -53,7 +68,10 @@ - (instancetype)initWithBridge:(nonnull RCTBridge *)bridge - (BOOL)isNodeManagedByFabric:(nonnull NSNumber *)tag { RCTAnimatedNode *node = _animationNodes[tag]; - return [node isManagedByFabric]; + if (node) { + return [node isManagedByFabric]; + } + return false; } #pragma mark -- Graph @@ -321,7 +339,7 @@ - (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag RCTEventAnimation *driver = [[RCTEventAnimation alloc] initWithEventPath:eventPath valueNode:(RCTValueAnimatedNode *)node]; - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, eventName]; + NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeAnimatedEventName(eventName)]; if (_eventDrivers[key] != nil) { [_eventDrivers[key] addObject:driver]; } else { @@ -335,7 +353,7 @@ - (void)removeAnimatedEventFromView:(nonnull NSNumber *)viewTag eventName:(nonnull NSString *)eventName animatedNodeTag:(nonnull NSNumber *)animatedNodeTag { - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, eventName]; + NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeAnimatedEventName(eventName)]; if (_eventDrivers[key] != nil) { if (_eventDrivers[key].count == 1) { [_eventDrivers removeObjectForKey:key]; @@ -357,7 +375,7 @@ - (void)handleAnimatedEvent:(id)event return; } - NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, event.eventName]; + NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeAnimatedEventName(event.eventName)]; NSMutableArray *driversForKey = _eventDrivers[key]; if (driversForKey) { for (RCTEventAnimation *driver in driversForKey) { diff --git a/Libraries/NativeAnimation/React-RCTAnimation.podspec b/Libraries/NativeAnimation/React-RCTAnimation.podspec index 702234cd112f02..80c6de01d3a4f0 100644 --- a/Libraries/NativeAnimation/React-RCTAnimation.podspec +++ b/Libraries/NativeAnimation/React-RCTAnimation.podspec @@ -26,9 +26,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "{Drivers/*,Nodes/*,*}.{h,m}" + s.source_files = "{Drivers/*,Nodes/*,*}.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTAnimation" - s.dependency "React-Core", version + s.dependency "React-Core/RCTAnimationHeaders", version end diff --git a/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js new file mode 100644 index 00000000000000..f814d567df056a --- /dev/null +++ b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js @@ -0,0 +1,21 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +startRecordingFps: () => void; + +stopRecordingFps: (animationStopTimeMs: number) => void; +} + +export default (TurboModuleRegistry.get('AnimationsDebugModule'): ?Spec); diff --git a/Libraries/NativeModules/specs/NativeDevSettings.js b/Libraries/NativeModules/specs/NativeDevSettings.js new file mode 100644 index 00000000000000..ec0f9392e8c492 --- /dev/null +++ b/Libraries/NativeModules/specs/NativeDevSettings.js @@ -0,0 +1,28 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +reload: () => void; + +setHotLoadingEnabled: (isHotLoadingEnabled: boolean) => void; + +setIsDebuggingRemotely: (isDebuggingRemotelyEnabled: boolean) => void; + +setLiveReloadEnabled: (isLiveReloadEnabled: boolean) => void; + +setProfilingEnabled: (isProfilingEnabled: boolean) => void; + +toggleElementInspector: () => void; + + // iOS only. + +setIsShakeToShowDevMenuEnabled: (enabled: boolean) => void; +} + +export default (TurboModuleRegistry.getEnforcing('DevSettings'): Spec); diff --git a/Libraries/NativeModules/specs/NativeDeviceEventManager.js b/Libraries/NativeModules/specs/NativeDeviceEventManager.js new file mode 100644 index 00000000000000..342115dd0e478e --- /dev/null +++ b/Libraries/NativeModules/specs/NativeDeviceEventManager.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +invokeDefaultBackPressHandler: () => void; +} + +export default (TurboModuleRegistry.get('DeviceEventManager'): ?Spec); diff --git a/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js new file mode 100644 index 00000000000000..4ca12692fa1773 --- /dev/null +++ b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js @@ -0,0 +1,49 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +/* 'buttonClicked' | 'dismissed' */ +type DialogAction = string; +/* + buttonPositive = -1, + buttonNegative = -2, + buttonNeutral = -3 +*/ +type DialogButtonKey = number; +export type DialogOptions = {| + title?: string, + message?: string, + buttonPositive?: string, + buttonNegative?: string, + buttonNeutral?: string, + items?: Array, + cancelable?: boolean, +|}; + +export interface Spec extends TurboModule { + +getConstants: () => {| + +buttonClicked: DialogAction, + +dismissed: DialogAction, + +buttonPositive: DialogButtonKey, + +buttonNegative: DialogButtonKey, + +buttonNeutral: DialogButtonKey, + |}; + +showAlert: ( + config: DialogOptions, + onError: (error: string) => void, + onAction: (action: DialogAction, buttonKey?: DialogButtonKey) => void, + ) => void; +} + +export default (TurboModuleRegistry.get('DialogManagerAndroid'): ?Spec); diff --git a/Libraries/NativeModules/specs/NativeRedBox.js b/Libraries/NativeModules/specs/NativeRedBox.js new file mode 100644 index 00000000000000..e132b544345324 --- /dev/null +++ b/Libraries/NativeModules/specs/NativeRedBox.js @@ -0,0 +1,21 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +setExtraData: (extraData: Object, identifier: string) => void; + +dismiss: () => void; +} + +export default (TurboModuleRegistry.get('RedBox'): ?Spec); diff --git a/Libraries/NativeModules/specs/NativeSourceCode.js b/Libraries/NativeModules/specs/NativeSourceCode.js new file mode 100644 index 00000000000000..2ba94687afb6ea --- /dev/null +++ b/Libraries/NativeModules/specs/NativeSourceCode.js @@ -0,0 +1,22 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + scriptURL: string, + |}; +} + +export default (TurboModuleRegistry.getEnforcing('SourceCode'): Spec); diff --git a/Libraries/Network/NativeNetworkingAndroid.js b/Libraries/Network/NativeNetworkingAndroid.js new file mode 100644 index 00000000000000..573090d7d26ccd --- /dev/null +++ b/Libraries/Network/NativeNetworkingAndroid.js @@ -0,0 +1,38 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +type Header = [string, string]; + +export interface Spec extends TurboModule { + +sendRequest: ( + method: string, + url: string, + requestId: number, + headers: Array
, + data: Object, + responseType: Object, // TODO: Use stricter type. + useIncrementalUpdates: boolean, + timeout: number, + withCredentials: boolean, + ) => void; + +abortRequest: (requestId: number) => void; + +clearCookies: (callback: (result: boolean) => void) => void; + + // RCTEventEmitter + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.getEnforcing('Networking'): Spec); diff --git a/Libraries/Network/NativeNetworkingIOS.js b/Libraries/Network/NativeNetworkingIOS.js new file mode 100644 index 00000000000000..85a6cffbd22034 --- /dev/null +++ b/Libraries/Network/NativeNetworkingIOS.js @@ -0,0 +1,38 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +sendRequest: ( + query: {| + method: string, + url: string, + data: Object, + headers: Object, + responseType: Object, // TODO: Use stricter type. + incrementalUpdates: boolean, + timeout: number, + withCredentials: boolean, + |}, + callback: (requestId: number) => void, + ) => void; + +abortRequest: (requestId: number) => void; + +clearCookies: (callback: (result: boolean) => void) => void; + + // RCTEventEmitter + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.getEnforcing('Networking'): Spec); diff --git a/Libraries/Network/RCTDataRequestHandler.m b/Libraries/Network/RCTDataRequestHandler.m index 2a7c42c6a10bf1..5d72c52264a423 100644 --- a/Libraries/Network/RCTDataRequestHandler.m +++ b/Libraries/Network/RCTDataRequestHandler.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTDataRequestHandler.h" +#import @implementation RCTDataRequestHandler { diff --git a/Libraries/Network/RCTFileRequestHandler.m b/Libraries/Network/RCTFileRequestHandler.m index 77427ccc61effc..313ceb59790e3d 100644 --- a/Libraries/Network/RCTFileRequestHandler.m +++ b/Libraries/Network/RCTFileRequestHandler.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTFileRequestHandler.h" +#import #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) #import diff --git a/Libraries/Network/RCTHTTPRequestHandler.mm b/Libraries/Network/RCTHTTPRequestHandler.mm index 76131fa69f7797..e72e9437f60109 100644 --- a/Libraries/Network/RCTHTTPRequestHandler.mm +++ b/Libraries/Network/RCTHTTPRequestHandler.mm @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTHTTPRequestHandler.h" +#import #import -#import "RCTNetworking.h" +#import @interface RCTHTTPRequestHandler () @@ -29,12 +29,12 @@ @implementation RCTHTTPRequestHandler - (void)invalidate { - dispatch_async(self->_methodQueue, ^{ - [self->_session invalidateAndCancel]; - self->_session = nil; - }); + std::lock_guard lock(_mutex); + [self->_session invalidateAndCancel]; + self->_session = nil; } +// Needs to lock before call this method. - (BOOL)isValid { // if session == nil and delegates != nil, we've been invalidated @@ -58,6 +58,7 @@ - (BOOL)canHandleRequest:(NSURLRequest *)request - (NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request withDelegate:(id)delegate { + std::lock_guard lock(_mutex); // Lazy setup if (!_session && [self isValid]) { // You can override default NSURLSession instance property allowsCellularAccess (default value YES) @@ -83,19 +84,12 @@ - (NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request delegate:self delegateQueue:callbackQueue]; - std::lock_guard lock(_mutex); _delegates = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsStrongMemory capacity:0]; } - __block NSURLSessionDataTask *task = nil; - dispatch_sync(self->_methodQueue, ^{ - task = [self->_session dataTaskWithRequest:request]; - }); - { - std::lock_guard lock(_mutex); - [_delegates setObject:delegate forKey:task]; - } + NSURLSessionDataTask *task = [_session dataTaskWithRequest:request]; + [_delegates setObject:delegate forKey:task]; [task resume]; return task; } diff --git a/Libraries/Network/RCTNetInfo.m b/Libraries/Network/RCTNetInfo.m index f295c57dddb734..08ae677625d1df 100644 --- a/Libraries/Network/RCTNetInfo.m +++ b/Libraries/Network/RCTNetInfo.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTNetInfo.h" +#import -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif #import @@ -148,7 +148,7 @@ - (BOOL)setReachabilityStatus:(SCNetworkReachabilityFlags)flags status = RCTReachabilityStateNone; } -#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS ISS#2323203) +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_OSX else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { connectionType = RCTConnectionTypeCellular; diff --git a/Libraries/Network/RCTNetwork.xcodeproj/project.pbxproj b/Libraries/Network/RCTNetwork.xcodeproj/project.pbxproj deleted file mode 100644 index bce11b46fb2a1b..00000000000000 --- a/Libraries/Network/RCTNetwork.xcodeproj/project.pbxproj +++ /dev/null @@ -1,485 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 134E969A1BCEB7F800AFFDA1 /* RCTDataRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */; }; - 1372B7371AB03E7B00659ED6 /* RCTNetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */; }; - 13D6D66A1B5FCF8200883BE9 /* RCTNetworkTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */; }; - 13EF800E1BCBE015003F47DD /* RCTFileRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */; }; - 2D3B5F261D9B0EAB00451313 /* RCTNetworkTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */; }; - 2D3B5F271D9B0EB400451313 /* RCTHTTPRequestHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */; }; - 2D3B5F281D9B0EB400451313 /* RCTFileRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */; }; - 2D3B5F291D9B0EB400451313 /* RCTDataRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */; }; - 2D3B5F2A1D9B0EB400451313 /* RCTNetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */; }; - 2D3B5F2B1D9B0EB400451313 /* RCTNetworking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.mm */; }; - 352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */; }; - 58B512081A9E6CE300147676 /* RCTNetworking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.mm */; }; - 649BF6D820190E380068273E /* RCTHTTPRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */; }; - 649BF6D920190E3C0068273E /* RCTFileRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */; }; - 649BF6DA20190E3E0068273E /* RCTDataRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */; }; - 649BF6DD20190E690068273E /* RCTHTTPRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */; }; - 649BF6DE20190E6C0068273E /* RCTFileRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */; }; - 649BF6DF20190E6E0068273E /* RCTDataRequestHandler.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */; }; - 6BDE7A871ECB6E8400CC951F /* RCTNetworkTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */; }; - 6BDE7A881ECB6E8400CC951F /* RCTFileRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */; }; - 6BDE7A891ECB6E8400CC951F /* RCTDataRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */; }; - 6BDE7A8A1ECB6E8400CC951F /* RCTNetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */; }; - 6BDE7A8B1ECB6E8400CC951F /* RCTNetworking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.mm */; }; - 6BDE7A8C1ECB6E8400CC951F /* RCTHTTPRequestHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 649BF6D720190E260068273E /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTNetwork; - dstSubfolderSpec = 16; - files = ( - 649BF6D820190E380068273E /* RCTHTTPRequestHandler.h in CopyFiles */, - 649BF6D920190E3C0068273E /* RCTFileRequestHandler.h in CopyFiles */, - 649BF6DA20190E3E0068273E /* RCTDataRequestHandler.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 649BF6DC20190E4C0068273E /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTNetwork; - dstSubfolderSpec = 16; - files = ( - 649BF6DD20190E690068273E /* RCTHTTPRequestHandler.h in CopyFiles */, - 649BF6DE20190E6C0068273E /* RCTFileRequestHandler.h in CopyFiles */, - 649BF6DF20190E6E0068273E /* RCTDataRequestHandler.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDataRequestHandler.h; sourceTree = ""; }; - 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDataRequestHandler.m; sourceTree = ""; }; - 1372B7351AB03E7B00659ED6 /* RCTNetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNetInfo.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RCTNetInfo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 13D6D6681B5FCF8200883BE9 /* RCTNetworkTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNetworkTask.h; sourceTree = ""; }; - 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNetworkTask.m; sourceTree = ""; }; - 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTFileRequestHandler.h; sourceTree = ""; }; - 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFileRequestHandler.m; sourceTree = ""; }; - 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTNetwork-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHTTPRequestHandler.h; sourceTree = ""; }; - 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTHTTPRequestHandler.mm; sourceTree = ""; }; - 3D5FA63F1DE4B4790058FD77 /* RCTNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworking.h; sourceTree = ""; }; - 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTNetwork.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 58B512071A9E6CE300147676 /* RCTNetworking.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNetworking.mm; sourceTree = ""; }; - 6BDE7A901ECB6E8400CC951F /* libRCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTNetwork.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13D6D6681B5FCF8200883BE9 /* RCTNetworkTask.h */, - 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */, - 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */, - 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */, - 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */, - 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */, - 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */, - 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */, - 1372B7351AB03E7B00659ED6 /* RCTNetInfo.h */, - 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */, - 3D5FA63F1DE4B4790058FD77 /* RCTNetworking.h */, - 58B512071A9E6CE300147676 /* RCTNetworking.mm */, - 58B511DC1A9E6C8500147676 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B511DC1A9E6C8500147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */, - 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */, - 6BDE7A901ECB6E8400CC951F /* libRCTNetwork.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28531D9B044C00D4039D /* RCTNetwork-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A285C1D9B044C00D4039D /* Build configuration list for PBXNativeTarget "RCTNetwork-tvOS" */; - buildPhases = ( - 2D2A28501D9B044C00D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTNetwork-tvOS"; - productName = "RCTNetwork-tvOS"; - productReference = 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTNetwork */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTNetwork" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 649BF6DC20190E4C0068273E /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTNetwork; - productName = RCTDataManager; - productReference = 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */; - productType = "com.apple.product-type.library.static"; - }; - 6BDE7A851ECB6E8400CC951F /* RCTNetwork-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6BDE7A8D1ECB6E8400CC951F /* Build configuration list for PBXNativeTarget "RCTNetwork-macOS" */; - buildPhases = ( - 6BDE7A861ECB6E8400CC951F /* Sources */, - 649BF6D720190E260068273E /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTNetwork-macOS"; - productName = RCTDataManager; - productReference = 6BDE7A901ECB6E8400CC951F /* libRCTNetwork.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28531D9B044C00D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTNetwork" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511DC1A9E6C8500147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTNetwork */, - 6BDE7A851ECB6E8400CC951F /* RCTNetwork-macOS */, - 2D2A28531D9B044C00D4039D /* RCTNetwork-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28501D9B044C00D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F2A1D9B0EB400451313 /* RCTNetInfo.m in Sources */, - 2D3B5F261D9B0EAB00451313 /* RCTNetworkTask.m in Sources */, - 2D3B5F281D9B0EB400451313 /* RCTFileRequestHandler.m in Sources */, - 2D3B5F271D9B0EB400451313 /* RCTHTTPRequestHandler.mm in Sources */, - 2D3B5F2B1D9B0EB400451313 /* RCTNetworking.mm in Sources */, - 2D3B5F291D9B0EB400451313 /* RCTDataRequestHandler.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13D6D66A1B5FCF8200883BE9 /* RCTNetworkTask.m in Sources */, - 13EF800E1BCBE015003F47DD /* RCTFileRequestHandler.m in Sources */, - 134E969A1BCEB7F800AFFDA1 /* RCTDataRequestHandler.m in Sources */, - 1372B7371AB03E7B00659ED6 /* RCTNetInfo.m in Sources */, - 58B512081A9E6CE300147676 /* RCTNetworking.mm in Sources */, - 352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6BDE7A861ECB6E8400CC951F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6BDE7A871ECB6E8400CC951F /* RCTNetworkTask.m in Sources */, - 6BDE7A881ECB6E8400CC951F /* RCTFileRequestHandler.m in Sources */, - 6BDE7A891ECB6E8400CC951F /* RCTDataRequestHandler.m in Sources */, - 6BDE7A8A1ECB6E8400CC951F /* RCTNetInfo.m in Sources */, - 6BDE7A8B1ECB6E8400CC951F /* RCTNetworking.mm in Sources */, - 6BDE7A8C1ECB6E8400CC951F /* RCTHTTPRequestHandler.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A285A1D9B044C00D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A285B1D9B044C00D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - }; - name = Release; - }; - 6BDE7A8E1ECB6E8400CC951F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 6BDE7A8F1ECB6E8400CC951F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A285C1D9B044C00D4039D /* Build configuration list for PBXNativeTarget "RCTNetwork-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A285A1D9B044C00D4039D /* Debug */, - 2D2A285B1D9B044C00D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6BDE7A8D1ECB6E8400CC951F /* Build configuration list for PBXNativeTarget "RCTNetwork-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6BDE7A8E1ECB6E8400CC951F /* Debug */, - 6BDE7A8F1ECB6E8400CC951F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/Network/RCTNetworking.android.js b/Libraries/Network/RCTNetworking.android.js index 89435e2714cf9a..c809b8dcdd3a18 100644 --- a/Libraries/Network/RCTNetworking.android.js +++ b/Libraries/Network/RCTNetworking.android.js @@ -13,8 +13,7 @@ // Do not require the native RCTNetworking module directly! Use this wrapper module instead. // It will add the necessary requestId, so that you don't have to generate it yourself. const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); -const RCTNetworkingNative = require('../BatchedBridge/NativeModules') - .Networking; +import NativeNetworkingAndroid from './NativeNetworkingAndroid'; const convertRequestBody = require('./convertRequestBody'); import type {RequestBody} from './convertRequestBody'; @@ -42,7 +41,7 @@ function generateRequestId(): number { */ class RCTNetworking extends NativeEventEmitter { constructor() { - super(RCTNetworkingNative); + super(NativeNetworkingAndroid); } sendRequest( @@ -54,7 +53,7 @@ class RCTNetworking extends NativeEventEmitter { responseType: 'text' | 'base64', incrementalUpdates: boolean, timeout: number, - callback: (requestId: number) => any, + callback: (requestId: number) => mixed, withCredentials: boolean, ) { const body = convertRequestBody(data); @@ -65,7 +64,7 @@ class RCTNetworking extends NativeEventEmitter { })); } const requestId = generateRequestId(); - RCTNetworkingNative.sendRequest( + NativeNetworkingAndroid.sendRequest( method, url, requestId, @@ -80,11 +79,11 @@ class RCTNetworking extends NativeEventEmitter { } abortRequest(requestId: number) { - RCTNetworkingNative.abortRequest(requestId); + NativeNetworkingAndroid.abortRequest(requestId); } clearCookies(callback: (result: boolean) => any) { - RCTNetworkingNative.clearCookies(callback); + NativeNetworkingAndroid.clearCookies(callback); } } diff --git a/Libraries/Network/RCTNetworking.js b/Libraries/Network/RCTNetworking.js index 99b4c88fa2f800..7bf9af76709132 100644 --- a/Libraries/Network/RCTNetworking.js +++ b/Libraries/Network/RCTNetworking.js @@ -13,17 +13,16 @@ 'use strict'; const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); -const RCTNetworkingNative = require('../BatchedBridge/NativeModules') - .Networking; -const convertRequestBody = require('./convertRequestBody'); -import type {RequestBody} from './convertRequestBody'; +const convertRequestBody = require('./convertRequestBody'); +import NativeNetworkingIOS from './NativeNetworkingIOS'; import type {NativeResponseType} from './XMLHttpRequest'; +import type {RequestBody} from './convertRequestBody'; class RCTNetworking extends NativeEventEmitter { constructor() { - super(RCTNetworkingNative); + super(NativeNetworkingIOS); } sendRequest( @@ -35,11 +34,11 @@ class RCTNetworking extends NativeEventEmitter { responseType: NativeResponseType, incrementalUpdates: boolean, timeout: number, - callback: (requestId: number) => any, + callback: (requestId: number) => void, withCredentials: boolean, ) { const body = convertRequestBody(data); - RCTNetworkingNative.sendRequest( + NativeNetworkingIOS.sendRequest( { method, url, @@ -55,12 +54,12 @@ class RCTNetworking extends NativeEventEmitter { } abortRequest(requestId: number) { - RCTNetworkingNative.abortRequest(requestId); + NativeNetworkingIOS.abortRequest(requestId); } - clearCookies(callback: (result: boolean) => any) { - RCTNetworkingNative.clearCookies(callback); + clearCookies(callback: (result: boolean) => void) { + NativeNetworkingIOS.clearCookies(callback); } } -module.exports = new RCTNetworking(); +module.exports = (new RCTNetworking(): RCTNetworking); diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index a17d0d3de56d56..193e3c52796507 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -16,7 +16,7 @@ #import #import -#import "RCTHTTPRequestHandler.h" +#import typedef RCTURLRequestCancellationBlock (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result); diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index b63a97f6873cc7..5e29c9ea16230d 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -26,9 +26,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m,mm}" + s.source_files = "*.{m,mm}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTNetwork" - s.dependency "React-Core", version + s.dependency "React-Core/RCTNetworkHeaders", version end diff --git a/Libraries/Network/XMLHttpRequest.js b/Libraries/Network/XMLHttpRequest.js index f0f507cd873895..14e06222b684d8 100644 --- a/Libraries/Network/XMLHttpRequest.js +++ b/Libraries/Network/XMLHttpRequest.js @@ -10,13 +10,13 @@ 'use strict'; +const BlobManager = require('../Blob/BlobManager'); const EventTarget = require('event-target-shim'); const RCTNetworking = require('./RCTNetworking'); const base64 = require('base64-js'); const invariant = require('invariant'); const warning = require('fbjs/lib/warning'); -const BlobManager = require('../Blob/BlobManager'); export type NativeResponseType = 'base64' | 'blob' | 'text'; export type ResponseType = @@ -73,7 +73,7 @@ const REQUEST_EVENTS = [ const XHR_EVENTS = REQUEST_EVENTS.concat('readystatechange'); -class XMLHttpRequestEventTarget extends EventTarget(...REQUEST_EVENTS) { +class XMLHttpRequestEventTarget extends (EventTarget(...REQUEST_EVENTS): any) { onload: ?Function; onloadstart: ?Function; onprogress: ?Function; @@ -86,7 +86,7 @@ class XMLHttpRequestEventTarget extends EventTarget(...REQUEST_EVENTS) { /** * Shared base for platform-specific XMLHttpRequest implementations. */ -class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { +class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { static UNSENT: number = UNSENT; static OPENED: number = OPENED; static HEADERS_RECEIVED: number = HEADERS_RECEIVED; diff --git a/Libraries/Network/__tests__/XMLHttpRequest-test.js b/Libraries/Network/__tests__/XMLHttpRequest-test.js index bfe4be6aa0ce99..0e610763f427a8 100644 --- a/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -37,6 +37,11 @@ jest }, abortRequest: function() {}, }, + PlatformConstants: { + getConstants() { + return {}; + }, + }, }); const XMLHttpRequest = require('../XMLHttpRequest'); diff --git a/Libraries/Network/fetch.js b/Libraries/Network/fetch.js index 66687e70de2035..65a02b9ee4d428 100644 --- a/Libraries/Network/fetch.js +++ b/Libraries/Network/fetch.js @@ -11,10 +11,8 @@ 'use strict'; -const whatwg = require('whatwg-fetch'); +// side-effectful require() to put fetch, +// Headers, Request, Response in global scope +require('whatwg-fetch'); -if (whatwg && whatwg.fetch) { - module.exports = whatwg; -} else { - module.exports = {fetch, Headers, Request, Response}; -} +module.exports = {fetch, Headers, Request, Response}; diff --git a/Libraries/NewAppScreen/components/DebugInstructions.js b/Libraries/NewAppScreen/components/DebugInstructions.js index da690642e53088..7549235c01ef0b 100644 --- a/Libraries/NewAppScreen/components/DebugInstructions.js +++ b/Libraries/NewAppScreen/components/DebugInstructions.js @@ -8,8 +8,9 @@ * @format */ -import React from 'react'; +import type {Node} from 'react'; import {Platform, StyleSheet, Text} from 'react-native'; +import React from 'react'; const styles = StyleSheet.create({ highlight: { @@ -17,10 +18,10 @@ const styles = StyleSheet.create({ }, }); -const DebugInstructions = Platform.select({ +const DebugInstructions: () => Node = Platform.select({ ios: () => ( - Press Cmd+D in the simulator or{' '} + Press Cmd + D in the simulator or{' '} Shake your device to open the React Native debug menu. @@ -34,7 +35,7 @@ const DebugInstructions = Platform.select({ // ]TODO(macOS ISS#2323203) default: () => ( - Press menu button or{' '} + Press Cmd or Ctrl + M or{' '} Shake your device to open the React Native debug menu. diff --git a/Libraries/NewAppScreen/components/Header.js b/Libraries/NewAppScreen/components/Header.js index f1f5cf9f050fd4..06d01101f78658 100644 --- a/Libraries/NewAppScreen/components/Header.js +++ b/Libraries/NewAppScreen/components/Header.js @@ -9,12 +9,12 @@ */ 'use strict'; - -import React from 'react'; -import {Text, StyleSheet, ImageBackground} from 'react-native'; import Colors from './Colors'; +import type {Node} from 'react'; +import {Text, StyleSheet, ImageBackground} from 'react-native'; +import React from 'react'; -const Header = () => ( +const Header = (): Node => ( ( +const LinkList = (): Node => ( {links.map((item, index) => { return ( diff --git a/Libraries/NewAppScreen/components/ReloadInstructions.js b/Libraries/NewAppScreen/components/ReloadInstructions.js index 406ce6c00c762f..114335a4b531d3 100644 --- a/Libraries/NewAppScreen/components/ReloadInstructions.js +++ b/Libraries/NewAppScreen/components/ReloadInstructions.js @@ -8,8 +8,9 @@ * @format */ -import React from 'react'; +import type {Node} from 'react'; import {Platform, StyleSheet, Text} from 'react-native'; +import React from 'react'; const styles = StyleSheet.create({ highlight: { @@ -17,10 +18,10 @@ const styles = StyleSheet.create({ }, }); -const ReloadInstructions = Platform.select({ +const ReloadInstructions: () => Node = Platform.select({ ios: () => ( - Press Cmd+R in the simulator to + Press Cmd + R in the simulator to reload your app's code. ), diff --git a/Libraries/Performance/NativeJSCSamplingProfiler.js b/Libraries/Performance/NativeJSCSamplingProfiler.js new file mode 100644 index 00000000000000..a40e8e301520b8 --- /dev/null +++ b/Libraries/Performance/NativeJSCSamplingProfiler.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +operationComplete: (token: number, result: ?string, error: ?string) => void; +} + +export default (TurboModuleRegistry.get('JSCSamplingProfiler'): ?Spec); diff --git a/Libraries/Performance/QuickPerformanceLogger.js b/Libraries/Performance/QuickPerformanceLogger.js index 2fdafbb8481689..23ae5b30d25ed4 100644 --- a/Libraries/Performance/QuickPerformanceLogger.js +++ b/Libraries/Performance/QuickPerformanceLogger.js @@ -35,17 +35,6 @@ const QuickPerformanceLogger = { } }, - markerNote( - markerId: number, - actionId: number, - instanceKey: number = DUMMY_INSTANCE_KEY, - timestamp: number = AUTO_SET_TIMESTAMP, - ): void { - if (global.nativeQPLMarkerNote) { - global.nativeQPLMarkerNote(markerId, instanceKey, actionId, timestamp); - } - }, - markerTag( markerId: number, tag: string, diff --git a/Libraries/Performance/SamplingProfiler.js b/Libraries/Performance/SamplingProfiler.js index cce9cb9596b467..2808f83ebddaec 100644 --- a/Libraries/Performance/SamplingProfiler.js +++ b/Libraries/Performance/SamplingProfiler.js @@ -28,8 +28,11 @@ const SamplingProfiler = { error = e.toString(); } - const {JSCSamplingProfiler} = require('../BatchedBridge/NativeModules'); - JSCSamplingProfiler.operationComplete(token, result, error); + const NativeJSCSamplingProfiler = require('./NativeJSCSamplingProfiler') + .default; + if (NativeJSCSamplingProfiler) { + NativeJSCSamplingProfiler.operationComplete(token, result, error); + } }, }; diff --git a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js new file mode 100644 index 00000000000000..685cb56be00e6d --- /dev/null +++ b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js @@ -0,0 +1,59 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +// TODO: Use proper enum types. +export type PermissionStatus = string; +export type PermissionType = string; +/* +export type PermissionStatus = 'granted' | 'denied' | 'never_ask_again'; +export type PermissionType = + | 'android.permission.READ_CALENDAR' + | 'android.permission.WRITE_CALENDAR' + | 'android.permission.CAMERA' + | 'android.permission.READ_CONTACTS' + | 'android.permission.WRITE_CONTACTS' + | 'android.permission.GET_ACCOUNTS' + | 'android.permission.ACCESS_FINE_LOCATION' + | 'android.permission.ACCESS_COARSE_LOCATION' + | 'android.permission.RECORD_AUDIO' + | 'android.permission.READ_PHONE_STATE' + | 'android.permission.CALL_PHONE' + | 'android.permission.READ_CALL_LOG' + | 'android.permission.WRITE_CALL_LOG' + | 'com.android.voicemail.permission.ADD_VOICEMAIL' + | 'android.permission.USE_SIP' + | 'android.permission.PROCESS_OUTGOING_CALLS' + | 'android.permission.BODY_SENSORS' + | 'android.permission.SEND_SMS' + | 'android.permission.RECEIVE_SMS' + | 'android.permission.READ_SMS' + | 'android.permission.RECEIVE_WAP_PUSH' + | 'android.permission.RECEIVE_MMS' + | 'android.permission.READ_EXTERNAL_STORAGE' + | 'android.permission.WRITE_EXTERNAL_STORAGE'; +*/ + +export interface Spec extends TurboModule { + +checkPermission: (permission: PermissionType) => Promise; + +requestPermission: (permission: PermissionType) => Promise; + +shouldShowRequestPermissionRationale: ( + permission: string, + ) => Promise; + +requestMultiplePermissions: ( + permissions: Array, + ) => Promise<{[permission: PermissionType]: PermissionStatus}>; +} + +export default (TurboModuleRegistry.get('PermissionsAndroid'): ?Spec); diff --git a/Libraries/PermissionsAndroid/PermissionsAndroid.js b/Libraries/PermissionsAndroid/PermissionsAndroid.js index ae35e07cac6073..9ba1624c62b852 100644 --- a/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -10,7 +10,15 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +const Platform = require('../Utilities/Platform'); + +import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManagerAndroid'; +import NativePermissionsAndroid from './NativePermissionsAndroid'; +import type { + PermissionStatus, + PermissionType, +} from './NativePermissionsAndroid'; +import invariant from 'invariant'; export type Rationale = { title: string, @@ -20,7 +28,39 @@ export type Rationale = { buttonNeutral?: string, }; -type PermissionStatus = 'granted' | 'denied' | 'never_ask_again'; +const PERMISSION_REQUEST_RESULT = Object.freeze({ + GRANTED: 'granted', + DENIED: 'denied', + NEVER_ASK_AGAIN: 'never_ask_again', +}); + +const PERMISSIONS = Object.freeze({ + READ_CALENDAR: 'android.permission.READ_CALENDAR', + WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR', + CAMERA: 'android.permission.CAMERA', + READ_CONTACTS: 'android.permission.READ_CONTACTS', + WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS', + GET_ACCOUNTS: 'android.permission.GET_ACCOUNTS', + ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION', + ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION', + RECORD_AUDIO: 'android.permission.RECORD_AUDIO', + READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE', + CALL_PHONE: 'android.permission.CALL_PHONE', + READ_CALL_LOG: 'android.permission.READ_CALL_LOG', + WRITE_CALL_LOG: 'android.permission.WRITE_CALL_LOG', + ADD_VOICEMAIL: 'com.android.voicemail.permission.ADD_VOICEMAIL', + USE_SIP: 'android.permission.USE_SIP', + PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS', + BODY_SENSORS: 'android.permission.BODY_SENSORS', + SEND_SMS: 'android.permission.SEND_SMS', + RECEIVE_SMS: 'android.permission.RECEIVE_SMS', + READ_SMS: 'android.permission.READ_SMS', + RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH', + RECEIVE_MMS: 'android.permission.RECEIVE_MMS', + READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE', + WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE', +}); + /** * `PermissionsAndroid` provides access to Android M's new permissions model. * @@ -28,46 +68,37 @@ type PermissionStatus = 'granted' | 'denied' | 'never_ask_again'; */ class PermissionsAndroid { - PERMISSIONS: Object; - RESULTS: Object; - - constructor() { - /** - * A list of specified "dangerous" permissions that require prompting the user - */ - this.PERMISSIONS = { - READ_CALENDAR: 'android.permission.READ_CALENDAR', - WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR', - CAMERA: 'android.permission.CAMERA', - READ_CONTACTS: 'android.permission.READ_CONTACTS', - WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS', - GET_ACCOUNTS: 'android.permission.GET_ACCOUNTS', - ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION', - ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION', - RECORD_AUDIO: 'android.permission.RECORD_AUDIO', - READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE', - CALL_PHONE: 'android.permission.CALL_PHONE', - READ_CALL_LOG: 'android.permission.READ_CALL_LOG', - WRITE_CALL_LOG: 'android.permission.WRITE_CALL_LOG', - ADD_VOICEMAIL: 'com.android.voicemail.permission.ADD_VOICEMAIL', - USE_SIP: 'android.permission.USE_SIP', - PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS', - BODY_SENSORS: 'android.permission.BODY_SENSORS', - SEND_SMS: 'android.permission.SEND_SMS', - RECEIVE_SMS: 'android.permission.RECEIVE_SMS', - READ_SMS: 'android.permission.READ_SMS', - RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH', - RECEIVE_MMS: 'android.permission.RECEIVE_MMS', - READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE', - WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE', - }; - - this.RESULTS = { - GRANTED: 'granted', - DENIED: 'denied', - NEVER_ASK_AGAIN: 'never_ask_again', - }; - } + PERMISSIONS: {| + ACCESS_COARSE_LOCATION: string, + ACCESS_FINE_LOCATION: string, + ADD_VOICEMAIL: string, + BODY_SENSORS: string, + CALL_PHONE: string, + CAMERA: string, + GET_ACCOUNTS: string, + PROCESS_OUTGOING_CALLS: string, + READ_CALENDAR: string, + READ_CALL_LOG: string, + READ_CONTACTS: string, + READ_EXTERNAL_STORAGE: string, + READ_PHONE_STATE: string, + READ_SMS: string, + RECEIVE_MMS: string, + RECEIVE_SMS: string, + RECEIVE_WAP_PUSH: string, + RECORD_AUDIO: string, + SEND_SMS: string, + USE_SIP: string, + WRITE_CALENDAR: string, + WRITE_CALL_LOG: string, + WRITE_CONTACTS: string, + WRITE_EXTERNAL_STORAGE: string, + |} = PERMISSIONS; + RESULTS: {| + DENIED: $TEMPORARY$string<'denied'>, + GRANTED: $TEMPORARY$string<'granted'>, + NEVER_ASK_AGAIN: $TEMPORARY$string<'never_ask_again'>, + |} = PERMISSION_REQUEST_RESULT; /** * DEPRECATED - use check @@ -77,11 +108,23 @@ class PermissionsAndroid { * * @deprecated */ - checkPermission(permission: string): Promise { + checkPermission(permission: PermissionType): Promise { console.warn( '"PermissionsAndroid.checkPermission" is deprecated. Use "PermissionsAndroid.check" instead', ); - return NativeModules.PermissionsAndroid.checkPermission(permission); + if (Platform.OS !== 'android') { + console.warn( + '"PermissionsAndroid" module works only for Android platform.', + ); + return Promise.resolve(false); + } + + invariant( + NativePermissionsAndroid, + 'PermissionsAndroid is not installed correctly.', + ); + + return NativePermissionsAndroid.checkPermission(permission); } /** @@ -90,8 +133,20 @@ class PermissionsAndroid { * * See https://facebook.github.io/react-native/docs/permissionsandroid.html#check */ - check(permission: string): Promise { - return NativeModules.PermissionsAndroid.checkPermission(permission); + check(permission: PermissionType): Promise { + if (Platform.OS !== 'android') { + console.warn( + '"PermissionsAndroid" module works only for Android platform.', + ); + return Promise.resolve(false); + } + + invariant( + NativePermissionsAndroid, + 'PermissionsAndroid is not installed correctly.', + ); + + return NativePermissionsAndroid.checkPermission(permission); } /** @@ -109,12 +164,19 @@ class PermissionsAndroid { * @deprecated */ async requestPermission( - permission: string, + permission: PermissionType, rationale?: Rationale, ): Promise { console.warn( '"PermissionsAndroid.requestPermission" is deprecated. Use "PermissionsAndroid.request" instead', ); + if (Platform.OS !== 'android') { + console.warn( + '"PermissionsAndroid" module works only for Android platform.', + ); + return Promise.resolve(false); + } + const response = await this.request(permission, rationale); return response === this.RESULTS.GRANTED; } @@ -126,28 +188,41 @@ class PermissionsAndroid { * See https://facebook.github.io/react-native/docs/permissionsandroid.html#request */ async request( - permission: string, + permission: PermissionType, rationale?: Rationale, ): Promise { + if (Platform.OS !== 'android') { + console.warn( + '"PermissionsAndroid" module works only for Android platform.', + ); + return Promise.resolve(this.RESULTS.DENIED); + } + + invariant( + NativePermissionsAndroid, + 'PermissionsAndroid is not installed correctly.', + ); + if (rationale) { - const shouldShowRationale = await NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale( + const shouldShowRationale = await NativePermissionsAndroid.shouldShowRequestPermissionRationale( permission, ); - if (shouldShowRationale) { + if (shouldShowRationale && !!NativeDialogManagerAndroid) { return new Promise((resolve, reject) => { - NativeModules.DialogManagerAndroid.showAlert( - rationale, + const options = { + ...rationale, + }; + NativeDialogManagerAndroid.showAlert( + options, () => reject(new Error('Error showing rationale')), () => - resolve( - NativeModules.PermissionsAndroid.requestPermission(permission), - ), + resolve(NativePermissionsAndroid.requestPermission(permission)), ); }); } } - return NativeModules.PermissionsAndroid.requestPermission(permission); + return NativePermissionsAndroid.requestPermission(permission); } /** @@ -158,11 +233,21 @@ class PermissionsAndroid { * See https://facebook.github.io/react-native/docs/permissionsandroid.html#requestmultiple */ requestMultiple( - permissions: Array, - ): Promise<{[permission: string]: PermissionStatus}> { - return NativeModules.PermissionsAndroid.requestMultiplePermissions( - permissions, + permissions: Array, + ): Promise<{[permission: PermissionType]: PermissionStatus}> { + if (Platform.OS !== 'android') { + console.warn( + '"PermissionsAndroid" module works only for Android platform.', + ); + return Promise.resolve({}); + } + + invariant( + NativePermissionsAndroid, + 'PermissionsAndroid is not installed correctly.', ); + + return NativePermissionsAndroid.requestMultiplePermissions(permissions); } } diff --git a/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js new file mode 100644 index 00000000000000..8eb5095163681c --- /dev/null +++ b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js @@ -0,0 +1,74 @@ +/** + * 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. + * + * @format + * @flow + */ + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +type Permissions = {| + alert: boolean, + badge: boolean, + sound: boolean, +|}; + +type Notification = {| + +alertTitle?: ?string, + // Actual type: string | number + +fireDate?: ?number, + +alertBody?: ?string, + +alertAction?: ?string, + +userInfo?: ?Object, + +category?: ?string, + // Actual type: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' + +repeatInterval?: ?string, + +applicationIconBadgeNumber?: ?number, + +isSilent?: ?boolean, +|}; + +export interface Spec extends TurboModule { + +getConstants: () => {}; + +onFinishRemoteNotification: ( + notificationId: string, + /** + * Type: + * 'UIBackgroundFetchResultNewData' | + * 'UIBackgroundFetchResultNoData' | + * 'UIBackgroundFetchResultFailed' + */ + fetchResult: string, + ) => void; + +setApplicationIconBadgeNumber: (num: number) => void; + +getApplicationIconBadgeNumber: (callback: (num: number) => void) => void; + +requestPermissions: (permission: {| + +alert?: ?boolean, + +badge?: ?boolean, + +sound?: ?boolean, + |}) => Promise; + +abandonPermissions: () => void; + +checkPermissions: (callback: (permissions: Permissions) => void) => void; + +presentLocalNotification: (notification: Notification) => void; + +scheduleLocalNotification: (notification: Notification) => void; + +cancelAllLocalNotifications: () => void; + +cancelLocalNotifications: (userInfo: Object) => void; + +getInitialNotification: () => Promise; + +getScheduledLocalNotifications: ( + callback: (notification: Notification) => void, + ) => void; + +removeAllDeliveredNotifications: () => void; + +removeDeliveredNotifications: (identifiers: Array) => void; + +getDeliveredNotifications: ( + callback: (notification: Array) => void, + ) => void; + +addListener: (eventType: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get( + 'PushNotificationManager', +): ?Spec); diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index bd3e39db32ed5e..8a2a67332aab4b 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -11,13 +11,12 @@ 'use strict'; const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); -const Platform = require('../Utilities/Platform'); // TODO(macOS ISS#2323203) -const RCTPushNotificationManager = require('../BatchedBridge/NativeModules') - .PushNotificationManager; +import {Platform} from 'react-native'; // TODO(macOS ISS#2323203) +import NativePushNotificationManagerIOS from './NativePushNotificationManagerIOS'; const invariant = require('invariant'); const PushNotificationEmitter = new NativeEventEmitter( - RCTPushNotificationManager, + NativePushNotificationManagerIOS, ); const _notifHandlers = new Map(); @@ -93,7 +92,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#presentlocalnotification */ static presentLocalNotification(details: Object) { - RCTPushNotificationManager.presentLocalNotification(details); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.presentLocalNotification(details); } /** @@ -102,7 +105,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#schedulelocalnotification */ static scheduleLocalNotification(details: Object) { - RCTPushNotificationManager.scheduleLocalNotification(details); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.scheduleLocalNotification(details); } /** @@ -111,7 +118,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#cancelalllocalnotifications */ static cancelAllLocalNotifications() { - RCTPushNotificationManager.cancelAllLocalNotifications(); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.cancelAllLocalNotifications(); } /** @@ -120,7 +131,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#removealldeliverednotifications */ static removeAllDeliveredNotifications(): void { - RCTPushNotificationManager.removeAllDeliveredNotifications(); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.removeAllDeliveredNotifications(); } /** @@ -131,7 +146,11 @@ class PushNotificationIOS { static getDeliveredNotifications( callback: (notifications: Array) => void, ): void { - RCTPushNotificationManager.getDeliveredNotifications(callback); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.getDeliveredNotifications(callback); } /** @@ -140,7 +159,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#removedeliverednotifications */ static removeDeliveredNotifications(identifiers: Array): void { - RCTPushNotificationManager.removeDeliveredNotifications(identifiers); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.removeDeliveredNotifications(identifiers); } /** @@ -149,7 +172,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#setapplicationiconbadgenumber */ static setApplicationIconBadgeNumber(number: number) { - RCTPushNotificationManager.setApplicationIconBadgeNumber(number); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.setApplicationIconBadgeNumber(number); } /** @@ -158,7 +185,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getapplicationiconbadgenumber */ static getApplicationIconBadgeNumber(callback: Function) { - RCTPushNotificationManager.getApplicationIconBadgeNumber(callback); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.getApplicationIconBadgeNumber(callback); } /** @@ -167,7 +198,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#cancellocalnotification */ static cancelLocalNotifications(userInfo: Object) { - RCTPushNotificationManager.cancelLocalNotifications(userInfo); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.cancelLocalNotifications(userInfo); } /** @@ -176,7 +211,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getscheduledlocalnotifications */ static getScheduledLocalNotifications(callback: Function) { - RCTPushNotificationManager.getScheduledLocalNotifications(callback); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.getScheduledLocalNotifications(callback); } /** @@ -282,7 +321,13 @@ class PushNotificationIOS { sound: true, }; } - return RCTPushNotificationManager.requestPermissions(requestedPermissions); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + return NativePushNotificationManagerIOS.requestPermissions( + requestedPermissions, + ); } /** @@ -291,7 +336,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#abandonpermissions */ static abandonPermissions() { - RCTPushNotificationManager.abandonPermissions(); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.abandonPermissions(); } /** @@ -302,7 +351,11 @@ class PushNotificationIOS { */ static checkPermissions(callback: Function) { invariant(typeof callback === 'function', 'Must provide a valid callback'); - RCTPushNotificationManager.checkPermissions(callback); + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.checkPermissions(callback); } /** @@ -312,7 +365,11 @@ class PushNotificationIOS { * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getinitialnotification */ static getInitialNotification(): Promise { - return RCTPushNotificationManager.getInitialNotification().then( + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + return NativePushNotificationManagerIOS.getInitialNotification().then( notification => { return notification && new PushNotificationIOS(notification); }, @@ -376,7 +433,11 @@ class PushNotificationIOS { } this._remoteNotificationCompleteCallbackCalled = true; - RCTPushNotificationManager.onFinishRemoteNotification( + invariant( + NativePushNotificationManagerIOS, + 'PushNotificationManager is not available.', + ); + NativePushNotificationManagerIOS.onFinishRemoteNotification( this._notificationId, fetchResult, ); diff --git a/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj b/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj deleted file mode 100644 index d029211d319dac..00000000000000 --- a/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj +++ /dev/null @@ -1,464 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; }; - 3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; }; - 6424F7A61F669A3A0025D741 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 3D05745D1DE6004600184BB4 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6424F7A81F669A3A0025D741 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushNotification.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPushNotificationManager.h; sourceTree = ""; }; - 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushNotificationManager.m; sourceTree = ""; }; - 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTPushNotification-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6424F7AC1F669A3A0025D741 /* libRCTPushNotification-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTPushNotification-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 3D05745C1DE6004600184BB4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6424F7A71F669A3A0025D741 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */, - 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */, - 6424F7AC1F669A3A0025D741 /* libRCTPushNotification-macOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D0574671DE6004600184BB4 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */; - buildPhases = ( - 3D05745B1DE6004600184BB4 /* Sources */, - 3D05745C1DE6004600184BB4 /* Frameworks */, - 3D05745D1DE6004600184BB4 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTPushNotification-tvOS"; - productName = "RCTPushNotification-tvOS"; - productReference = 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTPushNotification */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTPushNotification; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */; - productType = "com.apple.product-type.library.static"; - }; - 6424F7A41F669A3A0025D741 /* RCTPushNotification-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6424F7A91F669A3A0025D741 /* Build configuration list for PBXNativeTarget "RCTPushNotification-macOS" */; - buildPhases = ( - 6424F7A51F669A3A0025D741 /* Sources */, - 6424F7A71F669A3A0025D741 /* Frameworks */, - 6424F7A81F669A3A0025D741 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTPushNotification-macOS"; - productName = RCTDataManager; - productReference = 6424F7AC1F669A3A0025D741 /* libRCTPushNotification-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 3D05745E1DE6004600184BB4 = { - CreatedOnToolsVersion = 8.1; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTPushNotification */, - 3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */, - 6424F7A41F669A3A0025D741 /* RCTPushNotification-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 3D05745B1DE6004600184BB4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6424F7A51F669A3A0025D741 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6424F7A61F669A3A0025D741 /* RCTPushNotificationManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 3D0574651DE6004600184BB4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 3D0574661DE6004600184BB4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTPushNotification; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTPushNotification; - }; - name = Release; - }; - 6424F7AA1F669A3A0025D741 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 6424F7AB1F669A3A0025D741 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3D0574671DE6004600184BB4 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D0574651DE6004600184BB4 /* Debug */, - 3D0574661DE6004600184BB4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6424F7A91F669A3A0025D741 /* Build configuration list for PBXNativeTarget "RCTPushNotification-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6424F7AA1F669A3A0025D741 /* Debug */, - 6424F7AB1F669A3A0025D741 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index 5af7626d67cfc6..bf3a23b03db98f 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -11,14 +11,14 @@ extern NSString *const RCTRemoteNotificationReceived; @interface RCTPushNotificationManager : RCTEventEmitter -#if !TARGET_OS_OSX // [TODO(macOS ISS#2323203) +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -#endif // ]TODO(macOS ISS#2323203) +#endif // TODO(macOS ISS#2323203) -#if !TARGET_OS_TV -#if !TARGET_OS_OSX // [TODO(macOS ISS#2323203) +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; -#endif // ]TODO(macOS ISS#2323203) +#endif // TODO(macOS ISS#2323203) + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; + (void)didReceiveRemoteNotification:(NSDictionary *)notification; #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.m b/Libraries/PushNotificationIOS/RCTPushNotificationManager.m index 53b10c430a7bbc..796cd6faf2e5eb 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.m +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTPushNotificationManager.h" +#import #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) #import @@ -25,7 +25,7 @@ static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS"; -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC @implementation RCTConvert (NSCalendarUnit) RCT_ENUM_CONVERTER(NSCalendarUnit, @@ -117,14 +117,14 @@ + (NSUserNotification *)NSUserNotification:(id)json #endif // TODO(macOS ISS#2323203) @end -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC @implementation RCTPushNotificationManager { RCTPromiseResolveBlock _requestPermissionsResolveBlock; } -#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS ISS#2323203) +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC && !TARGET_OS_OSX static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -168,7 +168,7 @@ @implementation RCTPushNotificationManager return formattedNotification; } -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) static NSDictionary *RCTFormatUserNotification(NSUserNotification *notification) @@ -197,7 +197,7 @@ - (dispatch_queue_t)methodQueue return dispatch_get_main_queue(); } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC - (void)startObserving { [[NSNotificationCenter defaultCenter] addObserver:self @@ -673,13 +673,13 @@ - (void)handleRegisterUserNotificationSettings:(NSNotification *)notification #endif // ]TODO(macOS ISS#2323203) } -#else //TARGET_OS_TV +#else //TARGET_OS_TV / TARGET_OS_UIKITFORMAC - (NSArray *)supportedEvents { return @[]; } -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC @end diff --git a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec index 993505505f0916..2ff1341b900f3b 100644 --- a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +++ b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec @@ -27,9 +27,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTPushNotification" - s.dependency "React-Core", version + s.dependency "React-Core/RCTPushNotificationHeaders", version end diff --git a/Libraries/RCTRequired/BUCK b/Libraries/RCTRequired/BUCK new file mode 100644 index 00000000000000..e1cab5cee394e0 --- /dev/null +++ b/Libraries/RCTRequired/BUCK @@ -0,0 +1,8 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "fb_apple_library") + +fb_apple_library( + name = "RCTRequired", + autoglob = True, + contacts = ["oncall+react_native@xmail.facebook.com"], + frameworks = ["Foundation"], +) diff --git a/React/React-DevSupport.podspec b/Libraries/RCTRequired/RCTRequired.podspec similarity index 74% rename from React/React-DevSupport.podspec rename to Libraries/RCTRequired/RCTRequired.podspec index 2e5a8b02745862..95b1a9e0d0558a 100644 --- a/React/React-DevSupport.podspec +++ b/Libraries/RCTRequired/RCTRequired.podspec @@ -6,7 +6,7 @@ require "json" -package = JSON.parse(File.read(File.join(__dir__, "..", "package.json"))) +package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) version = package['version'] source = { :git => 'https://github.com/facebook/react-native.git' } @@ -18,7 +18,7 @@ else end Pod::Spec.new do |s| - s.name = "React-DevSupport" + s.name = "RCTRequired" s.version = version s.summary = "-" # TODO s.homepage = "http://facebook.github.io/react-native/" @@ -26,10 +26,6 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "DevSupport/*", - "Inspector/*" - s.header_dir = "React" - - s.dependency "React-Core", version - s.dependency "React-RCTWebSocket", version + s.source_files = "**/*.{c,h,m,mm,cpp}" + s.header_dir = "RCTRequired" end diff --git a/Libraries/RCTRequired/RCTRequired/RCTRequired.h b/Libraries/RCTRequired/RCTRequired/RCTRequired.h new file mode 100644 index 00000000000000..798769512e6e18 --- /dev/null +++ b/Libraries/RCTRequired/RCTRequired/RCTRequired.h @@ -0,0 +1,77 @@ +/** + * 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. + */ + +#include + +// The inliner doesn't take into account ARC optimizations that may occur after +// inlining when computing the inline cost of an ObjC++ function. Here we make +// the inlining decisions to avoid unnecessary code bloat. In effect RCTRequired +// is a cost-free abstraction in non-DEBUG mode. In DEBUG mode we don't force +// inlining for ease of debugging. +#if DEBUG +#define RCTREQUIRED_INLINE inline +#else +#define RCTREQUIRED_INLINE __attribute__((always_inline)) inline +#endif + +/** + RCTRequired uses the compiler to enforce definition of a struct member (primitives, pointers, or objects). + + Internally, we use an implicit constructor without a default, so there has to be an initial value. + + Usage: + @code + struct S { + RCTRequired i; + RCTRequired str; + NSString *optionalStr; + }; + + S options = { + .i = 0, // warning if omitted + .str = @"Hello World", // warning if omitted + }; + @endcode + */ +template +struct RCTRequired { + /// Pass-through constructor (allows for implicit conversion) for wrapped type T + template + RCTREQUIRED_INLINE + RCTRequired(Args&&... args): _t(std::forward(args)...) { + static_assert(sizeof...(Args) > 0, "Required struct member not initialized. Expand assert trace to see where this was triggered."); + } + + RCTREQUIRED_INLINE + RCTRequired(const RCTRequired&) = default; + RCTREQUIRED_INLINE + RCTRequired(RCTRequired&&) = default; + + RCTREQUIRED_INLINE + RCTRequired& operator=(const RCTRequired&) = default; + RCTREQUIRED_INLINE + RCTRequired& operator=(RCTRequired&&) = default; + + RCTREQUIRED_INLINE + ~RCTRequired() = default; + + /// Public accessor for private storage (Use when implicit conversion is impracticable) + RCTREQUIRED_INLINE + const T &get() const { return _t; } + RCTREQUIRED_INLINE + T &get() { return _t; } + + + // Implicit conversion + RCTREQUIRED_INLINE + operator T() const { return _t; } + RCTREQUIRED_INLINE + operator T&() { return _t; } + +private: + T _t; +}; diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index 8e83050154702b..39d3374a864a1d 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -15,6 +15,7 @@ const PropTypes = require('prop-types'); const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); const React = require('react'); const ReactNative = require('../Renderer/shims/ReactNative'); +const RootTagContext = require('./RootTagContext'); const StyleSheet = require('../StyleSheet/StyleSheet'); const View = require('../Components/View/View'); @@ -41,7 +42,9 @@ class AppContainer extends React.Component { _mainRef: ?React.ElementRef; _subscription: ?EmitterSubscription = null; - static childContextTypes = { + static childContextTypes: + | any + | $TEMPORARY$object<{|rootTag: React$PropType$Primitive|}> = { rootTag: PropTypes.number, }; @@ -112,11 +115,13 @@ class AppContainer extends React.Component { innerView = {innerView}; } return ( - - {innerView} - {yellowBox} - {this.state.inspector} - + + + {innerView} + {yellowBox} + {this.state.inspector} + + ); } } diff --git a/Libraries/ReactNative/AppRegistry.js b/Libraries/ReactNative/AppRegistry.js index 3fa755e3d98490..683bfd565c188c 100644 --- a/Libraries/ReactNative/AppRegistry.js +++ b/Libraries/ReactNative/AppRegistry.js @@ -11,7 +11,6 @@ const BatchedBridge = require('../BatchedBridge/BatchedBridge'); const BugReporting = require('../BugReporting/BugReporting'); -const NativeModules = require('../BatchedBridge/NativeModules'); const ReactNative = require('../Renderer/shims/ReactNative'); const SceneTracker = require('../Utilities/SceneTracker'); @@ -21,6 +20,9 @@ const renderApplication = require('./renderApplication'); const createPerformanceLogger = require('../Utilities/createPerformanceLogger'); import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger'; +import NativeHeadlessJsTaskSupport from './NativeHeadlessJsTaskSupport'; +import HeadlessJsTaskError from './HeadlessJsTaskError'; + type Task = (taskData: any) => Promise; type TaskProvider = () => Task; type TaskCanceller = () => void; @@ -177,17 +179,7 @@ const AppRegistry = { */ runApplication(appKey: string, appParameters: any): void { const msg = - 'Running application "' + - appKey + - '" with appParams: ' + - JSON.stringify(appParameters) + - '. ' + - '__DEV__ === ' + - String(__DEV__) + - ', development-level warning are ' + - (__DEV__ ? 'ON' : 'OFF') + - ', performance optimizations are ' + - (__DEV__ ? 'OFF' : 'ON'); + 'Running "' + appKey + '" with ' + JSON.stringify(appParameters); infoLog(msg); BugReporting.addSource( 'AppRegistry.runApplication' + runCount++, @@ -195,18 +187,10 @@ const AppRegistry = { ); invariant( runnables[appKey] && runnables[appKey].run, - 'Application ' + - appKey + - ' has not been registered.\n\n' + - "Hint: This error often happens when you're running the packager " + - '(local dev server) from a wrong folder. For example you have ' + - 'multiple apps and the packager is still running for the app you ' + - 'were working on before.\nIf this is the case, simply kill the old ' + - 'packager instance (e.g. close the packager terminal window) ' + - 'and start the packager in the correct app folder (e.g. cd into app ' + - "folder and run 'npm start').\n\n" + - 'This error can also happen due to a require() error during ' + - 'initialization or failure to call AppRegistry.registerComponent.\n\n', + `"${appKey}" has not been registered. This can happen if:\n` + + '* Metro (the local dev server) is run from the wrong folder. ' + + 'Check if Metro is running, stop it and restart it in the current project.\n' + + "* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.", ); SceneTracker.setActiveScene({name: appKey}); @@ -261,16 +245,32 @@ const AppRegistry = { const taskProvider = taskProviders.get(taskKey); if (!taskProvider) { console.warn(`No task registered for key ${taskKey}`); - NativeModules.HeadlessJsTaskSupport.notifyTaskFinished(taskId); + if (NativeHeadlessJsTaskSupport) { + NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId); + } return; } taskProvider()(data) - .then(() => - NativeModules.HeadlessJsTaskSupport.notifyTaskFinished(taskId), - ) + .then(() => { + if (NativeHeadlessJsTaskSupport) { + NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId); + } + }) .catch(reason => { console.error(reason); - NativeModules.HeadlessJsTaskSupport.notifyTaskFinished(taskId); + + if ( + NativeHeadlessJsTaskSupport && + reason instanceof HeadlessJsTaskError + ) { + NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then( + retryPosted => { + if (!retryPosted) { + NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId); + } + }, + ); + } }); }, diff --git a/Libraries/ReactNative/DummyUIManager.js b/Libraries/ReactNative/DummyUIManager.js new file mode 100644 index 00000000000000..fb2a774b916fd9 --- /dev/null +++ b/Libraries/ReactNative/DummyUIManager.js @@ -0,0 +1,119 @@ +/** + * 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. + * + * @flow + * @format + */ +'use strict'; + +module.exports = { + getViewManagerConfig: (viewManagerName: string): null => { + console.warn( + 'Attempting to get config for view manager: ' + viewManagerName, + ); + return null; + }, + getConstants: (): $TEMPORARY$object<{||}> => ({}), + getConstantsForViewManager: (viewManagerName: string) => {}, + getDefaultEventTypes: (): Array<$FlowFixMe> => [], + playTouchSound: () => {}, + lazilyLoadView: (name: string) => {}, + createView: ( + reactTag: ?number, + viewName: string, + rootTag: number, + props: Object, + ) => {}, + updateView: (reactTag: number, viewName: string, props: Object) => {}, + focus: (reactTag: ?number) => {}, + blur: (reactTag: ?number) => {}, + findSubviewIn: ( + reactTag: ?number, + point: Array, + callback: ( + nativeViewTag: number, + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => {}, + dispatchViewManagerCommand: ( + reactTag: ?number, + commandID: number, + commandArgs: ?Array, + ) => {}, + measure: ( + reactTag: ?number, + callback: ( + left: number, + top: number, + width: number, + height: number, + pageX: number, + pageY: number, + ) => void, + ) => {}, + measureInWindow: ( + reactTag: ?number, + callback: (x: number, y: number, width: number, height: number) => void, + ) => {}, + viewIsDescendantOf: ( + reactTag: ?number, + ancestorReactTag: ?number, + callback: (result: Array) => void, + ) => {}, + measureLayout: ( + reactTag: ?number, + ancestorReactTag: ?number, + errorCallback: (error: Object) => void, + callback: ( + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => {}, + measureLayoutRelativeToParent: ( + reactTag: ?number, + errorCallback: (error: Object) => void, + callback: ( + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => {}, + setJSResponder: (reactTag: ?number, blockNativeResponder: boolean) => {}, + clearJSResponder: () => {}, + configureNextLayoutAnimation: ( + config: Object, + callback: () => void, + errorCallback: (error: Object) => void, + ) => {}, + removeSubviewsFromContainerWithID: (containerID: number) => {}, + replaceExistingNonRootView: (reactTag: ?number, newReactTag: ?number) => {}, + setChildren: (containerTag: ?number, reactTags: Array) => {}, + manageChildren: ( + containerTag: ?number, + moveFromIndices: Array, + moveToIndices: Array, + addChildReactTags: Array, + addAtIndices: Array, + removeAtIndices: Array, + ) => {}, + + // Android only + setLayoutAnimationEnabledExperimental: (enabled: boolean) => {}, + sendAccessibilityEvent: (reactTag: ?number, eventType: number) => {}, + showPopupMenu: ( + reactTag: ?number, + items: Array, + error: (error: Object) => void, + success: (event: string, selected?: number) => void, + ) => {}, + dismissPopupMenu: () => {}, +}; diff --git a/Libraries/CameraRoll/__mocks__/CameraRoll.js b/Libraries/ReactNative/HeadlessJsTaskError.js similarity index 79% rename from Libraries/CameraRoll/__mocks__/CameraRoll.js rename to Libraries/ReactNative/HeadlessJsTaskError.js index 5094bdc7290099..0f85e138bb5a5f 100644 --- a/Libraries/CameraRoll/__mocks__/CameraRoll.js +++ b/Libraries/ReactNative/HeadlessJsTaskError.js @@ -9,6 +9,4 @@ */ 'use strict'; -const CameraRoll = {}; - -export default CameraRoll; +export default class HeadlessJsTaskError extends Error {} diff --git a/Libraries/ReactNative/I18nManager.js b/Libraries/ReactNative/I18nManager.js index da2767a842068f..94133b1dd1f421 100644 --- a/Libraries/ReactNative/I18nManager.js +++ b/Libraries/ReactNative/I18nManager.js @@ -9,21 +9,47 @@ */ 'use strict'; -type I18nManagerStatus = { - isRTL: boolean, +import NativeI18nManager from './NativeI18nManager'; + +const i18nConstants: {| doLeftAndRightSwapInRTL: boolean, - allowRTL: (allowRTL: boolean) => {}, - forceRTL: (forceRTL: boolean) => {}, - swapLeftAndRightInRTL: (flipStyles: boolean) => {}, -}; + isRTL: boolean, +|} = NativeI18nManager + ? NativeI18nManager.getConstants() + : { + isRTL: false, + doLeftAndRightSwapInRTL: true, + }; -const I18nManager: I18nManagerStatus = require('../BatchedBridge/NativeModules') - .I18nManager || { - isRTL: false, - doLeftAndRightSwapInRTL: true, - allowRTL: () => {}, - forceRTL: () => {}, - swapLeftAndRightInRTL: () => {}, -}; +module.exports = { + getConstants: (): {|doLeftAndRightSwapInRTL: boolean, isRTL: boolean|} => { + return i18nConstants; + }, + + allowRTL: (shouldAllow: boolean) => { + if (!NativeI18nManager) { + return; + } -module.exports = I18nManager; + NativeI18nManager.allowRTL(shouldAllow); + }, + + forceRTL: (shouldForce: boolean) => { + if (!NativeI18nManager) { + return; + } + + NativeI18nManager.forceRTL(shouldForce); + }, + + swapLeftAndRightInRTL: (flipStyles: boolean) => { + if (!NativeI18nManager) { + return; + } + + NativeI18nManager.swapLeftAndRightInRTL(flipStyles); + }, + + isRTL: i18nConstants.isRTL, + doLeftAndRightSwapInRTL: i18nConstants.doLeftAndRightSwapInRTL, +}; diff --git a/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js new file mode 100644 index 00000000000000..290957fd7f2414 --- /dev/null +++ b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js @@ -0,0 +1,21 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +notifyTaskFinished: (taskId: number) => void; + +notifyTaskRetry: (taskId: number) => Promise; +} + +export default (TurboModuleRegistry.get('HeadlessJsTaskSupport'): ?Spec); diff --git a/Libraries/ReactNative/NativeI18nManager.js b/Libraries/ReactNative/NativeI18nManager.js new file mode 100644 index 00000000000000..afaab21dfce13f --- /dev/null +++ b/Libraries/ReactNative/NativeI18nManager.js @@ -0,0 +1,26 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + isRTL: boolean, + doLeftAndRightSwapInRTL: boolean, + |}; + allowRTL: (allowRTL: boolean) => void; + forceRTL: (forceRTL: boolean) => void; + swapLeftAndRightInRTL: (flipStyles: boolean) => void; +} + +export default (TurboModuleRegistry.get('I18nManager'): ?Spec); diff --git a/Libraries/ReactNative/NativeUIManager.js b/Libraries/ReactNative/NativeUIManager.js new file mode 100644 index 00000000000000..717e63dbc12282 --- /dev/null +++ b/Libraries/ReactNative/NativeUIManager.js @@ -0,0 +1,122 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => Object; + +getConstantsForViewManager: (viewManagerName: string) => Object; + +getDefaultEventTypes: () => Array; + +playTouchSound: () => void; + +lazilyLoadView: (name: string) => Object; // revisit return + +createView: ( + reactTag: ?number, + viewName: string, + rootTag: number, + props: Object, + ) => void; + +updateView: (reactTag: number, viewName: string, props: Object) => void; + +focus: (reactTag: ?number) => void; + +blur: (reactTag: ?number) => void; + +findSubviewIn: ( + reactTag: ?number, + point: Array, + callback: ( + nativeViewTag: number, + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => void; + +dispatchViewManagerCommand: ( + reactTag: ?number, + commandID: number, + commandArgs: ?Array, + ) => void; + +measure: ( + reactTag: ?number, + callback: ( + left: number, + top: number, + width: number, + height: number, + pageX: number, + pageY: number, + ) => void, + ) => void; + +measureInWindow: ( + reactTag: ?number, + callback: (x: number, y: number, width: number, height: number) => void, + ) => void; + +viewIsDescendantOf: ( + reactTag: ?number, + ancestorReactTag: ?number, + callback: (result: Array) => void, + ) => void; + +measureLayout: ( + reactTag: ?number, + ancestorReactTag: ?number, + errorCallback: (error: Object) => void, + callback: ( + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => void; + +measureLayoutRelativeToParent: ( + reactTag: ?number, + errorCallback: (error: Object) => void, + callback: ( + left: number, + top: number, + width: number, + height: number, + ) => void, + ) => void; + +setJSResponder: (reactTag: ?number, blockNativeResponder: boolean) => void; + +clearJSResponder: () => void; + +configureNextLayoutAnimation: ( + config: Object, + callback: () => void, // check what is returned here + errorCallback: (error: Object) => void, + ) => void; + +removeSubviewsFromContainerWithID: (containerID: number) => void; + +replaceExistingNonRootView: ( + reactTag: ?number, + newReactTag: ?number, + ) => void; + +setChildren: (containerTag: ?number, reactTags: Array) => void; + +manageChildren: ( + containerTag: ?number, + moveFromIndices: Array, + moveToIndices: Array, + addChildReactTags: Array, + addAtIndices: Array, + removeAtIndices: Array, + ) => void; + + // Android only + +setLayoutAnimationEnabledExperimental: (enabled: boolean) => void; + +sendAccessibilityEvent: (reactTag: ?number, eventType: number) => void; + +showPopupMenu: ( + reactTag: ?number, + items: Array, + error: (error: Object) => void, + success: (event: string, selected?: number) => void, + ) => void; + +dismissPopupMenu: () => void; +} + +export default (TurboModuleRegistry.getEnforcing('UIManager'): Spec); diff --git a/Libraries/ReactNative/PaperUIManager.js b/Libraries/ReactNative/PaperUIManager.js new file mode 100644 index 00000000000000..7110cd3da11065 --- /dev/null +++ b/Libraries/ReactNative/PaperUIManager.js @@ -0,0 +1,163 @@ +/** + * 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. + * + * @flow + * @format + */ +'use strict'; + +const NativeModules = require('../BatchedBridge/NativeModules'); +const Platform = require('../Utilities/Platform'); +const UIManagerProperties = require('./UIManagerProperties'); + +const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty'); + +import NativeUIManager from './NativeUIManager'; + +const viewManagerConfigs = {}; + +const triedLoadingConfig = new Set(); + +let NativeUIManagerConstants = {}; +let isNativeUIManagerConstantsSet = false; +function getConstants(): Object { + if (!isNativeUIManagerConstantsSet) { + NativeUIManagerConstants = NativeUIManager.getConstants(); + isNativeUIManagerConstantsSet = true; + } + return NativeUIManagerConstants; +} + +const UIManagerJS = { + ...NativeUIManager, + getConstants(): Object { + return getConstants(); + }, + getViewManagerConfig: function(viewManagerName: string): any { + if ( + viewManagerConfigs[viewManagerName] === undefined && + NativeUIManager.getConstantsForViewManager + ) { + try { + viewManagerConfigs[ + viewManagerName + ] = NativeUIManager.getConstantsForViewManager(viewManagerName); + } catch (e) { + viewManagerConfigs[viewManagerName] = null; + } + } + + const config = viewManagerConfigs[viewManagerName]; + if (config) { + return config; + } + + // If we're in the Chrome Debugger, let's not even try calling the sync + // method. + if (!global.nativeCallSyncHook) { + return config; + } + + if ( + NativeUIManager.lazilyLoadView && + !triedLoadingConfig.has(viewManagerName) + ) { + const result = NativeUIManager.lazilyLoadView(viewManagerName); + triedLoadingConfig.add(viewManagerName); + if (result.viewConfig) { + getConstants()[viewManagerName] = result.viewConfig; + lazifyViewManagerConfig(viewManagerName); + } + } + + return viewManagerConfigs[viewManagerName]; + }, +}; + +// TODO (T45220498): Remove this. +// 3rd party libs may be calling `NativeModules.UIManager.getViewManagerConfig()` +// instead of `UIManager.getViewManagerConfig()` off UIManager.js. +// This is a workaround for now. +// $FlowFixMe +NativeUIManager.getViewManagerConfig = UIManagerJS.getViewManagerConfig; + +function lazifyViewManagerConfig(viewName) { + const viewConfig = getConstants()[viewName]; + viewManagerConfigs[viewName] = viewConfig; + if (viewConfig.Manager) { + defineLazyObjectProperty(viewConfig, 'Constants', { + get: () => { + const viewManager = NativeModules[viewConfig.Manager]; + const constants = {}; + viewManager && + Object.keys(viewManager).forEach(key => { + const value = viewManager[key]; + if (typeof value !== 'function') { + constants[key] = value; + } + }); + return constants; + }, + }); + defineLazyObjectProperty(viewConfig, 'Commands', { + get: () => { + const viewManager = NativeModules[viewConfig.Manager]; + const commands = {}; + let index = 0; + viewManager && + Object.keys(viewManager).forEach(key => { + const value = viewManager[key]; + if (typeof value === 'function') { + commands[key] = index++; + } + }); + return commands; + }, + }); + } +} + +/** + * Copies the ViewManager constants and commands into UIManager. This is + * only needed for iOS, which puts the constants in the ViewManager + * namespace instead of UIManager, unlike Android. + */ +if ( + Platform.OS === 'ios' || + Platform.OS === 'macos' /* TODO(macOS ISS#2323203) */ +) { + Object.keys(getConstants()).forEach(viewName => { + lazifyViewManagerConfig(viewName); + }); +} else if (getConstants().ViewManagerNames) { + NativeUIManager.getConstants().ViewManagerNames.forEach(viewManagerName => { + defineLazyObjectProperty(NativeUIManager, viewManagerName, { + get: () => NativeUIManager.getConstantsForViewManager(viewManagerName), + }); + }); +} + +if (!global.nativeCallSyncHook) { + Object.keys(getConstants()).forEach(viewManagerName => { + if (!UIManagerProperties.includes(viewManagerName)) { + if (!viewManagerConfigs[viewManagerName]) { + viewManagerConfigs[viewManagerName] = getConstants()[viewManagerName]; + } + defineLazyObjectProperty(NativeUIManager, viewManagerName, { + get: () => { + console.warn( + `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` + + `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`, + ); + + return UIManagerJS.getViewManagerConfig(viewManagerName); + }, + }); + } + }); +} + +module.exports = UIManagerJS; diff --git a/Libraries/ReactNative/RootTagContext.js b/Libraries/ReactNative/RootTagContext.js new file mode 100644 index 00000000000000..ca5ed03932fd5c --- /dev/null +++ b/Libraries/ReactNative/RootTagContext.js @@ -0,0 +1,15 @@ +/** + * 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. + * + * @flow strict + * @format + */ + +'use strict'; + +const React = require('react'); + +module.exports = (React.createContext(0): React$Context); diff --git a/Libraries/ReactNative/UIManager.js b/Libraries/ReactNative/UIManager.js index 756fab360dd8d1..15a74e2bef0310 100644 --- a/Libraries/ReactNative/UIManager.js +++ b/Libraries/ReactNative/UIManager.js @@ -4,159 +4,36 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow * @format */ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); -const Platform = require('../Utilities/Platform'); -const UIManagerProperties = require('./UIManagerProperties'); - -const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty'); -const invariant = require('invariant'); - -const {UIManager} = NativeModules; -const viewManagerConfigs = {}; - -invariant( - UIManager, - 'UIManager is undefined. The native module config is probably incorrect.', -); - -const triedLoadingConfig = new Set(); -UIManager.getViewManagerConfig = function(viewManagerName: string) { - if ( - viewManagerConfigs[viewManagerName] === undefined && - UIManager.getConstantsForViewManager - ) { - try { - viewManagerConfigs[ - viewManagerName - ] = UIManager.getConstantsForViewManager(viewManagerName); - } catch (e) { - viewManagerConfigs[viewManagerName] = null; - } - } - - const config = viewManagerConfigs[viewManagerName]; - if (config) { - return config; - } - - // If we're in the Chrome Debugger, let's not even try calling the sync - // method. - if (!global.nativeCallSyncHook) { - return config; - } - - if (UIManager.lazilyLoadView && !triedLoadingConfig.has(viewManagerName)) { - const result = UIManager.lazilyLoadView(viewManagerName); - triedLoadingConfig.add(viewManagerName); - if (result.viewConfig) { - UIManager[viewManagerName] = result.viewConfig; - lazifyViewManagerConfig(viewManagerName); - } - } - - return viewManagerConfigs[viewManagerName]; -}; - -function lazifyViewManagerConfig(viewName) { - const viewConfig = UIManager[viewName]; - if (viewConfig.Manager) { - viewManagerConfigs[viewName] = viewConfig; - defineLazyObjectProperty(viewConfig, 'Constants', { - get: () => { - const viewManager = NativeModules[viewConfig.Manager]; - const constants = {}; - viewManager && - Object.keys(viewManager).forEach(key => { - const value = viewManager[key]; - if (typeof value !== 'function') { - constants[key] = value; - } - }); - return constants; - }, - }); - defineLazyObjectProperty(viewConfig, 'Commands', { - get: () => { - const viewManager = NativeModules[viewConfig.Manager]; - const commands = {}; - let index = 0; - viewManager && - Object.keys(viewManager).forEach(key => { - const value = viewManager[key]; - if (typeof value === 'function') { - commands[key] = index++; - } - }); - return commands; - }, - }); - } +import type {Spec} from './NativeUIManager'; + +interface UIManagerJSInterface extends Spec { + +getViewManagerConfig: (viewManagerName: string) => Object; + // The following are not marked read-only due to logic in UIManagerStatTracker. + createView: ( + reactTag: ?number, + viewName: string, + rootTag: number, + props: Object, + ) => void; + updateView: (reactTag: number, viewName: string, props: Object) => void; + manageChildren: ( + containerTag: ?number, + moveFromIndices: Array, + moveToIndices: Array, + addChildReactTags: Array, + addAtIndices: Array, + removeAtIndices: Array, + ) => void; } -/** - * Copies the ViewManager constants and commands into UIManager. This is - * only needed for iOS, which puts the constants in the ViewManager - * namespace instead of UIManager, unlike Android. - */ -if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS ISS#2323203) */ -) { - Object.keys(UIManager).forEach(viewName => { - lazifyViewManagerConfig(viewName); - }); -} else if (UIManager.ViewManagerNames) { - // We want to add all the view managers to the UIManager. - // However, the way things are set up, the list of view managers is not known at compile time. - // As Prepack runs at compile it, it cannot process this loop. - // So we wrap it in a special __residual call, which basically tells Prepack to ignore it. - let residual = global.__residual - ? global.__residual - : (_, f, ...args) => f.apply(undefined, args); - residual( - 'void', - (UIManager, defineLazyObjectProperty) => { - UIManager.ViewManagerNames.forEach(viewManagerName => { - defineLazyObjectProperty(UIManager, viewManagerName, { - get: () => UIManager.getConstantsForViewManager(viewManagerName), - }); - }); - }, - UIManager, - defineLazyObjectProperty, - ); - - // As Prepack now no longer knows which properties exactly the UIManager has, - // we also tell Prepack that it has only partial knowledge of the UIManager, - // so that any accesses to unknown properties along the global code will fail - // when Prepack encounters them. - if (global.__makePartial) { - global.__makePartial(UIManager); - } -} - -if (!global.nativeCallSyncHook) { - Object.keys(UIManager).forEach(viewManagerName => { - if (!UIManagerProperties.includes(viewManagerName)) { - if (!viewManagerConfigs[viewManagerName]) { - viewManagerConfigs[viewManagerName] = UIManager[viewManagerName]; - } - defineLazyObjectProperty(UIManager, viewManagerName, { - get: () => { - console.warn( - `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` + - `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`, - ); - return UIManager.getViewManagerConfig(viewManagerName); - }, - }); - } - }); -} +const UIManager: UIManagerJSInterface = + global.RN$Bridgeless === true + ? require('./DummyUIManager') // No UIManager in bridgeless mode + : require('./PaperUIManager'); module.exports = UIManager; diff --git a/Libraries/ReactNative/UIManagerStatTracker.js b/Libraries/ReactNative/UIManagerStatTracker.js index ec1494c53b4390..85aaa6ba7707a7 100644 --- a/Libraries/ReactNative/UIManagerStatTracker.js +++ b/Libraries/ReactNative/UIManagerStatTracker.js @@ -52,8 +52,8 @@ const UIManagerStatTracker = { remove, ) { incStat('manageChildren', 1); - incStat('move', Object.keys(moveFrom || []).length); - incStat('remove', Object.keys(remove || []).length); + incStat('move', moveFrom.length); + incStat('remove', remove.length); manageChildrenOrig(tag, moveFrom, moveTo, addTags, addIndices, remove); }; }, diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 3be8755373c424..226e3ba9342b42 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -14,16 +14,16 @@ const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleA const UIManager = require('./UIManager'); const insetsDiffer = require('../Utilities/differ/insetsDiffer'); +const invariant = require('invariant'); const matricesDiffer = require('../Utilities/differ/matricesDiffer'); const pointsDiffer = require('../Utilities/differ/pointsDiffer'); const processColor = require('../StyleSheet/processColor'); +const processColorArray = require('../StyleSheet/processColorArray'); const resolveAssetSource = require('../Image/resolveAssetSource'); const sizesDiffer = require('../Utilities/differ/sizesDiffer'); -const invariant = require('invariant'); const warning = require('fbjs/lib/warning'); -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) -function getNativeComponentAttributes(uiViewClassName: string) { +function getNativeComponentAttributes(uiViewClassName: string): any { const viewConfig = UIManager.getViewManagerConfig(uiViewClassName); invariant( @@ -97,17 +97,18 @@ function attachDefaultEventTypes(viewConfig: any) { // This is supported on UIManager platforms (ex: Android), // as lazy view managers are not implemented for all platforms. // See [UIManager] for details on constants and implementations. - if (UIManager.ViewManagerNames || UIManager.LazyViewManagersEnabled) { + const constants = UIManager.getConstants(); + if (constants.ViewManagerNames || constants.LazyViewManagersEnabled) { // Lazy view managers enabled. viewConfig = merge(viewConfig, UIManager.getDefaultEventTypes()); } else { viewConfig.bubblingEventTypes = merge( viewConfig.bubblingEventTypes, - UIManager.genericBubblingEventTypes, + constants.genericBubblingEventTypes, ); viewConfig.directEventTypes = merge( viewConfig.directEventTypes, - UIManager.genericDirectEventTypes, + constants.genericDirectEventTypes, ); } } @@ -182,11 +183,4 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any { return null; } -function processColorArray( - colors: ?Array, -): ?Array /* TODO(macOS ISS#2323203) */ { - // ]TODO(macOS ISS#2323203) - return colors == null ? null : colors.map(processColor); -} - module.exports = getNativeComponentAttributes; diff --git a/Libraries/ReactNative/renderApplication.js b/Libraries/ReactNative/renderApplication.js index ce7f6878002b4b..72a2e27e66d1d7 100644 --- a/Libraries/ReactNative/renderApplication.js +++ b/Libraries/ReactNative/renderApplication.js @@ -33,7 +33,7 @@ function renderApplication( ) { invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag); - let renderable = ( + const renderable = ( @@ -45,21 +45,6 @@ function renderApplication( ); - // If the root component is async, the user probably wants the initial render - // to be async also. To do this, wrap AppContainer with an async marker. - // For more info see https://fb.me/is-component-async - if ( - /* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.68 was deployed. To see the error delete this - * comment and run Flow. */ - RootComponent.prototype != null && - RootComponent.prototype.unstable_isAsyncReactComponent === true - ) { - // $FlowFixMe This is not yet part of the official public API - const ConcurrentMode = React.unstable_ConcurrentMode; - renderable = {renderable}; - } - GlobalPerformanceLogger.startTimespan('renderApplication_React_render'); if (fabric) { require('../Renderer/shims/ReactFabric').render(renderable, rootTag); diff --git a/lib/README b/Libraries/ReactPrivate/README similarity index 53% rename from lib/README rename to Libraries/ReactPrivate/README index b5273d4970123e..afda34a704367d 100644 --- a/lib/README +++ b/Libraries/ReactPrivate/README @@ -1 +1 @@ -JS modules in this folder are forwarding modules to allow React to require React Native internals as node dependencies. +JS modules in this folder are forwarding modules to allow React to require React Native internals. diff --git a/Libraries/react-native/React.js b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js similarity index 78% rename from Libraries/react-native/React.js rename to Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js index ac9f5d1bcec4a7..e34e6271f2f7fe 100644 --- a/Libraries/react-native/React.js +++ b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js @@ -5,8 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow strict-local */ -'use strict'; - -module.exports = require('react'); +import '../Core/InitializeCore'; diff --git a/Libraries/ReactPrivate/ReactNativePrivateInterface.js b/Libraries/ReactPrivate/ReactNativePrivateInterface.js new file mode 100644 index 00000000000000..82634a69998231 --- /dev/null +++ b/Libraries/ReactPrivate/ReactNativePrivateInterface.js @@ -0,0 +1,46 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +// flowlint unsafe-getters-setters:off +module.exports = { + get BatchedBridge() { + return require('../BatchedBridge/BatchedBridge.js'); + }, + get ExceptionsManager() { + return require('../Core/ExceptionsManager'); + }, + get Platform() { + return require('../Utilities/Platform'); + }, + get RCTEventEmitter() { + return require('../EventEmitter/RCTEventEmitter'); + }, + get ReactNativeViewConfigRegistry() { + return require('../Renderer/shims/ReactNativeViewConfigRegistry'); + }, + get TextInputState() { + return require('../Components/TextInput/TextInputState'); + }, + get UIManager() { + return require('../ReactNative/UIManager'); + }, + get deepDiffer() { + return require('../Utilities/differ/deepDiffer'); + }, + get deepFreezeAndThrowOnMutationInDev() { + return require('../Utilities/deepFreezeAndThrowOnMutationInDev'); + }, + get flattenStyle() { + return require('../StyleSheet/flattenStyle'); + }, + get ReactFiberErrorDialog() { + return require('../Core/ReactFiberErrorDialog'); + }, +}; diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index 6ee6fe16ed4c59..9febf0f4c87833 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -ec6691a68716bc59291746fc62f374a56fb435c9 +85d05b3a4d439c504ee43652d586ee253a01faf6 diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js new file mode 100644 index 00000000000000..9593291b531ac9 --- /dev/null +++ b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -0,0 +1,23496 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +'use strict'; + +if (__DEV__) { + (function() { +"use strict"; + +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"); +var React = require("react"); +var Scheduler = require("scheduler"); +var checkPropTypes = require("prop-types/checkPropTypes"); +var tracing = require("scheduler/tracing"); + +// Do not require this module directly! Use normal `invariant` calls with +// template literal strings. The messages will be converted to ReactError during +// build, and in production they will be minified. + +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} + +/** + * 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. + */ + +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; + +/** + * Injectable mapping from names to event plugin modules. + */ +var namesToPlugins = {}; + +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + (function() { + if (!(pluginIndex > -1)) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + } + })(); + if (plugins[pluginIndex]) { + continue; + } + (function() { + if (!pluginModule.extractEvents) { + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + } + })(); + plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + for (var eventName in publishedEvents) { + (function() { + if ( + !publishEventForPlugin( + publishedEvents[eventName], + pluginModule, + eventName + ) + ) { + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + })(); + } + } +} + +/** + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private + */ +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + (function() { + if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName + + "`." + ) + ); + } + })(); + eventNameDispatchConfigs[eventName] = dispatchConfig; + + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName( + phasedRegistrationName, + pluginModule, + eventName + ); + } + } + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName( + dispatchConfig.registrationName, + pluginModule, + eventName + ); + return true; + } + return false; +} + +/** + * Publishes a registration name that is used to identify dispatched events. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private + */ +function publishRegistrationName(registrationName, pluginModule, eventName) { + (function() { + if (!!registrationNameModules[registrationName]) { + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + } + })(); + registrationNameModules[registrationName] = pluginModule; + registrationNameDependencies[registrationName] = + pluginModule.eventTypes[eventName].dependencies; + + { + var lowerCasedName = registrationName.toLowerCase(); + } +} + +/** + * Registers plugins so that they can extract and dispatch events. + * + * @see {EventPluginHub} + */ + +/** + * Ordered list of injected plugins. + */ +var plugins = []; + +/** + * Mapping from event name to dispatch config + */ +var eventNameDispatchConfigs = {}; + +/** + * Mapping from registration name to plugin module + */ +var registrationNameModules = {}; + +/** + * Mapping from registration name to event name + */ +var registrationNameDependencies = {}; + +/** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in true. + * @type {Object} + */ + +// Trust the developer to only use possibleRegistrationNames in true + +/** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + * @see {EventPluginHub.injection.injectEventPluginOrder} + */ +function injectEventPluginOrder(injectedEventPluginOrder) { + (function() { + if (!!eventPluginOrder) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + } + })(); + // Clone the ordering so it cannot be dynamically mutated. + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); +} + +/** + * Injects plugins to be used by `EventPluginHub`. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. + * + * Plugins can be injected as part of page initialization or on-the-fly. + * + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + * @see {EventPluginHub.injection.injectEventPluginsByName} + */ +function injectEventPluginsByName(injectedNamesToPlugins) { + var isOrderingDirty = false; + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + (function() { + if (!!namesToPlugins[pluginName]) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + } + })(); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; + } + } + if (isOrderingDirty) { + recomputePluginOrdering(); + } +} + +var invokeGuardedCallbackImpl = function( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +}; + +{ + // 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 + // "Pause on exceptions" behavior. Because React wraps all user-provided + // functions in invokeGuardedCallback, and the production version of + // invokeGuardedCallback uses a try-catch, all user exceptions are treated + // like caught exceptions, and the DevTools won't pause unless the developer + // takes the extra step of enabling pause on caught exceptions. This is + // unintuitive, though, because even though React has caught the error, from + // the developer's perspective, the error is uncaught. + // + // To preserve the expected "Pause on exceptions" behavior, we don't use a + // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake + // DOM node, and call the user-provided callback from inside an event handler + // for that fake event. If the callback throws, the error is "captured" using + // a global event handler. But because the error happens in a different + // event loop context, it does not interrupt the normal program flow. + // Effectively, this gives us try-catch behavior without actually using + // try-catch. Neat! + + // Check that the browser supports the APIs we need to implement our special + // DEV version of invokeGuardedCallback + if ( + typeof window !== "undefined" && + typeof window.dispatchEvent === "function" && + typeof document !== "undefined" && + typeof document.createEvent === "function" + ) { + var fakeNode = document.createElement("react"); + + var invokeGuardedCallbackDev = function( + name, + func, + context, + a, + b, + c, + d, + e, + f + ) { + // If document doesn't exist we know for sure we will crash in this method + // when we call document.createEvent(). However this can cause confusing + // errors: https://github.com/facebookincubator/create-react-app/issues/3482 + // So we preemptively throw with a better message instead. + (function() { + if (!(typeof document !== "undefined")) { + throw ReactError( + Error( + "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + ) + ); + } + })(); + var evt = document.createEvent("Event"); + + // Keeps track of whether the user-provided callback threw an error. We + // set this to true at the beginning, then set it to false right after + // calling the function. If the function errors, `didError` will never be + // set to false. This strategy works even if the browser is flaky and + // fails to call our global error handler, because it doesn't rely on + // the error event at all. + var didError = true; + + // Keeps track of the value of window.event so that we can reset it + // during the callback to let user code access window.event in the + // browsers that support it. + var windowEvent = window.event; + + // Keeps track of the descriptor of window.event to restore it after event + // dispatching: https://github.com/facebook/react/issues/13688 + var windowEventDescriptor = Object.getOwnPropertyDescriptor( + window, + "event" + ); + + // Create an event handler for our fake event. We will synchronously + // dispatch our fake event using `dispatchEvent`. Inside the handler, we + // call the user-provided callback. + var funcArgs = Array.prototype.slice.call(arguments, 3); + function callCallback() { + // We immediately remove the callback from event listeners so that + // nested `invokeGuardedCallback` calls do not clash. Otherwise, a + // nested call would trigger the fake event handlers of any call higher + // in the stack. + fakeNode.removeEventListener(evtType, callCallback, false); + + // We check for window.hasOwnProperty('event') to prevent the + // window.event assignment in both IE <= 10 as they throw an error + // "Member not found" in strict mode, and in Firefox which does not + // support window.event. + if ( + typeof window.event !== "undefined" && + window.hasOwnProperty("event") + ) { + window.event = windowEvent; + } + + func.apply(context, funcArgs); + didError = false; + } + + // Create a global error event handler. We use this to capture the value + // that was thrown. It's possible that this error handler will fire more + // than once; for example, if non-React code also calls `dispatchEvent` + // and a handler for that event throws. We should be resilient to most of + // those cases. Even if our error event handler fires more than once, the + // last error event is always used. If the callback actually does error, + // we know that the last error event is the correct one, because it's not + // possible for anything else to have happened in between our callback + // erroring and the code that follows the `dispatchEvent` call below. If + // the callback doesn't error, but the error event was fired, we know to + // ignore it because `didError` will be false, as described above. + var error = void 0; + // Use this to track whether the error event is ever called. + var didSetError = false; + var isCrossOriginError = false; + + function handleWindowError(event) { + error = event.error; + didSetError = true; + if (error === null && event.colno === 0 && event.lineno === 0) { + isCrossOriginError = true; + } + if (event.defaultPrevented) { + // Some other error handler has prevented default. + // Browsers silence the error report if this happens. + // We'll remember this to later decide whether to log it or not. + if (error != null && typeof error === "object") { + try { + error._suppressLogging = true; + } catch (inner) { + // Ignore. + } + } + } + } + + // Create a fake event type. + var evtType = "react-" + (name ? name : "invokeguardedcallback"); + + // Attach our event handlers + window.addEventListener("error", handleWindowError); + fakeNode.addEventListener(evtType, callCallback, false); + + // Synchronously dispatch our fake event. If the user-provided function + // errors, it will trigger our global error handler. + evt.initEvent(evtType, false, false); + fakeNode.dispatchEvent(evt); + + if (windowEventDescriptor) { + Object.defineProperty(window, "event", windowEventDescriptor); + } + + if (didError) { + if (!didSetError) { + // The callback errored, but the error event never fired. + error = new Error( + "An error was thrown inside one of your components, but React " + + "doesn't know what it was. This is likely due to browser " + + 'flakiness. React does its best to preserve the "Pause on ' + + 'exceptions" behavior of the DevTools, which requires some ' + + "DEV-mode only tricks. It's possible that these don't work in " + + "your browser. Try triggering the error in production mode, " + + "or switching to a modern browser. If you suspect that this is " + + "actually an issue with React, please file an issue." + ); + } else if (isCrossOriginError) { + error = new Error( + "A cross-origin error was thrown. React doesn't have access to " + + "the actual error object in development. " + + "See https://fb.me/react-crossorigin-error for more information." + ); + } + this.onError(error); + } + + // Remove our event listeners + window.removeEventListener("error", handleWindowError); + }; + + invokeGuardedCallbackImpl = invokeGuardedCallbackDev; + } +} + +var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; + +// Used by Fiber to simulate a try-catch. +var hasError = false; +var caughtError = null; + +// Used by event system to capture/rethrow the first error. +var hasRethrowError = false; +var rethrowError = null; + +var reporter = { + onError: function(error) { + hasError = true; + caughtError = error; + } +}; + +/** + * 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 + */ +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = false; + caughtError = null; + invokeGuardedCallbackImpl$1.apply(reporter, arguments); +} + +/** + * 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 + */ +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + var error = clearCaughtError(); + if (!hasRethrowError) { + hasRethrowError = true; + rethrowError = error; + } + } +} + +/** + * During execution of guarded functions we will capture the first error which + * we will rethrow to be handled by the top level error handler. + */ +function rethrowCaughtError() { + if (hasRethrowError) { + var error = rethrowError; + hasRethrowError = false; + rethrowError = null; + throw error; + } +} + +function hasCaughtError() { + return hasError; +} + +function clearCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + return error; + } else { + (function() { + { + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } +} + +/** + * 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]; + } + + 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 argsWithFormat = args.map(function(item) { + return "" + item; + }); + argsWithFormat.unshift("Warning: " + format); + + // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + Function.prototype.apply.call(console.error, console, argsWithFormat); + } + 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) {} + }; +} + +var warningWithoutStack$1 = warningWithoutStack; + +var getFiberCurrentPropsFromNode = null; +var getInstanceFromNode = null; +var getNodeFromInstance = null; + +function setComponentTree( + getFiberCurrentPropsFromNodeImpl, + getInstanceFromNodeImpl, + getNodeFromInstanceImpl +) { + getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; + getInstanceFromNode = getInstanceFromNodeImpl; + getNodeFromInstance = getNodeFromInstanceImpl; + { + !(getNodeFromInstance && getInstanceFromNode) + ? warningWithoutStack$1( + false, + "EventPluginUtils.setComponentTree(...): Injected " + + "module is missing getNodeFromInstance or getInstanceFromNode." + ) + : void 0; + } +} + +var validateEventDispatches = void 0; +{ + validateEventDispatches = function(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr + ? dispatchListeners.length + : dispatchListeners + ? 1 + : 0; + + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr + ? dispatchInstances.length + : dispatchInstances + ? 1 + : 0; + + !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) + ? warningWithoutStack$1(false, "EventPluginUtils: Invalid `event`.") + : void 0; + }; +} + +/** + * Dispatch the event to the listener. + * @param {SyntheticEvent} event SyntheticEvent to handle + * @param {function} listener Application-level callback + * @param {*} inst Internal component instance + */ +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + event.currentTarget = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches. + */ +function executeDispatchesInOrder(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, dispatchListeners, dispatchInstances); + } + event._dispatchListeners = null; + event._dispatchInstances = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches, but stops + * at the first dispatch execution returning true, and returns that id. + * + * @return {?string} id of the first dispatch execution who's listener returns + * true, or null if no listener returned true. + */ +function executeDispatchesInOrderStopAtTrueImpl(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + if (dispatchListeners[i](event, dispatchInstances[i])) { + return dispatchInstances[i]; + } + } + } else if (dispatchListeners) { + if (dispatchListeners(event, dispatchInstances)) { + return dispatchInstances; + } + } + return null; +} + +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ +function executeDispatchesInOrderStopAtTrue(event) { + var ret = executeDispatchesInOrderStopAtTrueImpl(event); + event._dispatchInstances = null; + event._dispatchListeners = null; + return ret; +} + +/** + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. + * + * @return {*} The return value of executing the single dispatch. + */ +function executeDirectDispatch(event) { + { + validateEventDispatches(event); + } + var dispatchListener = event._dispatchListeners; + var dispatchInstance = event._dispatchInstances; + (function() { + if (!!Array.isArray(dispatchListener)) { + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + } + })(); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + var res = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return res; +} + +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ +function hasDispatches(event) { + return !!event._dispatchListeners; +} + +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. + */ + +function accumulateInto(current, next) { + (function() { + if (!(next != null)) { + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + } + })(); + + if (current == null) { + return next; + } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + current.push(next); + return current; + } + + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; +} + +/** + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + * @param {function} cb Callback invoked with each element or a collection. + * @param {?} [scope] Scope used as `this` in a callback. + */ +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); + } +} + +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ +var eventQueue = null; + +/** + * Dispatches an event and releases it back into the pool, unless persistent. + * + * @param {?object} event Synthetic event to be dispatched. + * @private + */ +var executeDispatchesAndRelease = function(event) { + if (event) { + executeDispatchesInOrder(event); + + if (!event.isPersistent()) { + event.constructor.release(event); + } + } +}; +var executeDispatchesAndReleaseTopLevel = function(e) { + return executeDispatchesAndRelease(e); +}; + +function runEventsInBatch(events) { + if (events !== null) { + eventQueue = accumulateInto(eventQueue, events); + } + + // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + var processingEventQueue = eventQueue; + eventQueue = null; + + if (!processingEventQueue) { + return; + } + + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + (function() { + if (!!eventQueue) { + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + } + })(); + // This would be a good time to rethrow if any of the event handlers threw. + rethrowCaughtError(); +} + +function isInteractive(tag) { + return ( + tag === "button" || + tag === "input" || + tag === "select" || + tag === "textarea" + ); +} + +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + return !!(props.disabled && isInteractive(type)); + default: + return false; + } +} + +/** + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. + * + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public + */ + +/** + * Methods for injecting dependencies. + */ +var injection = { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: injectEventPluginOrder, + + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: injectEventPluginsByName +}; + +/** + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ +function getListener(inst, registrationName) { + var listener = void 0; + + // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not + // live here; needs to be moved to a better place soon + var stateNode = inst.stateNode; + if (!stateNode) { + // Work in progress (ex: onload events in incremental mode). + return null; + } + var props = getFiberCurrentPropsFromNode(stateNode); + if (!props) { + // Work in progress. + return null; + } + listener = props[registrationName]; + if (shouldPreventMouseEvent(registrationName, inst.type, props)) { + return null; + } + (function() { + if (!(!listener || typeof listener === "function")) { + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + } + })(); + return listener; +} + +/** + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. + * + * @return {*} An accumulation of synthetic events. + * @internal + */ +function extractPluginEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + var events = null; + for (var i = 0; i < plugins.length; i++) { + // Not every plugin in the ordering may be loaded at runtime. + var possiblePlugin = plugins[i]; + if (possiblePlugin) { + var extractedEvents = possiblePlugin.extractEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); + } + } + } + return events; +} + +function runExtractedPluginEventsInBatch( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + var events = extractPluginEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ); + runEventsInBatch(events); +} + +var FunctionComponent = 0; +var ClassComponent = 1; +var IndeterminateComponent = 2; // Before we know whether it is function or class +var HostRoot = 3; // Root of a host tree. Could be nested inside another node. +var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. +var HostComponent = 5; +var HostText = 6; +var Fragment = 7; +var Mode = 8; +var ContextConsumer = 9; +var ContextProvider = 10; +var ForwardRef = 11; +var Profiler = 12; +var SuspenseComponent = 13; +var MemoComponent = 14; +var SimpleMemoComponent = 15; +var LazyComponent = 16; +var IncompleteClassComponent = 17; +var DehydratedSuspenseComponent = 18; +var SuspenseListComponent = 19; +var FundamentalComponent = 20; + +function getParent(inst) { + do { + 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 + // host node but that wouldn't work for React Native and doesn't let us + // do the portal feature. + } while (inst && inst.tag !== HostComponent); + if (inst) { + return inst; + } + return null; +} + +/** + * Return the lowest common ancestor of A and B, or null if they are in + * different trees. + */ +function getLowestCommonAncestor(instA, instB) { + var depthA = 0; + for (var tempA = instA; tempA; tempA = getParent(tempA)) { + depthA++; + } + var depthB = 0; + for (var tempB = instB; tempB; tempB = getParent(tempB)) { + depthB++; + } + + // If A is deeper, crawl up. + while (depthA - depthB > 0) { + instA = getParent(instA); + depthA--; + } + + // If B is deeper, crawl up. + while (depthB - depthA > 0) { + instB = getParent(instB); + depthB--; + } + + // Walk in lockstep until we find a match. + var depth = depthA; + while (depth--) { + if (instA === instB || instA === instB.alternate) { + return instA; + } + instA = getParent(instA); + instB = getParent(instB); + } + return null; +} + +/** + * Return if A is an ancestor of B. + */ +function isAncestor(instA, instB) { + while (instB) { + if (instA === instB || instA === instB.alternate) { + return true; + } + instB = getParent(instB); + } + return false; +} + +/** + * Return the parent instance of the passed-in instance. + */ +function getParentInstance(inst) { + return getParent(inst); +} + +/** + * Simulates the traversal of a two-phase, capture/bubble event dispatch. + */ +function traverseTwoPhase(inst, fn, arg) { + var path = []; + while (inst) { + path.push(inst); + inst = getParent(inst); + } + var i = void 0; + for (i = path.length; i-- > 0; ) { + fn(path[i], "captured", arg); + } + for (i = 0; i < path.length; i++) { + fn(path[i], "bubbled", arg); + } +} + +/** + * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that + * should would receive a `mouseEnter` or `mouseLeave` event. + * + * Does not invoke the callback on the nearest common ancestor because nothing + * "entered" or "left" that element. + */ + +/** + * Some event types have a notion of different registration names for different + * "phases" of propagation. This finds listeners by a given phase. + */ +function listenerAtPhase(inst, event, propagationPhase) { + var registrationName = + event.dispatchConfig.phasedRegistrationNames[propagationPhase]; + return getListener(inst, registrationName); +} + +/** + * A small set of propagation patterns, each of which will accept a small amount + * of information, and generate a set of "dispatch ready event objects" - which + * are sets of events that have already been annotated with a set of dispatched + * listener functions/ids. The API is designed this way to discourage these + * propagation strategies from actually executing the dispatches, since we + * always want to collect the entire set of dispatches before executing even a + * single one. + */ + +/** + * Tags a `SyntheticEvent` with dispatched listeners. Creating this function + * here, allows us to not have to bind or create functions for each event. + * Mutating the event's members allows us to not have to create a wrapping + * "dispatch" object that pairs the event with the listener. + */ +function accumulateDirectionalDispatches(inst, phase, event) { + { + !inst + ? warningWithoutStack$1(false, "Dispatching inst must not be null") + : void 0; + } + var listener = listenerAtPhase(inst, event, phase); + if (listener) { + event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + ); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } +} + +/** + * Collect dispatches (must be entirely collected before dispatching - see unit + * tests). Lazily allocate the array to conserve memory. We must loop through + * each event and perform the traversal for each one. We cannot perform a + * single traversal for the entire collection of events because each event may + * have a different target. + */ +function accumulateTwoPhaseDispatchesSingle(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + */ +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + var parentInst = targetInst ? getParentInstance(targetInst) : null; + traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Accumulates without regard to direction, does not look for phased + * registration names. Same as `accumulateDirectDispatchesSingle` but without + * requiring that the `dispatchMarker` be the same as the dispatched ID. + */ +function accumulateDispatches(inst, ignoredDirection, event) { + if (inst && event && event.dispatchConfig.registrationName) { + var registrationName = event.dispatchConfig.registrationName; + var listener = getListener(inst, registrationName); + if (listener) { + event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + ); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } + } +} + +/** + * Accumulates dispatches on an `SyntheticEvent`, but only for the + * `dispatchMarker`. + * @param {SyntheticEvent} event + */ +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + accumulateDispatches(event._targetInst, null, event); + } +} + +function accumulateTwoPhaseDispatches(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); +} + +function accumulateTwoPhaseDispatchesSkipTarget(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); +} + +function accumulateDirectDispatches(events) { + forEachAccumulated(events, accumulateDirectDispatchesSingle); +} + +/* eslint valid-typeof: 0 */ + +var EVENT_POOL_SIZE = 10; + +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var EventInterface = { + type: null, + target: null, + // currentTarget is set when dispatching; no use in copying it here + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + 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. + * + * These systems should generally use pooling to reduce the frequency of garbage + * collection. The system should check `isPersistent` to determine whether the + * event should be released into the pool after being dispatched. Users that + * need a persisted event should invoke `persist`. + * + * Synthetic events (and subclasses) implement the DOM Level 3 Events API by + * normalizing browser quirks. Subclasses do not necessarily have to implement a + * DOM interface; custom application-specific events can also subclass this. + * + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {*} targetInst Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @param {DOMEventTarget} nativeEventTarget Target node. + */ +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + { + // these have a getter/setter for warnings + delete this.nativeEvent; + delete this.preventDefault; + delete this.stopPropagation; + delete this.isDefaultPrevented; + delete this.isPropagationStopped; + } + + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (!Interface.hasOwnProperty(propName)) { + continue; + } + { + delete this[propName]; // this has a getter/setter for warnings + } + var normalize = Interface[propName]; + if (normalize) { + this[propName] = normalize(nativeEvent); + } else { + if (propName === "target") { + this.target = nativeEventTarget; + } else { + this[propName] = nativeEvent[propName]; + } + } + } + + var defaultPrevented = + nativeEvent.defaultPrevented != null + ? nativeEvent.defaultPrevented + : nativeEvent.returnValue === false; + if (defaultPrevented) { + this.isDefaultPrevented = functionThatReturnsTrue; + } else { + this.isDefaultPrevented = functionThatReturnsFalse; + } + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} + +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = true; + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.preventDefault) { + event.preventDefault(); + } else if (typeof event.returnValue !== "unknown") { + event.returnValue = false; + } + this.isDefaultPrevented = functionThatReturnsTrue; + }, + + stopPropagation: function() { + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.stopPropagation) { + event.stopPropagation(); + } else if (typeof event.cancelBubble !== "unknown") { + // The ChangeEventPlugin registers a "propertychange" event for + // IE. This event does not support bubbling or cancelling, and + // any references to cancelBubble throw "Member not found". A + // typeof check of "unknown" circumvents this issue (and is also + // IE specific). + event.cancelBubble = true; + } + + this.isPropagationStopped = functionThatReturnsTrue; + }, + + /** + * We release all dispatched `SyntheticEvent`s after each event loop, adding + * them back into the pool. This allows a way to hold onto a reference that + * won't be added back into the pool. + */ + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + + /** + * Checks if this event should be released back into the pool. + * + * @return {boolean} True if this should not be released, false otherwise. + */ + isPersistent: functionThatReturnsFalse, + + /** + * `PooledClass` looks for `destructor` on each instance it releases. + */ + destructor: function() { + var Interface = this.constructor.Interface; + for (var propName in Interface) { + { + Object.defineProperty( + this, + propName, + getPooledWarningPropertyDefinition(propName, Interface[propName]) + ); + } + } + 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, + "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() {}) + ); + } + } +}); + +SyntheticEvent.Interface = EventInterface; + +/** + * Helper to reduce boilerplate when creating subclasses. + */ +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); + } + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + + return Class; +}; + +addEventPoolingTo(SyntheticEvent); + +/** + * Helper to nullify syntheticEvent instance properties when destructing + * + * @param {String} propName + * @param {?object} getVal + * @return {object} defineProperty object + */ +function getPooledWarningPropertyDefinition(propName, getVal) { + var isFunction = typeof getVal === "function"; + return { + configurable: true, + set: set, + get: get + }; + + function set(val) { + var action = isFunction ? "setting the method" : "setting the property"; + warn(action, "This is effectively a no-op"); + return val; + } + + function get() { + var action = isFunction ? "accessing the method" : "accessing the property"; + var result = isFunction + ? "This is a no-op function" + : "This is set to null"; + warn(action, result); + return getVal; + } + + function warn(action, result) { + var warningCondition = false; + !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; + } +} + +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + var EventConstructor = this; + if (EventConstructor.eventPool.length) { + var instance = EventConstructor.eventPool.pop(); + EventConstructor.call( + instance, + dispatchConfig, + targetInst, + nativeEvent, + nativeInst + ); + return instance; + } + return new EventConstructor( + dispatchConfig, + targetInst, + nativeEvent, + nativeInst + ); +} + +function releasePooledEvent(event) { + var EventConstructor = this; + (function() { + if (!(event instanceof EventConstructor)) { + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + } + })(); + event.destructor(); + if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { + EventConstructor.eventPool.push(event); + } +} + +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} + +/** + * `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 ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function(nativeEvent) { + return null; // Actually doesn't even look at the native event. + } +}); + +var TOP_TOUCH_START = "topTouchStart"; +var TOP_TOUCH_MOVE = "topTouchMove"; +var TOP_TOUCH_END = "topTouchEnd"; +var TOP_TOUCH_CANCEL = "topTouchCancel"; +var TOP_SCROLL = "topScroll"; +var TOP_SELECTION_CHANGE = "topSelectionChange"; + +function isStartish(topLevelType) { + return topLevelType === TOP_TOUCH_START; +} + +function isMoveish(topLevelType) { + return topLevelType === TOP_TOUCH_MOVE; +} + +function isEndish(topLevelType) { + return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL; +} + +var startDependencies = [TOP_TOUCH_START]; +var moveDependencies = [TOP_TOUCH_MOVE]; +var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END]; + +/** + * Tracks the position and time of each active touch by `touch.identifier`. We + * should typically only see IDs in the range of 1-20 because IDs get recycled + * when touches end and start again. + */ + +var MAX_TOUCH_BANK = 20; +var touchBank = []; +var touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + // If there is only one active touch, we remember its location. This prevents + // us having to loop through all of the touches all the time in the most + // common case. + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 +}; + +function timestampForTouch(touch) { + // The legacy internal implementation provides "timeStamp", which has been + // renamed to "timestamp". Let both work for now while we iron it out + // TODO (evv): rename timeStamp to timestamp in internal code + return touch.timeStamp || touch.timestamp; +} + +/** + * TODO: Instead of making gestures recompute filtered velocity, we could + * include a built in velocity computation that can be reused globally. + */ +function createTouchRecord(touch) { + return { + touchActive: true, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }; +} + +function resetTouchRecord(touchRecord, touch) { + touchRecord.touchActive = true; + touchRecord.startPageX = touch.pageX; + touchRecord.startPageY = touch.pageY; + touchRecord.startTimeStamp = timestampForTouch(touch); + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchRecord.previousPageX = touch.pageX; + touchRecord.previousPageY = touch.pageY; + touchRecord.previousTimeStamp = timestampForTouch(touch); +} + +function getTouchIdentifier(_ref) { + var identifier = _ref.identifier; + + (function() { + if (!(identifier != null)) { + throw ReactError(Error("Touch object is missing identifier.")); + } + })(); + { + !(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; +} + +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch); + var touchRecord = touchBank[identifier]; + if (touchRecord) { + resetTouchRecord(touchRecord, touch); + } else { + touchBank[identifier] = createTouchRecord(touch); + } + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} + +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + if (touchRecord) { + touchRecord.touchActive = true; + touchRecord.previousPageX = touchRecord.currentPageX; + touchRecord.previousPageY = touchRecord.currentPageY; + touchRecord.previousTimeStamp = touchRecord.currentTimeStamp; + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); + } else { + console.warn( + "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); + } +} + +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + if (touchRecord) { + touchRecord.touchActive = false; + touchRecord.previousPageX = touchRecord.currentPageX; + touchRecord.previousPageY = touchRecord.currentPageY; + touchRecord.previousTimeStamp = touchRecord.currentTimeStamp; + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); + } else { + console.warn( + "Cannot record touch end without a touch start.\n" + "Touch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); + } +} + +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} + +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK)); + if (touchBank.length > MAX_TOUCH_BANK) { + printed += " (original size: " + touchBank.length + ")"; + } + return printed; +} + +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchMove); + } else if (isStartish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchStart); + touchHistory.numberActiveTouches = nativeEvent.touches.length; + if (touchHistory.numberActiveTouches === 1) { + touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier; + } + } else if (isEndish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchEnd); + touchHistory.numberActiveTouches = nativeEvent.touches.length; + if (touchHistory.numberActiveTouches === 1) { + for (var i = 0; i < touchBank.length; i++) { + var touchTrackToCheck = touchBank[i]; + if (touchTrackToCheck != null && touchTrackToCheck.touchActive) { + touchHistory.indexOfSingleActiveTouch = i; + break; + } + } + { + var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch]; + !(activeRecord != null && activeRecord.touchActive) + ? warningWithoutStack$1(false, "Cannot find single active touch.") + : void 0; + } + } + } + }, + + touchHistory: touchHistory +}; + +/** + * Accumulates items that must not be null or undefined. + * + * This is used to conserve memory by avoiding array allocations. + * + * @return {*|array<*>} An accumulation of items. + */ +function accumulate(current, next) { + (function() { + if (!(next != null)) { + throw ReactError( + Error( + "accumulate(...): Accumulated items must not be null or undefined." + ) + ); + } + })(); + + if (current == null) { + return next; + } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + return current.concat(next); + } + + if (Array.isArray(next)) { + return [current].concat(next); + } + + return [current, next]; +} + +/** + * Instance of element that should respond to touch/move types of interactions, + * as indicated explicitly by relevant callbacks. + */ +var responderInst = null; + +/** + * Count of current touches. A textInput should become responder iff the + * selection changes while there is a touch on the screen. + */ +var trackedTouchCount = 0; + +var changeResponder = function(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (ResponderEventPlugin.GlobalResponderHandler !== null) { + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); + } +}; + +var eventTypes = { + /** + * On a `touchStart`/`mouseDown`, is it desired that this element become the + * responder? + */ + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + + /** + * On a `scroll`, is it desired that this element become the responder? This + * is usually not needed, but should be used to retroactively infer that a + * `touchStart` had occurred during momentum scroll. During a momentum scroll, + * a touch start will be immediately followed by a scroll event if the view is + * currently scrolling. + * + * TODO: This shouldn't bubble. + */ + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: [TOP_SCROLL] + }, + + /** + * On text selection change, should this element become the responder? This + * is needed for text inputs or other views with native selection, so the + * JS view can claim the responder. + * + * TODO: This shouldn't bubble. + */ + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: [TOP_SELECTION_CHANGE] + }, + + /** + * On a `touchMove`/`mouseMove`, is it desired that this element become the + * responder? + */ + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + + /** + * Direct responder events dispatched directly to responder. Do not bubble. + */ + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { + registrationName: "onResponderGrant", + dependencies: [] + }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } +}; + +/** + * + * Responder System: + * ---------------- + * + * - A global, solitary "interaction lock" on a view. + * - If a node becomes the responder, it should convey visual feedback + * immediately to indicate so, either by highlighting or moving accordingly. + * - To be the responder means, that touches are exclusively important to that + * responder view, and no other view. + * - While touches are still occurring, the responder lock can be transferred to + * a new view, but only to increasingly "higher" views (meaning ancestors of + * the current responder). + * + * Responder being granted: + * ------------------------ + * + * - Touch starts, moves, and scrolls can cause an ID to become the responder. + * - We capture/bubble `startShouldSetResponder`/`moveShouldSetResponder` to + * the "appropriate place". + * - If nothing is currently the responder, the "appropriate place" is the + * initiating event's `targetID`. + * - If something *is* already the responder, the "appropriate place" is the + * first common ancestor of the event target and the current `responderInst`. + * - Some negotiation happens: See the timing diagram below. + * - Scrolled views automatically become responder. The reasoning is that a + * platform scroll view that isn't built on top of the responder system has + * began scrolling, and the active responder must now be notified that the + * interaction is no longer locked to it - the system has taken over. + * + * - Responder being released: + * As soon as no more touches that *started* inside of descendants of the + * *current* responderInst, an `onResponderRelease` event is dispatched to the + * current responder, and the responder lock is released. + * + * TODO: + * - on "end", a callback hook for `onResponderEndShouldRemainResponder` that + * determines if the responder lock should remain. + * - If a view shouldn't "remain" the responder, any active touches should by + * default be considered "dead" and do not influence future negotiations or + * bubble paths. It should be as if those touches do not exist. + * -- For multitouch: Usually a translate-z will choose to "remain" responder + * after one out of many touches ended. For translate-y, usually the view + * doesn't wish to "remain" responder after one of many touches end. + * - Consider building this on top of a `stopPropagation` model similar to + * `W3C` events. + * - Ensure that `onResponderTerminate` is called on touch cancels, whether or + * not `onResponderTerminationRequest` returns `true` or `false`. + * + */ + +/* Negotiation Performed + +-----------------------+ + / \ +Process low level events to + Current Responder + wantsResponderID +determine who to perform negot-| (if any exists at all) | +iation/transition | Otherwise just pass through| +-------------------------------+----------------------------+------------------+ +Bubble to find first ID | | +to return true:wantsResponderID| | + | | + +-------------+ | | + | onTouchStart| | | + +------+------+ none | | + | return| | ++-----------v-------------+true| +------------------------+ | +|onStartShouldSetResponder|----->|onResponderStart (cur) |<-----------+ ++-----------+-------------+ | +------------------------+ | | + | | | +--------+-------+ + | returned true for| false:REJECT +-------->|onResponderReject + | wantsResponderID | | | +----------------+ + | (now attempt | +------------------+-----+ | + | handoff) | | onResponder | | + +------------------->| TerminationRequest| | + | +------------------+-----+ | + | | | +----------------+ + | true:GRANT +-------->|onResponderGrant| + | | +--------+-------+ + | +------------------------+ | | + | | onResponderTerminate |<-----------+ + | +------------------+-----+ | + | | | +----------------+ + | +-------->|onResponderStart| + | | +----------------+ +Bubble to find first ID | | +to return true:wantsResponderID| | + | | + +-------------+ | | + | onTouchMove | | | + +------+------+ none | | + | return| | ++-----------v-------------+true| +------------------------+ | +|onMoveShouldSetResponder |----->|onResponderMove (cur) |<-----------+ ++-----------+-------------+ | +------------------------+ | | + | | | +--------+-------+ + | returned true for| false:REJECT +-------->|onResponderRejec| + | wantsResponderID | | | +----------------+ + | (now attempt | +------------------+-----+ | + | handoff) | | onResponder | | + +------------------->| TerminationRequest| | + | +------------------+-----+ | + | | | +----------------+ + | true:GRANT +-------->|onResponderGrant| + | | +--------+-------+ + | +------------------------+ | | + | | onResponderTerminate |<-----------+ + | +------------------+-----+ | + | | | +----------------+ + | +-------->|onResponderMove | + | | +----------------+ + | | + | | + Some active touch started| | + inside current responder | +------------------------+ | + +------------------------->| onResponderEnd | | + | | +------------------------+ | + +---+---------+ | | + | onTouchEnd | | | + +---+---------+ | | + | | +------------------------+ | + +------------------------->| onResponderEnd | | + No active touches started| +-----------+------------+ | + inside current responder | | | + | v | + | +------------------------+ | + | | onResponderRelease | | + | +------------------------+ | + | | + + + */ + +/** + * A note about event ordering in the `EventPluginHub`. + * + * Suppose plugins are injected in the following order: + * + * `[R, S, C]` + * + * To help illustrate the example, assume `S` is `SimpleEventPlugin` (for + * `onClick` etc) and `R` is `ResponderEventPlugin`. + * + * "Deferred-Dispatched Events": + * + * - The current event plugin system will traverse the list of injected plugins, + * in order, and extract events by collecting the plugin's return value of + * `extractEvents()`. + * - These events that are returned from `extractEvents` are "deferred + * dispatched events". + * - When returned from `extractEvents`, deferred-dispatched events contain an + * "accumulation" of deferred dispatches. + * - These deferred dispatches are accumulated/collected before they are + * returned, but processed at a later time by the `EventPluginHub` (hence the + * name deferred). + * + * In the process of returning their deferred-dispatched events, event plugins + * themselves can dispatch events on-demand without returning them from + * `extractEvents`. Plugins might want to do this, so that they can use event + * dispatching as a tool that helps them decide which events should be extracted + * in the first place. + * + * "On-Demand-Dispatched Events": + * + * - On-demand-dispatched events are not returned from `extractEvents`. + * - On-demand-dispatched events are dispatched during the process of returning + * the deferred-dispatched events. + * - They should not have side effects. + * - They should be avoided, and/or eventually be replaced with another + * abstraction that allows event plugins to perform multiple "rounds" of event + * extraction. + * + * Therefore, the sequence of event dispatches becomes: + * + * - `R`s on-demand events (if any) (dispatched by `R` on-demand) + * - `S`s on-demand events (if any) (dispatched by `S` on-demand) + * - `C`s on-demand events (if any) (dispatched by `C` on-demand) + * - `R`s extracted events (if any) (dispatched by `EventPluginHub`) + * - `S`s extracted events (if any) (dispatched by `EventPluginHub`) + * - `C`s extracted events (if any) (dispatched by `EventPluginHub`) + * + * In the case of `ResponderEventPlugin`: If the `startShouldSetResponder` + * on-demand dispatch returns `true` (and some other details are satisfied) the + * `onResponderGrant` deferred dispatched event is returned from + * `extractEvents`. The sequence of dispatch executions in this case + * will appear as follows: + * + * - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand) + * - `touchStartCapture` (`EventPluginHub` dispatches as usual) + * - `touchStart` (`EventPluginHub` dispatches as usual) + * - `responderGrant/Reject` (`EventPluginHub` dispatches as usual) + */ + +function setResponderAndExtractTransfer( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + 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); + + // When capturing/bubbling the "shouldSet" event, we want to skip the target + // (deepest ID) if it happens to be the current responder. The reasoning: + // It's strange to get an `onMoveShouldSetResponder` when you're *already* + // the responder. + var skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst; + var shouldSetEvent = ResponderSyntheticEvent.getPooled( + shouldSetEventType, + bubbleShouldSetFrom, + nativeEvent, + nativeEventTarget + ); + shouldSetEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + if (skipOverBubbleShouldSetFrom) { + accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent); + } else { + accumulateTwoPhaseDispatches(shouldSetEvent); + } + var wantsResponderInst = executeDispatchesInOrderStopAtTrue(shouldSetEvent); + if (!shouldSetEvent.isPersistent()) { + shouldSetEvent.constructor.release(shouldSetEvent); + } + + if (!wantsResponderInst || wantsResponderInst === responderInst) { + return null; + } + var extracted = void 0; + var grantEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + wantsResponderInst, + nativeEvent, + nativeEventTarget + ); + grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + + accumulateDirectDispatches(grantEvent); + var blockHostResponder = executeDirectDispatch(grantEvent) === true; + if (responderInst) { + var terminationRequestEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + ); + terminationRequestEvent.touchHistory = + ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(terminationRequestEvent); + var shouldSwitch = + !hasDispatches(terminationRequestEvent) || + executeDirectDispatch(terminationRequestEvent); + if (!terminationRequestEvent.isPersistent()) { + terminationRequestEvent.constructor.release(terminationRequestEvent); + } + + if (shouldSwitch) { + var terminateEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + ); + terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(terminateEvent); + extracted = accumulate(extracted, [grantEvent, terminateEvent]); + changeResponder(wantsResponderInst, blockHostResponder); + } else { + var rejectEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + wantsResponderInst, + nativeEvent, + nativeEventTarget + ); + rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(rejectEvent); + extracted = accumulate(extracted, rejectEvent); + } + } else { + extracted = accumulate(extracted, grantEvent); + changeResponder(wantsResponderInst, blockHostResponder); + } + return extracted; +} + +/** + * A transfer is a negotiation between a currently set responder and the next + * element to claim responder status. Any start event could trigger a transfer + * of responderInst. Any move event could trigger a transfer. + * + * @param {string} topLevelType Record from `BrowserEventConstants`. + * @return {boolean} True if a transfer of responder could possibly occur. + */ +function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) { + return ( + topLevelInst && + // 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 === TOP_SCROLL && !nativeEvent.responderIgnoreScroll) || + (trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ); +} + +/** + * Returns whether or not this touch end event makes it such that there are no + * longer any touches that started inside of the current `responderInst`. + * + * @param {NativeEvent} nativeEvent Native touch end event. + * @return {boolean} Whether or not this touch end event ends the responder. + */ +function noResponderTouches(nativeEvent) { + var touches = nativeEvent.touches; + if (!touches || touches.length === 0) { + return true; + } + for (var i = 0; i < touches.length; i++) { + var activeTouch = touches[i]; + 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); + if (isAncestor(responderInst, targetInst)) { + return false; + } + } + } + return true; +} + +var ResponderEventPlugin = { + /* For unit testing only */ + _getResponder: function() { + return responderInst; + }, + + eventTypes: eventTypes, + + /** + * We must be resilient to `targetInst` being `null` on `touchMove` or + * `touchEnd`. On certain platforms, this means that a native scroll has + * assumed control and the original touch targets are destroyed. + */ + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) { + trackedTouchCount += 1; + } else if (isEndish(topLevelType)) { + if (trackedTouchCount >= 0) { + trackedTouchCount -= 1; + } else { + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ); + return null; + } + } + + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + + var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) + ? setResponderAndExtractTransfer( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) + : null; + // Responder may or may not have transferred on a new touch start/move. + // Regardless, whoever is the responder after any potential transfer, we + // direct all touch start/move/ends to them in the form of + // `onResponderMove/Start/End`. These will be called for *every* additional + // finger that move/start/end, dispatched directly to whoever is the + // current responder at that moment, until the responder is "released". + // + // These multiple individual change touch events are are always bookended + // by `onResponderGrant`, and one of + // (`onResponderRelease/onResponderTerminate`). + var isResponderTouchStart = responderInst && isStartish(topLevelType); + var isResponderTouchMove = responderInst && isMoveish(topLevelType); + var isResponderTouchEnd = responderInst && isEndish(topLevelType); + var incrementalTouch = isResponderTouchStart + ? eventTypes.responderStart + : isResponderTouchMove + ? eventTypes.responderMove + : isResponderTouchEnd + ? eventTypes.responderEnd + : null; + + if (incrementalTouch) { + var gesture = ResponderSyntheticEvent.getPooled( + incrementalTouch, + responderInst, + nativeEvent, + nativeEventTarget + ); + gesture.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(gesture); + extracted = accumulate(extracted, gesture); + } + + 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) { + var finalEvent = ResponderSyntheticEvent.getPooled( + finalTouch, + responderInst, + nativeEvent, + nativeEventTarget + ); + finalEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(finalEvent); + extracted = accumulate(extracted, finalEvent); + changeResponder(null); + } + + return extracted; + }, + + GlobalResponderHandler: null, + + injection: { + /** + * @param {{onChange: (ReactID, ReactID) => void} GlobalResponderHandler + * Object that handles any change in responder. Use this to inject + * integration with an existing touch handling system etc. + */ + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } +}; + +// Module provided by RN: +var customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes; +var customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; + +var ReactNativeBridgeEventPlugin = { + eventTypes: {}, + + /** + * @see {EventPluginHub.extractEvents} + */ + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (targetInst == null) { + // Probably a node belonging to another renderer's tree. + return null; + } + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; + var directDispatchConfig = customDirectEventTypes[topLevelType]; + (function() { + if (!(bubbleDispatchConfig || directDispatchConfig)) { + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + } + })(); + var event = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) { + accumulateTwoPhaseDispatches(event); + } else if (directDispatchConfig) { + accumulateDirectDispatches(event); + } else { + return null; + } + return event; + } +}; + +var ReactNativeEventPluginOrder = [ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]; + +/** + * Make sure essential globals are available and are patched correctly. Please don't remove this + * line. Bundles created by react-packager `require` it before executing any application code. This + * ensures it exists in the dependency graph and can be `require`d. + * TODO: require this in packager, not in React #10932517 + */ +// Module provided by RN: +/** + * Inject module for resolving DOM hierarchy and plugin ordering. + */ +injection.injectEventPluginOrder(ReactNativeEventPluginOrder); + +/** + * Some important event plugins included by default (without having to require + * them). + */ +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin +}); + +function getInstanceFromInstance(instanceHandle) { + return instanceHandle; +} + +function getTagFromInstance(inst) { + var tag = inst.stateNode.canonical._nativeTag; + (function() { + if (!tag) { + throw ReactError(Error("All native instances should have a tag.")); + } + })(); + return tag; +} + +function getFiberCurrentPropsFromNode$1(inst) { + return inst.canonical.currentProps; +} + +// Module provided by RN: +var ReactFabricGlobalResponderHandler = { + onChange: function(from, to, blockNativeResponder) { + if (to !== null) { + var tag = to.stateNode.canonical._nativeTag; + ReactNativePrivateInterface.UIManager.setJSResponder( + tag, + blockNativeResponder + ); + } else { + ReactNativePrivateInterface.UIManager.clearJSResponder(); + } + } +}; + +setComponentTree( + getFiberCurrentPropsFromNode$1, + getInstanceFromInstance, + getTagFromInstance +); + +ResponderEventPlugin.injection.injectGlobalResponderHandler( + ReactFabricGlobalResponderHandler +); + +/** + * `ReactInstanceMap` maintains a mapping from a public facing stateful + * instance (key) and the internal representation (value). This allows public + * methods to accept the user facing instance as an argument and map them back + * to internal methods. + * + * Note that this module is currently shared and assumed to be stateless. + * If this becomes an actual Map, that will break. + */ + +/** + * This API should be called `delete` but we'd have to make sure to always + * transform these to strings for IE support. When this transform is fully + * supported we can rename it. + */ + +function get(key) { + return key._reactInternalFiber; +} + +function set(key, value) { + key._reactInternalFiber = value; +} + +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +// Prevent newer renderers from RTE when used with older react package versions. +// Current owner and dispatcher used to share the same ref, +// but PR #14548 split them out to better support the react-debug-tools package. +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) { + ReactSharedInternals.ReactCurrentDispatcher = { + current: null + }; +} +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === "function" && Symbol.for; + +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol + ? Symbol.for("react.strict_mode") + : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; +// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol + ? Symbol.for("react.forward_ref") + : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4; +var REACT_FUNDAMENTAL_TYPE = hasSymbol + ? Symbol.for("react.fundamental") + : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6; + +var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = "@@iterator"; + +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== "object") { + return null; + } + var maybeIterator = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable[FAUX_ITERATOR_SYMBOL]; + if (typeof maybeIterator === "function") { + return maybeIterator; + } + return null; +} + +var Pending = 0; +var Resolved = 1; +var Rejected = 2; + +function refineResolvedLazyComponent(lazyComponent) { + return lazyComponent._status === Resolved ? lazyComponent._result : null; +} + +function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName) + ); +} + +function getComponentName(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + { + if (typeof type.tag === "number") { + warningWithoutStack$1( + false, + "Received an unexpected object in getComponentName(). " + + "This is likely a bug in React. Please file an issue." + ); + } + } + if (typeof type === "function") { + return type.displayName || type.name || null; + } + if (typeof type === "string") { + return type; + } + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if (typeof type === "object") { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, "ForwardRef"); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: { + var thenable = type; + var resolvedThenable = refineResolvedLazyComponent(thenable); + if (resolvedThenable) { + return getComponentName(resolvedThenable); + } + break; + } + } + } + return null; +} + +// Don't change these two values. They're used by React Dev Tools. +var NoEffect = /* */ 0; +var PerformedWork = /* */ 1; + +// You can change the rest (and add more). +var Placement = /* */ 2; +var Update = /* */ 4; +var PlacementAndUpdate = /* */ 6; +var Deletion = /* */ 8; +var ContentReset = /* */ 16; +var Callback = /* */ 32; +var DidCapture = /* */ 64; +var Ref = /* */ 128; +var Snapshot = /* */ 256; +var Passive = /* */ 512; + +// Passive & Update & Callback & Ref & Snapshot +var LifecycleEffectMask = /* */ 932; + +// Union of all host effects +var HostEffectMask = /* */ 1023; + +var Incomplete = /* */ 1024; +var ShouldCapture = /* */ 2048; + +// Re-export dynamic flags from the fbsource version. +var _require = require("../shims/ReactFeatureFlags"); + +var debugRenderPhaseSideEffects = _require.debugRenderPhaseSideEffects; + +var enableUserTimingAPI = true; +var enableProfilerTimer = true; +var enableSchedulerTracing = true; +var enableSuspenseServerRenderer = false; + +var debugRenderPhaseSideEffectsForStrictMode = true; + +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; +var warnAboutDeprecatedLifecycles = true; +var warnAboutDeprecatedSetNativeProps = true; +var enableFlareAPI = false; +var enableFundamentalAPI = false; + +var warnAboutUnmockedScheduler = true; +var revertPassiveEffectsChange = false; +var flushSuspenseFallbacksInTests = true; +var enableUserBlockingEvents = false; +var enableSuspenseCallback = false; +var warnAboutDefaultPropsOnFunctionComponents = false; +var warnAboutStringRefs = false; +var disableLegacyContext = false; +var disableSchedulerTimeoutBasedOnReactExpirationTime = false; + +// Only used in www builds. + +var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + +var MOUNTING = 1; +var MOUNTED = 2; +var UNMOUNTED = 3; + +function isFiberMountedImpl(fiber) { + var node = fiber; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + while (node.return) { + node = node.return; + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + } + } else { + while (node.return) { + node = node.return; + } + } + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return MOUNTED; + } + // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + return UNMOUNTED; +} + +function isFiberMounted(fiber) { + return isFiberMountedImpl(fiber) === MOUNTED; +} + +function isMounted(component) { + { + var owner = ReactCurrentOwner$1.current; + if (owner !== null && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + !instance._warnedAboutRefsInRender + ? warningWithoutStack$1( + false, + "%s is accessing isMounted inside its render() function. " + + "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(ownerFiber.type) || "A component" + ) + : void 0; + instance._warnedAboutRefsInRender = true; + } + } + + var fiber = get(component); + if (!fiber) { + return false; + } + return isFiberMountedImpl(fiber) === MOUNTED; +} + +function assertIsMounted(fiber) { + (function() { + if (!(isFiberMountedImpl(fiber) === MOUNTED)) { + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + })(); +} + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var state = isFiberMountedImpl(fiber); + (function() { + if (!(state !== UNMOUNTED)) { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + if (state === MOUNTING) { + return null; + } + return fiber; + } + // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + var a = fiber; + var b = alternate; + while (true) { + var parentA = a.return; + if (parentA === null) { + // We're at the root. + break; + } + var parentB = parentA.alternate; + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + if (nextParent !== null) { + a = b = nextParent; + continue; + } + // If there's no parent, we're at the root. + break; + } + + // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + if (parentA.child === parentB.child) { + var child = parentA.child; + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + child = child.sibling; + } + // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + (function() { + if (!didFindChild) { + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + })(); + } + } + + (function() { + if (!(a.alternate === b)) { + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + (function() { + if (!(a.tag === HostRoot)) { + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + })(); + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } + // Otherwise B has to be current branch. + return alternate; +} + +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + if (!currentParent) { + return null; + } + + // Next we'll drill down this component to find the first HostComponent/Text. + var node = currentParent; + while (true) { + if (node.tag === HostComponent || node.tag === HostText) { + return node; + } else if (node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === currentParent) { + return null; + } + while (!node.sibling) { + if (!node.return || node.return === currentParent) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + // Flow needs the return null here, but ESLint complains about it. + // eslint-disable-next-line no-unreachable + return null; +} + +/** + * In the future, we should cleanup callbacks by cancelling them instead of + * using this. + */ +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if (!callback) { + return undefined; + } + // This protects against createClass() components. + // We don't know if there is code depending on it. + // We intentionally don't use isMounted() because even accessing + // isMounted property on a React ES6 class will trigger a warning. + if (typeof context.__isMounted === "boolean") { + if (!context.__isMounted) { + return undefined; + } + } + + // FIXME: there used to be other branches that protected + // against unmounted host components. But RN host components don't + // define isMounted() anymore, so those checks didn't do anything. + + // They caused false positive warning noise so we removed them: + // https://github.com/facebook/react-native/issues/18868#issuecomment-413579095 + + // However, this means that the callback is NOT guaranteed to be safe + // for host components. The solution we should implement is to make + // UIManager.measure() and similar calls truly cancelable. Then we + // can change our own code calling them to cancel when something unmounts. + + return callback.apply(context, arguments); + }; +} + +function throwOnStylesProp(component, props) { + if (props.styles !== undefined) { + var owner = component._owner || null; + var name = component.constructor.displayName; + var msg = + "`styles` is not a supported property of `" + + name + + "`, did " + + "you mean `style` (singular)?"; + if (owner && owner.constructor && owner.constructor.displayName) { + msg += + "\n\nCheck the `" + + owner.constructor.displayName + + "` parent " + + " component."; + } + throw new Error(msg); + } +} + +function warnForStyleProps(props, validAttributes) { + for (var key in validAttributes.style) { + if (!(validAttributes[key] || props[key] === undefined)) { + console.error( + "You are setting the style `{ " + + key + + ": ... }` as a prop. You " + + "should nest it in a style object. " + + "E.g. `{ style: { " + + key + + ": ... } }`" + ); + } + } +} + +// Modules provided by RN: +var emptyObject = {}; + +/** + * Create a payload that contains all the updates between two sets of props. + * + * These helpers are all encapsulated into a single module, because they use + * mutation as a performance optimization which leads to subtle shared + * dependencies between the code paths. To avoid this mutable state leaking + * across modules, I've kept them isolated to this module. + */ + +// Tracks removed keys +var removedKeys = null; +var removedKeyCount = 0; + +function defaultDiffer(prevProp, nextProp) { + if (typeof nextProp !== "object" || nextProp === null) { + // Scalars have already been checked for equality + return true; + } else { + // For objects and arrays, the default diffing algorithm is a deep compare + return ReactNativePrivateInterface.deepDiffer(prevProp, nextProp); + } +} + +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) { + var i = node.length; + while (i-- && removedKeyCount > 0) { + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + } + } else if (node && removedKeyCount > 0) { + var obj = node; + for (var propKey in removedKeys) { + if (!removedKeys[propKey]) { + continue; + } + var nextProp = obj[propKey]; + if (nextProp === undefined) { + continue; + } + + var attributeConfig = validAttributes[propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + if (typeof nextProp === "function") { + nextProp = true; + } + if (typeof nextProp === "undefined") { + nextProp = null; + } + + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + updatePayload[propKey] = nextProp; + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + updatePayload[propKey] = nextValue; + } + removedKeys[propKey] = false; + removedKeyCount--; + } + } +} + +function diffNestedArrayProperty( + updatePayload, + prevArray, + nextArray, + validAttributes +) { + var minLength = + prevArray.length < nextArray.length ? prevArray.length : nextArray.length; + var i = void 0; + for (i = 0; i < minLength; i++) { + // Diff any items in the array in the forward direction. Repeated keys + // will be overwritten by later values. + updatePayload = diffNestedProperty( + updatePayload, + prevArray[i], + nextArray[i], + validAttributes + ); + } + for (; i < prevArray.length; i++) { + // Clear out all remaining properties. + updatePayload = clearNestedProperty( + updatePayload, + prevArray[i], + validAttributes + ); + } + for (; i < nextArray.length; i++) { + // Add all remaining properties. + updatePayload = addNestedProperty( + updatePayload, + nextArray[i], + validAttributes + ); + } + return updatePayload; +} + +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) { + // If no properties have been added, then we can bail out quickly on object + // equality. + return updatePayload; + } + + if (!prevProp || !nextProp) { + if (nextProp) { + return addNestedProperty(updatePayload, nextProp, validAttributes); + } + if (prevProp) { + return clearNestedProperty(updatePayload, prevProp, validAttributes); + } + return updatePayload; + } + + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) { + // Both are leaves, we can diff the leaves. + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + } + + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + // Both are arrays, we can diff the arrays. + return diffNestedArrayProperty( + updatePayload, + prevProp, + nextProp, + validAttributes + ); + } + + if (Array.isArray(prevProp)) { + return diffProperties( + updatePayload, + // $FlowFixMe - We know that this is always an object when the input is. + ReactNativePrivateInterface.flattenStyle(prevProp), + // $FlowFixMe - We know that this isn't an array because of above flow. + nextProp, + validAttributes + ); + } + + return diffProperties( + updatePayload, + prevProp, + // $FlowFixMe - We know that this is always an object when the input is. + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} + +/** + * addNestedProperty takes a single set of props and valid attribute + * attribute configurations. It processes each prop and adds it to the + * updatePayload. + */ +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) { + return updatePayload; + } + + if (!Array.isArray(nextProp)) { + // Add each property of the leaf. + return addProperties(updatePayload, nextProp, validAttributes); + } + + for (var i = 0; i < nextProp.length; i++) { + // Add all the properties of the array. + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + } + + return updatePayload; +} + +/** + * clearNestedProperty takes a single set of props and valid attributes. It + * adds a null sentinel to the updatePayload, for each prop key. + */ +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) { + return updatePayload; + } + + if (!Array.isArray(prevProp)) { + // Add each property of the leaf. + return clearProperties(updatePayload, prevProp, validAttributes); + } + + for (var i = 0; i < prevProp.length; i++) { + // Add all the properties of the array. + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + } + return updatePayload; +} + +/** + * diffProperties takes two sets of props and a set of valid attributes + * and write to updatePayload the values that changed or were deleted. + * If no updatePayload is provided, a new one is created and returned if + * anything changed. + */ +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig = void 0; + var nextProp = void 0; + var prevProp = void 0; + + for (var propKey in nextProps) { + attributeConfig = validAttributes[propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + prevProp = prevProps[propKey]; + nextProp = nextProps[propKey]; + + // functions are converted to booleans as markers that the associated + // events should be sent from native. + if (typeof nextProp === "function") { + nextProp = true; + // If nextProp is not a function, then don't bother changing prevProp + // since nextProp will win and go into the updatePayload regardless. + if (typeof prevProp === "function") { + prevProp = true; + } + } + + // An explicit value of undefined is treated as a null because it overrides + // any other preceding value. + if (typeof nextProp === "undefined") { + nextProp = null; + if (typeof prevProp === "undefined") { + prevProp = null; + } + } + + if (removedKeys) { + removedKeys[propKey] = false; + } + + if (updatePayload && updatePayload[propKey] !== undefined) { + // Something else already triggered an update to this key because another + // value diffed. Since we're now later in the nested arrays our value is + // more important so we need to calculate it and override the existing + // value. It doesn't matter if nothing changed, we'll set it anyway. + + // Pattern match on: attributeConfig + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + updatePayload[propKey] = nextProp; + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + updatePayload[propKey] = nextValue; + } + continue; + } + + if (prevProp === nextProp) { + continue; // nothing changed + } + + // Pattern match on: attributeConfig + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + if (defaultDiffer(prevProp, nextProp)) { + // a normal leaf has changed + (updatePayload || (updatePayload = {}))[propKey] = nextProp; + } + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var shouldUpdate = + prevProp === undefined || + (typeof attributeConfig.diff === "function" + ? attributeConfig.diff(prevProp, nextProp) + : defaultDiffer(prevProp, nextProp)); + if (shouldUpdate) { + var _nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + (updatePayload || (updatePayload = {}))[propKey] = _nextValue; + } + } else { + // default: fallthrough case when nested properties are defined + removedKeys = null; + removedKeyCount = 0; + // We think that attributeConfig is not CustomAttributeConfiguration at + // this point so we assume it must be AttributeConfiguration. + updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + ); + if (removedKeyCount > 0 && updatePayload) { + restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ); + removedKeys = null; + } + } + } + + // Also iterate through all the previous props to catch any that have been + // removed and make sure native gets the signal so it can reset them to the + // default. + for (var _propKey in prevProps) { + if (nextProps[_propKey] !== undefined) { + continue; // we've already covered this key in the previous pass + } + attributeConfig = validAttributes[_propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + if (updatePayload && updatePayload[_propKey] !== undefined) { + // This was already updated to a diff result earlier. + continue; + } + + prevProp = prevProps[_propKey]; + if (prevProp === undefined) { + continue; // was already empty anyway + } + // Pattern match on: attributeConfig + if ( + typeof attributeConfig !== "object" || + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration | !Object + // Flag the leaf property for removal by sending a sentinel. + (updatePayload || (updatePayload = {}))[_propKey] = null; + if (!removedKeys) { + removedKeys = {}; + } + if (!removedKeys[_propKey]) { + removedKeys[_propKey] = true; + removedKeyCount++; + } + } else { + // default: + // This is a nested attribute configuration where all the properties + // were removed so we need to go through and clear out all of them. + updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ); + } + } + return updatePayload; +} + +/** + * addProperties adds all the valid props to the payload after being processed. + */ +function addProperties(updatePayload, props, validAttributes) { + // TODO: Fast path + return diffProperties(updatePayload, emptyObject, props, validAttributes); +} + +/** + * clearProperties clears all the previous props by adding a null sentinel + * to the payload for each valid key. + */ +function clearProperties(updatePayload, prevProps, validAttributes) { + // TODO: Fast path + return diffProperties(updatePayload, prevProps, emptyObject, validAttributes); +} + +function create(props, validAttributes) { + return addProperties( + null, // updatePayload + props, + validAttributes + ); +} + +function diff(prevProps, nextProps, validAttributes) { + return diffProperties( + null, // updatePayload + prevProps, + nextProps, + validAttributes + ); +} + +// Use to restore controlled state after a change event has fired. + +var restoreImpl = null; +var restoreTarget = null; +var restoreQueue = null; + +function restoreStateOfTarget(target) { + // We perform this translation at the end of the event loop so that we + // always receive the correct fiber here + var internalInstance = getInstanceFromNode(target); + if (!internalInstance) { + // Unmounted + return; + } + (function() { + if (!(typeof restoreImpl === "function")) { + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); + restoreImpl(internalInstance.stateNode, internalInstance.type, props); +} + +function needsStateRestore() { + return restoreTarget !== null || restoreQueue !== null; +} + +function restoreStateIfNeeded() { + if (!restoreTarget) { + return; + } + var target = restoreTarget; + var queuedTargets = restoreQueue; + restoreTarget = null; + restoreQueue = null; + + restoreStateOfTarget(target); + if (queuedTargets) { + for (var i = 0; i < queuedTargets.length; i++) { + restoreStateOfTarget(queuedTargets[i]); + } + } +} + +// Used as a way to call batchedUpdates when we don't have a reference to +// the renderer. Such as when we're dispatching events or if third party +// libraries need to call batchedUpdates. Eventually, this API will go away when +// everything is batched by default. We'll then have a similar API to opt-out of +// scheduled work and instead do synchronous work. + +// Defaults +var batchedUpdatesImpl = function(fn, bookkeeping) { + return fn(bookkeeping); +}; +var discreteUpdatesImpl = function(fn, a, b, c) { + return fn(a, b, c); +}; +var flushDiscreteUpdatesImpl = function() {}; +var batchedEventUpdatesImpl = batchedUpdatesImpl; + +var isInsideEventHandler = false; + +function finishEventHandler() { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + var controlledComponentsHavePendingUpdates = needsStateRestore(); + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + flushDiscreteUpdatesImpl(); + restoreStateIfNeeded(); + } +} + +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(bookkeeping); + } + isInsideEventHandler = true; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + isInsideEventHandler = false; + finishEventHandler(); + } +} + +function batchedEventUpdates(fn, a, b) { + if (isInsideEventHandler) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(a, b); + } + isInsideEventHandler = true; + try { + return batchedEventUpdatesImpl(fn, a, b); + } finally { + isInsideEventHandler = false; + finishEventHandler(); + } +} + +function discreteUpdates(fn, a, b, c) { + var prevIsInsideEventHandler = isInsideEventHandler; + isInsideEventHandler = true; + try { + return discreteUpdatesImpl(fn, a, b, c); + } finally { + isInsideEventHandler = prevIsInsideEventHandler; + if (!isInsideEventHandler) { + finishEventHandler(); + } + } +} + +var lastFlushedEventTimeStamp = 0; +function flushDiscreteUpdatesIfNeeded(timeStamp) { + // event.timeStamp isn't overly reliable due to inconsistencies in + // how different browsers have historically provided the time stamp. + // Some browsers provide high-resolution time stamps for all events, + // some provide low-resolution time stamps for all events. FF < 52 + // even mixes both time stamps together. Some browsers even report + // negative time stamps or time stamps that are 0 (iOS9) in some cases. + // Given we are only comparing two time stamps with equality (!==), + // we are safe from the resolution differences. If the time stamp is 0 + // we bail-out of preventing the flush, which can affect semantics, + // such as if an earlier flush removes or adds event listeners that + // are fired in the subsequent flush. However, this is the same + // behaviour as we had before this change, so the risks are low. + if ( + !isInsideEventHandler && + (!enableFlareAPI || + timeStamp === 0 || + lastFlushedEventTimeStamp !== timeStamp) + ) { + lastFlushedEventTimeStamp = timeStamp; + flushDiscreteUpdatesImpl(); + } +} + +function setBatchingImplementation( + _batchedUpdatesImpl, + _discreteUpdatesImpl, + _flushDiscreteUpdatesImpl, + _batchedEventUpdatesImpl +) { + batchedUpdatesImpl = _batchedUpdatesImpl; + discreteUpdatesImpl = _discreteUpdatesImpl; + flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; + batchedEventUpdatesImpl = _batchedEventUpdatesImpl; +} + +function _classCallCheck$1(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + } + return call && (typeof call === "object" || typeof call === "function") + ? call + : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) + Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass); +} + +/** + * Class only exists for its Flow type. + */ +var ReactNativeComponent = (function(_React$Component) { + _inherits(ReactNativeComponent, _React$Component); + + function ReactNativeComponent() { + _classCallCheck$1(this, ReactNativeComponent); + + return _possibleConstructorReturn( + this, + _React$Component.apply(this, arguments) + ); + } + + ReactNativeComponent.prototype.blur = function blur() {}; + + ReactNativeComponent.prototype.focus = function focus() {}; + + ReactNativeComponent.prototype.measure = function measure(callback) {}; + + ReactNativeComponent.prototype.measureInWindow = function measureInWindow( + callback + ) {}; + + ReactNativeComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail + ) {}; + + ReactNativeComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) {}; + + return ReactNativeComponent; +})(React.Component); + +/** + * This type keeps ReactNativeFiberHostComponent and NativeMethodsMixin in sync. + * It can also provide types for ReactNative applications that use NMM or refs. + */ + +/** + * Flat ReactNative renderer bundles are too big for Flow to parse efficiently. + * Provide minimal Flow typing for the high-level RN API and call it a day. + */ + +var DiscreteEvent = 0; +var UserBlockingEvent = 1; +var ContinuousEvent = 2; + +/** + * 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 warning = warningWithoutStack$1; + +{ + warning = function(condition, format) { + if (condition) { + return; + } + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + // eslint-disable-next-line react-internal/warning-and-invariant-args + + for ( + var _len = arguments.length, + args = Array(_len > 2 ? _len - 2 : 0), + _key = 2; + _key < _len; + _key++ + ) { + args[_key - 2] = arguments[_key]; + } + + warningWithoutStack$1.apply( + undefined, + [false, format + "%s"].concat(args, [stack]) + ); + }; +} + +var warning$1 = warning; + +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var runWithPriority = Scheduler.unstable_runWithPriority; +var _nativeFabricUIManage$2 = nativeFabricUIManager; +var measureInWindow = _nativeFabricUIManage$2.measureInWindow; + +var activeTimeouts = new Map(); +var rootEventTypesToEventResponderInstances = new Map(); +var ownershipChangeListeners = new Set(); + +var globalOwner = null; + +var currentTimeStamp = 0; +var currentTimers = new Map(); +var currentInstance = null; +var currentEventQueue = null; +var currentEventQueuePriority = ContinuousEvent; +var currentTimerIDCounter = 0; + +var eventResponderContext = { + dispatchEvent: function(eventValue, eventListener, eventPriority) { + validateResponderContext(); + validateEventValue(eventValue); + if (eventPriority < currentEventQueuePriority) { + currentEventQueuePriority = eventPriority; + } + currentEventQueue.push(createEventQueueItem(eventValue, eventListener)); + }, + isTargetWithinNode: function(childTarget, parentTarget) { + validateResponderContext(); + var childFiber = getFiberFromTarget(childTarget); + var parentFiber = getFiberFromTarget(parentTarget); + + var node = childFiber; + while (node !== null) { + if (node === parentFiber) { + return true; + } + node = node.return; + } + return false; + }, + getTargetBoundingRect: function(target, callback) { + measureInWindow(target.node, function(x, y, width, height) { + callback({ + left: x, + right: x + width, + top: y, + bottom: y + height + }); + }); + }, + addRootEventTypes: function(rootEventTypes) { + validateResponderContext(); + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + var eventResponderInstance = currentInstance; + registerRootEventType(rootEventType, eventResponderInstance); + } + }, + removeRootEventTypes: function(rootEventTypes) { + validateResponderContext(); + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + + var rootEventResponders = rootEventTypesToEventResponderInstances.get( + rootEventType + ); + var rootEventTypesSet = currentInstance.rootEventTypes; + if (rootEventTypesSet !== null) { + rootEventTypesSet.delete(rootEventType); + } + if (rootEventResponders !== undefined) { + rootEventResponders.delete(currentInstance); + } + } + }, + setTimeout: function(func, delay) { + validateResponderContext(); + if (currentTimers === null) { + currentTimers = new Map(); + } + var timeout = currentTimers.get(delay); + + var timerId = currentTimerIDCounter++; + if (timeout === undefined) { + var _timers = new Map(); + var _id = setTimeout(function() { + processTimers(_timers, delay); + }, delay); + timeout = { + id: _id, + timers: _timers + }; + currentTimers.set(delay, timeout); + } + timeout.timers.set(timerId, { + instance: currentInstance, + func: func, + id: timerId, + timeStamp: currentTimeStamp + }); + activeTimeouts.set(timerId, timeout); + return timerId; + }, + clearTimeout: function(timerId) { + validateResponderContext(); + var timeout = activeTimeouts.get(timerId); + + if (timeout !== undefined) { + var _timers2 = timeout.timers; + _timers2.delete(timerId); + if (_timers2.size === 0) { + clearTimeout(timeout.id); + } + } + }, + getTimeStamp: function() { + validateResponderContext(); + return currentTimeStamp; + } +}; + +function createEventQueueItem(value, listener) { + return { + value: value, + listener: listener + }; +} + +function validateEventValue(eventValue) { + if (typeof eventValue === "object" && eventValue !== null) { + var target = eventValue.target, + type = eventValue.type, + _timeStamp = eventValue.timeStamp; + + if (target == null || type == null || _timeStamp == null) { + throw new Error( + 'context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.' + ); + } + var showWarning = function(name) { + { + warning$1( + false, + "%s is not available on event objects created from event responder modules (React Flare). " + + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', + name, + name + ); + } + }; + eventValue.preventDefault = function() { + { + showWarning("preventDefault()"); + } + }; + eventValue.stopPropagation = function() { + { + showWarning("stopPropagation()"); + } + }; + eventValue.isDefaultPrevented = function() { + { + showWarning("isDefaultPrevented()"); + } + }; + eventValue.isPropagationStopped = function() { + { + showWarning("isPropagationStopped()"); + } + }; + // $FlowFixMe: we don't need value, Flow thinks we do + Object.defineProperty(eventValue, "nativeEvent", { + get: function() { + { + showWarning("nativeEvent"); + } + } + }); + } +} + +function getFiberFromTarget(target) { + if (target === null) { + return null; + } + return target.canonical._internalInstanceHandle || null; +} + +function processTimers(timers, delay) { + var timersArr = Array.from(timers.values()); + currentEventQueuePriority = ContinuousEvent; + try { + for (var i = 0; i < timersArr.length; i++) { + var _timersArr$i = timersArr[i], + _instance = _timersArr$i.instance, + _func = _timersArr$i.func, + _id2 = _timersArr$i.id, + _timeStamp2 = _timersArr$i.timeStamp; + + currentInstance = _instance; + currentEventQueue = []; + currentTimeStamp = _timeStamp2 + delay; + try { + _func(); + } finally { + activeTimeouts.delete(_id2); + } + } + processEventQueue(); + } finally { + currentTimers = null; + currentInstance = null; + currentEventQueue = null; + currentTimeStamp = 0; + } +} + +function createFabricResponderEvent(topLevelType, nativeEvent, target) { + return { + nativeEvent: nativeEvent, + responderTarget: target, + target: target, + type: topLevelType + }; +} + +function validateResponderContext() { + (function() { + if (!(currentEventQueue && currentInstance)) { + throw ReactError( + Error( + "An event responder context was used outside of an event cycle. Use context.setTimeout() to use asynchronous responder context outside of event cycle ." + ) + ); + } + })(); +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function processEventQueue() { + var eventQueue = currentEventQueue; + if (eventQueue.length === 0) { + return; + } + switch (currentEventQueuePriority) { + case DiscreteEvent: { + flushDiscreteUpdatesIfNeeded(currentTimeStamp); + discreteUpdates(function() { + batchedEventUpdates(processEvents, eventQueue); + }); + break; + } + case UserBlockingEvent: { + if (enableUserBlockingEvents) { + runWithPriority( + UserBlockingPriority, + batchedEventUpdates.bind(null, processEvents, eventQueue) + ); + } else { + batchedEventUpdates(processEvents, eventQueue); + } + break; + } + case ContinuousEvent: { + batchedEventUpdates(processEvents, eventQueue); + break; + } + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function releaseOwnershipForEventResponderInstance(eventResponderInstance) { + if (globalOwner === eventResponderInstance) { + globalOwner = null; + triggerOwnershipListeners(); + return true; + } + return false; +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function processEvents(eventQueue) { + for (var i = 0, length = eventQueue.length; i < length; i++) { + var _eventQueue$i = eventQueue[i], + _value = _eventQueue$i.value, + _listener = _eventQueue$i.listener; + + var type = typeof _value === "object" && _value !== null ? _value.type : ""; + invokeGuardedCallbackAndCatchFirstError(type, _listener, undefined, _value); + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function responderEventTypesContainType(eventTypes, type) { + for (var i = 0, len = eventTypes.length; i < len; i++) { + if (eventTypes[i] === type) { + return true; + } + } + return false; +} + +function validateResponderTargetEventTypes(eventType, responder) { + var targetEventTypes = responder.targetEventTypes; + // Validate the target event type exists on the responder + + if (targetEventTypes !== null) { + return responderEventTypesContainType(targetEventTypes, eventType); + } + return false; +} + +function validateOwnership(responderInstance) { + return globalOwner === null || globalOwner === responderInstance; +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function traverseAndHandleEventResponderInstances( + eventType, + targetFiber, + nativeEvent +) { + // Trigger event responders in this order: + // - Bubble target responder phase + // - Root responder phase + + var responderEvent = createFabricResponderEvent( + eventType, + nativeEvent, + targetFiber !== null ? targetFiber.stateNode : null + ); + var visitedResponders = new Set(); + var node = targetFiber; + while (node !== null) { + var _node = node, + dependencies = _node.dependencies, + tag = _node.tag; + + if (tag === HostComponent && dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for (var i = 0, length = responderInstances.length; i < length; i++) { + var responderInstance = responderInstances[i]; + + if (validateOwnership(responderInstance)) { + var props = responderInstance.props, + responder = responderInstance.responder, + state = responderInstance.state, + target = responderInstance.target; + + if ( + !visitedResponders.has(responder) && + validateResponderTargetEventTypes(eventType, responder) + ) { + var onEvent = responder.onEvent; + visitedResponders.add(responder); + if (onEvent !== null) { + currentInstance = responderInstance; + responderEvent.responderTarget = target; + onEvent(responderEvent, eventResponderContext, props, state); + } + } + } + } + } + } + node = node.return; + } + // Root phase + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + eventType + ); + if (rootEventResponderInstances !== undefined) { + var _responderInstances = Array.from(rootEventResponderInstances); + + for (var _i = 0; _i < _responderInstances.length; _i++) { + var _responderInstance = _responderInstances[_i]; + if (!validateOwnership(_responderInstance)) { + continue; + } + var _props = _responderInstance.props, + _responder = _responderInstance.responder, + _state = _responderInstance.state, + _target = _responderInstance.target; + + var onRootEvent = _responder.onRootEvent; + if (onRootEvent !== null) { + currentInstance = _responderInstance; + responderEvent.responderTarget = _target; + onRootEvent(responderEvent, eventResponderContext, _props, _state); + } + } + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function dispatchEventForResponderEventSystem( + topLevelType, + targetFiber, + nativeEvent +) { + var previousEventQueue = currentEventQueue; + var previousInstance = currentInstance; + var previousTimers = currentTimers; + var previousTimeStamp = currentTimeStamp; + var previousEventQueuePriority = currentEventQueuePriority; + currentTimers = null; + currentEventQueue = []; + currentEventQueuePriority = ContinuousEvent; + // We might want to control timeStamp another way here + currentTimeStamp = Date.now(); + try { + traverseAndHandleEventResponderInstances( + topLevelType, + targetFiber, + nativeEvent + ); + processEventQueue(); + } finally { + currentTimers = previousTimers; + currentInstance = previousInstance; + currentEventQueue = previousEventQueue; + currentTimeStamp = previousTimeStamp; + currentEventQueuePriority = previousEventQueuePriority; + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function triggerOwnershipListeners() { + var listeningInstances = Array.from(ownershipChangeListeners); + var previousInstance = currentInstance; + var previousEventQueuePriority = currentEventQueuePriority; + var previousEventQueue = currentEventQueue; + try { + for (var i = 0; i < listeningInstances.length; i++) { + var _instance2 = listeningInstances[i]; + var props = _instance2.props, + responder = _instance2.responder, + state = _instance2.state; + + currentInstance = _instance2; + currentEventQueuePriority = ContinuousEvent; + currentEventQueue = []; + var onOwnershipChange = responder.onOwnershipChange; + if (onOwnershipChange !== null) { + onOwnershipChange(eventResponderContext, props, state); + } + } + processEventQueue(); + } finally { + currentInstance = previousInstance; + currentEventQueue = previousEventQueue; + currentEventQueuePriority = previousEventQueuePriority; + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function mountEventResponder(responder, responderInstance, props, state) { + if (responder.onOwnershipChange !== null) { + ownershipChangeListeners.add(responderInstance); + } + var onMount = responder.onMount; + if (onMount !== null) { + currentEventQueuePriority = ContinuousEvent; + currentInstance = responderInstance; + currentEventQueue = []; + try { + onMount(eventResponderContext, props, state); + processEventQueue(); + } finally { + currentEventQueue = null; + currentInstance = null; + currentTimers = null; + } + } +} + +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function unmountEventResponder(responderInstance) { + var responder = responderInstance.responder; + var onUnmount = responder.onUnmount; + if (onUnmount !== null) { + var props = responderInstance.props, + state = responderInstance.state; + + currentEventQueue = []; + currentEventQueuePriority = ContinuousEvent; + currentInstance = responderInstance; + try { + onUnmount(eventResponderContext, props, state); + processEventQueue(); + } finally { + currentEventQueue = null; + currentInstance = null; + currentTimers = null; + } + } + releaseOwnershipForEventResponderInstance(responderInstance); + if (responder.onOwnershipChange !== null) { + ownershipChangeListeners.delete(responderInstance); + } + var rootEventTypesSet = responderInstance.rootEventTypes; + if (rootEventTypesSet !== null) { + var rootEventTypes = Array.from(rootEventTypesSet); + + for (var i = 0; i < rootEventTypes.length; i++) { + var topLevelEventType = rootEventTypes[i]; + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + topLevelEventType + ); + if (rootEventResponderInstances !== undefined) { + rootEventResponderInstances.delete(responderInstance); + } + } + } +} + +function registerRootEventType(rootEventType, responderInstance) { + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + rootEventType + ); + if (rootEventResponderInstances === undefined) { + rootEventResponderInstances = new Set(); + rootEventTypesToEventResponderInstances.set( + rootEventType, + rootEventResponderInstances + ); + } + var rootEventTypesSet = responderInstance.rootEventTypes; + if (rootEventTypesSet === null) { + rootEventTypesSet = responderInstance.rootEventTypes = new Set(); + } + (function() { + if (!!rootEventTypesSet.has(rootEventType)) { + throw ReactError( + Error( + 'addRootEventTypes() found a duplicate root event type of "' + + rootEventType + + '". This might be because the event type exists in the event responder "rootEventTypes" array or because of a previous addRootEventTypes() using this root event type.' + ) + ); + } + })(); + rootEventTypesSet.add(rootEventType); + rootEventResponderInstances.add(responderInstance); +} + +function addRootEventTypesForResponderInstance( + responderInstance, + rootEventTypes +) { + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + registerRootEventType(rootEventType, responderInstance); + } +} + +function dispatchEvent(target, topLevelType, nativeEvent) { + var targetFiber = target; + if (enableFlareAPI) { + // React Flare event system + dispatchEventForResponderEventSystem(topLevelType, target, nativeEvent); + } + batchedUpdates(function() { + // Heritage plugin event system + runExtractedPluginEventsInBatch( + topLevelType, + targetFiber, + nativeEvent, + nativeEvent.target + ); + }); + // React Native doesn't use ReactControlledComponent but if it did, here's + // where it would do it. +} + +// Renderers that don't support mutation +// can re-export everything from this module. + +function shim() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +// Mutation (when unsupported) +var supportsMutation = false; +var appendChild = shim; +var appendChildToContainer = shim; +var commitTextUpdate = shim; +var commitMount = shim; +var commitUpdate = shim; +var insertBefore = shim; +var insertInContainerBefore = shim; +var removeChild = shim; +var removeChildFromContainer = shim; +var resetTextContent = shim; +var hideInstance = shim; +var hideTextInstance = shim; +var unhideInstance = shim; +var unhideTextInstance = shim; + +// Renderers that don't support hydration +// can re-export everything from this module. + +function shim$1() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +// Hydration (when unsupported) + +var supportsHydration = false; +var canHydrateInstance = shim$1; +var canHydrateTextInstance = shim$1; +var canHydrateSuspenseInstance = shim$1; +var isSuspenseInstancePending = shim$1; +var isSuspenseInstanceFallback = shim$1; +var registerSuspenseInstanceRetry = shim$1; +var getNextHydratableSibling = shim$1; +var getFirstHydratableChild = shim$1; +var hydrateInstance = shim$1; +var hydrateTextInstance = shim$1; +var getNextHydratableInstanceAfterSuspenseInstance = shim$1; +var clearSuspenseBoundary = shim$1; +var clearSuspenseBoundaryFromContainer = shim$1; +var didNotMatchHydratedContainerTextInstance = shim$1; +var didNotMatchHydratedTextInstance = shim$1; +var didNotHydrateContainerInstance = shim$1; +var didNotHydrateInstance = shim$1; +var didNotFindHydratableContainerInstance = shim$1; +var didNotFindHydratableContainerTextInstance = shim$1; +var didNotFindHydratableContainerSuspenseInstance = shim$1; +var didNotFindHydratableInstance = shim$1; +var didNotFindHydratableTextInstance = shim$1; +var didNotFindHydratableSuspenseInstance = shim$1; + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +// Modules provided by RN: +var _nativeFabricUIManage$1 = nativeFabricUIManager; +var createNode = _nativeFabricUIManage$1.createNode; +var cloneNode = _nativeFabricUIManage$1.cloneNode; +var cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren; +var cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps; +var cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps; +var createChildNodeSet = _nativeFabricUIManage$1.createChildSet; +var appendChildNode = _nativeFabricUIManage$1.appendChild; +var appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet; +var completeRoot = _nativeFabricUIManage$1.completeRoot; +var registerEventHandler = _nativeFabricUIManage$1.registerEventHandler; +var fabricMeasure = _nativeFabricUIManage$1.measure; +var fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow; +var fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout; +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; + +// Counter for uniquely identifying views. +// % 10 === 1 means it is a rootTag. +// % 2 === 0 means it is a Fabric tag. +// This means that they never overlap. + +var nextReactTag = 2; + +// TODO: Remove this conditional once all changes have propagated. +if (registerEventHandler) { + /** + * Register the event emitter with the native bridge + */ + registerEventHandler(dispatchEvent); +} + +/** + * This is used for refs on host components. + */ + +var ReactFabricHostComponent = (function() { + function ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ) { + _classCallCheck(this, ReactFabricHostComponent); + + this._nativeTag = tag; + this.viewConfig = viewConfig; + this.currentProps = props; + this._internalInstanceHandle = internalInstanceHandle; + } + + ReactFabricHostComponent.prototype.blur = function blur() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + + ReactFabricHostComponent.prototype.focus = function focus() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + + ReactFabricHostComponent.prototype.measure = function measure(callback) { + fabricMeasure( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + + ReactFabricHostComponent.prototype.measureInWindow = function measureInWindow( + callback + ) { + fabricMeasureInWindow( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + + ReactFabricHostComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + if ( + typeof relativeToNativeNode === "number" || + !(relativeToNativeNode instanceof ReactFabricHostComponent) + ) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a ref to a native component." + ); + + return; + } + + fabricMeasureLayout( + this._internalInstanceHandle.stateNode.node, + relativeToNativeNode._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + + ReactFabricHostComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + + return; + }; + + return ReactFabricHostComponent; +})(); + +function appendInitialChild(parentInstance, child) { + appendChildNode(parentInstance.node, child.node); +} + +function createInstance( + type, + props, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + var tag = nextReactTag; + nextReactTag += 2; + + var viewConfig = getViewConfigForType(type); + + { + for (var key in viewConfig.validAttributes) { + if (props.hasOwnProperty(key)) { + ReactNativePrivateInterface.deepFreezeAndThrowOnMutationInDev( + props[key] + ); + } + } + } + + var updatePayload = create(props, viewConfig.validAttributes); + + var node = createNode( + tag, // reactTag + viewConfig.uiViewClassName, // viewName + rootContainerInstance, // rootTag + updatePayload, // props + internalInstanceHandle // internalInstanceHandle + ); + + var component = new ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ); + + return { + node: node, + canonical: component + }; +} + +function createTextInstance( + text, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + (function() { + if (!hostContext.isInAParentText) { + throw ReactError( + Error("Text strings must be rendered within a component.") + ); + } + })(); + + var tag = nextReactTag; + nextReactTag += 2; + + var node = createNode( + tag, // reactTag + "RCTRawText", // viewName + rootContainerInstance, // rootTag + { text: text }, // props + internalInstanceHandle // instance handle + ); + + return { + node: node + }; +} + +function finalizeInitialChildren( + parentInstance, + type, + props, + rootContainerInstance, + hostContext +) { + return false; +} + +function getRootHostContext(rootContainerInstance) { + return { isInAParentText: false }; +} + +function getChildHostContext(parentHostContext, type, rootContainerInstance) { + var prevIsInAParentText = parentHostContext.isInAParentText; + var isInAParentText = + type === "AndroidTextInput" || // Android + type === "RCTMultilineTextInputView" || // iOS + type === "RCTSinglelineTextInputView" || // iOS + type === "RCTText" || + type === "RCTVirtualText"; + + if (prevIsInAParentText !== isInAParentText) { + return { isInAParentText: isInAParentText }; + } else { + return parentHostContext; + } +} + +function getPublicInstance(instance) { + return instance.canonical; +} + +function prepareForCommit(containerInfo) { + // Noop +} + +function prepareUpdate( + instance, + type, + oldProps, + newProps, + rootContainerInstance, + hostContext +) { + var viewConfig = instance.canonical.viewConfig; + var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); + // TODO: If the event handlers have changed, we need to update the current props + // in the commit phase but there is no host config hook to do it yet. + // So instead we hack it by updating it in the render phase. + instance.canonical.currentProps = newProps; + return updatePayload; +} + +function resetAfterCommit(containerInfo) { + // Noop +} + +function shouldDeprioritizeSubtree(type, props) { + return false; +} + +function shouldSetTextContent(type, props) { + // TODO (bvaughn) Revisit this decision. + // Always returning false simplifies the createInstance() implementation, + // But creates an additional child Fiber for raw text children. + // No additional native views are created though. + // It's not clear to me which is better so I'm deferring for now. + // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 + return false; +} + +// The Fabric renderer is secondary to the existing React Native renderer. +var isPrimaryRenderer = false; + +// The Fabric renderer shouldn't trigger missing act() warnings +var warnsIfNotActing = false; + +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; + +// ------------------- +// Persistence +// ------------------- + +var supportsPersistence = true; + +function cloneInstance( + instance, + updatePayload, + type, + oldProps, + newProps, + internalInstanceHandle, + keepChildren, + recyclableInstance +) { + var node = instance.node; + var clone = void 0; + if (keepChildren) { + if (updatePayload !== null) { + clone = cloneNodeWithNewProps(node, updatePayload); + } else { + clone = cloneNode(node); + } + } else { + if (updatePayload !== null) { + clone = cloneNodeWithNewChildrenAndProps(node, updatePayload); + } else { + clone = cloneNodeWithNewChildren(node); + } + } + return { + node: clone, + canonical: instance.canonical + }; +} + +function cloneHiddenInstance(instance, type, props, internalInstanceHandle) { + var viewConfig = instance.canonical.viewConfig; + var node = instance.node; + var updatePayload = create( + { style: { display: "none" } }, + viewConfig.validAttributes + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical + }; +} + +function cloneHiddenTextInstance(instance, text, internalInstanceHandle) { + throw new Error("Not yet implemented."); +} + +function createContainerChildSet(container) { + return createChildNodeSet(container); +} + +function appendChildToContainerChildSet(childSet, child) { + appendChildNodeToSet(childSet, child.node); +} + +function finalizeContainerChildren(container, newChildren) { + completeRoot(container, newChildren); +} + +function mountResponderInstance( + responder, + responderInstance, + props, + state, + instance, + rootContainerInstance +) { + if (enableFlareAPI) { + var rootEventTypes = responder.rootEventTypes; + + if (rootEventTypes !== null) { + addRootEventTypesForResponderInstance(responderInstance, rootEventTypes); + } + mountEventResponder(responder, responderInstance, props, state); + } +} + +function unmountResponderInstance(responderInstance) { + if (enableFlareAPI) { + // TODO stop listening to targetEventTypes + unmountEventResponder(responderInstance); + } +} + +function getFundamentalComponentInstance(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function mountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function shouldUpdateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function updateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function unmountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function cloneFundamentalInstance(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; + +var describeComponentFrame = function(name, source, ownerName) { + var sourceInfo = ""; + if (source) { + var path = source.fileName; + var fileName = path.replace(BEFORE_SLASH_RE, ""); + { + // In DEV, include code for a common special case: + // prefer "folder/index.js" instead of just "index.js". + if (/^index\./.test(fileName)) { + var match = path.match(BEFORE_SLASH_RE); + if (match) { + var pathBeforeSlash = match[1]; + if (pathBeforeSlash) { + var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ""); + fileName = folderName + "/" + fileName; + } + } + } + } + sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")"; + } else if (ownerName) { + sourceInfo = " (created by " + ownerName + ")"; + } + return "\n in " + (name || "Unknown") + sourceInfo; +}; + +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostRoot: + case HostPortal: + case HostText: + case Fragment: + case ContextProvider: + case ContextConsumer: + return ""; + default: + var owner = fiber._debugOwner; + var source = fiber._debugSource; + var name = getComponentName(fiber.type); + var ownerName = null; + if (owner) { + ownerName = getComponentName(owner.type); + } + return describeComponentFrame(name, source, ownerName); + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + var node = workInProgress; + do { + info += describeFiber(node); + node = node.return; + } while (node); + return info; +} + +var current = null; +var phase = null; + +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + var owner = current._debugOwner; + if (owner !== null && typeof owner !== "undefined") { + return getComponentName(owner.type); + } + } + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ""; + } + // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + return getStackByFiberInDevAndProd(current); + } + return ""; +} + +function resetCurrentFiber() { + { + ReactDebugCurrentFrame.getCurrentStack = null; + current = null; + phase = null; + } +} + +function setCurrentFiber(fiber) { + { + ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; + current = fiber; + phase = null; + } +} + +function setCurrentPhase(lifeCyclePhase) { + { + phase = lifeCyclePhase; + } +} + +// Prefix measurements so that it's possible to filter them. +// Longer prefixes are hard to read in DevTools. +var reactEmoji = "\u269B"; +var warningEmoji = "\u26D4"; +var supportsUserTiming = + typeof performance !== "undefined" && + typeof performance.mark === "function" && + typeof performance.clearMarks === "function" && + typeof performance.measure === "function" && + typeof performance.clearMeasures === "function"; + +// Keep track of current fiber so that we know the path to unwind on pause. +// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? +var currentFiber = null; +// If we're in the middle of user code, which fiber and method is it? +// Reusing `currentFiber` would be confusing for this because user code fiber +// can change during commit phase too, but we don't need to unwind it (since +// lifecycles in the commit phase don't resemble a tree). +var currentPhase = null; +var currentPhaseFiber = null; +// Did lifecycle hook schedule an update? This is often a performance problem, +// so we will keep track of it, and include it in the report. +// Track commits caused by cascading updates. +var isCommitting = false; +var hasScheduledUpdateInCurrentCommit = false; +var hasScheduledUpdateInCurrentPhase = false; +var commitCountInCurrentWorkLoop = 0; +var effectCountInCurrentCommit = 0; +var isWaitingForCallback = false; +// During commits, we only show a measurement once per method name +// to avoid stretch the commit phase with measurement overhead. +var labelsInCurrentCommit = new Set(); + +var formatMarkName = function(markName) { + return reactEmoji + " " + markName; +}; + +var formatLabel = function(label, warning) { + var prefix = warning ? warningEmoji + " " : reactEmoji + " "; + var suffix = warning ? " Warning: " + warning : ""; + return "" + prefix + label + suffix; +}; + +var beginMark = function(markName) { + performance.mark(formatMarkName(markName)); +}; + +var clearMark = function(markName) { + performance.clearMarks(formatMarkName(markName)); +}; + +var endMark = function(label, markName, warning) { + var formattedMarkName = formatMarkName(markName); + var formattedLabel = formatLabel(label, warning); + try { + performance.measure(formattedLabel, formattedMarkName); + } catch (err) {} + // If previous mark was missing for some reason, this will throw. + // This could only happen if React crashed in an unexpected place earlier. + // Don't pile on with more errors. + + // Clear marks immediately to avoid growing buffer. + performance.clearMarks(formattedMarkName); + performance.clearMeasures(formattedLabel); +}; + +var getFiberMarkName = function(label, debugID) { + return label + " (#" + debugID + ")"; +}; + +var getFiberLabel = function(componentName, isMounted, phase) { + if (phase === null) { + // These are composite component total time measurements. + return componentName + " [" + (isMounted ? "update" : "mount") + "]"; + } else { + // Composite component methods. + return componentName + "." + phase; + } +}; + +var beginFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + + if (isCommitting && labelsInCurrentCommit.has(label)) { + // During the commit phase, we don't show duplicate labels because + // there is a fixed overhead for every measurement, and we don't + // want to stretch the commit phase beyond necessary. + return false; + } + labelsInCurrentCommit.add(label); + + var markName = getFiberMarkName(label, debugID); + beginMark(markName); + return true; +}; + +var clearFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + clearMark(markName); +}; + +var endFiberMark = function(fiber, phase, warning) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + endMark(label, markName, warning); +}; + +var shouldIgnoreFiber = function(fiber) { + // Host components should be skipped in the timeline. + // We could check typeof fiber.type, but does this work with RN? + switch (fiber.tag) { + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case Fragment: + case ContextProvider: + case ContextConsumer: + case Mode: + return true; + default: + return false; + } +}; + +var clearPendingPhaseMeasurement = function() { + if (currentPhase !== null && currentPhaseFiber !== null) { + clearFiberMark(currentPhaseFiber, currentPhase); + } + currentPhaseFiber = null; + currentPhase = null; + hasScheduledUpdateInCurrentPhase = false; +}; + +var pauseTimers = function() { + // Stops all currently active measurements so that they can be resumed + // if we continue in a later deferred loop from the same unit of work. + var fiber = currentFiber; + while (fiber) { + if (fiber._debugIsCurrentlyTiming) { + endFiberMark(fiber, null, null); + } + fiber = fiber.return; + } +}; + +var resumeTimersRecursively = function(fiber) { + if (fiber.return !== null) { + resumeTimersRecursively(fiber.return); + } + if (fiber._debugIsCurrentlyTiming) { + beginFiberMark(fiber, null); + } +}; + +var resumeTimers = function() { + // Resumes all measurements that were active during the last deferred loop. + if (currentFiber !== null) { + resumeTimersRecursively(currentFiber); + } +}; + +function recordEffect() { + if (enableUserTimingAPI) { + effectCountInCurrentCommit++; + } +} + +function recordScheduleUpdate() { + if (enableUserTimingAPI) { + if (isCommitting) { + hasScheduledUpdateInCurrentCommit = true; + } + if ( + currentPhase !== null && + currentPhase !== "componentWillMount" && + currentPhase !== "componentWillReceiveProps" + ) { + hasScheduledUpdateInCurrentPhase = true; + } + } +} + +function startRequestCallbackTimer() { + if (enableUserTimingAPI) { + if (supportsUserTiming && !isWaitingForCallback) { + isWaitingForCallback = true; + beginMark("(Waiting for async callback...)"); + } + } +} + +function stopRequestCallbackTimer(didExpire) { + if (enableUserTimingAPI) { + if (supportsUserTiming) { + isWaitingForCallback = false; + var warning = didExpire + ? "Update expired; will flush synchronously" + : null; + endMark( + "(Waiting for async callback...)", + "(Waiting for async callback...)", + warning + ); + } + } +} + +function startWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, this is the fiber to unwind from. + currentFiber = fiber; + if (!beginFiberMark(fiber, null)) { + return; + } + fiber._debugIsCurrentlyTiming = true; + } +} + +function cancelWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // Remember we shouldn't complete measurement for this fiber. + // Otherwise flamechart will be deep even for small updates. + fiber._debugIsCurrentlyTiming = false; + clearFiberMark(fiber, null); + } +} + +function stopWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + endFiberMark(fiber, null, null); + } +} + +function stopFailedWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + var warning = + fiber.tag === SuspenseComponent || + fiber.tag === DehydratedSuspenseComponent + ? "Rendering was suspended" + : "An error was thrown inside this error boundary"; + endFiberMark(fiber, null, warning); + } +} + +function startPhaseTimer(fiber, phase) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + clearPendingPhaseMeasurement(); + if (!beginFiberMark(fiber, phase)) { + return; + } + currentPhaseFiber = fiber; + currentPhase = phase; + } +} + +function stopPhaseTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + if (currentPhase !== null && currentPhaseFiber !== null) { + var warning = hasScheduledUpdateInCurrentPhase + ? "Scheduled a cascading update" + : null; + endFiberMark(currentPhaseFiber, currentPhase, warning); + } + currentPhase = null; + currentPhaseFiber = null; + } +} + +function startWorkLoopTimer(nextUnitOfWork) { + if (enableUserTimingAPI) { + currentFiber = nextUnitOfWork; + if (!supportsUserTiming) { + return; + } + commitCountInCurrentWorkLoop = 0; + // This is top level call. + // Any other measurements are performed within. + beginMark("(React Tree Reconciliation)"); + // Resume any measurements that were in progress during the last loop. + resumeTimers(); + } +} + +function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var warning = null; + if (interruptedBy !== null) { + if (interruptedBy.tag === HostRoot) { + warning = "A top-level update interrupted the previous render"; + } else { + var componentName = getComponentName(interruptedBy.type) || "Unknown"; + warning = + "An update to " + componentName + " interrupted the previous render"; + } + } else if (commitCountInCurrentWorkLoop > 1) { + warning = "There were cascading updates"; + } + commitCountInCurrentWorkLoop = 0; + var label = didCompleteRoot + ? "(React Tree Reconciliation: Completed Root)" + : "(React Tree Reconciliation: Yielded)"; + // Pause any measurements until the next loop. + pauseTimers(); + endMark(label, "(React Tree Reconciliation)", warning); + } +} + +function startCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + isCommitting = true; + hasScheduledUpdateInCurrentCommit = false; + labelsInCurrentCommit.clear(); + beginMark("(Committing Changes)"); + } +} + +function stopCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + + var warning = null; + if (hasScheduledUpdateInCurrentCommit) { + warning = "Lifecycle hook scheduled a cascading update"; + } else if (commitCountInCurrentWorkLoop > 0) { + warning = "Caused by a cascading update in earlier commit"; + } + hasScheduledUpdateInCurrentCommit = false; + commitCountInCurrentWorkLoop++; + isCommitting = false; + labelsInCurrentCommit.clear(); + + endMark("(Committing Changes)", "(Committing Changes)", warning); + } +} + +function startCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Committing Snapshot Effects)"); + } +} + +function stopCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Snapshot Effects: " + count + " Total)", + "(Committing Snapshot Effects)", + null + ); + } +} + +function startCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Committing Host Effects)"); + } +} + +function stopCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Host Effects: " + count + " Total)", + "(Committing Host Effects)", + null + ); + } +} + +function startCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Calling Lifecycle Methods)"); + } +} + +function stopCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Calling Lifecycle Methods: " + count + " Total)", + "(Calling Lifecycle Methods)", + null + ); + } +} + +var valueStack = []; + +var fiberStack = void 0; + +{ + fiberStack = []; +} + +var index = -1; + +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} + +function pop(cursor, fiber) { + if (index < 0) { + { + warningWithoutStack$1(false, "Unexpected pop."); + } + return; + } + + { + if (fiber !== fiberStack[index]) { + warningWithoutStack$1(false, "Unexpected Fiber popped."); + } + } + + cursor.current = valueStack[index]; + + valueStack[index] = null; + + { + fiberStack[index] = null; + } + + index--; +} + +function push(cursor, value, fiber) { + index++; + + valueStack[index] = cursor.current; + + { + fiberStack[index] = fiber; + } + + cursor.current = value; +} + +var warnedAboutMissingGetChildContext = void 0; + +{ + warnedAboutMissingGetChildContext = {}; +} + +var emptyContextObject = {}; +{ + Object.freeze(emptyContextObject); +} + +// A cursor to the current merged context object on the stack. +var contextStackCursor = createCursor(emptyContextObject); +// A cursor to a boolean indicating whether the context has changed. +var didPerformWorkStackCursor = createCursor(false); +// Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. +var previousContext = emptyContextObject; + +function getUnmaskedContext( + workInProgress, + Component, + didPushOwnContextIfProvider +) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; + } + return contextStackCursor.current; + } +} + +function cacheContext(workInProgress, unmaskedContext, maskedContext) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + } +} + +function getMaskedContext(workInProgress, unmaskedContext) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + var type = workInProgress.type; + var contextTypes = type.contextTypes; + if (!contextTypes) { + return emptyContextObject; + } + + // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) { + return instance.__reactInternalMemoizedMaskedChildContext; + } + + var context = {}; + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } + + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + contextTypes, + context, + "context", + name, + getCurrentFiberStackInDev + ); + } + + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } + + return context; + } +} + +function hasContextChanged() { + if (disableLegacyContext) { + return false; + } else { + return didPerformWorkStackCursor.current; + } +} + +function isContextProvider(type) { + if (disableLegacyContext) { + return false; + } else { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } +} + +function popContext(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } +} + +function popTopLevelContextObject(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } +} + +function pushTopLevelContextObject(fiber, context, didChange) { + if (disableLegacyContext) { + return; + } else { + (function() { + if (!(contextStackCursor.current === emptyContextObject)) { + throw ReactError( + Error( + "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(fiber, type, parentContext) { + if (disableLegacyContext) { + return parentContext; + } else { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; + + // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== "function") { + { + var componentName = getComponentName(type) || "Unknown"; + + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + warningWithoutStack$1( + false, + "%s.childContextTypes is specified but there is no getChildContext() method " + + "on the instance. You can either define getChildContext() on %s or remove " + + "childContextTypes from it.", + componentName, + componentName + ); + } + } + return parentContext; + } + + var childContext = void 0; + { + setCurrentPhase("getChildContext"); + } + startPhaseTimer(fiber, "getChildContext"); + childContext = instance.getChildContext(); + stopPhaseTimer(); + { + setCurrentPhase(null); + } + for (var contextKey in childContext) { + (function() { + if (!(contextKey in childContextTypes)) { + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + } + })(); + } + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + childContextTypes, + childContext, + "child context", + name, + // In practice, there is one case in which we won't get a stack. It's when + // somebody calls unstable_renderSubtreeIntoContainer() and we process + // context from the parent component instance. The stack will be missing + // because it's outside of the reconciliation, and so the pointer has not + // been set. This is rare and doesn't matter. We'll also remove that API. + getCurrentFiberStackInDev + ); + } + + return Object.assign({}, parentContext, childContext); + } +} + +function pushContextProvider(workInProgress) { + if (disableLegacyContext) { + return false; + } else { + var instance = workInProgress.stateNode; + // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + + // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. + previousContext = contextStackCursor.current; + push(contextStackCursor, memoizedMergedChildContext, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + + return true; + } +} + +function invalidateContextProvider(workInProgress, type, didChange) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + (function() { + if (!instance) { + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext( + workInProgress, + type, + previousContext + ); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; + + // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor, workInProgress); + // Now push the new context and mark that it has changed. + push(contextStackCursor, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } + } +} + +function findCurrentUnmaskedContext(fiber) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + (function() { + if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + var node = fiber; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; + case ClassComponent: { + var Component = node.type; + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; + } + break; + } + } + node = node.return; + } while (node !== null); + (function() { + { + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } +} + +var LegacyRoot = 0; +var BatchedRoot = 1; +var ConcurrentRoot = 2; + +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority; +var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback; +var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback; +var Scheduler_shouldYield = Scheduler.unstable_shouldYield; +var Scheduler_requestPaint = Scheduler.unstable_requestPaint; +var Scheduler_now = Scheduler.unstable_now; +var Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel; +var Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var Scheduler_NormalPriority = Scheduler.unstable_NormalPriority; +var Scheduler_LowPriority = Scheduler.unstable_LowPriority; +var Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; + +if (enableSchedulerTracing) { + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + (function() { + if ( + !( + tracing.__interactionsRef != null && + tracing.__interactionsRef.current != null + ) + ) { + throw ReactError( + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) + ); + } + })(); +} + +var fakeCallbackNode = {}; + +// Except for NoPriority, these correspond to Scheduler priorities. We use +// ascending numbers so we can compare them like numbers. They start at 90 to +// avoid clashing with Scheduler's priorities. +var ImmediatePriority = 99; +var UserBlockingPriority$1 = 98; +var NormalPriority = 97; +var LowPriority = 96; +var IdlePriority = 95; +// NoPriority is the absence of priority. Also React-only. +var NoPriority = 90; + +var shouldYield = Scheduler_shouldYield; +var requestPaint = + // Fall back gracefully if we're running an older version of Scheduler. + Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; + +var syncQueue = null; +var immediateQueueCallbackNode = null; +var isFlushingSyncQueue = false; +var initialTimeMs = Scheduler_now(); + +// If the initial timestamp is reasonably small, use Scheduler's `now` directly. +// This will be the case for modern browsers that support `performance.now`. In +// older browsers, Scheduler falls back to `Date.now`, which returns a Unix +// timestamp. In that case, subtract the module initialization time to simulate +// the behavior of performance.now and keep our times small enough to fit +// within 32 bits. +// TODO: Consider lifting this into Scheduler. +var now = + initialTimeMs < 10000 + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; + +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return ImmediatePriority; + case Scheduler_UserBlockingPriority: + return UserBlockingPriority$1; + case Scheduler_NormalPriority: + return NormalPriority; + case Scheduler_LowPriority: + return LowPriority; + case Scheduler_IdlePriority: + return IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case ImmediatePriority: + return Scheduler_ImmediatePriority; + case UserBlockingPriority$1: + return Scheduler_UserBlockingPriority; + case NormalPriority: + return Scheduler_NormalPriority; + case LowPriority: + return Scheduler_LowPriority; + case IdlePriority: + return Scheduler_IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function runWithPriority$1(reactPriorityLevel, fn) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(priorityLevel, fn); +} + +function scheduleCallback(reactPriorityLevel, callback, options) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(priorityLevel, callback, options); +} + +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + // Flush the queue in the next tick, at the earliest. + immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ); + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } + return fakeCallbackNode; +} + +function cancelCallback(callbackNode) { + if (callbackNode !== fakeCallbackNode) { + Scheduler_cancelCallback(callbackNode); + } +} + +function flushSyncCallbackQueue() { + if (immediateQueueCallbackNode !== null) { + Scheduler_cancelCallback(immediateQueueCallbackNode); + } + flushSyncCallbackQueueImpl(); +} + +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + try { + var _isSync = true; + var queue = syncQueue; + runWithPriority$1(ImmediatePriority, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + callback = callback(_isSync); + } while (callback !== null); + } + }); + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); + } + // Resume flushing in the next tick + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ); + throw error; + } finally { + isFlushingSyncQueue = false; + } + } +} + +var NoMode = 0; +var StrictMode = 1; +// TODO: Remove BatchedMode and ConcurrentMode by reading from the root +// tag instead +var BatchedMode = 2; +var ConcurrentMode = 4; +var ProfileMode = 8; + +// Max 31 bit integer. The max integer size in V8 for 32-bit systems. +// Math.pow(2, 30) - 1 +// 0b111111111111111111111111111111 +var MAX_SIGNED_31_BIT_INT = 1073741823; + +var NoWork = 0; +var Never = 1; +var Sync = MAX_SIGNED_31_BIT_INT; +var Batched = Sync - 1; + +var UNIT_SIZE = 10; +var MAGIC_NUMBER_OFFSET = Batched - 1; + +// 1 unit of expiration time represents 10ms. +function msToExpirationTime(ms) { + // Always add an offset so that we don't clash with the magic number for NoWork. + return MAGIC_NUMBER_OFFSET - ((ms / UNIT_SIZE) | 0); +} + +function expirationTimeToMs(expirationTime) { + return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE; +} + +function ceiling(num, precision) { + return (((num / precision) | 0) + 1) * precision; +} + +function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { + return ( + MAGIC_NUMBER_OFFSET - + ceiling( + MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, + bucketSizeMs / UNIT_SIZE + ) + ); +} + +// TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update +// the names to reflect. +var LOW_PRIORITY_EXPIRATION = 5000; +var LOW_PRIORITY_BATCH_SIZE = 250; + +function computeAsyncExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + LOW_PRIORITY_EXPIRATION, + LOW_PRIORITY_BATCH_SIZE + ); +} + +function computeSuspenseExpiration(currentTime, timeoutMs) { + // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time? + return computeExpirationBucket( + currentTime, + timeoutMs, + LOW_PRIORITY_BATCH_SIZE + ); +} + +// We intentionally set a higher expiration time for interactive updates in +// dev than in production. +// +// If the main thread is being blocked so long that you hit the expiration, +// it's a problem that could be solved with better scheduling. +// +// People will be more likely to notice this and fix it with the long +// expiration time in development. +// +// In production we opt for better UX at the risk of masking scheduling +// problems, by expiring fast. +var HIGH_PRIORITY_EXPIRATION = 500; +var HIGH_PRIORITY_BATCH_SIZE = 100; + +function computeInteractiveExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + HIGH_PRIORITY_EXPIRATION, + HIGH_PRIORITY_BATCH_SIZE + ); +} + +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (expirationTime === Sync) { + return ImmediatePriority; + } + if (expirationTime === Never) { + return IdlePriority; + } + var msUntil = + expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime); + if (msUntil <= 0) { + return ImmediatePriority; + } + if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) { + return UserBlockingPriority$1; + } + if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) { + return NormalPriority; + } + + // TODO: Handle LowPriority + + // Assume anything lower has idle priority + return IdlePriority; +} + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return ( + (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare + ); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if ( + typeof objA !== "object" || + objA === null || + typeof objB !== "object" || + objB === null + ) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if ( + !hasOwnProperty.call(objB, keysA[i]) || + !is(objA[keysA[i]], objB[keysA[i]]) + ) { + return false; + } + } + + return true; +} + +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * 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 lowPriorityWarning = function() {}; + +{ + var 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; + var message = + "Warning: " + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== "undefined") { + console.warn(message); + } + 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. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function(condition, format) { + if (format === undefined) { + throw new Error( + "`lowPriorityWarning(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(undefined, [format].concat(args)); + } + }; +} + +var lowPriorityWarning$1 = lowPriorityWarning; + +var ReactStrictModeWarnings = { + recordUnsafeLifecycleWarnings: function(fiber, instance) {}, + flushPendingUnsafeLifecycleWarnings: function() {}, + recordLegacyContextWarning: function(fiber, instance) {}, + flushLegacyContextWarning: function() {}, + discardPendingWarnings: function() {} +}; + +{ + var findStrictRoot = function(fiber) { + var maybeStrictRoot = null; + + var node = fiber; + while (node !== null) { + if (node.mode & StrictMode) { + maybeStrictRoot = node; + } + node = node.return; + } + + return maybeStrictRoot; + }; + + var setToSortedString = function(set) { + var array = []; + set.forEach(function(value) { + array.push(value); + }); + return array.sort().join(", "); + }; + + var pendingComponentWillMountWarnings = []; + var pendingUNSAFE_ComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUNSAFE_ComponentWillUpdateWarnings = []; + + // Tracks components we have already warned about. + var didWarnAboutUnsafeLifecycles = new Set(); + + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( + fiber, + instance + ) { + // Dedup strategy: Warn once per component. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { + return; + } + + if ( + typeof instance.componentWillMount === "function" && + // Don't warn about react-lifecycles-compat polyfilled components. + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + pendingComponentWillMountWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillMount === "function" + ) { + pendingUNSAFE_ComponentWillMountWarnings.push(fiber); + } + + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + pendingComponentWillReceivePropsWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); + } + + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + pendingComponentWillUpdateWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillUpdate === "function" + ) { + pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); + } + }; + + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { + // We do an initial pass to gather component names + var componentWillMountUniqueNames = new Set(); + if (pendingComponentWillMountWarnings.length > 0) { + pendingComponentWillMountWarnings.forEach(function(fiber) { + componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillMountWarnings = []; + } + + var UNSAFE_componentWillMountUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { + pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { + UNSAFE_componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillMountWarnings = []; + } + + var componentWillReceivePropsUniqueNames = new Set(); + if (pendingComponentWillReceivePropsWarnings.length > 0) { + pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { + componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingComponentWillReceivePropsWarnings = []; + } + + var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { + UNSAFE_componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + } + + var componentWillUpdateUniqueNames = new Set(); + if (pendingComponentWillUpdateWarnings.length > 0) { + pendingComponentWillUpdateWarnings.forEach(function(fiber) { + componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingComponentWillUpdateWarnings = []; + } + + var UNSAFE_componentWillUpdateUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { + pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { + UNSAFE_componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingUNSAFE_ComponentWillUpdateWarnings = []; + } + + // Finally, we flush all the warnings + // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' + if (UNSAFE_componentWillMountUniqueNames.size > 0) { + var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "\nPlease update the following components: %s", + sortedNames + ); + } + + if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames = setToSortedString( + UNSAFE_componentWillReceivePropsUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillReceiveProps in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, " + + "refactor your code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "\nPlease update the following components: %s", + _sortedNames + ); + } + + if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { + var _sortedNames2 = setToSortedString( + UNSAFE_componentWillUpdateUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillUpdate in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "\nPlease update the following components: %s", + _sortedNames2 + ); + } + + if (componentWillMountUniqueNames.size > 0) { + var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); + + lowPriorityWarning$1( + false, + "componentWillMount has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "* Rename componentWillMount to UNSAFE_componentWillMount to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames3 + ); + } + + if (componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames4 = setToSortedString( + componentWillReceivePropsUniqueNames + ); + + lowPriorityWarning$1( + false, + "componentWillReceiveProps has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, refactor your " + + "code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames4 + ); + } + + if (componentWillUpdateUniqueNames.size > 0) { + var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); + + lowPriorityWarning$1( + false, + "componentWillUpdate has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames5 + ); + } + }; + + var pendingLegacyContextWarning = new Map(); + + // Tracks components we have already warned about. + var didWarnAboutLegacyContext = new Set(); + + ReactStrictModeWarnings.recordLegacyContextWarning = function( + fiber, + instance + ) { + var strictRoot = findStrictRoot(fiber); + if (strictRoot === null) { + warningWithoutStack$1( + false, + "Expected to find a StrictMode component in a strict mode tree. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + return; + } + + // Dedup strategy: Warn once per component. + if (didWarnAboutLegacyContext.has(fiber.type)) { + return; + } + + var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); + + if ( + fiber.type.contextTypes != null || + fiber.type.childContextTypes != null || + (instance !== null && typeof instance.getChildContext === "function") + ) { + if (warningsForRoot === undefined) { + warningsForRoot = []; + pendingLegacyContextWarning.set(strictRoot, warningsForRoot); + } + warningsForRoot.push(fiber); + } + }; + + ReactStrictModeWarnings.flushLegacyContextWarning = function() { + pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) { + var uniqueNames = new Set(); + fiberArray.forEach(function(fiber) { + uniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutLegacyContext.add(fiber.type); + }); + + var sortedNames = setToSortedString(uniqueNames); + var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); + + warningWithoutStack$1( + false, + "Legacy context API has been detected within a strict-mode tree: %s" + + "\n\nThe old API will be supported in all 16.x releases, but applications " + + "using it should migrate to the new version." + + "\n\nPlease update the following components: %s" + + "\n\nLearn more about this warning here:" + + "\nhttps://fb.me/react-legacy-context", + strictRootComponentStack, + sortedNames + ); + }); + }; + + ReactStrictModeWarnings.discardPendingWarnings = function() { + pendingComponentWillMountWarnings = []; + pendingUNSAFE_ComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUNSAFE_ComponentWillUpdateWarnings = []; + pendingLegacyContextWarning = new Map(); + }; +} + +// Resolves type to a family. + +// Used by React Refresh runtime through DevTools Global Hook. + +var resolveFamily = null; +// $FlowFixMe Flow gets confused by a WeakSet feature check below. +var failedBoundaries = null; + +var setRefreshHandler = function(handler) { + { + resolveFamily = handler; + } +}; + +function resolveFunctionForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + return type; + } + // Use the latest known implementation. + return family.current; + } +} + +function resolveClassForHotReloading(type) { + // No implementation differences. + return resolveFunctionForHotReloading(type); +} + +function resolveForwardRefForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + // Check if we're dealing with a real forwardRef. Don't want to crash early. + if ( + type !== null && + type !== undefined && + typeof type.render === "function" + ) { + // ForwardRef is special because its resolved .type is an object, + // but it's possible that we only have its inner render function in the map. + // If that inner render function is different, we'll build a new forwardRef type. + var currentRender = resolveFunctionForHotReloading(type.render); + if (type.render !== currentRender) { + var syntheticType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: currentRender + }; + if (type.displayName !== undefined) { + syntheticType.displayName = type.displayName; + } + return syntheticType; + } + } + return type; + } + // Use the latest known implementation. + return family.current; + } +} + +function isCompatibleFamilyForHotReloading(fiber, element) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return false; + } + + var prevType = fiber.elementType; + var nextType = element.type; + + // If we got here, we know types aren't === equal. + var needsCompareFamilies = false; + + var $$typeofNextType = + typeof nextType === "object" && nextType !== null + ? nextType.$$typeof + : null; + + switch (fiber.tag) { + case ClassComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } + break; + } + case FunctionComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + // We don't know the inner type yet. + // We're going to assume that the lazy inner type is stable, + // and so it is sufficient to avoid reconciling it away. + // We're not going to unwrap or actually use the new lazy type. + needsCompareFamilies = true; + } + break; + } + case ForwardRef: { + if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + case MemoComponent: + case SimpleMemoComponent: { + if ($$typeofNextType === REACT_MEMO_TYPE) { + // TODO: if it was but can no longer be simple, + // we shouldn't set this. + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + default: + return false; + } + + // Check if both types have a family and it's the same one. + if (needsCompareFamilies) { + // Note: memo() and forwardRef() we'll compare outer rather than inner type. + // This means both of them need to be registered to preserve state. + // If we unwrapped and compared the inner types for wrappers instead, + // then we would risk falsely saying two separate memo(Foo) + // calls are equivalent because they wrap the same Foo function. + var prevFamily = resolveFamily(prevType); + if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { + return true; + } + } + return false; + } +} + +function markFailedErrorBoundaryForHotReloading(fiber) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + if (typeof WeakSet !== "function") { + return; + } + if (failedBoundaries === null) { + failedBoundaries = new WeakSet(); + } + failedBoundaries.add(fiber); + } +} + +var scheduleRefresh = function(root, update) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + var _staleFamilies = update.staleFamilies, + _updatedFamilies = update.updatedFamilies; + + flushPassiveEffects(); + flushSync(function() { + scheduleFibersWithFamiliesRecursively( + root.current, + _updatedFamilies, + _staleFamilies + ); + }); + } +}; + +var scheduleRoot = function(root, element) { + { + if (root.context !== emptyContextObject) { + // Super edge case: root has a legacy _renderSubtree context + // but we don't know the parentComponent so we can't pass it. + // Just ignore. We'll delete this with _renderSubtree code path later. + return; + } + flushPassiveEffects(); + updateContainerAtExpirationTime(element, root, null, Sync, null); + } +}; + +function scheduleFibersWithFamiliesRecursively( + fiber, + updatedFamilies, + staleFamilies +) { + { + var alternate = fiber.alternate, + child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + if (resolveFamily === null) { + throw new Error("Expected resolveFamily to be set during hot reload."); + } + + var needsRender = false; + var needsRemount = false; + if (candidateType !== null) { + var family = resolveFamily(candidateType); + if (family !== undefined) { + if (staleFamilies.has(family)) { + needsRemount = true; + } else if (updatedFamilies.has(family)) { + if (tag === ClassComponent) { + needsRemount = true; + } else { + needsRender = true; + } + } + } + } + if (failedBoundaries !== null) { + if ( + failedBoundaries.has(fiber) || + (alternate !== null && failedBoundaries.has(alternate)) + ) { + needsRemount = true; + } + } + + if (needsRemount) { + fiber._debugNeedsRemount = true; + } + if (needsRemount || needsRender) { + scheduleWork(fiber, Sync); + } + if (child !== null && !needsRemount) { + scheduleFibersWithFamiliesRecursively( + child, + updatedFamilies, + staleFamilies + ); + } + if (sibling !== null) { + scheduleFibersWithFamiliesRecursively( + sibling, + updatedFamilies, + staleFamilies + ); + } + } +} + +var findHostInstancesForRefresh = function(root, families) { + { + var hostInstances = new Set(); + var types = new Set( + families.map(function(family) { + return family.current; + }) + ); + findHostInstancesForMatchingFibersRecursively( + root.current, + types, + hostInstances + ); + return hostInstances; + } +}; + +function findHostInstancesForMatchingFibersRecursively( + fiber, + types, + hostInstances +) { + { + var child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + var didMatch = false; + if (candidateType !== null) { + if (types.has(candidateType)) { + didMatch = true; + } + } + + if (didMatch) { + // We have a match. This only drills down to the closest host components. + // There's no need to search deeper because for the purpose of giving + // visual feedback, "flashing" outermost parent rectangles is sufficient. + findHostInstancesForFiberShallowly(fiber, hostInstances); + } else { + // If there's no match, maybe there will be one further down in the child tree. + if (child !== null) { + findHostInstancesForMatchingFibersRecursively( + child, + types, + hostInstances + ); + } + } + + if (sibling !== null) { + findHostInstancesForMatchingFibersRecursively( + sibling, + types, + hostInstances + ); + } + } +} + +function findHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var foundHostInstances = findChildHostInstancesForFiberShallowly( + fiber, + hostInstances + ); + if (foundHostInstances) { + return; + } + // If we didn't find any host children, fallback to closest host parent. + var node = fiber; + while (true) { + switch (node.tag) { + case HostComponent: + hostInstances.add(node.stateNode); + return; + case HostPortal: + hostInstances.add(node.stateNode.containerInfo); + return; + case HostRoot: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (node.return === null) { + throw new Error("Expected to reach root first."); + } + node = node.return; + } + } +} + +function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var node = fiber; + var foundHostInstances = false; + while (true) { + if (node.tag === HostComponent) { + // We got a match. + foundHostInstances = true; + hostInstances.add(node.stateNode); + // There may still be more, so keep searching. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === fiber) { + return foundHostInstances; + } + while (node.sibling === null) { + if (node.return === null || node.return === fiber) { + return foundHostInstances; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return false; +} + +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + // Resolve default props. Taken from ReactElement + var props = Object.assign({}, baseProps); + var defaultProps = Component.defaultProps; + for (var propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + return props; + } + return baseProps; +} + +function readLazyComponentType(lazyComponent) { + var status = lazyComponent._status; + var result = lazyComponent._result; + switch (status) { + case Resolved: { + var Component = result; + return Component; + } + case Rejected: { + var error = result; + throw error; + } + case Pending: { + var thenable = result; + throw thenable; + } + default: { + lazyComponent._status = Pending; + var ctor = lazyComponent._ctor; + var _thenable = ctor(); + _thenable.then( + function(moduleObject) { + if (lazyComponent._status === Pending) { + var defaultExport = moduleObject.default; + { + if (defaultExport === undefined) { + warning$1( + false, + "lazy: Expected the result of a dynamic import() call. " + + "Instead received: %s\n\nYour code should look like: \n " + + "const MyComponent = lazy(() => import('./MyComponent'))", + moduleObject + ); + } + } + lazyComponent._status = Resolved; + lazyComponent._result = defaultExport; + } + }, + function(error) { + if (lazyComponent._status === Pending) { + lazyComponent._status = Rejected; + lazyComponent._result = error; + } + } + ); + // Handle synchronous thenables. + switch (lazyComponent._status) { + case Resolved: + return lazyComponent._result; + case Rejected: + throw lazyComponent._result; + } + lazyComponent._result = _thenable; + throw _thenable; + } + } +} + +var valueCursor = createCursor(null); + +var rendererSigil = void 0; +{ + // Use this to detect multiple renderers using the same context + rendererSigil = {}; +} + +var currentlyRenderingFiber = null; +var lastContextDependency = null; +var lastContextWithAllBitsObserved = null; + +var isDisallowedContextReadInDEV = false; + +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber = null; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + { + isDisallowedContextReadInDEV = false; + } +} + +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} + +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} + +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + + if (isPrimaryRenderer) { + push(valueCursor, context._currentValue, providerFiber); + + context._currentValue = nextValue; + { + !( + context._currentRenderer === undefined || + context._currentRenderer === null || + context._currentRenderer === rendererSigil + ) + ? warningWithoutStack$1( + false, + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ) + : void 0; + context._currentRenderer = rendererSigil; + } + } else { + push(valueCursor, context._currentValue2, providerFiber); + + context._currentValue2 = nextValue; + { + !( + context._currentRenderer2 === undefined || + context._currentRenderer2 === null || + context._currentRenderer2 === rendererSigil + ) + ? warningWithoutStack$1( + false, + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ) + : void 0; + context._currentRenderer2 = rendererSigil; + } + } +} + +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + + pop(valueCursor, providerFiber); + + var context = providerFiber.type._context; + if (isPrimaryRenderer) { + context._currentValue = currentValue; + } else { + context._currentValue2 = currentValue; + } +} + +function calculateChangedBits(context, newValue, oldValue) { + if (is(oldValue, newValue)) { + // No change + return 0; + } else { + var changedBits = + typeof context._calculateChangedBits === "function" + ? context._calculateChangedBits(oldValue, newValue) + : MAX_SIGNED_31_BIT_INT; + + { + !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) + ? warning$1( + false, + "calculateChangedBits: Expected the return value to be a " + + "31-bit integer. Instead received: %s", + changedBits + ) + : void 0; + } + return changedBits | 0; + } +} + +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + // Update the child expiration time of all the ancestors, including + // the alternates. + var node = parent; + while (node !== null) { + var alternate = node.alternate; + if (node.childExpirationTime < renderExpirationTime) { + node.childExpirationTime = renderExpirationTime; + if ( + alternate !== null && + alternate.childExpirationTime < renderExpirationTime + ) { + alternate.childExpirationTime = renderExpirationTime; + } + } else if ( + alternate !== null && + alternate.childExpirationTime < renderExpirationTime + ) { + alternate.childExpirationTime = renderExpirationTime; + } else { + // Neither alternate was updated, which means the rest of the + // ancestor path already has sufficient priority. + break; + } + node = node.return; + } +} + +function propagateContextChange( + workInProgress, + context, + changedBits, + renderExpirationTime +) { + var fiber = workInProgress.child; + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + while (fiber !== null) { + var nextFiber = void 0; + + // Visit this fiber. + var list = fiber.dependencies; + if (list !== null) { + nextFiber = fiber.child; + + var dependency = list.firstContext; + while (dependency !== null) { + // Check if the context matches. + if ( + dependency.context === context && + (dependency.observedBits & changedBits) !== 0 + ) { + // Match! Schedule an update on this fiber. + + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var update = createUpdate(renderExpirationTime, null); + update.tag = ForceUpdate; + // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + enqueueUpdate(fiber, update); + } + + if (fiber.expirationTime < renderExpirationTime) { + fiber.expirationTime = renderExpirationTime; + } + var alternate = fiber.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + + scheduleWorkOnParentPath(fiber.return, renderExpirationTime); + + // Mark the expiration time on the list, too. + if (list.expirationTime < renderExpirationTime) { + list.expirationTime = renderExpirationTime; + } + + // Since we already found a match, we can stop traversing the + // dependency list. + break; + } + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if ( + enableSuspenseServerRenderer && + fiber.tag === DehydratedSuspenseComponent + ) { + // If a dehydrated suspense component is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates on its children. + if (fiber.expirationTime < renderExpirationTime) { + fiber.expirationTime = renderExpirationTime; + } + var _alternate = fiber.alternate; + if ( + _alternate !== null && + _alternate.expirationTime < renderExpirationTime + ) { + _alternate.expirationTime = renderExpirationTime; + } + // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childExpirationTime on + // this fiber to indicate that a context has changed. + scheduleWorkOnParentPath(fiber, renderExpirationTime); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + var sibling = nextFiber.sibling; + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } + // No more siblings. Traverse up. + nextFiber = nextFiber.return; + } + } + fiber = nextFiber; + } +} + +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + + var dependencies = workInProgress.dependencies; + if (dependencies !== null) { + var firstContext = dependencies.firstContext; + if (firstContext !== null) { + if (dependencies.expirationTime >= renderExpirationTime) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } + // Reset the work-in-progress list + dependencies.firstContext = null; + } + } +} + +function readContext(context, observedBits) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + !!isDisallowedContextReadInDEV + ? warning$1( + false, + "Context can only be read while React is rendering. " + + "In classes, you can read it in the render method or getDerivedStateFromProps. " + + "In function components, you can read it directly in the function body, but not " + + "inside Hooks like useReducer() or useMemo()." + ) + : void 0; + } + + if (lastContextWithAllBitsObserved === context) { + // Nothing to do. We already observe everything in this context. + } else if (observedBits === false || observedBits === 0) { + // Do not observe any updates. + } else { + var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types. + if ( + typeof observedBits !== "number" || + observedBits === MAX_SIGNED_31_BIT_INT + ) { + // Observe all updates. + lastContextWithAllBitsObserved = context; + resolvedObservedBits = MAX_SIGNED_31_BIT_INT; + } else { + resolvedObservedBits = observedBits; + } + + var contextItem = { + context: context, + observedBits: resolvedObservedBits, + next: null + }; + + if (lastContextDependency === null) { + (function() { + if (!(currentlyRenderingFiber !== null)) { + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + } + })(); + + // This is the first dependency for this component. Create a new list. + lastContextDependency = contextItem; + currentlyRenderingFiber.dependencies = { + expirationTime: NoWork, + firstContext: contextItem, + responders: null + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + return isPrimaryRenderer ? context._currentValue : context._currentValue2; +} + +// UpdateQueue is a linked list of prioritized updates. +// +// Like fibers, update queues come in pairs: a current queue, which represents +// the visible state of the screen, and a work-in-progress queue, which can be +// mutated and processed asynchronously before it is committed — a form of +// double buffering. If a work-in-progress render is discarded before finishing, +// we create a new work-in-progress by cloning the current queue. +// +// Both queues share a persistent, singly-linked list structure. To schedule an +// update, we append it to the end of both queues. Each queue maintains a +// pointer to first update in the persistent list that hasn't been processed. +// The work-in-progress pointer always has a position equal to or greater than +// the current queue, since we always work on that one. The current queue's +// pointer is only updated during the commit phase, when we swap in the +// work-in-progress. +// +// For example: +// +// Current pointer: A - B - C - D - E - F +// Work-in-progress pointer: D - E - F +// ^ +// The work-in-progress queue has +// processed more updates than current. +// +// The reason we append to both queues is because otherwise we might drop +// updates without ever processing them. For example, if we only add updates to +// the work-in-progress queue, some updates could be lost whenever a work-in +// -progress render restarts by cloning from current. Similarly, if we only add +// updates to the current queue, the updates will be lost whenever an already +// in-progress queue commits and swaps with the current queue. However, by +// adding to both queues, we guarantee that the update will be part of the next +// work-in-progress. (And because the work-in-progress queue becomes the +// current queue once it commits, there's no danger of applying the same +// update twice.) +// +// Prioritization +// -------------- +// +// Updates are not sorted by priority, but by insertion; new updates are always +// appended to the end of the list. +// +// The priority is still important, though. When processing the update queue +// during the render phase, only the updates with sufficient priority are +// included in the result. If we skip an update because it has insufficient +// priority, it remains in the queue to be processed later, during a lower +// priority render. Crucially, all updates subsequent to a skipped update also +// remain in the queue *regardless of their priority*. That means high priority +// updates are sometimes processed twice, at two separate priorities. We also +// keep track of a base state, that represents the state before the first +// update in the queue is applied. +// +// For example: +// +// Given a base state of '', and the following queue of updates +// +// A1 - B2 - C1 - D2 +// +// where the number indicates the priority, and the update is applied to the +// previous state by appending a letter, React will process these updates as +// two separate renders, one per distinct priority level: +// +// First render, at priority 1: +// Base state: '' +// Updates: [A1, C1] +// Result state: 'AC' +// +// Second render, at priority 2: +// Base state: 'A' <- The base state does not include C1, +// because B2 was skipped. +// Updates: [B2, C1, D2] <- C1 was rebased on top of B2 +// Result state: 'ABCD' +// +// Because we process updates in insertion order, and rebase high priority +// updates when preceding updates are skipped, the final result is deterministic +// regardless of priority. Intermediate state may vary according to system +// resources, but the final state is always the same. + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; + +// Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. +var hasForceUpdate = false; + +var didWarnUpdateInsideUpdate = void 0; +var currentlyProcessingQueue = void 0; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function createUpdateQueue(baseState) { + var queue = { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; + return queue; +} + +function cloneUpdateQueue(currentQueue) { + var queue = { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + + // TODO: With resuming, if we bail out and resuse the child tree, we should + // keep these effects. + firstCapturedUpdate: null, + lastCapturedUpdate: null, + + firstEffect: null, + lastEffect: null, + + firstCapturedEffect: null, + lastCapturedEffect: null + }; + return queue; +} + +function createUpdate(expirationTime, suspenseConfig) { + var update = { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + + tag: UpdateState, + payload: null, + callback: null, + + next: null, + nextEffect: null + }; + { + update.priority = getCurrentPriorityLevel(); + } + return update; +} + +function appendUpdateToQueue(queue, update) { + // Append the update to the end of the list. + if (queue.lastUpdate === null) { + // Queue is empty + queue.firstUpdate = queue.lastUpdate = update; + } else { + queue.lastUpdate.next = update; + queue.lastUpdate = update; + } +} + +function enqueueUpdate(fiber, update) { + // Update queues are created lazily. + var alternate = fiber.alternate; + var queue1 = void 0; + var queue2 = void 0; + if (alternate === null) { + // There's only one fiber. + queue1 = fiber.updateQueue; + queue2 = null; + if (queue1 === null) { + queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState); + } + } else { + // There are two owners. + queue1 = fiber.updateQueue; + queue2 = alternate.updateQueue; + if (queue1 === null) { + if (queue2 === null) { + // Neither fiber has an update queue. Create new ones. + queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState); + queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ); + } else { + // Only one fiber has an update queue. Clone to create a new one. + queue1 = fiber.updateQueue = cloneUpdateQueue(queue2); + } + } else { + if (queue2 === null) { + // Only one fiber has an update queue. Clone to create a new one. + queue2 = alternate.updateQueue = cloneUpdateQueue(queue1); + } else { + // Both owners have an update queue. + } + } + } + if (queue2 === null || queue1 === queue2) { + // There's only a single queue. + appendUpdateToQueue(queue1, update); + } else { + // There are two queues. We need to append the update to both queues, + // while accounting for the persistent structure of the list — we don't + // want the same update to be added multiple times. + if (queue1.lastUpdate === null || queue2.lastUpdate === null) { + // One of the queues is not empty. We must add the update to both queues. + appendUpdateToQueue(queue1, update); + appendUpdateToQueue(queue2, update); + } else { + // Both queues are non-empty. The last update is the same in both lists, + // because of structural sharing. So, only append to one of the lists. + appendUpdateToQueue(queue1, update); + // But we still need to update the `lastUpdate` pointer of queue2. + queue2.lastUpdate = update; + } + } + + { + if ( + fiber.tag === ClassComponent && + (currentlyProcessingQueue === queue1 || + (queue2 !== null && currentlyProcessingQueue === queue2)) && + !didWarnUpdateInsideUpdate + ) { + warningWithoutStack$1( + false, + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + didWarnUpdateInsideUpdate = true; + } + } +} + +function enqueueCapturedUpdate(workInProgress, update) { + // Captured updates go into a separate list, and only on the work-in- + // progress queue. + var workInProgressQueue = workInProgress.updateQueue; + if (workInProgressQueue === null) { + workInProgressQueue = workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + ); + } else { + // TODO: I put this here rather than createWorkInProgress so that we don't + // clone the queue unnecessarily. There's probably a better way to + // structure this. + workInProgressQueue = ensureWorkInProgressQueueIsAClone( + workInProgress, + workInProgressQueue + ); + } + + // Append the update to the end of the list. + if (workInProgressQueue.lastCapturedUpdate === null) { + // This is the first render phase update + workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update; + } else { + workInProgressQueue.lastCapturedUpdate.next = update; + workInProgressQueue.lastCapturedUpdate = update; + } +} + +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + if (current !== null) { + // If the work-in-progress queue is equal to the current queue, + // we need to clone it first. + if (queue === current.updateQueue) { + queue = workInProgress.updateQueue = cloneUpdateQueue(queue); + } + } + return queue; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var _payload = update.payload; + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + _payload.call(instance, prevState, nextProps); + } + } + var nextState = _payload.call(instance, prevState, nextProps); + { + exitDisallowedContextReadInDEV(); + } + return nextState; + } + // State object + return _payload; + } + case CaptureUpdate: { + workInProgress.effectTag = + (workInProgress.effectTag & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + case UpdateState: { + var _payload2 = update.payload; + var partialState = void 0; + if (typeof _payload2 === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + _payload2.call(instance, prevState, nextProps); + } + } + partialState = _payload2.call(instance, prevState, nextProps); + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload2; + } + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } + // Merge the partial state and the previous state. + return Object.assign({}, prevState, partialState); + } + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + return prevState; +} + +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = false; + + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + + { + currentlyProcessingQueue = queue; + } + + // These values may change as we process the queue. + var newBaseState = queue.baseState; + var newFirstUpdate = null; + var newExpirationTime = NoWork; + + // Iterate through the list of updates to compute the result. + var update = queue.firstUpdate; + var resultState = newBaseState; + while (update !== null) { + var updateExpirationTime = update.expirationTime; + if (updateExpirationTime < renderExpirationTime) { + // This update does not have sufficient priority. Skip it. + if (newFirstUpdate === null) { + // This is the first skipped update. It will be the first update in + // the new list. + newFirstUpdate = update; + // Since this is the first update that was skipped, the current result + // is the new base state. + newBaseState = resultState; + } + // Since this update will remain in the list, update the remaining + // expiration time. + if (newExpirationTime < updateExpirationTime) { + newExpirationTime = updateExpirationTime; + } + } else { + // This update does have sufficient priority. + + // Mark the event time of this update as relevant to this render pass. + // TODO: This should ideally use the true event time of this update rather than + // its priority which is a derived and not reverseable value. + // TODO: We should skip this update if it was already committed but currently + // we have no way of detecting the difference between a committed and suspended + // update here. + markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); + + // Process it and compute a new result. + resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + ); + var _callback = update.callback; + if (_callback !== null) { + workInProgress.effectTag |= Callback; + // Set this to null, in case it was mutated during an aborted render. + update.nextEffect = null; + if (queue.lastEffect === null) { + queue.firstEffect = queue.lastEffect = update; + } else { + queue.lastEffect.nextEffect = update; + queue.lastEffect = update; + } + } + } + // Continue to the next update. + update = update.next; + } + + // Separately, iterate though the list of captured updates. + var newFirstCapturedUpdate = null; + update = queue.firstCapturedUpdate; + while (update !== null) { + var _updateExpirationTime = update.expirationTime; + if (_updateExpirationTime < renderExpirationTime) { + // This update does not have sufficient priority. Skip it. + if (newFirstCapturedUpdate === null) { + // This is the first skipped captured update. It will be the first + // update in the new list. + newFirstCapturedUpdate = update; + // If this is the first update that was skipped, the current result is + // the new base state. + if (newFirstUpdate === null) { + newBaseState = resultState; + } + } + // Since this update will remain in the list, update the remaining + // expiration time. + if (newExpirationTime < _updateExpirationTime) { + newExpirationTime = _updateExpirationTime; + } + } else { + // This update does have sufficient priority. Process it and compute + // a new result. + resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + ); + var _callback2 = update.callback; + if (_callback2 !== null) { + workInProgress.effectTag |= Callback; + // Set this to null, in case it was mutated during an aborted render. + update.nextEffect = null; + if (queue.lastCapturedEffect === null) { + queue.firstCapturedEffect = queue.lastCapturedEffect = update; + } else { + queue.lastCapturedEffect.nextEffect = update; + queue.lastCapturedEffect = update; + } + } + } + update = update.next; + } + + if (newFirstUpdate === null) { + queue.lastUpdate = null; + } + if (newFirstCapturedUpdate === null) { + queue.lastCapturedUpdate = null; + } else { + workInProgress.effectTag |= Callback; + } + if (newFirstUpdate === null && newFirstCapturedUpdate === null) { + // We processed every update, without skipping. That means the new base + // state is the same as the result state. + newBaseState = resultState; + } + + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = newFirstCapturedUpdate; + + // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + (function() { + if (!(typeof callback === "function")) { + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + callback + ) + ); + } + })(); + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} + +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} + +function commitUpdateQueue( + finishedWork, + finishedQueue, + instance, + renderExpirationTime +) { + // If the finished render included captured updates, and there are still + // lower priority updates left over, we need to keep the captured updates + // in the queue so that they are rebased and not dropped once we process the + // queue again at the lower priority. + if (finishedQueue.firstCapturedUpdate !== null) { + // Join the captured update list to the end of the normal list. + if (finishedQueue.lastUpdate !== null) { + finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate; + finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate; + } + // Clear the list of captured updates. + finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null; + } + + // Commit the effects + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} + +function commitUpdateEffects(effect, instance) { + while (effect !== null) { + var _callback3 = effect.callback; + if (_callback3 !== null) { + effect.callback = null; + callCallback(_callback3, instance); + } + effect = effect.nextEffect; + } +} + +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + +function requestCurrentSuspenseConfig() { + return ReactCurrentBatchConfig.suspense; +} + +var fakeInternalInstance = {}; +var isArray$1 = Array.isArray; + +// React.Component uses a shared frozen object by default. +// We'll use it to determine whether we need to initialize legacy refs. +var emptyRefsObject = new React.Component().refs; + +var didWarnAboutStateAssignmentForComponent = void 0; +var didWarnAboutUninitializedState = void 0; +var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0; +var didWarnAboutLegacyLifecyclesAndDerivedState = void 0; +var didWarnAboutUndefinedDerivedState = void 0; +var warnOnUndefinedDerivedState = void 0; +var warnOnInvalidCallback = void 0; +var didWarnAboutDirectlyAssigningPropsToState = void 0; +var didWarnAboutContextTypeAndContextTypes = void 0; +var didWarnAboutInvalidateContextType = void 0; + +{ + didWarnAboutStateAssignmentForComponent = new Set(); + didWarnAboutUninitializedState = new Set(); + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); + didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); + didWarnAboutDirectlyAssigningPropsToState = new Set(); + didWarnAboutUndefinedDerivedState = new Set(); + didWarnAboutContextTypeAndContextTypes = new Set(); + didWarnAboutInvalidateContextType = new Set(); + + var didWarnOnInvalidCallback = new Set(); + + warnOnInvalidCallback = function(callback, callerName) { + if (callback === null || typeof callback === "function") { + return; + } + var key = callerName + "_" + callback; + if (!didWarnOnInvalidCallback.has(key)) { + didWarnOnInvalidCallback.add(key); + warningWithoutStack$1( + false, + "%s(...): Expected the last optional `callback` argument to be a " + + "function. Instead received: %s.", + callerName, + callback + ); + } + }; + + warnOnUndefinedDerivedState = function(type, partialState) { + if (partialState === undefined) { + var componentName = getComponentName(type) || "Component"; + if (!didWarnAboutUndefinedDerivedState.has(componentName)) { + didWarnAboutUndefinedDerivedState.add(componentName); + warningWithoutStack$1( + false, + "%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. " + + "You have returned undefined.", + componentName + ); + } + } + }; + + // This is so gross but it's at least non-critical and can be removed if + // it causes problems. This is meant to give a nicer error message for + // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, + // ...)) which otherwise throws a "_processChildContext is not a function" + // exception. + Object.defineProperty(fakeInternalInstance, "_processChildContext", { + enumerable: false, + value: function() { + (function() { + { + throw ReactError( + Error( + "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + ) + ); + } + })(); + } + }); + Object.freeze(fakeInternalInstance); +} + +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + var prevState = workInProgress.memoizedState; + + { + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Invoke the function an extra time to help detect side-effects. + getDerivedStateFromProps(nextProps, prevState); + } + } + + var partialState = getDerivedStateFromProps(nextProps, prevState); + + { + warnOnUndefinedDerivedState(ctor, partialState); + } + // Merge the partial state and the previous state. + var memoizedState = + partialState === null || partialState === undefined + ? prevState + : Object.assign({}, prevState, partialState); + workInProgress.memoizedState = memoizedState; + + // Once the update queue is empty, persist the derived state onto the + // base state. + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null && workInProgress.expirationTime === NoWork) { + updateQueue.baseState = memoizedState; + } +} + +var classComponentUpdater = { + isMounted: isMounted, + enqueueSetState: function(inst, payload, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.payload = payload; + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "setState"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.tag = ReplaceState; + update.payload = payload; + + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "replaceState"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueForceUpdate: function(inst, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.tag = ForceUpdate; + + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "forceUpdate"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + } +}; + +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + var instance = workInProgress.stateNode; + if (typeof instance.shouldComponentUpdate === "function") { + startPhaseTimer(workInProgress, "shouldComponentUpdate"); + var shouldUpdate = instance.shouldComponentUpdate( + newProps, + newState, + nextContext + ); + stopPhaseTimer(); + + { + !(shouldUpdate !== undefined) + ? warningWithoutStack$1( + false, + "%s.shouldComponentUpdate(): Returned undefined instead of a " + + "boolean value. Make sure to return true or false.", + getComponentName(ctor) || "Component" + ) + : void 0; + } + + return shouldUpdate; + } + + if (ctor.prototype && ctor.prototype.isPureReactComponent) { + return ( + !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + ); + } + + return true; +} + +function checkClassInstance(workInProgress, ctor, newProps) { + var instance = workInProgress.stateNode; + { + var name = getComponentName(ctor) || "Component"; + var renderPresent = instance.render; + + if (!renderPresent) { + if (ctor.prototype && typeof ctor.prototype.render === "function") { + warningWithoutStack$1( + false, + "%s(...): No `render` method found on the returned component " + + "instance: did you accidentally return an object from the constructor?", + name + ); + } else { + warningWithoutStack$1( + false, + "%s(...): No `render` method found on the returned component " + + "instance: you may have forgotten to define `render`.", + name + ); + } + } + + var noGetInitialStateOnES6 = + !instance.getInitialState || + instance.getInitialState.isReactClassApproved || + instance.state; + !noGetInitialStateOnES6 + ? warningWithoutStack$1( + false, + "getInitialState was defined on %s, a plain JavaScript class. " + + "This is only supported for classes created using React.createClass. " + + "Did you mean to define a state property instead?", + name + ) + : void 0; + var noGetDefaultPropsOnES6 = + !instance.getDefaultProps || + instance.getDefaultProps.isReactClassApproved; + !noGetDefaultPropsOnES6 + ? warningWithoutStack$1( + false, + "getDefaultProps was defined on %s, a plain JavaScript class. " + + "This is only supported for classes created using React.createClass. " + + "Use a static property to define defaultProps instead.", + name + ) + : void 0; + var noInstancePropTypes = !instance.propTypes; + !noInstancePropTypes + ? warningWithoutStack$1( + false, + "propTypes was defined as an instance property on %s. Use a static " + + "property to define propTypes instead.", + name + ) + : void 0; + var noInstanceContextType = !instance.contextType; + !noInstanceContextType + ? warningWithoutStack$1( + false, + "contextType was defined as an instance property on %s. Use a static " + + "property to define contextType instead.", + name + ) + : void 0; + + if (disableLegacyContext) { + if (ctor.childContextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy childContextTypes API which is no longer supported. " + + "Use React.createContext() instead.", + name + ); + } + if (ctor.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with static contextType instead.", + name + ); + } + } else { + var noInstanceContextTypes = !instance.contextTypes; + !noInstanceContextTypes + ? warningWithoutStack$1( + false, + "contextTypes was defined as an instance property on %s. Use a static " + + "property to define contextTypes instead.", + name + ) + : void 0; + + if ( + ctor.contextType && + ctor.contextTypes && + !didWarnAboutContextTypeAndContextTypes.has(ctor) + ) { + didWarnAboutContextTypeAndContextTypes.add(ctor); + warningWithoutStack$1( + false, + "%s declares both contextTypes and contextType static properties. " + + "The legacy contextTypes property will be ignored.", + name + ); + } + } + + var noComponentShouldUpdate = + typeof instance.componentShouldUpdate !== "function"; + !noComponentShouldUpdate + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentShouldUpdate(). Did you mean shouldComponentUpdate()? " + + "The name is phrased as a question because the function is " + + "expected to return a value.", + name + ) + : void 0; + if ( + ctor.prototype && + ctor.prototype.isPureReactComponent && + typeof instance.shouldComponentUpdate !== "undefined" + ) { + warningWithoutStack$1( + false, + "%s has a method called shouldComponentUpdate(). " + + "shouldComponentUpdate should not be used when extending React.PureComponent. " + + "Please extend React.Component if shouldComponentUpdate is used.", + getComponentName(ctor) || "A pure component" + ); + } + var noComponentDidUnmount = + typeof instance.componentDidUnmount !== "function"; + !noComponentDidUnmount + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentDidUnmount(). But there is no such lifecycle method. " + + "Did you mean componentWillUnmount()?", + name + ) + : void 0; + var noComponentDidReceiveProps = + typeof instance.componentDidReceiveProps !== "function"; + !noComponentDidReceiveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentDidReceiveProps(). But there is no such lifecycle method. " + + "If you meant to update the state in response to changing props, " + + "use componentWillReceiveProps(). If you meant to fetch data or " + + "run side-effects or mutations after React has updated the UI, use componentDidUpdate().", + name + ) + : void 0; + var noComponentWillRecieveProps = + typeof instance.componentWillRecieveProps !== "function"; + !noComponentWillRecieveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", + name + ) + : void 0; + var noUnsafeComponentWillRecieveProps = + typeof instance.UNSAFE_componentWillRecieveProps !== "function"; + !noUnsafeComponentWillRecieveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", + name + ) + : void 0; + var hasMutatedProps = instance.props !== newProps; + !(instance.props === undefined || !hasMutatedProps) + ? warningWithoutStack$1( + false, + "%s(...): When calling super() in `%s`, make sure to pass " + + "up the same props that your component's constructor was passed.", + name, + name + ) + : void 0; + var noInstanceDefaultProps = !instance.defaultProps; + !noInstanceDefaultProps + ? warningWithoutStack$1( + false, + "Setting defaultProps as an instance property on %s is not supported and will be ignored." + + " Instead, define defaultProps as a static property on %s.", + name, + name + ) + : void 0; + + if ( + typeof instance.getSnapshotBeforeUpdate === "function" && + typeof instance.componentDidUpdate !== "function" && + !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor) + ) { + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); + warningWithoutStack$1( + false, + "%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). " + + "This component defines getSnapshotBeforeUpdate() only.", + getComponentName(ctor) + ); + } + + var noInstanceGetDerivedStateFromProps = + typeof instance.getDerivedStateFromProps !== "function"; + !noInstanceGetDerivedStateFromProps + ? warningWithoutStack$1( + false, + "%s: getDerivedStateFromProps() is defined as an instance method " + + "and will be ignored. Instead, declare it as a static method.", + name + ) + : void 0; + var noInstanceGetDerivedStateFromCatch = + typeof instance.getDerivedStateFromError !== "function"; + !noInstanceGetDerivedStateFromCatch + ? warningWithoutStack$1( + false, + "%s: getDerivedStateFromError() is defined as an instance method " + + "and will be ignored. Instead, declare it as a static method.", + name + ) + : void 0; + var noStaticGetSnapshotBeforeUpdate = + typeof ctor.getSnapshotBeforeUpdate !== "function"; + !noStaticGetSnapshotBeforeUpdate + ? warningWithoutStack$1( + false, + "%s: getSnapshotBeforeUpdate() is defined as a static method " + + "and will be ignored. Instead, declare it as an instance method.", + name + ) + : void 0; + var _state = instance.state; + if (_state && (typeof _state !== "object" || isArray$1(_state))) { + warningWithoutStack$1( + false, + "%s.state: must be set to an object or null", + name + ); + } + if (typeof instance.getChildContext === "function") { + !(typeof ctor.childContextTypes === "object") + ? warningWithoutStack$1( + false, + "%s.getChildContext(): childContextTypes must be defined in order to " + + "use getChildContext().", + name + ) + : void 0; + } + } +} + +function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; + // The instance needs access to the fiber so that it can schedule updates + set(instance, workInProgress); + { + instance._reactInternalInstance = fakeInternalInstance; + } +} + +function constructClassInstance( + workInProgress, + ctor, + props, + renderExpirationTime +) { + var isLegacyContextConsumer = false; + var unmaskedContext = emptyContextObject; + var context = emptyContextObject; + var contextType = ctor.contextType; + + { + if ("contextType" in ctor) { + var isValid = + // Allow null for conditional declaration + contextType === null || + (contextType !== undefined && + contextType.$$typeof === REACT_CONTEXT_TYPE && + contextType._context === undefined); // Not a + + if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { + didWarnAboutInvalidateContextType.add(ctor); + + var addendum = ""; + if (contextType === undefined) { + addendum = + " However, it is set to undefined. " + + "This can be caused by a typo or by mixing up named and default imports. " + + "This can also happen due to a circular dependency, so " + + "try moving the createContext() call to a separate file."; + } else if (typeof contextType !== "object") { + addendum = " However, it is set to a " + typeof contextType + "."; + } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { + addendum = " Did you accidentally pass the Context.Provider instead?"; + } else if (contextType._context !== undefined) { + // + addendum = " Did you accidentally pass the Context.Consumer instead?"; + } else { + addendum = + " However, it is set to an object with keys {" + + Object.keys(contextType).join(", ") + + "}."; + } + warningWithoutStack$1( + false, + "%s defines an invalid contextType. " + + "contextType should point to the Context object returned by React.createContext().%s", + getComponentName(ctor) || "Component", + addendum + ); + } + } + } + + if (typeof contextType === "object" && contextType !== null) { + context = readContext(contextType); + } else if (!disableLegacyContext) { + unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + var contextTypes = ctor.contextTypes; + isLegacyContextConsumer = + contextTypes !== null && contextTypes !== undefined; + context = isLegacyContextConsumer + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject; + } + + // Instantiate twice to help detect side-effects. + { + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + new ctor(props, context); // eslint-disable-line no-new + } + } + + var instance = new ctor(props, context); + var state = (workInProgress.memoizedState = + instance.state !== null && instance.state !== undefined + ? instance.state + : null); + adoptClassInstance(workInProgress, instance); + + { + if (typeof ctor.getDerivedStateFromProps === "function" && state === null) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutUninitializedState.has(componentName)) { + didWarnAboutUninitializedState.add(componentName); + warningWithoutStack$1( + false, + "`%s` uses `getDerivedStateFromProps` but its initial state is " + + "%s. This is not recommended. Instead, define the initial state by " + + "assigning an object to `this.state` in the constructor of `%s`. " + + "This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", + componentName, + instance.state === null ? "null" : "undefined", + componentName + ); + } + } + + // If new component APIs are defined, "unsafe" lifecycles won't be called. + // Warn about these lifecycles if they are present. + // Don't warn about react-lifecycles-compat polyfilled methods though. + if ( + typeof ctor.getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function" + ) { + var foundWillMountName = null; + var foundWillReceivePropsName = null; + var foundWillUpdateName = null; + if ( + typeof instance.componentWillMount === "function" && + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + foundWillMountName = "componentWillMount"; + } else if (typeof instance.UNSAFE_componentWillMount === "function") { + foundWillMountName = "UNSAFE_componentWillMount"; + } + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + foundWillReceivePropsName = "componentWillReceiveProps"; + } else if ( + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps"; + } + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + foundWillUpdateName = "componentWillUpdate"; + } else if (typeof instance.UNSAFE_componentWillUpdate === "function") { + foundWillUpdateName = "UNSAFE_componentWillUpdate"; + } + if ( + foundWillMountName !== null || + foundWillReceivePropsName !== null || + foundWillUpdateName !== null + ) { + var _componentName = getComponentName(ctor) || "Component"; + var newApiName = + typeof ctor.getDerivedStateFromProps === "function" + ? "getDerivedStateFromProps()" + : "getSnapshotBeforeUpdate()"; + if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { + didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); + warningWithoutStack$1( + false, + "Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n" + + "%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n" + + "The above lifecycles should be removed. Learn more about this warning here:\n" + + "https://fb.me/react-async-component-lifecycle-hooks", + _componentName, + newApiName, + foundWillMountName !== null ? "\n " + foundWillMountName : "", + foundWillReceivePropsName !== null + ? "\n " + foundWillReceivePropsName + : "", + foundWillUpdateName !== null ? "\n " + foundWillUpdateName : "" + ); + } + } + } + } + + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // ReactFiberContext usually updates this cache but can't for newly-created instances. + if (isLegacyContextConsumer) { + cacheContext(workInProgress, unmaskedContext, context); + } + + return instance; +} + +function callComponentWillMount(workInProgress, instance) { + startPhaseTimer(workInProgress, "componentWillMount"); + var oldState = instance.state; + + if (typeof instance.componentWillMount === "function") { + instance.componentWillMount(); + } + if (typeof instance.UNSAFE_componentWillMount === "function") { + instance.UNSAFE_componentWillMount(); + } + + stopPhaseTimer(); + + if (oldState !== instance.state) { + { + warningWithoutStack$1( + false, + "%s.componentWillMount(): Assigning directly to this.state is " + + "deprecated (except inside a component's " + + "constructor). Use setState instead.", + getComponentName(workInProgress.type) || "Component" + ); + } + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } +} + +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + var oldState = instance.state; + startPhaseTimer(workInProgress, "componentWillReceiveProps"); + if (typeof instance.componentWillReceiveProps === "function") { + instance.componentWillReceiveProps(newProps, nextContext); + } + if (typeof instance.UNSAFE_componentWillReceiveProps === "function") { + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + } + stopPhaseTimer(); + + if (instance.state !== oldState) { + { + var componentName = getComponentName(workInProgress.type) || "Component"; + if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { + didWarnAboutStateAssignmentForComponent.add(componentName); + warningWithoutStack$1( + false, + "%s.componentWillReceiveProps(): Assigning directly to " + + "this.state is deprecated (except inside a component's " + + "constructor). Use setState instead.", + componentName + ); + } + } + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } +} + +// Invokes the mount life-cycles on a previously never rendered instance. +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + { + checkClassInstance(workInProgress, ctor, newProps); + } + + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + + var contextType = ctor.contextType; + if (typeof contextType === "object" && contextType !== null) { + instance.context = readContext(contextType); + } else if (disableLegacyContext) { + instance.context = emptyContextObject; + } else { + var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + instance.context = getMaskedContext(workInProgress, unmaskedContext); + } + + { + if (instance.state === newProps) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { + didWarnAboutDirectlyAssigningPropsToState.add(componentName); + warningWithoutStack$1( + false, + "%s: It is not recommended to assign props directly to state " + + "because updates to props won't be reflected in state. " + + "In most cases, it is better to use props directly.", + componentName + ); + } + } + + if (workInProgress.mode & StrictMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + instance + ); + } + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( + workInProgress, + instance + ); + } + } + + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + instance.state = workInProgress.memoizedState; + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + instance.state = workInProgress.memoizedState; + } + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + typeof ctor.getDerivedStateFromProps !== "function" && + typeof instance.getSnapshotBeforeUpdate !== "function" && + (typeof instance.UNSAFE_componentWillMount === "function" || + typeof instance.componentWillMount === "function") + ) { + callComponentWillMount(workInProgress, instance); + // If we had additional state updates during this life-cycle, let's + // process them now. + updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + instance.state = workInProgress.memoizedState; + } + } + + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } +} + +function resumeMountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + + var oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) { + nextContext = readContext(contextType); + } else if (!disableLegacyContext) { + var nextLegacyUnmaskedContext = getUnmaskedContext( + workInProgress, + ctor, + true + ); + nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = + typeof getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function"; + + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillReceiveProps === "function" || + typeof instance.componentWillReceiveProps === "function") + ) { + if (oldProps !== newProps || oldContext !== nextContext) { + callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext + ); + } + } + + resetHasForceUpdateBeforeProcessing(); + + var oldState = workInProgress.memoizedState; + var newState = (instance.state = oldState); + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + newState = workInProgress.memoizedState; + } + if ( + oldProps === newProps && + oldState === newState && + !hasContextChanged() && + !checkHasForceUpdateAfterProcessing() + ) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + return false; + } + + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + newState = workInProgress.memoizedState; + } + + var shouldUpdate = + checkHasForceUpdateAfterProcessing() || + checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext + ); + + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillMount === "function" || + typeof instance.componentWillMount === "function") + ) { + startPhaseTimer(workInProgress, "componentWillMount"); + if (typeof instance.componentWillMount === "function") { + instance.componentWillMount(); + } + if (typeof instance.UNSAFE_componentWillMount === "function") { + instance.UNSAFE_componentWillMount(); + } + stopPhaseTimer(); + } + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } + + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + + return shouldUpdate; +} + +// Invokes the update life-cycles and returns false if it shouldn't rerender. +function updateClassInstance( + current, + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + + var oldProps = workInProgress.memoizedProps; + instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps); + + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) { + nextContext = readContext(contextType); + } else if (!disableLegacyContext) { + var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = + typeof getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function"; + + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillReceiveProps === "function" || + typeof instance.componentWillReceiveProps === "function") + ) { + if (oldProps !== newProps || oldContext !== nextContext) { + callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext + ); + } + } + + resetHasForceUpdateBeforeProcessing(); + + var oldState = workInProgress.memoizedState; + var newState = (instance.state = oldState); + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + newState = workInProgress.memoizedState; + } + + if ( + oldProps === newProps && + oldState === newState && + !hasContextChanged() && + !checkHasForceUpdateAfterProcessing() + ) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Update; + } + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Snapshot; + } + } + return false; + } + + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + newState = workInProgress.memoizedState; + } + + var shouldUpdate = + checkHasForceUpdateAfterProcessing() || + checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext + ); + + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillUpdate === "function" || + typeof instance.componentWillUpdate === "function") + ) { + startPhaseTimer(workInProgress, "componentWillUpdate"); + if (typeof instance.componentWillUpdate === "function") { + instance.componentWillUpdate(newProps, newState, nextContext); + } + if (typeof instance.UNSAFE_componentWillUpdate === "function") { + instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); + } + stopPhaseTimer(); + } + if (typeof instance.componentDidUpdate === "function") { + workInProgress.effectTag |= Update; + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + workInProgress.effectTag |= Snapshot; + } + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Update; + } + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Snapshot; + } + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized props/state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } + + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + + return shouldUpdate; +} + +var didWarnAboutMaps = void 0; +var didWarnAboutGenerators = void 0; +var didWarnAboutStringRefs = void 0; +var ownerHasKeyUseWarning = void 0; +var ownerHasFunctionTypeWarning = void 0; +var warnForMissingKey = function(child) {}; + +{ + didWarnAboutMaps = false; + didWarnAboutGenerators = false; + didWarnAboutStringRefs = {}; + + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + ownerHasKeyUseWarning = {}; + ownerHasFunctionTypeWarning = {}; + + warnForMissingKey = function(child) { + if (child === null || typeof child !== "object") { + return; + } + if (!child._store || child._store.validated || child.key != null) { + return; + } + (function() { + if (!(typeof child._store === "object")) { + throw ReactError( + Error( + "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + child._store.validated = true; + + var currentComponentErrorInfo = + "Each child in a list should have a unique " + + '"key" prop. See https://fb.me/react-warning-keys for ' + + "more information." + + getCurrentFiberStackInDev(); + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; + + warning$1( + false, + "Each child in a list should have a unique " + + '"key" prop. See https://fb.me/react-warning-keys for ' + + "more information." + ); + }; +} + +var isArray = Array.isArray; + +function coerceRef(returnFiber, current$$1, element) { + var mixedRef = element.ref; + if ( + mixedRef !== null && + typeof mixedRef !== "function" && + typeof mixedRef !== "object" + ) { + { + // TODO: Clean this up once we turn on the string ref warning for + // everyone, because the strict mode case will no longer be relevant + if (returnFiber.mode & StrictMode || warnAboutStringRefs) { + var componentName = getComponentName(returnFiber.type) || "Component"; + if (!didWarnAboutStringRefs[componentName]) { + if (warnAboutStringRefs) { + warningWithoutStack$1( + false, + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + componentName, + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } else { + warningWithoutStack$1( + false, + 'A string ref, "%s", has been found within a strict mode tree. ' + + "String refs are a source of potential bugs and should be avoided. " + + "We recommend using useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } + didWarnAboutStringRefs[componentName] = true; + } + } + } + + if (element._owner) { + var owner = element._owner; + var inst = void 0; + if (owner) { + var ownerFiber = owner; + (function() { + if (!(ownerFiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + } + })(); + inst = ownerFiber.stateNode; + } + (function() { + if (!inst) { + throw ReactError( + Error( + "Missing owner for string ref " + + mixedRef + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var stringRef = "" + mixedRef; + // Check if previous string ref matches new string ref + if ( + current$$1 !== null && + current$$1.ref !== null && + typeof current$$1.ref === "function" && + current$$1.ref._stringRef === stringRef + ) { + return current$$1.ref; + } + var ref = function(value) { + var refs = inst.refs; + if (refs === emptyRefsObject) { + // This is a lazy pooled frozen object, so we need to initialize. + refs = inst.refs = {}; + } + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + }; + ref._stringRef = stringRef; + return ref; + } else { + (function() { + if (!(typeof mixedRef === "string")) { + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + } + })(); + (function() { + if (!element._owner) { + throw ReactError( + Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + })(); + } + } + return mixedRef; +} + +function throwOnInvalidObjectType(returnFiber, newChild) { + if (returnFiber.type !== "textarea") { + var addendum = ""; + { + addendum = + " If you meant to render a collection of children, use an array " + + "instead." + + getCurrentFiberStackInDev(); + } + (function() { + { + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + (Object.prototype.toString.call(newChild) === "[object Object]" + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + + addendum + ) + ); + } + })(); + } +} + +function warnOnFunctionType() { + var currentComponentErrorInfo = + "Functions are not valid as a React child. This may happen if " + + "you return a Component instead of from render. " + + "Or maybe you meant to call this function rather than return it." + + getCurrentFiberStackInDev(); + + if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) { + return; + } + ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true; + + warning$1( + false, + "Functions are not valid as a React child. This may happen if " + + "you return a Component instead of from render. " + + "Or maybe you meant to call this function rather than return it." + ); +} + +// This wrapper function exists because I expect to clone the code in each path +// to be able to optimize each path individually by branching early. This needs +// a compiler or we can do it manually. Helpers that don't need this branching +// live outside of this function. +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (!shouldTrackSideEffects) { + // Noop. + return; + } + // Deletions are added in reversed order so we add it to the front. + // At this point, the return fiber's effect list is empty except for + // deletions, so we can just append the deletion to the list. The remaining + // effects aren't added until the complete phase. Once we implement + // resuming, this may not be true. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + } + childToDelete.nextEffect = null; + childToDelete.effectTag = Deletion; + } + + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) { + // Noop. + return null; + } + + // TODO: For the shouldClone case, this could be micro-optimized a bit by + // assuming that after the first child we've already added everything. + var childToDelete = currentFirstChild; + while (childToDelete !== null) { + deleteChild(returnFiber, childToDelete); + childToDelete = childToDelete.sibling; + } + return null; + } + + function mapRemainingChildren(returnFiber, currentFirstChild) { + // Add the remaining children to a temporary map so that we can find them by + // keys quickly. Implicit (null) keys get added to this set with their index + var existingChildren = new Map(); + + var existingChild = currentFirstChild; + while (existingChild !== null) { + if (existingChild.key !== null) { + existingChildren.set(existingChild.key, existingChild); + } else { + existingChildren.set(existingChild.index, existingChild); + } + existingChild = existingChild.sibling; + } + return existingChildren; + } + + function useFiber(fiber, pendingProps, expirationTime) { + // We currently set sibling to null and index to 0 here because it is easy + // to forget to do before returning it. E.g. for the single child case. + var clone = createWorkInProgress(fiber, pendingProps, expirationTime); + clone.index = 0; + clone.sibling = null; + return clone; + } + + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) { + // Noop. + return lastPlacedIndex; + } + var current$$1 = newFiber.alternate; + if (current$$1 !== null) { + var oldIndex = current$$1.index; + if (oldIndex < lastPlacedIndex) { + // This is a move. + newFiber.effectTag = Placement; + return lastPlacedIndex; + } else { + // This item can stay in place. + return oldIndex; + } + } else { + // This is an insertion. + newFiber.effectTag = Placement; + return lastPlacedIndex; + } + } + + function placeSingleChild(newFiber) { + // This is simpler for the single child case. We only need to do a + // placement for inserting new children. + if (shouldTrackSideEffects && newFiber.alternate === null) { + newFiber.effectTag = Placement; + } + return newFiber; + } + + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (current$$1 === null || current$$1.tag !== HostText) { + // Insert + var created = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current$$1, textContent, expirationTime); + existing.return = returnFiber; + return existing; + } + } + + function updateElement(returnFiber, current$$1, element, expirationTime) { + if ( + current$$1 !== null && + (current$$1.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(current$$1, element)) + ) { + // Move based on index + var existing = useFiber(current$$1, element.props, expirationTime); + existing.ref = coerceRef(returnFiber, current$$1, element); + existing.return = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; + } + return existing; + } else { + // Insert + var created = createFiberFromElement( + element, + returnFiber.mode, + expirationTime + ); + created.ref = coerceRef(returnFiber, current$$1, element); + created.return = returnFiber; + return created; + } + } + + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + current$$1 === null || + current$$1.tag !== HostPortal || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) { + // Insert + var created = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber( + current$$1, + portal.children || [], + expirationTime + ); + existing.return = returnFiber; + return existing; + } + } + + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (current$$1 === null || current$$1.tag !== Fragment) { + // Insert + var created = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current$$1, fragment, expirationTime); + existing.return = returnFiber; + return existing; + } + } + + function createChild(returnFiber, newChild, expirationTime) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + var created = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + var _created = createFiberFromElement( + newChild, + returnFiber.mode, + expirationTime + ); + _created.ref = coerceRef(returnFiber, null, newChild); + _created.return = returnFiber; + return _created; + } + case REACT_PORTAL_TYPE: { + var _created2 = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + _created2.return = returnFiber; + return _created2; + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + var _created3 = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + ); + _created3.return = returnFiber; + return _created3; + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + // Update the fiber if the keys match, otherwise return null. + + var key = oldFiber !== null ? oldFiber.key : null; + + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + if (key !== null) { + return null; + } + return updateTextNode( + returnFiber, + oldFiber, + "" + newChild, + expirationTime + ); + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + if (newChild.key === key) { + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ); + } + return updateElement( + returnFiber, + oldFiber, + newChild, + expirationTime + ); + } else { + return null; + } + } + case REACT_PORTAL_TYPE: { + if (newChild.key === key) { + return updatePortal( + returnFiber, + oldFiber, + newChild, + expirationTime + ); + } else { + return null; + } + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + if (key !== null) { + return null; + } + + return updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys, so we neither have to check the old nor + // new node for the key. If both are text nodes, they match. + var matchedFiber = existingChildren.get(newIdx) || null; + return updateTextNode( + returnFiber, + matchedFiber, + "" + newChild, + expirationTime + ); + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + var _matchedFiber = + existingChildren.get( + newChild.key === null ? newIdx : newChild.key + ) || null; + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment( + returnFiber, + _matchedFiber, + newChild.props.children, + expirationTime, + newChild.key + ); + } + return updateElement( + returnFiber, + _matchedFiber, + newChild, + expirationTime + ); + } + case REACT_PORTAL_TYPE: { + var _matchedFiber2 = + existingChildren.get( + newChild.key === null ? newIdx : newChild.key + ) || null; + return updatePortal( + returnFiber, + _matchedFiber2, + newChild, + expirationTime + ); + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + var _matchedFiber3 = existingChildren.get(newIdx) || null; + return updateFragment( + returnFiber, + _matchedFiber3, + newChild, + expirationTime, + null + ); + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + /** + * Warns if there is a duplicate or missing key + */ + function warnOnInvalidKey(child, knownKeys) { + { + if (typeof child !== "object" || child === null) { + return knownKeys; + } + switch (child.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + warnForMissingKey(child); + var key = child.key; + if (typeof key !== "string") { + break; + } + if (knownKeys === null) { + knownKeys = new Set(); + knownKeys.add(key); + break; + } + if (!knownKeys.has(key)) { + knownKeys.add(key); + break; + } + warning$1( + false, + "Encountered two children with the same key, `%s`. " + + "Keys should be unique so that components maintain their identity " + + "across updates. Non-unique keys may cause children to be " + + "duplicated and/or omitted — the behavior is unsupported and " + + "could change in a future version.", + key + ); + break; + default: + break; + } + } + return knownKeys; + } + + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + // This algorithm can't optimize by searching from both ends since we + // don't have backpointers on fibers. I'm trying to see how far we can get + // with that model. If it ends up not being worth the tradeoffs, we can + // add it later. + + // Even with a two ended optimization, we'd want to optimize for the case + // where there are few changes and brute force the comparison instead of + // going for the Map. It'd like to explore hitting that path first in + // forward-only mode and only go for the Map once we notice that we need + // lots of look ahead. This doesn't handle reversal as well as two ended + // search but that's unusual. Besides, for the two ended optimization to + // work on Iterables, we'd need to copy the whole set. + + // In this first iteration, we'll just live with hitting the bad case + // (adding everything to a Map) in for every insert/move. + + // If you change this code, also update reconcileChildrenIterator() which + // uses the same algorithm. + + { + // First, validate keys. + var knownKeys = null; + for (var i = 0; i < newChildren.length; i++) { + var child = newChildren[i]; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } + + var resultingFirstChild = null; + var previousNewFiber = null; + + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; + } + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) { + oldFiber = nextOldFiber; + } + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + + if (newIdx === newChildren.length) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + ); + if (_newFiber === null) { + continue; + } + lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber; + } else { + previousNewFiber.sibling = _newFiber; + } + previousNewFiber = _newFiber; + } + return resultingFirstChild; + } + + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); + + // Keep scanning and use the map to restore deleted items as moves. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber2 = updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + ); + if (_newFiber2 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber2.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete( + _newFiber2.key === null ? newIdx : _newFiber2.key + ); + } + } + lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber2; + } else { + previousNewFiber.sibling = _newFiber2; + } + previousNewFiber = _newFiber2; + } + } + + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + } + + return resultingFirstChild; + } + + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + // This is the same implementation as reconcileChildrenArray(), + // but using the iterator instead. + + var iteratorFn = getIteratorFn(newChildrenIterable); + (function() { + if (!(typeof iteratorFn === "function")) { + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + { + // We don't support rendering Generators because it's a mutation. + // See https://github.com/facebook/react/issues/12995 + if ( + typeof Symbol === "function" && + // $FlowFixMe Flow doesn't know about toStringTag + newChildrenIterable[Symbol.toStringTag] === "Generator" + ) { + !didWarnAboutGenerators + ? warning$1( + false, + "Using Generators as children is unsupported and will likely yield " + + "unexpected results because enumerating a generator mutates it. " + + "You may convert it to an array with `Array.from()` or the " + + "`[...spread]` operator before rendering. Keep in mind " + + "you might need to polyfill these features for older browsers." + ) + : void 0; + didWarnAboutGenerators = true; + } + + // Warn about using Maps as children + if (newChildrenIterable.entries === iteratorFn) { + !didWarnAboutMaps + ? warning$1( + false, + "Using Maps as children is unsupported and will likely yield " + + "unexpected results. Convert it to a sequence/iterable of keyed " + + "ReactElements instead." + ) + : void 0; + didWarnAboutMaps = true; + } + + // First, validate keys. + // We'll get a different iterator later for the main pass. + var _newChildren = iteratorFn.call(newChildrenIterable); + if (_newChildren) { + var knownKeys = null; + var _step = _newChildren.next(); + for (; !_step.done; _step = _newChildren.next()) { + var child = _step.value; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } + } + + var newChildren = iteratorFn.call(newChildrenIterable); + (function() { + if (!(newChildren != null)) { + throw ReactError(Error("An iterable object provided no iterator.")); + } + })(); + + var resultingFirstChild = null; + var previousNewFiber = null; + + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + + var step = newChildren.next(); + for ( + ; + oldFiber !== null && !step.done; + newIdx++, step = newChildren.next() + ) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; + } + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) { + oldFiber = nextOldFiber; + } + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + + if (step.done) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber3 = createChild(returnFiber, step.value, expirationTime); + if (_newFiber3 === null) { + continue; + } + lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber3; + } else { + previousNewFiber.sibling = _newFiber3; + } + previousNewFiber = _newFiber3; + } + return resultingFirstChild; + } + + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); + + // Keep scanning and use the map to restore deleted items as moves. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber4 = updateFromMap( + existingChildren, + returnFiber, + newIdx, + step.value, + expirationTime + ); + if (_newFiber4 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber4.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete( + _newFiber4.key === null ? newIdx : _newFiber4.key + ); + } + } + lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber4; + } else { + previousNewFiber.sibling = _newFiber4; + } + previousNewFiber = _newFiber4; + } + } + + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + } + + return resultingFirstChild; + } + + function reconcileSingleTextNode( + returnFiber, + currentFirstChild, + textContent, + expirationTime + ) { + // There's no need to check for keys on text nodes since we don't have a + // way to define them. + if (currentFirstChild !== null && currentFirstChild.tag === HostText) { + // We already have an existing node so let's just update it and delete + // the rest. + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + var existing = useFiber(currentFirstChild, textContent, expirationTime); + existing.return = returnFiber; + return existing; + } + // The existing first child is not a text node so we need to create one + // and delete the existing ones. + deleteRemainingChildren(returnFiber, currentFirstChild); + var created = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + function reconcileSingleElement( + returnFiber, + currentFirstChild, + element, + expirationTime + ) { + var key = element.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if ( + child.tag === Fragment + ? element.type === REACT_FRAGMENT_TYPE + : child.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(child, element) + ) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber( + child, + element.type === REACT_FRAGMENT_TYPE + ? element.props.children + : element.props, + expirationTime + ); + existing.ref = coerceRef(returnFiber, child, element); + existing.return = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; + } + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else { + deleteChild(returnFiber, child); + } + child = child.sibling; + } + + if (element.type === REACT_FRAGMENT_TYPE) { + var created = createFiberFromFragment( + element.props.children, + returnFiber.mode, + expirationTime, + element.key + ); + created.return = returnFiber; + return created; + } else { + var _created4 = createFiberFromElement( + element, + returnFiber.mode, + expirationTime + ); + _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + _created4.return = returnFiber; + return _created4; + } + } + + function reconcileSinglePortal( + returnFiber, + currentFirstChild, + portal, + expirationTime + ) { + var key = portal.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if ( + child.tag === HostPortal && + child.stateNode.containerInfo === portal.containerInfo && + child.stateNode.implementation === portal.implementation + ) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, portal.children || [], expirationTime); + existing.return = returnFiber; + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else { + deleteChild(returnFiber, child); + } + child = child.sibling; + } + + var created = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + // This API will tag the children with the side-effect of the reconciliation + // itself. They will be added to the side-effect list as we pass through the + // children and the parent. + function reconcileChildFibers( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) { + // This function is not recursive. + // If the top level item is an array, we treat it as a set of children, + // not as a fragment. Nested arrays on the other hand will be treated as + // fragment nodes. Recursion happens at the normal flow. + + // Handle top level unkeyed fragments as if they were arrays. + // This leads to an ambiguity between <>{[...]} and <>.... + // We treat the ambiguous cases above the same. + var isUnkeyedTopLevelFragment = + typeof newChild === "object" && + newChild !== null && + newChild.type === REACT_FRAGMENT_TYPE && + newChild.key === null; + if (isUnkeyedTopLevelFragment) { + newChild = newChild.props.children; + } + + // Handle object types + var isObject = typeof newChild === "object" && newChild !== null; + + if (isObject) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return placeSingleChild( + reconcileSingleElement( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return placeSingleChild( + reconcileSinglePortal( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) + ); + } + } + + if (typeof newChild === "string" || typeof newChild === "number") { + return placeSingleChild( + reconcileSingleTextNode( + returnFiber, + currentFirstChild, + "" + newChild, + expirationTime + ) + ); + } + + if (isArray(newChild)) { + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + } + + if (getIteratorFn(newChild)) { + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + } + + if (isObject) { + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + if (typeof newChild === "undefined" && !isUnkeyedTopLevelFragment) { + // If the new child is undefined, and the return fiber is a composite + // component, throw an error. If Fiber return types are disabled, + // we already threw above. + switch (returnFiber.tag) { + case ClassComponent: { + { + var instance = returnFiber.stateNode; + if (instance.render._isMockFunction) { + // We allow auto-mocks to proceed as if they're returning null. + break; + } + } + } + // Intentionally fall through to the next case, which handles both + // functions and classes + // eslint-disable-next-lined no-fallthrough + case FunctionComponent: { + var Component = returnFiber.type; + (function() { + { + throw ReactError( + Error( + (Component.displayName || Component.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + ); + } + })(); + } + } + } + + // Remaining cases are all treated as empty. + return deleteRemainingChildren(returnFiber, currentFirstChild); + } + + return reconcileChildFibers; +} + +var reconcileChildFibers = ChildReconciler(true); +var mountChildFibers = ChildReconciler(false); + +function cloneChildFibers(current$$1, workInProgress) { + (function() { + if (!(current$$1 === null || workInProgress.child === current$$1.child)) { + throw ReactError(Error("Resuming work not yet implemented.")); + } + })(); + + if (workInProgress.child === null) { + return; + } + + var currentChild = workInProgress.child; + var newChild = createWorkInProgress( + currentChild, + currentChild.pendingProps, + currentChild.expirationTime + ); + workInProgress.child = newChild; + + newChild.return = workInProgress; + while (currentChild.sibling !== null) { + currentChild = currentChild.sibling; + newChild = newChild.sibling = createWorkInProgress( + currentChild, + currentChild.pendingProps, + currentChild.expirationTime + ); + newChild.return = workInProgress; + } + newChild.sibling = null; +} + +// Reset a workInProgress child set to prepare it for a second pass. +function resetChildFibers(workInProgress, renderExpirationTime) { + var child = workInProgress.child; + while (child !== null) { + resetWorkInProgress(child, renderExpirationTime); + child = child.sibling; + } +} + +var NO_CONTEXT = {}; + +var contextStackCursor$1 = createCursor(NO_CONTEXT); +var contextFiberStackCursor = createCursor(NO_CONTEXT); +var rootInstanceStackCursor = createCursor(NO_CONTEXT); + +function requiredContext(c) { + (function() { + if (!(c !== NO_CONTEXT)) { + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + return c; +} + +function getRootHostContainer() { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + return rootInstance; +} + +function pushHostContainer(fiber, nextRootInstance) { + // Push current root instance onto the stack; + // This allows us to reset root when portals are popped. + push(rootInstanceStackCursor, nextRootInstance, fiber); + // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); + + // Finally, we need to push the host context to the stack. + // However, we can't just call getRootHostContext() and push it because + // we'd have a different number of entries on the stack depending on + // whether getRootHostContext() throws somewhere in renderer code or not. + // So we push an empty value first. This lets us safely unwind on errors. + push(contextStackCursor$1, NO_CONTEXT, fiber); + var nextRootContext = getRootHostContext(nextRootInstance); + // Now that we know this function doesn't throw, replace it. + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, nextRootContext, fiber); +} + +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} + +function getHostContext() { + var context = requiredContext(contextStackCursor$1.current); + return context; +} + +function pushHostContext(fiber) { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = getChildHostContext(context, fiber.type, rootInstance); + + // Don't push this Fiber's context unless it's unique. + if (context === nextContext) { + return; + } + + // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, nextContext, fiber); +} + +function popHostContext(fiber) { + // Do not pop unless this Fiber provided the current context. + // pushHostContext() only pushes Fibers that provide unique contexts. + if (contextFiberStackCursor.current !== fiber) { + return; + } + + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); +} + +var DefaultSuspenseContext = 0; + +// The Suspense Context is split into two parts. The lower bits is +// inherited deeply down the subtree. The upper bits only affect +// this immediate suspense boundary and gets reset each new +// boundary or suspense list. +var SubtreeSuspenseContextMask = 1; + +// Subtree Flags: + +// InvisibleParentSuspenseContext indicates that one of our parent Suspense +// boundaries is not currently showing visible main content. +// Either because it is already showing a fallback or is not mounted at all. +// We can use this to determine if it is desirable to trigger a fallback at +// the parent. If not, then we might need to trigger undesirable boundaries +// and/or suspend the commit to avoid hiding the parent content. +var InvisibleParentSuspenseContext = 1; + +// Shallow Flags: + +// ForceSuspenseFallback can be used by SuspenseList to force newly added +// items into their fallback state during one of the render passes. +var ForceSuspenseFallback = 2; + +var suspenseStackCursor = createCursor(DefaultSuspenseContext); + +function hasSuspenseContext(parentContext, flag) { + return (parentContext & flag) !== 0; +} + +function setDefaultShallowSuspenseContext(parentContext) { + return parentContext & SubtreeSuspenseContextMask; +} + +function setShallowSuspenseContext(parentContext, shallowContext) { + return (parentContext & SubtreeSuspenseContextMask) | shallowContext; +} + +function addSubtreeSuspenseContext(parentContext, subtreeContext) { + return parentContext | subtreeContext; +} + +function pushSuspenseContext(fiber, newContext) { + push(suspenseStackCursor, newContext, fiber); +} + +function popSuspenseContext(fiber) { + pop(suspenseStackCursor, fiber); +} + +// TODO: This is now an empty object. Should we switch this to a boolean? +// Alternatively we can make this use an effect tag similar to SuspenseList. + +function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { + // If it was the primary children that just suspended, capture and render the + var nextState = workInProgress.memoizedState; + if (nextState !== null) { + return false; + } + var props = workInProgress.memoizedProps; + // In order to capture, the Suspense component must have a fallback prop. + if (props.fallback === undefined) { + return false; + } + // Regular boundaries always capture. + if (props.unstable_avoidThisFallback !== true) { + return true; + } + // If it's a boundary we should avoid, then we prefer to bubble up to the + // parent boundary if it is currently invisible. + if (hasInvisibleParent) { + return false; + } + // If the parent is not able to handle it, we must handle it. + return true; +} + +function findFirstSuspended(row) { + var node = row; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + return node; + } + } else if ( + node.tag === SuspenseListComponent && + // revealOrder undefined can't be trusted because it don't + // keep track of whether it suspended or not. + node.memoizedProps.revealOrder !== undefined + ) { + var didSuspend = (node.effectTag & DidCapture) !== NoEffect; + if (didSuspend) { + return node; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) { + return null; + } + while (node.sibling === null) { + if (node.return === null || node.return === row) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} + +function createResponderListener(responder, props) { + var eventResponderListener = { + responder: responder, + props: props + }; + { + Object.freeze(eventResponderListener); + } + return eventResponderListener; +} + +function createResponderInstance( + responder, + responderProps, + responderState, + target, + fiber +) { + return { + fiber: fiber, + props: responderProps, + responder: responder, + rootEventTypes: null, + state: responderState, + target: target + }; +} + +var NoEffect$1 = /* */ 0; +var UnmountSnapshot = /* */ 2; +var UnmountMutation = /* */ 4; +var MountMutation = /* */ 8; +var UnmountLayout = /* */ 16; +var MountLayout = /* */ 32; +var MountPassive = /* */ 64; +var UnmountPassive = /* */ 128; + +var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; + +var didWarnAboutMismatchedHooksForComponent = void 0; +{ + didWarnAboutMismatchedHooksForComponent = new Set(); +} + +// These are set right before calling the component. +var renderExpirationTime$1 = NoWork; +// The work-in-progress fiber. I've named it differently to distinguish it from +// the work-in-progress hook. +var currentlyRenderingFiber$1 = null; + +// Hooks are stored as a linked list on the fiber's memoizedState field. The +// current hook list is the list that belongs to the current fiber. The +// work-in-progress hook list is a new list that will be added to the +// work-in-progress fiber. +var currentHook = null; +var nextCurrentHook = null; +var firstWorkInProgressHook = null; +var workInProgressHook = null; +var nextWorkInProgressHook = null; + +var remainingExpirationTime = NoWork; +var componentUpdateQueue = null; +var sideEffectTag = 0; + +// Updates scheduled during render will trigger an immediate re-render at the +// end of the current pass. We can't store these updates on the normal queue, +// because if the work is aborted, they should be discarded. Because this is +// a relatively rare case, we also don't want to add an additional field to +// either the hook or queue object types. So we store them in a lazily create +// map of queue -> render-phase updates, which are discarded once the component +// completes without re-rendering. + +// Whether an update was scheduled during the currently executing render pass. +var didScheduleRenderPhaseUpdate = false; +// Lazily created map of render-phase updates +var renderPhaseUpdates = null; +// Counter to prevent infinite loops. +var numberOfReRenders = 0; +var RE_RENDER_LIMIT = 25; + +// In DEV, this is the name of the currently executing primitive hook +var currentHookNameInDev = null; + +// In DEV, this list ensures that hooks are called in the same order between renders. +// The list stores the order of hooks used during the initial render (mount). +// Subsequent renders (updates) reference this list. +var hookTypesDev = null; +var hookTypesUpdateIndexDev = -1; + +// In DEV, this tracks whether currently rendering component needs to ignore +// the dependencies for Hooks that need them (e.g. useEffect or useMemo). +// When true, such Hooks will always be "remounted". Only used during hot reload. +var ignorePreviousDependencies = false; + +function mountHookTypesDev() { + { + var hookName = currentHookNameInDev; + + if (hookTypesDev === null) { + hookTypesDev = [hookName]; + } else { + hookTypesDev.push(hookName); + } + } +} + +function updateHookTypesDev() { + { + var hookName = currentHookNameInDev; + + if (hookTypesDev !== null) { + hookTypesUpdateIndexDev++; + if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { + warnOnHookMismatchInDev(hookName); + } + } + } +} + +function checkDepsAreArrayDev(deps) { + { + if (deps !== undefined && deps !== null && !Array.isArray(deps)) { + // Verify deps, but only on mount to avoid extra checks. + // It's unlikely their type would change as usually you define them inline. + warning$1( + false, + "%s received a final argument that is not an array (instead, received `%s`). When " + + "specified, the final argument must be an array.", + currentHookNameInDev, + typeof deps + ); + } + } +} + +function warnOnHookMismatchInDev(currentHookName) { + { + var componentName = getComponentName(currentlyRenderingFiber$1.type); + if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { + didWarnAboutMismatchedHooksForComponent.add(componentName); + + if (hookTypesDev !== null) { + var table = ""; + + var secondColumnStart = 30; + + for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { + var oldHookName = hookTypesDev[i]; + var newHookName = + i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; + + var row = i + 1 + ". " + oldHookName; + + // Extra space so second column lines up + // lol @ IE not supporting String#repeat + while (row.length < secondColumnStart) { + row += " "; + } + + row += newHookName + "\n"; + + table += row; + } + + warning$1( + false, + "React has detected a change in the order of Hooks called by %s. " + + "This will lead to bugs and errors if not fixed. " + + "For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n" + + " Previous render Next render\n" + + " ------------------------------------------------------\n" + + "%s" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + componentName, + table + ); + } + } + } +} + +function throwInvalidHookError() { + (function() { + { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); + } + })(); +} + +function areHookInputsEqual(nextDeps, prevDeps) { + { + if (ignorePreviousDependencies) { + // Only true when this component is being hot reloaded. + return false; + } + } + + if (prevDeps === null) { + { + warning$1( + false, + "%s received a final argument during this render, but not during " + + "the previous render. Even though the final argument is optional, " + + "its type cannot change between renders.", + currentHookNameInDev + ); + } + return false; + } + + { + // Don't bother comparing lengths in prod because these arrays should be + // passed inline. + if (nextDeps.length !== prevDeps.length) { + warning$1( + false, + "The final argument passed to %s changed size between renders. The " + + "order and size of this array must remain constant.\n\n" + + "Previous: %s\n" + + "Incoming: %s", + currentHookNameInDev, + "[" + prevDeps.join(", ") + "]", + "[" + nextDeps.join(", ") + "]" + ); + } + } + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { + if (is(nextDeps[i], prevDeps[i])) { + continue; + } + return false; + } + return true; +} + +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = current !== null ? current.memoizedState : null; + + { + hookTypesDev = current !== null ? current._debugHookTypes : null; + hookTypesUpdateIndexDev = -1; + // Used for hot reloading: + ignorePreviousDependencies = + current !== null && current.type !== workInProgress.type; + } + + // The following should have already been reset + // currentHook = null; + // workInProgressHook = null; + + // remainingExpirationTime = NoWork; + // componentUpdateQueue = null; + + // didScheduleRenderPhaseUpdate = false; + // renderPhaseUpdates = null; + // numberOfReRenders = 0; + // sideEffectTag = 0; + + // TODO Warn if no hooks are used at all during mount, then some are used during update. + // Currently we will identify the update render as a mount because nextCurrentHook === null. + // This is tricky because it's valid for certain types of components (e.g. React.lazy) + + // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used. + // Non-stateful hooks (e.g. context) don't get added to memoizedState, + // so nextCurrentHook would be null during updates and mounts. + { + if (nextCurrentHook !== null) { + ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + } else if (hookTypesDev !== null) { + // This dispatcher handles an edge case where a component is updating, + // but no stateful hooks have been used. + // We want to match the production code behavior (which will use HooksDispatcherOnMount), + // but with the extra DEV validation to ensure hooks ordering hasn't changed. + // This dispatcher does that. + ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; + } else { + ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + } + } + + var children = Component(props, refOrContext); + + if (didScheduleRenderPhaseUpdate) { + do { + didScheduleRenderPhaseUpdate = false; + numberOfReRenders += 1; + { + // Even when hot reloading, allow dependencies to stabilize + // after first render to prevent infinite render phase updates. + ignorePreviousDependencies = false; + } + + // Start over from the beginning of the list + nextCurrentHook = current !== null ? current.memoizedState : null; + nextWorkInProgressHook = firstWorkInProgressHook; + + currentHook = null; + workInProgressHook = null; + componentUpdateQueue = null; + + { + // Also validate hook order for cascading updates. + hookTypesUpdateIndexDev = -1; + } + + ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + + children = Component(props, refOrContext); + } while (didScheduleRenderPhaseUpdate); + + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + + // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + + var renderedWork = currentlyRenderingFiber$1; + + renderedWork.memoizedState = firstWorkInProgressHook; + renderedWork.expirationTime = remainingExpirationTime; + renderedWork.updateQueue = componentUpdateQueue; + renderedWork.effectTag |= sideEffectTag; + + { + renderedWork._debugHookTypes = hookTypesDev; + } + + // This check uses currentHook so that it works the same in DEV and prod bundles. + // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. + var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; + + renderExpirationTime$1 = NoWork; + currentlyRenderingFiber$1 = null; + + currentHook = null; + nextCurrentHook = null; + firstWorkInProgressHook = null; + workInProgressHook = null; + nextWorkInProgressHook = null; + + { + currentHookNameInDev = null; + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + } + + remainingExpirationTime = NoWork; + componentUpdateQueue = null; + sideEffectTag = 0; + + // These were reset above + // didScheduleRenderPhaseUpdate = false; + // renderPhaseUpdates = null; + // numberOfReRenders = 0; + + (function() { + if (!!didRenderTooFewHooks) { + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + } + })(); + + return children; +} + +function bailoutHooks(current, workInProgress, expirationTime) { + workInProgress.updateQueue = current.updateQueue; + workInProgress.effectTag &= ~(Passive | Update); + if (current.expirationTime <= expirationTime) { + current.expirationTime = NoWork; + } +} + +function resetHooks() { + // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + + // This is used to reset the state of this module when a component throws. + // It's also called inside mountIndeterminateComponent if we determine the + // component is a module-style component. + renderExpirationTime$1 = NoWork; + currentlyRenderingFiber$1 = null; + + currentHook = null; + nextCurrentHook = null; + firstWorkInProgressHook = null; + workInProgressHook = null; + nextWorkInProgressHook = null; + + { + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + + currentHookNameInDev = null; + } + + remainingExpirationTime = NoWork; + componentUpdateQueue = null; + sideEffectTag = 0; + + didScheduleRenderPhaseUpdate = false; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} + +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + + baseState: null, + queue: null, + baseUpdate: null, + + next: null + }; + + if (workInProgressHook === null) { + // This is the first hook in the list + firstWorkInProgressHook = workInProgressHook = hook; + } else { + // Append to the end of the list + workInProgressHook = workInProgressHook.next = hook; + } + return workInProgressHook; +} + +function updateWorkInProgressHook() { + // This function is used both for updates and for re-renders triggered by a + // render phase update. It assumes there is either a current hook we can + // clone, or a work-in-progress hook from a previous render pass that we can + // use as a base. When we reach the end of the base list, we must switch to + // the dispatcher used for mounts. + if (nextWorkInProgressHook !== null) { + // There's already a work-in-progress. Reuse it. + workInProgressHook = nextWorkInProgressHook; + nextWorkInProgressHook = workInProgressHook.next; + + currentHook = nextCurrentHook; + nextCurrentHook = currentHook !== null ? currentHook.next : null; + } else { + // Clone from the current hook. + (function() { + if (!(nextCurrentHook !== null)) { + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + } + })(); + currentHook = nextCurrentHook; + + var newHook = { + memoizedState: currentHook.memoizedState, + + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + + next: null + }; + + if (workInProgressHook === null) { + // This is the first hook in the list. + workInProgressHook = firstWorkInProgressHook = newHook; + } else { + // Append to the end of the list. + workInProgressHook = workInProgressHook.next = newHook; + } + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} + +function createFunctionComponentUpdateQueue() { + return { + lastEffect: null + }; +} + +function basicStateReducer(state, action) { + return typeof action === "function" ? action(state) : action; +} + +function mountReducer(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + var initialState = void 0; + if (init !== undefined) { + initialState = init(initialArg); + } else { + initialState = initialArg; + } + hook.memoizedState = hook.baseState = initialState; + var queue = (hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialState + }); + var dispatch = (queue.dispatch = dispatchAction.bind( + null, + // Flow doesn't know this is non-null, but we do. + currentlyRenderingFiber$1, + queue + )); + return [hook.memoizedState, dispatch]; +} + +function updateReducer(reducer, initialArg, init) { + var hook = updateWorkInProgressHook(); + var queue = hook.queue; + (function() { + if (!(queue !== null)) { + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + + queue.lastRenderedReducer = reducer; + + if (numberOfReRenders > 0) { + // This is a re-render. Apply the new render phase updates to the previous + var _dispatch = queue.dispatch; + if (renderPhaseUpdates !== null) { + // Render phase updates are stored in a map of queue -> linked list + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (firstRenderPhaseUpdate !== undefined) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + var update = firstRenderPhaseUpdate; + do { + // Process this render phase update. We don't have to check the + // priority because it will always be the same as the current + // render's. + var _action = update.action; + newState = reducer(newState, _action); + update = update.next; + } while (update !== null); + + // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!is(newState, hook.memoizedState)) { + markWorkInProgressReceivedUpdate(); + } + + hook.memoizedState = newState; + // Don't persist the state accumulated from the render phase updates to + // the base state unless the queue is empty. + // TODO: Not sure if this is the desired semantics, but it's what we + // do for gDSFP. I can't remember why. + if (hook.baseUpdate === queue.last) { + hook.baseState = newState; + } + + queue.lastRenderedState = newState; + + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + + // The last update in the entire queue + var last = queue.last; + // The last update that is part of the base state. + var baseUpdate = hook.baseUpdate; + var baseState = hook.baseState; + + // Find the first unprocessed update. + var first = void 0; + if (baseUpdate !== null) { + if (last !== null) { + // For the first update, the queue is a circular linked list where + // `queue.last.next = queue.first`. Once the first update commits, and + // the `baseUpdate` is no longer empty, we can unravel the list. + last.next = null; + } + first = baseUpdate.next; + } else { + first = last !== null ? last.next : null; + } + if (first !== null) { + var _newState = baseState; + var newBaseState = null; + var newBaseUpdate = null; + var prevUpdate = baseUpdate; + var _update = first; + var didSkip = false; + do { + var updateExpirationTime = _update.expirationTime; + if (updateExpirationTime < renderExpirationTime$1) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + if (!didSkip) { + didSkip = true; + newBaseUpdate = prevUpdate; + newBaseState = _newState; + } + // Update the remaining priority in the queue. + if (updateExpirationTime > remainingExpirationTime) { + remainingExpirationTime = updateExpirationTime; + } + } else { + // This update does have sufficient priority. + + // Mark the event time of this update as relevant to this render pass. + // TODO: This should ideally use the true event time of this update rather than + // its priority which is a derived and not reverseable value. + // TODO: We should skip this update if it was already committed but currently + // we have no way of detecting the difference between a committed and suspended + // update here. + markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ); + + // Process this update. + if (_update.eagerReducer === reducer) { + // If this update was processed eagerly, and its reducer matches the + // current reducer, we can use the eagerly computed state. + _newState = _update.eagerState; + } else { + var _action2 = _update.action; + _newState = reducer(_newState, _action2); + } + } + prevUpdate = _update; + _update = _update.next; + } while (_update !== null && _update !== first); + + if (!didSkip) { + newBaseUpdate = prevUpdate; + newBaseState = _newState; + } + + // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!is(_newState, hook.memoizedState)) { + markWorkInProgressReceivedUpdate(); + } + + hook.memoizedState = _newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = newBaseState; + + queue.lastRenderedState = _newState; + } + + var dispatch = queue.dispatch; + return [hook.memoizedState, dispatch]; +} + +function mountState(initialState) { + var hook = mountWorkInProgressHook(); + if (typeof initialState === "function") { + initialState = initialState(); + } + hook.memoizedState = hook.baseState = initialState; + var queue = (hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }); + var dispatch = (queue.dispatch = dispatchAction.bind( + null, + // Flow doesn't know this is non-null, but we do. + currentlyRenderingFiber$1, + queue + )); + return [hook.memoizedState, dispatch]; +} + +function updateState(initialState) { + return updateReducer(basicStateReducer, initialState); +} + +function pushEffect(tag, create, destroy, deps) { + var effect = { + tag: tag, + create: create, + destroy: destroy, + deps: deps, + // Circular + next: null + }; + if (componentUpdateQueue === null) { + componentUpdateQueue = createFunctionComponentUpdateQueue(); + componentUpdateQueue.lastEffect = effect.next = effect; + } else { + var _lastEffect = componentUpdateQueue.lastEffect; + if (_lastEffect === null) { + componentUpdateQueue.lastEffect = effect.next = effect; + } else { + var firstEffect = _lastEffect.next; + _lastEffect.next = effect; + effect.next = firstEffect; + componentUpdateQueue.lastEffect = effect; + } + } + return effect; +} + +function mountRef(initialValue) { + var hook = mountWorkInProgressHook(); + var ref = { current: initialValue }; + { + Object.seal(ref); + } + hook.memoizedState = ref; + return ref; +} + +function updateRef(initialValue) { + var hook = updateWorkInProgressHook(); + return hook.memoizedState; +} + +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps); +} + +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var destroy = undefined; + + if (currentHook !== null) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (nextDeps !== null) { + var prevDeps = prevEffect.deps; + if (areHookInputsEqual(nextDeps, prevDeps)) { + pushEffect(NoEffect$1, create, destroy, nextDeps); + return; + } + } + } + + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps); +} + +function mountEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } + return mountEffectImpl( + Update | Passive, + UnmountPassive | MountPassive, + create, + deps + ); +} + +function updateEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } + return updateEffectImpl( + Update | Passive, + UnmountPassive | MountPassive, + create, + deps + ); +} + +function mountLayoutEffect(create, deps) { + return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps); +} + +function updateLayoutEffect(create, deps) { + return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps); +} + +function imperativeHandleEffect(create, ref) { + if (typeof ref === "function") { + var refCallback = ref; + var _inst = create(); + refCallback(_inst); + return function() { + refCallback(null); + }; + } else if (ref !== null && ref !== undefined) { + var refObject = ref; + { + !refObject.hasOwnProperty("current") + ? warning$1( + false, + "Expected useImperativeHandle() first argument to either be a " + + "ref callback or React.createRef() object. Instead received: %s.", + "an object with keys {" + Object.keys(refObject).join(", ") + "}" + ) + : void 0; + } + var _inst2 = create(); + refObject.current = _inst2; + return function() { + refObject.current = null; + }; + } +} + +function mountImperativeHandle(ref, create, deps) { + { + !(typeof create === "function") + ? warning$1( + false, + "Expected useImperativeHandle() second argument to be a function " + + "that creates a handle. Instead received: %s.", + create !== null ? typeof create : "null" + ) + : void 0; + } + + // TODO: If deps are provided, should we skip comparing the ref itself? + var effectDeps = + deps !== null && deps !== undefined ? deps.concat([ref]) : null; + + return mountEffectImpl( + Update, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + effectDeps + ); +} + +function updateImperativeHandle(ref, create, deps) { + { + !(typeof create === "function") + ? warning$1( + false, + "Expected useImperativeHandle() second argument to be a function " + + "that creates a handle. Instead received: %s.", + create !== null ? typeof create : "null" + ) + : void 0; + } + + // TODO: If deps are provided, should we skip comparing the ref itself? + var effectDeps = + deps !== null && deps !== undefined ? deps.concat([ref]) : null; + + return updateEffectImpl( + Update, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + effectDeps + ); +} + +function mountDebugValue(value, formatterFn) { + // This hook is normally a no-op. + // The react-debug-hooks package injects its own implementation + // so that e.g. DevTools can display custom hook values. +} + +var updateDebugValue = mountDebugValue; + +function mountCallback(callback, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + hook.memoizedState = [callback, nextDeps]; + return callback; +} + +function updateCallback(callback, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) { + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) { + return prevState[0]; + } + } + } + hook.memoizedState = [callback, nextDeps]; + return callback; +} + +function mountMemo(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var nextValue = nextCreate(); + hook.memoizedState = [nextValue, nextDeps]; + return nextValue; +} + +function updateMemo(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) { + // Assume these are defined. If they're not, areHookInputsEqual will warn. + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) { + return prevState[0]; + } + } + } + var nextValue = nextCreate(); + hook.memoizedState = [nextValue, nextDeps]; + return nextValue; +} + +function dispatchAction(fiber, queue, action) { + (function() { + if (!(numberOfReRenders < RE_RENDER_LIMIT)) { + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + } + })(); + + { + !(arguments.length <= 3) + ? warning$1( + false, + "State updates from the useState() and useReducer() Hooks don't support the " + + "second callback argument. To execute a side effect after " + + "rendering, declare it in the component body with useEffect()." + ) + : void 0; + } + + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (alternate !== null && alternate === currentlyRenderingFiber$1) + ) { + // This is a render phase update. Stash it in a lazily-created map of + // queue -> linked list of updates. After this render pass, we'll restart + // and apply the stashed updates on top of the work-in-progress hook. + didScheduleRenderPhaseUpdate = true; + var update = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + { + update.priority = getCurrentPriorityLevel(); + } + if (renderPhaseUpdates === null) { + renderPhaseUpdates = new Map(); + } + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (firstRenderPhaseUpdate === undefined) { + renderPhaseUpdates.set(queue, update); + } else { + // Append the update to the end of the list. + var lastRenderPhaseUpdate = firstRenderPhaseUpdate; + while (lastRenderPhaseUpdate.next !== null) { + lastRenderPhaseUpdate = lastRenderPhaseUpdate.next; + } + lastRenderPhaseUpdate.next = update; + } + } else { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + + var currentTime = requestCurrentTime(); + var _suspenseConfig = requestCurrentSuspenseConfig(); + var _expirationTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + + var _update2 = { + expirationTime: _expirationTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + + { + _update2.priority = getCurrentPriorityLevel(); + } + + // Append the update to the end of the list. + var _last = queue.last; + if (_last === null) { + // This is the first update. Create a circular list. + _update2.next = _update2; + } else { + var first = _last.next; + if (first !== null) { + // Still circular. + _update2.next = first; + } + _last.next = _update2; + } + queue.last = _update2; + + if ( + fiber.expirationTime === NoWork && + (alternate === null || alternate.expirationTime === NoWork) + ) { + // The queue is currently empty, which means we can eagerly compute the + // next state before entering the render phase. If the new state is the + // same as the current state, we may be able to bail out entirely. + var _lastRenderedReducer = queue.lastRenderedReducer; + if (_lastRenderedReducer !== null) { + var prevDispatcher = void 0; + { + prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + } + try { + var currentState = queue.lastRenderedState; + var _eagerState = _lastRenderedReducer(currentState, action); + // Stash the eagerly computed state, and the reducer used to compute + // it, on the update object. If the reducer hasn't changed by the + // time we enter the render phase, then the eager state can be used + // without calling the reducer again. + _update2.eagerReducer = _lastRenderedReducer; + _update2.eagerState = _eagerState; + if (is(_eagerState, currentState)) { + // Fast path. We can bail out without scheduling React to re-render. + // It's still possible that we'll need to rebase this update later, + // if the component re-renders for a different reason and by that + // time the reducer has changed. + return; + } + } catch (error) { + // Suppress the error. It will throw again in the render phase. + } finally { + { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + } + } + } + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotScopedWithMatchingAct(fiber); + warnIfNotCurrentlyActingUpdatesInDev(fiber); + } + } + scheduleWork(fiber, _expirationTime); + } +} + +var ContextOnlyDispatcher = { + readContext: readContext, + + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError +}; + +var HooksDispatcherOnMountInDEV = null; +var HooksDispatcherOnMountWithHookTypesInDEV = null; +var HooksDispatcherOnUpdateInDEV = null; +var InvalidNestedHooksDispatcherOnMountInDEV = null; +var InvalidNestedHooksDispatcherOnUpdateInDEV = null; + +{ + var warnInvalidContextAccess = function() { + warning$1( + false, + "Context can only be read while React is rendering. " + + "In classes, you can read it in the render method or getDerivedStateFromProps. " + + "In function components, you can read it directly in the function body, but not " + + "inside Hooks like useReducer() or useMemo()." + ); + }; + + var warnInvalidHookAccess = function() { + warning$1( + false, + "Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. " + + "You can only call Hooks at the top level of your React function. " + + "For more information, see " + + "https://fb.me/rules-of-hooks" + ); + }; + + HooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + mountHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + mountHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + HooksDispatcherOnMountWithHookTypesInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + HooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return updateRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + InvalidNestedHooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + InvalidNestedHooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; +} + +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var now$1 = Scheduler.unstable_now; + +var commitTime = 0; +var profilerStartTime = -1; + +function getCommitTime() { + return commitTime; +} + +function recordCommitTime() { + if (!enableProfilerTimer) { + return; + } + commitTime = now$1(); +} + +function startProfilerTimer(fiber) { + if (!enableProfilerTimer) { + return; + } + + profilerStartTime = now$1(); + + if (fiber.actualStartTime < 0) { + fiber.actualStartTime = now$1(); + } +} + +function stopProfilerTimerIfRunning(fiber) { + if (!enableProfilerTimer) { + return; + } + profilerStartTime = -1; +} + +function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { + if (!enableProfilerTimer) { + return; + } + + if (profilerStartTime >= 0) { + var elapsedTime = now$1() - profilerStartTime; + fiber.actualDuration += elapsedTime; + if (overrideBaseTime) { + fiber.selfBaseDuration = elapsedTime; + } + profilerStartTime = -1; + } +} + +// The deepest Fiber on the stack involved in a hydration context. +// This may have been an insertion or a hydration. +var hydrationParentFiber = null; +var nextHydratableInstance = null; +var isHydrating = false; + +function warnIfHydrating() { + { + !!isHydrating + ? warning$1( + false, + "We should not be hydrating here. This is a bug in React. Please file a bug." + ) + : void 0; + } +} + +function enterHydrationState(fiber) { + if (!supportsHydration) { + return false; + } + + var parentInstance = fiber.stateNode.containerInfo; + nextHydratableInstance = getFirstHydratableChild(parentInstance); + hydrationParentFiber = fiber; + isHydrating = true; + return true; +} + +function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) { + if (!supportsHydration) { + return false; + } + + var suspenseInstance = fiber.stateNode; + nextHydratableInstance = getNextHydratableSibling(suspenseInstance); + popToNextHostParent(fiber); + isHydrating = true; + return true; +} + +function deleteHydratableInstance(returnFiber, instance) { + { + switch (returnFiber.tag) { + case HostRoot: + didNotHydrateContainerInstance( + returnFiber.stateNode.containerInfo, + instance + ); + break; + case HostComponent: + didNotHydrateInstance( + returnFiber.type, + returnFiber.memoizedProps, + returnFiber.stateNode, + instance + ); + break; + } + } + + var childToDelete = createFiberFromHostInstanceForDeletion(); + childToDelete.stateNode = instance; + childToDelete.return = returnFiber; + childToDelete.effectTag = Deletion; + + // This might seem like it belongs on progressedFirstDeletion. However, + // these children are not part of the reconciliation list of children. + // Even if we abort and rereconcile the children, that will try to hydrate + // again and the nodes are still in the host tree so these will be + // recreated. + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + } +} + +function insertNonHydratedInstance(returnFiber, fiber) { + fiber.effectTag |= Placement; + { + switch (returnFiber.tag) { + case HostRoot: { + var parentContainer = returnFiber.stateNode.containerInfo; + switch (fiber.tag) { + case HostComponent: + var type = fiber.type; + var props = fiber.pendingProps; + didNotFindHydratableContainerInstance(parentContainer, type, props); + break; + case HostText: + var text = fiber.pendingProps; + didNotFindHydratableContainerTextInstance(parentContainer, text); + break; + case SuspenseComponent: + didNotFindHydratableContainerSuspenseInstance(parentContainer); + break; + } + break; + } + case HostComponent: { + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + switch (fiber.tag) { + case HostComponent: + var _type = fiber.type; + var _props = fiber.pendingProps; + didNotFindHydratableInstance( + parentType, + parentProps, + parentInstance, + _type, + _props + ); + break; + case HostText: + var _text = fiber.pendingProps; + didNotFindHydratableTextInstance( + parentType, + parentProps, + parentInstance, + _text + ); + break; + case SuspenseComponent: + didNotFindHydratableSuspenseInstance( + parentType, + parentProps, + parentInstance + ); + break; + } + break; + } + default: + return; + } + } +} + +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case HostComponent: { + var type = fiber.type; + var props = fiber.pendingProps; + var instance = canHydrateInstance(nextInstance, type, props); + if (instance !== null) { + fiber.stateNode = instance; + return true; + } + return false; + } + case HostText: { + var text = fiber.pendingProps; + var textInstance = canHydrateTextInstance(nextInstance, text); + if (textInstance !== null) { + fiber.stateNode = textInstance; + return true; + } + return false; + } + case SuspenseComponent: { + if (enableSuspenseServerRenderer) { + var suspenseInstance = canHydrateSuspenseInstance(nextInstance); + if (suspenseInstance !== null) { + // Downgrade the tag to a dehydrated component until we've hydrated it. + fiber.tag = DehydratedSuspenseComponent; + fiber.stateNode = suspenseInstance; + return true; + } + } + return false; + } + default: + return false; + } +} + +function tryToClaimNextHydratableInstance(fiber) { + if (!isHydrating) { + return; + } + var nextInstance = nextHydratableInstance; + if (!nextInstance) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber, nextInstance)) { + // If we can't hydrate this instance let's try the next one. + // We use this as a heuristic. It's based on intuition and not data so it + // might be flawed or unnecessary. + nextInstance = getNextHydratableSibling(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber, nextInstance)) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } + // We matched the next one, we'll now assume that the first one was + // superfluous and we'll delete it. Since we can't eagerly delete it + // we'll have to schedule a deletion. To do that, this node needs a dummy + // fiber associated with it. + deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance); + } + hydrationParentFiber = fiber; + nextHydratableInstance = getFirstHydratableChild(nextInstance); +} + +function prepareToHydrateHostInstance( + fiber, + rootContainerInstance, + hostContext +) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + var instance = fiber.stateNode; + var updatePayload = hydrateInstance( + instance, + fiber.type, + fiber.memoizedProps, + rootContainerInstance, + hostContext, + fiber + ); + // TODO: Type this specific to this type of component. + fiber.updateQueue = updatePayload; + // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. + if (updatePayload !== null) { + return true; + } + return false; +} + +function prepareToHydrateHostTextInstance(fiber) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + var textInstance = fiber.stateNode; + var textContent = fiber.memoizedProps; + var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); + { + if (shouldUpdate) { + // We assume that prepareToHydrateHostTextInstance is called in a context where the + // hydration parent is the parent host component of this host text. + var returnFiber = hydrationParentFiber; + if (returnFiber !== null) { + switch (returnFiber.tag) { + case HostRoot: { + var parentContainer = returnFiber.stateNode.containerInfo; + didNotMatchHydratedContainerTextInstance( + parentContainer, + textInstance, + textContent + ); + break; + } + case HostComponent: { + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + didNotMatchHydratedTextInstance( + parentType, + parentProps, + parentInstance, + textInstance, + textContent + ); + break; + } + } + } + } + } + return shouldUpdate; +} + +function skipPastDehydratedSuspenseInstance(fiber) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + var suspenseInstance = fiber.stateNode; + (function() { + if (!suspenseInstance) { + throw ReactError( + Error( + "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance( + suspenseInstance + ); +} + +function popToNextHostParent(fiber) { + var parent = fiber.return; + while ( + parent !== null && + parent.tag !== HostComponent && + parent.tag !== HostRoot && + parent.tag !== DehydratedSuspenseComponent + ) { + parent = parent.return; + } + hydrationParentFiber = parent; +} + +function popHydrationState(fiber) { + if (!supportsHydration) { + return false; + } + if (fiber !== hydrationParentFiber) { + // We're deeper than the current hydration context, inside an inserted + // tree. + return false; + } + if (!isHydrating) { + // If we're not currently hydrating but we're in a hydration context, then + // we were an insertion and now need to pop up reenter hydration of our + // siblings. + popToNextHostParent(fiber); + isHydrating = true; + return false; + } + + var type = fiber.type; + + // If we have any remaining hydratable nodes, we need to delete them now. + // We only do this deeper than head and body since they tend to have random + // other nodes in them. We also ignore components with pure text content in + // side of them. + // TODO: Better heuristic. + if ( + fiber.tag !== HostComponent || + (type !== "head" && + type !== "body" && + !shouldSetTextContent(type, fiber.memoizedProps)) + ) { + var nextInstance = nextHydratableInstance; + while (nextInstance) { + deleteHydratableInstance(fiber, nextInstance); + nextInstance = getNextHydratableSibling(nextInstance); + } + } + + popToNextHostParent(fiber); + nextHydratableInstance = hydrationParentFiber + ? getNextHydratableSibling(fiber.stateNode) + : null; + return true; +} + +function resetHydrationState() { + if (!supportsHydration) { + return; + } + + hydrationParentFiber = null; + nextHydratableInstance = null; + isHydrating = false; +} + +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; + +var didReceiveUpdate = false; + +var didWarnAboutBadClass = void 0; +var didWarnAboutModulePatternComponent = void 0; +var didWarnAboutContextTypeOnFunctionComponent = void 0; +var didWarnAboutGetDerivedStateOnFunctionComponent = void 0; +var didWarnAboutFunctionRefs = void 0; +var didWarnAboutReassigningProps = void 0; +var didWarnAboutMaxDuration = void 0; +var didWarnAboutRevealOrder = void 0; +var didWarnAboutTailOptions = void 0; +var didWarnAboutDefaultPropsOnFunctionComponent = void 0; + +{ + didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; + didWarnAboutContextTypeOnFunctionComponent = {}; + didWarnAboutGetDerivedStateOnFunctionComponent = {}; + didWarnAboutFunctionRefs = {}; + didWarnAboutReassigningProps = false; + didWarnAboutMaxDuration = false; + didWarnAboutRevealOrder = {}; + didWarnAboutTailOptions = {}; + didWarnAboutDefaultPropsOnFunctionComponent = {}; +} + +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + if (current$$1 === null) { + // If this is a fresh new component that hasn't been rendered yet, we + // won't update its child set by applying minimal side-effects. Instead, + // we will add them all to the child before it gets rendered. That means + // we can optimize this reconciliation pass by not tracking side-effects. + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + // If the current child is the same as the work in progress, it means that + // we haven't yet started any work on these children. Therefore, we use + // the clone algorithm to create a copy of all the current children. + + // If we had any progressed work already, that is invalid at this point so + // let's throw it out. + workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); + } +} + +function forceUnmountCurrentAndReconcile( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + // This function is fork of reconcileChildren. It's used in cases where we + // want to reconcile without matching against the existing set. This has the + // effect of all current children being unmounted; even if the type and key + // are the same, the old child is unmounted and a new child is created. + // + // To do this, we're going to go through the reconcile algorithm twice. In + // the first pass, we schedule a deletion for all the current children by + // passing null. + workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + ); + // In the second pass, we mount the new children. The trick here is that we + // pass null in place of where we usually pass the current child set. This has + // the effect of remounting all children regardless of whether their their + // identity matches. + workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); +} + +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + // TODO: current can be non-null here even if the component + // hasn't yet mounted. This happens after the first render suspends. + // We'll need to figure out if this is fine or can cause issues. + + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + var render = Component.render; + var ref = workInProgress.ref; + + // The rest is a fork of updateFunctionComponent + var nextChildren = void 0; + prepareToReadContext(workInProgress, renderExpirationTime); + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + nextChildren = renderWithHooks( + current$$1, + workInProgress, + render, + nextProps, + ref, + renderExpirationTime + ); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + nextChildren = renderWithHooks( + current$$1, + workInProgress, + render, + nextProps, + ref, + renderExpirationTime + ); + } + } + setCurrentPhase(null); + } + + if (current$$1 !== null && !didReceiveUpdate) { + bailoutHooks(current$$1, workInProgress, renderExpirationTime); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (current$$1 === null) { + var type = Component.type; + if ( + isSimpleFunctionComponent(type) && + Component.compare === null && + // SimpleMemoComponent codepath doesn't resolve outer props either. + Component.defaultProps === undefined + ) { + var resolvedType = type; + { + resolvedType = resolveFunctionForHotReloading(type); + } + // If this is a plain function component without default props, + // and with only the default shallow comparison, we upgrade it + // to a SimpleMemoComponent to allow fast path updates. + workInProgress.tag = SimpleMemoComponent; + workInProgress.type = resolvedType; + { + validateFunctionComponentInDev(workInProgress, type); + } + return updateSimpleMemoComponent( + current$$1, + workInProgress, + resolvedType, + nextProps, + updateExpirationTime, + renderExpirationTime + ); + } + { + var innerPropTypes = type.propTypes; + if (innerPropTypes) { + // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(type), + getCurrentFiberStackInDev + ); + } + } + var child = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + child.ref = workInProgress.ref; + child.return = workInProgress; + workInProgress.child = child; + return child; + } + { + var _type = Component.type; + var _innerPropTypes = _type.propTypes; + if (_innerPropTypes) { + // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes( + _innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(_type), + getCurrentFiberStackInDev + ); + } + } + var currentChild = current$$1.child; // This is always exactly one child + if (updateExpirationTime < renderExpirationTime) { + // This will be the props with resolved defaultProps, + // unlike current.memoizedProps which will be the unresolved ones. + var prevProps = currentChild.memoizedProps; + // Default to shallow comparison + var compare = Component.compare; + compare = compare !== null ? compare : shallowEqual; + if ( + compare(prevProps, nextProps) && + current$$1.ref === workInProgress.ref + ) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + var newChild = createWorkInProgress( + currentChild, + nextProps, + renderExpirationTime + ); + newChild.ref = workInProgress.ref; + newChild.return = workInProgress; + workInProgress.child = newChild; + return newChild; +} + +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + // TODO: current can be non-null here even if the component + // hasn't yet mounted. This happens when the inner render suspends. + // We'll need to figure out if this is fine or can cause issues. + + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var outerMemoType = workInProgress.elementType; + if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { + // We warn when you define propTypes on lazy() + // so let's just skip over it to find memo() outer wrapper. + // Inner props for memo are validated later. + outerMemoType = refineResolvedLazyComponent(outerMemoType); + } + var outerPropTypes = outerMemoType && outerMemoType.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + nextProps, // Resolved (SimpleMemoComponent has no defaultProps) + "prop", + getComponentName(outerMemoType), + getCurrentFiberStackInDev + ); + } + // Inner propTypes will be validated in the function component path. + } + } + if (current$$1 !== null) { + var prevProps = current$$1.memoizedProps; + if ( + shallowEqual(prevProps, nextProps) && + current$$1.ref === workInProgress.ref && + // Prevent bailout if the implementation changed due to hot reload: + workInProgress.type === current$$1.type + ) { + didReceiveUpdate = false; + if (updateExpirationTime < renderExpirationTime) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + } + return updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} + +function updateFragment(current$$1, workInProgress, renderExpirationTime) { + var nextChildren = workInProgress.pendingProps; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateMode(current$$1, workInProgress, renderExpirationTime) { + var nextChildren = workInProgress.pendingProps.children; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateProfiler(current$$1, workInProgress, renderExpirationTime) { + if (enableProfilerTimer) { + workInProgress.effectTag |= Update; + } + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (current$$1 === null && ref !== null) || + (current$$1 !== null && current$$1.ref !== ref) + ) { + // Schedule a Ref effect + workInProgress.effectTag |= Ref; + } +} + +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + var nextChildren = void 0; + prepareToReadContext(workInProgress, renderExpirationTime); + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + nextChildren = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + nextChildren = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + } + } + setCurrentPhase(null); + } + + if (current$$1 !== null && !didReceiveUpdate) { + bailoutHooks(current$$1, workInProgress, renderExpirationTime); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = void 0; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + prepareToReadContext(workInProgress, renderExpirationTime); + + var instance = workInProgress.stateNode; + var shouldUpdate = void 0; + if (instance === null) { + if (current$$1 !== null) { + // An class component without an instance only mounts if it suspended + // inside a non- concurrent tree, in an inconsistent state. We want to + // tree it like a new mount, even though an empty version of it already + // committed. Disconnect the alternate pointers. + current$$1.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + // In the initial pass we might need to construct the instance. + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + shouldUpdate = true; + } else if (current$$1 === null) { + // In a resume, we'll already have an instance we can reuse. + shouldUpdate = resumeMountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + } else { + shouldUpdate = updateClassInstance( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + } + var nextUnitOfWork = finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime + ); + { + var inst = workInProgress.stateNode; + if (inst.props !== nextProps) { + !didWarnAboutReassigningProps + ? warning$1( + false, + "It looks like %s is reassigning its own `this.props` while rendering. " + + "This is not supported and can lead to confusing bugs.", + getComponentName(workInProgress.type) || "a component" + ) + : void 0; + didWarnAboutReassigningProps = true; + } + } + return nextUnitOfWork; +} + +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + // Refs should update even if shouldComponentUpdate returns false + markRef(current$$1, workInProgress); + + var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect; + + if (!shouldUpdate && !didCaptureError) { + // Context providers should defer to sCU for rendering + if (hasContext) { + invalidateContextProvider(workInProgress, Component, false); + } + + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + var instance = workInProgress.stateNode; + + // Rerender + ReactCurrentOwner$3.current = workInProgress; + var nextChildren = void 0; + if ( + didCaptureError && + typeof Component.getDerivedStateFromError !== "function" + ) { + // If we captured an error, but getDerivedStateFrom catch is not defined, + // unmount all the children. componentDidCatch will schedule an update to + // re-render a fallback. This is temporary until we migrate everyone to + // the new API. + // TODO: Warn in a future release. + nextChildren = null; + + if (enableProfilerTimer) { + stopProfilerTimerIfRunning(workInProgress); + } + } else { + { + setCurrentPhase("render"); + nextChildren = instance.render(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + instance.render(); + } + setCurrentPhase(null); + } + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + if (current$$1 !== null && didCaptureError) { + // If we're recovering from an error, reconcile without reusing any of + // the existing children. Conceptually, the normal children and the children + // that are shown on error are two different sets, so we shouldn't reuse + // normal children even if their identities match. + forceUnmountCurrentAndReconcile( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } else { + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } + + // Memoize state using the values we just used to render. + // TODO: Restructure so we never read values from the instance. + workInProgress.memoizedState = instance.state; + + // The context might have changed so we need to recalculate it. + if (hasContext) { + invalidateContextProvider(workInProgress, Component, true); + } + + return workInProgress.child; +} + +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + if (root.pendingContext) { + pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ); + } else if (root.context) { + // Should always be set + pushTopLevelContextObject(workInProgress, root.context, false); + } + pushHostContainer(workInProgress, root.containerInfo); +} + +function updateHostRoot(current$$1, workInProgress, renderExpirationTime) { + pushHostRootContext(workInProgress); + var updateQueue = workInProgress.updateQueue; + (function() { + if (!(updateQueue !== null)) { + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var nextProps = workInProgress.pendingProps; + var prevState = workInProgress.memoizedState; + var prevChildren = prevState !== null ? prevState.element : null; + processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + null, + renderExpirationTime + ); + var nextState = workInProgress.memoizedState; + // Caution: React DevTools currently depends on this property + // being called "element". + var nextChildren = nextState.element; + if (nextChildren === prevChildren) { + // If the state is the same as before, that's a bailout because we had + // no work that expires at this time. + resetHydrationState(); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + var root = workInProgress.stateNode; + if ( + (current$$1 === null || current$$1.child === null) && + root.hydrate && + enterHydrationState(workInProgress) + ) { + // If we don't have any current children this might be the first pass. + // We always try to hydrate. If this isn't a hydration pass there won't + // be any children to hydrate which is effectively the same thing as + // not hydrating. + + // This is a bit of a hack. We track the host root as a placement to + // know that we're currently in a mounting state. That way isMounted + // works as expected. We must reset this before committing. + // TODO: Delete this when we delete isMounted and findDOMNode. + workInProgress.effectTag |= Placement; + + // Ensure that children mount into this root without tracking + // side-effects. This ensures that we don't store Placement effects on + // nodes that will be hydrated. + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + // Otherwise reset hydration state in case we aborted and resumed another + // root. + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + resetHydrationState(); + } + return workInProgress.child; +} + +function updateHostComponent(current$$1, workInProgress, renderExpirationTime) { + pushHostContext(workInProgress); + + if (current$$1 === null) { + tryToClaimNextHydratableInstance(workInProgress); + } + + var type = workInProgress.type; + var nextProps = workInProgress.pendingProps; + var prevProps = current$$1 !== null ? current$$1.memoizedProps : null; + + var nextChildren = nextProps.children; + var isDirectTextChild = shouldSetTextContent(type, nextProps); + + if (isDirectTextChild) { + // We special case a direct text child of a host node. This is a common + // case. We won't handle it as a reified child. We will instead handle + // this in the host environment that also have access to this prop. That + // avoids allocating another HostText fiber and traversing it. + nextChildren = null; + } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) { + // If we're switching from a direct text child to a normal child, or to + // empty, we need to schedule the text content to be reset. + workInProgress.effectTag |= ContentReset; + } + + markRef(current$$1, workInProgress); + + // Check the host config to see if the children are offscreen/hidden. + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(type, nextProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } + + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateHostText(current$$1, workInProgress) { + if (current$$1 === null) { + tryToClaimNextHydratableInstance(workInProgress); + } + // Nothing to do here. This is terminal. We'll do the completion step + // immediately after. + return null; +} + +function mountLazyComponent( + _current, + workInProgress, + elementType, + updateExpirationTime, + renderExpirationTime +) { + if (_current !== null) { + // An lazy component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + var props = workInProgress.pendingProps; + // We can't start a User Timing measurement with correct label yet. + // Cancel and resume right after we know the tag. + cancelWorkTimer(workInProgress); + var Component = readLazyComponentType(elementType); + // Store the unwrapped component in the type. + workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = resolveLazyComponentTag(Component)); + startWorkTimer(workInProgress); + var resolvedProps = resolveDefaultProps(Component, props); + var child = void 0; + switch (resolvedTag) { + case FunctionComponent: { + { + validateFunctionComponentInDev(workInProgress, Component); + workInProgress.type = Component = resolveFunctionForHotReloading( + Component + ); + } + child = updateFunctionComponent( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case ClassComponent: { + { + workInProgress.type = Component = resolveClassForHotReloading( + Component + ); + } + child = updateClassComponent( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case ForwardRef: { + { + workInProgress.type = Component = resolveForwardRefForHotReloading( + Component + ); + } + child = updateForwardRef( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case MemoComponent: { + { + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = Component.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + resolvedProps, // Resolved for outer only + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + child = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too + updateExpirationTime, + renderExpirationTime + ); + break; + } + default: { + var hint = ""; + { + if ( + Component !== null && + typeof Component === "object" && + Component.$$typeof === REACT_LAZY_TYPE + ) { + hint = " Did you wrap a component in React.lazy() more than once?"; + } + } + // This message intentionally doesn't mention ForwardRef or MemoComponent + // because the fact that it's a separate type of work is an + // implementation detail. + (function() { + { + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." + + hint + ) + ); + } + })(); + } + } + return child; +} + +function mountIncompleteClassComponent( + _current, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (_current !== null) { + // An incomplete component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + // Promote the fiber to a class and try rendering again. + workInProgress.tag = ClassComponent; + + // The rest of this function is a fork of `updateClassComponent` + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = void 0; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + prepareToReadContext(workInProgress, renderExpirationTime); + + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + + return finishClassComponent( + null, + workInProgress, + Component, + true, + hasContext, + renderExpirationTime + ); +} + +function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderExpirationTime +) { + if (_current !== null) { + // An indeterminate component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + var props = workInProgress.pendingProps; + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderExpirationTime); + var value = void 0; + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + warningWithoutStack$1( + false, + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictMode) { + ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); + } + + ReactCurrentOwner$3.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderExpirationTime + ); + } + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + { + var _componentName = getComponentName(Component) || "Unknown"; + if (!didWarnAboutModulePatternComponent[_componentName]) { + warningWithoutStack$1( + false, + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + + // Proceed under the assumption that this is a class instance + workInProgress.tag = ClassComponent; + + // Throw out any hooks that were used. + resetHooks(); + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = false; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + + workInProgress.memoizedState = + value.state !== null && value.state !== undefined ? value.state : null; + + var getDerivedStateFromProps = Component.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + props + ); + } + + adoptClassInstance(workInProgress, value); + mountClassInstance(workInProgress, Component, props, renderExpirationTime); + return finishClassComponent( + null, + workInProgress, + Component, + true, + hasContext, + renderExpirationTime + ); + } else { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + { + if (disableLegacyContext && Component.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with React.useContext() instead.", + getComponentName(Component) || "Unknown" + ); + } + + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderExpirationTime + ); + } + } + } + reconcileChildren(null, workInProgress, value, renderExpirationTime); + { + validateFunctionComponentInDev(workInProgress, Component); + } + return workInProgress.child; + } +} + +function validateFunctionComponentInDev(workInProgress, Component) { + if (Component) { + !!Component.childContextTypes + ? warningWithoutStack$1( + false, + "%s(...): childContextTypes cannot be defined on a function component.", + Component.displayName || Component.name || "Component" + ) + : void 0; + } + if (workInProgress.ref !== null) { + var info = ""; + var ownerName = getCurrentFiberOwnerNameInDevOrNull(); + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + + var warningKey = ownerName || workInProgress._debugID || ""; + var debugSource = workInProgress._debugSource; + if (debugSource) { + warningKey = debugSource.fileName + ":" + debugSource.lineNumber; + } + if (!didWarnAboutFunctionRefs[warningKey]) { + didWarnAboutFunctionRefs[warningKey] = true; + warning$1( + false, + "Function components cannot be given refs. " + + "Attempts to access this ref will fail. " + + "Did you mean to use React.forwardRef()?%s", + info + ); + } + } + + if ( + warnAboutDefaultPropsOnFunctionComponents && + Component.defaultProps !== undefined + ) { + var componentName = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { + warningWithoutStack$1( + false, + "%s: Support for defaultProps will be removed from function components " + + "in a future major release. Use JavaScript default parameters instead.", + componentName + ); + didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; + } + } + + if (typeof Component.getDerivedStateFromProps === "function") { + var _componentName2 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) { + warningWithoutStack$1( + false, + "%s: Function components do not support getDerivedStateFromProps.", + _componentName2 + ); + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true; + } + } + + if ( + typeof Component.contextType === "object" && + Component.contextType !== null + ) { + var _componentName3 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + warningWithoutStack$1( + false, + "%s: Function components do not support contextType.", + _componentName3 + ); + didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + } + } +} + +// TODO: This is now an empty object. Should we just make it a boolean? +var SUSPENDED_MARKER = {}; + +function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) { + // If the context is telling us that we should show a fallback, and we're not + // already showing content, then we should show the fallback instead. + return ( + hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && + (current$$1 === null || current$$1.memoizedState !== null) + ); +} + +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode; + var nextProps = workInProgress.pendingProps; + + // This is used by DevTools to force a boundary to suspend. + { + if (shouldSuspend(workInProgress)) { + workInProgress.effectTag |= DidCapture; + } + } + + var suspenseContext = suspenseStackCursor.current; + + var nextState = null; + var nextDidTimeout = false; + + if ( + (workInProgress.effectTag & DidCapture) !== NoEffect || + shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) + ) { + // Something in this boundary's subtree already suspended. Switch to + // rendering the fallback children. + nextState = SUSPENDED_MARKER; + nextDidTimeout = true; + workInProgress.effectTag &= ~DidCapture; + } else { + // Attempting the main content + if (current$$1 === null || current$$1.memoizedState !== null) { + // This is a new mount or this boundary is already showing a fallback state. + // Mark this subtree context as having at least one invisible parent that could + // handle the fallback state. + // Boundaries without fallbacks or should be avoided are not considered since + // they cannot handle preferred fallback states. + if ( + nextProps.fallback !== undefined && + nextProps.unstable_avoidThisFallback !== true + ) { + suspenseContext = addSubtreeSuspenseContext( + suspenseContext, + InvisibleParentSuspenseContext + ); + } + } + } + + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + + pushSuspenseContext(workInProgress, suspenseContext); + + { + if ("maxDuration" in nextProps) { + if (!didWarnAboutMaxDuration) { + didWarnAboutMaxDuration = true; + warning$1( + false, + "maxDuration has been removed from React. " + + "Remove the maxDuration prop." + ); + } + } + } + + // This next part is a bit confusing. If the children timeout, we switch to + // showing the fallback children in place of the "primary" children. + // However, we don't want to delete the primary children because then their + // state will be lost (both the React state and the host state, e.g. + // uncontrolled form inputs). Instead we keep them mounted and hide them. + // Both the fallback children AND the primary children are rendered at the + // same time. Once the primary children are un-suspended, we can delete + // the fallback children — don't need to preserve their state. + // + // The two sets of children are siblings in the host environment, but + // semantically, for purposes of reconciliation, they are two separate sets. + // So we store them using two fragment fibers. + // + // However, we want to avoid allocating extra fibers for every placeholder. + // They're only necessary when the children time out, because that's the + // only time when both sets are mounted. + // + // So, the extra fragment fibers are only used if the children time out. + // Otherwise, we render the primary children directly. This requires some + // custom reconciliation logic to preserve the state of the primary + // children. It's essentially a very basic form of re-parenting. + + // `child` points to the child fiber. In the normal case, this is the first + // fiber of the primary children set. In the timed-out case, it's a + // a fragment fiber containing the primary children. + var child = void 0; + // `next` points to the next fiber React should render. In the normal case, + // it's the same as `child`: the first fiber of the primary children set. + // In the timed-out case, it's a fragment fiber containing the *fallback* + // children -- we skip over the primary children entirely. + var next = void 0; + if (current$$1 === null) { + if (enableSuspenseServerRenderer) { + // If we're currently hydrating, try to hydrate this boundary. + // But only if this has a fallback. + if (nextProps.fallback !== undefined) { + tryToClaimNextHydratableInstance(workInProgress); + // This could've changed the tag if this was a dehydrated suspense component. + if (workInProgress.tag === DehydratedSuspenseComponent) { + popSuspenseContext(workInProgress); + return updateDehydratedSuspenseComponent( + null, + workInProgress, + renderExpirationTime + ); + } + } + } + + // This is the initial mount. This branch is pretty simple because there's + // no previous state that needs to be preserved. + if (nextDidTimeout) { + // Mount separate fragments for primary and fallback children. + var nextFallbackChildren = nextProps.fallback; + var primaryChildFragment = createFiberFromFragment( + null, + mode, + NoWork, + null + ); + primaryChildFragment.return = workInProgress; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var progressedState = workInProgress.memoizedState; + var progressedPrimaryChild = + progressedState !== null + ? workInProgress.child.child + : workInProgress.child; + primaryChildFragment.child = progressedPrimaryChild; + var progressedChild = progressedPrimaryChild; + while (progressedChild !== null) { + progressedChild.return = primaryChildFragment; + progressedChild = progressedChild.sibling; + } + } + + var fallbackChildFragment = createFiberFromFragment( + nextFallbackChildren, + mode, + renderExpirationTime, + null + ); + fallbackChildFragment.return = workInProgress; + primaryChildFragment.sibling = fallbackChildFragment; + child = primaryChildFragment; + // Skip the primary children, and continue working on the + // fallback children. + next = fallbackChildFragment; + } else { + // Mount the primary children without an intermediate fragment fiber. + var nextPrimaryChildren = nextProps.children; + child = next = mountChildFibers( + workInProgress, + null, + nextPrimaryChildren, + renderExpirationTime + ); + } + } else { + // This is an update. This branch is more complicated because we need to + // ensure the state of the primary children is preserved. + var prevState = current$$1.memoizedState; + var prevDidTimeout = prevState !== null; + if (prevDidTimeout) { + // The current tree already timed out. That means each child set is + var currentPrimaryChildFragment = current$$1.child; + var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; + if (nextDidTimeout) { + // Still timed out. Reuse the current primary children by cloning + // its fragment. We're going to skip over these entirely. + var _nextFallbackChildren = nextProps.fallback; + var _primaryChildFragment = createWorkInProgress( + currentPrimaryChildFragment, + currentPrimaryChildFragment.pendingProps, + NoWork + ); + _primaryChildFragment.return = workInProgress; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var _progressedState = workInProgress.memoizedState; + var _progressedPrimaryChild = + _progressedState !== null + ? workInProgress.child.child + : workInProgress.child; + if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) { + _primaryChildFragment.child = _progressedPrimaryChild; + var _progressedChild = _progressedPrimaryChild; + while (_progressedChild !== null) { + _progressedChild.return = _primaryChildFragment; + _progressedChild = _progressedChild.sibling; + } + } + } + + // Because primaryChildFragment is a new fiber that we're inserting as the + // parent of a new tree, we need to set its treeBaseDuration. + if (enableProfilerTimer && workInProgress.mode & ProfileMode) { + // treeBaseDuration is the sum of all the child tree base durations. + var treeBaseDuration = 0; + var hiddenChild = _primaryChildFragment.child; + while (hiddenChild !== null) { + treeBaseDuration += hiddenChild.treeBaseDuration; + hiddenChild = hiddenChild.sibling; + } + _primaryChildFragment.treeBaseDuration = treeBaseDuration; + } + + // Clone the fallback child fragment, too. These we'll continue + // working on. + var _fallbackChildFragment = createWorkInProgress( + currentFallbackChildFragment, + _nextFallbackChildren, + currentFallbackChildFragment.expirationTime + ); + _fallbackChildFragment.return = workInProgress; + _primaryChildFragment.sibling = _fallbackChildFragment; + child = _primaryChildFragment; + _primaryChildFragment.childExpirationTime = NoWork; + // Skip the primary children, and continue working on the + // fallback children. + next = _fallbackChildFragment; + } else { + // No longer suspended. Switch back to showing the primary children, + // and remove the intermediate fragment fiber. + var _nextPrimaryChildren = nextProps.children; + var currentPrimaryChild = currentPrimaryChildFragment.child; + var primaryChild = reconcileChildFibers( + workInProgress, + currentPrimaryChild, + _nextPrimaryChildren, + renderExpirationTime + ); + + // If this render doesn't suspend, we need to delete the fallback + // children. Wait until the complete phase, after we've confirmed the + // fallback is no longer needed. + // TODO: Would it be better to store the fallback fragment on + // the stateNode? + + // Continue rendering the children, like we normally do. + child = next = primaryChild; + } + } else { + // The current tree has not already timed out. That means the primary + // children are not wrapped in a fragment fiber. + var _currentPrimaryChild = current$$1.child; + if (nextDidTimeout) { + // Timed out. Wrap the children in a fragment fiber to keep them + // separate from the fallback children. + var _nextFallbackChildren2 = nextProps.fallback; + var _primaryChildFragment2 = createFiberFromFragment( + // It shouldn't matter what the pending props are because we aren't + // going to render this fragment. + null, + mode, + NoWork, + null + ); + _primaryChildFragment2.return = workInProgress; + _primaryChildFragment2.child = _currentPrimaryChild; + if (_currentPrimaryChild !== null) { + _currentPrimaryChild.return = _primaryChildFragment2; + } + + // Even though we're creating a new fiber, there are no new children, + // because we're reusing an already mounted tree. So we don't need to + // schedule a placement. + // primaryChildFragment.effectTag |= Placement; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var _progressedState2 = workInProgress.memoizedState; + var _progressedPrimaryChild2 = + _progressedState2 !== null + ? workInProgress.child.child + : workInProgress.child; + _primaryChildFragment2.child = _progressedPrimaryChild2; + var _progressedChild2 = _progressedPrimaryChild2; + while (_progressedChild2 !== null) { + _progressedChild2.return = _primaryChildFragment2; + _progressedChild2 = _progressedChild2.sibling; + } + } + + // Because primaryChildFragment is a new fiber that we're inserting as the + // parent of a new tree, we need to set its treeBaseDuration. + if (enableProfilerTimer && workInProgress.mode & ProfileMode) { + // treeBaseDuration is the sum of all the child tree base durations. + var _treeBaseDuration = 0; + var _hiddenChild = _primaryChildFragment2.child; + while (_hiddenChild !== null) { + _treeBaseDuration += _hiddenChild.treeBaseDuration; + _hiddenChild = _hiddenChild.sibling; + } + _primaryChildFragment2.treeBaseDuration = _treeBaseDuration; + } + + // Create a fragment from the fallback children, too. + var _fallbackChildFragment2 = createFiberFromFragment( + _nextFallbackChildren2, + mode, + renderExpirationTime, + null + ); + _fallbackChildFragment2.return = workInProgress; + _primaryChildFragment2.sibling = _fallbackChildFragment2; + _fallbackChildFragment2.effectTag |= Placement; + child = _primaryChildFragment2; + _primaryChildFragment2.childExpirationTime = NoWork; + // Skip the primary children, and continue working on the + // fallback children. + next = _fallbackChildFragment2; + } else { + // Still haven't timed out. Continue rendering the children, like we + // normally do. + var _nextPrimaryChildren2 = nextProps.children; + next = child = reconcileChildFibers( + workInProgress, + _currentPrimaryChild, + _nextPrimaryChildren2, + renderExpirationTime + ); + } + } + workInProgress.stateNode = current$$1.stateNode; + } + + workInProgress.memoizedState = nextState; + workInProgress.child = child; + return next; +} + +function retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime +) { + // Detach from the current dehydrated boundary. + current$$1.alternate = null; + workInProgress.alternate = null; + + // Insert a deletion in the effect list. + var returnFiber = workInProgress.return; + (function() { + if (!(returnFiber !== null)) { + throw ReactError( + Error( + "Suspense boundaries are never on the root. This is probably a bug in React." + ) + ); + } + })(); + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + popSuspenseContext(workInProgress); + + // Upgrade this work in progress to a real Suspense component. + workInProgress.tag = SuspenseComponent; + workInProgress.stateNode = null; + workInProgress.memoizedState = null; + // This is now an insertion. + workInProgress.effectTag |= Placement; + // Retry as a real Suspense component. + return updateSuspenseComponent(null, workInProgress, renderExpirationTime); +} + +function updateDehydratedSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + var suspenseInstance = workInProgress.stateNode; + if (current$$1 === null) { + // During the first pass, we'll bail out and not drill into the children. + // Instead, we'll leave the content in place and try to hydrate it later. + if (isSuspenseInstanceFallback(suspenseInstance)) { + // This is a client-only boundary. Since we won't get any content from the server + // for this, we need to schedule that at a higher priority based on when it would + // have timed out. In theory we could render it in this pass but it would have the + // wrong priority associated with it and will prevent hydration of parent path. + // Instead, we'll leave work left on it to render it in a separate commit. + + // TODO This time should be the time at which the server rendered response that is + // a parent to this boundary was displayed. However, since we currently don't have + // a protocol to transfer that time, we'll just estimate it by using the current + // time. This will mean that Suspense timeouts are slightly shifted to later than + // they should be. + var serverDisplayTime = requestCurrentTime(); + // Schedule a normal pri update to render this content. + workInProgress.expirationTime = computeAsyncExpiration(serverDisplayTime); + } else { + // We'll continue hydrating the rest at offscreen priority since we'll already + // be showing the right content coming from the server, it is no rush. + workInProgress.expirationTime = Never; + } + return null; + } + + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { + // Something suspended. Leave the existing children in place. + // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far? + workInProgress.child = null; + return null; + } + + // We should never be hydrating at this point because it is the first pass, + // but after we've already committed once. + warnIfHydrating(); + + if (isSuspenseInstanceFallback(suspenseInstance)) { + // This boundary is in a permanent fallback state. In this case, we'll never + // get an update and we'll never be able to hydrate the final content. Let's just try the + // client side render instead. + return retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // We use childExpirationTime to indicate that a child might depend on context, so if + // any context has changed, we need to treat is as if the input might have changed. + var hasContextChanged$$1 = + current$$1.childExpirationTime >= renderExpirationTime; + if (didReceiveUpdate || hasContextChanged$$1) { + // This boundary has changed since the first render. This means that we are now unable to + // hydrate it. We might still be able to hydrate it using an earlier expiration time but + // during this render we can't. Instead, we're going to delete the whole subtree and + // instead inject a new real Suspense boundary to take its place, which may render content + // or fallback. The real Suspense boundary will suspend for a while so we have some time + // to ensure it can produce real content, but all state and pending events will be lost. + return retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime + ); + } else if (isSuspenseInstancePending(suspenseInstance)) { + // This component is still pending more data from the server, so we can't hydrate its + // content. We treat it as if this component suspended itself. It might seem as if + // we could just try to render it client-side instead. However, this will perform a + // lot of unnecessary work and is unlikely to complete since it often will suspend + // on missing data anyway. Additionally, the server might be able to render more + // than we can on the client yet. In that case we'd end up with more fallback states + // on the client than if we just leave it alone. If the server times out or errors + // these should update this boundary to the permanent Fallback state instead. + // Mark it as having captured (i.e. suspended). + workInProgress.effectTag |= DidCapture; + // Leave the children in place. I.e. empty. + workInProgress.child = null; + // Register a callback to retry this boundary once the server has sent the result. + registerSuspenseInstanceRetry( + suspenseInstance, + retryTimedOutBoundary.bind(null, current$$1) + ); + return null; + } else { + // This is the first attempt. + reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress); + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; + } +} + +function propagateSuspenseContextChange( + workInProgress, + firstChild, + renderExpirationTime +) { + // Mark any Suspense boundaries with fallbacks as having work to do. + // If they were previously forced into fallbacks, they may now be able + // to unblock. + var node = firstChild; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + if (node.expirationTime < renderExpirationTime) { + node.expirationTime = renderExpirationTime; + } + var alternate = node.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + scheduleWorkOnParentPath(node.return, renderExpirationTime); + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function findLastContentRow(firstChild) { + // This is going to find the last row among these children that is already + // showing content on the screen, as opposed to being in fallback state or + // new. If a row has multiple Suspense boundaries, any of them being in the + // fallback state, counts as the whole row being in a fallback state. + // Note that the "rows" will be workInProgress, but any nested children + // will still be current since we haven't rendered them yet. The mounted + // order may not be the same as the new order. We use the new order. + var row = firstChild; + var lastContentRow = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + lastContentRow = row; + } + row = row.sibling; + } + return lastContentRow; +} + +function validateRevealOrder(revealOrder) { + { + if ( + revealOrder !== undefined && + revealOrder !== "forwards" && + revealOrder !== "backwards" && + revealOrder !== "together" && + !didWarnAboutRevealOrder[revealOrder] + ) { + didWarnAboutRevealOrder[revealOrder] = true; + if (typeof revealOrder === "string") { + switch (revealOrder.toLowerCase()) { + case "together": + case "forwards": + case "backwards": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'Use lowercase "%s" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + case "forward": + case "backward": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'React uses the -s suffix in the spelling. Use "%ss" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + default: + warning$1( + false, + '"%s" is not a supported revealOrder on . ' + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + break; + } + } else { + warning$1( + false, + "%s is not a supported value for revealOrder on . " + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + } + } + } +} + +function validateTailOptions(tailMode, revealOrder) { + { + if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { + if (tailMode !== "collapsed" && tailMode !== "hidden") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + '"%s" is not a supported value for tail on . ' + + 'Did you mean "collapsed" or "hidden"?', + tailMode + ); + } else if (revealOrder !== "forwards" && revealOrder !== "backwards") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + ' is only valid if revealOrder is ' + + '"forwards" or "backwards". ' + + 'Did you mean to specify revealOrder="forwards"?', + tailMode + ); + } + } + } +} + +function validateSuspenseListNestedChild(childSlot, index) { + { + var isArray = Array.isArray(childSlot); + var isIterable = !isArray && typeof getIteratorFn(childSlot) === "function"; + if (isArray || isIterable) { + var type = isArray ? "array" : "iterable"; + warning$1( + false, + "A nested %s was passed to row #%s in . Wrap it in " + + "an additional SuspenseList to configure its revealOrder: " + + " ... " + + "{%s} ... " + + "", + type, + index, + type + ); + return false; + } + } + return true; +} + +function validateSuspenseListChildren(children, revealOrder) { + { + if ( + (revealOrder === "forwards" || revealOrder === "backwards") && + children !== undefined && + children !== null && + children !== false + ) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + if (!validateSuspenseListNestedChild(children[i], i)) { + return; + } + } + } else { + var iteratorFn = getIteratorFn(children); + if (typeof iteratorFn === "function") { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) { + var step = childrenIterator.next(); + var _i = 0; + for (; !step.done; step = childrenIterator.next()) { + if (!validateSuspenseListNestedChild(step.value, _i)) { + return; + } + _i++; + } + } + } else { + warning$1( + false, + 'A single row was passed to a . ' + + "This is not useful since it needs multiple rows. " + + "Did you mean to pass multiple children or an array?", + revealOrder + ); + } + } + } + } +} + +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + if (renderState === null) { + workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }; + } else { + // We can reuse the existing object from previous renders. + renderState.isBackwards = isBackwards; + renderState.rendering = null; + renderState.last = lastContentRow; + renderState.tail = tail; + renderState.tailExpiration = 0; + renderState.tailMode = tailMode; + } +} + +// This can end up rendering this component multiple passes. +// The first pass splits the children fibers into two sets. A head and tail. +// We first render the head. If anything is in fallback state, we do another +// pass through beginWork to rerender all children (including the tail) with +// the force suspend context. If the first render didn't have anything in +// in fallback state. Then we render each row in the tail one-by-one. +// That happens in the completeWork phase without going back to beginWork. +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps; + var revealOrder = nextProps.revealOrder; + var tailMode = nextProps.tail; + var newChildren = nextProps.children; + + validateRevealOrder(revealOrder); + validateTailOptions(tailMode, revealOrder); + validateSuspenseListChildren(newChildren, revealOrder); + + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + + var suspenseContext = suspenseStackCursor.current; + + var shouldForceFallback = hasSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + if (shouldForceFallback) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + workInProgress.effectTag |= DidCapture; + } else { + var didSuspendBefore = + current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect; + if (didSuspendBefore) { + // If we previously forced a fallback, we need to schedule work + // on any nested boundaries to let them know to try to render + // again. This is the same as context updating. + propagateSuspenseContextChange( + workInProgress, + workInProgress.child, + renderExpirationTime + ); + } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, SuspenseList doesn't work so we just + // use make it a noop by treating it as the default revealOrder. + workInProgress.memoizedState = null; + } else { + switch (revealOrder) { + case "forwards": { + var lastContentRow = findLastContentRow(workInProgress.child); + var tail = void 0; + if (lastContentRow === null) { + // The whole list is part of the tail. + // TODO: We could fast path by just rendering the tail now. + tail = workInProgress.child; + workInProgress.child = null; + } else { + // Disconnect the tail rows after the content row. + // We're going to render them separately later. + tail = lastContentRow.sibling; + lastContentRow.sibling = null; + } + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + tail, + lastContentRow, + tailMode + ); + break; + } + case "backwards": { + // We're going to find the first row that has existing content. + // At the same time we're going to reverse the list of everything + // we pass in the meantime. That's going to be our tail in reverse + // order. + var _tail = null; + var row = workInProgress.child; + workInProgress.child = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + // This is the beginning of the main content. + workInProgress.child = row; + break; + } + var nextRow = row.sibling; + row.sibling = _tail; + _tail = row; + row = nextRow; + } + // TODO: If workInProgress.child is null, we can continue on the tail immediately. + initSuspenseListRenderState( + workInProgress, + true, // isBackwards + _tail, + null, // last + tailMode + ); + break; + } + case "together": { + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + null, // tail + null, // last + undefined + ); + break; + } + default: { + // The default reveal order is the same as not having + // a boundary. + workInProgress.memoizedState = null; + } + } + } + return workInProgress.child; +} + +function updatePortalComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + var nextChildren = workInProgress.pendingProps; + if (current$$1 === null) { + // Portals are special because we don't append the children during mount + // but at commit. Therefore we need to track insertions which the normal + // flow doesn't do during mount. This doesn't happen at the root because + // the root always starts with a "current" with a null child. + // TODO: Consider unifying this with how the root works. + workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } + return workInProgress.child; +} + +function updateContextProvider( + current$$1, + workInProgress, + renderExpirationTime +) { + var providerType = workInProgress.type; + var context = providerType._context; + + var newProps = workInProgress.pendingProps; + var oldProps = workInProgress.memoizedProps; + + var newValue = newProps.value; + + { + var providerPropTypes = workInProgress.type.propTypes; + + if (providerPropTypes) { + checkPropTypes( + providerPropTypes, + newProps, + "prop", + "Context.Provider", + getCurrentFiberStackInDev + ); + } + } + + pushProvider(workInProgress, newValue); + + if (oldProps !== null) { + var oldValue = oldProps.value; + var changedBits = calculateChangedBits(context, newValue, oldValue); + if (changedBits === 0) { + // No change. Bailout early if children are the same. + if (oldProps.children === newProps.children && !hasContextChanged()) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } else { + // The context value changed. Search for matching consumers and schedule + // them to update. + propagateContextChange( + workInProgress, + context, + changedBits, + renderExpirationTime + ); + } + } + + var newChildren = newProps.children; + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +var hasWarnedAboutUsingContextAsConsumer = false; + +function updateContextConsumer( + current$$1, + workInProgress, + renderExpirationTime +) { + var context = workInProgress.type; + // The logic below for Context differs depending on PROD or DEV mode. In + // DEV mode, we create a separate object for Context.Consumer that acts + // like a proxy to Context. This proxy object adds unnecessary code in PROD + // so we use the old behaviour (Context.Consumer references Context) to + // reduce size and overhead. The separate object references context via + // a property called "_context", which also gives us the ability to check + // in DEV mode if this property exists or not and warn if it does not. + { + if (context._context === undefined) { + // This may be because it's a Context (rather than a Consumer). + // Or it may be because it's older React where they're the same thing. + // We only want to warn if we're sure it's a new React. + if (context !== context.Consumer) { + if (!hasWarnedAboutUsingContextAsConsumer) { + hasWarnedAboutUsingContextAsConsumer = true; + warning$1( + false, + "Rendering directly is not supported and will be removed in " + + "a future major release. Did you mean to render instead?" + ); + } + } + } else { + context = context._context; + } + } + var newProps = workInProgress.pendingProps; + var render = newProps.children; + + { + !(typeof render === "function") + ? warningWithoutStack$1( + false, + "A context consumer was rendered with multiple children, or a child " + + "that isn't a function. A context consumer expects a single child " + + "that is a function. If you did pass a function, make sure there " + + "is no trailing or leading whitespace around it." + ) + : void 0; + } + + prepareToReadContext(workInProgress, renderExpirationTime); + var newValue = readContext(context, newProps.unstable_observedBits); + var newChildren = void 0; + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + newChildren = render(newValue); + setCurrentPhase(null); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateFundamentalComponent$1( + current$$1, + workInProgress, + renderExpirationTime +) { + var fundamentalImpl = workInProgress.type.impl; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function markWorkInProgressReceivedUpdate() { + didReceiveUpdate = true; +} + +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + cancelWorkTimer(workInProgress); + + if (current$$1 !== null) { + // Reuse previous dependencies + workInProgress.dependencies = current$$1.dependencies; + } + + if (enableProfilerTimer) { + // Don't update "base" render times for bailouts. + stopProfilerTimerIfRunning(workInProgress); + } + + // Check if the children have any pending work. + var childExpirationTime = workInProgress.childExpirationTime; + if (childExpirationTime < renderExpirationTime) { + // The children don't have any work either. We can skip them. + // TODO: Once we add back resuming, we should check if the children are + // a work-in-progress set. If so, we need to transfer their effects. + return null; + } else { + // This fiber doesn't have work, but its subtree does. Clone the child + // fibers and continue. + cloneChildFibers(current$$1, workInProgress); + return workInProgress.child; + } +} + +function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) { + { + var returnFiber = oldWorkInProgress.return; + if (returnFiber === null) { + throw new Error("Cannot swap the root fiber."); + } + + // Disconnect from the old current. + // It will get deleted. + current$$1.alternate = null; + oldWorkInProgress.alternate = null; + + // Connect to the new tree. + newWorkInProgress.index = oldWorkInProgress.index; + newWorkInProgress.sibling = oldWorkInProgress.sibling; + newWorkInProgress.return = oldWorkInProgress.return; + newWorkInProgress.ref = oldWorkInProgress.ref; + + // Replace the child/sibling pointers above it. + if (oldWorkInProgress === returnFiber.child) { + returnFiber.child = newWorkInProgress; + } else { + var prevSibling = returnFiber.child; + if (prevSibling === null) { + throw new Error("Expected parent to have a child."); + } + while (prevSibling.sibling !== oldWorkInProgress) { + prevSibling = prevSibling.sibling; + if (prevSibling === null) { + throw new Error("Expected to find the previous sibling."); + } + } + prevSibling.sibling = newWorkInProgress; + } + + // Delete the old fiber and place the new one. + // Since the old fiber is disconnected, we have to schedule it manually. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + newWorkInProgress.effectTag |= Placement; + + // Restart work from the new fiber. + return newWorkInProgress; + } +} + +function beginWork$1(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + + { + if (workInProgress._debugNeedsRemount && current$$1 !== null) { + // This will restart the begin phase with a new fiber. + return remountFiber( + current$$1, + workInProgress, + createFiberFromTypeAndProps( + workInProgress.type, + workInProgress.key, + workInProgress.pendingProps, + workInProgress._debugOwner || null, + workInProgress.mode, + workInProgress.expirationTime + ) + ); + } + } + + if (current$$1 !== null) { + var oldProps = current$$1.memoizedProps; + var newProps = workInProgress.pendingProps; + + if ( + oldProps !== newProps || + hasContextChanged() || + // Force a re-render if the implementation changed due to hot reload: + workInProgress.type !== current$$1.type + ) { + // If props or context changed, mark the fiber as having performed work. + // This may be unset if the props are determined to be equal later (memo). + didReceiveUpdate = true; + } else if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = false; + // This fiber does not have any pending work. Bailout without entering + // the begin phase. There's still some bookkeeping we that needs to be done + // in this optimized path, mostly pushing stuff onto the stack. + switch (workInProgress.tag) { + case HostRoot: + pushHostRootContext(workInProgress); + resetHydrationState(); + break; + case HostComponent: + pushHostContext(workInProgress); + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(workInProgress.type, newProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } + break; + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + pushContextProvider(workInProgress); + } + break; + } + case HostPortal: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case ContextProvider: { + var newValue = workInProgress.memoizedProps.value; + pushProvider(workInProgress, newValue); + break; + } + case Profiler: + if (enableProfilerTimer) { + workInProgress.effectTag |= Update; + } + break; + case SuspenseComponent: { + var state = workInProgress.memoizedState; + var didTimeout = state !== null; + if (didTimeout) { + // If this boundary is currently timed out, we need to decide + // whether to retry the primary children, or to skip over it and + // go straight to the fallback. Check the priority of the primary + var primaryChildFragment = workInProgress.child; + var primaryChildExpirationTime = + primaryChildFragment.childExpirationTime; + if ( + primaryChildExpirationTime !== NoWork && + primaryChildExpirationTime >= renderExpirationTime + ) { + // The primary children have pending work. Use the normal path + // to attempt to render the primary children again. + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + // The primary children do not have pending work with sufficient + // priority. Bailout. + var child = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + if (child !== null) { + // The fallback children have pending work. Skip over the + // primary children and work on the fallback. + return child.sibling; + } else { + return null; + } + } + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + } + break; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + // We know that this component will suspend again because if it has + // been unsuspended it has committed as a regular Suspense component. + // If it needs to be retried, it should have work scheduled on it. + workInProgress.effectTag |= DidCapture; + } + break; + } + case SuspenseListComponent: { + var didSuspendBefore = + (current$$1.effectTag & DidCapture) !== NoEffect; + + var hasChildWork = + workInProgress.childExpirationTime >= renderExpirationTime; + + if (didSuspendBefore) { + if (hasChildWork) { + // If something was in fallback state last time, and we have all the + // same children then we're still in progressive loading state. + // Something might get unblocked by state updates or retries in the + // tree which will affect the tail. So we need to use the normal + // path to compute the correct tail. + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + workInProgress.effectTag |= DidCapture; + } + + // If nothing suspended before and we're rendering the same children, + // then the tail doesn't matter. Anything new that suspends will work + // in the "together" mode, so we can continue from the state we had. + var renderState = workInProgress.memoizedState; + if (renderState !== null) { + // Reset to the "together" mode in case we've started a different + // update in the past but didn't complete it. + renderState.rendering = null; + renderState.tail = null; + } + pushSuspenseContext(workInProgress, suspenseStackCursor.current); + + if (hasChildWork) { + break; + } else { + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + return null; + } + } + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } else { + didReceiveUpdate = false; + } + + // Before entering the begin phase, clear the expiration time. + workInProgress.expirationTime = NoWork; + + switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current$$1, + workInProgress, + workInProgress.type, + renderExpirationTime + ); + } + case LazyComponent: { + var elementType = workInProgress.elementType; + return mountLazyComponent( + current$$1, + workInProgress, + elementType, + updateExpirationTime, + renderExpirationTime + ); + } + case FunctionComponent: { + var _Component = workInProgress.type; + var unresolvedProps = workInProgress.pendingProps; + var resolvedProps = + workInProgress.elementType === _Component + ? unresolvedProps + : resolveDefaultProps(_Component, unresolvedProps); + return updateFunctionComponent( + current$$1, + workInProgress, + _Component, + resolvedProps, + renderExpirationTime + ); + } + case ClassComponent: { + var _Component2 = workInProgress.type; + var _unresolvedProps = workInProgress.pendingProps; + var _resolvedProps = + workInProgress.elementType === _Component2 + ? _unresolvedProps + : resolveDefaultProps(_Component2, _unresolvedProps); + return updateClassComponent( + current$$1, + workInProgress, + _Component2, + _resolvedProps, + renderExpirationTime + ); + } + case HostRoot: + return updateHostRoot(current$$1, workInProgress, renderExpirationTime); + case HostComponent: + return updateHostComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case HostText: + return updateHostText(current$$1, workInProgress); + case SuspenseComponent: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case HostPortal: + return updatePortalComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case ForwardRef: { + var type = workInProgress.type; + var _unresolvedProps2 = workInProgress.pendingProps; + var _resolvedProps2 = + workInProgress.elementType === type + ? _unresolvedProps2 + : resolveDefaultProps(type, _unresolvedProps2); + return updateForwardRef( + current$$1, + workInProgress, + type, + _resolvedProps2, + renderExpirationTime + ); + } + case Fragment: + return updateFragment(current$$1, workInProgress, renderExpirationTime); + case Mode: + return updateMode(current$$1, workInProgress, renderExpirationTime); + case Profiler: + return updateProfiler(current$$1, workInProgress, renderExpirationTime); + case ContextProvider: + return updateContextProvider( + current$$1, + workInProgress, + renderExpirationTime + ); + case ContextConsumer: + return updateContextConsumer( + current$$1, + workInProgress, + renderExpirationTime + ); + case MemoComponent: { + var _type2 = workInProgress.type; + var _unresolvedProps3 = workInProgress.pendingProps; + // Resolve outer props first, then resolve inner props. + var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); + { + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = _type2.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + _resolvedProps3, // Resolved for outer only + "prop", + getComponentName(_type2), + getCurrentFiberStackInDev + ); + } + } + } + _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); + return updateMemoComponent( + current$$1, + workInProgress, + _type2, + _resolvedProps3, + updateExpirationTime, + renderExpirationTime + ); + } + case SimpleMemoComponent: { + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + } + case IncompleteClassComponent: { + var _Component3 = workInProgress.type; + var _unresolvedProps4 = workInProgress.pendingProps; + var _resolvedProps4 = + workInProgress.elementType === _Component3 + ? _unresolvedProps4 + : resolveDefaultProps(_Component3, _unresolvedProps4); + return mountIncompleteClassComponent( + current$$1, + workInProgress, + _Component3, + _resolvedProps4, + renderExpirationTime + ); + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + return updateDehydratedSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + break; + } + case SuspenseListComponent: { + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + return updateFundamentalComponent$1( + current$$1, + workInProgress, + renderExpirationTime + ); + } + break; + } + } + (function() { + { + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +function createFundamentalStateInstance(currentFiber, props, impl, state) { + return { + currentFiber: currentFiber, + impl: impl, + instance: null, + prevProps: null, + props: props, + state: state + }; +} + +var emptyObject$1 = {}; +var isArray$2 = Array.isArray; + +function markUpdate(workInProgress) { + // Tag the fiber with an update effect. This turns a Placement into + // a PlacementAndUpdate. + workInProgress.effectTag |= Update; +} + +function markRef$1(workInProgress) { + workInProgress.effectTag |= Ref; +} + +var appendAllChildren = void 0; +var updateHostContainer = void 0; +var updateHostComponent$1 = void 0; +var updateHostText$1 = void 0; +if (supportsMutation) { + // Mutation mode + + appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + if (node.tag === HostComponent || node.tag === HostText) { + appendInitialChild(parent, node.stateNode); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + appendInitialChild(parent, node.stateNode.instance); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + + updateHostContainer = function(workInProgress) { + // Noop + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + // If we have an alternate, that means this is an update and we need to + // schedule a side-effect to do the updates. + var oldProps = current.memoizedProps; + if (oldProps === newProps) { + // In mutation mode, this is sufficient for a bailout because + // we won't touch this node even if children changed. + return; + } + + // If we get updated because one of our children updated, we don't + // have newProps so we'll have to reuse them. + // TODO: Split the update API as separate for the props vs. children. + // Even better would be if children weren't special cased at all tho. + var instance = workInProgress.stateNode; + var currentHostContext = getHostContext(); + // TODO: Experiencing an error where oldProps is null. Suggests a host + // component is hitting the resume path. Figure out why. Possibly + // related to `hidden`. + var updatePayload = prepareUpdate( + instance, + type, + oldProps, + newProps, + rootContainerInstance, + currentHostContext + ); + // TODO: Type this specific to this type of component. + workInProgress.updateQueue = updatePayload; + // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. All the work is done in commitWork. + if (updatePayload) { + markUpdate(workInProgress); + } + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + // If the text differs, mark it as an update. All the work in done in commitWork. + if (oldText !== newText) { + markUpdate(workInProgress); + } + }; +} else if (supportsPersistence) { + // Persistent host tree mode + + appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + // eslint-disable-next-line no-labels + branches: if (node.tag === HostComponent) { + var instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var props = node.memoizedProps; + var type = node.type; + instance = cloneHiddenInstance(instance, type, props, node); + } + appendInitialChild(parent, instance); + } else if (node.tag === HostText) { + var _instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var text = node.memoizedProps; + _instance = cloneHiddenTextInstance(_instance, text, node); + } + appendInitialChild(parent, _instance); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance2 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props = node.memoizedProps; + var _type = node.type; + _instance2 = cloneHiddenInstance(_instance2, _type, _props, node); + } + appendInitialChild(parent, _instance2); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.tag === SuspenseComponent) { + if ((node.effectTag & Update) !== NoEffect) { + // Need to toggle the visibility of the primary children. + var newIsHidden = node.memoizedState !== null; + if (newIsHidden) { + var primaryChildParent = node.child; + if (primaryChildParent !== null) { + if (primaryChildParent.child !== null) { + primaryChildParent.child.return = primaryChildParent; + appendAllChildren( + parent, + primaryChildParent, + true, + newIsHidden + ); + } + var fallbackChildParent = primaryChildParent.sibling; + if (fallbackChildParent !== null) { + fallbackChildParent.return = node; + node = fallbackChildParent; + continue; + } + } + } + } + if (node.child !== null) { + // Continue traversing like normal + node.child.return = node; + node = node.child; + continue; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + // $FlowFixMe This is correct but Flow is confused by the labeled break. + node = node; + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + + // An unfortunate fork of appendAllChildren because we have two different parent types. + var appendAllChildrenToContainer = function( + containerChildSet, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + // eslint-disable-next-line no-labels + branches: if (node.tag === HostComponent) { + var instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var props = node.memoizedProps; + var type = node.type; + instance = cloneHiddenInstance(instance, type, props, node); + } + appendChildToContainerChildSet(containerChildSet, instance); + } else if (node.tag === HostText) { + var _instance3 = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var text = node.memoizedProps; + _instance3 = cloneHiddenTextInstance(_instance3, text, node); + } + appendChildToContainerChildSet(containerChildSet, _instance3); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance4 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props2 = node.memoizedProps; + var _type2 = node.type; + _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node); + } + appendChildToContainerChildSet(containerChildSet, _instance4); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.tag === SuspenseComponent) { + if ((node.effectTag & Update) !== NoEffect) { + // Need to toggle the visibility of the primary children. + var newIsHidden = node.memoizedState !== null; + if (newIsHidden) { + var primaryChildParent = node.child; + if (primaryChildParent !== null) { + if (primaryChildParent.child !== null) { + primaryChildParent.child.return = primaryChildParent; + appendAllChildrenToContainer( + containerChildSet, + primaryChildParent, + true, + newIsHidden + ); + } + var fallbackChildParent = primaryChildParent.sibling; + if (fallbackChildParent !== null) { + fallbackChildParent.return = node; + node = fallbackChildParent; + continue; + } + } + } + } + if (node.child !== null) { + // Continue traversing like normal + node.child.return = node; + node = node.child; + continue; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + // $FlowFixMe This is correct but Flow is confused by the labeled break. + node = node; + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + updateHostContainer = function(workInProgress) { + var portalOrRoot = workInProgress.stateNode; + var childrenUnchanged = workInProgress.firstEffect === null; + if (childrenUnchanged) { + // No changes, just reuse the existing instance. + } else { + var container = portalOrRoot.containerInfo; + var newChildSet = createContainerChildSet(container); + // If children might have changed, we have to add them all to the set. + appendAllChildrenToContainer(newChildSet, workInProgress, false, false); + portalOrRoot.pendingChildren = newChildSet; + // Schedule an update on the container to swap out the container. + markUpdate(workInProgress); + finalizeContainerChildren(container, newChildSet); + } + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + var currentInstance = current.stateNode; + var oldProps = current.memoizedProps; + // If there are no effects associated with this node, then none of our children had any updates. + // This guarantees that we can reuse all of them. + var childrenUnchanged = workInProgress.firstEffect === null; + if (childrenUnchanged && oldProps === newProps) { + // No changes, just reuse the existing instance. + // Note that this might release a previous clone. + workInProgress.stateNode = currentInstance; + return; + } + var recyclableInstance = workInProgress.stateNode; + var currentHostContext = getHostContext(); + var updatePayload = null; + if (oldProps !== newProps) { + updatePayload = prepareUpdate( + recyclableInstance, + type, + oldProps, + newProps, + rootContainerInstance, + currentHostContext + ); + } + if (childrenUnchanged && updatePayload === null) { + // No changes, just reuse the existing instance. + // Note that this might release a previous clone. + workInProgress.stateNode = currentInstance; + return; + } + var newInstance = cloneInstance( + currentInstance, + updatePayload, + type, + oldProps, + newProps, + workInProgress, + childrenUnchanged, + recyclableInstance + ); + if ( + finalizeInitialChildren( + newInstance, + type, + newProps, + rootContainerInstance, + currentHostContext + ) + ) { + markUpdate(workInProgress); + } + workInProgress.stateNode = newInstance; + if (childrenUnchanged) { + // If there are no other effects in this tree, we need to flag this node as having one. + // Even though we're not going to use it for anything. + // Otherwise parents won't know that there are new children to propagate upwards. + markUpdate(workInProgress); + } else { + // If children might have changed, we have to add them all to the set. + appendAllChildren(newInstance, workInProgress, false, false); + } + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + if (oldText !== newText) { + // If the text content differs, we'll create a new text instance for it. + var rootContainerInstance = getRootHostContainer(); + var currentHostContext = getHostContext(); + workInProgress.stateNode = createTextInstance( + newText, + rootContainerInstance, + currentHostContext, + workInProgress + ); + // We'll have to mark it as having an effect, even though we won't use the effect for anything. + // This lets the parents know that at least one of their children has changed. + markUpdate(workInProgress); + } + }; +} else { + // No host operations + updateHostContainer = function(workInProgress) { + // Noop + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + // Noop + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + // Noop + }; +} + +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var tailNode = renderState.tail; + var lastTailNode = null; + while (tailNode !== null) { + if (tailNode.alternate !== null) { + lastTailNode = tailNode; + } + tailNode = tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (lastTailNode === null) { + // All remaining items in the tail are insertions. + renderState.tail = null; + } else { + // Detach the insertion after the last node that was already + // inserted. + lastTailNode.sibling = null; + } + break; + } + case "collapsed": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var _tailNode = renderState.tail; + var _lastTailNode = null; + while (_tailNode !== null) { + if (_tailNode.alternate !== null) { + _lastTailNode = _tailNode; + } + _tailNode = _tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (_lastTailNode === null) { + // All remaining items in the tail are insertions. + if (!hasRenderedATailFallback && renderState.tail !== null) { + // We suspended during the head. We want to show at least one + // row at the tail. So we'll keep on and cut off the rest. + renderState.tail.sibling = null; + } else { + renderState.tail = null; + } + } else { + // Detach the insertion after the last node that was already + // inserted. + _lastTailNode.sibling = null; + } + break; + } + } +} + +function completeWork(current, workInProgress, renderExpirationTime) { + var newProps = workInProgress.pendingProps; + + switch (workInProgress.tag) { + case IndeterminateComponent: + break; + case LazyComponent: + break; + case SimpleMemoComponent: + case FunctionComponent: + break; + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + break; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var fiberRoot = workInProgress.stateNode; + if (fiberRoot.pendingContext) { + fiberRoot.context = fiberRoot.pendingContext; + fiberRoot.pendingContext = null; + } + if (current === null || current.child === null) { + // If we hydrated, pop so that we can delete any remaining children + // that weren't hydrated. + popHydrationState(workInProgress); + // This resets the hacky state to fix isMounted before committing. + // TODO: Delete this when we delete isMounted and findDOMNode. + workInProgress.effectTag &= ~Placement; + } + updateHostContainer(workInProgress); + break; + } + case HostComponent: { + popHostContext(workInProgress); + var rootContainerInstance = getRootHostContainer(); + var type = workInProgress.type; + if (current !== null && workInProgress.stateNode != null) { + updateHostComponent$1( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ); + + if (enableFlareAPI) { + var prevListeners = current.memoizedProps.listeners; + var nextListeners = newProps.listeners; + var instance = workInProgress.stateNode; + if (prevListeners !== nextListeners) { + updateEventListeners( + nextListeners, + instance, + rootContainerInstance, + workInProgress + ); + } + } + + if (current.ref !== workInProgress.ref) { + markRef$1(workInProgress); + } + } else { + if (!newProps) { + (function() { + if (!(workInProgress.stateNode !== null)) { + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + // This can happen when we abort work. + break; + } + + var currentHostContext = getHostContext(); + // TODO: Move createInstance to beginWork and keep it on a context + // "stack" as the parent. Then append children as we go in beginWork + // or completeWork depending on we want to add then top->down or + // bottom->up. Top->down is faster in IE11. + var wasHydrated = popHydrationState(workInProgress); + if (wasHydrated) { + // TODO: Move this and createInstance step into the beginPhase + // to consolidate. + if ( + prepareToHydrateHostInstance( + workInProgress, + rootContainerInstance, + currentHostContext + ) + ) { + // If changes to the hydrated node needs to be applied at the + // commit-phase we mark this as such. + markUpdate(workInProgress); + } + if (enableFlareAPI) { + var _instance5 = workInProgress.stateNode; + var listeners = newProps.listeners; + if (listeners != null) { + updateEventListeners( + listeners, + _instance5, + rootContainerInstance, + workInProgress + ); + } + } + } else { + var _instance6 = createInstance( + type, + newProps, + rootContainerInstance, + currentHostContext, + workInProgress + ); + + appendAllChildren(_instance6, workInProgress, false, false); + + if (enableFlareAPI) { + var _listeners = newProps.listeners; + if (_listeners != null) { + updateEventListeners( + _listeners, + _instance6, + rootContainerInstance, + workInProgress + ); + } + } + + // Certain renderers require commit-time effects for initial mount. + // (eg DOM renderer supports auto-focus for certain elements). + // Make sure such renderers get scheduled for later work. + if ( + finalizeInitialChildren( + _instance6, + type, + newProps, + rootContainerInstance, + currentHostContext + ) + ) { + markUpdate(workInProgress); + } + workInProgress.stateNode = _instance6; + } + + if (workInProgress.ref !== null) { + // If there is a ref on a host node we need to schedule a callback + markRef$1(workInProgress); + } + } + break; + } + case HostText: { + var newText = newProps; + if (current && workInProgress.stateNode != null) { + var oldText = current.memoizedProps; + // If we have an alternate, that means this is an update and we need + // to schedule a side-effect to do the updates. + updateHostText$1(current, workInProgress, oldText, newText); + } else { + if (typeof newText !== "string") { + (function() { + if (!(workInProgress.stateNode !== null)) { + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + // This can happen when we abort work. + } + var _rootContainerInstance = getRootHostContainer(); + var _currentHostContext = getHostContext(); + var _wasHydrated = popHydrationState(workInProgress); + if (_wasHydrated) { + if (prepareToHydrateHostTextInstance(workInProgress)) { + markUpdate(workInProgress); + } + } else { + workInProgress.stateNode = createTextInstance( + newText, + _rootContainerInstance, + _currentHostContext, + workInProgress + ); + } + } + break; + } + case ForwardRef: + break; + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var nextState = workInProgress.memoizedState; + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { + // Something suspended. Re-render with the fallback children. + workInProgress.expirationTime = renderExpirationTime; + // Do not reset the effect list. + return workInProgress; + } + + var nextDidTimeout = nextState !== null; + var prevDidTimeout = false; + if (current === null) { + // In cases where we didn't find a suitable hydration boundary we never + // downgraded this to a DehydratedSuspenseComponent, but we still need to + // pop the hydration state since we might be inside the insertion tree. + popHydrationState(workInProgress); + } else { + var prevState = current.memoizedState; + prevDidTimeout = prevState !== null; + if (!nextDidTimeout && prevState !== null) { + // We just switched from the fallback to the normal children. + // Delete the fallback. + // TODO: Would it be better to store the fallback fragment on + var currentFallbackChild = current.child.sibling; + if (currentFallbackChild !== null) { + // Deletions go at the beginning of the return fiber's effect list + var first = workInProgress.firstEffect; + if (first !== null) { + workInProgress.firstEffect = currentFallbackChild; + currentFallbackChild.nextEffect = first; + } else { + workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild; + currentFallbackChild.nextEffect = null; + } + currentFallbackChild.effectTag = Deletion; + } + } + } + + if (nextDidTimeout && !prevDidTimeout) { + // If this subtreee is running in batched mode we can suspend, + // otherwise we won't suspend. + // TODO: This will still suspend a synchronous tree if anything + // in the concurrent tree already suspended during this render. + // This is a known bug. + if ((workInProgress.mode & BatchedMode) !== NoMode) { + // TODO: Move this back to throwException because this is too late + // if this is a large tree which is common for initial loads. We + // don't know if we should restart a render or not until we get + // this marker, and this is too late. + // If this render already had a ping or lower pri updates, + // and this is the first time we know we're going to suspend we + // should be able to immediately restart from within throwException. + var hasInvisibleChildContext = + current === null && + workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + if ( + hasInvisibleChildContext || + hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ) + ) { + // If this was in an invisible tree or a new render, then showing + // this boundary is ok. + renderDidSuspend(); + } else { + // Otherwise, we're going to have to hide content so we should + // suspend for longer if possible. + renderDidSuspendDelayIfPossible(); + } + } + } + + if (supportsPersistence) { + // TODO: Only schedule updates if not prevDidTimeout. + if (nextDidTimeout) { + // If this boundary just timed out, schedule an effect to attach a + // retry listener to the proimse. This flag is also used to hide the + // primary children. + workInProgress.effectTag |= Update; + } + } + if (supportsMutation) { + // TODO: Only schedule updates if these values are non equal, i.e. it changed. + if (nextDidTimeout || prevDidTimeout) { + // If this boundary just timed out, schedule an effect to attach a + // retry listener to the proimse. This flag is also used to hide the + // primary children. In mutation mode, we also need the flag to + // *unhide* children that were previously hidden, so check if the + // is currently timed out, too. + workInProgress.effectTag |= Update; + } + } + if ( + enableSuspenseCallback && + workInProgress.updateQueue !== null && + workInProgress.memoizedProps.suspenseCallback != null + ) { + // Always notify the callback + workInProgress.effectTag |= Update; + } + break; + } + case Fragment: + break; + case Mode: + break; + case Profiler: + break; + case HostPortal: + popHostContainer(workInProgress); + updateHostContainer(workInProgress); + break; + case ContextProvider: + // Pop provider fiber + popProvider(workInProgress); + break; + case ContextConsumer: + break; + case MemoComponent: + break; + case IncompleteClassComponent: { + // Same as class component case. I put it down here so that the tags are + // sequential to ensure this switch is compiled to a jump table. + var _Component = workInProgress.type; + if (isContextProvider(_Component)) { + popContext(workInProgress); + } + break; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (current === null) { + var _wasHydrated2 = popHydrationState(workInProgress); + (function() { + if (!_wasHydrated2) { + throw ReactError( + Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ) + ); + } + })(); + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + skipPastDehydratedSuspenseInstance(workInProgress); + } else { + // We should never have been in a hydration state if we didn't have a current. + // However, in some of those paths, we might have reentered a hydration state + // and then we might be inside a hydration state. In that case, we'll need to + // exit out of it. + resetHydrationState(); + if ((workInProgress.effectTag & DidCapture) === NoEffect) { + // This boundary did not suspend so it's now hydrated. + // To handle any future suspense cases, we're going to now upgrade it + // to a Suspense component. We detach it from the existing current fiber. + current.alternate = null; + workInProgress.alternate = null; + workInProgress.tag = SuspenseComponent; + workInProgress.memoizedState = null; + workInProgress.stateNode = null; + } + } + } + break; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + + var renderState = workInProgress.memoizedState; + + if (renderState === null) { + // We're running in the default, "independent" mode. We don't do anything + // in this mode. + break; + } + + var didSuspendAlready = + (workInProgress.effectTag & DidCapture) !== NoEffect; + + var renderedTail = renderState.rendering; + if (renderedTail === null) { + // We just rendered the head. + if (!didSuspendAlready) { + // This is the first pass. We need to figure out if anything is still + // suspended in the rendered set. + + // If new content unsuspended, but there's still some content that + // didn't. Then we need to do a second pass that forces everything + // to keep showing their fallbacks. + + // We might be suspended if something in this render pass suspended, or + // something in the previous committed pass suspended. Otherwise, + // there's no chance so we can skip the expensive call to + // findFirstSuspended. + var cannotBeSuspended = + renderHasNotSuspendedYet() && + (current === null || (current.effectTag & DidCapture) === NoEffect); + if (!cannotBeSuspended) { + var row = workInProgress.child; + while (row !== null) { + var suspended = findFirstSuspended(row); + if (suspended !== null) { + didSuspendAlready = true; + workInProgress.effectTag |= DidCapture; + cutOffTailIfNeeded(renderState, false); + + // If this is a newly suspended tree, it might not get committed as + // part of the second pass. In that case nothing will subscribe to + // its thennables. Instead, we'll transfer its thennables to the + // SuspenseList so that it can retry if they resolve. + // There might be multiple of these in the list but since we're + // going to wait for all of them anyway, it doesn't really matter + // which ones gets to ping. In theory we could get clever and keep + // track of how many dependencies remain but it gets tricky because + // in the meantime, we can add/remove/change items and dependencies. + // We might bail out of the loop before finding any but that + // doesn't matter since that means that the other boundaries that + // we did find already has their listeners attached. + var newThennables = suspended.updateQueue; + if (newThennables !== null) { + workInProgress.updateQueue = newThennables; + workInProgress.effectTag |= Update; + } + + // Rerender the whole list, but this time, we'll force fallbacks + // to stay in place. + // Reset the effect list before doing the second pass since that's now invalid. + workInProgress.firstEffect = workInProgress.lastEffect = null; + // Reset the child fibers to their original state. + resetChildFibers(workInProgress, renderExpirationTime); + + // Set up the Suspense Context to force suspense and immediately + // rerender the children. + pushSuspenseContext( + workInProgress, + setShallowSuspenseContext( + suspenseStackCursor.current, + ForceSuspenseFallback + ) + ); + return workInProgress.child; + } + row = row.sibling; + } + } + } else { + cutOffTailIfNeeded(renderState, false); + } + // Next we're going to render the tail. + } else { + // Append the rendered row to the child list. + if (!didSuspendAlready) { + var _suspended = findFirstSuspended(renderedTail); + if (_suspended !== null) { + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, true); + // This might have been modified. + if ( + renderState.tail === null && + renderState.tailMode === "hidden" + ) { + // We need to delete the row we just rendered. + // Ensure we transfer the update queue to the parent. + var _newThennables = _suspended.updateQueue; + if (_newThennables !== null) { + workInProgress.updateQueue = _newThennables; + workInProgress.effectTag |= Update; + } + // Reset the effect list to what it w as before we rendered this + // child. The nested children have already appended themselves. + var lastEffect = (workInProgress.lastEffect = + renderState.lastEffect); + // Remove any effects that were appended after this point. + if (lastEffect !== null) { + lastEffect.nextEffect = null; + } + // We're done. + return null; + } + } else if ( + now() > renderState.tailExpiration && + renderExpirationTime > Never + ) { + // We have now passed our CPU deadline and we'll just give up further + // attempts to render the main content and only render fallbacks. + // The assumption is that this is usually faster. + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + + cutOffTailIfNeeded(renderState, false); + + // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. If we can show + // them, then they really have the same priority as this render. + // So we'll pick it back up the very next render pass once we've had + // an opportunity to yield for paint. + + var nextPriority = renderExpirationTime - 1; + workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority; + if (enableSchedulerTracing) { + markSpawnedWork(nextPriority); + } + } + } + if (renderState.isBackwards) { + // The effect list of the backwards tail will have been added + // to the end. This breaks the guarantee that life-cycles fire in + // sibling order but that isn't a strong guarantee promised by React. + // Especially since these might also just pop in during future commits. + // Append to the beginning of the list. + renderedTail.sibling = workInProgress.child; + workInProgress.child = renderedTail; + } else { + var previousSibling = renderState.last; + if (previousSibling !== null) { + previousSibling.sibling = renderedTail; + } else { + workInProgress.child = renderedTail; + } + renderState.last = renderedTail; + } + } + + if (renderState.tail !== null) { + // We still have tail rows to render. + if (renderState.tailExpiration === 0) { + // Heuristic for how long we're willing to spend rendering rows + // until we just give up and show what we have so far. + var TAIL_EXPIRATION_TIMEOUT_MS = 500; + renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; + } + // Pop a row. + var next = renderState.tail; + renderState.rendering = next; + renderState.tail = next.sibling; + renderState.lastEffect = workInProgress.lastEffect; + next.sibling = null; + + // Restore the context. + // TODO: We can probably just avoid popping it instead and only + // setting it the first time we go from not suspended to suspended. + var suspenseContext = suspenseStackCursor.current; + if (didSuspendAlready) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + } else { + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + // Do a pass over the next row. + return next; + } + break; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalImpl = workInProgress.type.impl; + var fundamentalInstance = workInProgress.stateNode; + + if (fundamentalInstance === null) { + var getInitialState = fundamentalImpl.getInitialState; + var fundamentalState = void 0; + if (getInitialState !== undefined) { + fundamentalState = getInitialState(newProps); + } + fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance( + workInProgress, + newProps, + fundamentalImpl, + fundamentalState || {} + ); + var _instance7 = getFundamentalComponentInstance(fundamentalInstance); + fundamentalInstance.instance = _instance7; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + appendAllChildren(_instance7, workInProgress, false, false); + mountFundamentalComponent(fundamentalInstance); + } else { + // We fire update in commit phase + var prevProps = fundamentalInstance.props; + fundamentalInstance.prevProps = prevProps; + fundamentalInstance.props = newProps; + fundamentalInstance.currentFiber = workInProgress; + if (supportsPersistence) { + var _instance8 = cloneFundamentalInstance(fundamentalInstance); + fundamentalInstance.instance = _instance8; + appendAllChildren(_instance8, workInProgress, false, false); + } + var shouldUpdate = shouldUpdateFundamentalComponent( + fundamentalInstance + ); + if (shouldUpdate) { + markUpdate(workInProgress); + } + } + } + break; + } + default: + (function() { + { + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + return null; +} + +function mountEventResponder$1( + responder, + responderProps, + instance, + rootContainerInstance, + fiber, + respondersMap +) { + var responderState = emptyObject$1; + var getInitialState = responder.getInitialState; + if (getInitialState !== null) { + responderState = getInitialState(responderProps); + } + var responderInstance = createResponderInstance( + responder, + responderProps, + responderState, + instance, + fiber + ); + mountResponderInstance( + responder, + responderInstance, + responderProps, + responderState, + instance, + rootContainerInstance + ); + respondersMap.set(responder, responderInstance); +} + +function updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance +) { + var responder = void 0; + var props = void 0; + + if (listener) { + responder = listener.responder; + props = listener.props; + } + (function() { + if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) { + throw ReactError( + Error( + "An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer()." + ) + ); + } + })(); + var listenerProps = props; + if (visistedResponders.has(responder)) { + // show warning + { + warning$1( + false, + 'Duplicate event responder "%s" found in event listeners. ' + + "Event listeners passed to elements cannot use the same event responder more than once.", + responder.displayName + ); + } + return; + } + visistedResponders.add(responder); + var responderInstance = respondersMap.get(responder); + + if (responderInstance === undefined) { + // Mount + mountEventResponder$1( + responder, + listenerProps, + instance, + rootContainerInstance, + fiber, + respondersMap + ); + } else { + // Update + responderInstance.props = listenerProps; + responderInstance.fiber = fiber; + } +} + +function updateEventListeners( + listeners, + instance, + rootContainerInstance, + fiber +) { + var visistedResponders = new Set(); + var dependencies = fiber.dependencies; + if (listeners != null) { + if (dependencies === null) { + dependencies = fiber.dependencies = { + expirationTime: NoWork, + firstContext: null, + responders: new Map() + }; + } + var respondersMap = dependencies.responders; + if (respondersMap === null) { + respondersMap = new Map(); + } + if (isArray$2(listeners)) { + for (var i = 0, length = listeners.length; i < length; i++) { + var listener = listeners[i]; + updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } else { + updateEventListener( + listeners, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } + if (dependencies !== null) { + var _respondersMap = dependencies.responders; + if (_respondersMap !== null) { + // Unmount + var mountedResponders = Array.from(_respondersMap.keys()); + for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) { + var mountedResponder = mountedResponders[_i]; + if (!visistedResponders.has(mountedResponder)) { + var responderInstance = _respondersMap.get(mountedResponder); + unmountResponderInstance(responderInstance); + _respondersMap.delete(mountedResponder); + } + } + } + } +} + +function unwindWork(workInProgress, renderExpirationTime) { + switch (workInProgress.tag) { + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + var effectTag = workInProgress.effectTag; + if (effectTag & ShouldCapture) { + workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + return null; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var _effectTag = workInProgress.effectTag; + (function() { + if (!((_effectTag & DidCapture) === NoEffect)) { + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + case HostComponent: { + // TODO: popHydrationState + popHostContext(workInProgress); + return null; + } + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var _effectTag2 = workInProgress.effectTag; + if (_effectTag2 & ShouldCapture) { + workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + return null; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (workInProgress.alternate === null) { + // TODO: popHydrationState + } else { + resetHydrationState(); + } + var _effectTag3 = workInProgress.effectTag; + if (_effectTag3 & ShouldCapture) { + workInProgress.effectTag = + (_effectTag3 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + } + return null; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + // SuspenseList doesn't actually catch anything. It should've been + // caught by a nested boundary. If not, it should bubble through. + return null; + } + case HostPortal: + popHostContainer(workInProgress); + return null; + case ContextProvider: + popProvider(workInProgress); + return null; + default: + return null; + } +} + +function unwindInterruptedWork(interruptedWork) { + switch (interruptedWork.tag) { + case ClassComponent: { + var childContextTypes = interruptedWork.type.childContextTypes; + if (childContextTypes !== null && childContextTypes !== undefined) { + popContext(interruptedWork); + } + break; + } + case HostRoot: { + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + } + case HostComponent: { + popHostContext(interruptedWork); + break; + } + case HostPortal: + popHostContainer(interruptedWork); + break; + case SuspenseComponent: + popSuspenseContext(interruptedWork); + break; + case DehydratedSuspenseComponent: + if (enableSuspenseServerRenderer) { + popSuspenseContext(interruptedWork); + } + break; + case SuspenseListComponent: + popSuspenseContext(interruptedWork); + break; + case ContextProvider: + popProvider(interruptedWork); + break; + default: + break; + } +} + +function createCapturedValue(value, source) { + // If the value is an error, call this function immediately after it is thrown + // so the stack is accurate. + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} + +// Module provided by RN: +(function() { + if ( + !( + typeof ReactNativePrivateInterface.ReactFiberErrorDialog + .showErrorDialog === "function" + ) + ) { + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); + } +})(); + +function showErrorDialog(capturedError) { + return ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ); +} + +function logCapturedError(capturedError) { + var logError = showErrorDialog(capturedError); + + // Allow injected showErrorDialog() to prevent default console.error logging. + // This enables renderers like ReactNative to better manage redbox behavior. + if (logError === false) { + return; + } + + var error = capturedError.error; + { + var componentName = capturedError.componentName, + componentStack = capturedError.componentStack, + errorBoundaryName = capturedError.errorBoundaryName, + errorBoundaryFound = capturedError.errorBoundaryFound, + willRetry = capturedError.willRetry; + + // Browsers support silencing uncaught errors by calling + // `preventDefault()` in window `error` handler. + // We record this information as an expando on the error. + + if (error != null && error._suppressLogging) { + if (errorBoundaryFound && willRetry) { + // The error is recoverable and was silenced. + // Ignore it and don't print the stack addendum. + // This is handy for testing error boundaries without noise. + return; + } + // The error is fatal. Since the silencing might have + // been accidental, we'll surface it anyway. + // However, the browser would have silenced the original error + // so we'll print it first, and then print the stack addendum. + console.error(error); + // For a more detailed description of this block, see: + // https://github.com/facebook/react/pull/13384 + } + + var componentNameMessage = componentName + ? "The above error occurred in the <" + componentName + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryMessage = void 0; + // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. + if (errorBoundaryFound && errorBoundaryName) { + if (willRetry) { + errorBoundaryMessage = + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + errorBoundaryName + "."); + } else { + errorBoundaryMessage = + "This error was initially handled by the error boundary " + + errorBoundaryName + + ".\n" + + "Recreating the tree from scratch failed so React will unmount the tree."; + } + } else { + errorBoundaryMessage = + "Consider adding an error boundary to your tree to customize error handling behavior.\n" + + "Visit https://fb.me/react-error-boundaries to learn more about error boundaries."; + } + var combinedMessage = + "" + + componentNameMessage + + componentStack + + "\n\n" + + ("" + errorBoundaryMessage); + + // In development, we provide our own message with just the component stack. + // We don't include the original error message and JS stack because the browser + // has already printed it. Even if the application swallows the error, it is still + // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. + console.error(combinedMessage); + } +} + +var didWarnAboutUndefinedSnapshotBeforeUpdate = null; +{ + didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); +} + +var PossiblyWeakSet$1 = typeof WeakSet === "function" ? WeakSet : Set; + +function logError(boundary, errorInfo) { + var source = errorInfo.source; + var stack = errorInfo.stack; + if (stack === null && source !== null) { + stack = getStackByFiberInDevAndProd(source); + } + + var capturedError = { + componentName: source !== null ? getComponentName(source.type) : null, + componentStack: stack !== null ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: false, + willRetry: false + }; + + if (boundary !== null && boundary.tag === ClassComponent) { + capturedError.errorBoundary = boundary.stateNode; + capturedError.errorBoundaryName = getComponentName(boundary.type); + capturedError.errorBoundaryFound = true; + capturedError.willRetry = true; + } + + try { + logCapturedError(capturedError); + } catch (e) { + // This method must not throw, or React internal state will get messed up. + // If console.error is overridden, or logCapturedError() shows a dialog that throws, + // we want to report this error outside of the normal stack as a last resort. + // https://github.com/facebook/react/issues/13188 + setTimeout(function() { + throw e; + }); + } +} + +var callComponentWillUnmountWithTimer = function(current$$1, instance) { + startPhaseTimer(current$$1, "componentWillUnmount"); + instance.props = current$$1.memoizedProps; + instance.state = current$$1.memoizedState; + instance.componentWillUnmount(); + stopPhaseTimer(); +}; + +// Capture errors so they don't interrupt unmounting. +function safelyCallComponentWillUnmount(current$$1, instance) { + { + invokeGuardedCallback( + null, + callComponentWillUnmountWithTimer, + null, + current$$1, + instance + ); + if (hasCaughtError()) { + var unmountError = clearCaughtError(); + captureCommitPhaseError(current$$1, unmountError); + } + } +} + +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (ref !== null) { + if (typeof ref === "function") { + { + invokeGuardedCallback(null, ref, null, null); + if (hasCaughtError()) { + var refError = clearCaughtError(); + captureCommitPhaseError(current$$1, refError); + } + } + } else { + ref.current = null; + } + } +} + +function safelyCallDestroy(current$$1, destroy) { + { + invokeGuardedCallback(null, destroy, null); + if (hasCaughtError()) { + var error = clearCaughtError(); + captureCommitPhaseError(current$$1, error); + } + } +} + +function commitBeforeMutationLifeCycles(current$$1, finishedWork) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork); + return; + } + case ClassComponent: { + if (finishedWork.effectTag & Snapshot) { + if (current$$1 !== null) { + var prevProps = current$$1.memoizedProps; + var prevState = current$$1.memoizedState; + startPhaseTimer(finishedWork, "getSnapshotBeforeUpdate"); + var instance = finishedWork.stateNode; + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "getSnapshotBeforeUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "getSnapshotBeforeUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + var snapshot = instance.getSnapshotBeforeUpdate( + finishedWork.elementType === finishedWork.type + ? prevProps + : resolveDefaultProps(finishedWork.type, prevProps), + prevState + ); + { + var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; + if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { + didWarnSet.add(finishedWork.type); + warningWithoutStack$1( + false, + "%s.getSnapshotBeforeUpdate(): A snapshot value (or null) " + + "must be returned. You have returned undefined.", + getComponentName(finishedWork.type) + ); + } + } + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + stopPhaseTimer(); + } + } + return; + } + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case IncompleteClassComponent: + // Nothing to do for these component types + return; + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + var updateQueue = finishedWork.updateQueue; + var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + // Unmount + var destroy = effect.destroy; + effect.destroy = undefined; + if (destroy !== undefined) { + destroy(); + } + } + if ((effect.tag & mountTag) !== NoEffect$1) { + // Mount + var create = effect.create; + effect.destroy = create(); + + { + var _destroy = effect.destroy; + if (_destroy !== undefined && typeof _destroy !== "function") { + var addendum = void 0; + if (_destroy === null) { + addendum = + " You returned null. If your effect does not require clean " + + "up, return undefined (or nothing)."; + } else if (typeof _destroy.then === "function") { + addendum = + "\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. " + + "Instead, write the async function inside your effect " + + "and call it immediately:\n\n" + + "useEffect(() => {\n" + + " async function fetchData() {\n" + + " // You can await here\n" + + " const response = await MyAPI.getData(someId);\n" + + " // ...\n" + + " }\n" + + " fetchData();\n" + + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + + "Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching"; + } else { + addendum = " You returned: " + _destroy; + } + warningWithoutStack$1( + false, + "An effect function must not return anything besides a function, " + + "which is used for clean-up.%s%s", + addendum, + getStackByFiberInDevAndProd(finishedWork) + ); + } + } + } + effect = effect.next; + } while (effect !== firstEffect); + } +} + +function commitPassiveHookEffects(finishedWork) { + if ((finishedWork.effectTag & Passive) !== NoEffect) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + break; + } + default: + break; + } + } +} + +function commitLifeCycles( + finishedRoot, + current$$1, + finishedWork, + committedExpirationTime +) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountLayout, MountLayout, finishedWork); + break; + } + case ClassComponent: { + var instance = finishedWork.stateNode; + if (finishedWork.effectTag & Update) { + if (current$$1 === null) { + startPhaseTimer(finishedWork, "componentDidMount"); + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "componentDidMount. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "componentDidMount. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + instance.componentDidMount(); + stopPhaseTimer(); + } else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current$$1.memoizedProps + : resolveDefaultProps( + finishedWork.type, + current$$1.memoizedProps + ); + var prevState = current$$1.memoizedState; + startPhaseTimer(finishedWork, "componentDidUpdate"); + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "componentDidUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "componentDidUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + instance.componentDidUpdate( + prevProps, + prevState, + instance.__reactInternalSnapshotBeforeUpdate + ); + stopPhaseTimer(); + } + } + var updateQueue = finishedWork.updateQueue; + if (updateQueue !== null) { + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "processing the update queue. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "processing the update queue. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + commitUpdateQueue( + finishedWork, + updateQueue, + instance, + committedExpirationTime + ); + } + return; + } + case HostRoot: { + var _updateQueue = finishedWork.updateQueue; + if (_updateQueue !== null) { + var _instance = null; + if (finishedWork.child !== null) { + switch (finishedWork.child.tag) { + case HostComponent: + _instance = getPublicInstance(finishedWork.child.stateNode); + break; + case ClassComponent: + _instance = finishedWork.child.stateNode; + break; + } + } + commitUpdateQueue( + finishedWork, + _updateQueue, + _instance, + committedExpirationTime + ); + } + return; + } + case HostComponent: { + var _instance2 = finishedWork.stateNode; + + // Renderers may schedule work to be done after host components are mounted + // (eg DOM renderer may schedule auto-focus for inputs and form controls). + // These effects should only be committed when components are first mounted, + // aka when there is no current/alternate. + if (current$$1 === null && finishedWork.effectTag & Update) { + var type = finishedWork.type; + var props = finishedWork.memoizedProps; + commitMount(_instance2, type, props, finishedWork); + } + + return; + } + case HostText: { + // We have no life-cycles associated with text. + return; + } + case HostPortal: { + // We have no life-cycles associated with portals. + return; + } + case Profiler: { + if (enableProfilerTimer) { + var onRender = finishedWork.memoizedProps.onRender; + + if (typeof onRender === "function") { + if (enableSchedulerTracing) { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime(), + finishedRoot.memoizedInteractions + ); + } else { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime() + ); + } + } + } + return; + } + case SuspenseComponent: + case SuspenseListComponent: + case IncompleteClassComponent: + case FundamentalComponent: + return; + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function hideOrUnhideAllChildren(finishedWork, isHidden) { + if (supportsMutation) { + // We only have the top Fiber that was inserted but we need to recurse down its + var node = finishedWork; + while (true) { + if (node.tag === HostComponent) { + var instance = node.stateNode; + if (isHidden) { + hideInstance(instance); + } else { + unhideInstance(node.stateNode, node.memoizedProps); + } + } else if (node.tag === HostText) { + var _instance3 = node.stateNode; + if (isHidden) { + hideTextInstance(_instance3); + } else { + unhideTextInstance(_instance3, node.memoizedProps); + } + } else if ( + node.tag === SuspenseComponent && + node.memoizedState !== null + ) { + // Found a nested Suspense component that timed out. Skip over the + var fallbackChildFragment = node.child.sibling; + fallbackChildFragment.return = node; + node = fallbackChildFragment; + continue; + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === finishedWork) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } +} + +function commitAttachRef(finishedWork) { + var ref = finishedWork.ref; + if (ref !== null) { + var instance = finishedWork.stateNode; + var instanceToUse = void 0; + switch (finishedWork.tag) { + case HostComponent: + instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; + } + if (typeof ref === "function") { + ref(instanceToUse); + } else { + { + if (!ref.hasOwnProperty("current")) { + warningWithoutStack$1( + false, + "Unexpected ref object provided for %s. " + + "Use either a ref-setter function or React.createRef().%s", + getComponentName(finishedWork.type), + getStackByFiberInDevAndProd(finishedWork) + ); + } + } + + ref.current = instanceToUse; + } + } +} + +function commitDetachRef(current$$1) { + var currentRef = current$$1.ref; + if (currentRef !== null) { + if (typeof currentRef === "function") { + currentRef(null); + } else { + currentRef.current = null; + } + } +} + +// User-originating errors (lifecycles and refs) should not interrupt +// deletion, so don't let them throw. Host-originating errors should +// interrupt deletion, so it's okay +function commitUnmount(current$$1, renderPriorityLevel) { + onCommitUnmount(current$$1); + + switch (current$$1.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var lastEffect = updateQueue.lastEffect; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + + // When the owner fiber is deleted, the destroy function of a passive + // effect hook is called during the synchronous commit phase. This is + // a concession to implementation complexity. Calling it in the + // passive effect phase (like they usually are, when dependencies + // change during an update) would require either traversing the + // children of the deleted fiber again, or including unmount effects + // as part of the fiber effect list. + // + // Because this is during the sync commit phase, we need to change + // the priority. + // + // TODO: Reconsider this implementation trade off. + var priorityLevel = + renderPriorityLevel > NormalPriority + ? NormalPriority + : renderPriorityLevel; + runWithPriority$1(priorityLevel, function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (destroy !== undefined) { + safelyCallDestroy(current$$1, destroy); + } + effect = effect.next; + } while (effect !== firstEffect); + }); + } + } + break; + } + case ClassComponent: { + safelyDetachRef(current$$1); + var instance = current$$1.stateNode; + if (typeof instance.componentWillUnmount === "function") { + safelyCallComponentWillUnmount(current$$1, instance); + } + return; + } + case HostComponent: { + if (enableFlareAPI) { + var dependencies = current$$1.dependencies; + + if (dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for ( + var i = 0, length = responderInstances.length; + i < length; + i++ + ) { + var responderInstance = responderInstances[i]; + unmountResponderInstance(responderInstance); + } + dependencies.responders = null; + } + } + } + safelyDetachRef(current$$1); + return; + } + case HostPortal: { + // TODO: this is recursive. + // We are also not using this parent because + // the portal will get pushed immediately. + if (supportsMutation) { + unmountHostComponents(current$$1, renderPriorityLevel); + } else if (supportsPersistence) { + emptyPortalContainer(current$$1); + } + return; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = current$$1.stateNode; + if (fundamentalInstance !== null) { + unmountFundamentalComponent(fundamentalInstance); + current$$1.stateNode = null; + } + } + } + } +} + +function commitNestedUnmounts(root, renderPriorityLevel) { + // While we're inside a removed host node we don't want to call + // removeChild on the inner nodes because they're removed by the top + // call anyway. We also want to call componentWillUnmount on all + // composites before this host node is removed from the tree. Therefore + var node = root; + while (true) { + commitUnmount(node, renderPriorityLevel); + // Visit children because they may contain more composite or host nodes. + // Skip portals because commitUnmount() currently visits them recursively. + if ( + node.child !== null && + // If we use mutation we drill down into portals using commitUnmount above. + // If we don't use mutation we drill down into portals here instead. + (!supportsMutation || node.tag !== HostPortal) + ) { + node.child.return = node; + node = node.child; + continue; + } + if (node === root) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === root) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + // Cut off the return pointers to disconnect it from the tree. Ideally, we + // should clear the child pointer of the parent alternate to let this + // get GC:ed but we don't know which for sure which parent is the current + // one so we'll settle for GC:ing the subtree of this child. This child + // itself will be GC:ed when the parent updates the next time. + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + if (alternate !== null) { + detachFiber(alternate); + } +} + +function emptyPortalContainer(current$$1) { + if (!supportsPersistence) { + return; + } + + var portal = current$$1.stateNode; + var containerInfo = portal.containerInfo; + + var emptyChildSet = createContainerChildSet(containerInfo); +} + +function commitContainer(finishedWork) { + if (!supportsPersistence) { + return; + } + + switch (finishedWork.tag) { + case ClassComponent: + case HostComponent: + case HostText: + case FundamentalComponent: { + return; + } + case HostRoot: + case HostPortal: { + var portalOrRoot = finishedWork.stateNode; + var containerInfo = portalOrRoot.containerInfo, + _pendingChildren = portalOrRoot.pendingChildren; + + return; + } + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function getHostParentFiber(fiber) { + var parent = fiber.return; + while (parent !== null) { + if (isHostParent(parent)) { + return parent; + } + parent = parent.return; + } + (function() { + { + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +function isHostParent(fiber) { + return ( + fiber.tag === HostComponent || + fiber.tag === HostRoot || + fiber.tag === HostPortal + ); +} + +function getHostSibling(fiber) { + // We're going to search forward into the tree until we find a sibling host + // node. Unfortunately, if multiple insertions are done in a row we have to + // search past them. This leads to exponential search for the next sibling. + var node = fiber; + siblings: while (true) { + // If we didn't find anything, let's try the next sibling. + while (node.sibling === null) { + if (node.return === null || isHostParent(node.return)) { + // If we pop out of the root or hit the parent the fiber we are the + // last sibling. + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + while ( + node.tag !== HostComponent && + node.tag !== HostText && + node.tag !== DehydratedSuspenseComponent + ) { + // If it is not host node and, we might have a host node inside it. + // Try to search down until we find one. + if (node.effectTag & Placement) { + // If we don't have a child, try the siblings instead. + continue siblings; + } + // If we don't have a child, try the siblings instead. + // We also skip portals because they are not part of this host tree. + if (node.child === null || node.tag === HostPortal) { + continue siblings; + } else { + node.child.return = node; + node = node.child; + } + } + // Check if this host node is stable or about to be placed. + if (!(node.effectTag & Placement)) { + // Found it! + return node.stateNode; + } + } +} + +function commitPlacement(finishedWork) { + if (!supportsMutation) { + return; + } + + // Recursively insert all host nodes into the parent. + var parentFiber = getHostParentFiber(finishedWork); + + // Note: these two variables *must* always be updated together. + var parent = void 0; + var isContainer = void 0; + var parentStateNode = parentFiber.stateNode; + switch (parentFiber.tag) { + case HostComponent: + parent = parentStateNode; + isContainer = false; + break; + case HostRoot: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case HostPortal: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case FundamentalComponent: + if (enableFundamentalAPI) { + parent = parentStateNode.instance; + isContainer = false; + } + // eslint-disable-next-line-no-fallthrough + default: + (function() { + { + throw ReactError( + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + if (parentFiber.effectTag & ContentReset) { + // Reset the text content of the parent before doing any insertions + resetTextContent(parent); + // Clear ContentReset from the effect tag + parentFiber.effectTag &= ~ContentReset; + } + + var before = getHostSibling(finishedWork); + // We only have the top Fiber that was inserted but we need to recurse down its + // children to find all the terminal nodes. + var node = finishedWork; + while (true) { + var isHost = node.tag === HostComponent || node.tag === HostText; + if (isHost || (enableFundamentalAPI && node.tag === FundamentalComponent)) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (before) { + if (isContainer) { + insertInContainerBefore(parent, stateNode, before); + } else { + insertBefore(parent, stateNode, before); + } + } else { + if (isContainer) { + appendChildToContainer(parent, stateNode); + } else { + appendChild(parent, stateNode); + } + } + } else if (node.tag === HostPortal) { + // If the insertion itself is a portal, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === finishedWork) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function unmountHostComponents(current$$1, renderPriorityLevel) { + // We only have the top Fiber that was deleted but we need to recurse down its + var node = current$$1; + + // Each iteration, currentParent is populated with node's host parent if not + // currentParentIsValid. + var currentParentIsValid = false; + + // Note: these two variables *must* always be updated together. + var currentParent = void 0; + var currentParentIsContainer = void 0; + + while (true) { + if (!currentParentIsValid) { + var parent = node.return; + findParent: while (true) { + (function() { + if (!(parent !== null)) { + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var parentStateNode = parent.stateNode; + switch (parent.tag) { + case HostComponent: + currentParent = parentStateNode; + currentParentIsContainer = false; + break findParent; + case HostRoot: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + case HostPortal: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + case FundamentalComponent: + if (enableFundamentalAPI) { + currentParent = parentStateNode.instance; + currentParentIsContainer = false; + } + } + parent = parent.return; + } + currentParentIsValid = true; + } + + if (node.tag === HostComponent || node.tag === HostText) { + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, node.stateNode); + } else { + removeChild(currentParent, node.stateNode); + } + // Don't visit children because we already visited them. + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var fundamentalNode = node.stateNode.instance; + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, fundamentalNode); + } else { + removeChild(currentParent, fundamentalNode); + } + } else if ( + enableSuspenseServerRenderer && + node.tag === DehydratedSuspenseComponent + ) { + // Delete the dehydrated suspense boundary and all of its content. + if (currentParentIsContainer) { + clearSuspenseBoundaryFromContainer(currentParent, node.stateNode); + } else { + clearSuspenseBoundary(currentParent, node.stateNode); + } + } else if (node.tag === HostPortal) { + if (node.child !== null) { + // When we go into a portal, it becomes the parent to remove from. + // We will reassign it back when we pop the portal on the way up. + currentParent = node.stateNode.containerInfo; + currentParentIsContainer = true; + // Visit children because portals might contain host components. + node.child.return = node; + node = node.child; + continue; + } + } else { + commitUnmount(node, renderPriorityLevel); + // Visit children because we may find more host components below. + if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === current$$1) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === current$$1) { + return; + } + node = node.return; + if (node.tag === HostPortal) { + // When we go out of the portal, we need to restore the parent. + // Since we don't keep a stack of them, we will search for it. + currentParentIsValid = false; + } + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function commitDeletion(current$$1, renderPriorityLevel) { + if (supportsMutation) { + // Recursively delete all host nodes from the parent. + // Detach refs and call componentWillUnmount() on the whole subtree. + unmountHostComponents(current$$1, renderPriorityLevel); + } else { + // Detach refs and call componentWillUnmount() on the whole subtree. + commitNestedUnmounts(current$$1, renderPriorityLevel); + } + detachFiber(current$$1); +} + +function commitWork(current$$1, finishedWork) { + if (!supportsMutation) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + // Note: We currently never use MountMutation, but useLayout uses + // UnmountMutation. + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + } + case Profiler: { + return; + } + case SuspenseComponent: { + commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); + return; + } + } + + commitContainer(finishedWork); + return; + } + + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + // Note: We currently never use MountMutation, but useLayout uses + // UnmountMutation. + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + } + case ClassComponent: { + return; + } + case HostComponent: { + var instance = finishedWork.stateNode; + if (instance != null) { + // Commit the work prepared earlier. + var newProps = finishedWork.memoizedProps; + // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldProps = + current$$1 !== null ? current$$1.memoizedProps : newProps; + var type = finishedWork.type; + // TODO: Type the updateQueue to be specific to host components. + var updatePayload = finishedWork.updateQueue; + finishedWork.updateQueue = null; + if (updatePayload !== null) { + commitUpdate( + instance, + updatePayload, + type, + oldProps, + newProps, + finishedWork + ); + } + } + return; + } + case HostText: { + (function() { + if (!(finishedWork.stateNode !== null)) { + throw ReactError( + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var textInstance = finishedWork.stateNode; + var newText = finishedWork.memoizedProps; + // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldText = current$$1 !== null ? current$$1.memoizedProps : newText; + commitTextUpdate(textInstance, oldText, newText); + return; + } + case HostRoot: { + return; + } + case Profiler: { + return; + } + case SuspenseComponent: { + commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); + return; + } + case IncompleteClassComponent: { + return; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = finishedWork.stateNode; + updateFundamentalComponent(fundamentalInstance); + } + return; + } + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function commitSuspenseComponent(finishedWork) { + var newState = finishedWork.memoizedState; + + var newDidTimeout = void 0; + var primaryChildParent = finishedWork; + if (newState === null) { + newDidTimeout = false; + } else { + newDidTimeout = true; + primaryChildParent = finishedWork.child; + markCommitTimeOfFallback(); + } + + if (supportsMutation && primaryChildParent !== null) { + hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); + } + + if (enableSuspenseCallback && newState !== null) { + var suspenseCallback = finishedWork.memoizedProps.suspenseCallback; + if (typeof suspenseCallback === "function") { + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + suspenseCallback(new Set(thenables)); + } + } else { + if (suspenseCallback !== undefined) { + warning$1(false, "Unexpected type for suspenseCallback."); + } + } + } +} + +function attachSuspenseRetryListeners(finishedWork) { + // If this boundary just timed out, then it will have a set of thenables. + // For each thenable, attach a listener so that when it resolves, React + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + if (retryCache === null) { + retryCache = finishedWork.stateNode = new PossiblyWeakSet$1(); + } + thenables.forEach(function(thenable) { + // Memoize using the boundary fiber to prevent redundant listeners. + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + if (!retryCache.has(thenable)) { + if (enableSchedulerTracing) { + retry = tracing.unstable_wrap(retry); + } + retryCache.add(thenable); + thenable.then(retry, retry); + } + }); + } +} + +function commitResetTextContent(current$$1) { + if (!supportsMutation) { + return; + } + resetTextContent(current$$1.stateNode); +} + +var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; +var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; + +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + var update = createUpdate(expirationTime, null); + // Unmount the root by rendering null. + update.tag = CaptureUpdate; + // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { element: null }; + var error = errorInfo.value; + update.callback = function() { + onUncaughtError(error); + logError(fiber, errorInfo); + }; + return update; +} + +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + var update = createUpdate(expirationTime, null); + update.tag = CaptureUpdate; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if (typeof getDerivedStateFromError === "function") { + var error = errorInfo.value; + update.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + + var inst = fiber.stateNode; + if (inst !== null && typeof inst.componentDidCatch === "function") { + update.callback = function callback() { + { + markFailedErrorBoundaryForHotReloading(fiber); + } + if (typeof getDerivedStateFromError !== "function") { + // To preserve the preexisting retry behavior of error boundaries, + // we keep track of which ones already failed during this batch. + // This gets reset before we yield back to the browser. + // TODO: Warn in strict mode if getDerivedStateFromError is + // not defined. + markLegacyErrorBoundaryAsFailed(this); + + // Only log here if componentDidCatch is the only error boundary method defined + logError(fiber, errorInfo); + } + var error = errorInfo.value; + var stack = errorInfo.stack; + this.componentDidCatch(error, { + componentStack: stack !== null ? stack : "" + }); + { + if (typeof getDerivedStateFromError !== "function") { + // If componentDidCatch is the only error boundary method defined, + // then it needs to call setState to recover from errors. + // If no state update is scheduled then the boundary will swallow the error. + !(fiber.expirationTime === Sync) + ? warningWithoutStack$1( + false, + "%s: Error boundaries should implement getDerivedStateFromError(). " + + "In that method, return a state update to display an error message or fallback UI.", + getComponentName(fiber.type) || "Unknown" + ) + : void 0; + } + } + }; + } else { + update.callback = function() { + markFailedErrorBoundaryForHotReloading(fiber); + }; + } + return update; +} + +function attachPingListener(root, renderExpirationTime, thenable) { + // Attach a listener to the promise to "ping" the root and retry. But + // only if one does not already exist for the current render expiration + // time (which acts like a "thread ID" here). + var pingCache = root.pingCache; + var threadIDs = void 0; + if (pingCache === null) { + pingCache = root.pingCache = new PossiblyWeakMap(); + threadIDs = new Set(); + pingCache.set(thenable, threadIDs); + } else { + threadIDs = pingCache.get(thenable); + if (threadIDs === undefined) { + threadIDs = new Set(); + pingCache.set(thenable, threadIDs); + } + } + if (!threadIDs.has(renderExpirationTime)) { + // Memoize using the thread ID to prevent redundant listeners. + threadIDs.add(renderExpirationTime); + var ping = pingSuspendedRoot.bind( + null, + root, + thenable, + renderExpirationTime + ); + if (enableSchedulerTracing) { + ping = tracing.unstable_wrap(ping); + } + thenable.then(ping, ping); + } +} + +function throwException( + root, + returnFiber, + sourceFiber, + value, + renderExpirationTime +) { + // The source fiber did not complete. + sourceFiber.effectTag |= Incomplete; + // Its effect list is no longer valid. + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + + if ( + value !== null && + typeof value === "object" && + typeof value.then === "function" + ) { + // This is a thenable. + var thenable = value; + + checkForWrongSuspensePriorityInDEV(sourceFiber); + + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + + // Schedule the nearest Suspense to re-render the timed out view. + var _workInProgress = returnFiber; + do { + if ( + _workInProgress.tag === SuspenseComponent && + shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) + ) { + // Found the nearest boundary. + + // Stash the promise on the boundary fiber. If the boundary times out, we'll + var thenables = _workInProgress.updateQueue; + if (thenables === null) { + var updateQueue = new Set(); + updateQueue.add(thenable); + _workInProgress.updateQueue = updateQueue; + } else { + thenables.add(thenable); + } + + // If the boundary is outside of batched mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. In the commit phase, we'll schedule a + // subsequent synchronous update to re-render the Suspense. + // + // Note: It doesn't matter whether the component that suspended was + // inside a batched mode tree. If the Suspense is outside of it, we + // should *not* suspend the commit. + if ((_workInProgress.mode & BatchedMode) === NoMode) { + _workInProgress.effectTag |= DidCapture; + + // We're going to commit this fiber even though it didn't complete. + // But we shouldn't call any lifecycle methods or callbacks. Remove + // all lifecycle effect tags. + sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete); + + if (sourceFiber.tag === ClassComponent) { + var currentSourceFiber = sourceFiber.alternate; + if (currentSourceFiber === null) { + // This is a new mount. Change the tag so it's not mistaken for a + // completed class component. For example, we should not call + // componentWillUnmount if it is deleted. + sourceFiber.tag = IncompleteClassComponent; + } else { + // When we try rendering again, we should not reuse the current fiber, + // since it's known to be in an inconsistent state. Use a force update to + // prevent a bail out. + var update = createUpdate(Sync, null); + update.tag = ForceUpdate; + enqueueUpdate(sourceFiber, update); + } + } + + // The source fiber did not complete. Mark it with Sync priority to + // indicate that it still has pending work. + sourceFiber.expirationTime = Sync; + + // Exit without suspending. + return; + } + + // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. SuspenseConfig applies to + // this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. + + attachPingListener(root, renderExpirationTime, thenable); + + _workInProgress.effectTag |= ShouldCapture; + _workInProgress.expirationTime = renderExpirationTime; + + return; + } else if ( + enableSuspenseServerRenderer && + _workInProgress.tag === DehydratedSuspenseComponent + ) { + attachPingListener(root, renderExpirationTime, thenable); + + // Since we already have a current fiber, we can eagerly add a retry listener. + var retryCache = _workInProgress.memoizedState; + if (retryCache === null) { + retryCache = _workInProgress.memoizedState = new PossiblyWeakSet(); + var current$$1 = _workInProgress.alternate; + (function() { + if (!current$$1) { + throw ReactError( + Error( + "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + ) + ); + } + })(); + current$$1.memoizedState = retryCache; + } + // Memoize using the boundary fiber to prevent redundant listeners. + if (!retryCache.has(thenable)) { + retryCache.add(thenable); + var retry = resolveRetryThenable.bind( + null, + _workInProgress, + thenable + ); + if (enableSchedulerTracing) { + retry = tracing.unstable_wrap(retry); + } + thenable.then(retry, retry); + } + _workInProgress.effectTag |= ShouldCapture; + _workInProgress.expirationTime = renderExpirationTime; + return; + } + // This boundary already captured during this render. Continue to the next + // boundary. + _workInProgress = _workInProgress.return; + } while (_workInProgress !== null); + // No boundary was found. Fallthrough to error mode. + // TODO: Use invariant so the message is stripped in prod? + value = new Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n" + + "\n" + + "Add a component higher in the tree to " + + "provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + + // We didn't find a boundary that could handle this type of exception. Start + // over and traverse parent path again, this time treating the exception + // as an error. + renderDidError(); + value = createCapturedValue(value, sourceFiber); + var workInProgress = returnFiber; + do { + switch (workInProgress.tag) { + case HostRoot: { + var _errorInfo = value; + workInProgress.effectTag |= ShouldCapture; + workInProgress.expirationTime = renderExpirationTime; + var _update = createRootErrorUpdate( + workInProgress, + _errorInfo, + renderExpirationTime + ); + enqueueCapturedUpdate(workInProgress, _update); + return; + } + case ClassComponent: + // Capture and retry + var errorInfo = value; + var ctor = workInProgress.type; + var instance = workInProgress.stateNode; + if ( + (workInProgress.effectTag & DidCapture) === NoEffect && + (typeof ctor.getDerivedStateFromError === "function" || + (instance !== null && + typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance))) + ) { + workInProgress.effectTag |= ShouldCapture; + workInProgress.expirationTime = renderExpirationTime; + // Schedule the error boundary to re-render using updated state + var _update2 = createClassErrorUpdate( + workInProgress, + errorInfo, + renderExpirationTime + ); + enqueueCapturedUpdate(workInProgress, _update2); + return; + } + break; + default: + break; + } + workInProgress = workInProgress.return; + } while (workInProgress !== null); +} + +// The scheduler is imported here *only* to detect whether it's been mocked +// DEV stuff +var ceil = Math.ceil; + +var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; +var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; +var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; + +var NoContext = /* */ 0; +var BatchedContext = /* */ 1; +var EventContext = /* */ 2; +var DiscreteEventContext = /* */ 4; +var LegacyUnbatchedContext = /* */ 8; +var RenderContext = /* */ 16; +var CommitContext = /* */ 32; + +var RootIncomplete = 0; +var RootErrored = 1; +var RootSuspended = 2; +var RootSuspendedWithDelay = 3; +var RootCompleted = 4; + +// Describes where we are in the React execution stack +var executionContext = NoContext; +// The root we're working on +var workInProgressRoot = null; +// The fiber we're working on +var workInProgress = null; +// The expiration time we're rendering +var renderExpirationTime = NoWork; +// Whether to root completed, errored, suspended, etc. +var workInProgressRootExitStatus = RootIncomplete; +// Most recent event time among processed updates during this render. +// This is conceptually a time stamp but expressed in terms of an ExpirationTime +// because we deal mostly with expiration times in the hot path, so this avoids +// the conversion happening in the hot path. +var workInProgressRootLatestProcessedExpirationTime = Sync; +var workInProgressRootLatestSuspenseTimeout = Sync; +var workInProgressRootCanSuspendUsingConfig = null; +// If we're pinged while rendering we don't always restart immediately. +// This flag determines if it might be worthwhile to restart if an opportunity +// happens latere. +var workInProgressRootHasPendingPing = false; +// The most recent time we committed a fallback. This lets us ensure a train +// model where we don't commit new loading states in too quick succession. +var globalMostRecentFallbackTime = 0; +var FALLBACK_THROTTLE_MS = 500; + +var nextEffect = null; +var hasUncaughtError = false; +var firstUncaughtError = null; +var legacyErrorBoundariesThatAlreadyFailed = null; + +var rootDoesHavePassiveEffects = false; +var rootWithPendingPassiveEffects = null; +var pendingPassiveEffectsRenderPriority = NoPriority; +var pendingPassiveEffectsExpirationTime = NoWork; + +var rootsWithPendingDiscreteUpdates = null; + +// Use these to prevent an infinite loop of nested updates +var NESTED_UPDATE_LIMIT = 50; +var nestedUpdateCount = 0; +var rootWithNestedUpdates = null; + +var NESTED_PASSIVE_UPDATE_LIMIT = 50; +var nestedPassiveUpdateCount = 0; + +var interruptedBy = null; + +// Marks the need to reschedule pending interactions at these expiration times +// during the commit phase. This enables them to be traced across components +// that spawn new work during render. E.g. hidden boundaries, suspended SSR +// hydration or SuspenseList. +var spawnedWorkDuringRender = null; + +// Expiration times are computed by adding to the current time (the start +// time). However, if two updates are scheduled within the same event, we +// should treat their start times as simultaneous, even if the actual clock +// time has advanced between the first and second call. + +// In other words, because expiration times determine how updates are batched, +// we want all updates of like priority that occur within the same event to +// receive the same expiration time. Otherwise we get tearing. +var currentEventTime = NoWork; + +function requestCurrentTime() { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + // We're inside React, so it's fine to read the actual time. + return msToExpirationTime(now()); + } + // We're not inside React, so we may be in the middle of a browser event. + if (currentEventTime !== NoWork) { + // Use the same start time for all updates until we enter React again. + return currentEventTime; + } + // This is the first update since React yielded. Compute a new start time. + currentEventTime = msToExpirationTime(now()); + return currentEventTime; +} + +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + var mode = fiber.mode; + if ((mode & BatchedMode) === NoMode) { + return Sync; + } + + var priorityLevel = getCurrentPriorityLevel(); + if ((mode & ConcurrentMode) === NoMode) { + return priorityLevel === ImmediatePriority ? Sync : Batched; + } + + if ((executionContext & RenderContext) !== NoContext) { + // Use whatever time we're already rendering + return renderExpirationTime; + } + + var expirationTime = void 0; + if (suspenseConfig !== null) { + // Compute an expiration time based on the Suspense timeout. + expirationTime = computeSuspenseExpiration( + currentTime, + suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION + ); + } else { + // Compute an expiration time based on the Scheduler priority. + switch (priorityLevel) { + case ImmediatePriority: + expirationTime = Sync; + break; + case UserBlockingPriority$1: + // TODO: Rename this to computeUserBlockingExpiration + expirationTime = computeInteractiveExpiration(currentTime); + break; + case NormalPriority: + case LowPriority: + // TODO: Handle LowPriority + // TODO: Rename this to... something better. + expirationTime = computeAsyncExpiration(currentTime); + break; + case IdlePriority: + expirationTime = Never; + break; + default: + (function() { + { + throw ReactError(Error("Expected a valid priority level")); + } + })(); + } + } + + // If we're in the middle of rendering a tree, do not update at the same + // expiration time that is already rendering. + // TODO: We shouldn't have to do this if the update is on a different root. + // Refactor computeExpirationForFiber + scheduleUpdate so we have access to + // the root when we check for this condition. + if (workInProgressRoot !== null && expirationTime === renderExpirationTime) { + // This is a trick to move this update into a separate batch + expirationTime -= 1; + } + + return expirationTime; +} + +function scheduleUpdateOnFiber(fiber, expirationTime) { + checkForNestedUpdates(); + warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber); + + var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (root === null) { + warnAboutUpdateOnUnmountedFiberInDEV(fiber); + return; + } + + root.pingTime = NoWork; + + checkForInterruption(fiber, expirationTime); + recordScheduleUpdate(); + + // TODO: computeExpirationForFiber also reads the priority. Pass the + // priority as an argument to that function and this one. + var priorityLevel = getCurrentPriorityLevel(); + + if (expirationTime === Sync) { + if ( + // Check if we're inside unbatchedUpdates + (executionContext & LegacyUnbatchedContext) !== NoContext && + // Check if we're not already rendering + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Register pending interactions on the root to avoid losing traced interaction data. + schedulePendingInteractions(root, expirationTime); + + // This is a legacy edge case. The initial mount of a ReactDOM.render-ed + // root inside of batchedUpdates should be synchronous, but layout updates + // should be deferred until the end of the batch. + var callback = renderRoot(root, Sync, true); + while (callback !== null) { + callback = callback(true); + } + } else { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + if (executionContext === NoContext) { + // Flush the synchronous work now, wnless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of sync mode. + flushSyncCallbackQueue(); + } + } + } else { + scheduleCallbackForRoot(root, priorityLevel, expirationTime); + } + + if ( + (executionContext & DiscreteEventContext) !== NoContext && + // Only updates at user-blocking priority or greater are considered + // discrete, even inside a discrete event. + (priorityLevel === UserBlockingPriority$1 || + priorityLevel === ImmediatePriority) + ) { + // This is the result of a discrete event. Track the lowest priority + // discrete update per root so we can flush them early, if needed. + if (rootsWithPendingDiscreteUpdates === null) { + rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); + } else { + var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); + if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) { + rootsWithPendingDiscreteUpdates.set(root, expirationTime); + } + } + } +} +var scheduleWork = scheduleUpdateOnFiber; + +// This is split into a separate function so we can mark a fiber with pending +// work without treating it as a typical update that originates from an event; +// e.g. retrying a Suspense boundary isn't an update, but it does schedule work +// on a fiber. +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + // Update the source fiber's expiration time + if (fiber.expirationTime < expirationTime) { + fiber.expirationTime = expirationTime; + } + var alternate = fiber.alternate; + if (alternate !== null && alternate.expirationTime < expirationTime) { + alternate.expirationTime = expirationTime; + } + // Walk the parent path to the root and update the child expiration time. + var node = fiber.return; + var root = null; + if (node === null && fiber.tag === HostRoot) { + root = fiber.stateNode; + } else { + while (node !== null) { + alternate = node.alternate; + if (node.childExpirationTime < expirationTime) { + node.childExpirationTime = expirationTime; + if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + } else if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + if (node.return === null && node.tag === HostRoot) { + root = node.stateNode; + break; + } + node = node.return; + } + } + + if (root !== null) { + // Update the first and last pending expiration times in this root + var firstPendingTime = root.firstPendingTime; + if (expirationTime > firstPendingTime) { + root.firstPendingTime = expirationTime; + } + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime === NoWork || expirationTime < lastPendingTime) { + root.lastPendingTime = expirationTime; + } + } + + return root; +} + +// Use this function, along with runRootCallback, to ensure that only a single +// callback per root is scheduled. It's still possible to call renderRoot +// directly, but scheduling via this function helps avoid excessive callbacks. +// It works by storing the callback node and expiration time on the root. When a +// new callback comes in, it compares the expiration time to determine if it +// should cancel the previous one. It also relies on commitRoot scheduling a +// callback to render the next level, because that means we don't need a +// separate callback per expiration time. +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + var existingCallbackExpirationTime = root.callbackExpirationTime; + if (existingCallbackExpirationTime < expirationTime) { + // New callback has higher priority than the existing one. + var existingCallbackNode = root.callbackNode; + if (existingCallbackNode !== null) { + cancelCallback(existingCallbackNode); + } + root.callbackExpirationTime = expirationTime; + + if (expirationTime === Sync) { + // Sync React callbacks are scheduled on a special internal queue + root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + ); + } else { + var options = null; + if ( + !disableSchedulerTimeoutBasedOnReactExpirationTime && + expirationTime !== Never + ) { + var timeout = expirationTimeToMs(expirationTime) - now(); + options = { timeout: timeout }; + } + + root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + options + ); + if ( + enableUserTimingAPI && + expirationTime !== Sync && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Scheduled an async callback, and we're not already working. Add an + // entry to the flamegraph that shows we're waiting for a callback + // to fire. + startRequestCallbackTimer(); + } + } + } + + // Associate the current interactions with this new root+priority. + schedulePendingInteractions(root, expirationTime); +} + +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode; + var continuation = null; + try { + continuation = callback(isSync); + if (continuation !== null) { + return runRootCallback.bind(null, root, continuation); + } else { + return null; + } + } finally { + // If the callback exits without returning a continuation, remove the + // corresponding callback node from the root. Unless the callback node + // has changed, which implies that it was already cancelled by a high + // priority update. + if (continuation === null && prevCallbackNode === root.callbackNode) { + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + } + } +} + +function flushDiscreteUpdates() { + // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. + // However, `act` uses `batchedUpdates`, so there's no way to distinguish + // those two cases. Need to fix this before exposing flushDiscreteUpdates + // as a public API. + if ( + (executionContext & (BatchedContext | RenderContext | CommitContext)) !== + NoContext + ) { + if (true && (executionContext & RenderContext) !== NoContext) { + warning$1( + false, + "unstable_flushDiscreteUpdates: Cannot flush updates when React is " + + "already rendering." + ); + } + // We're already rendering, so we can't synchronously flush pending work. + // This is probably a nested event dispatch triggered by a lifecycle/effect, + // like `el.focus()`. Exit. + return; + } + flushPendingDiscreteUpdates(); + if (!revertPassiveEffectsChange) { + // If the discrete updates scheduled passive effects, flush them now so that + // they fire before the next serial event. + flushPassiveEffects(); + } +} + +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + if ( + firstBatch !== null && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ) { + scheduleCallback(NormalPriority, function() { + firstBatch._onComplete(); + return null; + }); + return true; + } else { + return false; + } +} + +function flushPendingDiscreteUpdates() { + if (rootsWithPendingDiscreteUpdates !== null) { + // For each root with pending discrete updates, schedule a callback to + // immediately flush them. + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + // Now flush the immediate queue. + flushSyncCallbackQueue(); + } +} + +function batchedUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function batchedEventUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= EventContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function discreteUpdates$1(fn, a, b, c) { + var prevExecutionContext = executionContext; + executionContext |= DiscreteEventContext; + try { + // Should this + return runWithPriority$1(UserBlockingPriority$1, fn.bind(null, a, b, c)); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function flushSync(fn, a) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + (function() { + { + throw ReactError( + Error( + "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." + ) + ); + } + })(); + } + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return runWithPriority$1(ImmediatePriority, fn.bind(null, a)); + } finally { + executionContext = prevExecutionContext; + // Flush the immediate callbacks that were scheduled during this batch. + // Note that this will happen even if batchedUpdates is higher up + // the stack. + flushSyncCallbackQueue(); + } +} + +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + var timeoutHandle = root.timeoutHandle; + if (timeoutHandle !== noTimeout) { + // The root previous suspended and scheduled a timeout to commit a fallback + // state. Now that we have additional work, cancel the timeout. + root.timeoutHandle = noTimeout; + // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above + cancelTimeout(timeoutHandle); + } + + if (workInProgress !== null) { + var interruptedWork = workInProgress.return; + while (interruptedWork !== null) { + unwindInterruptedWork(interruptedWork); + interruptedWork = interruptedWork.return; + } + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestProcessedExpirationTime = Sync; + workInProgressRootLatestSuspenseTimeout = Sync; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = false; + + if (enableSchedulerTracing) { + spawnedWorkDuringRender = null; + } + + { + ReactStrictModeWarnings.discardPendingWarnings(); + componentsThatTriggeredHighPriSuspend = null; + } +} + +function renderRoot(root, expirationTime, isSync) { + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + if (enableUserTimingAPI && expirationTime !== Sync) { + var didExpire = isSync; + stopRequestCallbackTimer(didExpire); + } + + if (root.firstPendingTime < expirationTime) { + // If there's no work left at this expiration time, exit immediately. This + // happens when multiple callbacks are scheduled for a single root, but an + // earlier callback flushes the work of a later one. + return null; + } + + if (isSync && root.finishedExpirationTime === expirationTime) { + // There's already a pending commit at this expiration time. + // TODO: This is poorly factored. This case only exists for the + // batch.commit() API. + return commitRoot.bind(null, root); + } + + flushPassiveEffects(); + + // If the root or expiration time have changed, throw out the existing stack + // and prepare a fresh one. Otherwise we'll continue where we left off. + if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { + prepareFreshStack(root, expirationTime); + startWorkOnPendingInteractions(root, expirationTime); + } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // We could've received an update at a lower priority while we yielded. + // We're suspended in a delayed state. Once we complete this render we're + // just going to try to recover at the last pending time anyway so we might + // as well start doing that eagerly. + // Ideally we should be able to do this even for retries but we don't yet + // know if we're going to process an update which wants to commit earlier, + // and this path happens very early so it would happen too often. Instead, + // for that case, we'll wait until we complete. + if (workInProgressRootHasPendingPing) { + // We have a ping at this expiration. Let's restart to see if we get unblocked. + prepareFreshStack(root, expirationTime); + } else { + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately, while preserving the position in the queue. + return renderRoot.bind(null, root, lastPendingTime); + } + } + } + + // If we have a work-in-progress fiber, it means there's still work to do + // in this root. + if (workInProgress !== null) { + var prevExecutionContext = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + if (prevDispatcher === null) { + // The React isomorphic package does not include a default dispatcher. + // Instead the first renderer will lazily attach one, in order to give + // nicer error messages. + prevDispatcher = ContextOnlyDispatcher; + } + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + startWorkLoopTimer(workInProgress); + + // TODO: Fork renderRoot into renderRootSync and renderRootAsync + if (isSync) { + if (expirationTime !== Sync) { + // An async update expired. There may be other expired updates on + // this root. We should render all the expired work in a + // single batch. + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) { + // Restart at the current time. + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + return renderRoot.bind(null, root, currentTime); + } + } + } else { + // Since we know we're in a React event, we can clear the current + // event time. The next update will compute a new event time. + currentEventTime = NoWork; + } + + do { + try { + if (isSync) { + workLoopSync(); + } else { + workLoop(); + } + break; + } catch (thrownValue) { + // Reset module-level state that was set during the render phase. + resetContextDependencies(); + resetHooks(); + + var sourceFiber = workInProgress; + if (sourceFiber === null || sourceFiber.return === null) { + // Expected to be working on a non-root fiber. This is a fatal error + // because there's no ancestor that can handle it; the root is + // supposed to capture all errors that weren't caught by an error + // boundary. + prepareFreshStack(root, expirationTime); + executionContext = prevExecutionContext; + throw thrownValue; + } + + if (enableProfilerTimer && sourceFiber.mode & ProfileMode) { + // Record the time spent rendering before an error was thrown. This + // avoids inaccurate Profiler durations in the case of a + // suspended render. + stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true); + } + + var returnFiber = sourceFiber.return; + throwException( + root, + returnFiber, + sourceFiber, + thrownValue, + renderExpirationTime + ); + workInProgress = completeUnitOfWork(sourceFiber); + } + } while (true); + + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + + if (workInProgress !== null) { + // There's still work left over. Return a continuation. + stopInterruptedWorkLoopTimer(); + if (expirationTime !== Sync) { + startRequestCallbackTimer(); + } + return renderRoot.bind(null, root, expirationTime); + } + } + + // We now have a consistent tree. The next step is either to commit it, or, if + // something suspended, wait to commit it after a timeout. + stopFinishedWorkLoopTimer(); + + root.finishedWork = root.current.alternate; + root.finishedExpirationTime = expirationTime; + + var isLocked = resolveLocksOnRoot(root, expirationTime); + if (isLocked) { + // This root has a lock that prevents it from committing. Exit. If we begin + // work on the root again, without any intervening updates, it will finish + // without doing additional work. + return null; + } + + // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; + + switch (workInProgressRootExitStatus) { + case RootIncomplete: { + (function() { + { + throw ReactError(Error("Should have a work-in-progress.")); + } + })(); + } + // Flow knows about invariant, so it complains if I add a break statement, + // but eslint doesn't know about invariant, so it complains if I do. + // eslint-disable-next-line no-fallthrough + case RootErrored: { + // An error was thrown. First check if there is lower priority work + // scheduled on this root. + var _lastPendingTime = root.lastPendingTime; + if (_lastPendingTime < expirationTime) { + // There's lower priority work. Before raising the error, try rendering + // at the lower priority to see if it fixes it. Use a continuation to + // maintain the existing priority and position in the queue. + return renderRoot.bind(null, root, _lastPendingTime); + } + if (!isSync) { + // If we're rendering asynchronously, it's possible the error was + // caused by tearing due to a mutation during an event. Try rendering + // one more time without yiedling to events. + prepareFreshStack(root, expirationTime); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + return null; + } + // If we're already rendering synchronously, commit the root in its + // errored state. + return commitRoot.bind(null, root); + } + case RootSuspended: { + flushSuspensePriorityWarningInDEV(); + + // We have an acceptable loading state. We need to figure out if we should + // immediately commit it or wait a bit. + + // If we have processed new updates during this render, we may now have a + // new loading state ready. We want to ensure that we commit that as soon as + // possible. + var hasNotProcessedNewUpdates = + workInProgressRootLatestProcessedExpirationTime === Sync; + if ( + hasNotProcessedNewUpdates && + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // If we have not processed any new updates during this pass, then this is + // either a retry of an existing fallback state or a hidden tree. + // Hidden trees shouldn't be batched with other work and after that's + // fixed it can only be a retry. + // We're going to throttle committing retries so that we don't show too + // many loading states too quickly. + var msUntilTimeout = + globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); + // Don't bother with a very short suspense time. + if (msUntilTimeout > 10) { + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime2 = root.lastPendingTime; + if (_lastPendingTime2 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level. + return renderRoot.bind(null, root, _lastPendingTime2); + } + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootSuspendedWithDelay: { + flushSuspensePriorityWarningInDEV(); + + if ( + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // We're suspended in a state that should be avoided. We'll try to avoid committing + // it for as long as the timeouts let us. + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime3 = root.lastPendingTime; + if (_lastPendingTime3 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately. + return renderRoot.bind(null, root, _lastPendingTime3); + } + + var _msUntilTimeout = void 0; + if (workInProgressRootLatestSuspenseTimeout !== Sync) { + // We have processed a suspense config whose expiration time we can use as + // the timeout. + _msUntilTimeout = + expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now(); + } else if (workInProgressRootLatestProcessedExpirationTime === Sync) { + // This should never normally happen because only new updates cause + // delayed states, so we should have processed something. However, + // this could also happen in an offscreen tree. + _msUntilTimeout = 0; + } else { + // If we don't have a suspense config, we're going to use a heuristic to + var eventTimeMs = inferTimeFromExpirationTime( + workInProgressRootLatestProcessedExpirationTime + ); + var currentTimeMs = now(); + var timeUntilExpirationMs = + expirationTimeToMs(expirationTime) - currentTimeMs; + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed < 0) { + // We get this wrong some time since we estimate the time. + timeElapsed = 0; + } + + _msUntilTimeout = jnd(timeElapsed) - timeElapsed; + + // Clamp the timeout to the expiration time. + // TODO: Once the event time is exact instead of inferred from expiration time + // we don't need this. + if (timeUntilExpirationMs < _msUntilTimeout) { + _msUntilTimeout = timeUntilExpirationMs; + } + } + + // Don't bother with a very short suspense time. + if (_msUntilTimeout > 10) { + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootCompleted: { + // The work completed. Ready to commit. + if ( + !isSync && + // do not delay if we're inside an act() scope + !( + true && + flushSuspenseFallbacksInTests && + IsThisRendererActing.current + ) && + workInProgressRootLatestProcessedExpirationTime !== Sync && + workInProgressRootCanSuspendUsingConfig !== null + ) { + // If we have exceeded the minimum loading delay, which probably + // means we have shown a spinner already, we might have to suspend + // a bit longer to ensure that the spinner is shown for enough time. + var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay( + workInProgressRootLatestProcessedExpirationTime, + expirationTime, + workInProgressRootCanSuspendUsingConfig + ); + if (_msUntilTimeout2 > 10) { + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout2 + ); + return null; + } + } + return commitRoot.bind(null, root); + } + default: { + (function() { + { + throw ReactError(Error("Unknown root exit status.")); + } + })(); + } + } +} + +function markCommitTimeOfFallback() { + globalMostRecentFallbackTime = now(); +} + +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + if ( + expirationTime < workInProgressRootLatestProcessedExpirationTime && + expirationTime > Never + ) { + workInProgressRootLatestProcessedExpirationTime = expirationTime; + } + if (suspenseConfig !== null) { + if ( + expirationTime < workInProgressRootLatestSuspenseTimeout && + expirationTime > Never + ) { + workInProgressRootLatestSuspenseTimeout = expirationTime; + // Most of the time we only have one config and getting wrong is not bad. + workInProgressRootCanSuspendUsingConfig = suspenseConfig; + } + } +} + +function renderDidSuspend() { + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootSuspended; + } +} + +function renderDidSuspendDelayIfPossible() { + if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) { + workInProgressRootExitStatus = RootSuspendedWithDelay; + } +} + +function renderDidError() { + if (workInProgressRootExitStatus !== RootCompleted) { + workInProgressRootExitStatus = RootErrored; + } +} + +// Called during render to determine if anything has suspended. +// Returns false if we're not sure. +function renderHasNotSuspendedYet() { + // If something errored or completed, we can't really be sure, + // so those are false. + return workInProgressRootExitStatus === RootIncomplete; +} + +function inferTimeFromExpirationTime(expirationTime) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; +} + +function inferTimeFromExpirationTimeWithSuspenseConfig( + expirationTime, + suspenseConfig +) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time by subtracting the timeout + // that was added to the event time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return ( + earliestExpirationTimeMs - + (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION) + ); +} + +function workLoopSync() { + // Already timed out, so perform work without checking if we need to yield. + while (workInProgress !== null) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function workLoop() { + // Perform work until Scheduler asks us to yield + while (workInProgress !== null && !shouldYield()) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function performUnitOfWork(unitOfWork) { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = unitOfWork.alternate; + + startWorkTimer(unitOfWork); + setCurrentFiber(unitOfWork); + + var next = void 0; + if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) { + startProfilerTimer(unitOfWork); + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); + } else { + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + } + + resetCurrentFiber(); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + if (next === null) { + // If this doesn't spawn new work, complete the current work. + next = completeUnitOfWork(unitOfWork); + } + + ReactCurrentOwner$2.current = null; + return next; +} + +function completeUnitOfWork(unitOfWork) { + // Attempt to complete the current unit of work, then move to the next + // sibling. If there are no more siblings, return to the parent fiber. + workInProgress = unitOfWork; + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = workInProgress.alternate; + var returnFiber = workInProgress.return; + + // Check if the work completed or if something threw. + if ((workInProgress.effectTag & Incomplete) === NoEffect) { + setCurrentFiber(workInProgress); + var next = void 0; + if ( + !enableProfilerTimer || + (workInProgress.mode & ProfileMode) === NoMode + ) { + next = completeWork(current$$1, workInProgress, renderExpirationTime); + } else { + startProfilerTimer(workInProgress); + next = completeWork(current$$1, workInProgress, renderExpirationTime); + // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + } + stopWorkTimer(workInProgress); + resetCurrentFiber(); + resetChildExpirationTime(workInProgress); + + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + return next; + } + + if ( + returnFiber !== null && + // Do not append effects to parents if a sibling failed to complete + (returnFiber.effectTag & Incomplete) === NoEffect + ) { + // Append all the effects of the subtree and this fiber onto the effect + // list of the parent. The completion order of the children affects the + // side-effect order. + if (returnFiber.firstEffect === null) { + returnFiber.firstEffect = workInProgress.firstEffect; + } + if (workInProgress.lastEffect !== null) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; + } + returnFiber.lastEffect = workInProgress.lastEffect; + } + + // If this fiber had side-effects, we append it AFTER the children's + // side-effects. We can perform certain side-effects earlier if needed, + // by doing multiple passes over the effect list. We don't want to + // schedule our own side-effect on our own list because if end up + // reusing children we'll schedule this effect onto itself since we're + // at the end. + var effectTag = workInProgress.effectTag; + + // Skip both NoWork and PerformedWork tags when creating the effect + // list. PerformedWork effect is read by React DevTools but shouldn't be + // committed. + if (effectTag > PerformedWork) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress; + } else { + returnFiber.firstEffect = workInProgress; + } + returnFiber.lastEffect = workInProgress; + } + } + } else { + // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + var _next = unwindWork(workInProgress, renderExpirationTime); + + // Because this fiber did not complete, don't reset its expiration time. + + if ( + enableProfilerTimer && + (workInProgress.mode & ProfileMode) !== NoMode + ) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + + // Include the time spent working on failed children before continuing. + var actualDuration = workInProgress.actualDuration; + var child = workInProgress.child; + while (child !== null) { + actualDuration += child.actualDuration; + child = child.sibling; + } + workInProgress.actualDuration = actualDuration; + } + + if (_next !== null) { + // If completing this work spawned new work, do that next. We'll come + // back here again. + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + // TODO: The name stopFailedWorkTimer is misleading because Suspense + // also captures and restarts. + stopFailedWorkTimer(workInProgress); + _next.effectTag &= HostEffectMask; + return _next; + } + stopWorkTimer(workInProgress); + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its effect list. + returnFiber.firstEffect = returnFiber.lastEffect = null; + returnFiber.effectTag |= Incomplete; + } + } + + var siblingFiber = workInProgress.sibling; + if (siblingFiber !== null) { + // If there is more work to do in this returnFiber, do that next. + return siblingFiber; + } + // Otherwise, return to the parent + workInProgress = returnFiber; + } while (workInProgress !== null); + + // We've reached the root. + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootCompleted; + } + return null; +} + +function resetChildExpirationTime(completedWork) { + if ( + renderExpirationTime !== Never && + completedWork.childExpirationTime === Never + ) { + // The children of this component are hidden. Don't bubble their + // expiration times. + return; + } + + var newChildExpirationTime = NoWork; + + // Bubble up the earliest expiration time. + if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) { + // In profiling mode, resetChildExpirationTime is also used to reset + // profiler durations. + var actualDuration = completedWork.actualDuration; + var treeBaseDuration = completedWork.selfBaseDuration; + + // When a fiber is cloned, its actualDuration is reset to 0. This value will + // only be updated if work is done on the fiber (i.e. it doesn't bailout). + // When work is done, it should bubble to the parent's actualDuration. If + // the fiber has not been cloned though, (meaning no work was done), then + // this value will reflect the amount of time spent working on a previous + // render. In that case it should not bubble. We determine whether it was + // cloned by comparing the child pointer. + var shouldBubbleActualDurations = + completedWork.alternate === null || + completedWork.child !== completedWork.alternate.child; + + var child = completedWork.child; + while (child !== null) { + var childUpdateExpirationTime = child.expirationTime; + var childChildExpirationTime = child.childExpirationTime; + if (childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childUpdateExpirationTime; + } + if (childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childChildExpirationTime; + } + if (shouldBubbleActualDurations) { + actualDuration += child.actualDuration; + } + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + completedWork.actualDuration = actualDuration; + completedWork.treeBaseDuration = treeBaseDuration; + } else { + var _child = completedWork.child; + while (_child !== null) { + var _childUpdateExpirationTime = _child.expirationTime; + var _childChildExpirationTime = _child.childExpirationTime; + if (_childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childUpdateExpirationTime; + } + if (_childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childChildExpirationTime; + } + _child = _child.sibling; + } + } + + completedWork.childExpirationTime = newChildExpirationTime; +} + +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1( + ImmediatePriority, + commitRootImpl.bind(null, root, renderPriorityLevel) + ); + // If there are passive effects, schedule a callback to flush them. This goes + // outside commitRootImpl so that it inherits the priority of the render. + if (rootWithPendingPassiveEffects !== null) { + scheduleCallback(NormalPriority, function() { + flushPassiveEffects(); + return null; + }); + } + return null; +} + +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + flushRenderPhaseStrictModeWarningsInDEV(); + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + var finishedWork = root.finishedWork; + var expirationTime = root.finishedExpirationTime; + if (finishedWork === null) { + return null; + } + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + (function() { + if (!(finishedWork !== root.current)) { + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + // commitRoot never returns a continuation; it always finishes synchronously. + // So we can clear these now to allow a new callback to be scheduled. + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + + startCommitTimer(); + + // Update the first and last pending times on this root. The new first + // pending time is whatever is left on the root fiber. + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime; + var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + var firstPendingTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = firstPendingTimeBeforeCommit; + if (firstPendingTimeBeforeCommit < root.lastPendingTime) { + // This usually means we've finished all the work, but it can also happen + // when something gets downprioritized during render, like a hidden tree. + root.lastPendingTime = firstPendingTimeBeforeCommit; + } + + if (root === workInProgressRoot) { + // We can reset these now that they are finished. + workInProgressRoot = null; + workInProgress = null; + renderExpirationTime = NoWork; + } else { + } + // This indicates that the last root we worked on is not the same one that + // we're committing now. This most commonly happens when a suspended root + // times out. + + // Get the list of effects. + var firstEffect = void 0; + if (finishedWork.effectTag > PerformedWork) { + // A fiber's effect list consists only of its children, not itself. So if + // the root has an effect, we need to add it to the end of the list. The + // resulting list is the set that would belong to the root's parent, if it + // had one; that is, all the effects in the tree including the root. + if (finishedWork.lastEffect !== null) { + finishedWork.lastEffect.nextEffect = finishedWork; + firstEffect = finishedWork.firstEffect; + } else { + firstEffect = finishedWork; + } + } else { + // There is no effect on the root. + firstEffect = finishedWork.firstEffect; + } + + if (firstEffect !== null) { + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + // Reset this to null before calling lifecycles + ReactCurrentOwner$2.current = null; + + // The commit phase is broken into several sub-phases. We do a separate pass + // of the effect list for each phase: all mutation effects come before all + // layout effects, and so on. + + // The first phase a "before mutation" phase. We use this phase to read the + // state of the host tree right before we mutate it. This is where + // getSnapshotBeforeUpdate is called. + startCommitSnapshotEffectsTimer(); + prepareForCommit(root.containerInfo); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback(null, commitBeforeMutationEffects, null); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitSnapshotEffectsTimer(); + + if (enableProfilerTimer) { + // Mark the current commit time to be shared by all Profilers in this + // batch. This enables them to be grouped later. + recordCommitTime(); + } + + // The next phase is the mutation phase, where we mutate the host tree. + startCommitHostEffectsTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitMutationEffects, + null, + renderPriorityLevel + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitHostEffectsTimer(); + resetAfterCommit(root.containerInfo); + + // The work-in-progress tree is now the current tree. This must come after + // the mutation phase, so that the previous tree is still current during + // componentWillUnmount, but before the layout phase, so that the finished + // work is current during componentDidMount/Update. + root.current = finishedWork; + + // The next phase is the layout phase, where we call effects that read + // the host tree after it's been mutated. The idiomatic use case for this is + // layout, but class component lifecycles also fire here for legacy reasons. + startCommitLifeCyclesTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitLayoutEffects, + null, + root, + expirationTime + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error2 = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error2); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitLifeCyclesTimer(); + + nextEffect = null; + + // Tell Scheduler to yield at the end of the frame, so the browser has an + // opportunity to paint. + requestPaint(); + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + executionContext = prevExecutionContext; + } else { + // No effects. + root.current = finishedWork; + // Measure these anyway so the flamegraph explicitly shows that there were + // no effects. + // TODO: Maybe there's a better way to report this. + startCommitSnapshotEffectsTimer(); + stopCommitSnapshotEffectsTimer(); + if (enableProfilerTimer) { + recordCommitTime(); + } + startCommitHostEffectsTimer(); + stopCommitHostEffectsTimer(); + startCommitLifeCyclesTimer(); + stopCommitLifeCyclesTimer(); + } + + stopCommitTimer(); + + var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; + + if (rootDoesHavePassiveEffects) { + // This commit has passive effects. Stash a reference to them. But don't + // schedule a callback until after flushing layout work. + rootDoesHavePassiveEffects = false; + rootWithPendingPassiveEffects = root; + pendingPassiveEffectsExpirationTime = expirationTime; + pendingPassiveEffectsRenderPriority = renderPriorityLevel; + } else { + // We are done with the effect chain at this point so let's clear the + // nextEffect pointers to assist with GC. If we have passive effects, we'll + // clear this in flushPassiveEffects. + nextEffect = firstEffect; + while (nextEffect !== null) { + var nextNextEffect = nextEffect.nextEffect; + nextEffect.nextEffect = null; + nextEffect = nextNextEffect; + } + } + + // Check if there's remaining work on this root + var remainingExpirationTime = root.firstPendingTime; + if (remainingExpirationTime !== NoWork) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + remainingExpirationTime + ); + + if (enableSchedulerTracing) { + if (spawnedWorkDuringRender !== null) { + var expirationTimes = spawnedWorkDuringRender; + spawnedWorkDuringRender = null; + for (var i = 0; i < expirationTimes.length; i++) { + scheduleInteractions( + root, + expirationTimes[i], + root.memoizedInteractions + ); + } + } + } + + scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); + } else { + // If there's no remaining work, we can clear the set of already failed + // error boundaries. + legacyErrorBoundariesThatAlreadyFailed = null; + } + + if (enableSchedulerTracing) { + if (!rootDidHavePassiveEffects) { + // If there are no passive effects, then we can complete the pending interactions. + // Otherwise, we'll wait until after the passive effects are flushed. + // Wait to do this until after remaining work has been scheduled, + // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. + finishPendingInteractions(root, expirationTime); + } + } + + onCommitRoot(finishedWork.stateNode, expirationTime); + + if (remainingExpirationTime === Sync) { + // Count the number of times the root synchronously re-renders without + // finishing. If there are too many, it indicates an infinite update loop. + if (root === rootWithNestedUpdates) { + nestedUpdateCount++; + } else { + nestedUpdateCount = 0; + rootWithNestedUpdates = root; + } + } else { + nestedUpdateCount = 0; + } + + if (hasUncaughtError) { + hasUncaughtError = false; + var _error3 = firstUncaughtError; + firstUncaughtError = null; + throw _error3; + } + + if ((executionContext & LegacyUnbatchedContext) !== NoContext) { + // This is a legacy edge case. We just committed the initial mount of + // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired + // synchronously, but layout updates should be deferred until the end + // of the batch. + return null; + } + + // If layout work was scheduled, flush it now. + flushSyncCallbackQueue(); + return null; +} + +function commitBeforeMutationEffects() { + while (nextEffect !== null) { + if ((nextEffect.effectTag & Snapshot) !== NoEffect) { + setCurrentFiber(nextEffect); + recordEffect(); + + var current$$1 = nextEffect.alternate; + commitBeforeMutationLifeCycles(current$$1, nextEffect); + + resetCurrentFiber(); + } + nextEffect = nextEffect.nextEffect; + } +} + +function commitMutationEffects(renderPriorityLevel) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & ContentReset) { + commitResetTextContent(nextEffect); + } + + if (effectTag & Ref) { + var current$$1 = nextEffect.alternate; + if (current$$1 !== null) { + commitDetachRef(current$$1); + } + } + + // The following switch statement is only concerned about placement, + // updates, and deletions. To avoid needing to add a case for every possible + // bitmap value, we remove the secondary effects from the effect tag and + // switch on that value. + var primaryEffectTag = effectTag & (Placement | Update | Deletion); + switch (primaryEffectTag) { + case Placement: { + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + // TODO: findDOMNode doesn't rely on this any more but isMounted does + // and isMounted is deprecated anyway so we should be able to kill this. + nextEffect.effectTag &= ~Placement; + break; + } + case PlacementAndUpdate: { + // Placement + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + nextEffect.effectTag &= ~Placement; + + // Update + var _current = nextEffect.alternate; + commitWork(_current, nextEffect); + break; + } + case Update: { + var _current2 = nextEffect.alternate; + commitWork(_current2, nextEffect); + break; + } + case Deletion: { + commitDeletion(nextEffect, renderPriorityLevel); + break; + } + } + + // TODO: Only record a mutation effect if primaryEffectTag is non-zero. + recordEffect(); + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function commitLayoutEffects(root, committedExpirationTime) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & (Update | Callback)) { + recordEffect(); + var current$$1 = nextEffect.alternate; + commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); + } + + if (effectTag & Ref) { + recordEffect(); + commitAttachRef(nextEffect); + } + + if (effectTag & Passive) { + rootDoesHavePassiveEffects = true; + } + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function flushPassiveEffects() { + if (rootWithPendingPassiveEffects === null) { + return false; + } + var root = rootWithPendingPassiveEffects; + var expirationTime = pendingPassiveEffectsExpirationTime; + var renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = NoWork; + pendingPassiveEffectsRenderPriority = NoPriority; + var priorityLevel = + renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; + return runWithPriority$1( + priorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} + +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + } + })(); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + + // Note: This currently assumes there are no passive effects on the root + // fiber, because the root is not part of its own effect list. This could + // change in the future. + var effect = root.current.firstEffect; + while (effect !== null) { + { + setCurrentFiber(effect); + invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); + if (hasCaughtError()) { + (function() { + if (!(effect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(effect, error); + } + resetCurrentFiber(); + } + var nextNextEffect = effect.nextEffect; + // Remove nextEffect pointer to assist GC + effect.nextEffect = null; + effect = nextNextEffect; + } + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); + } + + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + + // If additional passive effects were scheduled, increment a counter. If this + // exceeds the limit, we'll fire a warning. + nestedPassiveUpdateCount = + rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + + return true; +} + +function isAlreadyFailedLegacyErrorBoundary(instance) { + return ( + legacyErrorBoundariesThatAlreadyFailed !== null && + legacyErrorBoundariesThatAlreadyFailed.has(instance) + ); +} + +function markLegacyErrorBoundaryAsFailed(instance) { + if (legacyErrorBoundariesThatAlreadyFailed === null) { + legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); + } else { + legacyErrorBoundariesThatAlreadyFailed.add(instance); + } +} + +function prepareToThrowUncaughtError(error) { + if (!hasUncaughtError) { + hasUncaughtError = true; + firstUncaughtError = error; + } +} +var onUncaughtError = prepareToThrowUncaughtError; + +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); + enqueueUpdate(rootFiber, update); + var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } +} + +function captureCommitPhaseError(sourceFiber, error) { + if (sourceFiber.tag === HostRoot) { + // Error was thrown at the root. There is no parent, so the root + // itself should capture it. + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } + + var fiber = sourceFiber.return; + while (fiber !== null) { + if (fiber.tag === HostRoot) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } else if (fiber.tag === ClassComponent) { + var ctor = fiber.type; + var instance = fiber.stateNode; + if ( + typeof ctor.getDerivedStateFromError === "function" || + (typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance)) + ) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createClassErrorUpdate( + fiber, + errorInfo, + // TODO: This is always sync + Sync + ); + enqueueUpdate(fiber, update); + var root = markUpdateTimeFromFiberToRoot(fiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } + return; + } + } + fiber = fiber.return; + } +} + +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + if (pingCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + pingCache.delete(thenable); + } + + if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { + // Received a ping at the same priority level at which we're currently + // rendering. We might want to restart this render. This should mirror + // the logic of whether or not a root suspends once it completes. + + // TODO: If we're rendering sync either due to Sync, Batched or expired, + // we should probably never restart. + + // If we're suspended with delay, we'll always suspend so we can always + // restart. If we're suspended without any updates, it might be a retry. + // If it's early in the retry we can restart. We can't know for sure + // whether we'll eventually process an update during this render pass, + // but it's somewhat unlikely that we get to a ping before that, since + // getting to the root most update is usually very fast. + if ( + workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + workInProgressRootLatestProcessedExpirationTime === Sync && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ) { + // Restart from the root. Don't need to schedule a ping because + // we're already working on this tree. + prepareFreshStack(root, renderExpirationTime); + } else { + // Even though we can't restart right now, we might get an + // opportunity later. So we mark this render as having a ping. + workInProgressRootHasPendingPing = true; + } + return; + } + + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < suspendedTime) { + // The root is no longer suspended at this time. + return; + } + + var pingTime = root.pingTime; + if (pingTime !== NoWork && pingTime < suspendedTime) { + // There's already a lower priority ping scheduled. + return; + } + + // Mark the time at which this ping was scheduled. + root.pingTime = suspendedTime; + + if (root.finishedExpirationTime === suspendedTime) { + // If there's a pending fallback waiting to commit, throw it away. + root.finishedExpirationTime = NoWork; + root.finishedWork = null; + } + + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + suspendedTime + ); + scheduleCallbackForRoot(root, priorityLevel, suspendedTime); +} + +function retryTimedOutBoundary(boundaryFiber) { + // The boundary fiber (a Suspense component or SuspenseList component) + // previously was rendered in its fallback state. One of the promises that + // suspended it has resolved, which means at least part of the tree was + // likely unblocked. Try rendering again, at a new expiration time. + var currentTime = requestCurrentTime(); + var suspenseConfig = null; // Retries don't carry over the already committed update. + var retryTime = computeExpirationForFiber( + currentTime, + boundaryFiber, + suspenseConfig + ); + // TODO: Special case idle priority? + var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); + var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); + if (root !== null) { + scheduleCallbackForRoot(root, priorityLevel, retryTime); + } +} + +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = void 0; + if (enableSuspenseServerRenderer) { + switch (boundaryFiber.tag) { + case SuspenseComponent: + retryCache = boundaryFiber.stateNode; + break; + case DehydratedSuspenseComponent: + retryCache = boundaryFiber.memoizedState; + break; + default: + (function() { + { + throw ReactError( + Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." + ) + ); + } + })(); + } + } else { + retryCache = boundaryFiber.stateNode; + } + + if (retryCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + retryCache.delete(thenable); + } + + retryTimedOutBoundary(boundaryFiber); +} + +// Computes the next Just Noticeable Difference (JND) boundary. +// The theory is that a person can't tell the difference between small differences in time. +// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable +// difference in the experience. However, waiting for longer might mean that we can avoid +// showing an intermediate loading state. The longer we have already waited, the harder it +// is to tell small differences in time. Therefore, the longer we've already waited, +// the longer we can wait additionally. At some point we have to give up though. +// We pick a train model where the next boundary commits at a consistent schedule. +// These particular numbers are vague estimates. We expect to adjust them based on research. +function jnd(timeElapsed) { + return timeElapsed < 120 + ? 120 + : timeElapsed < 480 + ? 480 + : timeElapsed < 1080 + ? 1080 + : timeElapsed < 1920 + ? 1920 + : timeElapsed < 3000 + ? 3000 + : timeElapsed < 4320 + ? 4320 + : ceil(timeElapsed / 1960) * 1960; +} + +function computeMsUntilSuspenseLoadingDelay( + mostRecentEventTime, + committedExpirationTime, + suspenseConfig +) { + var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0; + if (busyMinDurationMs <= 0) { + return 0; + } + var busyDelayMs = suspenseConfig.busyDelayMs | 0; + + // Compute the time until this render pass would expire. + var currentTimeMs = now(); + var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig( + mostRecentEventTime, + suspenseConfig + ); + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed <= busyDelayMs) { + // If we haven't yet waited longer than the initial delay, we don't + // have to wait any additional time. + return 0; + } + var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; + // This is the value that is passed to `setTimeout`. + return msUntilTimeout; +} + +function checkForNestedUpdates() { + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { + nestedUpdateCount = 0; + rootWithNestedUpdates = null; + (function() { + { + throw ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + ); + } + })(); + } + + { + if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { + nestedPassiveUpdateCount = 0; + warning$1( + false, + "Maximum update depth exceeded. This can happen when a component " + + "calls setState inside useEffect, but useEffect either doesn't " + + "have a dependency array, or one of the dependencies changes on " + + "every render." + ); + } + } +} + +function flushRenderPhaseStrictModeWarningsInDEV() { + { + ReactStrictModeWarnings.flushLegacyContextWarning(); + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); + } + } +} + +function stopFinishedWorkLoopTimer() { + var didCompleteRoot = true; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function stopInterruptedWorkLoopTimer() { + // TODO: Track which fiber caused the interruption. + var didCompleteRoot = false; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { + if ( + enableUserTimingAPI && + workInProgressRoot !== null && + updateExpirationTime > renderExpirationTime + ) { + interruptedBy = fiberThatReceivedUpdate; + } +} + +var didWarnStateUpdateForUnmountedComponent = null; +function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + { + var tag = fiber.tag; + if ( + tag !== HostRoot && + tag !== ClassComponent && + tag !== FunctionComponent && + tag !== ForwardRef && + tag !== MemoComponent && + tag !== SimpleMemoComponent + ) { + // Only warn for user-defined components, not internal ones like Suspense. + return; + } + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForUnmountedComponent !== null) { + if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { + return; + } + didWarnStateUpdateForUnmountedComponent.add(componentName); + } else { + didWarnStateUpdateForUnmountedComponent = new Set([componentName]); + } + warningWithoutStack$1( + false, + "Can't perform a React state update on an unmounted component. This " + + "is a no-op, but it indicates a memory leak in your application. To " + + "fix, cancel all subscriptions and asynchronous tasks in %s.%s", + tag === ClassComponent + ? "the componentWillUnmount method" + : "a useEffect cleanup function", + getStackByFiberInDevAndProd(fiber) + ); + } +} + +var beginWork$$1 = void 0; +if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { + var dummyFiber = null; + beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { + // If a component throws an error, we replay it again in a synchronously + // dispatched event, so that the debugger will treat it as an uncaught + // error See ReactErrorUtils for more information. + + // Before entering the begin phase, copy the work-in-progress onto a dummy + // fiber. If beginWork throws, we'll use this to reset the state. + var originalWorkInProgressCopy = assignFiberPropertiesInDEV( + dummyFiber, + unitOfWork + ); + try { + return beginWork$1(current$$1, unitOfWork, expirationTime); + } catch (originalError) { + if ( + originalError !== null && + typeof originalError === "object" && + typeof originalError.then === "function" + ) { + // Don't replay promises. Treat everything else like an error. + throw originalError; + } + + // Keep this code in sync with renderRoot; any changes here must have + // corresponding changes there. + resetContextDependencies(); + resetHooks(); + + // Unwind the failed stack frame + unwindInterruptedWork(unitOfWork); + + // Restore the original properties of the fiber. + assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + + if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { + // Reset the profiler timer. + startProfilerTimer(unitOfWork); + } + + // Run beginWork again. + invokeGuardedCallback( + null, + beginWork$1, + null, + current$$1, + unitOfWork, + expirationTime + ); + + if (hasCaughtError()) { + var replayError = clearCaughtError(); + // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. + // Rethrow this error instead of the original one. + throw replayError; + } else { + // This branch is reachable if the render phase is impure. + throw originalError; + } + } + }; +} else { + beginWork$$1 = beginWork$1; +} + +var didWarnAboutUpdateInRender = false; +var didWarnAboutUpdateInGetChildContext = false; +function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { + { + if (fiber.tag === ClassComponent) { + switch (phase) { + case "getChildContext": + if (didWarnAboutUpdateInGetChildContext) { + return; + } + warningWithoutStack$1( + false, + "setState(...): Cannot call setState() inside getChildContext()" + ); + didWarnAboutUpdateInGetChildContext = true; + break; + case "render": + if (didWarnAboutUpdateInRender) { + return; + } + warningWithoutStack$1( + false, + "Cannot update during an existing state transition (such as " + + "within `render`). Render methods should be a pure function of " + + "props and state." + ); + didWarnAboutUpdateInRender = true; + break; + } + } + } +} + +// a 'shared' variable that changes when act() opens/closes in tests. +var IsThisRendererActing = { current: false }; + +function warnIfNotScopedWithMatchingAct(fiber) { + { + if ( + warnsIfNotActing === true && + IsSomeRendererActing.current === true && + IsThisRendererActing.current !== true + ) { + warningWithoutStack$1( + false, + "It looks like you're using the wrong act() around your test interactions.\n" + + "Be sure to use the matching version of act() corresponding to your renderer:\n\n" + + "// for react-dom:\n" + + "import {act} from 'react-dom/test-utils';\n" + + "// ...\n" + + "act(() => ...);\n\n" + + "// for react-test-renderer:\n" + + "import TestRenderer from 'react-test-renderer';\n" + + "const {act} = TestRenderer;\n" + + "// ...\n" + + "act(() => ...);" + + "%s", + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +function warnIfNotCurrentlyActingEffectsInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + (fiber.mode & StrictMode) !== NoMode && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s ran an effect, but was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + executionContext === NoContext && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s inside a test was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; + +// In tests, we want to enforce a mocked scheduler. +var didWarnAboutUnmockedScheduler = false; +// TODO Before we release concurrent mode, revisit this and decide whether a mocked +// scheduler is the actual recommendation. The alternative could be a testing build, +// a new lib, or whatever; we dunno just yet. This message is for early adopters +// to get their tests right. + +function warnIfUnmockedScheduler(fiber) { + { + if ( + didWarnAboutUnmockedScheduler === false && + Scheduler.unstable_flushAllWithoutAsserting === undefined + ) { + if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } else if (warnAboutUnmockedScheduler === true) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'Starting from React v17, the "scheduler" module will need to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } + } + } +} + +var componentsThatTriggeredHighPriSuspend = null; +function checkForWrongSuspensePriorityInDEV(sourceFiber) { + { + var currentPriorityLevel = getCurrentPriorityLevel(); + if ( + (sourceFiber.mode & ConcurrentMode) !== NoEffect && + (currentPriorityLevel === UserBlockingPriority$1 || + currentPriorityLevel === ImmediatePriority) + ) { + var workInProgressNode = sourceFiber; + while (workInProgressNode !== null) { + // Add the component that triggered the suspense + var current$$1 = workInProgressNode.alternate; + if (current$$1 !== null) { + // TODO: warn component that triggers the high priority + // suspend is the HostRoot + switch (workInProgressNode.tag) { + case ClassComponent: + // Loop through the component's update queue and see whether the component + // has triggered any high priority updates + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var update = updateQueue.firstUpdate; + while (update !== null) { + var priorityLevel = update.priority; + if ( + priorityLevel === UserBlockingPriority$1 || + priorityLevel === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + update = update.next; + } + } + break; + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + if ( + workInProgressNode.memoizedState !== null && + workInProgressNode.memoizedState.baseUpdate !== null + ) { + var _update = workInProgressNode.memoizedState.baseUpdate; + // Loop through the functional component's memoized state to see whether + // the component has triggered any high pri updates + while (_update !== null) { + var priority = _update.priority; + if ( + priority === UserBlockingPriority$1 || + priority === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + if ( + _update.next === workInProgressNode.memoizedState.baseUpdate + ) { + break; + } + _update = _update.next; + } + } + break; + default: + break; + } + } + workInProgressNode = workInProgressNode.return; + } + } + } +} + +function flushSuspensePriorityWarningInDEV() { + { + if (componentsThatTriggeredHighPriSuspend !== null) { + var componentNames = []; + componentsThatTriggeredHighPriSuspend.forEach(function(name) { + return componentNames.push(name); + }); + componentsThatTriggeredHighPriSuspend = null; + + if (componentNames.length > 0) { + warningWithoutStack$1( + false, + "%s triggered a user-blocking update that suspended." + + "\n\n" + + "The fix is to split the update into multiple parts: a user-blocking " + + "update to provide immediate feedback, and another update that " + + "triggers the bulk of the changes." + + "\n\n" + + "Refer to the documentation for useSuspenseTransition to learn how " + + "to implement this pattern.", + // TODO: Add link to React docs with more information, once it exists + componentNames.sort().join(", ") + ); + } + } + } +} + +function computeThreadID(root, expirationTime) { + // Interaction threads are unique per root and expiration time. + return expirationTime * 1000 + root.interactionThreadID; +} + +function markSpawnedWork(expirationTime) { + if (!enableSchedulerTracing) { + return; + } + if (spawnedWorkDuringRender === null) { + spawnedWorkDuringRender = [expirationTime]; + } else { + spawnedWorkDuringRender.push(expirationTime); + } +} + +function scheduleInteractions(root, expirationTime, interactions) { + if (!enableSchedulerTracing) { + return; + } + + if (interactions.size > 0) { + var pendingInteractionMap = root.pendingInteractionMap; + var pendingInteractions = pendingInteractionMap.get(expirationTime); + if (pendingInteractions != null) { + interactions.forEach(function(interaction) { + if (!pendingInteractions.has(interaction)) { + // Update the pending async work count for previously unscheduled interaction. + interaction.__count++; + } + + pendingInteractions.add(interaction); + }); + } else { + pendingInteractionMap.set(expirationTime, new Set(interactions)); + + // Update the pending async work count for the current interactions. + interactions.forEach(function(interaction) { + interaction.__count++; + }); + } + + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + subscriber.onWorkScheduled(interactions, threadID); + } + } +} + +function schedulePendingInteractions(root, expirationTime) { + // This is called when work is scheduled on a root. + // It associates the current interactions with the newly-scheduled expiration. + // They will be restored when that expiration is later committed. + if (!enableSchedulerTracing) { + return; + } + + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); +} + +function startWorkOnPendingInteractions(root, expirationTime) { + // This is called when new work is started on a root. + if (!enableSchedulerTracing) { + return; + } + + // Determine which interactions this batch of work currently includes, So that + // we can accurately attribute time spent working on it, And so that cascading + // work triggered during the render phase will be associated with it. + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + if (scheduledExpirationTime >= expirationTime) { + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + } + }); + + // Store the current set of interactions on the FiberRoot for a few reasons: + // We can re-use it in hot functions like renderRoot() without having to + // recalculate it. We will also use it in commitWork() to pass to any Profiler + // onRender() hooks. This also provides DevTools with a way to access it when + // the onCommitRoot() hook is called. + root.memoizedInteractions = interactions; + + if (interactions.size > 0) { + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } + } +} + +function finishPendingInteractions(root, committedExpirationTime) { + if (!enableSchedulerTracing) { + return; + } + + var earliestRemainingTimeAfterCommit = root.firstPendingTime; + + var subscriber = void 0; + + try { + subscriber = tracing.__subscriberRef.current; + if (subscriber !== null && root.memoizedInteractions.size > 0) { + var threadID = computeThreadID(root, committedExpirationTime); + subscriber.onWorkStopped(root.memoizedInteractions, threadID); + } + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } finally { + // Clear completed interactions from the pending Map. + // Unless the render was suspended or cascading work was scheduled, + // In which case– leave pending interactions until the subsequent render. + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + // Only decrement the pending interaction count if we're done. + // If there's still work at the current priority, + // That indicates that we are waiting for suspense data. + if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { + pendingInteractionMap.delete(scheduledExpirationTime); + + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; + + if (subscriber !== null && interaction.__count === 0) { + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } + }); + } + }); + } +} + +var onCommitFiberRoot = null; +var onCommitFiberUnmount = null; +var hasLoggedError = false; + +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; + +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { + // No DevTools + return false; + } + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } + if (!hook.supportsFiber) { + { + warningWithoutStack$1( + false, + "The installed version of React DevTools is too old and will not work " + + "with the current version of React. Please update React DevTools. " + + "https://fb.me/react-devtools" + ); + } + // DevTools exists, even though it doesn't support Fiber. + return true; + } + try { + var rendererID = hook.inject(internals); + // We have successfully injected, so now it is safe to set up hooks. + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = (root.current.effectTag & DidCapture) === DidCapture; + if (enableProfilerTimer) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } else { + hook.onCommitFiberRoot(rendererID, root, undefined, didError); + } + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } + } + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } + } + }; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s.", + err + ); + } + } + // DevTools exists + return true; +} + +function onCommitRoot(root, expirationTime) { + if (typeof onCommitFiberRoot === "function") { + onCommitFiberRoot(root, expirationTime); + } +} + +function onCommitUnmount(fiber) { + if (typeof onCommitFiberUnmount === "function") { + onCommitFiberUnmount(fiber); + } +} + +var hasBadMapPolyfill = void 0; + +{ + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + var testMap = new Map([[nonExtensibleObject, null]]); + var testSet = new Set([nonExtensibleObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; + } +} + +// A Fiber is work on a Component that needs to be done or was done. There can +// be more than one per component. + +var debugCounter = void 0; + +{ + debugCounter = 1; +} + +function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.elementType = null; + this.type = null; + this.stateNode = null; + + // Fiber + this.return = null; + this.child = null; + this.sibling = null; + this.index = 0; + + this.ref = null; + + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + this.dependencies = null; + + this.mode = mode; + + // Effects + this.effectTag = NoEffect; + this.nextEffect = null; + + this.firstEffect = null; + this.lastEffect = null; + + this.expirationTime = NoWork; + this.childExpirationTime = NoWork; + + this.alternate = null; + + if (enableProfilerTimer) { + // Note: The following is done to avoid a v8 performance cliff. + // + // Initializing the fields below to smis and later updating them with + // double values will cause Fibers to end up having separate shapes. + // This behavior/bug has something to do with Object.preventExtension(). + // Fortunately this only impacts DEV builds. + // Unfortunately it makes React unusably slow for some applications. + // To work around this, initialize the fields below with doubles. + // + // Learn more about this here: + // https://github.com/facebook/react/issues/14365 + // https://bugs.chromium.org/p/v8/issues/detail?id=8538 + this.actualDuration = Number.NaN; + this.actualStartTime = Number.NaN; + this.selfBaseDuration = Number.NaN; + this.treeBaseDuration = Number.NaN; + + // It's okay to replace the initial doubles with smis after initialization. + // This won't trigger the performance cliff mentioned above, + // and it simplifies other profiler code (including DevTools). + this.actualDuration = 0; + this.actualStartTime = -1; + this.selfBaseDuration = 0; + this.treeBaseDuration = 0; + } + + { + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugIsCurrentlyTiming = false; + this._debugNeedsRemount = false; + this._debugHookTypes = null; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { + Object.preventExtensions(this); + } + } +} + +// This is a constructor function, rather than a POJO constructor, still +// please ensure we do the following: +// 1) Nobody should add any instance methods on this. Instance methods can be +// more difficult to predict when they get optimized and they are almost +// never inlined properly in static compilers. +// 2) Nobody should rely on `instanceof Fiber` for type testing. We should +// always know when it is a fiber. +// 3) We might want to experiment with using numeric keys since they are easier +// to optimize in a non-JIT environment. +// 4) We can easily go from a constructor to a createFiber object literal if that +// is faster. +// 5) It should be easy to port this to a C struct and keep a C implementation +// compatible. +var createFiber = function(tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); +}; + +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} + +function isSimpleFunctionComponent(type) { + return ( + typeof type === "function" && + !shouldConstruct(type) && + type.defaultProps === undefined + ); +} + +function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + return IndeterminateComponent; +} + +// This is used to create an alternate fiber to do work on. +function createWorkInProgress(current, pendingProps, expirationTime) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + ); + workInProgress.elementType = current.elementType; + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; + + { + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; + workInProgress._debugHookTypes = current._debugHookTypes; + } + + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; + + // We already have an alternate. + // Reset the effect tag. + workInProgress.effectTag = NoEffect; + + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + + if (enableProfilerTimer) { + // We intentionally reset, rather than copy, actualDuration & actualStartTime. + // This prevents time from endlessly accumulating in new commits. + // This has the downside of resetting values for different priority renders, + // But works for yielding (the common case) and should support resuming. + workInProgress.actualDuration = 0; + workInProgress.actualStartTime = -1; + } + } + + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; + + // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + + if (enableProfilerTimer) { + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } + + { + workInProgress._debugNeedsRemount = current._debugNeedsRemount; + switch (workInProgress.tag) { + case IndeterminateComponent: + case FunctionComponent: + case SimpleMemoComponent: + workInProgress.type = resolveFunctionForHotReloading(current.type); + break; + case ClassComponent: + workInProgress.type = resolveClassForHotReloading(current.type); + break; + case ForwardRef: + workInProgress.type = resolveForwardRefForHotReloading(current.type); + break; + default: + break; + } + } + + return workInProgress; +} + +// Used to reuse a Fiber for a second pass. +function resetWorkInProgress(workInProgress, renderExpirationTime) { + // This resets the Fiber to what createFiber or createWorkInProgress would + // have set the values to before during the first pass. Ideally this wouldn't + // be necessary but unfortunately many code paths reads from the workInProgress + // when they should be reading from current and writing to workInProgress. + + // We assume pendingProps, index, key, ref, return are still untouched to + // avoid doing another reconciliation. + + // Reset the effect tag but keep any Placement tags, since that's something + // that child fiber is setting, not the reconciliation. + workInProgress.effectTag &= Placement; + + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + + var current = workInProgress.alternate; + if (current === null) { + // Reset to createFiber's initial values. + workInProgress.childExpirationTime = NoWork; + workInProgress.expirationTime = renderExpirationTime; + + workInProgress.child = null; + workInProgress.memoizedProps = null; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; + + workInProgress.dependencies = null; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = 0; + workInProgress.treeBaseDuration = 0; + } + } else { + // Reset to the cloned values that createWorkInProgress would've. + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } + } + + return workInProgress; +} + +function createHostRootFiber(tag) { + var mode = void 0; + if (tag === ConcurrentRoot) { + mode = ConcurrentMode | BatchedMode | StrictMode; + } else if (tag === BatchedRoot) { + mode = BatchedMode | StrictMode; + } else { + mode = NoMode; + } + + if (enableProfilerTimer && isDevToolsPresent) { + // Always collect profile timings when DevTools are present. + // This enables DevTools to start capturing timing at any point– + // Without some nodes in the tree having empty base times. + mode |= ProfileMode; + } + + return createFiber(HostRoot, null, null, mode); +} + +function createFiberFromTypeAndProps( + type, // React$ElementType + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiber = void 0; + + var fiberTag = IndeterminateComponent; + // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var resolvedType = type; + if (typeof type === "function") { + if (shouldConstruct(type)) { + fiberTag = ClassComponent; + { + resolvedType = resolveClassForHotReloading(resolvedType); + } + } else { + { + resolvedType = resolveFunctionForHotReloading(resolvedType); + } + } + } else if (typeof type === "string") { + fiberTag = HostComponent; + } else { + getTag: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = Mode; + mode |= ConcurrentMode | BatchedMode | StrictMode; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; + break; + case REACT_PROFILER_TYPE: + return createFiberFromProfiler(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_TYPE: + return createFiberFromSuspense(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_LIST_TYPE: + return createFiberFromSuspenseList( + pendingProps, + mode, + expirationTime, + key + ); + default: { + if (typeof type === "object" && type !== null) { + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break getTag; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break getTag; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + { + resolvedType = resolveForwardRefForHotReloading(resolvedType); + } + break getTag; + case REACT_MEMO_TYPE: + fiberTag = MemoComponent; + break getTag; + case REACT_LAZY_TYPE: + fiberTag = LazyComponent; + resolvedType = null; + break getTag; + case REACT_FUNDAMENTAL_TYPE: + if (enableFundamentalAPI) { + return createFiberFromFundamental( + type, + pendingProps, + mode, + expirationTime, + key + ); + } + break; + } + } + var info = ""; + { + if ( + type === undefined || + (typeof type === "object" && + type !== null && + Object.keys(type).length === 0) + ) { + info += + " You likely forgot to export your component from the file " + + "it's defined in, or you might have mixed up default and " + + "named imports."; + } + var ownerName = owner ? getComponentName(owner.type) : null; + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + } + (function() { + { + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (type == null ? type : typeof type) + + "." + + info + ) + ); + } + })(); + } + } + } + + fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.elementType = type; + fiber.type = resolvedType; + fiber.expirationTime = expirationTime; + + return fiber; +} + +function createFiberFromElement(element, mode, expirationTime) { + var owner = null; + { + owner = element._owner; + } + var type = element.type; + var key = element.key; + var pendingProps = element.props; + var fiber = createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime + ); + { + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; + } + return fiber; +} + +function createFiberFromFragment(elements, mode, expirationTime, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromFundamental( + fundamentalComponent, + pendingProps, + mode, + expirationTime, + key +) { + var fiber = createFiber(FundamentalComponent, pendingProps, key, mode); + fiber.elementType = fundamentalComponent; + fiber.type = fundamentalComponent; + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { + { + if ( + typeof pendingProps.id !== "string" || + typeof pendingProps.onRender !== "function" + ) { + warningWithoutStack$1( + false, + 'Profiler must specify an "id" string and "onRender" function as props' + ); + } + } + + var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); + // TODO: The Profiler fiber shouldn't have a type. It has a tag. + fiber.elementType = REACT_PROFILER_TYPE; + fiber.type = REACT_PROFILER_TYPE; + fiber.expirationTime = expirationTime; + + return fiber; +} + +function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); + + // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_TYPE; + fiber.elementType = REACT_SUSPENSE_TYPE; + + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); + { + // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_LIST_TYPE; + } + fiber.elementType = REACT_SUSPENSE_LIST_TYPE; + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromText(content, mode, expirationTime) { + var fiber = createFiber(HostText, content, null, mode); + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoMode); + // TODO: These should not need a type. + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + return fiber; +} + +function createFiberFromPortal(portal, mode, expirationTime) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.expirationTime = expirationTime; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, // Used by persistent updates + implementation: portal.implementation + }; + return fiber; +} + +// Used for stashing WIP properties to replay failed work in DEV. +function assignFiberPropertiesInDEV(target, source) { + if (target === null) { + // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoMode); + } + + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. + + target.tag = source.tag; + target.key = source.key; + target.elementType = source.elementType; + target.type = source.type; + target.stateNode = source.stateNode; + target.return = source.return; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.dependencies = source.dependencies; + target.mode = source.mode; + target.effectTag = source.effectTag; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.expirationTime = source.expirationTime; + target.childExpirationTime = source.childExpirationTime; + target.alternate = source.alternate; + if (enableProfilerTimer) { + target.actualDuration = source.actualDuration; + target.actualStartTime = source.actualStartTime; + target.selfBaseDuration = source.selfBaseDuration; + target.treeBaseDuration = source.treeBaseDuration; + } + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; + target._debugNeedsRemount = source._debugNeedsRemount; + target._debugHookTypes = source._debugHookTypes; + return target; +} + +// TODO: This should be lifted into the renderer. + +// The following attributes are only used by interaction tracing builds. +// They enable interactions to be associated with their async work, +// And expose interaction metadata to the React DevTools Profiler plugin. +// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. + +// Exported FiberRoot type includes all properties, +// To avoid requiring potentially error-prone :any casts throughout the project. +// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). +// The types are defined separately within this file to ensure they stay in sync. +// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) + +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pendingChildren = null; + this.pingCache = null; + this.finishedExpirationTime = NoWork; + this.finishedWork = null; + this.timeoutHandle = noTimeout; + this.context = null; + this.pendingContext = null; + this.hydrate = hydrate; + this.firstBatch = null; + this.callbackNode = null; + this.callbackExpirationTime = NoWork; + this.firstPendingTime = NoWork; + this.lastPendingTime = NoWork; + this.pingTime = NoWork; + + if (enableSchedulerTracing) { + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); + } +} + +function createFiberRoot(containerInfo, tag, hydrate) { + var root = new FiberRootNode(containerInfo, tag, hydrate); + + // Cyclic construction. This cheats the type system right now because + // stateNode is any. + var uninitializedFiber = createHostRootFiber(tag); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + + return root; +} + +// This lets us hook into Fiber to debug what it's doing. +// See https://github.com/facebook/react/pull/8033. +// This is not part of the public API, not even for React DevTools. +// You may only inject a debugTool if you work on React Fiber itself. +var ReactFiberInstrumentation = { + debugTool: null +}; + +var ReactFiberInstrumentation_1 = ReactFiberInstrumentation; + +// 0 is PROD, 1 is DEV. +// Might add PROFILE later. + +var didWarnAboutNestedUpdates = void 0; +var didWarnAboutFindNodeInStrictMode = void 0; + +{ + didWarnAboutNestedUpdates = false; + didWarnAboutFindNodeInStrictMode = {}; +} + +function getContextForSubtree(parentComponent) { + if (!parentComponent) { + return emptyContextObject; + } + + var fiber = get(parentComponent); + var parentContext = findCurrentUnmaskedContext(fiber); + + if (fiber.tag === ClassComponent) { + var Component = fiber.type; + if (isContextProvider(Component)) { + return processChildContext(fiber, Component, parentContext); + } + } + + return parentContext; +} + +function scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback +) { + { + if (phase === "render" && current !== null && !didWarnAboutNestedUpdates) { + didWarnAboutNestedUpdates = true; + warningWithoutStack$1( + false, + "Render methods should be a pure function of props and state; " + + "triggering nested component updates from render is not allowed. " + + "If necessary, trigger nested updates in componentDidUpdate.\n\n" + + "Check the render method of %s.", + getComponentName(current.type) || "Unknown" + ); + } + } + + var update = createUpdate(expirationTime, suspenseConfig); + // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { element: element }; + + callback = callback === undefined ? null : callback; + if (callback !== null) { + !(typeof callback === "function") + ? warningWithoutStack$1( + false, + "render(...): Expected the last optional `callback` argument to be a " + + "function. Instead received: %s.", + callback + ) + : void 0; + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(current$$1, update); + scheduleWork(current$$1, expirationTime); + + return expirationTime; +} + +function updateContainerAtExpirationTime( + element, + container, + parentComponent, + expirationTime, + suspenseConfig, + callback +) { + // TODO: If this is a nested container, this won't be the root. + var current$$1 = container.current; + + { + if (ReactFiberInstrumentation_1.debugTool) { + if (current$$1.alternate === null) { + ReactFiberInstrumentation_1.debugTool.onMountContainer(container); + } else if (element === null) { + ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container); + } else { + ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container); + } + } + } + + var context = getContextForSubtree(parentComponent); + if (container.context === null) { + container.context = context; + } else { + container.pendingContext = context; + } + + return scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback + ); +} + +function findHostInstance(component) { + var fiber = get(component); + if (fiber === undefined) { + if (typeof component.render === "function") { + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } else { + (function() { + { + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + })(); + } + } + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + return hostFiber.stateNode; +} + +function findHostInstanceWithWarning(component, methodName) { + { + var fiber = get(component); + if (fiber === undefined) { + if (typeof component.render === "function") { + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } else { + (function() { + { + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + })(); + } + } + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + if (hostFiber.mode & StrictMode) { + var componentName = getComponentName(fiber.type) || "Component"; + if (!didWarnAboutFindNodeInStrictMode[componentName]) { + didWarnAboutFindNodeInStrictMode[componentName] = true; + if (fiber.mode & StrictMode) { + warningWithoutStack$1( + false, + "%s is deprecated in StrictMode. " + + "%s was passed an instance of %s which is inside StrictMode. " + + "Instead, add a ref directly to the element you want to reference." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-find-node", + methodName, + methodName, + componentName, + getStackByFiberInDevAndProd(hostFiber) + ); + } else { + warningWithoutStack$1( + false, + "%s is deprecated in StrictMode. " + + "%s was passed an instance of %s which renders StrictMode children. " + + "Instead, add a ref directly to the element you want to reference." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-find-node", + methodName, + methodName, + componentName, + getStackByFiberInDevAndProd(hostFiber) + ); + } + } + } + return hostFiber.stateNode; + } + return findHostInstance(component); +} + +function createContainer(containerInfo, tag, hydrate) { + return createFiberRoot(containerInfo, tag, hydrate); +} + +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current; + var currentTime = requestCurrentTime(); + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfUnmockedScheduler(current$$1); + warnIfNotScopedWithMatchingAct(current$$1); + } + } + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + return updateContainerAtExpirationTime( + element, + container, + parentComponent, + expirationTime, + suspenseConfig, + callback + ); +} + +function getPublicRootInstance(container) { + var containerFiber = container.current; + if (!containerFiber.child) { + return null; + } + switch (containerFiber.child.tag) { + case HostComponent: + return getPublicInstance(containerFiber.child.stateNode); + default: + return containerFiber.child.stateNode; + } +} + +var shouldSuspendImpl = function(fiber) { + return false; +}; + +function shouldSuspend(fiber) { + return shouldSuspendImpl(fiber); +} + +var overrideHookState = null; +var overrideProps = null; +var scheduleUpdate = null; +var setSuspenseHandler = null; + +{ + var copyWithSetImpl = function(obj, path, idx, value) { + if (idx >= path.length) { + return value; + } + var key = path[idx]; + var updated = Array.isArray(obj) ? obj.slice() : Object.assign({}, obj); + // $FlowFixMe number or string is fine here + updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value); + return updated; + }; + + var copyWithSet = function(obj, path, value) { + return copyWithSetImpl(obj, path, 0, value); + }; + + // Support DevTools editable values for useState and useReducer. + overrideHookState = function(fiber, id, path, value) { + // For now, the "id" of stateful hooks is just the stateful hook index. + // This may change in the future with e.g. nested hooks. + var currentHook = fiber.memoizedState; + while (currentHook !== null && id > 0) { + currentHook = currentHook.next; + id--; + } + if (currentHook !== null) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + + var newState = copyWithSet(currentHook.memoizedState, path, value); + currentHook.memoizedState = newState; + currentHook.baseState = newState; + + // We aren't actually adding an update to the queue, + // because there is no update we can add for useReducer hooks that won't trigger an error. + // (There's no appropriate action type for DevTools overrides.) + // As a result though, React will see the scheduled update as a noop and bailout. + // Shallow cloning props works as a workaround for now to bypass the bailout check. + fiber.memoizedProps = Object.assign({}, fiber.memoizedProps); + + scheduleWork(fiber, Sync); + } + }; + + // Support DevTools props for function components, forwardRef, memo, host components, etc. + overrideProps = function(fiber, path, value) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); + if (fiber.alternate) { + fiber.alternate.pendingProps = fiber.pendingProps; + } + scheduleWork(fiber, Sync); + }; + + scheduleUpdate = function(fiber) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + scheduleWork(fiber, Sync); + }; + + setSuspenseHandler = function(newShouldSuspendImpl) { + shouldSuspendImpl = newShouldSuspendImpl; + }; +} + +function injectIntoDevTools(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; + + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: overrideHookState, + overrideProps: overrideProps, + setSuspenseHandler: setSuspenseHandler, + scheduleUpdate: scheduleUpdate, + currentDispatcherRef: ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + return hostFiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + if (!findFiberByHostInstance) { + // Might not be implemented by the renderer. + return null; + } + return findFiberByHostInstance(instance); + }, + + // React Refresh + findHostInstancesForRefresh: findHostInstancesForRefresh, + scheduleRefresh: scheduleRefresh, + scheduleRoot: scheduleRoot, + setRefreshHandler: setRefreshHandler, + // Enables DevTools to append owner stacks to error messages in DEV mode. + getCurrentFiber: function() { + return current; + } + }) + ); +} + +// This file intentionally does *not* have the Flow annotation. +// Don't add it. See `./inline-typed.js` for an explanation. + +function createPortal( + children, + containerInfo, + // TODO: figure out the API for cross-renderer implementation. + implementation +) { + var key = + arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + + return { + // This tag allow us to uniquely identify this as a React Portal + $$typeof: REACT_PORTAL_TYPE, + key: key == null ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} + +// TODO: this is special because it gets imported during build. + +var ReactVersion = "16.8.6"; + +// Modules provided by RN: +var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { + /** + * `NativeMethodsMixin` provides methods to access the underlying native + * component directly. This can be useful in cases when you want to focus + * a view or measure its on-screen dimensions, for example. + * + * The methods described here are available on most of the default components + * provided by React Native. Note, however, that they are *not* available on + * composite components that aren't directly backed by a native view. This will + * generally include most components that you define in your own app. For more + * information, see [Direct + * Manipulation](docs/direct-manipulation.html). + * + * Note the Flow $Exact<> syntax is required to support mixins. + * React createClass mixins can only be used with exact types. + */ + var NativeMethodsMixin = { + /** + * Determines the location on screen, width, and height of the given view and + * returns the values via an async callback. If successful, the callback will + * be called with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * Note that these measurements are not available until after the rendering + * has been completed in native. If you need the measurements as soon as + * possible, consider using the [`onLayout` + * prop](docs/view.html#onlayout) instead. + */ + measure: function(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }, + + /** + * Determines the location of the given view in the window and returns the + * values via an async callback. If the React root view is embedded in + * another native view, this will give you the absolute coordinates. If + * successful, the callback will be called with the following + * arguments: + * + * - x + * - y + * - width + * - height + * + * Note that these measurements are not available until after the rendering + * has been completed in native. + */ + measureInWindow: function(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }, + + /** + * Like [`measure()`](#measure), but measures the view relative an ancestor, + * specified as `relativeToNativeNode`. This means that the returned x, y + * are relative to the origin x, y of the ancestor view. + * + * As always, to obtain a native node handle for a component, you can use + * `findNodeHandle(component)`. + */ + measureLayout: function( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: measureLayout on components using NativeMethodsMixin " + + "or ReactNative.NativeComponent is not currently supported in Fabric. " + + "measureLayout must be called on a native ref. Consider using forwardRef." + ); + return; + } else { + var relativeNode = void 0; + + if (typeof relativeToNativeNode === "number") { + // Already a node handle + relativeNode = relativeToNativeNode; + } else if (relativeToNativeNode._nativeTag) { + relativeNode = relativeToNativeNode._nativeTag; + } + + if (relativeNode == null) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a node handle or a ref to a native component." + ); + + return; + } + + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + } + }, + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](docs/direct-manipulation.html)). + */ + setNativeProps: function(nativeProps) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than findNodeHandle() because + // We want the instance/wrapper (not the native tag). + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + return; + } + + { + if (warnAboutDeprecatedSetNativeProps) { + warningWithoutStack$1( + false, + "Warning: Calling ref.setNativeProps(nativeProps) " + + "is deprecated and will be removed in a future release. " + + "Use the setNativeProps export from the react-native package instead." + + "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" + ); + } + } + + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + var viewConfig = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + + { + warnForStyleProps(nativeProps, viewConfig.validAttributes); + } + + var updatePayload = create(nativeProps, viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } + }, + + /** + * Requests focus for the given input or view. The exact behavior triggered + * will depend on the platform and type of view. + */ + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + + /** + * Removes focus from an input or view. This is the opposite of `focus()`. + */ + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + + { + // hide this from Flow since we can't define these properties outside of + // true without actually implementing them (setting them to undefined + // isn't allowed by ReactClass) + var NativeMethodsMixin_DEV = NativeMethodsMixin; + (function() { + if ( + !( + !NativeMethodsMixin_DEV.componentWillMount && + !NativeMethodsMixin_DEV.componentWillReceiveProps && + !NativeMethodsMixin_DEV.UNSAFE_componentWillMount && + !NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps + ) + ) { + throw ReactError(Error("Do not override existing functions.")); + } + })(); + // TODO (bvaughn) Remove cWM and cWRP in a future version of React Native, + // Once these lifecycles have been remove from the reconciler. + NativeMethodsMixin_DEV.componentWillMount = function() { + throwOnStylesProp(this, this.props); + }; + NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) { + throwOnStylesProp(this, newProps); + }; + NativeMethodsMixin_DEV.UNSAFE_componentWillMount = function() { + throwOnStylesProp(this, this.props); + }; + NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps = function( + newProps + ) { + throwOnStylesProp(this, newProps); + }; + + // React may warn about cWM/cWRP/cWU methods being deprecated. + // Add a flag to suppress these warnings for this special case. + // TODO (bvaughn) Remove this flag once the above methods have been removed. + NativeMethodsMixin_DEV.componentWillMount.__suppressDeprecationWarning = true; + NativeMethodsMixin_DEV.componentWillReceiveProps.__suppressDeprecationWarning = true; + } + + return NativeMethodsMixin; +}; + +function _classCallCheck$2(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn$1(self, call) { + if (!self) { + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + } + return call && (typeof call === "object" || typeof call === "function") + ? call + : self; +} + +function _inherits$1(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) + Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass); +} + +// Modules provided by RN: +var ReactNativeComponent$1 = function(findNodeHandle, findHostInstance) { + /** + * Superclass that provides methods to access the underlying native component. + * This can be useful when you want to focus a view or measure its dimensions. + * + * Methods implemented by this class are available on most default components + * provided by React Native. However, they are *not* available on composite + * components that are not directly backed by a native view. For more + * information, see [Direct Manipulation](docs/direct-manipulation.html). + * + * @abstract + */ + var ReactNativeComponent = (function(_React$Component) { + _inherits$1(ReactNativeComponent, _React$Component); + + function ReactNativeComponent() { + _classCallCheck$2(this, ReactNativeComponent); + + return _possibleConstructorReturn$1( + this, + _React$Component.apply(this, arguments) + ); + } + + /** + * Removes focus. This is the opposite of `focus()`. + */ + + /** + * Due to bugs in Flow's handling of React.createClass, some fields already + * declared in the base class need to be redeclared below. + */ + ReactNativeComponent.prototype.blur = function blur() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + + /** + * Requests focus. The exact behavior depends on the platform and view. + */ + + ReactNativeComponent.prototype.focus = function focus() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + + /** + * Measures the on-screen location and dimensions. If successful, the callback + * will be called asynchronously with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * These values are not available until after natives rendering completes. If + * you need the measurements as soon as possible, consider using the + * [`onLayout` prop](docs/view.html#onlayout) instead. + */ + + ReactNativeComponent.prototype.measure = function measure(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }; + + /** + * Measures the on-screen location and dimensions. Even if the React Native + * root view is embedded within another native view, this method will give you + * the absolute coordinates measured from the window. If successful, the + * callback will be called asynchronously with the following arguments: + * + * - x + * - y + * - width + * - height + * + * These values are not available until after natives rendering completes. + */ + + ReactNativeComponent.prototype.measureInWindow = function measureInWindow( + callback + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }; + + /** + * Similar to [`measure()`](#measure), but the resulting location will be + * relative to the supplied ancestor's location. + * + * Obtain a native node handle with `ReactNative.findNodeHandle(component)`. + */ + + ReactNativeComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: measureLayout on components using NativeMethodsMixin " + + "or ReactNative.NativeComponent is not currently supported in Fabric. " + + "measureLayout must be called on a native ref. Consider using forwardRef." + ); + return; + } else { + var relativeNode = void 0; + + if (typeof relativeToNativeNode === "number") { + // Already a node handle + relativeNode = relativeToNativeNode; + } else if (relativeToNativeNode._nativeTag) { + relativeNode = relativeToNativeNode._nativeTag; + } + + if (relativeNode == null) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a node handle or a ref to a native component." + ); + + return; + } + + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + } + }; + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](docs/direct-manipulation.html)). + */ + + ReactNativeComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than ReactNative.findNodeHandle() because + // We want the instance/wrapper (not the native tag). + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + return; + } + + { + if (warnAboutDeprecatedSetNativeProps) { + warningWithoutStack$1( + false, + "Warning: Calling ref.setNativeProps(nativeProps) " + + "is deprecated and will be removed in a future release. " + + "Use the setNativeProps export from the react-native package instead." + + "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" + ); + } + } + + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + var viewConfig = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + + var updatePayload = create(nativeProps, viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } + }; + + return ReactNativeComponent; + })(React.Component); + + // eslint-disable-next-line no-unused-expressions + + return ReactNativeComponent; +}; + +var instanceCache = new Map(); + +function getInstanceFromTag(tag) { + return instanceCache.get(tag) || null; +} + +// Module provided by RN: +var emptyObject$2 = {}; +{ + Object.freeze(emptyObject$2); +} + +var getInspectorDataForViewTag = void 0; + +{ + var traverseOwnerTreeUp = function(hierarchy, instance) { + if (instance) { + hierarchy.unshift(instance); + traverseOwnerTreeUp(hierarchy, instance._debugOwner); + } + }; + + var getOwnerHierarchy = function(instance) { + var hierarchy = []; + traverseOwnerTreeUp(hierarchy, instance); + return hierarchy; + }; + + var lastNonHostInstance = function(hierarchy) { + for (var i = hierarchy.length - 1; i > 1; i--) { + var instance = hierarchy[i]; + + if (instance.tag !== HostComponent) { + return instance; + } + } + return hierarchy[0]; + }; + + var getHostProps = function(fiber) { + var host = findCurrentHostFiber(fiber); + if (host) { + return host.memoizedProps || emptyObject$2; + } + return emptyObject$2; + }; + + var getHostNode = function(fiber, findNodeHandle) { + var hostNode = void 0; + // look for children first for the hostNode + // as composite fibers do not have a hostNode + while (fiber) { + if (fiber.stateNode !== null && fiber.tag === HostComponent) { + hostNode = findNodeHandle(fiber.stateNode); + } + if (hostNode) { + return hostNode; + } + fiber = fiber.child; + } + return null; + }; + + var createHierarchy = function(fiberHierarchy) { + return fiberHierarchy.map(function(fiber) { + return { + name: getComponentName(fiber.type), + getInspectorData: function(findNodeHandle) { + return { + measure: function(callback) { + return ReactNativePrivateInterface.UIManager.measure( + getHostNode(fiber, findNodeHandle), + callback + ); + }, + props: getHostProps(fiber), + source: fiber._debugSource + }; + } + }; + }); + }; + + getInspectorDataForViewTag = function(viewTag) { + var closestInstance = getInstanceFromTag(viewTag); + + // Handle case where user clicks outside of ReactNative + if (!closestInstance) { + return { + hierarchy: [], + props: emptyObject$2, + selection: null, + source: null + }; + } + + var fiber = findCurrentFiberUsingSlowPath(closestInstance); + var fiberHierarchy = getOwnerHierarchy(fiber); + var instance = lastNonHostInstance(fiberHierarchy); + var hierarchy = createHierarchy(fiberHierarchy); + var props = getHostProps(instance); + var source = instance._debugSource; + var selection = fiberHierarchy.indexOf(instance); + + return { + hierarchy: hierarchy, + props: props, + selection: selection, + source: source + }; + }; +} + +var _nativeFabricUIManage = nativeFabricUIManager; +var fabricDispatchCommand = _nativeFabricUIManage.dispatchCommand; + +var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; + +function findNodeHandle(componentOrHandle) { + { + var owner = ReactCurrentOwner.current; + if (owner !== null && owner.stateNode !== null) { + !owner.stateNode._warnedAboutRefsInRender + ? warningWithoutStack$1( + false, + "%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(owner.type) || "A component" + ) + : void 0; + + owner.stateNode._warnedAboutRefsInRender = true; + } + } + if (componentOrHandle == null) { + return null; + } + if (typeof componentOrHandle === "number") { + // Already a node handle + return componentOrHandle; + } + if (componentOrHandle._nativeTag) { + return componentOrHandle._nativeTag; + } + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) { + return componentOrHandle.canonical._nativeTag; + } + var hostInstance = void 0; + { + hostInstance = findHostInstanceWithWarning( + componentOrHandle, + "findNodeHandle" + ); + } + + if (hostInstance == null) { + return hostInstance; + } + // TODO: the code is right but the types here are wrong. + // https://github.com/facebook/react/pull/12863 + if (hostInstance.canonical) { + // Fabric + return hostInstance.canonical._nativeTag; + } + return hostInstance._nativeTag; +} + +setBatchingImplementation( + batchedUpdates$1, + discreteUpdates$1, + flushDiscreteUpdates, + batchedEventUpdates$1 +); + +var roots = new Map(); + +var ReactFabric = { + NativeComponent: ReactNativeComponent$1(findNodeHandle, findHostInstance), + + findNodeHandle: findNodeHandle, + + setNativeProps: function(handle, nativeProps) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + + return; + }, + dispatchCommand: function(handle, command, args) { + var invalid = + handle._nativeTag == null || handle._internalInstanceHandle == null; + + if (invalid) { + !!invalid + ? warningWithoutStack$1( + false, + "dispatchCommand was called with a ref that isn't a " + + "native component. Use React.forwardRef to get access to the underlying native component" + ) + : void 0; + return; + } + + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + + if (!root) { + // TODO (bvaughn): If we decide to keep the wrapper component, + // We could create a wrapper for containerTag as well to reduce special casing. + root = createContainer(containerTag, LegacyRoot, false); + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + + return getPublicRootInstance(root); + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + if (root) { + // TODO: Is it safe to reset this now or should I wait since this unmount could be deferred? + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + } + }, + createPortal: function(children, containerTag) { + var key = + arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + return createPortal(children, containerTag, null, key); + }, + + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + // Used as a mixin in many createClass-based components + NativeMethodsMixin: NativeMethodsMixin(findNodeHandle, findHostInstance) + } +}; + +injectIntoDevTools({ + findFiberByHostInstance: getInstanceFromInstance, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 1, + version: ReactVersion, + rendererPackageName: "react-native-renderer" +}); + +var ReactFabric$2 = Object.freeze({ + default: ReactFabric +}); + +var ReactFabric$3 = (ReactFabric$2 && ReactFabric) || ReactFabric$2; + +// TODO: decide on the top-level export form. +// This is hacky but makes it work with both Rollup and Jest. +var fabric = ReactFabric$3.default || ReactFabric$3; + +module.exports = fabric; + + })(); +} diff --git a/Libraries/Renderer/oss/ReactFabric-dev.js b/Libraries/Renderer/implementations/ReactFabric-dev.js similarity index 75% rename from Libraries/Renderer/oss/ReactFabric-dev.js rename to Libraries/Renderer/implementations/ReactFabric-dev.js index 4121598785f1d0..dfad8aae4a09d3 100644 --- a/Libraries/Renderer/oss/ReactFabric-dev.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.js @@ -16,26 +16,18 @@ if (__DEV__) { (function() { "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"); -var UIManager = require("UIManager"); +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"); var React = require("react"); -var deepDiffer = require("deepDiffer"); -var flattenStyle = require("flattenStyle"); -var deepFreezeAndThrowOnMutationInDev = require("deepFreezeAndThrowOnMutationInDev"); -var TextInputState = require("TextInputState"); -var FabricUIManager = require("FabricUIManager"); -var checkPropTypes = require("prop-types/checkPropTypes"); var Scheduler = require("scheduler"); +var checkPropTypes = require("prop-types/checkPropTypes"); var tracing = require("scheduler/tracing"); -var ExceptionsManager = require("ExceptionsManager"); -// Do not require this module directly! Use a normal error constructor with +// Do not require this module directly! Use normal `invariant` calls with // template literal strings. The messages will be converted to ReactError during // build, and in production they will be minified. -function ReactError(message) { - var error = new Error(message); +function ReactError(error) { error.name = "Invariant Violation"; return error; } @@ -77,9 +69,11 @@ function recomputePluginOrdering() { (function() { if (!(pluginIndex > -1)) { throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); } })(); @@ -89,9 +83,11 @@ function recomputePluginOrdering() { (function() { if (!pluginModule.extractEvents) { throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); } })(); @@ -107,11 +103,13 @@ function recomputePluginOrdering() { ) ) { throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } })(); @@ -131,9 +129,11 @@ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { (function() { if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName + + "`." + ) ); } })(); @@ -174,9 +174,11 @@ function publishRegistrationName(registrationName, pluginModule, eventName) { (function() { if (!!registrationNameModules[registrationName]) { throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); } })(); @@ -237,7 +239,9 @@ function injectEventPluginOrder(injectedEventPluginOrder) { (function() { if (!!eventPluginOrder) { throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); } })(); @@ -270,9 +274,11 @@ function injectEventPluginsByName(injectedNamesToPlugins) { (function() { if (!!namesToPlugins[pluginName]) { throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); } })(); @@ -352,7 +358,9 @@ var invokeGuardedCallbackImpl = function( (function() { if (!(typeof document !== "undefined")) { throw ReactError( - "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + Error( + "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + ) ); } })(); @@ -581,7 +589,9 @@ function clearCaughtError() { (function() { { throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -795,7 +805,7 @@ function executeDirectDispatch(event) { var dispatchInstance = event._dispatchInstances; (function() { if (!!Array.isArray(dispatchListener)) { - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); } })(); event.currentTarget = dispatchListener @@ -833,7 +843,9 @@ function accumulateInto(current, next) { (function() { if (!(next != null)) { throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); } })(); @@ -921,7 +933,9 @@ function runEventsInBatch(events) { (function() { if (!!eventQueue) { throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); } })(); @@ -1022,11 +1036,13 @@ function getListener(inst, registrationName) { (function() { if (!(!listener || typeof listener === "function")) { throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); } })(); @@ -1099,8 +1115,8 @@ var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedSuspenseComponent = 18; -var EventComponent = 19; -var EventTarget = 20; +var SuspenseListComponent = 19; +var FundamentalComponent = 20; function getParent(inst) { do { @@ -1561,7 +1577,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) { return { configurable: true, set: set, - get: get$$1 + get: get }; function set(val) { @@ -1570,7 +1586,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) { return val; } - function get$$1() { + function get() { var action = isFunction ? "accessing the method" : "accessing the property"; var result = isFunction ? "This is a no-op function" @@ -1622,7 +1638,9 @@ function releasePooledEvent(event) { (function() { if (!(event instanceof EventConstructor)) { throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); } })(); @@ -1734,7 +1752,7 @@ function getTouchIdentifier(_ref) { (function() { if (!(identifier != null)) { - throw ReactError("Touch object is missing identifier."); + throw ReactError(Error("Touch object is missing identifier.")); } })(); { @@ -1774,7 +1792,7 @@ function recordTouchMove(touch) { touchRecord.currentTimeStamp = timestampForTouch(touch); touchHistory.mostRecentTimeStamp = timestampForTouch(touch); } else { - console.error( + console.warn( "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -1795,7 +1813,7 @@ function recordTouchEnd(touch) { touchRecord.currentTimeStamp = timestampForTouch(touch); touchHistory.mostRecentTimeStamp = timestampForTouch(touch); } else { - console.error( + console.warn( "Cannot record touch end without a touch start.\n" + "Touch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -1867,7 +1885,9 @@ function accumulate(current, next) { (function() { if (!(next != null)) { throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error( + "accumulate(...): Accumulated items must not be null or undefined." + ) ); } })(); @@ -1913,7 +1933,7 @@ var changeResponder = function(nextResponderInst, blockHostResponder) { } }; -var eventTypes$1 = { +var eventTypes = { /** * On a `touchStart`/`mouseDown`, is it desired that this element become the * responder? @@ -2204,12 +2224,12 @@ function setResponderAndExtractTransfer( nativeEventTarget ) { var shouldSetEventType = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; // TODO: stop one short of the current responder. var bubbleShouldSetFrom = !responderInst @@ -2243,7 +2263,7 @@ function setResponderAndExtractTransfer( } var extracted = void 0; var grantEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget @@ -2254,7 +2274,7 @@ function setResponderAndExtractTransfer( var blockHostResponder = executeDirectDispatch(grantEvent) === true; if (responderInst) { var terminationRequestEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -2271,7 +2291,7 @@ function setResponderAndExtractTransfer( if (shouldSwitch) { var terminateEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -2282,7 +2302,7 @@ function setResponderAndExtractTransfer( changeResponder(wantsResponderInst, blockHostResponder); } else { var rejectEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget @@ -2351,7 +2371,7 @@ var ResponderEventPlugin = { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, /** * We must be resilient to `targetInst` being `null` on `touchMove` or @@ -2401,11 +2421,11 @@ var ResponderEventPlugin = { var isResponderTouchMove = responderInst && isMoveish(topLevelType); var isResponderTouchEnd = responderInst && isEndish(topLevelType); var incrementalTouch = isResponderTouchStart - ? eventTypes$1.responderStart + ? eventTypes.responderStart : isResponderTouchMove - ? eventTypes$1.responderMove + ? eventTypes.responderMove : isResponderTouchEnd - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null; if (incrementalTouch) { @@ -2428,9 +2448,9 @@ var ResponderEventPlugin = { isEndish(topLevelType) && noResponderTouches(nativeEvent); var finalTouch = isResponderTerminate - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : isResponderRelease - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null; if (finalTouch) { var finalEvent = ResponderSyntheticEvent.getPooled( @@ -2462,8 +2482,16 @@ var ResponderEventPlugin = { } }; +// Module provided by RN: +var customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes; +var customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; + var ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + eventTypes: {}, /** * @see {EventPluginHub.extractEvents} @@ -2478,14 +2506,14 @@ var ReactNativeBridgeEventPlugin = { // Probably a node belonging to another renderer's tree. return null; } - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType]; - var directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; + var directDispatchConfig = customDirectEventTypes[topLevelType]; (function() { if (!(bubbleDispatchConfig || directDispatchConfig)) { throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); } })(); @@ -2540,7 +2568,7 @@ function getTagFromInstance(inst) { var tag = inst.stateNode.canonical._nativeTag; (function() { if (!tag) { - throw ReactError("All native instances should have a tag."); + throw ReactError(Error("All native instances should have a tag.")); } })(); return tag; @@ -2555,9 +2583,12 @@ var ReactFabricGlobalResponderHandler = { onChange: function(from, to, blockNativeResponder) { if (to !== null) { var tag = to.stateNode.canonical._nativeTag; - UIManager.setJSResponder(tag, blockNativeResponder); + ReactNativePrivateInterface.UIManager.setJSResponder( + tag, + blockNativeResponder + ); } else { - UIManager.clearJSResponder(); + ReactNativePrivateInterface.UIManager.clearJSResponder(); } } }; @@ -2588,7 +2619,7 @@ ResponderEventPlugin.injection.injectGlobalResponderHandler( * supported we can rename it. */ -function get$1(key) { +function get(key) { return key._reactInternalFiber; } @@ -2607,6 +2638,11 @@ if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) { current: null }; } +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. @@ -2621,6 +2657,8 @@ var REACT_STRICT_MODE_TYPE = hasSymbol var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; +// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") @@ -2629,19 +2667,15 @@ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4; -var REACT_EVENT_COMPONENT_TYPE = hasSymbol - ? Symbol.for("react.event_component") +var REACT_FUNDAMENTAL_TYPE = hasSymbol + ? Symbol.for("react.fundamental") : 0xead5; -var REACT_EVENT_TARGET_TYPE = hasSymbol - ? Symbol.for("react.event_target") - : 0xead6; - -// React event targets -var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol - ? Symbol.for("react.event_target.touch_hit") - : 0xead7; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6; var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; @@ -2667,22 +2701,6 @@ function refineResolvedLazyComponent(lazyComponent) { return lazyComponent._status === Resolved ? lazyComponent._result : null; } -var debugRenderPhaseSideEffects = false; -var debugRenderPhaseSideEffectsForStrictMode = false; -var enableUserTimingAPI = true; -var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; -var warnAboutDeprecatedLifecycles = true; -var enableProfilerTimer = true; -var enableSchedulerTracing = true; -var enableSuspenseServerRenderer = false; - -var disableYielding = false; - -var warnAboutDeprecatedSetNativeProps = false; -var enableEventAPI = false; - -// Only used in www builds. - function getWrappedName(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ""; return ( @@ -2712,8 +2730,6 @@ function getComponentName(type) { return type; } switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -2724,6 +2740,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { @@ -2743,28 +2761,6 @@ function getComponentName(type) { } break; } - case REACT_EVENT_COMPONENT_TYPE: { - if (enableEventAPI) { - var eventComponent = type; - var displayName = eventComponent.displayName; - if (displayName !== undefined) { - return displayName; - } - } - break; - } - case REACT_EVENT_TARGET_TYPE: { - if (enableEventAPI) { - var eventTarget = type; - if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) { - return "TouchHitTarget"; - } - var _displayName = eventTarget.displayName; - if (_displayName !== undefined) { - return _displayName; - } - } - } } } return null; @@ -2795,6 +2791,31 @@ var HostEffectMask = /* */ 1023; var Incomplete = /* */ 1024; var ShouldCapture = /* */ 2048; +var debugRenderPhaseSideEffects = false; +var debugRenderPhaseSideEffectsForStrictMode = false; +var enableUserTimingAPI = true; +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; +var warnAboutDeprecatedLifecycles = true; +var enableProfilerTimer = true; +var enableSchedulerTracing = true; +var enableSuspenseServerRenderer = false; + +var warnAboutDeprecatedSetNativeProps = false; +var enableFlareAPI = false; +var enableFundamentalAPI = false; + +var warnAboutUnmockedScheduler = false; +var revertPassiveEffectsChange = false; +var flushSuspenseFallbacksInTests = true; +var enableUserBlockingEvents = false; +var enableSuspenseCallback = false; +var warnAboutDefaultPropsOnFunctionComponents = false; +var warnAboutStringRefs = false; +var disableLegacyContext = false; +var disableSchedulerTimeoutBasedOnReactExpirationTime = false; + +// Only used in www builds. + var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; var MOUNTING = 1; @@ -2855,7 +2876,7 @@ function isMounted(component) { } } - var fiber = get$1(component); + var fiber = get(component); if (!fiber) { return false; } @@ -2865,7 +2886,7 @@ function isMounted(component) { function assertIsMounted(fiber) { (function() { if (!(isFiberMountedImpl(fiber) === MOUNTED)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } })(); } @@ -2877,7 +2898,9 @@ function findCurrentFiberUsingSlowPath(fiber) { var state = isFiberMountedImpl(fiber); (function() { if (!(state !== UNMOUNTED)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); if (state === MOUNTING) { @@ -2933,7 +2956,9 @@ function findCurrentFiberUsingSlowPath(fiber) { // way this could possibly happen is if this was unmounted, if at all. (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } @@ -2989,7 +3014,9 @@ function findCurrentFiberUsingSlowPath(fiber) { (function() { if (!didFindChild) { throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } })(); @@ -2999,7 +3026,9 @@ function findCurrentFiberUsingSlowPath(fiber) { (function() { if (!(a.alternate === b)) { throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -3008,7 +3037,7 @@ function findCurrentFiberUsingSlowPath(fiber) { // unmounted. (function() { if (!(a.tag === HostRoot)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } })(); if (a.stateNode.current === a) { @@ -3145,7 +3174,7 @@ function defaultDiffer(prevProp, nextProp) { return true; } else { // For objects and arrays, the default diffing algorithm is a deep compare - return deepDiffer(prevProp, nextProp); + return ReactNativePrivateInterface.deepDiffer(prevProp, nextProp); } } @@ -3285,7 +3314,7 @@ function diffNestedProperty( return diffProperties( updatePayload, // $FlowFixMe - We know that this is always an object when the input is. - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), // $FlowFixMe - We know that this isn't an array because of above flow. nextProp, validAttributes @@ -3296,7 +3325,7 @@ function diffNestedProperty( updatePayload, prevProp, // $FlowFixMe - We know that this is always an object when the input is. - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -3574,7 +3603,9 @@ function restoreStateOfTarget(target) { (function() { if (!(typeof restoreImpl === "function")) { throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -3610,2430 +3641,2586 @@ function restoreStateIfNeeded() { // scheduled work and instead do synchronous work. // Defaults -var _batchedUpdatesImpl = function(fn, bookkeeping) { +var batchedUpdatesImpl = function(fn, bookkeeping) { return fn(bookkeeping); }; -var _flushInteractiveUpdatesImpl = function() {}; +var discreteUpdatesImpl = function(fn, a, b, c) { + return fn(a, b, c); +}; +var flushDiscreteUpdatesImpl = function() {}; +var batchedEventUpdatesImpl = batchedUpdatesImpl; + +var isInsideEventHandler = false; + +function finishEventHandler() { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + var controlledComponentsHavePendingUpdates = needsStateRestore(); + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + flushDiscreteUpdatesImpl(); + restoreStateIfNeeded(); + } +} -var isBatching = false; function batchedUpdates(fn, bookkeeping) { - if (isBatching) { + if (isInsideEventHandler) { // If we are currently inside another batch, we need to wait until it // fully completes before restoring state. return fn(bookkeeping); } - isBatching = true; + isInsideEventHandler = true; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - // Here we wait until all updates have propagated, which is important - // when using controlled components within layers: - // https://github.com/facebook/react/issues/1698 - // Then we restore state of any controlled component. - isBatching = false; - var controlledComponentsHavePendingUpdates = needsStateRestore(); - if (controlledComponentsHavePendingUpdates) { - // If a controlled event was fired, we may need to restore the state of - // the DOM node back to the controlled value. This is necessary when React - // bails out of the update without touching the DOM. - _flushInteractiveUpdatesImpl(); - restoreStateIfNeeded(); - } + isInsideEventHandler = false; + finishEventHandler(); } } -function setBatchingImplementation( - batchedUpdatesImpl, - interactiveUpdatesImpl, - flushInteractiveUpdatesImpl -) { - _batchedUpdatesImpl = batchedUpdatesImpl; - _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl; -} - -function dispatchEvent(target, topLevelType, nativeEvent) { - var targetFiber = target; - batchedUpdates(function() { - runExtractedPluginEventsInBatch( - topLevelType, - targetFiber, - nativeEvent, - nativeEvent.target - ); - }); - // React Native doesn't use ReactControlledComponent but if it did, here's - // where it would do it. +function batchedEventUpdates(fn, a, b) { + if (isInsideEventHandler) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(a, b); + } + isInsideEventHandler = true; + try { + return batchedEventUpdatesImpl(fn, a, b); + } finally { + isInsideEventHandler = false; + finishEventHandler(); + } } -// Renderers that don't support mutation -// can re-export everything from this module. - -function shim() { - (function() { - { - throw ReactError( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); +function discreteUpdates(fn, a, b, c) { + var prevIsInsideEventHandler = isInsideEventHandler; + isInsideEventHandler = true; + try { + return discreteUpdatesImpl(fn, a, b, c); + } finally { + isInsideEventHandler = prevIsInsideEventHandler; + if (!isInsideEventHandler) { + finishEventHandler(); + } + } +} + +var lastFlushedEventTimeStamp = 0; +function flushDiscreteUpdatesIfNeeded(timeStamp) { + // event.timeStamp isn't overly reliable due to inconsistencies in + // how different browsers have historically provided the time stamp. + // Some browsers provide high-resolution time stamps for all events, + // some provide low-resolution time stamps for all events. FF < 52 + // even mixes both time stamps together. Some browsers even report + // negative time stamps or time stamps that are 0 (iOS9) in some cases. + // Given we are only comparing two time stamps with equality (!==), + // we are safe from the resolution differences. If the time stamp is 0 + // we bail-out of preventing the flush, which can affect semantics, + // such as if an earlier flush removes or adds event listeners that + // are fired in the subsequent flush. However, this is the same + // behaviour as we had before this change, so the risks are low. + if ( + !isInsideEventHandler && + (!enableFlareAPI || + timeStamp === 0 || + lastFlushedEventTimeStamp !== timeStamp) + ) { + lastFlushedEventTimeStamp = timeStamp; + flushDiscreteUpdatesImpl(); + } } -// Mutation (when unsupported) -var supportsMutation = false; -var appendChild$1 = shim; -var appendChildToContainer = shim; -var commitTextUpdate = shim; -var commitMount = shim; -var commitUpdate = shim; -var insertBefore = shim; -var insertInContainerBefore = shim; -var removeChild = shim; -var removeChildFromContainer = shim; -var resetTextContent = shim; -var hideInstance = shim; -var hideTextInstance = shim; -var unhideInstance = shim; -var unhideTextInstance = shim; - -// Renderers that don't support hydration -// can re-export everything from this module. - -function shim$1() { - (function() { - { - throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); +function setBatchingImplementation( + _batchedUpdatesImpl, + _discreteUpdatesImpl, + _flushDiscreteUpdatesImpl, + _batchedEventUpdatesImpl +) { + batchedUpdatesImpl = _batchedUpdatesImpl; + discreteUpdatesImpl = _discreteUpdatesImpl; + flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; + batchedEventUpdatesImpl = _batchedEventUpdatesImpl; } -// Hydration (when unsupported) - -var supportsHydration = false; -var canHydrateInstance = shim$1; -var canHydrateTextInstance = shim$1; -var canHydrateSuspenseInstance = shim$1; -var isSuspenseInstancePending = shim$1; -var isSuspenseInstanceFallback = shim$1; -var registerSuspenseInstanceRetry = shim$1; -var getNextHydratableSibling = shim$1; -var getFirstHydratableChild = shim$1; -var hydrateInstance = shim$1; -var hydrateTextInstance = shim$1; -var getNextHydratableInstanceAfterSuspenseInstance = shim$1; -var clearSuspenseBoundary = shim$1; -var clearSuspenseBoundaryFromContainer = shim$1; -var didNotMatchHydratedContainerTextInstance = shim$1; -var didNotMatchHydratedTextInstance = shim$1; -var didNotHydrateContainerInstance = shim$1; -var didNotHydrateInstance = shim$1; -var didNotFindHydratableContainerInstance = shim$1; -var didNotFindHydratableContainerTextInstance = shim$1; -var didNotFindHydratableContainerSuspenseInstance = shim$1; -var didNotFindHydratableInstance = shim$1; -var didNotFindHydratableTextInstance = shim$1; -var didNotFindHydratableSuspenseInstance = shim$1; - -function _classCallCheck(instance, Constructor) { +function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Modules provided by RN: -// Counter for uniquely identifying views. -// % 10 === 1 means it is a rootTag. -// % 2 === 0 means it is a Fabric tag. -// This means that they never overlap. -var nextReactTag = 2; +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + } + return call && (typeof call === "object" || typeof call === "function") + ? call + : self; +} -// TODO: Remove this conditional once all changes have propagated. -if (FabricUIManager.registerEventHandler) { - /** - * Register the event emitter with the native bridge - */ - FabricUIManager.registerEventHandler(dispatchEvent); +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) + Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass); } /** - * This is used for refs on host components. + * Class only exists for its Flow type. */ +var ReactNativeComponent = (function(_React$Component) { + _inherits(ReactNativeComponent, _React$Component); -var ReactFabricHostComponent = (function() { - function ReactFabricHostComponent( - tag, - viewConfig, - props, - internalInstanceHandle - ) { - _classCallCheck(this, ReactFabricHostComponent); + function ReactNativeComponent() { + _classCallCheck$1(this, ReactNativeComponent); - this._nativeTag = tag; - this.viewConfig = viewConfig; - this.currentProps = props; - this._internalInstanceHandle = internalInstanceHandle; + return _possibleConstructorReturn( + this, + _React$Component.apply(this, arguments) + ); } - ReactFabricHostComponent.prototype.blur = function blur() { - TextInputState.blurTextInput(this._nativeTag); - }; + ReactNativeComponent.prototype.blur = function blur() {}; - ReactFabricHostComponent.prototype.focus = function focus() { - TextInputState.focusTextInput(this._nativeTag); - }; + ReactNativeComponent.prototype.focus = function focus() {}; - ReactFabricHostComponent.prototype.measure = function measure$$1(callback) { - FabricUIManager.measure( - this._internalInstanceHandle.stateNode.node, - mountSafeCallback_NOT_REALLY_SAFE(this, callback) - ); - }; + ReactNativeComponent.prototype.measure = function measure(callback) {}; - ReactFabricHostComponent.prototype.measureInWindow = function measureInWindow$$1( + ReactNativeComponent.prototype.measureInWindow = function measureInWindow( callback - ) { - FabricUIManager.measureInWindow( - this._internalInstanceHandle.stateNode.node, - mountSafeCallback_NOT_REALLY_SAFE(this, callback) - ); - }; + ) {}; - ReactFabricHostComponent.prototype.measureLayout = function measureLayout$$1( + ReactNativeComponent.prototype.measureLayout = function measureLayout( relativeToNativeNode, onSuccess, - onFail /* currently unused */ - ) { - if ( - typeof relativeToNativeNode === "number" || - !(relativeToNativeNode instanceof ReactFabricHostComponent) - ) { - warningWithoutStack$1( - false, - "Warning: ref.measureLayout must be called with a ref to a native component." - ); + onFail + ) {}; - return; - } + ReactNativeComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) {}; - FabricUIManager.measureLayout( - this._internalInstanceHandle.stateNode.node, - relativeToNativeNode._internalInstanceHandle.stateNode.node, - mountSafeCallback_NOT_REALLY_SAFE(this, onFail), - mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) - ); - }; + return ReactNativeComponent; +})(React.Component); - ReactFabricHostComponent.prototype.setNativeProps = function setNativeProps( - nativeProps - ) { - warningWithoutStack$1( - false, - "Warning: setNativeProps is not currently supported in Fabric" - ); +/** + * This type keeps ReactNativeFiberHostComponent and NativeMethodsMixin in sync. + * It can also provide types for ReactNative applications that use NMM or refs. + */ - return; - }; +/** + * Flat ReactNative renderer bundles are too big for Flow to parse efficiently. + * Provide minimal Flow typing for the high-level RN API and call it a day. + */ - return ReactFabricHostComponent; -})(); +var DiscreteEvent = 0; +var UserBlockingEvent = 1; +var ContinuousEvent = 2; -function appendInitialChild(parentInstance, child) { - FabricUIManager.appendChild(parentInstance.node, child.node); -} +/** + * 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. + */ -function createInstance( - type, - props, - rootContainerInstance, - hostContext, - internalInstanceHandle -) { - var tag = nextReactTag; - nextReactTag += 2; +var warning = warningWithoutStack$1; - var viewConfig = ReactNativeViewConfigRegistry.get(type); +{ + warning = function(condition, format) { + if (condition) { + return; + } + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + // eslint-disable-next-line react-internal/warning-and-invariant-args - { - for (var key in viewConfig.validAttributes) { - if (props.hasOwnProperty(key)) { - deepFreezeAndThrowOnMutationInDev(props[key]); - } + for ( + var _len = arguments.length, + args = Array(_len > 2 ? _len - 2 : 0), + _key = 2; + _key < _len; + _key++ + ) { + args[_key - 2] = arguments[_key]; } - } - var updatePayload = create(props, viewConfig.validAttributes); + warningWithoutStack$1.apply( + undefined, + [false, format + "%s"].concat(args, [stack]) + ); + }; +} - var node = FabricUIManager.createNode( - tag, // reactTag - viewConfig.uiViewClassName, // viewName - rootContainerInstance, // rootTag - updatePayload, // props - internalInstanceHandle // internalInstanceHandle - ); +var warning$1 = warning; - var component = new ReactFabricHostComponent( - tag, - viewConfig, - props, - internalInstanceHandle - ); +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var runWithPriority = Scheduler.unstable_runWithPriority; +var _nativeFabricUIManage$2 = nativeFabricUIManager; +var measureInWindow = _nativeFabricUIManage$2.measureInWindow; + +var activeTimeouts = new Map(); +var rootEventTypesToEventResponderInstances = new Map(); +var ownershipChangeListeners = new Set(); + +var globalOwner = null; + +var currentTimeStamp = 0; +var currentTimers = new Map(); +var currentInstance = null; +var currentEventQueue = null; +var currentEventQueuePriority = ContinuousEvent; +var currentTimerIDCounter = 0; + +var eventResponderContext = { + dispatchEvent: function(eventValue, eventListener, eventPriority) { + validateResponderContext(); + validateEventValue(eventValue); + if (eventPriority < currentEventQueuePriority) { + currentEventQueuePriority = eventPriority; + } + currentEventQueue.push(createEventQueueItem(eventValue, eventListener)); + }, + isTargetWithinNode: function(childTarget, parentTarget) { + validateResponderContext(); + var childFiber = getFiberFromTarget(childTarget); + var parentFiber = getFiberFromTarget(parentTarget); - return { - node: node, - canonical: component - }; -} + var node = childFiber; + while (node !== null) { + if (node === parentFiber) { + return true; + } + node = node.return; + } + return false; + }, + getTargetBoundingRect: function(target, callback) { + measureInWindow(target.node, function(x, y, width, height) { + callback({ + left: x, + right: x + width, + top: y, + bottom: y + height + }); + }); + }, + addRootEventTypes: function(rootEventTypes) { + validateResponderContext(); + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + var eventResponderInstance = currentInstance; + registerRootEventType(rootEventType, eventResponderInstance); + } + }, + removeRootEventTypes: function(rootEventTypes) { + validateResponderContext(); + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; -function createTextInstance( - text, - rootContainerInstance, - hostContext, - internalInstanceHandle -) { - (function() { - if (!hostContext.isInAParentText) { - throw ReactError( - "Text strings must be rendered within a component." + var rootEventResponders = rootEventTypesToEventResponderInstances.get( + rootEventType ); + var rootEventTypesSet = currentInstance.rootEventTypes; + if (rootEventTypesSet !== null) { + rootEventTypesSet.delete(rootEventType); + } + if (rootEventResponders !== undefined) { + rootEventResponders.delete(currentInstance); + } } - })(); - - var tag = nextReactTag; - nextReactTag += 2; + }, + setTimeout: function(func, delay) { + validateResponderContext(); + if (currentTimers === null) { + currentTimers = new Map(); + } + var timeout = currentTimers.get(delay); + + var timerId = currentTimerIDCounter++; + if (timeout === undefined) { + var _timers = new Map(); + var _id = setTimeout(function() { + processTimers(_timers, delay); + }, delay); + timeout = { + id: _id, + timers: _timers + }; + currentTimers.set(delay, timeout); + } + timeout.timers.set(timerId, { + instance: currentInstance, + func: func, + id: timerId, + timeStamp: currentTimeStamp + }); + activeTimeouts.set(timerId, timeout); + return timerId; + }, + clearTimeout: function(timerId) { + validateResponderContext(); + var timeout = activeTimeouts.get(timerId); - var node = FabricUIManager.createNode( - tag, // reactTag - "RCTRawText", // viewName - rootContainerInstance, // rootTag - { text: text }, // props - internalInstanceHandle // instance handle - ); + if (timeout !== undefined) { + var _timers2 = timeout.timers; + _timers2.delete(timerId); + if (_timers2.size === 0) { + clearTimeout(timeout.id); + } + } + }, + getTimeStamp: function() { + validateResponderContext(); + return currentTimeStamp; + } +}; +function createEventQueueItem(value, listener) { return { - node: node + value: value, + listener: listener }; } -function finalizeInitialChildren( - parentInstance, - type, - props, - rootContainerInstance, - hostContext -) { - return false; -} +function validateEventValue(eventValue) { + if (typeof eventValue === "object" && eventValue !== null) { + var target = eventValue.target, + type = eventValue.type, + _timeStamp = eventValue.timeStamp; -function getRootHostContext(rootContainerInstance) { - return { isInAParentText: false }; + if (target == null || type == null || _timeStamp == null) { + throw new Error( + 'context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.' + ); + } + var showWarning = function(name) { + { + warning$1( + false, + "%s is not available on event objects created from event responder modules (React Flare). " + + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', + name, + name + ); + } + }; + eventValue.preventDefault = function() { + { + showWarning("preventDefault()"); + } + }; + eventValue.stopPropagation = function() { + { + showWarning("stopPropagation()"); + } + }; + eventValue.isDefaultPrevented = function() { + { + showWarning("isDefaultPrevented()"); + } + }; + eventValue.isPropagationStopped = function() { + { + showWarning("isPropagationStopped()"); + } + }; + // $FlowFixMe: we don't need value, Flow thinks we do + Object.defineProperty(eventValue, "nativeEvent", { + get: function() { + { + showWarning("nativeEvent"); + } + } + }); + } } -function getChildHostContext(parentHostContext, type, rootContainerInstance) { - var prevIsInAParentText = parentHostContext.isInAParentText; - var isInAParentText = - type === "AndroidTextInput" || // Android - type === "RCTMultilineTextInputView" || // iOS - type === "RCTSinglelineTextInputView" || // iOS - type === "RCTText" || - type === "RCTVirtualText"; - - if (prevIsInAParentText !== isInAParentText) { - return { isInAParentText: isInAParentText }; - } else { - return parentHostContext; +function getFiberFromTarget(target) { + if (target === null) { + return null; } + return target.canonical._internalInstanceHandle || null; } -function getChildHostContextForEventComponent(parentHostContext) { - // TODO: add getChildHostContextForEventComponent implementation - return parentHostContext; +function processTimers(timers, delay) { + var timersArr = Array.from(timers.values()); + currentEventQueuePriority = ContinuousEvent; + try { + for (var i = 0; i < timersArr.length; i++) { + var _timersArr$i = timersArr[i], + _instance = _timersArr$i.instance, + _func = _timersArr$i.func, + _id2 = _timersArr$i.id, + _timeStamp2 = _timersArr$i.timeStamp; + + currentInstance = _instance; + currentEventQueue = []; + currentTimeStamp = _timeStamp2 + delay; + try { + _func(); + } finally { + activeTimeouts.delete(_id2); + } + } + processEventQueue(); + } finally { + currentTimers = null; + currentInstance = null; + currentEventQueue = null; + currentTimeStamp = 0; + } } -function getChildHostContextForEventTarget(parentHostContext, type) { - // TODO: add getChildHostContextForEventTarget implementation - return parentHostContext; +function createFabricResponderEvent(topLevelType, nativeEvent, target) { + return { + nativeEvent: nativeEvent, + responderTarget: target, + target: target, + type: topLevelType + }; } -function getPublicInstance(instance) { - return instance.canonical; +function validateResponderContext() { + (function() { + if (!(currentEventQueue && currentInstance)) { + throw ReactError( + Error( + "An event responder context was used outside of an event cycle. Use context.setTimeout() to use asynchronous responder context outside of event cycle ." + ) + ); + } + })(); } -function prepareForCommit(containerInfo) { - // Noop +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function processEventQueue() { + var eventQueue = currentEventQueue; + if (eventQueue.length === 0) { + return; + } + switch (currentEventQueuePriority) { + case DiscreteEvent: { + flushDiscreteUpdatesIfNeeded(currentTimeStamp); + discreteUpdates(function() { + batchedEventUpdates(processEvents, eventQueue); + }); + break; + } + case UserBlockingEvent: { + if (enableUserBlockingEvents) { + runWithPriority( + UserBlockingPriority, + batchedEventUpdates.bind(null, processEvents, eventQueue) + ); + } else { + batchedEventUpdates(processEvents, eventQueue); + } + break; + } + case ContinuousEvent: { + batchedEventUpdates(processEvents, eventQueue); + break; + } + } } -function prepareUpdate( - instance, - type, - oldProps, - newProps, - rootContainerInstance, - hostContext -) { - var viewConfig = instance.canonical.viewConfig; - var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); - // TODO: If the event handlers have changed, we need to update the current props - // in the commit phase but there is no host config hook to do it yet. - // So instead we hack it by updating it in the render phase. - instance.canonical.currentProps = newProps; - return updatePayload; +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function releaseOwnershipForEventResponderInstance(eventResponderInstance) { + if (globalOwner === eventResponderInstance) { + globalOwner = null; + triggerOwnershipListeners(); + return true; + } + return false; } -function resetAfterCommit(containerInfo) { - // Noop +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function processEvents(eventQueue) { + for (var i = 0, length = eventQueue.length; i < length; i++) { + var _eventQueue$i = eventQueue[i], + _value = _eventQueue$i.value, + _listener = _eventQueue$i.listener; + + var type = typeof _value === "object" && _value !== null ? _value.type : ""; + invokeGuardedCallbackAndCatchFirstError(type, _listener, undefined, _value); + } } -function shouldDeprioritizeSubtree(type, props) { +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function responderEventTypesContainType(eventTypes, type) { + for (var i = 0, len = eventTypes.length; i < len; i++) { + if (eventTypes[i] === type) { + return true; + } + } return false; } -function shouldSetTextContent(type, props) { - // TODO (bvaughn) Revisit this decision. - // Always returning false simplifies the createInstance() implementation, - // But creates an additional child Fiber for raw text children. - // No additional native views are created though. - // It's not clear to me which is better so I'm deferring for now. - // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 +function validateResponderTargetEventTypes(eventType, responder) { + var targetEventTypes = responder.targetEventTypes; + // Validate the target event type exists on the responder + + if (targetEventTypes !== null) { + return responderEventTypesContainType(targetEventTypes, eventType); + } return false; } -// The Fabric renderer is secondary to the existing React Native renderer. -var isPrimaryRenderer = false; +function validateOwnership(responderInstance) { + return globalOwner === null || globalOwner === responderInstance; +} -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; - -// ------------------- -// Persistence -// ------------------- +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function traverseAndHandleEventResponderInstances( + eventType, + targetFiber, + nativeEvent +) { + // Trigger event responders in this order: + // - Bubble target responder phase + // - Root responder phase -var supportsPersistence = true; + var responderEvent = createFabricResponderEvent( + eventType, + nativeEvent, + targetFiber !== null ? targetFiber.stateNode : null + ); + var visitedResponders = new Set(); + var node = targetFiber; + while (node !== null) { + var _node = node, + dependencies = _node.dependencies, + tag = _node.tag; + + if (tag === HostComponent && dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for (var i = 0, length = responderInstances.length; i < length; i++) { + var responderInstance = responderInstances[i]; + + if (validateOwnership(responderInstance)) { + var props = responderInstance.props, + responder = responderInstance.responder, + state = responderInstance.state, + target = responderInstance.target; -function cloneInstance( - instance, - updatePayload, - type, - oldProps, - newProps, - internalInstanceHandle, - keepChildren, - recyclableInstance -) { - var node = instance.node; - var clone = void 0; - if (keepChildren) { - if (updatePayload !== null) { - clone = FabricUIManager.cloneNodeWithNewProps(node, updatePayload); - } else { - clone = FabricUIManager.cloneNode(node); - } - } else { - if (updatePayload !== null) { - clone = FabricUIManager.cloneNodeWithNewChildrenAndProps( - node, - updatePayload - ); - } else { - clone = FabricUIManager.cloneNodeWithNewChildren(node); + if ( + !visitedResponders.has(responder) && + validateResponderTargetEventTypes(eventType, responder) + ) { + var onEvent = responder.onEvent; + visitedResponders.add(responder); + if (onEvent !== null) { + currentInstance = responderInstance; + responderEvent.responderTarget = target; + onEvent(responderEvent, eventResponderContext, props, state); + } + } + } + } + } } + node = node.return; } - return { - node: clone, - canonical: instance.canonical - }; -} - -function cloneHiddenInstance(instance, type, props, internalInstanceHandle) { - var viewConfig = instance.canonical.viewConfig; - var node = instance.node; - var updatePayload = create( - { style: { display: "none" } }, - viewConfig.validAttributes + // Root phase + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + eventType ); - return { - node: FabricUIManager.cloneNodeWithNewProps(node, updatePayload), - canonical: instance.canonical - }; -} - -function cloneHiddenTextInstance(instance, text, internalInstanceHandle) { - throw new Error("Not yet implemented."); -} - -function createContainerChildSet(container) { - return FabricUIManager.createChildSet(container); -} - -function appendChildToContainerChildSet(childSet, child) { - FabricUIManager.appendChildToSet(childSet, child.node); -} - -function finalizeContainerChildren(container, newChildren) { - FabricUIManager.completeRoot(container, newChildren); -} - -function mountEventComponent(eventComponentInstance) { - throw new Error("Not yet implemented."); -} + if (rootEventResponderInstances !== undefined) { + var _responderInstances = Array.from(rootEventResponderInstances); -function updateEventComponent(eventComponentInstance) { - throw new Error("Not yet implemented."); -} - -function unmountEventComponent(eventComponentInstance) { - throw new Error("Not yet implemented."); -} + for (var _i = 0; _i < _responderInstances.length; _i++) { + var _responderInstance = _responderInstances[_i]; + if (!validateOwnership(_responderInstance)) { + continue; + } + var _props = _responderInstance.props, + _responder = _responderInstance.responder, + _state = _responderInstance.state, + _target = _responderInstance.target; -function getEventTargetChildElement(type, props) { - throw new Error("Not yet implemented."); + var onRootEvent = _responder.onRootEvent; + if (onRootEvent !== null) { + currentInstance = _responderInstance; + responderEvent.responderTarget = _target; + onRootEvent(responderEvent, eventResponderContext, _props, _state); + } + } + } } -function handleEventTarget( - type, - props, - rootContainerInstance, - internalInstanceHandle +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function dispatchEventForResponderEventSystem( + topLevelType, + targetFiber, + nativeEvent ) { - throw new Error("Not yet implemented."); -} - -function commitEventTarget(type, props, instance, parentInstance) { - throw new Error("Not yet implemented."); + var previousEventQueue = currentEventQueue; + var previousInstance = currentInstance; + var previousTimers = currentTimers; + var previousTimeStamp = currentTimeStamp; + var previousEventQueuePriority = currentEventQueuePriority; + currentTimers = null; + currentEventQueue = []; + currentEventQueuePriority = ContinuousEvent; + // We might want to control timeStamp another way here + currentTimeStamp = Date.now(); + try { + traverseAndHandleEventResponderInstances( + topLevelType, + targetFiber, + nativeEvent + ); + processEventQueue(); + } finally { + currentTimers = previousTimers; + currentInstance = previousInstance; + currentEventQueue = previousEventQueue; + currentTimeStamp = previousTimeStamp; + currentEventQueuePriority = previousEventQueuePriority; + } } -var BEFORE_SLASH_RE = /^(.*)[\\\/]/; +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function triggerOwnershipListeners() { + var listeningInstances = Array.from(ownershipChangeListeners); + var previousInstance = currentInstance; + var previousEventQueuePriority = currentEventQueuePriority; + var previousEventQueue = currentEventQueue; + try { + for (var i = 0; i < listeningInstances.length; i++) { + var _instance2 = listeningInstances[i]; + var props = _instance2.props, + responder = _instance2.responder, + state = _instance2.state; -var describeComponentFrame = function(name, source, ownerName) { - var sourceInfo = ""; - if (source) { - var path = source.fileName; - var fileName = path.replace(BEFORE_SLASH_RE, ""); - { - // In DEV, include code for a common special case: - // prefer "folder/index.js" instead of just "index.js". - if (/^index\./.test(fileName)) { - var match = path.match(BEFORE_SLASH_RE); - if (match) { - var pathBeforeSlash = match[1]; - if (pathBeforeSlash) { - var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ""); - fileName = folderName + "/" + fileName; - } - } + currentInstance = _instance2; + currentEventQueuePriority = ContinuousEvent; + currentEventQueue = []; + var onOwnershipChange = responder.onOwnershipChange; + if (onOwnershipChange !== null) { + onOwnershipChange(eventResponderContext, props, state); } } - sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")"; - } else if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - return "\n in " + (name || "Unknown") + sourceInfo; -}; - -var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostRoot: - case HostPortal: - case HostText: - case Fragment: - case ContextProvider: - case ContextConsumer: - return ""; - default: - var owner = fiber._debugOwner; - var source = fiber._debugSource; - var name = getComponentName(fiber.type); - var ownerName = null; - if (owner) { - ownerName = getComponentName(owner.type); - } - return describeComponentFrame(name, source, ownerName); + processEventQueue(); + } finally { + currentInstance = previousInstance; + currentEventQueue = previousEventQueue; + currentEventQueuePriority = previousEventQueuePriority; } } -function getStackByFiberInDevAndProd(workInProgress) { - var info = ""; - var node = workInProgress; - do { - info += describeFiber(node); - node = node.return; - } while (node); - return info; +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function mountEventResponder(responder, responderInstance, props, state) { + if (responder.onOwnershipChange !== null) { + ownershipChangeListeners.add(responderInstance); + } + var onMount = responder.onMount; + if (onMount !== null) { + currentEventQueuePriority = ContinuousEvent; + currentInstance = responderInstance; + currentEventQueue = []; + try { + onMount(eventResponderContext, props, state); + processEventQueue(); + } finally { + currentEventQueue = null; + currentInstance = null; + currentTimers = null; + } + } } -var current = null; -var phase = null; +// TODO this function is almost an exact copy of the DOM version, we should +// somehow share the logic +function unmountEventResponder(responderInstance) { + var responder = responderInstance.responder; + var onUnmount = responder.onUnmount; + if (onUnmount !== null) { + var props = responderInstance.props, + state = responderInstance.state; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - var owner = current._debugOwner; - if (owner !== null && typeof owner !== "undefined") { - return getComponentName(owner.type); + currentEventQueue = []; + currentEventQueuePriority = ContinuousEvent; + currentInstance = responderInstance; + try { + onUnmount(eventResponderContext, props, state); + processEventQueue(); + } finally { + currentEventQueue = null; + currentInstance = null; + currentTimers = null; } } - return null; -} + releaseOwnershipForEventResponderInstance(responderInstance); + if (responder.onOwnershipChange !== null) { + ownershipChangeListeners.delete(responderInstance); + } + var rootEventTypesSet = responderInstance.rootEventTypes; + if (rootEventTypesSet !== null) { + var rootEventTypes = Array.from(rootEventTypesSet); -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ""; + for (var i = 0; i < rootEventTypes.length; i++) { + var topLevelEventType = rootEventTypes[i]; + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + topLevelEventType + ); + if (rootEventResponderInstances !== undefined) { + rootEventResponderInstances.delete(responderInstance); + } } - // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - return getStackByFiberInDevAndProd(current); } - return ""; } -function resetCurrentFiber() { - { - ReactDebugCurrentFrame.getCurrentStack = null; - current = null; - phase = null; +function registerRootEventType(rootEventType, responderInstance) { + var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get( + rootEventType + ); + if (rootEventResponderInstances === undefined) { + rootEventResponderInstances = new Set(); + rootEventTypesToEventResponderInstances.set( + rootEventType, + rootEventResponderInstances + ); } + var rootEventTypesSet = responderInstance.rootEventTypes; + if (rootEventTypesSet === null) { + rootEventTypesSet = responderInstance.rootEventTypes = new Set(); + } + (function() { + if (!!rootEventTypesSet.has(rootEventType)) { + throw ReactError( + Error( + 'addRootEventTypes() found a duplicate root event type of "' + + rootEventType + + '". This might be because the event type exists in the event responder "rootEventTypes" array or because of a previous addRootEventTypes() using this root event type.' + ) + ); + } + })(); + rootEventTypesSet.add(rootEventType); + rootEventResponderInstances.add(responderInstance); } -function setCurrentFiber(fiber) { - { - ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; - current = fiber; - phase = null; +function addRootEventTypesForResponderInstance( + responderInstance, + rootEventTypes +) { + for (var i = 0; i < rootEventTypes.length; i++) { + var rootEventType = rootEventTypes[i]; + registerRootEventType(rootEventType, responderInstance); } } -function setCurrentPhase(lifeCyclePhase) { - { - phase = lifeCyclePhase; +function dispatchEvent(target, topLevelType, nativeEvent) { + var targetFiber = target; + if (enableFlareAPI) { + // React Flare event system + dispatchEventForResponderEventSystem(topLevelType, target, nativeEvent); } + batchedUpdates(function() { + // Heritage plugin event system + runExtractedPluginEventsInBatch( + topLevelType, + targetFiber, + nativeEvent, + nativeEvent.target + ); + }); + // React Native doesn't use ReactControlledComponent but if it did, here's + // where it would do it. } -// Prefix measurements so that it's possible to filter them. -// Longer prefixes are hard to read in DevTools. -var reactEmoji = "\u269B"; -var warningEmoji = "\u26D4"; -var supportsUserTiming = - typeof performance !== "undefined" && - typeof performance.mark === "function" && - typeof performance.clearMarks === "function" && - typeof performance.measure === "function" && - typeof performance.clearMeasures === "function"; - -// Keep track of current fiber so that we know the path to unwind on pause. -// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? -var currentFiber = null; -// If we're in the middle of user code, which fiber and method is it? -// Reusing `currentFiber` would be confusing for this because user code fiber -// can change during commit phase too, but we don't need to unwind it (since -// lifecycles in the commit phase don't resemble a tree). -var currentPhase = null; -var currentPhaseFiber = null; -// Did lifecycle hook schedule an update? This is often a performance problem, -// so we will keep track of it, and include it in the report. -// Track commits caused by cascading updates. -var isCommitting = false; -var hasScheduledUpdateInCurrentCommit = false; -var hasScheduledUpdateInCurrentPhase = false; -var commitCountInCurrentWorkLoop = 0; -var effectCountInCurrentCommit = 0; -var isWaitingForCallback = false; -// During commits, we only show a measurement once per method name -// to avoid stretch the commit phase with measurement overhead. -var labelsInCurrentCommit = new Set(); - -var formatMarkName = function(markName) { - return reactEmoji + " " + markName; -}; +// Renderers that don't support mutation +// can re-export everything from this module. -var formatLabel = function(label, warning) { - var prefix = warning ? warningEmoji + " " : reactEmoji + " "; - var suffix = warning ? " Warning: " + warning : ""; - return "" + prefix + label + suffix; -}; +function shim() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} -var beginMark = function(markName) { - performance.mark(formatMarkName(markName)); -}; +// Mutation (when unsupported) +var supportsMutation = false; +var appendChild = shim; +var appendChildToContainer = shim; +var commitTextUpdate = shim; +var commitMount = shim; +var commitUpdate = shim; +var insertBefore = shim; +var insertInContainerBefore = shim; +var removeChild = shim; +var removeChildFromContainer = shim; +var resetTextContent = shim; +var hideInstance = shim; +var hideTextInstance = shim; +var unhideInstance = shim; +var unhideTextInstance = shim; -var clearMark = function(markName) { - performance.clearMarks(formatMarkName(markName)); -}; +// Renderers that don't support hydration +// can re-export everything from this module. -var endMark = function(label, markName, warning) { - var formattedMarkName = formatMarkName(markName); - var formattedLabel = formatLabel(label, warning); - try { - performance.measure(formattedLabel, formattedMarkName); - } catch (err) {} - // If previous mark was missing for some reason, this will throw. - // This could only happen if React crashed in an unexpected place earlier. - // Don't pile on with more errors. +function shim$1() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} - // Clear marks immediately to avoid growing buffer. - performance.clearMarks(formattedMarkName); - performance.clearMeasures(formattedLabel); -}; +// Hydration (when unsupported) -var getFiberMarkName = function(label, debugID) { - return label + " (#" + debugID + ")"; -}; +var supportsHydration = false; +var canHydrateInstance = shim$1; +var canHydrateTextInstance = shim$1; +var canHydrateSuspenseInstance = shim$1; +var isSuspenseInstancePending = shim$1; +var isSuspenseInstanceFallback = shim$1; +var registerSuspenseInstanceRetry = shim$1; +var getNextHydratableSibling = shim$1; +var getFirstHydratableChild = shim$1; +var hydrateInstance = shim$1; +var hydrateTextInstance = shim$1; +var getNextHydratableInstanceAfterSuspenseInstance = shim$1; +var clearSuspenseBoundary = shim$1; +var clearSuspenseBoundaryFromContainer = shim$1; +var didNotMatchHydratedContainerTextInstance = shim$1; +var didNotMatchHydratedTextInstance = shim$1; +var didNotHydrateContainerInstance = shim$1; +var didNotHydrateInstance = shim$1; +var didNotFindHydratableContainerInstance = shim$1; +var didNotFindHydratableContainerTextInstance = shim$1; +var didNotFindHydratableContainerSuspenseInstance = shim$1; +var didNotFindHydratableInstance = shim$1; +var didNotFindHydratableTextInstance = shim$1; +var didNotFindHydratableSuspenseInstance = shim$1; -var getFiberLabel = function(componentName, isMounted, phase) { - if (phase === null) { - // These are composite component total time measurements. - return componentName + " [" + (isMounted ? "update" : "mount") + "]"; - } else { - // Composite component methods. - return componentName + "." + phase; +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } -}; +} -var beginFiberMark = function(fiber, phase) { - var componentName = getComponentName(fiber.type) || "Unknown"; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); +// Modules provided by RN: +var _nativeFabricUIManage$1 = nativeFabricUIManager; +var createNode = _nativeFabricUIManage$1.createNode; +var cloneNode = _nativeFabricUIManage$1.cloneNode; +var cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren; +var cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps; +var cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps; +var createChildNodeSet = _nativeFabricUIManage$1.createChildSet; +var appendChildNode = _nativeFabricUIManage$1.appendChild; +var appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet; +var completeRoot = _nativeFabricUIManage$1.completeRoot; +var registerEventHandler = _nativeFabricUIManage$1.registerEventHandler; +var fabricMeasure = _nativeFabricUIManage$1.measure; +var fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow; +var fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout; +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; - if (isCommitting && labelsInCurrentCommit.has(label)) { - // During the commit phase, we don't show duplicate labels because - // there is a fixed overhead for every measurement, and we don't - // want to stretch the commit phase beyond necessary. - return false; - } - labelsInCurrentCommit.add(label); +// Counter for uniquely identifying views. +// % 10 === 1 means it is a rootTag. +// % 2 === 0 means it is a Fabric tag. +// This means that they never overlap. - var markName = getFiberMarkName(label, debugID); - beginMark(markName); - return true; -}; +var nextReactTag = 2; -var clearFiberMark = function(fiber, phase) { - var componentName = getComponentName(fiber.type) || "Unknown"; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); - var markName = getFiberMarkName(label, debugID); - clearMark(markName); -}; +// TODO: Remove this conditional once all changes have propagated. +if (registerEventHandler) { + /** + * Register the event emitter with the native bridge + */ + registerEventHandler(dispatchEvent); +} -var endFiberMark = function(fiber, phase, warning) { - var componentName = getComponentName(fiber.type) || "Unknown"; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); - var markName = getFiberMarkName(label, debugID); - endMark(label, markName, warning); -}; +/** + * This is used for refs on host components. + */ -var shouldIgnoreFiber = function(fiber) { - // Host components should be skipped in the timeline. - // We could check typeof fiber.type, but does this work with RN? - switch (fiber.tag) { - case HostRoot: - case HostComponent: - case HostText: - case HostPortal: - case Fragment: - case ContextProvider: - case ContextConsumer: - case Mode: - return true; - default: - return false; - } -}; +var ReactFabricHostComponent = (function() { + function ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ) { + _classCallCheck(this, ReactFabricHostComponent); -var clearPendingPhaseMeasurement = function() { - if (currentPhase !== null && currentPhaseFiber !== null) { - clearFiberMark(currentPhaseFiber, currentPhase); + this._nativeTag = tag; + this.viewConfig = viewConfig; + this.currentProps = props; + this._internalInstanceHandle = internalInstanceHandle; } - currentPhaseFiber = null; - currentPhase = null; - hasScheduledUpdateInCurrentPhase = false; -}; -var pauseTimers = function() { - // Stops all currently active measurements so that they can be resumed - // if we continue in a later deferred loop from the same unit of work. - var fiber = currentFiber; - while (fiber) { - if (fiber._debugIsCurrentlyTiming) { - endFiberMark(fiber, null, null); - } - fiber = fiber.return; - } -}; + ReactFabricHostComponent.prototype.blur = function blur() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; -var resumeTimersRecursively = function(fiber) { - if (fiber.return !== null) { - resumeTimersRecursively(fiber.return); - } - if (fiber._debugIsCurrentlyTiming) { - beginFiberMark(fiber, null); - } -}; + ReactFabricHostComponent.prototype.focus = function focus() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; -var resumeTimers = function() { - // Resumes all measurements that were active during the last deferred loop. - if (currentFiber !== null) { - resumeTimersRecursively(currentFiber); - } -}; + ReactFabricHostComponent.prototype.measure = function measure(callback) { + fabricMeasure( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; -function recordEffect() { - if (enableUserTimingAPI) { - effectCountInCurrentCommit++; - } -} + ReactFabricHostComponent.prototype.measureInWindow = function measureInWindow( + callback + ) { + fabricMeasureInWindow( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; -function recordScheduleUpdate() { - if (enableUserTimingAPI) { - if (isCommitting) { - hasScheduledUpdateInCurrentCommit = true; - } + ReactFabricHostComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { if ( - currentPhase !== null && - currentPhase !== "componentWillMount" && - currentPhase !== "componentWillReceiveProps" + typeof relativeToNativeNode === "number" || + !(relativeToNativeNode instanceof ReactFabricHostComponent) ) { - hasScheduledUpdateInCurrentPhase = true; - } - } -} + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a ref to a native component." + ); -function startRequestCallbackTimer() { - if (enableUserTimingAPI) { - if (supportsUserTiming && !isWaitingForCallback) { - isWaitingForCallback = true; - beginMark("(Waiting for async callback...)"); + return; } - } -} -function stopRequestCallbackTimer(didExpire) { - if (enableUserTimingAPI) { - if (supportsUserTiming) { - isWaitingForCallback = false; - var warning = didExpire - ? "Update expired; will flush synchronously" - : null; - endMark( - "(Waiting for async callback...)", - "(Waiting for async callback...)", - warning - ); - } - } -} + fabricMeasureLayout( + this._internalInstanceHandle.stateNode.node, + relativeToNativeNode._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; -function startWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, this is the fiber to unwind from. - currentFiber = fiber; - if (!beginFiberMark(fiber, null)) { - return; - } - fiber._debugIsCurrentlyTiming = true; - } -} + ReactFabricHostComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); -function cancelWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // Remember we shouldn't complete measurement for this fiber. - // Otherwise flamechart will be deep even for small updates. - fiber._debugIsCurrentlyTiming = false; - clearFiberMark(fiber, null); - } -} + return; + }; -function stopWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, its parent is the fiber to unwind from. - currentFiber = fiber.return; - if (!fiber._debugIsCurrentlyTiming) { - return; - } - fiber._debugIsCurrentlyTiming = false; - endFiberMark(fiber, null, null); - } + return ReactFabricHostComponent; +})(); + +function appendInitialChild(parentInstance, child) { + appendChildNode(parentInstance.node, child.node); } -function stopFailedWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, its parent is the fiber to unwind from. - currentFiber = fiber.return; - if (!fiber._debugIsCurrentlyTiming) { - return; +function createInstance( + type, + props, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + var tag = nextReactTag; + nextReactTag += 2; + + var viewConfig = getViewConfigForType(type); + + { + for (var key in viewConfig.validAttributes) { + if (props.hasOwnProperty(key)) { + ReactNativePrivateInterface.deepFreezeAndThrowOnMutationInDev( + props[key] + ); + } } - fiber._debugIsCurrentlyTiming = false; - var warning = - fiber.tag === SuspenseComponent || - fiber.tag === DehydratedSuspenseComponent - ? "Rendering was suspended" - : "An error was thrown inside this error boundary"; - endFiberMark(fiber, null, warning); } + + var updatePayload = create(props, viewConfig.validAttributes); + + var node = createNode( + tag, // reactTag + viewConfig.uiViewClassName, // viewName + rootContainerInstance, // rootTag + updatePayload, // props + internalInstanceHandle // internalInstanceHandle + ); + + var component = new ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ); + + return { + node: node, + canonical: component + }; } -function startPhaseTimer(fiber, phase) { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - clearPendingPhaseMeasurement(); - if (!beginFiberMark(fiber, phase)) { - return; +function createTextInstance( + text, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + (function() { + if (!hostContext.isInAParentText) { + throw ReactError( + Error("Text strings must be rendered within a component.") + ); } - currentPhaseFiber = fiber; - currentPhase = phase; - } + })(); + + var tag = nextReactTag; + nextReactTag += 2; + + var node = createNode( + tag, // reactTag + "RCTRawText", // viewName + rootContainerInstance, // rootTag + { text: text }, // props + internalInstanceHandle // instance handle + ); + + return { + node: node + }; } -function stopPhaseTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - if (currentPhase !== null && currentPhaseFiber !== null) { - var warning = hasScheduledUpdateInCurrentPhase - ? "Scheduled a cascading update" - : null; - endFiberMark(currentPhaseFiber, currentPhase, warning); - } - currentPhase = null; - currentPhaseFiber = null; - } +function finalizeInitialChildren( + parentInstance, + type, + props, + rootContainerInstance, + hostContext +) { + return false; } -function startWorkLoopTimer(nextUnitOfWork) { - if (enableUserTimingAPI) { - currentFiber = nextUnitOfWork; - if (!supportsUserTiming) { - return; - } - commitCountInCurrentWorkLoop = 0; - // This is top level call. - // Any other measurements are performed within. - beginMark("(React Tree Reconciliation)"); - // Resume any measurements that were in progress during the last loop. - resumeTimers(); - } +function getRootHostContext(rootContainerInstance) { + return { isInAParentText: false }; } -function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var warning = null; - if (interruptedBy !== null) { - if (interruptedBy.tag === HostRoot) { - warning = "A top-level update interrupted the previous render"; - } else { - var componentName = getComponentName(interruptedBy.type) || "Unknown"; - warning = - "An update to " + componentName + " interrupted the previous render"; - } - } else if (commitCountInCurrentWorkLoop > 1) { - warning = "There were cascading updates"; - } - commitCountInCurrentWorkLoop = 0; - var label = didCompleteRoot - ? "(React Tree Reconciliation: Completed Root)" - : "(React Tree Reconciliation: Yielded)"; - // Pause any measurements until the next loop. - pauseTimers(); - endMark(label, "(React Tree Reconciliation)", warning); +function getChildHostContext(parentHostContext, type, rootContainerInstance) { + var prevIsInAParentText = parentHostContext.isInAParentText; + var isInAParentText = + type === "AndroidTextInput" || // Android + type === "RCTMultilineTextInputView" || // iOS + type === "RCTSinglelineTextInputView" || // iOS + type === "RCTText" || + type === "RCTVirtualText"; + + if (prevIsInAParentText !== isInAParentText) { + return { isInAParentText: isInAParentText }; + } else { + return parentHostContext; } } -function startCommitTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - isCommitting = true; - hasScheduledUpdateInCurrentCommit = false; - labelsInCurrentCommit.clear(); - beginMark("(Committing Changes)"); - } +function getPublicInstance(instance) { + return instance.canonical; } -function stopCommitTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } +function prepareForCommit(containerInfo) { + // Noop +} - var warning = null; - if (hasScheduledUpdateInCurrentCommit) { - warning = "Lifecycle hook scheduled a cascading update"; - } else if (commitCountInCurrentWorkLoop > 0) { - warning = "Caused by a cascading update in earlier commit"; - } - hasScheduledUpdateInCurrentCommit = false; - commitCountInCurrentWorkLoop++; - isCommitting = false; - labelsInCurrentCommit.clear(); - - endMark("(Committing Changes)", "(Committing Changes)", warning); - } -} - -function startCommitSnapshotEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - effectCountInCurrentCommit = 0; - beginMark("(Committing Snapshot Effects)"); - } -} - -function stopCommitSnapshotEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark( - "(Committing Snapshot Effects: " + count + " Total)", - "(Committing Snapshot Effects)", - null - ); - } -} - -function startCommitHostEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - effectCountInCurrentCommit = 0; - beginMark("(Committing Host Effects)"); - } +function prepareUpdate( + instance, + type, + oldProps, + newProps, + rootContainerInstance, + hostContext +) { + var viewConfig = instance.canonical.viewConfig; + var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); + // TODO: If the event handlers have changed, we need to update the current props + // in the commit phase but there is no host config hook to do it yet. + // So instead we hack it by updating it in the render phase. + instance.canonical.currentProps = newProps; + return updatePayload; } -function stopCommitHostEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark( - "(Committing Host Effects: " + count + " Total)", - "(Committing Host Effects)", - null - ); - } +function resetAfterCommit(containerInfo) { + // Noop } -function startCommitLifeCyclesTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - effectCountInCurrentCommit = 0; - beginMark("(Calling Lifecycle Methods)"); - } +function shouldDeprioritizeSubtree(type, props) { + return false; } -function stopCommitLifeCyclesTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark( - "(Calling Lifecycle Methods: " + count + " Total)", - "(Calling Lifecycle Methods)", - null - ); - } +function shouldSetTextContent(type, props) { + // TODO (bvaughn) Revisit this decision. + // Always returning false simplifies the createInstance() implementation, + // But creates an additional child Fiber for raw text children. + // No additional native views are created though. + // It's not clear to me which is better so I'm deferring for now. + // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 + return false; } -var valueStack = []; +// The Fabric renderer is secondary to the existing React Native renderer. +var isPrimaryRenderer = false; -var fiberStack = void 0; +// The Fabric renderer shouldn't trigger missing act() warnings +var warnsIfNotActing = false; -{ - fiberStack = []; -} +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; -var index = -1; +// ------------------- +// Persistence +// ------------------- -function createCursor(defaultValue) { - return { - current: defaultValue - }; -} +var supportsPersistence = true; -function pop(cursor, fiber) { - if (index < 0) { - { - warningWithoutStack$1(false, "Unexpected pop."); +function cloneInstance( + instance, + updatePayload, + type, + oldProps, + newProps, + internalInstanceHandle, + keepChildren, + recyclableInstance +) { + var node = instance.node; + var clone = void 0; + if (keepChildren) { + if (updatePayload !== null) { + clone = cloneNodeWithNewProps(node, updatePayload); + } else { + clone = cloneNode(node); } - return; - } - - { - if (fiber !== fiberStack[index]) { - warningWithoutStack$1(false, "Unexpected Fiber popped."); + } else { + if (updatePayload !== null) { + clone = cloneNodeWithNewChildrenAndProps(node, updatePayload); + } else { + clone = cloneNodeWithNewChildren(node); } } - - cursor.current = valueStack[index]; - - valueStack[index] = null; - - { - fiberStack[index] = null; - } - - index--; + return { + node: clone, + canonical: instance.canonical + }; } -function push(cursor, value, fiber) { - index++; - - valueStack[index] = cursor.current; - - { - fiberStack[index] = fiber; - } - - cursor.current = value; +function cloneHiddenInstance(instance, type, props, internalInstanceHandle) { + var viewConfig = instance.canonical.viewConfig; + var node = instance.node; + var updatePayload = create( + { style: { display: "none" } }, + viewConfig.validAttributes + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical + }; } -var warnedAboutMissingGetChildContext = void 0; - -{ - warnedAboutMissingGetChildContext = {}; +function cloneHiddenTextInstance(instance, text, internalInstanceHandle) { + throw new Error("Not yet implemented."); } -var emptyContextObject = {}; -{ - Object.freeze(emptyContextObject); +function createContainerChildSet(container) { + return createChildNodeSet(container); } -// A cursor to the current merged context object on the stack. -var contextStackCursor = createCursor(emptyContextObject); -// A cursor to a boolean indicating whether the context has changed. -var didPerformWorkStackCursor = createCursor(false); -// Keep track of the previous context object that was on the stack. -// We use this to get access to the parent context after we have already -// pushed the next context provider, and now need to merge their contexts. -var previousContext = emptyContextObject; - -function getUnmaskedContext( - workInProgress, - Component, - didPushOwnContextIfProvider -) { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; - } - return contextStackCursor.current; +function appendChildToContainerChildSet(childSet, child) { + appendChildNodeToSet(childSet, child.node); } -function cacheContext(workInProgress, unmaskedContext, maskedContext) { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; +function finalizeContainerChildren(container, newChildren) { + completeRoot(container, newChildren); } -function getMaskedContext(workInProgress, unmaskedContext) { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - if (!contextTypes) { - return emptyContextObject; - } - - // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. - var instance = workInProgress.stateNode; - if ( - instance && - instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext - ) { - return instance.__reactInternalMemoizedMaskedChildContext; - } +function mountResponderInstance( + responder, + responderInstance, + props, + state, + instance, + rootContainerInstance +) { + if (enableFlareAPI) { + var rootEventTypes = responder.rootEventTypes; - var context = {}; - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; + if (rootEventTypes !== null) { + addRootEventTypesForResponderInstance(responderInstance, rootEventTypes); + } + mountEventResponder(responder, responderInstance, props, state); } +} - { - var name = getComponentName(type) || "Unknown"; - checkPropTypes( - contextTypes, - context, - "context", - name, - getCurrentFiberStackInDev - ); +function unmountResponderInstance(responderInstance) { + if (enableFlareAPI) { + // TODO stop listening to targetEventTypes + unmountEventResponder(responderInstance); } +} - // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); - } +function getFundamentalComponentInstance(fundamentalInstance) { + throw new Error("Not yet implemented."); +} - return context; +function mountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); } -function hasContextChanged() { - return didPerformWorkStackCursor.current; +function shouldUpdateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); } -function isContextProvider(type) { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; +function updateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); } -function popContext(fiber) { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); +function unmountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); } -function popTopLevelContextObject(fiber) { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); +function cloneFundamentalInstance(fundamentalInstance) { + throw new Error("Not yet implemented."); } -function pushTopLevelContextObject(fiber, context, didChange) { - (function() { - if (!(contextStackCursor.current === emptyContextObject)) { - throw ReactError( - "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(fiber, type, parentContext) { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; - // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - if (typeof instance.getChildContext !== "function") { +var describeComponentFrame = function(name, source, ownerName) { + var sourceInfo = ""; + if (source) { + var path = source.fileName; + var fileName = path.replace(BEFORE_SLASH_RE, ""); { - var componentName = getComponentName(type) || "Unknown"; - - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - warningWithoutStack$1( - false, - "%s.childContextTypes is specified but there is no getChildContext() method " + - "on the instance. You can either define getChildContext() on %s or remove " + - "childContextTypes from it.", - componentName, - componentName - ); + // In DEV, include code for a common special case: + // prefer "folder/index.js" instead of just "index.js". + if (/^index\./.test(fileName)) { + var match = path.match(BEFORE_SLASH_RE); + if (match) { + var pathBeforeSlash = match[1]; + if (pathBeforeSlash) { + var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ""); + fileName = folderName + "/" + fileName; + } + } } } - return parentContext; - } - - var childContext = void 0; - { - setCurrentPhase("getChildContext"); - } - startPhaseTimer(fiber, "getChildContext"); - childContext = instance.getChildContext(); - stopPhaseTimer(); - { - setCurrentPhase(null); - } - for (var contextKey in childContext) { - (function() { - if (!(contextKey in childContextTypes)) { - throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' - ); - } - })(); - } - { - var name = getComponentName(type) || "Unknown"; - checkPropTypes( - childContextTypes, - childContext, - "child context", - name, - // In practice, there is one case in which we won't get a stack. It's when - // somebody calls unstable_renderSubtreeIntoContainer() and we process - // context from the parent component instance. The stack will be missing - // because it's outside of the reconciliation, and so the pointer has not - // been set. This is rare and doesn't matter. We'll also remove that API. - getCurrentFiberStackInDev - ); + sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")"; + } else if (ownerName) { + sourceInfo = " (created by " + ownerName + ")"; } + return "\n in " + (name || "Unknown") + sourceInfo; +}; - return Object.assign({}, parentContext, childContext); -} - -function pushContextProvider(workInProgress) { - var instance = workInProgress.stateNode; - // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. - var memoizedMergedChildContext = - (instance && instance.__reactInternalMemoizedMergedChildContext) || - emptyContextObject; - - // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - previousContext = contextStackCursor.current; - push(contextStackCursor, memoizedMergedChildContext, workInProgress); - push( - didPerformWorkStackCursor, - didPerformWorkStackCursor.current, - workInProgress - ); - - return true; -} - -function invalidateContextProvider(workInProgress, type, didChange) { - var instance = workInProgress.stateNode; - (function() { - if (!instance) { - throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext( - workInProgress, - type, - previousContext - ); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; - - // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor, workInProgress); - // Now push the new context and mark that it has changed. - push(contextStackCursor, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); +function describeFiber(fiber) { + switch (fiber.tag) { + case HostRoot: + case HostPortal: + case HostText: + case Fragment: + case ContextProvider: + case ContextConsumer: + return ""; + default: + var owner = fiber._debugOwner; + var source = fiber._debugSource; + var name = getComponentName(fiber.type); + var ownerName = null; + if (owner) { + ownerName = getComponentName(owner.type); + } + return describeComponentFrame(name, source, ownerName); } } -function findCurrentUnmaskedContext(fiber) { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - (function() { - if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { - throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); - - var node = fiber; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + var node = workInProgress; do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - case ClassComponent: { - var Component = node.type; - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - break; - } - } + info += describeFiber(node); node = node.return; - } while (node !== null); - (function() { - { - throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); + } while (node); + return info; } -var onCommitFiberRoot = null; -var onCommitFiberUnmount = null; -var hasLoggedError = false; +var current = null; +var phase = null; -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) { - if (true && !hasLoggedError) { - hasLoggedError = true; - warningWithoutStack$1( - false, - "React DevTools encountered an error: %s", - err - ); - } +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; } - }; -} - -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; - -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { - // No DevTools - return false; - } - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } - if (!hook.supportsFiber) { - { - warningWithoutStack$1( - false, - "The installed version of React DevTools is too old and will not work " + - "with the current version of React. Please update React DevTools. " + - "https://fb.me/react-devtools" - ); + var owner = current._debugOwner; + if (owner !== null && typeof owner !== "undefined") { + return getComponentName(owner.type); } - // DevTools exists, even though it doesn't support Fiber. - return true; } - try { - var rendererID = hook.inject(internals); - // We have successfully injected, so now it is safe to set up hooks. - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - warningWithoutStack$1( - false, - "React DevTools encountered an error: %s.", - err - ); + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ""; } + // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + return getStackByFiberInDevAndProd(current); } - // DevTools exists - return true; + return ""; } -function onCommitRoot(root) { - if (typeof onCommitFiberRoot === "function") { - onCommitFiberRoot(root); +function resetCurrentFiber() { + { + ReactDebugCurrentFrame.getCurrentStack = null; + current = null; + phase = null; } } -function onCommitUnmount(fiber) { - if (typeof onCommitFiberUnmount === "function") { - onCommitFiberUnmount(fiber); +function setCurrentFiber(fiber) { + { + ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; + current = fiber; + phase = null; } } -// Max 31 bit integer. The max integer size in V8 for 32-bit systems. -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 -var MAX_SIGNED_31_BIT_INT = 1073741823; - -// Intentionally not named imports because Rollup would use dynamic dispatch for -// CommonJS interop named imports. -var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority; -var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback; -var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback; -var Scheduler_shouldYield = Scheduler.unstable_shouldYield; -var Scheduler_now = Scheduler.unstable_now; -var Scheduler_getCurrentPriorityLevel = - Scheduler.unstable_getCurrentPriorityLevel; -var Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority; -var Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; -var Scheduler_NormalPriority = Scheduler.unstable_NormalPriority; -var Scheduler_LowPriority = Scheduler.unstable_LowPriority; -var Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; - -if (enableSchedulerTracing) { - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - (function() { - if ( - !( - tracing.__interactionsRef != null && - tracing.__interactionsRef.current != null - ) - ) { - throw ReactError( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" - ); - } - })(); +function setCurrentPhase(lifeCyclePhase) { + { + phase = lifeCyclePhase; + } } -var fakeCallbackNode = {}; +// Prefix measurements so that it's possible to filter them. +// Longer prefixes are hard to read in DevTools. +var reactEmoji = "\u269B"; +var warningEmoji = "\u26D4"; +var supportsUserTiming = + typeof performance !== "undefined" && + typeof performance.mark === "function" && + typeof performance.clearMarks === "function" && + typeof performance.measure === "function" && + typeof performance.clearMeasures === "function"; -// Except for NoPriority, these correspond to Scheduler priorities. We use -// ascending numbers so we can compare them like numbers. They start at 90 to -// avoid clashing with Scheduler's priorities. -var ImmediatePriority = 99; -var UserBlockingPriority = 98; -var NormalPriority = 97; -var LowPriority = 96; -var IdlePriority = 95; -// NoPriority is the absence of priority. Also React-only. +// Keep track of current fiber so that we know the path to unwind on pause. +// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? +var currentFiber = null; +// If we're in the middle of user code, which fiber and method is it? +// Reusing `currentFiber` would be confusing for this because user code fiber +// can change during commit phase too, but we don't need to unwind it (since +// lifecycles in the commit phase don't resemble a tree). +var currentPhase = null; +var currentPhaseFiber = null; +// Did lifecycle hook schedule an update? This is often a performance problem, +// so we will keep track of it, and include it in the report. +// Track commits caused by cascading updates. +var isCommitting = false; +var hasScheduledUpdateInCurrentCommit = false; +var hasScheduledUpdateInCurrentPhase = false; +var commitCountInCurrentWorkLoop = 0; +var effectCountInCurrentCommit = 0; +var isWaitingForCallback = false; +// During commits, we only show a measurement once per method name +// to avoid stretch the commit phase with measurement overhead. +var labelsInCurrentCommit = new Set(); -var shouldYield = disableYielding - ? function() { - return false; - } // Never yield when `disableYielding` is on - : Scheduler_shouldYield; +var formatMarkName = function(markName) { + return reactEmoji + " " + markName; +}; -var immediateQueue = null; -var immediateQueueCallbackNode = null; -var isFlushingImmediate = false; -var initialTimeMs = Scheduler_now(); +var formatLabel = function(label, warning) { + var prefix = warning ? warningEmoji + " " : reactEmoji + " "; + var suffix = warning ? " Warning: " + warning : ""; + return "" + prefix + label + suffix; +}; -// If the initial timestamp is reasonably small, use Scheduler's `now` directly. -// This will be the case for modern browsers that support `performance.now`. In -// older browsers, Scheduler falls back to `Date.now`, which returns a Unix -// timestamp. In that case, subtract the module initialization time to simulate -// the behavior of performance.now and keep our times small enough to fit -// within 32 bits. -// TODO: Consider lifting this into Scheduler. -var now = - initialTimeMs < 10000 - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; +var beginMark = function(markName) { + performance.mark(formatMarkName(markName)); +}; -function getCurrentPriorityLevel() { - switch (Scheduler_getCurrentPriorityLevel()) { - case Scheduler_ImmediatePriority: - return ImmediatePriority; - case Scheduler_UserBlockingPriority: - return UserBlockingPriority; - case Scheduler_NormalPriority: - return NormalPriority; - case Scheduler_LowPriority: - return LowPriority; - case Scheduler_IdlePriority: - return IdlePriority; - default: - (function() { - { - throw ReactError("Unknown priority level."); - } - })(); +var clearMark = function(markName) { + performance.clearMarks(formatMarkName(markName)); +}; + +var endMark = function(label, markName, warning) { + var formattedMarkName = formatMarkName(markName); + var formattedLabel = formatLabel(label, warning); + try { + performance.measure(formattedLabel, formattedMarkName); + } catch (err) {} + // If previous mark was missing for some reason, this will throw. + // This could only happen if React crashed in an unexpected place earlier. + // Don't pile on with more errors. + + // Clear marks immediately to avoid growing buffer. + performance.clearMarks(formattedMarkName); + performance.clearMeasures(formattedLabel); +}; + +var getFiberMarkName = function(label, debugID) { + return label + " (#" + debugID + ")"; +}; + +var getFiberLabel = function(componentName, isMounted, phase) { + if (phase === null) { + // These are composite component total time measurements. + return componentName + " [" + (isMounted ? "update" : "mount") + "]"; + } else { + // Composite component methods. + return componentName + "." + phase; } -} +}; -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case ImmediatePriority: - return Scheduler_ImmediatePriority; - case UserBlockingPriority: - return Scheduler_UserBlockingPriority; - case NormalPriority: - return Scheduler_NormalPriority; - case LowPriority: - return Scheduler_LowPriority; - case IdlePriority: - return Scheduler_IdlePriority; +var beginFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + + if (isCommitting && labelsInCurrentCommit.has(label)) { + // During the commit phase, we don't show duplicate labels because + // there is a fixed overhead for every measurement, and we don't + // want to stretch the commit phase beyond necessary. + return false; + } + labelsInCurrentCommit.add(label); + + var markName = getFiberMarkName(label, debugID); + beginMark(markName); + return true; +}; + +var clearFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + clearMark(markName); +}; + +var endFiberMark = function(fiber, phase, warning) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + endMark(label, markName, warning); +}; + +var shouldIgnoreFiber = function(fiber) { + // Host components should be skipped in the timeline. + // We could check typeof fiber.type, but does this work with RN? + switch (fiber.tag) { + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case Fragment: + case ContextProvider: + case ContextConsumer: + case Mode: + return true; default: - (function() { - { - throw ReactError("Unknown priority level."); - } - })(); + return false; } -} +}; -function runWithPriority(reactPriorityLevel, fn) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_runWithPriority(priorityLevel, fn); -} +var clearPendingPhaseMeasurement = function() { + if (currentPhase !== null && currentPhaseFiber !== null) { + clearFiberMark(currentPhaseFiber, currentPhase); + } + currentPhaseFiber = null; + currentPhase = null; + hasScheduledUpdateInCurrentPhase = false; +}; -function scheduleCallback(reactPriorityLevel, callback, options) { - if (reactPriorityLevel === ImmediatePriority) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushImmediateQueue`. - if (immediateQueue === null) { - immediateQueue = [callback]; - // Flush the queue in the next tick, at the earliest. - immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ); - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - immediateQueue.push(callback); +var pauseTimers = function() { + // Stops all currently active measurements so that they can be resumed + // if we continue in a later deferred loop from the same unit of work. + var fiber = currentFiber; + while (fiber) { + if (fiber._debugIsCurrentlyTiming) { + endFiberMark(fiber, null, null); } - return fakeCallbackNode; + fiber = fiber.return; } - // Otherwise pass through to Scheduler. - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(priorityLevel, callback, options); -} +}; -function cancelCallback(callbackNode) { - if (callbackNode !== fakeCallbackNode) { - Scheduler_cancelCallback(callbackNode); +var resumeTimersRecursively = function(fiber) { + if (fiber.return !== null) { + resumeTimersRecursively(fiber.return); } -} + if (fiber._debugIsCurrentlyTiming) { + beginFiberMark(fiber, null); + } +}; -function flushImmediateQueue() { - if (immediateQueueCallbackNode !== null) { - Scheduler_cancelCallback(immediateQueueCallbackNode); +var resumeTimers = function() { + // Resumes all measurements that were active during the last deferred loop. + if (currentFiber !== null) { + resumeTimersRecursively(currentFiber); + } +}; + +function recordEffect() { + if (enableUserTimingAPI) { + effectCountInCurrentCommit++; } - flushImmediateQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && immediateQueue !== null) { - // Prevent re-entrancy. - isFlushingImmediate = true; - var i = 0; - try { - var _isSync = true; - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do { - callback = callback(_isSync); - } while (callback !== null); - } - immediateQueue = null; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - if (immediateQueue !== null) { - immediateQueue = immediateQueue.slice(i + 1); - } - // Resume flushing in the next tick - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueue - ); - throw error; - } finally { - isFlushingImmediate = false; +function recordScheduleUpdate() { + if (enableUserTimingAPI) { + if (isCommitting) { + hasScheduledUpdateInCurrentCommit = true; + } + if ( + currentPhase !== null && + currentPhase !== "componentWillMount" && + currentPhase !== "componentWillReceiveProps" + ) { + hasScheduledUpdateInCurrentPhase = true; } } } -var NoWork = 0; -var Never = 1; -var Sync = MAX_SIGNED_31_BIT_INT; - -var UNIT_SIZE = 10; -var MAGIC_NUMBER_OFFSET = MAX_SIGNED_31_BIT_INT - 1; +function startRequestCallbackTimer() { + if (enableUserTimingAPI) { + if (supportsUserTiming && !isWaitingForCallback) { + isWaitingForCallback = true; + beginMark("(Waiting for async callback...)"); + } + } +} -// 1 unit of expiration time represents 10ms. -function msToExpirationTime(ms) { - // Always add an offset so that we don't clash with the magic number for NoWork. - return MAGIC_NUMBER_OFFSET - ((ms / UNIT_SIZE) | 0); +function stopRequestCallbackTimer(didExpire) { + if (enableUserTimingAPI) { + if (supportsUserTiming) { + isWaitingForCallback = false; + var warning = didExpire + ? "Update expired; will flush synchronously" + : null; + endMark( + "(Waiting for async callback...)", + "(Waiting for async callback...)", + warning + ); + } + } } -function expirationTimeToMs(expirationTime) { - return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE; +function startWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, this is the fiber to unwind from. + currentFiber = fiber; + if (!beginFiberMark(fiber, null)) { + return; + } + fiber._debugIsCurrentlyTiming = true; + } } -function ceiling(num, precision) { - return (((num / precision) | 0) + 1) * precision; +function cancelWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // Remember we shouldn't complete measurement for this fiber. + // Otherwise flamechart will be deep even for small updates. + fiber._debugIsCurrentlyTiming = false; + clearFiberMark(fiber, null); + } } -function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { - return ( - MAGIC_NUMBER_OFFSET - - ceiling( - MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, - bucketSizeMs / UNIT_SIZE - ) - ); +function stopWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + endFiberMark(fiber, null, null); + } } -// TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update -// the names to reflect. -var LOW_PRIORITY_EXPIRATION = 5000; -var LOW_PRIORITY_BATCH_SIZE = 250; - -function computeAsyncExpiration(currentTime) { - return computeExpirationBucket( - currentTime, - LOW_PRIORITY_EXPIRATION, - LOW_PRIORITY_BATCH_SIZE - ); +function stopFailedWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + var warning = + fiber.tag === SuspenseComponent || + fiber.tag === DehydratedSuspenseComponent + ? "Rendering was suspended" + : "An error was thrown inside this error boundary"; + endFiberMark(fiber, null, warning); + } } -// Same as computeAsyncExpiration but without the bucketing logic. This is -// used to compute timestamps instead of actual expiration times. -function computeAsyncExpirationNoBucket(currentTime) { - return currentTime - LOW_PRIORITY_EXPIRATION / UNIT_SIZE; +function startPhaseTimer(fiber, phase) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + clearPendingPhaseMeasurement(); + if (!beginFiberMark(fiber, phase)) { + return; + } + currentPhaseFiber = fiber; + currentPhase = phase; + } } -// We intentionally set a higher expiration time for interactive updates in -// dev than in production. -// -// If the main thread is being blocked so long that you hit the expiration, -// it's a problem that could be solved with better scheduling. -// -// People will be more likely to notice this and fix it with the long -// expiration time in development. -// -// In production we opt for better UX at the risk of masking scheduling -// problems, by expiring fast. -var HIGH_PRIORITY_EXPIRATION = 500; -var HIGH_PRIORITY_BATCH_SIZE = 100; - -function computeInteractiveExpiration(currentTime) { - return computeExpirationBucket( - currentTime, - HIGH_PRIORITY_EXPIRATION, - HIGH_PRIORITY_BATCH_SIZE - ); +function stopPhaseTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + if (currentPhase !== null && currentPhaseFiber !== null) { + var warning = hasScheduledUpdateInCurrentPhase + ? "Scheduled a cascading update" + : null; + endFiberMark(currentPhaseFiber, currentPhase, warning); + } + currentPhase = null; + currentPhaseFiber = null; + } } -function inferPriorityFromExpirationTime(currentTime, expirationTime) { - if (expirationTime === Sync) { - return ImmediatePriority; - } - if (expirationTime === Never) { - return IdlePriority; - } - var msUntil = - expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime); - if (msUntil <= 0) { - return ImmediatePriority; - } - if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) { - return UserBlockingPriority; - } - if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) { - return NormalPriority; +function startWorkLoopTimer(nextUnitOfWork) { + if (enableUserTimingAPI) { + currentFiber = nextUnitOfWork; + if (!supportsUserTiming) { + return; + } + commitCountInCurrentWorkLoop = 0; + // This is top level call. + // Any other measurements are performed within. + beginMark("(React Tree Reconciliation)"); + // Resume any measurements that were in progress during the last loop. + resumeTimers(); } +} - // TODO: Handle LowPriority +function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var warning = null; + if (interruptedBy !== null) { + if (interruptedBy.tag === HostRoot) { + warning = "A top-level update interrupted the previous render"; + } else { + var componentName = getComponentName(interruptedBy.type) || "Unknown"; + warning = + "An update to " + componentName + " interrupted the previous render"; + } + } else if (commitCountInCurrentWorkLoop > 1) { + warning = "There were cascading updates"; + } + commitCountInCurrentWorkLoop = 0; + var label = didCompleteRoot + ? "(React Tree Reconciliation: Completed Root)" + : "(React Tree Reconciliation: Yielded)"; + // Pause any measurements until the next loop. + pauseTimers(); + endMark(label, "(React Tree Reconciliation)", warning); + } +} - // Assume anything lower has idle priority - return IdlePriority; +function startCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + isCommitting = true; + hasScheduledUpdateInCurrentCommit = false; + labelsInCurrentCommit.clear(); + beginMark("(Committing Changes)"); + } } -var NoContext = 0; -var ConcurrentMode = 1; -var StrictMode = 2; -var ProfileMode = 4; +function stopCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } -var hasBadMapPolyfill = void 0; + var warning = null; + if (hasScheduledUpdateInCurrentCommit) { + warning = "Lifecycle hook scheduled a cascading update"; + } else if (commitCountInCurrentWorkLoop > 0) { + warning = "Caused by a cascading update in earlier commit"; + } + hasScheduledUpdateInCurrentCommit = false; + commitCountInCurrentWorkLoop++; + isCommitting = false; + labelsInCurrentCommit.clear(); -{ - hasBadMapPolyfill = false; - try { - var nonExtensibleObject = Object.preventExtensions({}); - var testMap = new Map([[nonExtensibleObject, null]]); - var testSet = new Set([nonExtensibleObject]); - // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - testMap.set(0, 0); - testSet.add(0); - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; + endMark("(Committing Changes)", "(Committing Changes)", warning); } } -// A Fiber is work on a Component that needs to be done or was done. There can -// be more than one per component. - -var debugCounter = void 0; - -{ - debugCounter = 1; +function startCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Committing Snapshot Effects)"); + } } -function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.elementType = null; - this.type = null; - this.stateNode = null; - - // Fiber - this.return = null; - this.child = null; - this.sibling = null; - this.index = 0; - - this.ref = null; - - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; - this.contextDependencies = null; - - this.mode = mode; - - // Effects - this.effectTag = NoEffect; - this.nextEffect = null; - - this.firstEffect = null; - this.lastEffect = null; - - this.expirationTime = NoWork; - this.childExpirationTime = NoWork; - - this.alternate = null; - - if (enableProfilerTimer) { - // Note: The following is done to avoid a v8 performance cliff. - // - // Initializing the fields below to smis and later updating them with - // double values will cause Fibers to end up having separate shapes. - // This behavior/bug has something to do with Object.preventExtension(). - // Fortunately this only impacts DEV builds. - // Unfortunately it makes React unusably slow for some applications. - // To work around this, initialize the fields below with doubles. - // - // Learn more about this here: - // https://github.com/facebook/react/issues/14365 - // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; - - // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; +function stopCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Snapshot Effects: " + count + " Total)", + "(Committing Snapshot Effects)", + null + ); } +} - { - this._debugID = debugCounter++; - this._debugSource = null; - this._debugOwner = null; - this._debugIsCurrentlyTiming = false; - this._debugHookTypes = null; - if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { - Object.preventExtensions(this); +function startCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; } + effectCountInCurrentCommit = 0; + beginMark("(Committing Host Effects)"); } } -// This is a constructor function, rather than a POJO constructor, still -// please ensure we do the following: -// 1) Nobody should add any instance methods on this. Instance methods can be -// more difficult to predict when they get optimized and they are almost -// never inlined properly in static compilers. -// 2) Nobody should rely on `instanceof Fiber` for type testing. We should -// always know when it is a fiber. -// 3) We might want to experiment with using numeric keys since they are easier -// to optimize in a non-JIT environment. -// 4) We can easily go from a constructor to a createFiber object literal if that -// is faster. -// 5) It should be easy to port this to a C struct and keep a C implementation -// compatible. -var createFiber = function(tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); -}; - -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); +function stopCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Host Effects: " + count + " Total)", + "(Committing Host Effects)", + null + ); + } } -function isSimpleFunctionComponent(type) { - return ( - typeof type === "function" && - !shouldConstruct(type) && - type.defaultProps === undefined - ); +function startCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Calling Lifecycle Methods)"); + } } -function resolveLazyComponentTag(Component) { - if (typeof Component === "function") { - return shouldConstruct(Component) ? ClassComponent : FunctionComponent; - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - if ($$typeof === REACT_FORWARD_REF_TYPE) { - return ForwardRef; - } - if ($$typeof === REACT_MEMO_TYPE) { - return MemoComponent; +function stopCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Calling Lifecycle Methods: " + count + " Total)", + "(Calling Lifecycle Methods)", + null + ); } - return IndeterminateComponent; } -// This is used to create an alternate fiber to do work on. -function createWorkInProgress(current, pendingProps, expirationTime) { - var workInProgress = current.alternate; - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - ); - workInProgress.elementType = current.elementType; - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; +var valueStack = []; - { - // DEV-only fields - workInProgress._debugID = current._debugID; - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; - workInProgress._debugHookTypes = current._debugHookTypes; - } +var fiberStack = void 0; - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; +{ + fiberStack = []; +} - // We already have an alternate. - // Reset the effect tag. - workInProgress.effectTag = NoEffect; +var index = -1; - // The effect list is no longer valid. - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} - if (enableProfilerTimer) { - // We intentionally reset, rather than copy, actualDuration & actualStartTime. - // This prevents time from endlessly accumulating in new commits. - // This has the downside of resetting values for different priority renders, - // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; +function pop(cursor, fiber) { + if (index < 0) { + { + warningWithoutStack$1(false, "Unexpected pop."); } + return; } - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; + { + if (fiber !== fiberStack[index]) { + warningWithoutStack$1(false, "Unexpected Fiber popped."); + } + } - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; + cursor.current = valueStack[index]; - // These will be overridden during the parent's reconciliation - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; + valueStack[index] = null; - if (enableProfilerTimer) { - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; + { + fiberStack[index] = null; } - return workInProgress; + index--; } -function createHostRootFiber(isConcurrent) { - var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext; +function push(cursor, value, fiber) { + index++; + + valueStack[index] = cursor.current; - if (enableProfilerTimer && isDevToolsPresent) { - // Always collect profile timings when DevTools are present. - // This enables DevTools to start capturing timing at any point– - // Without some nodes in the tree having empty base times. - mode |= ProfileMode; + { + fiberStack[index] = fiber; } - return createFiber(HostRoot, null, null, mode); + cursor.current = value; } -function createFiberFromTypeAndProps( - type, // React$ElementType - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiber = void 0; - - var fiberTag = IndeterminateComponent; - // The resolved type is set if we know what the final type will be. I.e. it's not lazy. - var resolvedType = type; - if (typeof type === "function") { - if (shouldConstruct(type)) { - fiberTag = ClassComponent; - } - } else if (typeof type === "string") { - fiberTag = HostComponent; - } else { - getTag: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode( - pendingProps, - mode | ConcurrentMode | StrictMode, - expirationTime, - key - ); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode( - pendingProps, - mode | StrictMode, - expirationTime, - key - ); - case REACT_PROFILER_TYPE: - return createFiberFromProfiler(pendingProps, mode, expirationTime, key); - case REACT_SUSPENSE_TYPE: - return createFiberFromSuspense(pendingProps, mode, expirationTime, key); - default: { - if (typeof type === "object" && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break getTag; - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break getTag; - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - break getTag; - case REACT_MEMO_TYPE: - fiberTag = MemoComponent; - break getTag; - case REACT_LAZY_TYPE: - fiberTag = LazyComponent; - resolvedType = null; - break getTag; - case REACT_EVENT_COMPONENT_TYPE: - if (enableEventAPI) { - return createFiberFromEventComponent( - type, - pendingProps, - mode, - expirationTime, - key - ); - } - break; - case REACT_EVENT_TARGET_TYPE: - if (enableEventAPI) { - return createFiberFromEventTarget( - type, - pendingProps, - mode, - expirationTime, - key - ); - } - break; - } - } - var info = ""; - { - if ( - type === undefined || - (typeof type === "object" && - type !== null && - Object.keys(type).length === 0) - ) { - info += - " You likely forgot to export your component from the file " + - "it's defined in, or you might have mixed up default and " + - "named imports."; - } - var ownerName = owner ? getComponentName(owner.type) : null; - if (ownerName) { - info += "\n\nCheck the render method of `" + ownerName + "`."; - } - } - (function() { - { - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (type == null ? type : typeof type) + - "." + - info - ); - } - })(); - } - } - } - - fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.elementType = type; - fiber.type = resolvedType; - fiber.expirationTime = expirationTime; +var warnedAboutMissingGetChildContext = void 0; - return fiber; +{ + warnedAboutMissingGetChildContext = {}; } -function createFiberFromElement(element, mode, expirationTime) { - var owner = null; - { - owner = element._owner; - } - var type = element.type; - var key = element.key; - var pendingProps = element.props; - var fiber = createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime - ); - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; - } - return fiber; +var emptyContextObject = {}; +{ + Object.freeze(emptyContextObject); } -function createFiberFromFragment(elements, mode, expirationTime, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.expirationTime = expirationTime; - return fiber; -} +// A cursor to the current merged context object on the stack. +var contextStackCursor = createCursor(emptyContextObject); +// A cursor to a boolean indicating whether the context has changed. +var didPerformWorkStackCursor = createCursor(false); +// Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. +var previousContext = emptyContextObject; -function createFiberFromEventComponent( - eventComponent, - pendingProps, - mode, - expirationTime, - key +function getUnmaskedContext( + workInProgress, + Component, + didPushOwnContextIfProvider ) { - var fiber = createFiber(EventComponent, pendingProps, key, mode); - fiber.elementType = eventComponent; - fiber.type = eventComponent; - fiber.expirationTime = expirationTime; - return fiber; + if (disableLegacyContext) { + return emptyContextObject; + } else { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; + } + return contextStackCursor.current; + } } -function createFiberFromEventTarget( - eventTarget, - pendingProps, - mode, - expirationTime, - key -) { - var fiber = createFiber(EventTarget, pendingProps, key, mode); - fiber.elementType = eventTarget; - fiber.type = eventTarget; - fiber.expirationTime = expirationTime; - // Store latest props - fiber.stateNode = { - props: pendingProps - }; - return fiber; +function cacheContext(workInProgress, unmaskedContext, maskedContext) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + } } -function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { - { +function getMaskedContext(workInProgress, unmaskedContext) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + var type = workInProgress.type; + var contextTypes = type.contextTypes; + if (!contextTypes) { + return emptyContextObject; + } + + // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + var instance = workInProgress.stateNode; if ( - typeof pendingProps.id !== "string" || - typeof pendingProps.onRender !== "function" + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext ) { - warningWithoutStack$1( - false, - 'Profiler must specify an "id" string and "onRender" function as props' - ); + return instance.__reactInternalMemoizedMaskedChildContext; } - } - - var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); - // TODO: The Profiler fiber shouldn't have a type. It has a tag. - fiber.elementType = REACT_PROFILER_TYPE; - fiber.type = REACT_PROFILER_TYPE; - fiber.expirationTime = expirationTime; - return fiber; -} + var context = {}; + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - var fiber = createFiber(Mode, pendingProps, key, mode); + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + contextTypes, + context, + "context", + name, + getCurrentFiberStackInDev + ); + } - // TODO: The Mode fiber shouldn't have a type. It has a tag. - var type = - (mode & ConcurrentMode) === NoContext - ? REACT_STRICT_MODE_TYPE - : REACT_CONCURRENT_MODE_TYPE; - fiber.elementType = type; - fiber.type = type; + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } - fiber.expirationTime = expirationTime; - return fiber; + return context; + } } -function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { - var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); - - // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. - var type = REACT_SUSPENSE_TYPE; - fiber.elementType = type; - fiber.type = type; - - fiber.expirationTime = expirationTime; - return fiber; +function hasContextChanged() { + if (disableLegacyContext) { + return false; + } else { + return didPerformWorkStackCursor.current; + } } -function createFiberFromText(content, mode, expirationTime) { - var fiber = createFiber(HostText, content, null, mode); - fiber.expirationTime = expirationTime; - return fiber; +function isContextProvider(type) { + if (disableLegacyContext) { + return false; + } else { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } } -function createFiberFromHostInstanceForDeletion() { - var fiber = createFiber(HostComponent, null, null, NoContext); - // TODO: These should not need a type. - fiber.elementType = "DELETED"; - fiber.type = "DELETED"; - return fiber; +function popContext(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } } -function createFiberFromPortal(portal, mode, expirationTime) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.expirationTime = expirationTime; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, // Used by persistent updates - implementation: portal.implementation - }; - return fiber; +function popTopLevelContextObject(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } } -// Used for stashing WIP properties to replay failed work in DEV. -function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoContext); - } - - // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. +function pushTopLevelContextObject(fiber, context, didChange) { + if (disableLegacyContext) { + return; + } else { + (function() { + if (!(contextStackCursor.current === emptyContextObject)) { + throw ReactError( + Error( + "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); - target.tag = source.tag; - target.key = source.key; - target.elementType = source.elementType; - target.type = source.type; - target.stateNode = source.stateNode; - target.return = source.return; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.contextDependencies = source.contextDependencies; - target.mode = source.mode; - target.effectTag = source.effectTag; - target.nextEffect = source.nextEffect; - target.firstEffect = source.firstEffect; - target.lastEffect = source.lastEffect; - target.expirationTime = source.expirationTime; - target.childExpirationTime = source.childExpirationTime; - target.alternate = source.alternate; - if (enableProfilerTimer) { - target.actualDuration = source.actualDuration; - target.actualStartTime = source.actualStartTime; - target.selfBaseDuration = source.selfBaseDuration; - target.treeBaseDuration = source.treeBaseDuration; + push(contextStackCursor, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); } - target._debugID = source._debugID; - target._debugSource = source._debugSource; - target._debugOwner = source._debugOwner; - target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; - target._debugHookTypes = source._debugHookTypes; - return target; } -// TODO: This should be lifted into the renderer. +function processChildContext(fiber, type, parentContext) { + if (disableLegacyContext) { + return parentContext; + } else { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; -// The following attributes are only used by interaction tracing builds. -// They enable interactions to be associated with their async work, -// And expose interaction metadata to the React DevTools Profiler plugin. -// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. + // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== "function") { + { + var componentName = getComponentName(type) || "Unknown"; -// Exported FiberRoot type includes all properties, -// To avoid requiring potentially error-prone :any casts throughout the project. -// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). -// The types are defined separately within this file to ensure they stay in sync. -// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + warningWithoutStack$1( + false, + "%s.childContextTypes is specified but there is no getChildContext() method " + + "on the instance. You can either define getChildContext() on %s or remove " + + "childContextTypes from it.", + componentName, + componentName + ); + } + } + return parentContext; + } -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pendingChildren = null; - this.pingCache = null; - this.pendingCommitExpirationTime = NoWork; - this.finishedWork = null; - this.timeoutHandle = noTimeout; - this.context = null; - this.pendingContext = null; - this.hydrate = hydrate; - this.firstBatch = null; - this.callbackNode = null; - this.callbackExpirationTime = NoWork; - this.firstPendingTime = NoWork; - this.lastPendingTime = NoWork; - this.pingTime = NoWork; + var childContext = void 0; + { + setCurrentPhase("getChildContext"); + } + startPhaseTimer(fiber, "getChildContext"); + childContext = instance.getChildContext(); + stopPhaseTimer(); + { + setCurrentPhase(null); + } + for (var contextKey in childContext) { + (function() { + if (!(contextKey in childContextTypes)) { + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + } + })(); + } + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + childContextTypes, + childContext, + "child context", + name, + // In practice, there is one case in which we won't get a stack. It's when + // somebody calls unstable_renderSubtreeIntoContainer() and we process + // context from the parent component instance. The stack will be missing + // because it's outside of the reconciliation, and so the pointer has not + // been set. This is rare and doesn't matter. We'll also remove that API. + getCurrentFiberStackInDev + ); + } - if (enableSchedulerTracing) { - this.interactionThreadID = tracing.unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); + return Object.assign({}, parentContext, childContext); } } -function createFiberRoot(containerInfo, isConcurrent, hydrate) { - var root = new FiberRootNode(containerInfo, hydrate); - - // Cyclic construction. This cheats the type system right now because - // stateNode is any. - var uninitializedFiber = createHostRootFiber(isConcurrent); - root.current = uninitializedFiber; - uninitializedFiber.stateNode = root; +function pushContextProvider(workInProgress) { + if (disableLegacyContext) { + return false; + } else { + var instance = workInProgress.stateNode; + // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + + // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. + previousContext = contextStackCursor.current; + push(contextStackCursor, memoizedMergedChildContext, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); - return root; + return true; + } } -/** - * 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 warning = warningWithoutStack$1; +function invalidateContextProvider(workInProgress, type, didChange) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + (function() { + if (!instance) { + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); -{ - warning = function(condition, format) { - if (condition) { - return; + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext( + workInProgress, + type, + previousContext + ); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; + + // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor, workInProgress); + // Now push the new context and mark that it has changed. + push(contextStackCursor, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); } - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - // eslint-disable-next-line react-internal/warning-and-invariant-args + } +} - for ( - var _len = arguments.length, - args = Array(_len > 2 ? _len - 2 : 0), - _key = 2; - _key < _len; - _key++ - ) { - args[_key - 2] = arguments[_key]; - } +function findCurrentUnmaskedContext(fiber) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + (function() { + if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); - warningWithoutStack$1.apply( - undefined, - [false, format + "%s"].concat(args, [stack]) - ); - }; + var node = fiber; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; + case ClassComponent: { + var Component = node.type; + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; + } + break; + } + } + node = node.return; + } while (node !== null); + (function() { + { + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } } -var warning$1 = warning; +var LegacyRoot = 0; +var BatchedRoot = 1; +var ConcurrentRoot = 2; -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return ( - (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare - ); +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority; +var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback; +var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback; +var Scheduler_shouldYield = Scheduler.unstable_shouldYield; +var Scheduler_requestPaint = Scheduler.unstable_requestPaint; +var Scheduler_now = Scheduler.unstable_now; +var Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel; +var Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var Scheduler_NormalPriority = Scheduler.unstable_NormalPriority; +var Scheduler_LowPriority = Scheduler.unstable_LowPriority; +var Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; + +if (enableSchedulerTracing) { + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + (function() { + if ( + !( + tracing.__interactionsRef != null && + tracing.__interactionsRef.current != null + ) + ) { + throw ReactError( + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) + ); + } + })(); } -var hasOwnProperty = Object.prototype.hasOwnProperty; +var fakeCallbackNode = {}; -/** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ -function shallowEqual(objA, objB) { - if (is(objA, objB)) { - return true; - } +// Except for NoPriority, these correspond to Scheduler priorities. We use +// ascending numbers so we can compare them like numbers. They start at 90 to +// avoid clashing with Scheduler's priorities. +var ImmediatePriority = 99; +var UserBlockingPriority$1 = 98; +var NormalPriority = 97; +var LowPriority = 96; +var IdlePriority = 95; +// NoPriority is the absence of priority. Also React-only. +var NoPriority = 90; - if ( +var shouldYield = Scheduler_shouldYield; +var requestPaint = + // Fall back gracefully if we're running an older version of Scheduler. + Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; + +var syncQueue = null; +var immediateQueueCallbackNode = null; +var isFlushingSyncQueue = false; +var initialTimeMs = Scheduler_now(); + +// If the initial timestamp is reasonably small, use Scheduler's `now` directly. +// This will be the case for modern browsers that support `performance.now`. In +// older browsers, Scheduler falls back to `Date.now`, which returns a Unix +// timestamp. In that case, subtract the module initialization time to simulate +// the behavior of performance.now and keep our times small enough to fit +// within 32 bits. +// TODO: Consider lifting this into Scheduler. +var now = + initialTimeMs < 10000 + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; + +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return ImmediatePriority; + case Scheduler_UserBlockingPriority: + return UserBlockingPriority$1; + case Scheduler_NormalPriority: + return NormalPriority; + case Scheduler_LowPriority: + return LowPriority; + case Scheduler_IdlePriority: + return IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case ImmediatePriority: + return Scheduler_ImmediatePriority; + case UserBlockingPriority$1: + return Scheduler_UserBlockingPriority; + case NormalPriority: + return Scheduler_NormalPriority; + case LowPriority: + return Scheduler_LowPriority; + case IdlePriority: + return Scheduler_IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function runWithPriority$1(reactPriorityLevel, fn) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(priorityLevel, fn); +} + +function scheduleCallback(reactPriorityLevel, callback, options) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(priorityLevel, callback, options); +} + +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + // Flush the queue in the next tick, at the earliest. + immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ); + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } + return fakeCallbackNode; +} + +function cancelCallback(callbackNode) { + if (callbackNode !== fakeCallbackNode) { + Scheduler_cancelCallback(callbackNode); + } +} + +function flushSyncCallbackQueue() { + if (immediateQueueCallbackNode !== null) { + Scheduler_cancelCallback(immediateQueueCallbackNode); + } + flushSyncCallbackQueueImpl(); +} + +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + try { + var _isSync = true; + var queue = syncQueue; + runWithPriority$1(ImmediatePriority, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + callback = callback(_isSync); + } while (callback !== null); + } + }); + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); + } + // Resume flushing in the next tick + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ); + throw error; + } finally { + isFlushingSyncQueue = false; + } + } +} + +var NoMode = 0; +var StrictMode = 1; +// TODO: Remove BatchedMode and ConcurrentMode by reading from the root +// tag instead +var BatchedMode = 2; +var ConcurrentMode = 4; +var ProfileMode = 8; + +// Max 31 bit integer. The max integer size in V8 for 32-bit systems. +// Math.pow(2, 30) - 1 +// 0b111111111111111111111111111111 +var MAX_SIGNED_31_BIT_INT = 1073741823; + +var NoWork = 0; +var Never = 1; +var Sync = MAX_SIGNED_31_BIT_INT; +var Batched = Sync - 1; + +var UNIT_SIZE = 10; +var MAGIC_NUMBER_OFFSET = Batched - 1; + +// 1 unit of expiration time represents 10ms. +function msToExpirationTime(ms) { + // Always add an offset so that we don't clash with the magic number for NoWork. + return MAGIC_NUMBER_OFFSET - ((ms / UNIT_SIZE) | 0); +} + +function expirationTimeToMs(expirationTime) { + return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE; +} + +function ceiling(num, precision) { + return (((num / precision) | 0) + 1) * precision; +} + +function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { + return ( + MAGIC_NUMBER_OFFSET - + ceiling( + MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, + bucketSizeMs / UNIT_SIZE + ) + ); +} + +// TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update +// the names to reflect. +var LOW_PRIORITY_EXPIRATION = 5000; +var LOW_PRIORITY_BATCH_SIZE = 250; + +function computeAsyncExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + LOW_PRIORITY_EXPIRATION, + LOW_PRIORITY_BATCH_SIZE + ); +} + +function computeSuspenseExpiration(currentTime, timeoutMs) { + // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time? + return computeExpirationBucket( + currentTime, + timeoutMs, + LOW_PRIORITY_BATCH_SIZE + ); +} + +// We intentionally set a higher expiration time for interactive updates in +// dev than in production. +// +// If the main thread is being blocked so long that you hit the expiration, +// it's a problem that could be solved with better scheduling. +// +// People will be more likely to notice this and fix it with the long +// expiration time in development. +// +// In production we opt for better UX at the risk of masking scheduling +// problems, by expiring fast. +var HIGH_PRIORITY_EXPIRATION = 500; +var HIGH_PRIORITY_BATCH_SIZE = 100; + +function computeInteractiveExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + HIGH_PRIORITY_EXPIRATION, + HIGH_PRIORITY_BATCH_SIZE + ); +} + +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (expirationTime === Sync) { + return ImmediatePriority; + } + if (expirationTime === Never) { + return IdlePriority; + } + var msUntil = + expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime); + if (msUntil <= 0) { + return ImmediatePriority; + } + if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) { + return UserBlockingPriority$1; + } + if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) { + return NormalPriority; + } + + // TODO: Handle LowPriority + + // Assume anything lower has idle priority + return IdlePriority; +} + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return ( + (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare + ); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if ( typeof objA !== "object" || objA === null || typeof objB !== "object" || @@ -6133,32 +6320,27 @@ var lowPriorityWarning = function() {}; var lowPriorityWarning$1 = lowPriorityWarning; var ReactStrictModeWarnings = { - discardPendingWarnings: function() {}, - flushPendingDeprecationWarnings: function() {}, - flushPendingUnsafeLifecycleWarnings: function() {}, - recordDeprecationWarnings: function(fiber, instance) {}, recordUnsafeLifecycleWarnings: function(fiber, instance) {}, + flushPendingUnsafeLifecycleWarnings: function() {}, recordLegacyContextWarning: function(fiber, instance) {}, - flushLegacyContextWarning: function() {} + flushLegacyContextWarning: function() {}, + discardPendingWarnings: function() {} }; { - var LIFECYCLE_SUGGESTIONS = { - UNSAFE_componentWillMount: "componentDidMount", - UNSAFE_componentWillReceiveProps: "static getDerivedStateFromProps", - UNSAFE_componentWillUpdate: "componentDidUpdate" - }; + var findStrictRoot = function(fiber) { + var maybeStrictRoot = null; - var pendingComponentWillMountWarnings = []; - var pendingComponentWillReceivePropsWarnings = []; - var pendingComponentWillUpdateWarnings = []; - var pendingUnsafeLifecycleWarnings = new Map(); - var pendingLegacyContextWarning = new Map(); + var node = fiber; + while (node !== null) { + if (node.mode & StrictMode) { + maybeStrictRoot = node; + } + node = node.return; + } - // Tracks components we have already warned about. - var didWarnAboutDeprecatedLifecycles = new Set(); - var didWarnAboutUnsafeLifecycles = new Set(); - var didWarnAboutLegacyContext = new Set(); + return maybeStrictRoot; + }; var setToSortedString = function(set) { var array = []; @@ -6168,241 +6350,250 @@ var ReactStrictModeWarnings = { return array.sort().join(", "); }; - ReactStrictModeWarnings.discardPendingWarnings = function() { - pendingComponentWillMountWarnings = []; - pendingComponentWillReceivePropsWarnings = []; - pendingComponentWillUpdateWarnings = []; - pendingUnsafeLifecycleWarnings = new Map(); - pendingLegacyContextWarning = new Map(); - }; + var pendingComponentWillMountWarnings = []; + var pendingUNSAFE_ComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUNSAFE_ComponentWillUpdateWarnings = []; - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { - pendingUnsafeLifecycleWarnings.forEach(function( - lifecycleWarningsMap, - strictRoot - ) { - var lifecyclesWarningMessages = []; - - Object.keys(lifecycleWarningsMap).forEach(function(lifecycle) { - var lifecycleWarnings = lifecycleWarningsMap[lifecycle]; - if (lifecycleWarnings.length > 0) { - var componentNames = new Set(); - lifecycleWarnings.forEach(function(fiber) { - componentNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - - var formatted = lifecycle.replace("UNSAFE_", ""); - var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle]; - var sortedComponentNames = setToSortedString(componentNames); + // Tracks components we have already warned about. + var didWarnAboutUnsafeLifecycles = new Set(); - lifecyclesWarningMessages.push( - formatted + - ": Please update the following components to use " + - (suggestion + " instead: " + sortedComponentNames) - ); - } - }); + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( + fiber, + instance + ) { + // Dedup strategy: Warn once per component. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { + return; + } - if (lifecyclesWarningMessages.length > 0) { - var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); + if ( + typeof instance.componentWillMount === "function" && + // Don't warn about react-lifecycles-compat polyfilled components. + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + pendingComponentWillMountWarnings.push(fiber); + } - warningWithoutStack$1( - false, - "Unsafe lifecycle methods were found within a strict-mode tree:%s" + - "\n\n%s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-strict-mode-warnings", - strictRootComponentStack, - lifecyclesWarningMessages.join("\n\n") - ); - } - }); + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillMount === "function" + ) { + pendingUNSAFE_ComponentWillMountWarnings.push(fiber); + } - pendingUnsafeLifecycleWarnings = new Map(); - }; + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + pendingComponentWillReceivePropsWarnings.push(fiber); + } - var findStrictRoot = function(fiber) { - var maybeStrictRoot = null; + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); + } - var node = fiber; - while (node !== null) { - if (node.mode & StrictMode) { - maybeStrictRoot = node; - } - node = node.return; + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + pendingComponentWillUpdateWarnings.push(fiber); } - return maybeStrictRoot; + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillUpdate === "function" + ) { + pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); + } }; - ReactStrictModeWarnings.flushPendingDeprecationWarnings = function() { + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { + // We do an initial pass to gather component names + var componentWillMountUniqueNames = new Set(); if (pendingComponentWillMountWarnings.length > 0) { - var uniqueNames = new Set(); pendingComponentWillMountWarnings.forEach(function(fiber) { - uniqueNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); + componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); }); - - var sortedNames = setToSortedString(uniqueNames); - - lowPriorityWarning$1( - false, - "componentWillMount is deprecated and will be removed in the next major version. " + - "Use componentDidMount instead. As a temporary workaround, " + - "you can rename to UNSAFE_componentWillMount." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - sortedNames - ); - pendingComponentWillMountWarnings = []; } + var UNSAFE_componentWillMountUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { + pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { + UNSAFE_componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillMountWarnings = []; + } + + var componentWillReceivePropsUniqueNames = new Set(); if (pendingComponentWillReceivePropsWarnings.length > 0) { - var _uniqueNames = new Set(); pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { - _uniqueNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); + componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); }); - var _sortedNames = setToSortedString(_uniqueNames); + pendingComponentWillReceivePropsWarnings = []; + } - lowPriorityWarning$1( - false, - "componentWillReceiveProps is deprecated and will be removed in the next major version. " + - "Use static getDerivedStateFromProps instead." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - _sortedNames - ); + var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { + UNSAFE_componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); - pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; } + var componentWillUpdateUniqueNames = new Set(); if (pendingComponentWillUpdateWarnings.length > 0) { - var _uniqueNames2 = new Set(); pendingComponentWillUpdateWarnings.forEach(function(fiber) { - _uniqueNames2.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); + componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); }); - var _sortedNames2 = setToSortedString(_uniqueNames2); - - lowPriorityWarning$1( - false, - "componentWillUpdate is deprecated and will be removed in the next major version. " + - "Use componentDidUpdate instead. As a temporary workaround, " + - "you can rename to UNSAFE_componentWillUpdate." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - _sortedNames2 - ); - pendingComponentWillUpdateWarnings = []; } - }; - ReactStrictModeWarnings.recordDeprecationWarnings = function( - fiber, - instance - ) { - // Dedup strategy: Warn once per component. - if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) { - return; - } + var UNSAFE_componentWillUpdateUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { + pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { + UNSAFE_componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); - // Don't warn about react-lifecycles-compat polyfilled components. - if ( - typeof instance.componentWillMount === "function" && - instance.componentWillMount.__suppressDeprecationWarning !== true - ) { - pendingComponentWillMountWarnings.push(fiber); - } - if ( - typeof instance.componentWillReceiveProps === "function" && - instance.componentWillReceiveProps.__suppressDeprecationWarning !== true - ) { - pendingComponentWillReceivePropsWarnings.push(fiber); + pendingUNSAFE_ComponentWillUpdateWarnings = []; } - if ( - typeof instance.componentWillUpdate === "function" && - instance.componentWillUpdate.__suppressDeprecationWarning !== true - ) { - pendingComponentWillUpdateWarnings.push(fiber); + + // Finally, we flush all the warnings + // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' + if (UNSAFE_componentWillMountUniqueNames.size > 0) { + var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "\nPlease update the following components: %s", + sortedNames + ); } - }; - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( - fiber, - instance - ) { - var strictRoot = findStrictRoot(fiber); - if (strictRoot === null) { + if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames = setToSortedString( + UNSAFE_componentWillReceivePropsUniqueNames + ); warningWithoutStack$1( false, - "Expected to find a StrictMode component in a strict mode tree. " + - "This error is likely caused by a bug in React. Please file an issue." + "Using UNSAFE_componentWillReceiveProps in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, " + + "refactor your code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "\nPlease update the following components: %s", + _sortedNames ); - return; } - // Dedup strategy: Warn once per component. - // This is difficult to track any other way since component names - // are often vague and are likely to collide between 3rd party libraries. - // An expand property is probably okay to use here since it's DEV-only, - // and will only be set in the event of serious warnings. - if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { - return; + if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { + var _sortedNames2 = setToSortedString( + UNSAFE_componentWillUpdateUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillUpdate in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "\nPlease update the following components: %s", + _sortedNames2 + ); } - var warningsForRoot = void 0; - if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) { - warningsForRoot = { - UNSAFE_componentWillMount: [], - UNSAFE_componentWillReceiveProps: [], - UNSAFE_componentWillUpdate: [] - }; + if (componentWillMountUniqueNames.size > 0) { + var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); - pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot); - } else { - warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot); + lowPriorityWarning$1( + false, + "componentWillMount has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "* Rename componentWillMount to UNSAFE_componentWillMount to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames3 + ); } - var unsafeLifecycles = []; - if ( - (typeof instance.componentWillMount === "function" && - instance.componentWillMount.__suppressDeprecationWarning !== true) || - typeof instance.UNSAFE_componentWillMount === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillMount"); - } - if ( - (typeof instance.componentWillReceiveProps === "function" && - instance.componentWillReceiveProps.__suppressDeprecationWarning !== - true) || - typeof instance.UNSAFE_componentWillReceiveProps === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillReceiveProps"); - } - if ( - (typeof instance.componentWillUpdate === "function" && - instance.componentWillUpdate.__suppressDeprecationWarning !== true) || - typeof instance.UNSAFE_componentWillUpdate === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillUpdate"); + if (componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames4 = setToSortedString( + componentWillReceivePropsUniqueNames + ); + + lowPriorityWarning$1( + false, + "componentWillReceiveProps has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, refactor your " + + "code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames4 + ); } - if (unsafeLifecycles.length > 0) { - unsafeLifecycles.forEach(function(lifecycle) { - warningsForRoot[lifecycle].push(fiber); - }); + if (componentWillUpdateUniqueNames.size > 0) { + var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); + + lowPriorityWarning$1( + false, + "componentWillUpdate has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames5 + ); } }; + var pendingLegacyContextWarning = new Map(); + + // Tracks components we have already warned about. + var didWarnAboutLegacyContext = new Set(); + ReactStrictModeWarnings.recordLegacyContextWarning = function( fiber, instance @@ -6451,77 +6642,499 @@ var ReactStrictModeWarnings = { warningWithoutStack$1( false, "Legacy context API has been detected within a strict-mode tree: %s" + + "\n\nThe old API will be supported in all 16.x releases, but applications " + + "using it should migrate to the new version." + "\n\nPlease update the following components: %s" + "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-strict-mode-warnings", + "\nhttps://fb.me/react-legacy-context", strictRootComponentStack, sortedNames ); }); }; + + ReactStrictModeWarnings.discardPendingWarnings = function() { + pendingComponentWillMountWarnings = []; + pendingUNSAFE_ComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUNSAFE_ComponentWillUpdateWarnings = []; + pendingLegacyContextWarning = new Map(); + }; } -function resolveDefaultProps(Component, baseProps) { - if (Component && Component.defaultProps) { - // Resolve default props. Taken from ReactElement - var props = Object.assign({}, baseProps); - var defaultProps = Component.defaultProps; - for (var propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - return props; +// Resolves type to a family. + +// Used by React Refresh runtime through DevTools Global Hook. + +var resolveFamily = null; +// $FlowFixMe Flow gets confused by a WeakSet feature check below. +var failedBoundaries = null; + +var setRefreshHandler = function(handler) { + { + resolveFamily = handler; } - return baseProps; -} +}; -function readLazyComponentType(lazyComponent) { - var status = lazyComponent._status; - var result = lazyComponent._result; - switch (status) { - case Resolved: { - var Component = result; - return Component; +function resolveFunctionForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; } - case Rejected: { - var error = result; - throw error; + var family = resolveFamily(type); + if (family === undefined) { + return type; } - case Pending: { - var thenable = result; - throw thenable; + // Use the latest known implementation. + return family.current; + } +} + +function resolveClassForHotReloading(type) { + // No implementation differences. + return resolveFunctionForHotReloading(type); +} + +function resolveForwardRefForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; } - default: { - lazyComponent._status = Pending; - var ctor = lazyComponent._ctor; - var _thenable = ctor(); - _thenable.then( - function(moduleObject) { - if (lazyComponent._status === Pending) { - var defaultExport = moduleObject.default; - { - if (defaultExport === undefined) { - warning$1( - false, - "lazy: Expected the result of a dynamic import() call. " + - "Instead received: %s\n\nYour code should look like: \n " + - "const MyComponent = lazy(() => import('./MyComponent'))", - moduleObject - ); - } - } - lazyComponent._status = Resolved; - lazyComponent._result = defaultExport; - } - }, - function(error) { - if (lazyComponent._status === Pending) { - lazyComponent._status = Rejected; - lazyComponent._result = error; + var family = resolveFamily(type); + if (family === undefined) { + // Check if we're dealing with a real forwardRef. Don't want to crash early. + if ( + type !== null && + type !== undefined && + typeof type.render === "function" + ) { + // ForwardRef is special because its resolved .type is an object, + // but it's possible that we only have its inner render function in the map. + // If that inner render function is different, we'll build a new forwardRef type. + var currentRender = resolveFunctionForHotReloading(type.render); + if (type.render !== currentRender) { + var syntheticType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: currentRender + }; + if (type.displayName !== undefined) { + syntheticType.displayName = type.displayName; } + return syntheticType; } - ); + } + return type; + } + // Use the latest known implementation. + return family.current; + } +} + +function isCompatibleFamilyForHotReloading(fiber, element) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return false; + } + + var prevType = fiber.elementType; + var nextType = element.type; + + // If we got here, we know types aren't === equal. + var needsCompareFamilies = false; + + var $$typeofNextType = + typeof nextType === "object" && nextType !== null + ? nextType.$$typeof + : null; + + switch (fiber.tag) { + case ClassComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } + break; + } + case FunctionComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + // We don't know the inner type yet. + // We're going to assume that the lazy inner type is stable, + // and so it is sufficient to avoid reconciling it away. + // We're not going to unwrap or actually use the new lazy type. + needsCompareFamilies = true; + } + break; + } + case ForwardRef: { + if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + case MemoComponent: + case SimpleMemoComponent: { + if ($$typeofNextType === REACT_MEMO_TYPE) { + // TODO: if it was but can no longer be simple, + // we shouldn't set this. + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + default: + return false; + } + + // Check if both types have a family and it's the same one. + if (needsCompareFamilies) { + // Note: memo() and forwardRef() we'll compare outer rather than inner type. + // This means both of them need to be registered to preserve state. + // If we unwrapped and compared the inner types for wrappers instead, + // then we would risk falsely saying two separate memo(Foo) + // calls are equivalent because they wrap the same Foo function. + var prevFamily = resolveFamily(prevType); + if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { + return true; + } + } + return false; + } +} + +function markFailedErrorBoundaryForHotReloading(fiber) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + if (typeof WeakSet !== "function") { + return; + } + if (failedBoundaries === null) { + failedBoundaries = new WeakSet(); + } + failedBoundaries.add(fiber); + } +} + +var scheduleRefresh = function(root, update) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + var _staleFamilies = update.staleFamilies, + _updatedFamilies = update.updatedFamilies; + + flushPassiveEffects(); + flushSync(function() { + scheduleFibersWithFamiliesRecursively( + root.current, + _updatedFamilies, + _staleFamilies + ); + }); + } +}; + +var scheduleRoot = function(root, element) { + { + if (root.context !== emptyContextObject) { + // Super edge case: root has a legacy _renderSubtree context + // but we don't know the parentComponent so we can't pass it. + // Just ignore. We'll delete this with _renderSubtree code path later. + return; + } + flushPassiveEffects(); + updateContainerAtExpirationTime(element, root, null, Sync, null); + } +}; + +function scheduleFibersWithFamiliesRecursively( + fiber, + updatedFamilies, + staleFamilies +) { + { + var alternate = fiber.alternate, + child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + if (resolveFamily === null) { + throw new Error("Expected resolveFamily to be set during hot reload."); + } + + var needsRender = false; + var needsRemount = false; + if (candidateType !== null) { + var family = resolveFamily(candidateType); + if (family !== undefined) { + if (staleFamilies.has(family)) { + needsRemount = true; + } else if (updatedFamilies.has(family)) { + if (tag === ClassComponent) { + needsRemount = true; + } else { + needsRender = true; + } + } + } + } + if (failedBoundaries !== null) { + if ( + failedBoundaries.has(fiber) || + (alternate !== null && failedBoundaries.has(alternate)) + ) { + needsRemount = true; + } + } + + if (needsRemount) { + fiber._debugNeedsRemount = true; + } + if (needsRemount || needsRender) { + scheduleWork(fiber, Sync); + } + if (child !== null && !needsRemount) { + scheduleFibersWithFamiliesRecursively( + child, + updatedFamilies, + staleFamilies + ); + } + if (sibling !== null) { + scheduleFibersWithFamiliesRecursively( + sibling, + updatedFamilies, + staleFamilies + ); + } + } +} + +var findHostInstancesForRefresh = function(root, families) { + { + var hostInstances = new Set(); + var types = new Set( + families.map(function(family) { + return family.current; + }) + ); + findHostInstancesForMatchingFibersRecursively( + root.current, + types, + hostInstances + ); + return hostInstances; + } +}; + +function findHostInstancesForMatchingFibersRecursively( + fiber, + types, + hostInstances +) { + { + var child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + var didMatch = false; + if (candidateType !== null) { + if (types.has(candidateType)) { + didMatch = true; + } + } + + if (didMatch) { + // We have a match. This only drills down to the closest host components. + // There's no need to search deeper because for the purpose of giving + // visual feedback, "flashing" outermost parent rectangles is sufficient. + findHostInstancesForFiberShallowly(fiber, hostInstances); + } else { + // If there's no match, maybe there will be one further down in the child tree. + if (child !== null) { + findHostInstancesForMatchingFibersRecursively( + child, + types, + hostInstances + ); + } + } + + if (sibling !== null) { + findHostInstancesForMatchingFibersRecursively( + sibling, + types, + hostInstances + ); + } + } +} + +function findHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var foundHostInstances = findChildHostInstancesForFiberShallowly( + fiber, + hostInstances + ); + if (foundHostInstances) { + return; + } + // If we didn't find any host children, fallback to closest host parent. + var node = fiber; + while (true) { + switch (node.tag) { + case HostComponent: + hostInstances.add(node.stateNode); + return; + case HostPortal: + hostInstances.add(node.stateNode.containerInfo); + return; + case HostRoot: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (node.return === null) { + throw new Error("Expected to reach root first."); + } + node = node.return; + } + } +} + +function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var node = fiber; + var foundHostInstances = false; + while (true) { + if (node.tag === HostComponent) { + // We got a match. + foundHostInstances = true; + hostInstances.add(node.stateNode); + // There may still be more, so keep searching. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === fiber) { + return foundHostInstances; + } + while (node.sibling === null) { + if (node.return === null || node.return === fiber) { + return foundHostInstances; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return false; +} + +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + // Resolve default props. Taken from ReactElement + var props = Object.assign({}, baseProps); + var defaultProps = Component.defaultProps; + for (var propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + return props; + } + return baseProps; +} + +function readLazyComponentType(lazyComponent) { + var status = lazyComponent._status; + var result = lazyComponent._result; + switch (status) { + case Resolved: { + var Component = result; + return Component; + } + case Rejected: { + var error = result; + throw error; + } + case Pending: { + var thenable = result; + throw thenable; + } + default: { + lazyComponent._status = Pending; + var ctor = lazyComponent._ctor; + var _thenable = ctor(); + _thenable.then( + function(moduleObject) { + if (lazyComponent._status === Pending) { + var defaultExport = moduleObject.default; + { + if (defaultExport === undefined) { + warning$1( + false, + "lazy: Expected the result of a dynamic import() call. " + + "Instead received: %s\n\nYour code should look like: \n " + + "const MyComponent = lazy(() => import('./MyComponent'))", + moduleObject + ); + } + } + lazyComponent._status = Resolved; + lazyComponent._result = defaultExport; + } + }, + function(error) { + if (lazyComponent._status === Pending) { + lazyComponent._status = Rejected; + lazyComponent._result = error; + } + } + ); // Handle synchronous thenables. switch (lazyComponent._status) { case Resolved: @@ -6549,7 +7162,7 @@ var lastContextWithAllBitsObserved = null; var isDisallowedContextReadInDEV = false; -function resetContextDependences() { +function resetContextDependencies() { // This is called right before React yields execution, to ensure `readContext` // cannot be called outside the render phase. currentlyRenderingFiber = null; @@ -6694,11 +7307,11 @@ function propagateContextChange( var nextFiber = void 0; // Visit this fiber. - var list = fiber.contextDependencies; + var list = fiber.dependencies; if (list !== null) { nextFiber = fiber.child; - var dependency = list.first; + var dependency = list.firstContext; while (dependency !== null) { // Check if the context matches. if ( @@ -6709,7 +7322,7 @@ function propagateContextChange( if (fiber.tag === ClassComponent) { // Schedule a force update on the work-in-progress. - var update = createUpdate(renderExpirationTime); + var update = createUpdate(renderExpirationTime, null); update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the // update to the current fiber, too, which means it will persist even if @@ -6805,17 +7418,18 @@ function prepareToReadContext(workInProgress, renderExpirationTime) { lastContextDependency = null; lastContextWithAllBitsObserved = null; - var currentDependencies = workInProgress.contextDependencies; - if ( - currentDependencies !== null && - currentDependencies.expirationTime >= renderExpirationTime - ) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); + var dependencies = workInProgress.dependencies; + if (dependencies !== null) { + var firstContext = dependencies.firstContext; + if (firstContext !== null) { + if (dependencies.expirationTime >= renderExpirationTime) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } + // Reset the work-in-progress list + dependencies.firstContext = null; + } } - - // Reset the work-in-progress list - workInProgress.contextDependencies = null; } function readContext(context, observedBits) { @@ -6860,16 +7474,19 @@ function readContext(context, observedBits) { (function() { if (!(currentlyRenderingFiber !== null)) { throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); } })(); // This is the first dependency for this component. Create a new list. lastContextDependency = contextItem; - currentlyRenderingFiber.contextDependencies = { - first: contextItem, - expirationTime: NoWork + currentlyRenderingFiber.dependencies = { + expirationTime: NoWork, + firstContext: contextItem, + responders: null }; } else { // Append a new context item. @@ -7009,9 +7626,10 @@ function cloneUpdateQueue(currentQueue) { return queue; } -function createUpdate(expirationTime) { - return { +function createUpdate(expirationTime, suspenseConfig) { + var update = { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: UpdateState, payload: null, @@ -7020,6 +7638,10 @@ function createUpdate(expirationTime) { next: null, nextEffect: null }; + { + update.priority = getCurrentPriorityLevel(); + } + return update; } function appendUpdateToQueue(queue, update) { @@ -7272,7 +7894,7 @@ function processUpdateQueue( // TODO: We should skip this update if it was already committed but currently // we have no way of detecting the difference between a committed and suspended // update here. - markRenderEventTime(updateExpirationTime); + markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process it and compute a new result. resultState = getStateFromUpdate( @@ -7386,8 +8008,10 @@ function callCallback(callback, context) { (function() { if (!(typeof callback === "function")) { throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - callback + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + callback + ) ); } })(); @@ -7441,6 +8065,12 @@ function commitUpdateEffects(effect, instance) { } } +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + +function requestCurrentSuspenseConfig() { + return ReactCurrentBatchConfig.suspense; +} + var fakeInternalInstance = {}; var isArray$1 = Array.isArray; @@ -7514,7 +8144,9 @@ var didWarnAboutInvalidateContextType = void 0; (function() { { throw ReactError( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + Error( + "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + ) ); } })(); @@ -7565,11 +8197,16 @@ function applyDerivedStateFromProps( var classComponentUpdater = { isMounted: isMounted, enqueueSetState: function(inst, payload, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.payload = payload; if (callback !== undefined && callback !== null) { { @@ -7578,16 +8215,23 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); }, enqueueReplaceState: function(inst, payload, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.tag = ReplaceState; update.payload = payload; @@ -7598,16 +8242,23 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); }, enqueueForceUpdate: function(inst, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.tag = ForceUpdate; if (callback !== undefined && callback !== null) { @@ -7617,7 +8268,9 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); } @@ -7732,28 +8385,48 @@ function checkClassInstance(workInProgress, ctor, newProps) { name ) : void 0; - var noInstanceContextTypes = !instance.contextTypes; - !noInstanceContextTypes - ? warningWithoutStack$1( + + if (disableLegacyContext) { + if (ctor.childContextTypes) { + warningWithoutStack$1( false, - "contextTypes was defined as an instance property on %s. Use a static " + - "property to define contextTypes instead.", + "%s uses the legacy childContextTypes API which is no longer supported. " + + "Use React.createContext() instead.", name - ) - : void 0; + ); + } + if (ctor.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with static contextType instead.", + name + ); + } + } else { + var noInstanceContextTypes = !instance.contextTypes; + !noInstanceContextTypes + ? warningWithoutStack$1( + false, + "contextTypes was defined as an instance property on %s. Use a static " + + "property to define contextTypes instead.", + name + ) + : void 0; - if ( - ctor.contextType && - ctor.contextTypes && - !didWarnAboutContextTypeAndContextTypes.has(ctor) - ) { - didWarnAboutContextTypeAndContextTypes.add(ctor); - warningWithoutStack$1( - false, - "%s declares both contextTypes and contextType static properties. " + - "The legacy contextTypes property will be ignored.", - name - ); + if ( + ctor.contextType && + ctor.contextTypes && + !didWarnAboutContextTypeAndContextTypes.has(ctor) + ) { + didWarnAboutContextTypeAndContextTypes.add(ctor); + warningWithoutStack$1( + false, + "%s declares both contextTypes and contextType static properties. " + + "The legacy contextTypes property will be ignored.", + name + ); + } } var noComponentShouldUpdate = @@ -7929,7 +8602,7 @@ function constructClassInstance( ) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; - var context = null; + var context = emptyContextObject; var contextType = ctor.contextType; { @@ -7977,7 +8650,7 @@ function constructClassInstance( if (typeof contextType === "object" && contextType !== null) { context = readContext(contextType); - } else { + } else if (!disableLegacyContext) { unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); var contextTypes = ctor.contextTypes; isLegacyContextConsumer = @@ -8179,6 +8852,8 @@ function mountClassInstance( var contextType = ctor.contextType; if (typeof contextType === "object" && contextType !== null) { instance.context = readContext(contextType); + } else if (disableLegacyContext) { + instance.context = emptyContextObject; } else { var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); instance.context = getMaskedContext(workInProgress, unmaskedContext); @@ -8200,11 +8875,6 @@ function mountClassInstance( } if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( - workInProgress, - instance - ); - ReactStrictModeWarnings.recordLegacyContextWarning( workInProgress, instance @@ -8212,7 +8882,7 @@ function mountClassInstance( } if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.recordDeprecationWarnings( + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( workInProgress, instance ); @@ -8284,10 +8954,10 @@ function resumeMountClassInstance( var oldContext = instance.context; var contextType = ctor.contextType; - var nextContext = void 0; + var nextContext = emptyContextObject; if (typeof contextType === "object" && contextType !== null) { nextContext = readContext(contextType); - } else { + } else if (!disableLegacyContext) { var nextLegacyUnmaskedContext = getUnmaskedContext( workInProgress, ctor, @@ -8433,10 +9103,10 @@ function updateClassInstance( var oldContext = instance.context; var contextType = ctor.contextType; - var nextContext = void 0; + var nextContext = emptyContextObject; if (typeof contextType === "object" && contextType !== null) { nextContext = readContext(contextType); - } else { + } else if (!disableLegacyContext) { var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); } @@ -8592,7 +9262,7 @@ function updateClassInstance( var didWarnAboutMaps = void 0; var didWarnAboutGenerators = void 0; -var didWarnAboutStringRefInStrictMode = void 0; +var didWarnAboutStringRefs = void 0; var ownerHasKeyUseWarning = void 0; var ownerHasFunctionTypeWarning = void 0; var warnForMissingKey = function(child) {}; @@ -8600,7 +9270,7 @@ var warnForMissingKey = function(child) {}; { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefInStrictMode = {}; + didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or @@ -8620,7 +9290,9 @@ var warnForMissingKey = function(child) {}; (function() { if (!(typeof child._store === "object")) { throw ReactError( - "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + Error( + "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -8655,21 +9327,38 @@ function coerceRef(returnFiber, current$$1, element) { typeof mixedRef !== "object" ) { { - if (returnFiber.mode & StrictMode) { + // TODO: Clean this up once we turn on the string ref warning for + // everyone, because the strict mode case will no longer be relevant + if (returnFiber.mode & StrictMode || warnAboutStringRefs) { var componentName = getComponentName(returnFiber.type) || "Component"; - if (!didWarnAboutStringRefInStrictMode[componentName]) { - warningWithoutStack$1( - false, - 'A string ref, "%s", has been found within a strict mode tree. ' + - "String refs are a source of potential bugs and should be avoided. " + - "We recommend using createRef() instead." + - "\n%s" + - "\n\nLearn more about using refs safely here:" + - "\nhttps://fb.me/react-strict-mode-string-ref", - mixedRef, - getStackByFiberInDevAndProd(returnFiber) - ); - didWarnAboutStringRefInStrictMode[componentName] = true; + if (!didWarnAboutStringRefs[componentName]) { + if (warnAboutStringRefs) { + warningWithoutStack$1( + false, + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + componentName, + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } else { + warningWithoutStack$1( + false, + 'A string ref, "%s", has been found within a strict mode tree. ' + + "String refs are a source of potential bugs and should be avoided. " + + "We recommend using useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } + didWarnAboutStringRefs[componentName] = true; } } } @@ -8682,7 +9371,9 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!(ownerFiber.tag === ClassComponent)) { throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); } })(); @@ -8691,9 +9382,11 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!inst) { throw ReactError( - "Missing owner for string ref " + - mixedRef + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + mixedRef + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -8725,16 +9418,20 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!(typeof mixedRef === "string")) { throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); } })(); (function() { if (!element._owner) { throw ReactError( - "Element ref was specified as a string (" + - mixedRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } })(); @@ -8755,12 +9452,14 @@ function throwOnInvalidObjectType(returnFiber, newChild) { (function() { { throw ReactError( - "Objects are not valid as a React child (found: " + - (Object.prototype.toString.call(newChild) === "[object Object]" - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + - addendum + Error( + "Objects are not valid as a React child (found: " + + (Object.prototype.toString.call(newChild) === "[object Object]" + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + + addendum + ) ); } })(); @@ -8912,7 +9611,12 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateElement(returnFiber, current$$1, element, expirationTime) { - if (current$$1 !== null && current$$1.elementType === element.type) { + if ( + current$$1 !== null && + (current$$1.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(current$$1, element)) + ) { // Move based on index var existing = useFiber(current$$1, element.props, expirationTime); existing.ref = coerceRef(returnFiber, current$$1, element); @@ -9425,7 +10129,9 @@ function ChildReconciler(shouldTrackSideEffects) { (function() { if (!(typeof iteratorFn === "function")) { throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -9480,7 +10186,7 @@ function ChildReconciler(shouldTrackSideEffects) { var newChildren = iteratorFn.call(newChildrenIterable); (function() { if (!(newChildren != null)) { - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); } })(); @@ -9656,7 +10362,9 @@ function ChildReconciler(shouldTrackSideEffects) { if ( child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE - : child.elementType === element.type + : child.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(child, element) ) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber( @@ -9856,8 +10564,10 @@ function ChildReconciler(shouldTrackSideEffects) { (function() { { throw ReactError( - (Component.displayName || Component.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (Component.displayName || Component.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) ); } })(); @@ -9878,7 +10588,7 @@ var mountChildFibers = ChildReconciler(false); function cloneChildFibers(current$$1, workInProgress) { (function() { if (!(current$$1 === null || workInProgress.child === current$$1.child)) { - throw ReactError("Resuming work not yet implemented."); + throw ReactError(Error("Resuming work not yet implemented.")); } })(); @@ -9907,6 +10617,15 @@ function cloneChildFibers(current$$1, workInProgress) { newChild.sibling = null; } +// Reset a workInProgress child set to prepare it for a second pass. +function resetChildFibers(workInProgress, renderExpirationTime) { + var child = workInProgress.child; + while (child !== null) { + resetWorkInProgress(child, renderExpirationTime); + child = child.sibling; + } +} + var NO_CONTEXT = {}; var contextStackCursor$1 = createCursor(NO_CONTEXT); @@ -9917,7 +10636,9 @@ function requiredContext(c) { (function() { if (!(c !== NO_CONTEXT)) { throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -9976,46 +10697,158 @@ function pushHostContext(fiber) { push(contextStackCursor$1, nextContext, fiber); } -function pushHostContextForEventComponent(fiber) { - var context = requiredContext(contextStackCursor$1.current); - var nextContext = getChildHostContextForEventComponent(context); - - // Don't push this Fiber's context unless it's unique. - if (context === nextContext) { +function popHostContext(fiber) { + // Do not pop unless this Fiber provided the current context. + // pushHostContext() only pushes Fibers that provide unique contexts. + if (contextFiberStackCursor.current !== fiber) { return; } - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); } -function pushHostContextForEventTarget(fiber) { - var context = requiredContext(contextStackCursor$1.current); - var eventTargetType = fiber.type.type; - var nextContext = getChildHostContextForEventTarget(context, eventTargetType); +var DefaultSuspenseContext = 0; - // Don't push this Fiber's context unless it's unique. - if (context === nextContext) { - return; +// The Suspense Context is split into two parts. The lower bits is +// inherited deeply down the subtree. The upper bits only affect +// this immediate suspense boundary and gets reset each new +// boundary or suspense list. +var SubtreeSuspenseContextMask = 1; + +// Subtree Flags: + +// InvisibleParentSuspenseContext indicates that one of our parent Suspense +// boundaries is not currently showing visible main content. +// Either because it is already showing a fallback or is not mounted at all. +// We can use this to determine if it is desirable to trigger a fallback at +// the parent. If not, then we might need to trigger undesirable boundaries +// and/or suspend the commit to avoid hiding the parent content. +var InvisibleParentSuspenseContext = 1; + +// Shallow Flags: + +// ForceSuspenseFallback can be used by SuspenseList to force newly added +// items into their fallback state during one of the render passes. +var ForceSuspenseFallback = 2; + +var suspenseStackCursor = createCursor(DefaultSuspenseContext); + +function hasSuspenseContext(parentContext, flag) { + return (parentContext & flag) !== 0; +} + +function setDefaultShallowSuspenseContext(parentContext) { + return parentContext & SubtreeSuspenseContextMask; +} + +function setShallowSuspenseContext(parentContext, shallowContext) { + return (parentContext & SubtreeSuspenseContextMask) | shallowContext; +} + +function addSubtreeSuspenseContext(parentContext, subtreeContext) { + return parentContext | subtreeContext; +} + +function pushSuspenseContext(fiber, newContext) { + push(suspenseStackCursor, newContext, fiber); +} + +function popSuspenseContext(fiber) { + pop(suspenseStackCursor, fiber); +} + +// TODO: This is now an empty object. Should we switch this to a boolean? +// Alternatively we can make this use an effect tag similar to SuspenseList. + +function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { + // If it was the primary children that just suspended, capture and render the + var nextState = workInProgress.memoizedState; + if (nextState !== null) { + return false; + } + var props = workInProgress.memoizedProps; + // In order to capture, the Suspense component must have a fallback prop. + if (props.fallback === undefined) { + return false; + } + // Regular boundaries always capture. + if (props.unstable_avoidThisFallback !== true) { + return true; + } + // If it's a boundary we should avoid, then we prefer to bubble up to the + // parent boundary if it is currently invisible. + if (hasInvisibleParent) { + return false; } + // If the parent is not able to handle it, we must handle it. + return true; +} - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); +function findFirstSuspended(row) { + var node = row; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + return node; + } + } else if ( + node.tag === SuspenseListComponent && + // revealOrder undefined can't be trusted because it don't + // keep track of whether it suspended or not. + node.memoizedProps.revealOrder !== undefined + ) { + var didSuspend = (node.effectTag & DidCapture) !== NoEffect; + if (didSuspend) { + return node; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) { + return null; + } + while (node.sibling === null) { + if (node.return === null || node.return === row) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; } -function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; +function createResponderListener(responder, props) { + var eventResponderListener = { + responder: responder, + props: props + }; + { + Object.freeze(eventResponderListener); } + return eventResponderListener; +} - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); +function createResponderInstance( + responder, + responderProps, + responderState, + target, + fiber +) { + return { + fiber: fiber, + props: responderProps, + responder: responder, + rootEventTypes: null, + state: responderState, + target: target + }; } var NoEffect$1 = /* */ 0; @@ -10079,6 +10912,11 @@ var currentHookNameInDev = null; var hookTypesDev = null; var hookTypesUpdateIndexDev = -1; +// In DEV, this tracks whether currently rendering component needs to ignore +// the dependencies for Hooks that need them (e.g. useEffect or useMemo). +// When true, such Hooks will always be "remounted". Only used during hot reload. +var ignorePreviousDependencies = false; + function mountHookTypesDev() { { var hookName = currentHookNameInDev; @@ -10170,13 +11008,22 @@ function throwInvalidHookError() { (function() { { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } })(); } function areHookInputsEqual(nextDeps, prevDeps) { + { + if (ignorePreviousDependencies) { + // Only true when this component is being hot reloaded. + return false; + } + } + if (prevDeps === null) { { warning$1( @@ -10230,6 +11077,9 @@ function renderWithHooks( { hookTypesDev = current !== null ? current._debugHookTypes : null; hookTypesUpdateIndexDev = -1; + // Used for hot reloading: + ignorePreviousDependencies = + current !== null && current.type !== workInProgress.type; } // The following should have already been reset @@ -10272,6 +11122,11 @@ function renderWithHooks( do { didScheduleRenderPhaseUpdate = false; numberOfReRenders += 1; + { + // Even when hot reloading, allow dependencies to stabilize + // after first render to prevent infinite render phase updates. + ignorePreviousDependencies = false; + } // Start over from the beginning of the list nextCurrentHook = current !== null ? current.memoizedState : null; @@ -10341,7 +11196,9 @@ function renderWithHooks( (function() { if (!!didRenderTooFewHooks) { throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); } })(); @@ -10429,7 +11286,7 @@ function updateWorkInProgressHook() { (function() { if (!(nextCurrentHook !== null)) { throw ReactError( - "Rendered more hooks than during the previous render." + Error("Rendered more hooks than during the previous render.") ); } })(); @@ -10497,7 +11354,9 @@ function updateReducer(reducer, initialArg, init) { (function() { if (!(queue !== null)) { throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); } })(); @@ -10530,7 +11389,7 @@ function updateReducer(reducer, initialArg, init) { } hook.memoizedState = newState; - // Don't persist the state accumlated from the render phase updates to + // Don't persist the state accumulated from the render phase updates to // the base state unless the queue is empty. // TODO: Not sure if this is the desired semantics, but it's what we // do for gDSFP. I can't remember why. @@ -10596,7 +11455,10 @@ function updateReducer(reducer, initialArg, init) { // TODO: We should skip this update if it was already committed but currently // we have no way of detecting the difference between a committed and suspended // update here. - markRenderEventTime(updateExpirationTime); + markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ); // Process this update. if (_update.eagerReducer === reducer) { @@ -10729,6 +11591,12 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { } function mountEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } return mountEffectImpl( Update | Passive, UnmountPassive | MountPassive, @@ -10738,6 +11606,12 @@ function mountEffect(create, deps) { } function updateEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } return updateEffectImpl( Update | Passive, UnmountPassive | MountPassive, @@ -10891,7 +11765,9 @@ function dispatchAction(fiber, queue, action) { (function() { if (!(numberOfReRenders < RE_RENDER_LIMIT)) { throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); } })(); @@ -10918,11 +11794,15 @@ function dispatchAction(fiber, queue, action) { didScheduleRenderPhaseUpdate = true; var update = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, next: null }; + { + update.priority = getCurrentPriorityLevel(); + } if (renderPhaseUpdates === null) { renderPhaseUpdates = new Map(); } @@ -10938,19 +11818,31 @@ function dispatchAction(fiber, queue, action) { lastRenderPhaseUpdate.next = update; } } else { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } var currentTime = requestCurrentTime(); - var _expirationTime = computeExpirationForFiber(currentTime, fiber); + var _suspenseConfig = requestCurrentSuspenseConfig(); + var _expirationTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); var _update2 = { expirationTime: _expirationTime, + suspenseConfig: _suspenseConfig, action: action, eagerReducer: null, eagerState: null, next: null }; + { + _update2.priority = getCurrentPriorityLevel(); + } + // Append the update to the end of the list. var _last = queue.last; if (_last === null) { @@ -11006,10 +11898,9 @@ function dispatchAction(fiber, queue, action) { } } { - // jest isn't a 'global', it's just exposed to tests via a wrapped function - // further, this isn't a test file, so flow doesn't recognize the symbol. So... - // $FlowExpectedError - because requirements don't give a damn about your type sigs. + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests if ("undefined" !== typeof jest) { + warnIfNotScopedWithMatchingAct(fiber); warnIfNotCurrentlyActingUpdatesInDev(fiber); } } @@ -11029,7 +11920,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }; var HooksDispatcherOnMountInDEV = null; @@ -11135,6 +12027,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; mountHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + mountHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11209,6 +12106,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11283,6 +12185,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11368,6 +12275,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11453,6 +12366,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return createResponderListener(responder, props); } }; } @@ -11515,6 +12434,17 @@ var hydrationParentFiber = null; var nextHydratableInstance = null; var isHydrating = false; +function warnIfHydrating() { + { + !!isHydrating + ? warning$1( + false, + "We should not be hydrating here. This is a bug in React. Please file a bug." + ) + : void 0; + } +} + function enterHydrationState(fiber) { if (!supportsHydration) { return false; @@ -11722,7 +12652,9 @@ function prepareToHydrateHostInstance( (function() { { throw ReactError( - "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -11752,7 +12684,9 @@ function prepareToHydrateHostTextInstance(fiber) { (function() { { throw ReactError( - "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -11802,7 +12736,9 @@ function skipPastDehydratedSuspenseInstance(fiber) { (function() { { throw ReactError( - "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -11811,7 +12747,9 @@ function skipPastDehydratedSuspenseInstance(fiber) { (function() { if (!suspenseInstance) { throw ReactError( - "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -11899,6 +12837,9 @@ var didWarnAboutGetDerivedStateOnFunctionComponent = void 0; var didWarnAboutFunctionRefs = void 0; var didWarnAboutReassigningProps = void 0; var didWarnAboutMaxDuration = void 0; +var didWarnAboutRevealOrder = void 0; +var didWarnAboutTailOptions = void 0; +var didWarnAboutDefaultPropsOnFunctionComponent = void 0; { didWarnAboutBadClass = {}; @@ -11908,6 +12849,9 @@ var didWarnAboutMaxDuration = void 0; didWarnAboutFunctionRefs = {}; didWarnAboutReassigningProps = false; didWarnAboutMaxDuration = false; + didWarnAboutRevealOrder = {}; + didWarnAboutTailOptions = {}; + didWarnAboutDefaultPropsOnFunctionComponent = {}; } function reconcileChildren( @@ -12076,18 +13020,22 @@ function updateMemoComponent( // SimpleMemoComponent codepath doesn't resolve outer props either. Component.defaultProps === undefined ) { + var resolvedType = type; + { + resolvedType = resolveFunctionForHotReloading(type); + } // If this is a plain function component without default props, // and with only the default shallow comparison, we upgrade it // to a SimpleMemoComponent to allow fast path updates. workInProgress.tag = SimpleMemoComponent; - workInProgress.type = type; + workInProgress.type = resolvedType; { validateFunctionComponentInDev(workInProgress, type); } return updateSimpleMemoComponent( current$$1, workInProgress, - type, + resolvedType, nextProps, updateExpirationTime, renderExpirationTime @@ -12207,7 +13155,9 @@ function updateSimpleMemoComponent( var prevProps = current$$1.memoizedProps; if ( shallowEqual(prevProps, nextProps) && - current$$1.ref === workInProgress.ref + current$$1.ref === workInProgress.ref && + // Prevent bailout if the implementation changed due to hot reload: + workInProgress.type === current$$1.type ) { didReceiveUpdate = false; if (updateExpirationTime < renderExpirationTime) { @@ -12300,8 +13250,11 @@ function updateFunctionComponent( } } - var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); - var context = getMaskedContext(workInProgress, unmaskedContext); + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); + context = getMaskedContext(workInProgress, unmaskedContext); + } var nextChildren = void 0; prepareToReadContext(workInProgress, renderExpirationTime); @@ -12576,7 +13529,9 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) { (function() { if (!(updateQueue !== null)) { throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -12674,10 +13629,13 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) { // Check the host config to see if the children are offscreen/hidden. if ( - renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps) ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } // Schedule this fiber to re-render at offscreen priority. Then bailout. workInProgress.expirationTime = workInProgress.childExpirationTime = Never; return null; @@ -12734,6 +13692,9 @@ function mountLazyComponent( case FunctionComponent: { { validateFunctionComponentInDev(workInProgress, Component); + workInProgress.type = Component = resolveFunctionForHotReloading( + Component + ); } child = updateFunctionComponent( null, @@ -12745,6 +13706,11 @@ function mountLazyComponent( break; } case ClassComponent: { + { + workInProgress.type = Component = resolveClassForHotReloading( + Component + ); + } child = updateClassComponent( null, workInProgress, @@ -12755,6 +13721,11 @@ function mountLazyComponent( break; } case ForwardRef: { + { + workInProgress.type = Component = resolveForwardRefForHotReloading( + Component + ); + } child = updateForwardRef( null, workInProgress, @@ -12806,10 +13777,12 @@ function mountLazyComponent( (function() { { throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." + - hint + Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." + + hint + ) ); } })(); @@ -12894,11 +13867,13 @@ function mountIndeterminateComponent( } var props = workInProgress.pendingProps; - var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); - var context = getMaskedContext(workInProgress, unmaskedContext); + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); + context = getMaskedContext(workInProgress, unmaskedContext); + } prepareToReadContext(workInProgress, renderExpirationTime); - var value = void 0; { @@ -13005,6 +13980,15 @@ function mountIndeterminateComponent( // Proceed under the assumption that this is a function component workInProgress.tag = FunctionComponent; { + if (disableLegacyContext && Component.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with React.useContext() instead.", + getComponentName(Component) || "Unknown" + ); + } + if ( debugRenderPhaseSideEffects || (debugRenderPhaseSideEffectsForStrictMode && @@ -13065,16 +14049,33 @@ function validateFunctionComponentInDev(workInProgress, Component) { } } - if (typeof Component.getDerivedStateFromProps === "function") { + if ( + warnAboutDefaultPropsOnFunctionComponents && + Component.defaultProps !== undefined + ) { var componentName = getComponentName(Component) || "Unknown"; - if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { warningWithoutStack$1( false, - "%s: Function components do not support getDerivedStateFromProps.", + "%s: Support for defaultProps will be removed from function components " + + "in a future major release. Use JavaScript default parameters instead.", componentName ); - didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; + } + } + + if (typeof Component.getDerivedStateFromProps === "function") { + var _componentName2 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) { + warningWithoutStack$1( + false, + "%s: Function components do not support getDerivedStateFromProps.", + _componentName2 + ); + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true; } } @@ -13082,19 +14083,31 @@ function validateFunctionComponentInDev(workInProgress, Component) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName2 = getComponentName(Component) || "Unknown"; + var _componentName3 = getComponentName(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { warningWithoutStack$1( false, "%s: Function components do not support contextType.", - _componentName2 + _componentName3 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; } } } +// TODO: This is now an empty object. Should we just make it a boolean? +var SUSPENDED_MARKER = {}; + +function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) { + // If the context is telling us that we should show a fallback, and we're not + // already showing content, then we should show the fallback instead. + return ( + hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && + (current$$1 === null || current$$1.memoizedState !== null) + ); +} + function updateSuspenseComponent( current$$1, workInProgress, @@ -13103,32 +14116,51 @@ function updateSuspenseComponent( var mode = workInProgress.mode; var nextProps = workInProgress.pendingProps; + // This is used by DevTools to force a boundary to suspend. { if (shouldSuspend(workInProgress)) { workInProgress.effectTag |= DidCapture; } } - // We should attempt to render the primary children unless this boundary - // already suspended during this render (`alreadyCaptured` is true). - var nextState = workInProgress.memoizedState; + var suspenseContext = suspenseStackCursor.current; - var nextDidTimeout = void 0; - if ((workInProgress.effectTag & DidCapture) === NoEffect) { - // This is the first attempt. - nextState = null; - nextDidTimeout = false; - } else { + var nextState = null; + var nextDidTimeout = false; + + if ( + (workInProgress.effectTag & DidCapture) !== NoEffect || + shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) + ) { // Something in this boundary's subtree already suspended. Switch to // rendering the fallback children. - nextState = { - fallbackExpirationTime: - nextState !== null ? nextState.fallbackExpirationTime : NoWork - }; + nextState = SUSPENDED_MARKER; nextDidTimeout = true; workInProgress.effectTag &= ~DidCapture; + } else { + // Attempting the main content + if (current$$1 === null || current$$1.memoizedState !== null) { + // This is a new mount or this boundary is already showing a fallback state. + // Mark this subtree context as having at least one invisible parent that could + // handle the fallback state. + // Boundaries without fallbacks or should be avoided are not considered since + // they cannot handle preferred fallback states. + if ( + nextProps.fallback !== undefined && + nextProps.unstable_avoidThisFallback !== true + ) { + suspenseContext = addSubtreeSuspenseContext( + suspenseContext, + InvisibleParentSuspenseContext + ); + } + } } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + + pushSuspenseContext(workInProgress, suspenseContext); + { if ("maxDuration" in nextProps) { if (!didWarnAboutMaxDuration) { @@ -13181,6 +14213,7 @@ function updateSuspenseComponent( tryToClaimNextHydratableInstance(workInProgress); // This could've changed the tag if this was a dehydrated suspense component. if (workInProgress.tag === DehydratedSuspenseComponent) { + popSuspenseContext(workInProgress); return updateDehydratedSuspenseComponent( null, workInProgress, @@ -13201,15 +14234,21 @@ function updateSuspenseComponent( NoWork, null ); + primaryChildFragment.return = workInProgress; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var progressedState = workInProgress.memoizedState; var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child; primaryChildFragment.child = progressedPrimaryChild; + var progressedChild = progressedPrimaryChild; + while (progressedChild !== null) { + progressedChild.return = primaryChildFragment; + progressedChild = progressedChild.sibling; + } } var fallbackChildFragment = createFiberFromFragment( @@ -13218,12 +14257,12 @@ function updateSuspenseComponent( renderExpirationTime, null ); + fallbackChildFragment.return = workInProgress; primaryChildFragment.sibling = fallbackChildFragment; child = primaryChildFragment; // Skip the primary children, and continue working on the // fallback children. next = fallbackChildFragment; - child.return = next.return = workInProgress; } else { // Mount the primary children without an intermediate fragment fiber. var nextPrimaryChildren = nextProps.children; @@ -13252,9 +14291,10 @@ function updateSuspenseComponent( currentPrimaryChildFragment.pendingProps, NoWork ); + _primaryChildFragment.return = workInProgress; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var _progressedState = workInProgress.memoizedState; var _progressedPrimaryChild = _progressedState !== null @@ -13262,6 +14302,11 @@ function updateSuspenseComponent( : workInProgress.child; if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) { _primaryChildFragment.child = _progressedPrimaryChild; + var _progressedChild = _progressedPrimaryChild; + while (_progressedChild !== null) { + _progressedChild.return = _primaryChildFragment; + _progressedChild = _progressedChild.sibling; + } } } @@ -13280,17 +14325,18 @@ function updateSuspenseComponent( // Clone the fallback child fragment, too. These we'll continue // working on. - var _fallbackChildFragment = (_primaryChildFragment.sibling = createWorkInProgress( + var _fallbackChildFragment = createWorkInProgress( currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime - )); + ); + _fallbackChildFragment.return = workInProgress; + _primaryChildFragment.sibling = _fallbackChildFragment; child = _primaryChildFragment; _primaryChildFragment.childExpirationTime = NoWork; // Skip the primary children, and continue working on the // fallback children. next = _fallbackChildFragment; - child.return = next.return = workInProgress; } else { // No longer suspended. Switch back to showing the primary children, // and remove the intermediate fragment fiber. @@ -13328,21 +14374,30 @@ function updateSuspenseComponent( NoWork, null ); + _primaryChildFragment2.return = workInProgress; _primaryChildFragment2.child = _currentPrimaryChild; + if (_currentPrimaryChild !== null) { + _currentPrimaryChild.return = _primaryChildFragment2; + } // Even though we're creating a new fiber, there are no new children, // because we're reusing an already mounted tree. So we don't need to // schedule a placement. // primaryChildFragment.effectTag |= Placement; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var _progressedState2 = workInProgress.memoizedState; var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child; _primaryChildFragment2.child = _progressedPrimaryChild2; + var _progressedChild2 = _progressedPrimaryChild2; + while (_progressedChild2 !== null) { + _progressedChild2.return = _primaryChildFragment2; + _progressedChild2 = _progressedChild2.sibling; + } } // Because primaryChildFragment is a new fiber that we're inserting as the @@ -13359,19 +14414,20 @@ function updateSuspenseComponent( } // Create a fragment from the fallback children, too. - var _fallbackChildFragment2 = (_primaryChildFragment2.sibling = createFiberFromFragment( + var _fallbackChildFragment2 = createFiberFromFragment( _nextFallbackChildren2, mode, renderExpirationTime, null - )); + ); + _fallbackChildFragment2.return = workInProgress; + _primaryChildFragment2.sibling = _fallbackChildFragment2; _fallbackChildFragment2.effectTag |= Placement; child = _primaryChildFragment2; _primaryChildFragment2.childExpirationTime = NoWork; // Skip the primary children, and continue working on the // fallback children. next = _fallbackChildFragment2; - child.return = next.return = workInProgress; } else { // Still haven't timed out. Continue rendering the children, like we // normally do. @@ -13406,7 +14462,9 @@ function retrySuspenseComponentWithoutHydrating( (function() { if (!(returnFiber !== null)) { throw ReactError( - "Suspense boundaries are never on the root. This is probably a bug in React." + Error( + "Suspense boundaries are never on the root. This is probably a bug in React." + ) ); } })(); @@ -13420,6 +14478,8 @@ function retrySuspenseComponentWithoutHydrating( current$$1.nextEffect = null; current$$1.effectTag = Deletion; + popSuspenseContext(workInProgress); + // Upgrade this work in progress to a real Suspense component. workInProgress.tag = SuspenseComponent; workInProgress.stateNode = null; @@ -13435,6 +14495,10 @@ function updateDehydratedSuspenseComponent( workInProgress, renderExpirationTime ) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); var suspenseInstance = workInProgress.stateNode; if (current$$1 === null) { // During the first pass, we'll bail out and not drill into the children. @@ -13461,12 +14525,18 @@ function updateDehydratedSuspenseComponent( } return null; } + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { // Something suspended. Leave the existing children in place. // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far? workInProgress.child = null; return null; } + + // We should never be hydrating at this point because it is the first pass, + // but after we've already committed once. + warnIfHydrating(); + if (isSuspenseInstanceFallback(suspenseInstance)) { // This boundary is in a permanent fallback state. In this case, we'll never // get an update and we'll never be able to hydrate the final content. Let's just try the @@ -13527,6 +14597,382 @@ function updateDehydratedSuspenseComponent( } } +function propagateSuspenseContextChange( + workInProgress, + firstChild, + renderExpirationTime +) { + // Mark any Suspense boundaries with fallbacks as having work to do. + // If they were previously forced into fallbacks, they may now be able + // to unblock. + var node = firstChild; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + if (node.expirationTime < renderExpirationTime) { + node.expirationTime = renderExpirationTime; + } + var alternate = node.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + scheduleWorkOnParentPath(node.return, renderExpirationTime); + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function findLastContentRow(firstChild) { + // This is going to find the last row among these children that is already + // showing content on the screen, as opposed to being in fallback state or + // new. If a row has multiple Suspense boundaries, any of them being in the + // fallback state, counts as the whole row being in a fallback state. + // Note that the "rows" will be workInProgress, but any nested children + // will still be current since we haven't rendered them yet. The mounted + // order may not be the same as the new order. We use the new order. + var row = firstChild; + var lastContentRow = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + lastContentRow = row; + } + row = row.sibling; + } + return lastContentRow; +} + +function validateRevealOrder(revealOrder) { + { + if ( + revealOrder !== undefined && + revealOrder !== "forwards" && + revealOrder !== "backwards" && + revealOrder !== "together" && + !didWarnAboutRevealOrder[revealOrder] + ) { + didWarnAboutRevealOrder[revealOrder] = true; + if (typeof revealOrder === "string") { + switch (revealOrder.toLowerCase()) { + case "together": + case "forwards": + case "backwards": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'Use lowercase "%s" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + case "forward": + case "backward": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'React uses the -s suffix in the spelling. Use "%ss" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + default: + warning$1( + false, + '"%s" is not a supported revealOrder on . ' + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + break; + } + } else { + warning$1( + false, + "%s is not a supported value for revealOrder on . " + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + } + } + } +} + +function validateTailOptions(tailMode, revealOrder) { + { + if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { + if (tailMode !== "collapsed" && tailMode !== "hidden") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + '"%s" is not a supported value for tail on . ' + + 'Did you mean "collapsed" or "hidden"?', + tailMode + ); + } else if (revealOrder !== "forwards" && revealOrder !== "backwards") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + ' is only valid if revealOrder is ' + + '"forwards" or "backwards". ' + + 'Did you mean to specify revealOrder="forwards"?', + tailMode + ); + } + } + } +} + +function validateSuspenseListNestedChild(childSlot, index) { + { + var isArray = Array.isArray(childSlot); + var isIterable = !isArray && typeof getIteratorFn(childSlot) === "function"; + if (isArray || isIterable) { + var type = isArray ? "array" : "iterable"; + warning$1( + false, + "A nested %s was passed to row #%s in . Wrap it in " + + "an additional SuspenseList to configure its revealOrder: " + + " ... " + + "{%s} ... " + + "", + type, + index, + type + ); + return false; + } + } + return true; +} + +function validateSuspenseListChildren(children, revealOrder) { + { + if ( + (revealOrder === "forwards" || revealOrder === "backwards") && + children !== undefined && + children !== null && + children !== false + ) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + if (!validateSuspenseListNestedChild(children[i], i)) { + return; + } + } + } else { + var iteratorFn = getIteratorFn(children); + if (typeof iteratorFn === "function") { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) { + var step = childrenIterator.next(); + var _i = 0; + for (; !step.done; step = childrenIterator.next()) { + if (!validateSuspenseListNestedChild(step.value, _i)) { + return; + } + _i++; + } + } + } else { + warning$1( + false, + 'A single row was passed to a . ' + + "This is not useful since it needs multiple rows. " + + "Did you mean to pass multiple children or an array?", + revealOrder + ); + } + } + } + } +} + +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + if (renderState === null) { + workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }; + } else { + // We can reuse the existing object from previous renders. + renderState.isBackwards = isBackwards; + renderState.rendering = null; + renderState.last = lastContentRow; + renderState.tail = tail; + renderState.tailExpiration = 0; + renderState.tailMode = tailMode; + } +} + +// This can end up rendering this component multiple passes. +// The first pass splits the children fibers into two sets. A head and tail. +// We first render the head. If anything is in fallback state, we do another +// pass through beginWork to rerender all children (including the tail) with +// the force suspend context. If the first render didn't have anything in +// in fallback state. Then we render each row in the tail one-by-one. +// That happens in the completeWork phase without going back to beginWork. +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps; + var revealOrder = nextProps.revealOrder; + var tailMode = nextProps.tail; + var newChildren = nextProps.children; + + validateRevealOrder(revealOrder); + validateTailOptions(tailMode, revealOrder); + validateSuspenseListChildren(newChildren, revealOrder); + + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + + var suspenseContext = suspenseStackCursor.current; + + var shouldForceFallback = hasSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + if (shouldForceFallback) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + workInProgress.effectTag |= DidCapture; + } else { + var didSuspendBefore = + current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect; + if (didSuspendBefore) { + // If we previously forced a fallback, we need to schedule work + // on any nested boundaries to let them know to try to render + // again. This is the same as context updating. + propagateSuspenseContextChange( + workInProgress, + workInProgress.child, + renderExpirationTime + ); + } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, SuspenseList doesn't work so we just + // use make it a noop by treating it as the default revealOrder. + workInProgress.memoizedState = null; + } else { + switch (revealOrder) { + case "forwards": { + var lastContentRow = findLastContentRow(workInProgress.child); + var tail = void 0; + if (lastContentRow === null) { + // The whole list is part of the tail. + // TODO: We could fast path by just rendering the tail now. + tail = workInProgress.child; + workInProgress.child = null; + } else { + // Disconnect the tail rows after the content row. + // We're going to render them separately later. + tail = lastContentRow.sibling; + lastContentRow.sibling = null; + } + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + tail, + lastContentRow, + tailMode + ); + break; + } + case "backwards": { + // We're going to find the first row that has existing content. + // At the same time we're going to reverse the list of everything + // we pass in the meantime. That's going to be our tail in reverse + // order. + var _tail = null; + var row = workInProgress.child; + workInProgress.child = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + // This is the beginning of the main content. + workInProgress.child = row; + break; + } + var nextRow = row.sibling; + row.sibling = _tail; + _tail = row; + row = nextRow; + } + // TODO: If workInProgress.child is null, we can continue on the tail immediately. + initSuspenseListRenderState( + workInProgress, + true, // isBackwards + _tail, + null, // last + tailMode + ); + break; + } + case "together": { + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + null, // tail + null, // last + undefined + ); + break; + } + default: { + // The default reveal order is the same as not having + // a boundary. + workInProgress.memoizedState = null; + } + } + } + return workInProgress.child; +} + function updatePortalComponent( current$$1, workInProgress, @@ -13690,11 +15136,15 @@ function updateContextConsumer( return workInProgress.child; } -function updateEventComponent$1( +function updateFundamentalComponent$1( current$$1, workInProgress, renderExpirationTime ) { + var fundamentalImpl = workInProgress.type.impl; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } var nextProps = workInProgress.pendingProps; var nextChildren = nextProps.children; @@ -13704,38 +15154,6 @@ function updateEventComponent$1( nextChildren, renderExpirationTime ); - pushHostContextForEventComponent(workInProgress); - return workInProgress.child; -} - -function updateEventTarget(current$$1, workInProgress, renderExpirationTime) { - var type = workInProgress.type.type; - var nextProps = workInProgress.pendingProps; - var eventTargetChild = getEventTargetChildElement(type, nextProps); - - { - !(nextProps.children == null) - ? warning$1(false, "Event targets should not have children.") - : void 0; - } - if (eventTargetChild !== null) { - var child = (workInProgress.child = createFiberFromTypeAndProps( - eventTargetChild.type, - null, - eventTargetChild.props, - null, - workInProgress.mode, - renderExpirationTime - )); - child.return = workInProgress; - - if (current$$1 === null || current$$1.child === null) { - child.effectTag = Placement; - } - } else { - reconcileChildren(current$$1, workInProgress, null, renderExpirationTime); - } - pushHostContextForEventTarget(workInProgress); return workInProgress.child; } @@ -13751,8 +15169,8 @@ function bailoutOnAlreadyFinishedWork( cancelWorkTimer(workInProgress); if (current$$1 !== null) { - // Reuse previous context list - workInProgress.contextDependencies = current$$1.contextDependencies; + // Reuse previous dependencies + workInProgress.dependencies = current$$1.dependencies; } if (enableProfilerTimer) { @@ -13775,14 +15193,91 @@ function bailoutOnAlreadyFinishedWork( } } +function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) { + { + var returnFiber = oldWorkInProgress.return; + if (returnFiber === null) { + throw new Error("Cannot swap the root fiber."); + } + + // Disconnect from the old current. + // It will get deleted. + current$$1.alternate = null; + oldWorkInProgress.alternate = null; + + // Connect to the new tree. + newWorkInProgress.index = oldWorkInProgress.index; + newWorkInProgress.sibling = oldWorkInProgress.sibling; + newWorkInProgress.return = oldWorkInProgress.return; + newWorkInProgress.ref = oldWorkInProgress.ref; + + // Replace the child/sibling pointers above it. + if (oldWorkInProgress === returnFiber.child) { + returnFiber.child = newWorkInProgress; + } else { + var prevSibling = returnFiber.child; + if (prevSibling === null) { + throw new Error("Expected parent to have a child."); + } + while (prevSibling.sibling !== oldWorkInProgress) { + prevSibling = prevSibling.sibling; + if (prevSibling === null) { + throw new Error("Expected to find the previous sibling."); + } + } + prevSibling.sibling = newWorkInProgress; + } + + // Delete the old fiber and place the new one. + // Since the old fiber is disconnected, we have to schedule it manually. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + newWorkInProgress.effectTag |= Placement; + + // Restart work from the new fiber. + return newWorkInProgress; + } +} + function beginWork$1(current$$1, workInProgress, renderExpirationTime) { var updateExpirationTime = workInProgress.expirationTime; + { + if (workInProgress._debugNeedsRemount && current$$1 !== null) { + // This will restart the begin phase with a new fiber. + return remountFiber( + current$$1, + workInProgress, + createFiberFromTypeAndProps( + workInProgress.type, + workInProgress.key, + workInProgress.pendingProps, + workInProgress._debugOwner || null, + workInProgress.mode, + workInProgress.expirationTime + ) + ); + } + } + if (current$$1 !== null) { var oldProps = current$$1.memoizedProps; var newProps = workInProgress.pendingProps; - if (oldProps !== newProps || hasContextChanged()) { + if ( + oldProps !== newProps || + hasContextChanged() || + // Force a re-render if the implementation changed due to hot reload: + workInProgress.type !== current$$1.type + ) { // If props or context changed, mark the fiber as having performed work. // This may be unset if the props are determined to be equal later (memo). didReceiveUpdate = true; @@ -13798,6 +15293,18 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { break; case HostComponent: pushHostContext(workInProgress); + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(workInProgress.type, newProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } break; case ClassComponent: { var Component = workInProgress.type; @@ -13844,6 +15351,10 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); // The primary children do not have pending work with sufficient // priority. Bailout. var child = bailoutOnAlreadyFinishedWork( @@ -13859,11 +15370,20 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { return null; } } + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); } break; } case DehydratedSuspenseComponent: { if (enableSuspenseServerRenderer) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); // We know that this component will suspend again because if it has // been unsuspended it has committed as a regular Suspense component. // If it needs to be retried, it should have work scheduled on it. @@ -13871,18 +15391,54 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { } break; } - case EventComponent: - if (enableEventAPI) { - pushHostContextForEventComponent(workInProgress); + case SuspenseListComponent: { + var didSuspendBefore = + (current$$1.effectTag & DidCapture) !== NoEffect; + + var hasChildWork = + workInProgress.childExpirationTime >= renderExpirationTime; + + if (didSuspendBefore) { + if (hasChildWork) { + // If something was in fallback state last time, and we have all the + // same children then we're still in progressive loading state. + // Something might get unblocked by state updates or retries in the + // tree which will affect the tail. So we need to use the normal + // path to compute the correct tail. + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + workInProgress.effectTag |= DidCapture; } - break; - case EventTarget: { - if (enableEventAPI) { - pushHostContextForEventTarget(workInProgress); + + // If nothing suspended before and we're rendering the same children, + // then the tail doesn't matter. Anything new that suspends will work + // in the "together" mode, so we can continue from the state we had. + var renderState = workInProgress.memoizedState; + if (renderState !== null) { + // Reset to the "together" mode in case we've started a different + // update in the past but didn't complete it. + renderState.rendering = null; + renderState.tail = null; } - break; - } - } + pushSuspenseContext(workInProgress, suspenseStackCursor.current); + + if (hasChildWork) { + break; + } else { + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + return null; + } + } + } return bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -13898,20 +15454,19 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { switch (workInProgress.tag) { case IndeterminateComponent: { - var elementType = workInProgress.elementType; return mountIndeterminateComponent( current$$1, workInProgress, - elementType, + workInProgress.type, renderExpirationTime ); } case LazyComponent: { - var _elementType = workInProgress.elementType; + var elementType = workInProgress.elementType; return mountLazyComponent( current$$1, workInProgress, - _elementType, + elementType, updateExpirationTime, renderExpirationTime ); @@ -14065,19 +15620,16 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { } break; } - case EventComponent: { - if (enableEventAPI) { - return updateEventComponent$1( - current$$1, - workInProgress, - renderExpirationTime - ); - } - break; + case SuspenseListComponent: { + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } - case EventTarget: { - if (enableEventAPI) { - return updateEventTarget( + case FundamentalComponent: { + if (enableFundamentalAPI) { + return updateFundamentalComponent$1( current$$1, workInProgress, renderExpirationTime @@ -14089,12 +15641,28 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { (function() { { throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); } +function createFundamentalStateInstance(currentFiber, props, impl, state) { + return { + currentFiber: currentFiber, + impl: impl, + instance: null, + prevProps: null, + props: props, + state: state + }; +} + +var emptyObject$1 = {}; +var isArray$2 = Array.isArray; + function markUpdate(workInProgress) { // Tag the fiber with an update effect. This turns a Placement into // a PlacementAndUpdate. @@ -14124,6 +15692,8 @@ if (supportsMutation) { while (node !== null) { if (node.tag === HostComponent || node.tag === HostText) { appendInitialChild(parent, node.stateNode); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + appendInitialChild(parent, node.stateNode.instance); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14228,6 +15798,15 @@ if (supportsMutation) { _instance = cloneHiddenTextInstance(_instance, text, node); } appendInitialChild(parent, _instance); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance2 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props = node.memoizedProps; + var _type = node.type; + _instance2 = cloneHiddenInstance(_instance2, _type, _props, node); + } + appendInitialChild(parent, _instance2); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14306,13 +15885,22 @@ if (supportsMutation) { } appendChildToContainerChildSet(containerChildSet, instance); } else if (node.tag === HostText) { - var _instance2 = node.stateNode; + var _instance3 = node.stateNode; if (needsVisibilityToggle && isHidden) { // This child is inside a timed out tree. Hide it. var text = node.memoizedProps; - _instance2 = cloneHiddenTextInstance(_instance2, text, node); + _instance3 = cloneHiddenTextInstance(_instance3, text, node); } - appendChildToContainerChildSet(containerChildSet, _instance2); + appendChildToContainerChildSet(containerChildSet, _instance3); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance4 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props2 = node.memoizedProps; + var _type2 = node.type; + _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node); + } + appendChildToContainerChildSet(containerChildSet, _instance4); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14488,6 +16076,69 @@ if (supportsMutation) { }; } +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var tailNode = renderState.tail; + var lastTailNode = null; + while (tailNode !== null) { + if (tailNode.alternate !== null) { + lastTailNode = tailNode; + } + tailNode = tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (lastTailNode === null) { + // All remaining items in the tail are insertions. + renderState.tail = null; + } else { + // Detach the insertion after the last node that was already + // inserted. + lastTailNode.sibling = null; + } + break; + } + case "collapsed": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var _tailNode = renderState.tail; + var _lastTailNode = null; + while (_tailNode !== null) { + if (_tailNode.alternate !== null) { + _lastTailNode = _tailNode; + } + _tailNode = _tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (_lastTailNode === null) { + // All remaining items in the tail are insertions. + if (!hasRenderedATailFallback && renderState.tail !== null) { + // We suspended during the head. We want to show at least one + // row at the tail. So we'll keep on and cut off the rest. + renderState.tail.sibling = null; + } else { + renderState.tail = null; + } + } else { + // Detach the insertion after the last node that was already + // inserted. + _lastTailNode.sibling = null; + } + break; + } + } +} + function completeWork(current, workInProgress, renderExpirationTime) { var newProps = workInProgress.pendingProps; @@ -14538,6 +16189,20 @@ function completeWork(current, workInProgress, renderExpirationTime) { rootContainerInstance ); + if (enableFlareAPI) { + var prevListeners = current.memoizedProps.listeners; + var nextListeners = newProps.listeners; + var instance = workInProgress.stateNode; + if (prevListeners !== nextListeners) { + updateEventListeners( + nextListeners, + instance, + rootContainerInstance, + workInProgress + ); + } + } + if (current.ref !== workInProgress.ref) { markRef$1(workInProgress); } @@ -14546,7 +16211,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { if (!(workInProgress.stateNode !== null)) { throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -14574,8 +16241,20 @@ function completeWork(current, workInProgress, renderExpirationTime) { // commit-phase we mark this as such. markUpdate(workInProgress); } + if (enableFlareAPI) { + var _instance5 = workInProgress.stateNode; + var listeners = newProps.listeners; + if (listeners != null) { + updateEventListeners( + listeners, + _instance5, + rootContainerInstance, + workInProgress + ); + } + } } else { - var instance = createInstance( + var _instance6 = createInstance( type, newProps, rootContainerInstance, @@ -14583,14 +16262,26 @@ function completeWork(current, workInProgress, renderExpirationTime) { workInProgress ); - appendAllChildren(instance, workInProgress, false, false); + appendAllChildren(_instance6, workInProgress, false, false); + + if (enableFlareAPI) { + var _listeners = newProps.listeners; + if (_listeners != null) { + updateEventListeners( + _listeners, + _instance6, + rootContainerInstance, + workInProgress + ); + } + } // Certain renderers require commit-time effects for initial mount. // (eg DOM renderer supports auto-focus for certain elements). // Make sure such renderers get scheduled for later work. if ( finalizeInitialChildren( - instance, + _instance6, type, newProps, rootContainerInstance, @@ -14599,7 +16290,7 @@ function completeWork(current, workInProgress, renderExpirationTime) { ) { markUpdate(workInProgress); } - workInProgress.stateNode = instance; + workInProgress.stateNode = _instance6; } if (workInProgress.ref !== null) { @@ -14621,7 +16312,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { if (!(workInProgress.stateNode !== null)) { throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -14648,6 +16341,7 @@ function completeWork(current, workInProgress, renderExpirationTime) { case ForwardRef: break; case SuspenseComponent: { + popSuspenseContext(workInProgress); var nextState = workInProgress.memoizedState; if ((workInProgress.effectTag & DidCapture) !== NoEffect) { // Something suspended. Re-render with the fallback children. @@ -14668,15 +16362,8 @@ function completeWork(current, workInProgress, renderExpirationTime) { prevDidTimeout = prevState !== null; if (!nextDidTimeout && prevState !== null) { // We just switched from the fallback to the normal children. - - // Mark the event time of the switching from fallback to normal children, - // based on the start of when we first showed the fallback. This time - var fallbackExpirationTime = prevState.fallbackExpirationTime; - markRenderEventTime(fallbackExpirationTime); - // Delete the fallback. // TODO: Would it be better to store the fallback fragment on - // the stateNode during the begin phase? var currentFallbackChild = current.child.sibling; if (currentFallbackChild !== null) { // Deletions go at the beginning of the return fiber's effect list @@ -14694,13 +16381,37 @@ function completeWork(current, workInProgress, renderExpirationTime) { } if (nextDidTimeout && !prevDidTimeout) { - // If this subtreee is running in concurrent mode we can suspend, + // If this subtreee is running in batched mode we can suspend, // otherwise we won't suspend. // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. - if ((workInProgress.mode & ConcurrentMode) !== NoContext) { - renderDidSuspend(); + if ((workInProgress.mode & BatchedMode) !== NoMode) { + // TODO: Move this back to throwException because this is too late + // if this is a large tree which is common for initial loads. We + // don't know if we should restart a render or not until we get + // this marker, and this is too late. + // If this render already had a ping or lower pri updates, + // and this is the first time we know we're going to suspend we + // should be able to immediately restart from within throwException. + var hasInvisibleChildContext = + current === null && + workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + if ( + hasInvisibleChildContext || + hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ) + ) { + // If this was in an invisible tree or a new render, then showing + // this boundary is ok. + renderDidSuspend(); + } else { + // Otherwise, we're going to have to hide content so we should + // suspend for longer if possible. + renderDidSuspendDelayIfPossible(); + } } } @@ -14724,6 +16435,14 @@ function completeWork(current, workInProgress, renderExpirationTime) { workInProgress.effectTag |= Update; } } + if ( + enableSuspenseCallback && + workInProgress.updateQueue !== null && + workInProgress.memoizedProps.suspenseCallback != null + ) { + // Always notify the callback + workInProgress.effectTag |= Update; + } break; } case Fragment: @@ -14755,78 +16474,275 @@ function completeWork(current, workInProgress, renderExpirationTime) { } case DehydratedSuspenseComponent: { if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); if (current === null) { var _wasHydrated2 = popHydrationState(workInProgress); (function() { if (!_wasHydrated2) { throw ReactError( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ) ); } })(); + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } skipPastDehydratedSuspenseInstance(workInProgress); - } else if ((workInProgress.effectTag & DidCapture) === NoEffect) { - // This boundary did not suspend so it's now hydrated. - // To handle any future suspense cases, we're going to now upgrade it - // to a Suspense component. We detach it from the existing current fiber. - current.alternate = null; - workInProgress.alternate = null; - workInProgress.tag = SuspenseComponent; - workInProgress.memoizedState = null; - workInProgress.stateNode = null; + } else { + // We should never have been in a hydration state if we didn't have a current. + // However, in some of those paths, we might have reentered a hydration state + // and then we might be inside a hydration state. In that case, we'll need to + // exit out of it. + resetHydrationState(); + if ((workInProgress.effectTag & DidCapture) === NoEffect) { + // This boundary did not suspend so it's now hydrated. + // To handle any future suspense cases, we're going to now upgrade it + // to a Suspense component. We detach it from the existing current fiber. + current.alternate = null; + workInProgress.alternate = null; + workInProgress.tag = SuspenseComponent; + workInProgress.memoizedState = null; + workInProgress.stateNode = null; + } } } break; } - case EventComponent: { - if (enableEventAPI) { - popHostContext(workInProgress); - var _rootContainerInstance2 = getRootHostContainer(); - var responder = workInProgress.type.responder; - var eventComponentInstance = workInProgress.stateNode; - - if (eventComponentInstance === null) { - var responderState = null; - if (responder.createInitialState !== undefined) { - responderState = responder.createInitialState(newProps); + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + + var renderState = workInProgress.memoizedState; + + if (renderState === null) { + // We're running in the default, "independent" mode. We don't do anything + // in this mode. + break; + } + + var didSuspendAlready = + (workInProgress.effectTag & DidCapture) !== NoEffect; + + var renderedTail = renderState.rendering; + if (renderedTail === null) { + // We just rendered the head. + if (!didSuspendAlready) { + // This is the first pass. We need to figure out if anything is still + // suspended in the rendered set. + + // If new content unsuspended, but there's still some content that + // didn't. Then we need to do a second pass that forces everything + // to keep showing their fallbacks. + + // We might be suspended if something in this render pass suspended, or + // something in the previous committed pass suspended. Otherwise, + // there's no chance so we can skip the expensive call to + // findFirstSuspended. + var cannotBeSuspended = + renderHasNotSuspendedYet() && + (current === null || (current.effectTag & DidCapture) === NoEffect); + if (!cannotBeSuspended) { + var row = workInProgress.child; + while (row !== null) { + var suspended = findFirstSuspended(row); + if (suspended !== null) { + didSuspendAlready = true; + workInProgress.effectTag |= DidCapture; + cutOffTailIfNeeded(renderState, false); + + // If this is a newly suspended tree, it might not get committed as + // part of the second pass. In that case nothing will subscribe to + // its thennables. Instead, we'll transfer its thennables to the + // SuspenseList so that it can retry if they resolve. + // There might be multiple of these in the list but since we're + // going to wait for all of them anyway, it doesn't really matter + // which ones gets to ping. In theory we could get clever and keep + // track of how many dependencies remain but it gets tricky because + // in the meantime, we can add/remove/change items and dependencies. + // We might bail out of the loop before finding any but that + // doesn't matter since that means that the other boundaries that + // we did find already has their listeners attached. + var newThennables = suspended.updateQueue; + if (newThennables !== null) { + workInProgress.updateQueue = newThennables; + workInProgress.effectTag |= Update; + } + + // Rerender the whole list, but this time, we'll force fallbacks + // to stay in place. + // Reset the effect list before doing the second pass since that's now invalid. + workInProgress.firstEffect = workInProgress.lastEffect = null; + // Reset the child fibers to their original state. + resetChildFibers(workInProgress, renderExpirationTime); + + // Set up the Suspense Context to force suspense and immediately + // rerender the children. + pushSuspenseContext( + workInProgress, + setShallowSuspenseContext( + suspenseStackCursor.current, + ForceSuspenseFallback + ) + ); + return workInProgress.child; + } + row = row.sibling; + } } - eventComponentInstance = workInProgress.stateNode = { - currentFiber: workInProgress, - props: newProps, - responder: responder, - rootEventTypes: null, - rootInstance: _rootContainerInstance2, - state: responderState - }; - markUpdate(workInProgress); } else { - // Update the props on the event component state node - eventComponentInstance.props = newProps; - // Update the root container, so we can properly unmount events at some point - eventComponentInstance.rootInstance = _rootContainerInstance2; - // Update the current fiber - eventComponentInstance.currentFiber = workInProgress; - updateEventComponent(eventComponentInstance); + cutOffTailIfNeeded(renderState, false); + } + // Next we're going to render the tail. + } else { + // Append the rendered row to the child list. + if (!didSuspendAlready) { + var _suspended = findFirstSuspended(renderedTail); + if (_suspended !== null) { + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, true); + // This might have been modified. + if ( + renderState.tail === null && + renderState.tailMode === "hidden" + ) { + // We need to delete the row we just rendered. + // Ensure we transfer the update queue to the parent. + var _newThennables = _suspended.updateQueue; + if (_newThennables !== null) { + workInProgress.updateQueue = _newThennables; + workInProgress.effectTag |= Update; + } + // Reset the effect list to what it w as before we rendered this + // child. The nested children have already appended themselves. + var lastEffect = (workInProgress.lastEffect = + renderState.lastEffect); + // Remove any effects that were appended after this point. + if (lastEffect !== null) { + lastEffect.nextEffect = null; + } + // We're done. + return null; + } + } else if ( + now() > renderState.tailExpiration && + renderExpirationTime > Never + ) { + // We have now passed our CPU deadline and we'll just give up further + // attempts to render the main content and only render fallbacks. + // The assumption is that this is usually faster. + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + + cutOffTailIfNeeded(renderState, false); + + // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. If we can show + // them, then they really have the same priority as this render. + // So we'll pick it back up the very next render pass once we've had + // an opportunity to yield for paint. + + var nextPriority = renderExpirationTime - 1; + workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority; + if (enableSchedulerTracing) { + markSpawnedWork(nextPriority); + } + } + } + if (renderState.isBackwards) { + // The effect list of the backwards tail will have been added + // to the end. This breaks the guarantee that life-cycles fire in + // sibling order but that isn't a strong guarantee promised by React. + // Especially since these might also just pop in during future commits. + // Append to the beginning of the list. + renderedTail.sibling = workInProgress.child; + workInProgress.child = renderedTail; + } else { + var previousSibling = renderState.last; + if (previousSibling !== null) { + previousSibling.sibling = renderedTail; + } else { + workInProgress.child = renderedTail; + } + renderState.last = renderedTail; + } + } + + if (renderState.tail !== null) { + // We still have tail rows to render. + if (renderState.tailExpiration === 0) { + // Heuristic for how long we're willing to spend rendering rows + // until we just give up and show what we have so far. + var TAIL_EXPIRATION_TIMEOUT_MS = 500; + renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; + } + // Pop a row. + var next = renderState.tail; + renderState.rendering = next; + renderState.tail = next.sibling; + renderState.lastEffect = workInProgress.lastEffect; + next.sibling = null; + + // Restore the context. + // TODO: We can probably just avoid popping it instead and only + // setting it the first time we go from not suspended to suspended. + var suspenseContext = suspenseStackCursor.current; + if (didSuspendAlready) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + } else { + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); } + pushSuspenseContext(workInProgress, suspenseContext); + // Do a pass over the next row. + return next; } break; } - case EventTarget: { - if (enableEventAPI) { - popHostContext(workInProgress); - var _type = workInProgress.type.type; - var _rootContainerInstance3 = getRootHostContainer(); - var shouldUpdate = handleEventTarget( - _type, - newProps, - _rootContainerInstance3, - workInProgress - ); - // Update the latest props on the stateNode. This is used - // during the event phase to find the most current props. - workInProgress.stateNode.props = newProps; - if (shouldUpdate) { - markUpdate(workInProgress); + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalImpl = workInProgress.type.impl; + var fundamentalInstance = workInProgress.stateNode; + + if (fundamentalInstance === null) { + var getInitialState = fundamentalImpl.getInitialState; + var fundamentalState = void 0; + if (getInitialState !== undefined) { + fundamentalState = getInitialState(newProps); + } + fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance( + workInProgress, + newProps, + fundamentalImpl, + fundamentalState || {} + ); + var _instance7 = getFundamentalComponentInstance(fundamentalInstance); + fundamentalInstance.instance = _instance7; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + appendAllChildren(_instance7, workInProgress, false, false); + mountFundamentalComponent(fundamentalInstance); + } else { + // We fire update in commit phase + var prevProps = fundamentalInstance.props; + fundamentalInstance.prevProps = prevProps; + fundamentalInstance.props = newProps; + fundamentalInstance.currentFiber = workInProgress; + if (supportsPersistence) { + var _instance8 = cloneFundamentalInstance(fundamentalInstance); + fundamentalInstance.instance = _instance8; + appendAllChildren(_instance8, workInProgress, false, false); + } + var shouldUpdate = shouldUpdateFundamentalComponent( + fundamentalInstance + ); + if (shouldUpdate) { + markUpdate(workInProgress); + } } } break; @@ -14835,7 +16751,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { { throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -14844,119 +16762,355 @@ function completeWork(current, workInProgress, renderExpirationTime) { return null; } -function shouldCaptureSuspense(workInProgress) { - // In order to capture, the Suspense component must have a fallback prop. - if (workInProgress.memoizedProps.fallback === undefined) { - return false; - } - // If it was the primary children that just suspended, capture and render the - // fallback. Otherwise, don't capture and bubble to the next boundary. - var nextState = workInProgress.memoizedState; - return nextState === null; -} - -function createCapturedValue(value, source) { - // If the value is an error, call this function immediately after it is thrown - // so the stack is accurate. - return { - value: value, - source: source, - stack: getStackByFiberInDevAndProd(source) - }; +function mountEventResponder$1( + responder, + responderProps, + instance, + rootContainerInstance, + fiber, + respondersMap +) { + var responderState = emptyObject$1; + var getInitialState = responder.getInitialState; + if (getInitialState !== null) { + responderState = getInitialState(responderProps); + } + var responderInstance = createResponderInstance( + responder, + responderProps, + responderState, + instance, + fiber + ); + mountResponderInstance( + responder, + responderInstance, + responderProps, + responderState, + instance, + rootContainerInstance + ); + respondersMap.set(responder, responderInstance); } -// Module provided by RN: -/** - * Intercept lifecycle errors and ensure they are shown with the correct stack - * trace within the native redbox component. - */ -function showErrorDialog(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - - var errorToHandle = void 0; - - // Typically Errors are thrown but eg strings or null can be thrown as well. - if (error instanceof Error) { - var message = error.message, - name = error.name; - - var summary = message ? name + ": " + message : name; +function updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance +) { + var responder = void 0; + var props = void 0; - errorToHandle = error; + if (listener) { + responder = listener.responder; + props = listener.props; + } + (function() { + if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) { + throw ReactError( + Error( + "An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer()." + ) + ); + } + })(); + var listenerProps = props; + if (visistedResponders.has(responder)) { + // show warning + { + warning$1( + false, + 'Duplicate event responder "%s" found in event listeners. ' + + "Event listeners passed to elements cannot use the same event responder more than once.", + responder.displayName + ); + } + return; + } + visistedResponders.add(responder); + var responderInstance = respondersMap.get(responder); - try { - errorToHandle.message = - summary + "\n\nThis error is located at:" + componentStack; - } catch (e) {} - } else if (typeof error === "string") { - errorToHandle = new Error( - error + "\n\nThis error is located at:" + componentStack + if (responderInstance === undefined) { + // Mount + mountEventResponder$1( + responder, + listenerProps, + instance, + rootContainerInstance, + fiber, + respondersMap ); } else { - errorToHandle = new Error("Unspecified error at:" + componentStack); + // Update + responderInstance.props = listenerProps; + responderInstance.fiber = fiber; } - - ExceptionsManager.handleException(errorToHandle, false); - - // Return false here to prevent ReactFiberErrorLogger default behavior of - // logging error details to console.error. Calls to console.error are - // automatically routed to the native redbox controller, which we've already - // done above by calling ExceptionsManager. - return false; } -function logCapturedError(capturedError) { - var logError = showErrorDialog(capturedError); - - // Allow injected showErrorDialog() to prevent default console.error logging. - // This enables renderers like ReactNative to better manage redbox behavior. - if (logError === false) { - return; +function updateEventListeners( + listeners, + instance, + rootContainerInstance, + fiber +) { + var visistedResponders = new Set(); + var dependencies = fiber.dependencies; + if (listeners != null) { + if (dependencies === null) { + dependencies = fiber.dependencies = { + expirationTime: NoWork, + firstContext: null, + responders: new Map() + }; + } + var respondersMap = dependencies.responders; + if (respondersMap === null) { + respondersMap = new Map(); + } + if (isArray$2(listeners)) { + for (var i = 0, length = listeners.length; i < length; i++) { + var listener = listeners[i]; + updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } else { + updateEventListener( + listeners, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } } - - var error = capturedError.error; - { - var componentName = capturedError.componentName, - componentStack = capturedError.componentStack, - errorBoundaryName = capturedError.errorBoundaryName, - errorBoundaryFound = capturedError.errorBoundaryFound, - willRetry = capturedError.willRetry; - - // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (errorBoundaryFound && willRetry) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; + if (dependencies !== null) { + var _respondersMap = dependencies.responders; + if (_respondersMap !== null) { + // Unmount + var mountedResponders = Array.from(_respondersMap.keys()); + for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) { + var mountedResponder = mountedResponders[_i]; + if (!visistedResponders.has(mountedResponder)) { + var responderInstance = _respondersMap.get(mountedResponder); + unmountResponderInstance(responderInstance); + _respondersMap.delete(mountedResponder); + } } - // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - console.error(error); - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 } + } +} - var componentNameMessage = componentName - ? "The above error occurred in the <" + componentName + "> component:" - : "The above error occurred in one of your React components:"; - - var errorBoundaryMessage = void 0; - // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. - if (errorBoundaryFound && errorBoundaryName) { - if (willRetry) { - errorBoundaryMessage = - "React will try to recreate this component tree from scratch " + - ("using the error boundary you provided, " + errorBoundaryName + "."); - } else { - errorBoundaryMessage = - "This error was initially handled by the error boundary " + +function unwindWork(workInProgress, renderExpirationTime) { + switch (workInProgress.tag) { + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + var effectTag = workInProgress.effectTag; + if (effectTag & ShouldCapture) { + workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + return null; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var _effectTag = workInProgress.effectTag; + (function() { + if (!((_effectTag & DidCapture) === NoEffect)) { + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + case HostComponent: { + // TODO: popHydrationState + popHostContext(workInProgress); + return null; + } + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var _effectTag2 = workInProgress.effectTag; + if (_effectTag2 & ShouldCapture) { + workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + return null; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (workInProgress.alternate === null) { + // TODO: popHydrationState + } else { + resetHydrationState(); + } + var _effectTag3 = workInProgress.effectTag; + if (_effectTag3 & ShouldCapture) { + workInProgress.effectTag = + (_effectTag3 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + } + return null; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + // SuspenseList doesn't actually catch anything. It should've been + // caught by a nested boundary. If not, it should bubble through. + return null; + } + case HostPortal: + popHostContainer(workInProgress); + return null; + case ContextProvider: + popProvider(workInProgress); + return null; + default: + return null; + } +} + +function unwindInterruptedWork(interruptedWork) { + switch (interruptedWork.tag) { + case ClassComponent: { + var childContextTypes = interruptedWork.type.childContextTypes; + if (childContextTypes !== null && childContextTypes !== undefined) { + popContext(interruptedWork); + } + break; + } + case HostRoot: { + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + } + case HostComponent: { + popHostContext(interruptedWork); + break; + } + case HostPortal: + popHostContainer(interruptedWork); + break; + case SuspenseComponent: + popSuspenseContext(interruptedWork); + break; + case DehydratedSuspenseComponent: + if (enableSuspenseServerRenderer) { + popSuspenseContext(interruptedWork); + } + break; + case SuspenseListComponent: + popSuspenseContext(interruptedWork); + break; + case ContextProvider: + popProvider(interruptedWork); + break; + default: + break; + } +} + +function createCapturedValue(value, source) { + // If the value is an error, call this function immediately after it is thrown + // so the stack is accurate. + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} + +// Module provided by RN: +(function() { + if ( + !( + typeof ReactNativePrivateInterface.ReactFiberErrorDialog + .showErrorDialog === "function" + ) + ) { + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); + } +})(); + +function showErrorDialog(capturedError) { + return ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ); +} + +function logCapturedError(capturedError) { + var logError = showErrorDialog(capturedError); + + // Allow injected showErrorDialog() to prevent default console.error logging. + // This enables renderers like ReactNative to better manage redbox behavior. + if (logError === false) { + return; + } + + var error = capturedError.error; + { + var componentName = capturedError.componentName, + componentStack = capturedError.componentStack, + errorBoundaryName = capturedError.errorBoundaryName, + errorBoundaryFound = capturedError.errorBoundaryFound, + willRetry = capturedError.willRetry; + + // Browsers support silencing uncaught errors by calling + // `preventDefault()` in window `error` handler. + // We record this information as an expando on the error. + + if (error != null && error._suppressLogging) { + if (errorBoundaryFound && willRetry) { + // The error is recoverable and was silenced. + // Ignore it and don't print the stack addendum. + // This is handy for testing error boundaries without noise. + return; + } + // The error is fatal. Since the silencing might have + // been accidental, we'll surface it anyway. + // However, the browser would have silenced the original error + // so we'll print it first, and then print the stack addendum. + console.error(error); + // For a more detailed description of this block, see: + // https://github.com/facebook/react/pull/13384 + } + + var componentNameMessage = componentName + ? "The above error occurred in the <" + componentName + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryMessage = void 0; + // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. + if (errorBoundaryFound && errorBoundaryName) { + if (willRetry) { + errorBoundaryMessage = + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + errorBoundaryName + "."); + } else { + errorBoundaryMessage = + "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree."; @@ -15153,14 +17307,15 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) { case HostText: case HostPortal: case IncompleteClassComponent: - case EventTarget: // Nothing to do for these component types return; default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15229,8 +17384,19 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } function commitPassiveHookEffects(finishedWork) { - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if ((finishedWork.effectTag & Passive) !== NoEffect) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + break; + } + default: + break; + } + } } function commitLifeCycles( @@ -15428,73 +17594,43 @@ function commitLifeCycles( if (enableProfilerTimer) { var onRender = finishedWork.memoizedProps.onRender; - if (enableSchedulerTracing) { - onRender( - finishedWork.memoizedProps.id, - current$$1 === null ? "mount" : "update", - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - getCommitTime(), - finishedRoot.memoizedInteractions - ); - } else { - onRender( - finishedWork.memoizedProps.id, - current$$1 === null ? "mount" : "update", - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - getCommitTime() - ); + if (typeof onRender === "function") { + if (enableSchedulerTracing) { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime(), + finishedRoot.memoizedInteractions + ); + } else { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime() + ); + } } } return; } case SuspenseComponent: + case SuspenseListComponent: case IncompleteClassComponent: + case FundamentalComponent: return; - case EventTarget: { - if (enableEventAPI) { - var _type = finishedWork.type.type; - var _props = finishedWork.memoizedProps; - var _instance3 = finishedWork.stateNode; - var parentInstance = null; - - var node = finishedWork.return; - // Traverse up the fiber tree until we find the parent host node. - while (node !== null) { - if (node.tag === HostComponent) { - parentInstance = node.stateNode; - break; - } else if (node.tag === HostRoot) { - parentInstance = node.stateNode.containerInfo; - break; - } - node = node.return; - } - (function() { - if (!(parentInstance !== null)) { - throw ReactError( - "This should have a parent host component initialized. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); - commitEventTarget(_type, _props, _instance3, parentInstance); - } - return; - } - case EventComponent: { - if (enableEventAPI) { - mountEventComponent(finishedWork.stateNode); - } - return; - } default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15515,11 +17651,11 @@ function hideOrUnhideAllChildren(finishedWork, isHidden) { unhideInstance(node.stateNode, node.memoizedProps); } } else if (node.tag === HostText) { - var _instance4 = node.stateNode; + var _instance3 = node.stateNode; if (isHidden) { - hideTextInstance(_instance4); + hideTextInstance(_instance3); } else { - unhideTextInstance(_instance4, node.memoizedProps); + unhideTextInstance(_instance3, node.memoizedProps); } } else if ( node.tag === SuspenseComponent && @@ -15596,7 +17732,7 @@ function commitDetachRef(current$$1) { // User-originating errors (lifecycles and refs) should not interrupt // deletion, so don't let them throw. Host-originating errors should // interrupt deletion, so it's okay -function commitUnmount(current$$1) { +function commitUnmount(current$$1, renderPriorityLevel) { onCommitUnmount(current$$1); switch (current$$1.tag) { @@ -15609,14 +17745,33 @@ function commitUnmount(current$$1) { var lastEffect = updateQueue.lastEffect; if (lastEffect !== null) { var firstEffect = lastEffect.next; - var effect = firstEffect; - do { - var destroy = effect.destroy; - if (destroy !== undefined) { - safelyCallDestroy(current$$1, destroy); - } - effect = effect.next; - } while (effect !== firstEffect); + + // When the owner fiber is deleted, the destroy function of a passive + // effect hook is called during the synchronous commit phase. This is + // a concession to implementation complexity. Calling it in the + // passive effect phase (like they usually are, when dependencies + // change during an update) would require either traversing the + // children of the deleted fiber again, or including unmount effects + // as part of the fiber effect list. + // + // Because this is during the sync commit phase, we need to change + // the priority. + // + // TODO: Reconsider this implementation trade off. + var priorityLevel = + renderPriorityLevel > NormalPriority + ? NormalPriority + : renderPriorityLevel; + runWithPriority$1(priorityLevel, function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (destroy !== undefined) { + safelyCallDestroy(current$$1, destroy); + } + effect = effect.next; + } while (effect !== firstEffect); + }); } } break; @@ -15630,6 +17785,25 @@ function commitUnmount(current$$1) { return; } case HostComponent: { + if (enableFlareAPI) { + var dependencies = current$$1.dependencies; + + if (dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for ( + var i = 0, length = responderInstances.length; + i < length; + i++ + ) { + var responderInstance = responderInstances[i]; + unmountResponderInstance(responderInstance); + } + dependencies.responders = null; + } + } + } safelyDetachRef(current$$1); return; } @@ -15638,30 +17812,32 @@ function commitUnmount(current$$1) { // We are also not using this parent because // the portal will get pushed immediately. if (supportsMutation) { - unmountHostComponents(current$$1); + unmountHostComponents(current$$1, renderPriorityLevel); } else if (supportsPersistence) { emptyPortalContainer(current$$1); } return; } - case EventComponent: { - if (enableEventAPI) { - var eventComponentInstance = current$$1.stateNode; - unmountEventComponent(eventComponentInstance); - current$$1.stateNode = null; + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = current$$1.stateNode; + if (fundamentalInstance !== null) { + unmountFundamentalComponent(fundamentalInstance); + current$$1.stateNode = null; + } } } } } -function commitNestedUnmounts(root) { +function commitNestedUnmounts(root, renderPriorityLevel) { // While we're inside a removed host node we don't want to call // removeChild on the inner nodes because they're removed by the top // call anyway. We also want to call componentWillUnmount on all // composites before this host node is removed from the tree. Therefore var node = root; while (true) { - commitUnmount(node); + commitUnmount(node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes. // Skip portals because commitUnmount() currently visits them recursively. if ( @@ -15689,6 +17865,7 @@ function commitNestedUnmounts(root) { } function detachFiber(current$$1) { + var alternate = current$$1.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we // should clear the child pointer of the parent alternate to let this // get GC:ed but we don't know which for sure which parent is the current @@ -15698,12 +17875,14 @@ function detachFiber(current$$1) { current$$1.child = null; current$$1.memoizedState = null; current$$1.updateQueue = null; - var alternate = current$$1.alternate; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; if (alternate !== null) { - alternate.return = null; - alternate.child = null; - alternate.memoizedState = null; - alternate.updateQueue = null; + detachFiber(alternate); } } @@ -15727,8 +17906,7 @@ function commitContainer(finishedWork) { case ClassComponent: case HostComponent: case HostText: - case EventTarget: - case EventComponent: { + case FundamentalComponent: { return; } case HostRoot: @@ -15743,7 +17921,9 @@ function commitContainer(finishedWork) { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15762,7 +17942,9 @@ function getHostParentFiber(fiber) { (function() { { throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15832,25 +18014,33 @@ function commitPlacement(finishedWork) { // Note: these two variables *must* always be updated together. var parent = void 0; var isContainer = void 0; - + var parentStateNode = parentFiber.stateNode; switch (parentFiber.tag) { case HostComponent: - parent = parentFiber.stateNode; + parent = parentStateNode; isContainer = false; break; case HostRoot: - parent = parentFiber.stateNode.containerInfo; + parent = parentStateNode.containerInfo; isContainer = true; break; case HostPortal: - parent = parentFiber.stateNode.containerInfo; + parent = parentStateNode.containerInfo; isContainer = true; break; + case FundamentalComponent: + if (enableFundamentalAPI) { + parent = parentStateNode.instance; + isContainer = false; + } + // eslint-disable-next-line-no-fallthrough default: (function() { { throw ReactError( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15867,8 +18057,9 @@ function commitPlacement(finishedWork) { // children to find all the terminal nodes. var node = finishedWork; while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - var stateNode = node.stateNode; + var isHost = node.tag === HostComponent || node.tag === HostText; + if (isHost || (enableFundamentalAPI && node.tag === FundamentalComponent)) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; if (before) { if (isContainer) { insertInContainerBefore(parent, stateNode, before); @@ -15879,7 +18070,7 @@ function commitPlacement(finishedWork) { if (isContainer) { appendChildToContainer(parent, stateNode); } else { - appendChild$1(parent, stateNode); + appendChild(parent, stateNode); } } } else if (node.tag === HostPortal) { @@ -15905,7 +18096,7 @@ function commitPlacement(finishedWork) { } } -function unmountHostComponents(current$$1) { +function unmountHostComponents(current$$1, renderPriorityLevel) { // We only have the top Fiber that was deleted but we need to recurse down its var node = current$$1; @@ -15924,23 +18115,31 @@ function unmountHostComponents(current$$1) { (function() { if (!(parent !== null)) { throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); + var parentStateNode = parent.stateNode; switch (parent.tag) { case HostComponent: - currentParent = parent.stateNode; + currentParent = parentStateNode; currentParentIsContainer = false; break findParent; case HostRoot: - currentParent = parent.stateNode.containerInfo; + currentParent = parentStateNode.containerInfo; currentParentIsContainer = true; break findParent; case HostPortal: - currentParent = parent.stateNode.containerInfo; + currentParent = parentStateNode.containerInfo; currentParentIsContainer = true; break findParent; + case FundamentalComponent: + if (enableFundamentalAPI) { + currentParent = parentStateNode.instance; + currentParentIsContainer = false; + } } parent = parent.return; } @@ -15948,7 +18147,7 @@ function unmountHostComponents(current$$1) { } if (node.tag === HostComponent || node.tag === HostText) { - commitNestedUnmounts(node); + commitNestedUnmounts(node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the // node from the tree. if (currentParentIsContainer) { @@ -15957,6 +18156,16 @@ function unmountHostComponents(current$$1) { removeChild(currentParent, node.stateNode); } // Don't visit children because we already visited them. + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var fundamentalNode = node.stateNode.instance; + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, fundamentalNode); + } else { + removeChild(currentParent, fundamentalNode); + } } else if ( enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent @@ -15979,7 +18188,7 @@ function unmountHostComponents(current$$1) { continue; } } else { - commitUnmount(node); + commitUnmount(node, renderPriorityLevel); // Visit children because we may find more host components below. if (node.child !== null) { node.child.return = node; @@ -16006,14 +18215,14 @@ function unmountHostComponents(current$$1) { } } -function commitDeletion(current$$1) { +function commitDeletion(current$$1, renderPriorityLevel) { if (supportsMutation) { // Recursively delete all host nodes from the parent. // Detach refs and call componentWillUnmount() on the whole subtree. - unmountHostComponents(current$$1); + unmountHostComponents(current$$1, renderPriorityLevel); } else { // Detach refs and call componentWillUnmount() on the whole subtree. - commitNestedUnmounts(current$$1); + commitNestedUnmounts(current$$1, renderPriorityLevel); } detachFiber(current$$1); } @@ -16035,6 +18244,11 @@ function commitWork(current$$1, finishedWork) { } case SuspenseComponent: { commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); return; } } @@ -16087,7 +18301,9 @@ function commitWork(current$$1, finishedWork) { (function() { if (!(finishedWork.stateNode !== null)) { throw ReactError( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16100,9 +18316,6 @@ function commitWork(current$$1, finishedWork) { commitTextUpdate(textInstance, oldText, newText); return; } - case EventTarget: { - return; - } case HostRoot: { return; } @@ -16111,19 +18324,30 @@ function commitWork(current$$1, finishedWork) { } case SuspenseComponent: { commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); return; } case IncompleteClassComponent: { return; } - case EventComponent: { + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = finishedWork.stateNode; + updateFundamentalComponent(fundamentalInstance); + } return; } default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16141,27 +18365,33 @@ function commitSuspenseComponent(finishedWork) { } else { newDidTimeout = true; primaryChildParent = finishedWork.child; - if (newState.fallbackExpirationTime === NoWork) { - // If the children had not already timed out, record the time. - // This is used to compute the elapsed time during subsequent - // attempts to render the children. - // We model this as a normal pri expiration time since that's - // how we infer start time for updates. - newState.fallbackExpirationTime = computeAsyncExpirationNoBucket( - requestCurrentTime() - ); - } + markCommitTimeOfFallback(); } if (supportsMutation && primaryChildParent !== null) { hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); } - // If this boundary just timed out, then it will have a set of thenables. - // For each thenable, attach a listener so that when it resolves, React - // attempts to re-render the boundary in the primary (pre-timeout) state. - var thenables = finishedWork.updateQueue; - if (thenables !== null) { + if (enableSuspenseCallback && newState !== null) { + var suspenseCallback = finishedWork.memoizedProps.suspenseCallback; + if (typeof suspenseCallback === "function") { + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + suspenseCallback(new Set(thenables)); + } + } else { + if (suspenseCallback !== undefined) { + warning$1(false, "Unexpected type for suspenseCallback."); + } + } + } +} + +function attachSuspenseRetryListeners(finishedWork) { + // If this boundary just timed out, then it will have a set of thenables. + // For each thenable, attach a listener so that when it resolves, React + var thenables = finishedWork.updateQueue; + if (thenables !== null) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; if (retryCache === null) { @@ -16192,7 +18422,7 @@ var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, null); // Unmount the root by rendering null. update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property @@ -16207,12 +18437,13 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, null); update.tag = CaptureUpdate; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if (typeof getDerivedStateFromError === "function") { var error = errorInfo.value; update.payload = function() { + logError(fiber, errorInfo); return getDerivedStateFromError(error); }; } @@ -16220,6 +18451,9 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { var inst = fiber.stateNode; if (inst !== null && typeof inst.componentDidCatch === "function") { update.callback = function callback() { + { + markFailedErrorBoundaryForHotReloading(fiber); + } if (typeof getDerivedStateFromError !== "function") { // To preserve the preexisting retry behavior of error boundaries, // we keep track of which ones already failed during this batch. @@ -16227,10 +18461,12 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { // TODO: Warn in strict mode if getDerivedStateFromError is // not defined. markLegacyErrorBoundaryAsFailed(this); + + // Only log here if componentDidCatch is the only error boundary method defined + logError(fiber, errorInfo); } var error = errorInfo.value; var stack = errorInfo.stack; - logError(fiber, errorInfo); this.componentDidCatch(error, { componentStack: stack !== null ? stack : "" }); @@ -16250,6 +18486,10 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { } } }; + } else { + update.callback = function() { + markFailedErrorBoundaryForHotReloading(fiber); + }; } return update; } @@ -16307,12 +18547,19 @@ function throwException( // This is a thenable. var thenable = value; + checkForWrongSuspensePriorityInDEV(sourceFiber); + + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + // Schedule the nearest Suspense to re-render the timed out view. var _workInProgress = returnFiber; do { if ( _workInProgress.tag === SuspenseComponent && - shouldCaptureSuspense(_workInProgress) + shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) ) { // Found the nearest boundary. @@ -16326,15 +18573,15 @@ function throwException( thenables.add(thenable); } - // If the boundary is outside of concurrent mode, we should *not* + // If the boundary is outside of batched mode, we should *not* // suspend the commit. Pretend as if the suspended component rendered // null and keep rendering. In the commit phase, we'll schedule a // subsequent synchronous update to re-render the Suspense. // // Note: It doesn't matter whether the component that suspended was - // inside a concurrent mode tree. If the Suspense is outside of it, we + // inside a batched mode tree. If the Suspense is outside of it, we // should *not* suspend the commit. - if ((_workInProgress.mode & ConcurrentMode) === NoContext) { + if ((_workInProgress.mode & BatchedMode) === NoMode) { _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete. @@ -16351,9 +18598,9 @@ function throwException( sourceFiber.tag = IncompleteClassComponent; } else { // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force updte to + // since it's known to be in an inconsistent state. Use a force update to // prevent a bail out. - var update = createUpdate(Sync); + var update = createUpdate(Sync, null); update.tag = ForceUpdate; enqueueUpdate(sourceFiber, update); } @@ -16369,11 +18616,51 @@ function throwException( // Confirmed that the boundary is in a concurrent mode tree. Continue // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. SuspenseConfig applies to + // this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. attachPingListener(root, renderExpirationTime, thenable); _workInProgress.effectTag |= ShouldCapture; _workInProgress.expirationTime = renderExpirationTime; + return; } else if ( enableSuspenseServerRenderer && @@ -16389,7 +18676,9 @@ function throwException( (function() { if (!current$$1) { throw ReactError( - "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + Error( + "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + ) ); } })(); @@ -16411,40 +18700,6 @@ function throwException( _workInProgress.effectTag |= ShouldCapture; _workInProgress.expirationTime = renderExpirationTime; return; - } else if ( - enableSuspenseServerRenderer && - _workInProgress.tag === DehydratedSuspenseComponent - ) { - attachPingListener(root, renderExpirationTime, thenable); - - // Since we already have a current fiber, we can eagerly add a retry listener. - var retryCache = _workInProgress.memoizedState; - if (retryCache === null) { - retryCache = _workInProgress.memoizedState = new PossiblyWeakSet(); - var _current = _workInProgress.alternate; - invariant( - _current, - "A dehydrated suspense boundary must commit before trying to render. " + - "This is probably a bug in React." - ); - _current.memoizedState = retryCache; - } - // Memoize using the boundary fiber to prevent redundant listeners. - if (!retryCache.has(thenable)) { - retryCache.add(thenable); - var retry = resolveRetryThenable.bind( - null, - _workInProgress, - thenable - ); - if (enableSchedulerTracing) { - retry = tracing.unstable_wrap(retry); - } - thenable.then(retry, retry); - } - _workInProgress.effectTag |= ShouldCapture; - _workInProgress.expirationTime = renderExpirationTime; - return; } // This boundary already captured during this render. Continue to the next // boundary. @@ -16513,129 +18768,30 @@ function throwException( } while (workInProgress !== null); } -function unwindWork(workInProgress, renderExpirationTime) { - switch (workInProgress.tag) { - case ClassComponent: { - var Component = workInProgress.type; - if (isContextProvider(Component)) { - popContext(workInProgress); - } - var effectTag = workInProgress.effectTag; - if (effectTag & ShouldCapture) { - workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; - return workInProgress; - } - return null; - } - case HostRoot: { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - var _effectTag = workInProgress.effectTag; - (function() { - if (!((_effectTag & DidCapture) === NoEffect)) { - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - } - })(); - workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; - return workInProgress; - } - case HostComponent: { - // TODO: popHydrationState - popHostContext(workInProgress); - return null; - } - case SuspenseComponent: { - var _effectTag2 = workInProgress.effectTag; - if (_effectTag2 & ShouldCapture) { - workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; - // Captured a suspense effect. Re-render the boundary. - return workInProgress; - } - return null; - } - case DehydratedSuspenseComponent: { - if (enableSuspenseServerRenderer) { - // TODO: popHydrationState - var _effectTag3 = workInProgress.effectTag; - if (_effectTag3 & ShouldCapture) { - workInProgress.effectTag = - (_effectTag3 & ~ShouldCapture) | DidCapture; - // Captured a suspense effect. Re-render the boundary. - return workInProgress; - } - } - return null; - } - case HostPortal: - popHostContainer(workInProgress); - return null; - case ContextProvider: - popProvider(workInProgress); - return null; - case EventComponent: - case EventTarget: - if (enableEventAPI) { - popHostContext(workInProgress); - } - return null; - default: - return null; - } -} - -function unwindInterruptedWork(interruptedWork) { - switch (interruptedWork.tag) { - case ClassComponent: { - var childContextTypes = interruptedWork.type.childContextTypes; - if (childContextTypes !== null && childContextTypes !== undefined) { - popContext(interruptedWork); - } - break; - } - case HostRoot: { - popHostContainer(interruptedWork); - popTopLevelContextObject(interruptedWork); - break; - } - case HostComponent: { - popHostContext(interruptedWork); - break; - } - case HostPortal: - popHostContainer(interruptedWork); - break; - case ContextProvider: - popProvider(interruptedWork); - break; - default: - break; - } -} - -// TODO: Ahaha Andrew is bad at spellling +// The scheduler is imported here *only* to detect whether it's been mocked // DEV stuff var ceil = Math.ceil; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; -var ReactShouldWarnActingUpdates = - ReactSharedInternals.ReactShouldWarnActingUpdates; +var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; -var NotWorking = 0; -var BatchedPhase = 1; -var LegacyUnbatchedPhase = 2; -var RenderPhase = 4; -var CommitPhase = 5; +var NoContext = /* */ 0; +var BatchedContext = /* */ 1; +var EventContext = /* */ 2; +var DiscreteEventContext = /* */ 4; +var LegacyUnbatchedContext = /* */ 8; +var RenderContext = /* */ 16; +var CommitContext = /* */ 32; var RootIncomplete = 0; var RootErrored = 1; var RootSuspended = 2; -var RootCompleted = 3; +var RootSuspendedWithDelay = 3; +var RootCompleted = 4; -// The phase of work we're currently in -var workPhase = NotWorking; +// Describes where we are in the React execution stack +var executionContext = NoContext; // The root we're working on var workInProgressRoot = null; // The fiber we're working on @@ -16648,1928 +18804,3361 @@ var workInProgressRootExitStatus = RootIncomplete; // This is conceptually a time stamp but expressed in terms of an ExpirationTime // because we deal mostly with expiration times in the hot path, so this avoids // the conversion happening in the hot path. -var workInProgressRootMostRecentEventTime = Sync; +var workInProgressRootLatestProcessedExpirationTime = Sync; +var workInProgressRootLatestSuspenseTimeout = Sync; +var workInProgressRootCanSuspendUsingConfig = null; +// If we're pinged while rendering we don't always restart immediately. +// This flag determines if it might be worthwhile to restart if an opportunity +// happens latere. +var workInProgressRootHasPendingPing = false; +// The most recent time we committed a fallback. This lets us ensure a train +// model where we don't commit new loading states in too quick succession. +var globalMostRecentFallbackTime = 0; +var FALLBACK_THROTTLE_MS = 500; var nextEffect = null; var hasUncaughtError = false; var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; -var rootDoesHavePassiveEffects = false; -var rootWithPendingPassiveEffects = null; -var pendingPassiveEffectsExpirationTime = NoWork; +var rootDoesHavePassiveEffects = false; +var rootWithPendingPassiveEffects = null; +var pendingPassiveEffectsRenderPriority = NoPriority; +var pendingPassiveEffectsExpirationTime = NoWork; + +var rootsWithPendingDiscreteUpdates = null; + +// Use these to prevent an infinite loop of nested updates +var NESTED_UPDATE_LIMIT = 50; +var nestedUpdateCount = 0; +var rootWithNestedUpdates = null; + +var NESTED_PASSIVE_UPDATE_LIMIT = 50; +var nestedPassiveUpdateCount = 0; + +var interruptedBy = null; + +// Marks the need to reschedule pending interactions at these expiration times +// during the commit phase. This enables them to be traced across components +// that spawn new work during render. E.g. hidden boundaries, suspended SSR +// hydration or SuspenseList. +var spawnedWorkDuringRender = null; + +// Expiration times are computed by adding to the current time (the start +// time). However, if two updates are scheduled within the same event, we +// should treat their start times as simultaneous, even if the actual clock +// time has advanced between the first and second call. + +// In other words, because expiration times determine how updates are batched, +// we want all updates of like priority that occur within the same event to +// receive the same expiration time. Otherwise we get tearing. +var currentEventTime = NoWork; + +function requestCurrentTime() { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + // We're inside React, so it's fine to read the actual time. + return msToExpirationTime(now()); + } + // We're not inside React, so we may be in the middle of a browser event. + if (currentEventTime !== NoWork) { + // Use the same start time for all updates until we enter React again. + return currentEventTime; + } + // This is the first update since React yielded. Compute a new start time. + currentEventTime = msToExpirationTime(now()); + return currentEventTime; +} + +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + var mode = fiber.mode; + if ((mode & BatchedMode) === NoMode) { + return Sync; + } + + var priorityLevel = getCurrentPriorityLevel(); + if ((mode & ConcurrentMode) === NoMode) { + return priorityLevel === ImmediatePriority ? Sync : Batched; + } + + if ((executionContext & RenderContext) !== NoContext) { + // Use whatever time we're already rendering + return renderExpirationTime; + } + + var expirationTime = void 0; + if (suspenseConfig !== null) { + // Compute an expiration time based on the Suspense timeout. + expirationTime = computeSuspenseExpiration( + currentTime, + suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION + ); + } else { + // Compute an expiration time based on the Scheduler priority. + switch (priorityLevel) { + case ImmediatePriority: + expirationTime = Sync; + break; + case UserBlockingPriority$1: + // TODO: Rename this to computeUserBlockingExpiration + expirationTime = computeInteractiveExpiration(currentTime); + break; + case NormalPriority: + case LowPriority: + // TODO: Handle LowPriority + // TODO: Rename this to... something better. + expirationTime = computeAsyncExpiration(currentTime); + break; + case IdlePriority: + expirationTime = Never; + break; + default: + (function() { + { + throw ReactError(Error("Expected a valid priority level")); + } + })(); + } + } + + // If we're in the middle of rendering a tree, do not update at the same + // expiration time that is already rendering. + // TODO: We shouldn't have to do this if the update is on a different root. + // Refactor computeExpirationForFiber + scheduleUpdate so we have access to + // the root when we check for this condition. + if (workInProgressRoot !== null && expirationTime === renderExpirationTime) { + // This is a trick to move this update into a separate batch + expirationTime -= 1; + } + + return expirationTime; +} + +function scheduleUpdateOnFiber(fiber, expirationTime) { + checkForNestedUpdates(); + warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber); + + var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (root === null) { + warnAboutUpdateOnUnmountedFiberInDEV(fiber); + return; + } + + root.pingTime = NoWork; + + checkForInterruption(fiber, expirationTime); + recordScheduleUpdate(); + + // TODO: computeExpirationForFiber also reads the priority. Pass the + // priority as an argument to that function and this one. + var priorityLevel = getCurrentPriorityLevel(); + + if (expirationTime === Sync) { + if ( + // Check if we're inside unbatchedUpdates + (executionContext & LegacyUnbatchedContext) !== NoContext && + // Check if we're not already rendering + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Register pending interactions on the root to avoid losing traced interaction data. + schedulePendingInteractions(root, expirationTime); + + // This is a legacy edge case. The initial mount of a ReactDOM.render-ed + // root inside of batchedUpdates should be synchronous, but layout updates + // should be deferred until the end of the batch. + var callback = renderRoot(root, Sync, true); + while (callback !== null) { + callback = callback(true); + } + } else { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + if (executionContext === NoContext) { + // Flush the synchronous work now, wnless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of sync mode. + flushSyncCallbackQueue(); + } + } + } else { + scheduleCallbackForRoot(root, priorityLevel, expirationTime); + } + + if ( + (executionContext & DiscreteEventContext) !== NoContext && + // Only updates at user-blocking priority or greater are considered + // discrete, even inside a discrete event. + (priorityLevel === UserBlockingPriority$1 || + priorityLevel === ImmediatePriority) + ) { + // This is the result of a discrete event. Track the lowest priority + // discrete update per root so we can flush them early, if needed. + if (rootsWithPendingDiscreteUpdates === null) { + rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); + } else { + var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); + if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) { + rootsWithPendingDiscreteUpdates.set(root, expirationTime); + } + } + } +} +var scheduleWork = scheduleUpdateOnFiber; + +// This is split into a separate function so we can mark a fiber with pending +// work without treating it as a typical update that originates from an event; +// e.g. retrying a Suspense boundary isn't an update, but it does schedule work +// on a fiber. +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + // Update the source fiber's expiration time + if (fiber.expirationTime < expirationTime) { + fiber.expirationTime = expirationTime; + } + var alternate = fiber.alternate; + if (alternate !== null && alternate.expirationTime < expirationTime) { + alternate.expirationTime = expirationTime; + } + // Walk the parent path to the root and update the child expiration time. + var node = fiber.return; + var root = null; + if (node === null && fiber.tag === HostRoot) { + root = fiber.stateNode; + } else { + while (node !== null) { + alternate = node.alternate; + if (node.childExpirationTime < expirationTime) { + node.childExpirationTime = expirationTime; + if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + } else if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + if (node.return === null && node.tag === HostRoot) { + root = node.stateNode; + break; + } + node = node.return; + } + } + + if (root !== null) { + // Update the first and last pending expiration times in this root + var firstPendingTime = root.firstPendingTime; + if (expirationTime > firstPendingTime) { + root.firstPendingTime = expirationTime; + } + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime === NoWork || expirationTime < lastPendingTime) { + root.lastPendingTime = expirationTime; + } + } + + return root; +} + +// Use this function, along with runRootCallback, to ensure that only a single +// callback per root is scheduled. It's still possible to call renderRoot +// directly, but scheduling via this function helps avoid excessive callbacks. +// It works by storing the callback node and expiration time on the root. When a +// new callback comes in, it compares the expiration time to determine if it +// should cancel the previous one. It also relies on commitRoot scheduling a +// callback to render the next level, because that means we don't need a +// separate callback per expiration time. +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + var existingCallbackExpirationTime = root.callbackExpirationTime; + if (existingCallbackExpirationTime < expirationTime) { + // New callback has higher priority than the existing one. + var existingCallbackNode = root.callbackNode; + if (existingCallbackNode !== null) { + cancelCallback(existingCallbackNode); + } + root.callbackExpirationTime = expirationTime; + + if (expirationTime === Sync) { + // Sync React callbacks are scheduled on a special internal queue + root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + ); + } else { + var options = null; + if ( + !disableSchedulerTimeoutBasedOnReactExpirationTime && + expirationTime !== Never + ) { + var timeout = expirationTimeToMs(expirationTime) - now(); + options = { timeout: timeout }; + } + + root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + options + ); + if ( + enableUserTimingAPI && + expirationTime !== Sync && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Scheduled an async callback, and we're not already working. Add an + // entry to the flamegraph that shows we're waiting for a callback + // to fire. + startRequestCallbackTimer(); + } + } + } + + // Associate the current interactions with this new root+priority. + schedulePendingInteractions(root, expirationTime); +} + +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode; + var continuation = null; + try { + continuation = callback(isSync); + if (continuation !== null) { + return runRootCallback.bind(null, root, continuation); + } else { + return null; + } + } finally { + // If the callback exits without returning a continuation, remove the + // corresponding callback node from the root. Unless the callback node + // has changed, which implies that it was already cancelled by a high + // priority update. + if (continuation === null && prevCallbackNode === root.callbackNode) { + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + } + } +} + +function flushDiscreteUpdates() { + // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. + // However, `act` uses `batchedUpdates`, so there's no way to distinguish + // those two cases. Need to fix this before exposing flushDiscreteUpdates + // as a public API. + if ( + (executionContext & (BatchedContext | RenderContext | CommitContext)) !== + NoContext + ) { + if (true && (executionContext & RenderContext) !== NoContext) { + warning$1( + false, + "unstable_flushDiscreteUpdates: Cannot flush updates when React is " + + "already rendering." + ); + } + // We're already rendering, so we can't synchronously flush pending work. + // This is probably a nested event dispatch triggered by a lifecycle/effect, + // like `el.focus()`. Exit. + return; + } + flushPendingDiscreteUpdates(); + if (!revertPassiveEffectsChange) { + // If the discrete updates scheduled passive effects, flush them now so that + // they fire before the next serial event. + flushPassiveEffects(); + } +} + +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + if ( + firstBatch !== null && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ) { + scheduleCallback(NormalPriority, function() { + firstBatch._onComplete(); + return null; + }); + return true; + } else { + return false; + } +} + +function flushPendingDiscreteUpdates() { + if (rootsWithPendingDiscreteUpdates !== null) { + // For each root with pending discrete updates, schedule a callback to + // immediately flush them. + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + // Now flush the immediate queue. + flushSyncCallbackQueue(); + } +} + +function batchedUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function batchedEventUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= EventContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function discreteUpdates$1(fn, a, b, c) { + var prevExecutionContext = executionContext; + executionContext |= DiscreteEventContext; + try { + // Should this + return runWithPriority$1(UserBlockingPriority$1, fn.bind(null, a, b, c)); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function flushSync(fn, a) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + (function() { + { + throw ReactError( + Error( + "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." + ) + ); + } + })(); + } + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return runWithPriority$1(ImmediatePriority, fn.bind(null, a)); + } finally { + executionContext = prevExecutionContext; + // Flush the immediate callbacks that were scheduled during this batch. + // Note that this will happen even if batchedUpdates is higher up + // the stack. + flushSyncCallbackQueue(); + } +} + +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + var timeoutHandle = root.timeoutHandle; + if (timeoutHandle !== noTimeout) { + // The root previous suspended and scheduled a timeout to commit a fallback + // state. Now that we have additional work, cancel the timeout. + root.timeoutHandle = noTimeout; + // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above + cancelTimeout(timeoutHandle); + } + + if (workInProgress !== null) { + var interruptedWork = workInProgress.return; + while (interruptedWork !== null) { + unwindInterruptedWork(interruptedWork); + interruptedWork = interruptedWork.return; + } + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestProcessedExpirationTime = Sync; + workInProgressRootLatestSuspenseTimeout = Sync; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = false; + + if (enableSchedulerTracing) { + spawnedWorkDuringRender = null; + } + + { + ReactStrictModeWarnings.discardPendingWarnings(); + componentsThatTriggeredHighPriSuspend = null; + } +} + +function renderRoot(root, expirationTime, isSync) { + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + if (enableUserTimingAPI && expirationTime !== Sync) { + var didExpire = isSync; + stopRequestCallbackTimer(didExpire); + } + + if (root.firstPendingTime < expirationTime) { + // If there's no work left at this expiration time, exit immediately. This + // happens when multiple callbacks are scheduled for a single root, but an + // earlier callback flushes the work of a later one. + return null; + } + + if (isSync && root.finishedExpirationTime === expirationTime) { + // There's already a pending commit at this expiration time. + // TODO: This is poorly factored. This case only exists for the + // batch.commit() API. + return commitRoot.bind(null, root); + } + + flushPassiveEffects(); + + // If the root or expiration time have changed, throw out the existing stack + // and prepare a fresh one. Otherwise we'll continue where we left off. + if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { + prepareFreshStack(root, expirationTime); + startWorkOnPendingInteractions(root, expirationTime); + } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // We could've received an update at a lower priority while we yielded. + // We're suspended in a delayed state. Once we complete this render we're + // just going to try to recover at the last pending time anyway so we might + // as well start doing that eagerly. + // Ideally we should be able to do this even for retries but we don't yet + // know if we're going to process an update which wants to commit earlier, + // and this path happens very early so it would happen too often. Instead, + // for that case, we'll wait until we complete. + if (workInProgressRootHasPendingPing) { + // We have a ping at this expiration. Let's restart to see if we get unblocked. + prepareFreshStack(root, expirationTime); + } else { + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately, while preserving the position in the queue. + return renderRoot.bind(null, root, lastPendingTime); + } + } + } + + // If we have a work-in-progress fiber, it means there's still work to do + // in this root. + if (workInProgress !== null) { + var prevExecutionContext = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + if (prevDispatcher === null) { + // The React isomorphic package does not include a default dispatcher. + // Instead the first renderer will lazily attach one, in order to give + // nicer error messages. + prevDispatcher = ContextOnlyDispatcher; + } + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + startWorkLoopTimer(workInProgress); + + // TODO: Fork renderRoot into renderRootSync and renderRootAsync + if (isSync) { + if (expirationTime !== Sync) { + // An async update expired. There may be other expired updates on + // this root. We should render all the expired work in a + // single batch. + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) { + // Restart at the current time. + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + return renderRoot.bind(null, root, currentTime); + } + } + } else { + // Since we know we're in a React event, we can clear the current + // event time. The next update will compute a new event time. + currentEventTime = NoWork; + } + + do { + try { + if (isSync) { + workLoopSync(); + } else { + workLoop(); + } + break; + } catch (thrownValue) { + // Reset module-level state that was set during the render phase. + resetContextDependencies(); + resetHooks(); + + var sourceFiber = workInProgress; + if (sourceFiber === null || sourceFiber.return === null) { + // Expected to be working on a non-root fiber. This is a fatal error + // because there's no ancestor that can handle it; the root is + // supposed to capture all errors that weren't caught by an error + // boundary. + prepareFreshStack(root, expirationTime); + executionContext = prevExecutionContext; + throw thrownValue; + } + + if (enableProfilerTimer && sourceFiber.mode & ProfileMode) { + // Record the time spent rendering before an error was thrown. This + // avoids inaccurate Profiler durations in the case of a + // suspended render. + stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true); + } + + var returnFiber = sourceFiber.return; + throwException( + root, + returnFiber, + sourceFiber, + thrownValue, + renderExpirationTime + ); + workInProgress = completeUnitOfWork(sourceFiber); + } + } while (true); + + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + + if (workInProgress !== null) { + // There's still work left over. Return a continuation. + stopInterruptedWorkLoopTimer(); + if (expirationTime !== Sync) { + startRequestCallbackTimer(); + } + return renderRoot.bind(null, root, expirationTime); + } + } + + // We now have a consistent tree. The next step is either to commit it, or, if + // something suspended, wait to commit it after a timeout. + stopFinishedWorkLoopTimer(); + + root.finishedWork = root.current.alternate; + root.finishedExpirationTime = expirationTime; + + var isLocked = resolveLocksOnRoot(root, expirationTime); + if (isLocked) { + // This root has a lock that prevents it from committing. Exit. If we begin + // work on the root again, without any intervening updates, it will finish + // without doing additional work. + return null; + } + + // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; + + switch (workInProgressRootExitStatus) { + case RootIncomplete: { + (function() { + { + throw ReactError(Error("Should have a work-in-progress.")); + } + })(); + } + // Flow knows about invariant, so it complains if I add a break statement, + // but eslint doesn't know about invariant, so it complains if I do. + // eslint-disable-next-line no-fallthrough + case RootErrored: { + // An error was thrown. First check if there is lower priority work + // scheduled on this root. + var _lastPendingTime = root.lastPendingTime; + if (_lastPendingTime < expirationTime) { + // There's lower priority work. Before raising the error, try rendering + // at the lower priority to see if it fixes it. Use a continuation to + // maintain the existing priority and position in the queue. + return renderRoot.bind(null, root, _lastPendingTime); + } + if (!isSync) { + // If we're rendering asynchronously, it's possible the error was + // caused by tearing due to a mutation during an event. Try rendering + // one more time without yiedling to events. + prepareFreshStack(root, expirationTime); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + return null; + } + // If we're already rendering synchronously, commit the root in its + // errored state. + return commitRoot.bind(null, root); + } + case RootSuspended: { + flushSuspensePriorityWarningInDEV(); + + // We have an acceptable loading state. We need to figure out if we should + // immediately commit it or wait a bit. + + // If we have processed new updates during this render, we may now have a + // new loading state ready. We want to ensure that we commit that as soon as + // possible. + var hasNotProcessedNewUpdates = + workInProgressRootLatestProcessedExpirationTime === Sync; + if ( + hasNotProcessedNewUpdates && + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // If we have not processed any new updates during this pass, then this is + // either a retry of an existing fallback state or a hidden tree. + // Hidden trees shouldn't be batched with other work and after that's + // fixed it can only be a retry. + // We're going to throttle committing retries so that we don't show too + // many loading states too quickly. + var msUntilTimeout = + globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); + // Don't bother with a very short suspense time. + if (msUntilTimeout > 10) { + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime2 = root.lastPendingTime; + if (_lastPendingTime2 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level. + return renderRoot.bind(null, root, _lastPendingTime2); + } + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootSuspendedWithDelay: { + flushSuspensePriorityWarningInDEV(); + + if ( + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // We're suspended in a state that should be avoided. We'll try to avoid committing + // it for as long as the timeouts let us. + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime3 = root.lastPendingTime; + if (_lastPendingTime3 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately. + return renderRoot.bind(null, root, _lastPendingTime3); + } + + var _msUntilTimeout = void 0; + if (workInProgressRootLatestSuspenseTimeout !== Sync) { + // We have processed a suspense config whose expiration time we can use as + // the timeout. + _msUntilTimeout = + expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now(); + } else if (workInProgressRootLatestProcessedExpirationTime === Sync) { + // This should never normally happen because only new updates cause + // delayed states, so we should have processed something. However, + // this could also happen in an offscreen tree. + _msUntilTimeout = 0; + } else { + // If we don't have a suspense config, we're going to use a heuristic to + var eventTimeMs = inferTimeFromExpirationTime( + workInProgressRootLatestProcessedExpirationTime + ); + var currentTimeMs = now(); + var timeUntilExpirationMs = + expirationTimeToMs(expirationTime) - currentTimeMs; + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed < 0) { + // We get this wrong some time since we estimate the time. + timeElapsed = 0; + } + + _msUntilTimeout = jnd(timeElapsed) - timeElapsed; + + // Clamp the timeout to the expiration time. + // TODO: Once the event time is exact instead of inferred from expiration time + // we don't need this. + if (timeUntilExpirationMs < _msUntilTimeout) { + _msUntilTimeout = timeUntilExpirationMs; + } + } + + // Don't bother with a very short suspense time. + if (_msUntilTimeout > 10) { + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootCompleted: { + // The work completed. Ready to commit. + if ( + !isSync && + // do not delay if we're inside an act() scope + !( + true && + flushSuspenseFallbacksInTests && + IsThisRendererActing.current + ) && + workInProgressRootLatestProcessedExpirationTime !== Sync && + workInProgressRootCanSuspendUsingConfig !== null + ) { + // If we have exceeded the minimum loading delay, which probably + // means we have shown a spinner already, we might have to suspend + // a bit longer to ensure that the spinner is shown for enough time. + var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay( + workInProgressRootLatestProcessedExpirationTime, + expirationTime, + workInProgressRootCanSuspendUsingConfig + ); + if (_msUntilTimeout2 > 10) { + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout2 + ); + return null; + } + } + return commitRoot.bind(null, root); + } + default: { + (function() { + { + throw ReactError(Error("Unknown root exit status.")); + } + })(); + } + } +} + +function markCommitTimeOfFallback() { + globalMostRecentFallbackTime = now(); +} + +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + if ( + expirationTime < workInProgressRootLatestProcessedExpirationTime && + expirationTime > Never + ) { + workInProgressRootLatestProcessedExpirationTime = expirationTime; + } + if (suspenseConfig !== null) { + if ( + expirationTime < workInProgressRootLatestSuspenseTimeout && + expirationTime > Never + ) { + workInProgressRootLatestSuspenseTimeout = expirationTime; + // Most of the time we only have one config and getting wrong is not bad. + workInProgressRootCanSuspendUsingConfig = suspenseConfig; + } + } +} + +function renderDidSuspend() { + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootSuspended; + } +} + +function renderDidSuspendDelayIfPossible() { + if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) { + workInProgressRootExitStatus = RootSuspendedWithDelay; + } +} + +function renderDidError() { + if (workInProgressRootExitStatus !== RootCompleted) { + workInProgressRootExitStatus = RootErrored; + } +} + +// Called during render to determine if anything has suspended. +// Returns false if we're not sure. +function renderHasNotSuspendedYet() { + // If something errored or completed, we can't really be sure, + // so those are false. + return workInProgressRootExitStatus === RootIncomplete; +} + +function inferTimeFromExpirationTime(expirationTime) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; +} + +function inferTimeFromExpirationTimeWithSuspenseConfig( + expirationTime, + suspenseConfig +) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time by subtracting the timeout + // that was added to the event time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return ( + earliestExpirationTimeMs - + (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION) + ); +} + +function workLoopSync() { + // Already timed out, so perform work without checking if we need to yield. + while (workInProgress !== null) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function workLoop() { + // Perform work until Scheduler asks us to yield + while (workInProgress !== null && !shouldYield()) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function performUnitOfWork(unitOfWork) { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = unitOfWork.alternate; + + startWorkTimer(unitOfWork); + setCurrentFiber(unitOfWork); + + var next = void 0; + if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) { + startProfilerTimer(unitOfWork); + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); + } else { + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + } + + resetCurrentFiber(); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + if (next === null) { + // If this doesn't spawn new work, complete the current work. + next = completeUnitOfWork(unitOfWork); + } + + ReactCurrentOwner$2.current = null; + return next; +} + +function completeUnitOfWork(unitOfWork) { + // Attempt to complete the current unit of work, then move to the next + // sibling. If there are no more siblings, return to the parent fiber. + workInProgress = unitOfWork; + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = workInProgress.alternate; + var returnFiber = workInProgress.return; + + // Check if the work completed or if something threw. + if ((workInProgress.effectTag & Incomplete) === NoEffect) { + setCurrentFiber(workInProgress); + var next = void 0; + if ( + !enableProfilerTimer || + (workInProgress.mode & ProfileMode) === NoMode + ) { + next = completeWork(current$$1, workInProgress, renderExpirationTime); + } else { + startProfilerTimer(workInProgress); + next = completeWork(current$$1, workInProgress, renderExpirationTime); + // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + } + stopWorkTimer(workInProgress); + resetCurrentFiber(); + resetChildExpirationTime(workInProgress); + + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + return next; + } + + if ( + returnFiber !== null && + // Do not append effects to parents if a sibling failed to complete + (returnFiber.effectTag & Incomplete) === NoEffect + ) { + // Append all the effects of the subtree and this fiber onto the effect + // list of the parent. The completion order of the children affects the + // side-effect order. + if (returnFiber.firstEffect === null) { + returnFiber.firstEffect = workInProgress.firstEffect; + } + if (workInProgress.lastEffect !== null) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; + } + returnFiber.lastEffect = workInProgress.lastEffect; + } + + // If this fiber had side-effects, we append it AFTER the children's + // side-effects. We can perform certain side-effects earlier if needed, + // by doing multiple passes over the effect list. We don't want to + // schedule our own side-effect on our own list because if end up + // reusing children we'll schedule this effect onto itself since we're + // at the end. + var effectTag = workInProgress.effectTag; + + // Skip both NoWork and PerformedWork tags when creating the effect + // list. PerformedWork effect is read by React DevTools but shouldn't be + // committed. + if (effectTag > PerformedWork) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress; + } else { + returnFiber.firstEffect = workInProgress; + } + returnFiber.lastEffect = workInProgress; + } + } + } else { + // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + var _next = unwindWork(workInProgress, renderExpirationTime); + + // Because this fiber did not complete, don't reset its expiration time. + + if ( + enableProfilerTimer && + (workInProgress.mode & ProfileMode) !== NoMode + ) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + + // Include the time spent working on failed children before continuing. + var actualDuration = workInProgress.actualDuration; + var child = workInProgress.child; + while (child !== null) { + actualDuration += child.actualDuration; + child = child.sibling; + } + workInProgress.actualDuration = actualDuration; + } + + if (_next !== null) { + // If completing this work spawned new work, do that next. We'll come + // back here again. + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + // TODO: The name stopFailedWorkTimer is misleading because Suspense + // also captures and restarts. + stopFailedWorkTimer(workInProgress); + _next.effectTag &= HostEffectMask; + return _next; + } + stopWorkTimer(workInProgress); + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its effect list. + returnFiber.firstEffect = returnFiber.lastEffect = null; + returnFiber.effectTag |= Incomplete; + } + } + + var siblingFiber = workInProgress.sibling; + if (siblingFiber !== null) { + // If there is more work to do in this returnFiber, do that next. + return siblingFiber; + } + // Otherwise, return to the parent + workInProgress = returnFiber; + } while (workInProgress !== null); + + // We've reached the root. + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootCompleted; + } + return null; +} + +function resetChildExpirationTime(completedWork) { + if ( + renderExpirationTime !== Never && + completedWork.childExpirationTime === Never + ) { + // The children of this component are hidden. Don't bubble their + // expiration times. + return; + } + + var newChildExpirationTime = NoWork; + + // Bubble up the earliest expiration time. + if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) { + // In profiling mode, resetChildExpirationTime is also used to reset + // profiler durations. + var actualDuration = completedWork.actualDuration; + var treeBaseDuration = completedWork.selfBaseDuration; + + // When a fiber is cloned, its actualDuration is reset to 0. This value will + // only be updated if work is done on the fiber (i.e. it doesn't bailout). + // When work is done, it should bubble to the parent's actualDuration. If + // the fiber has not been cloned though, (meaning no work was done), then + // this value will reflect the amount of time spent working on a previous + // render. In that case it should not bubble. We determine whether it was + // cloned by comparing the child pointer. + var shouldBubbleActualDurations = + completedWork.alternate === null || + completedWork.child !== completedWork.alternate.child; + + var child = completedWork.child; + while (child !== null) { + var childUpdateExpirationTime = child.expirationTime; + var childChildExpirationTime = child.childExpirationTime; + if (childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childUpdateExpirationTime; + } + if (childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childChildExpirationTime; + } + if (shouldBubbleActualDurations) { + actualDuration += child.actualDuration; + } + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + completedWork.actualDuration = actualDuration; + completedWork.treeBaseDuration = treeBaseDuration; + } else { + var _child = completedWork.child; + while (_child !== null) { + var _childUpdateExpirationTime = _child.expirationTime; + var _childChildExpirationTime = _child.childExpirationTime; + if (_childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childUpdateExpirationTime; + } + if (_childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childChildExpirationTime; + } + _child = _child.sibling; + } + } + + completedWork.childExpirationTime = newChildExpirationTime; +} + +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1( + ImmediatePriority, + commitRootImpl.bind(null, root, renderPriorityLevel) + ); + // If there are passive effects, schedule a callback to flush them. This goes + // outside commitRootImpl so that it inherits the priority of the render. + if (rootWithPendingPassiveEffects !== null) { + scheduleCallback(NormalPriority, function() { + flushPassiveEffects(); + return null; + }); + } + return null; +} + +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + flushRenderPhaseStrictModeWarningsInDEV(); + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + var finishedWork = root.finishedWork; + var expirationTime = root.finishedExpirationTime; + if (finishedWork === null) { + return null; + } + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + (function() { + if (!(finishedWork !== root.current)) { + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + // commitRoot never returns a continuation; it always finishes synchronously. + // So we can clear these now to allow a new callback to be scheduled. + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + + startCommitTimer(); + + // Update the first and last pending times on this root. The new first + // pending time is whatever is left on the root fiber. + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime; + var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + var firstPendingTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = firstPendingTimeBeforeCommit; + if (firstPendingTimeBeforeCommit < root.lastPendingTime) { + // This usually means we've finished all the work, but it can also happen + // when something gets downprioritized during render, like a hidden tree. + root.lastPendingTime = firstPendingTimeBeforeCommit; + } + + if (root === workInProgressRoot) { + // We can reset these now that they are finished. + workInProgressRoot = null; + workInProgress = null; + renderExpirationTime = NoWork; + } else { + } + // This indicates that the last root we worked on is not the same one that + // we're committing now. This most commonly happens when a suspended root + // times out. + + // Get the list of effects. + var firstEffect = void 0; + if (finishedWork.effectTag > PerformedWork) { + // A fiber's effect list consists only of its children, not itself. So if + // the root has an effect, we need to add it to the end of the list. The + // resulting list is the set that would belong to the root's parent, if it + // had one; that is, all the effects in the tree including the root. + if (finishedWork.lastEffect !== null) { + finishedWork.lastEffect.nextEffect = finishedWork; + firstEffect = finishedWork.firstEffect; + } else { + firstEffect = finishedWork; + } + } else { + // There is no effect on the root. + firstEffect = finishedWork.firstEffect; + } + + if (firstEffect !== null) { + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + // Reset this to null before calling lifecycles + ReactCurrentOwner$2.current = null; + + // The commit phase is broken into several sub-phases. We do a separate pass + // of the effect list for each phase: all mutation effects come before all + // layout effects, and so on. + + // The first phase a "before mutation" phase. We use this phase to read the + // state of the host tree right before we mutate it. This is where + // getSnapshotBeforeUpdate is called. + startCommitSnapshotEffectsTimer(); + prepareForCommit(root.containerInfo); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback(null, commitBeforeMutationEffects, null); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitSnapshotEffectsTimer(); + + if (enableProfilerTimer) { + // Mark the current commit time to be shared by all Profilers in this + // batch. This enables them to be grouped later. + recordCommitTime(); + } + + // The next phase is the mutation phase, where we mutate the host tree. + startCommitHostEffectsTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitMutationEffects, + null, + renderPriorityLevel + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitHostEffectsTimer(); + resetAfterCommit(root.containerInfo); + + // The work-in-progress tree is now the current tree. This must come after + // the mutation phase, so that the previous tree is still current during + // componentWillUnmount, but before the layout phase, so that the finished + // work is current during componentDidMount/Update. + root.current = finishedWork; -var rootsWithPendingDiscreteUpdates = null; + // The next phase is the layout phase, where we call effects that read + // the host tree after it's been mutated. The idiomatic use case for this is + // layout, but class component lifecycles also fire here for legacy reasons. + startCommitLifeCyclesTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitLayoutEffects, + null, + root, + expirationTime + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error2 = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error2); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitLifeCyclesTimer(); -// Use these to prevent an infinite loop of nested updates -var NESTED_UPDATE_LIMIT = 50; -var nestedUpdateCount = 0; -var rootWithNestedUpdates = null; + nextEffect = null; -var NESTED_PASSIVE_UPDATE_LIMIT = 50; -var nestedPassiveUpdateCount = 0; + // Tell Scheduler to yield at the end of the frame, so the browser has an + // opportunity to paint. + requestPaint(); -var interruptedBy = null; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + executionContext = prevExecutionContext; + } else { + // No effects. + root.current = finishedWork; + // Measure these anyway so the flamegraph explicitly shows that there were + // no effects. + // TODO: Maybe there's a better way to report this. + startCommitSnapshotEffectsTimer(); + stopCommitSnapshotEffectsTimer(); + if (enableProfilerTimer) { + recordCommitTime(); + } + startCommitHostEffectsTimer(); + stopCommitHostEffectsTimer(); + startCommitLifeCyclesTimer(); + stopCommitLifeCyclesTimer(); + } -// Expiration times are computed by adding to the current time (the start -// time). However, if two updates are scheduled within the same event, we -// should treat their start times as simultaneous, even if the actual clock -// time has advanced between the first and second call. + stopCommitTimer(); -// In other words, because expiration times determine how updates are batched, -// we want all updates of like priority that occur within the same event to -// receive the same expiration time. Otherwise we get tearing. -var currentEventTime = NoWork; + var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; -function requestCurrentTime() { - if (workPhase === RenderPhase || workPhase === CommitPhase) { - // We're inside React, so it's fine to read the actual time. - return msToExpirationTime(now()); + if (rootDoesHavePassiveEffects) { + // This commit has passive effects. Stash a reference to them. But don't + // schedule a callback until after flushing layout work. + rootDoesHavePassiveEffects = false; + rootWithPendingPassiveEffects = root; + pendingPassiveEffectsExpirationTime = expirationTime; + pendingPassiveEffectsRenderPriority = renderPriorityLevel; + } else { + // We are done with the effect chain at this point so let's clear the + // nextEffect pointers to assist with GC. If we have passive effects, we'll + // clear this in flushPassiveEffects. + nextEffect = firstEffect; + while (nextEffect !== null) { + var nextNextEffect = nextEffect.nextEffect; + nextEffect.nextEffect = null; + nextEffect = nextNextEffect; + } } - // We're not inside React, so we may be in the middle of a browser event. - if (currentEventTime !== NoWork) { - // Use the same start time for all updates until we enter React again. - return currentEventTime; + + // Check if there's remaining work on this root + var remainingExpirationTime = root.firstPendingTime; + if (remainingExpirationTime !== NoWork) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + remainingExpirationTime + ); + + if (enableSchedulerTracing) { + if (spawnedWorkDuringRender !== null) { + var expirationTimes = spawnedWorkDuringRender; + spawnedWorkDuringRender = null; + for (var i = 0; i < expirationTimes.length; i++) { + scheduleInteractions( + root, + expirationTimes[i], + root.memoizedInteractions + ); + } + } + } + + scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); + } else { + // If there's no remaining work, we can clear the set of already failed + // error boundaries. + legacyErrorBoundariesThatAlreadyFailed = null; } - // This is the first update since React yielded. Compute a new start time. - currentEventTime = msToExpirationTime(now()); - return currentEventTime; -} -function computeExpirationForFiber(currentTime, fiber) { - if ((fiber.mode & ConcurrentMode) === NoContext) { - return Sync; + if (enableSchedulerTracing) { + if (!rootDidHavePassiveEffects) { + // If there are no passive effects, then we can complete the pending interactions. + // Otherwise, we'll wait until after the passive effects are flushed. + // Wait to do this until after remaining work has been scheduled, + // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. + finishPendingInteractions(root, expirationTime); + } } - if (workPhase === RenderPhase) { - // Use whatever time we're already rendering - return renderExpirationTime; + onCommitRoot(finishedWork.stateNode, expirationTime); + + if (remainingExpirationTime === Sync) { + // Count the number of times the root synchronously re-renders without + // finishing. If there are too many, it indicates an infinite update loop. + if (root === rootWithNestedUpdates) { + nestedUpdateCount++; + } else { + nestedUpdateCount = 0; + rootWithNestedUpdates = root; + } + } else { + nestedUpdateCount = 0; } - // Compute an expiration time based on the Scheduler priority. - var expirationTime = void 0; - var priorityLevel = getCurrentPriorityLevel(); - switch (priorityLevel) { - case ImmediatePriority: - expirationTime = Sync; - break; - case UserBlockingPriority: - // TODO: Rename this to computeUserBlockingExpiration - expirationTime = computeInteractiveExpiration(currentTime); - break; - case NormalPriority: - case LowPriority: - // TODO: Handle LowPriority - // TODO: Rename this to... something better. - expirationTime = computeAsyncExpiration(currentTime); - break; - case IdlePriority: - expirationTime = Never; - break; - default: - (function() { - { - throw ReactError("Expected a valid priority level"); - } - })(); + if (hasUncaughtError) { + hasUncaughtError = false; + var _error3 = firstUncaughtError; + firstUncaughtError = null; + throw _error3; } - // If we're in the middle of rendering a tree, do not update at the same - // expiration time that is already rendering. - if (workInProgressRoot !== null && expirationTime === renderExpirationTime) { - // This is a trick to move this update into a separate batch - expirationTime -= 1; + if ((executionContext & LegacyUnbatchedContext) !== NoContext) { + // This is a legacy edge case. We just committed the initial mount of + // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired + // synchronously, but layout updates should be deferred until the end + // of the batch. + return null; } - return expirationTime; + // If layout work was scheduled, flush it now. + flushSyncCallbackQueue(); + return null; } -function scheduleUpdateOnFiber(fiber, expirationTime) { - checkForNestedUpdates(); - warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber); +function commitBeforeMutationEffects() { + while (nextEffect !== null) { + if ((nextEffect.effectTag & Snapshot) !== NoEffect) { + setCurrentFiber(nextEffect); + recordEffect(); - var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime); - if (root === null) { - warnAboutUpdateOnUnmountedFiberInDEV(fiber); - return; + var current$$1 = nextEffect.alternate; + commitBeforeMutationLifeCycles(current$$1, nextEffect); + + resetCurrentFiber(); + } + nextEffect = nextEffect.nextEffect; } +} - root.pingTime = NoWork; +function commitMutationEffects(renderPriorityLevel) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); - checkForInterruption(fiber, expirationTime); - recordScheduleUpdate(); + var effectTag = nextEffect.effectTag; - if (expirationTime === Sync) { - if (workPhase === LegacyUnbatchedPhase) { - // This is a legacy edge case. The initial mount of a ReactDOM.render-ed - // root inside of batchedUpdates should be synchronous, but layout updates - // should be deferred until the end of the batch. - var callback = renderRoot(root, Sync, true); - while (callback !== null) { - callback = callback(true); - } - } else { - scheduleCallbackForRoot(root, ImmediatePriority, Sync); - if (workPhase === NotWorking) { - // Flush the synchronous work now, wnless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initated - // updates, to preserve historical behavior of sync mode. - flushImmediateQueue(); - } + if (effectTag & ContentReset) { + commitResetTextContent(nextEffect); } - } else { - // TODO: computeExpirationForFiber also reads the priority. Pass the - // priority as an argument to that function and this one. - var priorityLevel = getCurrentPriorityLevel(); - if (priorityLevel === UserBlockingPriority) { - // This is the result of a discrete event. Track the lowest priority - // discrete update per root so we can flush them early, if needed. - if (rootsWithPendingDiscreteUpdates === null) { - rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); - } else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); - if ( - lastDiscreteTime === undefined || - lastDiscreteTime > expirationTime - ) { - rootsWithPendingDiscreteUpdates.set(root, expirationTime); - } + + if (effectTag & Ref) { + var current$$1 = nextEffect.alternate; + if (current$$1 !== null) { + commitDetachRef(current$$1); } } - scheduleCallbackForRoot(root, priorityLevel, expirationTime); - } -} -var scheduleWork = scheduleUpdateOnFiber; -// This is split into a separate function so we can mark a fiber with pending -// work without treating it as a typical update that originates from an event; -// e.g. retrying a Suspense boundary isn't an update, but it does schedule work -// on a fiber. -function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { - // Update the source fiber's expiration time - if (fiber.expirationTime < expirationTime) { - fiber.expirationTime = expirationTime; - } - var alternate = fiber.alternate; - if (alternate !== null && alternate.expirationTime < expirationTime) { - alternate.expirationTime = expirationTime; - } - // Walk the parent path to the root and update the child expiration time. - var node = fiber.return; - var root = null; - if (node === null && fiber.tag === HostRoot) { - root = fiber.stateNode; - } else { - while (node !== null) { - alternate = node.alternate; - if (node.childExpirationTime < expirationTime) { - node.childExpirationTime = expirationTime; - if ( - alternate !== null && - alternate.childExpirationTime < expirationTime - ) { - alternate.childExpirationTime = expirationTime; - } - } else if ( - alternate !== null && - alternate.childExpirationTime < expirationTime - ) { - alternate.childExpirationTime = expirationTime; + // The following switch statement is only concerned about placement, + // updates, and deletions. To avoid needing to add a case for every possible + // bitmap value, we remove the secondary effects from the effect tag and + // switch on that value. + var primaryEffectTag = effectTag & (Placement | Update | Deletion); + switch (primaryEffectTag) { + case Placement: { + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + // TODO: findDOMNode doesn't rely on this any more but isMounted does + // and isMounted is deprecated anyway so we should be able to kill this. + nextEffect.effectTag &= ~Placement; + break; } - if (node.return === null && node.tag === HostRoot) { - root = node.stateNode; + case PlacementAndUpdate: { + // Placement + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + nextEffect.effectTag &= ~Placement; + + // Update + var _current = nextEffect.alternate; + commitWork(_current, nextEffect); + break; + } + case Update: { + var _current2 = nextEffect.alternate; + commitWork(_current2, nextEffect); + break; + } + case Deletion: { + commitDeletion(nextEffect, renderPriorityLevel); break; } - node = node.return; } + + // TODO: Only record a mutation effect if primaryEffectTag is non-zero. + recordEffect(); + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; } +} - if (root !== null) { - // Update the first and last pending expiration times in this root - var firstPendingTime = root.firstPendingTime; - if (expirationTime > firstPendingTime) { - root.firstPendingTime = expirationTime; +function commitLayoutEffects(root, committedExpirationTime) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & (Update | Callback)) { + recordEffect(); + var current$$1 = nextEffect.alternate; + commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); } - var lastPendingTime = root.lastPendingTime; - if (lastPendingTime === NoWork || expirationTime < lastPendingTime) { - root.lastPendingTime = expirationTime; + + if (effectTag & Ref) { + recordEffect(); + commitAttachRef(nextEffect); } + + if (effectTag & Passive) { + rootDoesHavePassiveEffects = true; + } + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; } +} - return root; +function flushPassiveEffects() { + if (rootWithPendingPassiveEffects === null) { + return false; + } + var root = rootWithPendingPassiveEffects; + var expirationTime = pendingPassiveEffectsExpirationTime; + var renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = NoWork; + pendingPassiveEffectsRenderPriority = NoPriority; + var priorityLevel = + renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; + return runWithPriority$1( + priorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); } -// Use this function, along with runRootCallback, to ensure that only a single -// callback per root is scheduled. It's still possible to call renderRoot -// directly, but scheduling via this function helps avoid excessive callbacks. -// It works by storing the callback node and expiration time on the root. When a -// new callback comes in, it compares the expiration time to determine if it -// should cancel the previous one. It also relies on commitRoot scheduling a -// callback to render the next level, because that means we don't need a -// separate callback per expiration time. -function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { - var existingCallbackExpirationTime = root.callbackExpirationTime; - if (existingCallbackExpirationTime < expirationTime) { - // New callback has higher priority than the existing one. - var existingCallbackNode = root.callbackNode; - if (existingCallbackNode !== null) { - cancelCallback(existingCallbackNode); +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); } - root.callbackExpirationTime = expirationTime; + })(); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; - var options = null; - if (expirationTime !== Sync && expirationTime !== Never) { - var timeout = expirationTimeToMs(expirationTime) - now(); - if (timeout > 5000) { - // Sanity check. Should never take longer than 5 seconds. - // TODO: Add internal warning? - timeout = 5000; + // Note: This currently assumes there are no passive effects on the root + // fiber, because the root is not part of its own effect list. This could + // change in the future. + var effect = root.current.firstEffect; + while (effect !== null) { + { + setCurrentFiber(effect); + invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); + if (hasCaughtError()) { + (function() { + if (!(effect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(effect, error); } - options = { timeout: timeout }; + resetCurrentFiber(); } + var nextNextEffect = effect.nextEffect; + // Remove nextEffect pointer to assist GC + effect.nextEffect = null; + effect = nextNextEffect; + } - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - options - ); - if ( - enableUserTimingAPI && - expirationTime !== Sync && - workPhase !== RenderPhase && - workPhase !== CommitPhase - ) { - // Scheduled an async callback, and we're not already working. Add an - // entry to the flamegraph that shows we're waiting for a callback - // to fire. - startRequestCallbackTimer(); - } + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); } - // Add the current set of interactions to the pending set associated with - // this root. - schedulePendingInteraction(root, expirationTime); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + + // If additional passive effects were scheduled, increment a counter. If this + // exceeds the limit, we'll fire a warning. + nestedPassiveUpdateCount = + rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + + return true; } -function runRootCallback(root, callback, isSync) { - var prevCallbackNode = root.callbackNode; - var continuation = null; - try { - continuation = callback(isSync); - if (continuation !== null) { - return runRootCallback.bind(null, root, continuation); - } else { - return null; - } - } finally { - // If the callback exits without returning a continuation, remove the - // corresponding callback node from the root. Unless the callback node - // has changed, which implies that it was already cancelled by a high - // priority update. - if (continuation === null && prevCallbackNode === root.callbackNode) { - root.callbackNode = null; - root.callbackExpirationTime = NoWork; - } - } +function isAlreadyFailedLegacyErrorBoundary(instance) { + return ( + legacyErrorBoundariesThatAlreadyFailed !== null && + legacyErrorBoundariesThatAlreadyFailed.has(instance) + ); } -function flushInteractiveUpdates$1() { - if (workPhase === RenderPhase || workPhase === CommitPhase) { - // Can't synchronously flush interactive updates if React is already - // working. This is currently a no-op. - // TODO: Should we fire a warning? This happens if you synchronously invoke - // an input event inside an effect, like with `element.click()`. - return; +function markLegacyErrorBoundaryAsFailed(instance) { + if (legacyErrorBoundariesThatAlreadyFailed === null) { + legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); + } else { + legacyErrorBoundariesThatAlreadyFailed.add(instance); } - flushPendingDiscreteUpdates(); } -function resolveLocksOnRoot(root, expirationTime) { - var firstBatch = root.firstBatch; - if ( - firstBatch !== null && - firstBatch._defer && - firstBatch._expirationTime >= expirationTime - ) { - root.finishedWork = root.current.alternate; - root.pendingCommitExpirationTime = expirationTime; - scheduleCallback(NormalPriority, function() { - firstBatch._onComplete(); - return null; - }); - return true; - } else { - return false; +function prepareToThrowUncaughtError(error) { + if (!hasUncaughtError) { + hasUncaughtError = true; + firstUncaughtError = error; } - // Flush any sync work that was scheduled by effects - if (!isBatchingUpdates && !isRendering) { - performSyncWork(); +} +var onUncaughtError = prepareToThrowUncaughtError; + +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); + enqueueUpdate(rootFiber, update); + var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); } } -function interactiveUpdates$1(fn, a, b, c) { - if (workPhase === NotWorking) { - // TODO: Remove this call. Instead of doing this automatically, the caller - // should explicitly call flushInteractiveUpdates. - flushPendingDiscreteUpdates(); +function captureCommitPhaseError(sourceFiber, error) { + if (sourceFiber.tag === HostRoot) { + // Error was thrown at the root. There is no parent, so the root + // itself should capture it. + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } + + var fiber = sourceFiber.return; + while (fiber !== null) { + if (fiber.tag === HostRoot) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } else if (fiber.tag === ClassComponent) { + var ctor = fiber.type; + var instance = fiber.stateNode; + if ( + typeof ctor.getDerivedStateFromError === "function" || + (typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance)) + ) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createClassErrorUpdate( + fiber, + errorInfo, + // TODO: This is always sync + Sync + ); + enqueueUpdate(fiber, update); + var root = markUpdateTimeFromFiberToRoot(fiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } + return; + } + } + fiber = fiber.return; } - return runWithPriority(UserBlockingPriority, fn.bind(null, a, b, c)); } -function flushPendingDiscreteUpdates() { - if (rootsWithPendingDiscreteUpdates !== null) { - // For each root with pending discrete updates, schedule a callback to - // immediately flush them. - var roots = rootsWithPendingDiscreteUpdates; - rootsWithPendingDiscreteUpdates = null; - roots.forEach(function(expirationTime, root) { - scheduleCallback( - ImmediatePriority, - renderRoot.bind(null, root, expirationTime) - ); - }); - // Now flush the immediate queue. - flushImmediateQueue(); +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + if (pingCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + pingCache.delete(thenable); + } + + if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { + // Received a ping at the same priority level at which we're currently + // rendering. We might want to restart this render. This should mirror + // the logic of whether or not a root suspends once it completes. + + // TODO: If we're rendering sync either due to Sync, Batched or expired, + // we should probably never restart. + + // If we're suspended with delay, we'll always suspend so we can always + // restart. If we're suspended without any updates, it might be a retry. + // If it's early in the retry we can restart. We can't know for sure + // whether we'll eventually process an update during this render pass, + // but it's somewhat unlikely that we get to a ping before that, since + // getting to the root most update is usually very fast. + if ( + workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + workInProgressRootLatestProcessedExpirationTime === Sync && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ) { + // Restart from the root. Don't need to schedule a ping because + // we're already working on this tree. + prepareFreshStack(root, renderExpirationTime); + } else { + // Even though we can't restart right now, we might get an + // opportunity later. So we mark this render as having a ping. + workInProgressRootHasPendingPing = true; + } + return; } -} -function batchedUpdates$1(fn, a) { - if (workPhase !== NotWorking) { - // We're already working, or inside a batch, so batchedUpdates is a no-op. - return fn(a); + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < suspendedTime) { + // The root is no longer suspended at this time. + return; } - workPhase = BatchedPhase; - try { - return fn(a); - } finally { - workPhase = NotWorking; - // Flush the immediate callbacks that were scheduled during this batch - flushImmediateQueue(); + + var pingTime = root.pingTime; + if (pingTime !== NoWork && pingTime < suspendedTime) { + // There's already a lower priority ping scheduled. + return; } -} -function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = NoWork; + // Mark the time at which this ping was scheduled. + root.pingTime = suspendedTime; - var timeoutHandle = root.timeoutHandle; - if (timeoutHandle !== noTimeout) { - // The root previous suspended and scheduled a timeout to commit a fallback - // state. Now that we have additional work, cancel the timeout. - root.timeoutHandle = noTimeout; - // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above - cancelTimeout(timeoutHandle); + if (root.finishedExpirationTime === suspendedTime) { + // If there's a pending fallback waiting to commit, throw it away. + root.finishedExpirationTime = NoWork; + root.finishedWork = null; } - if (workInProgress !== null) { - var interruptedWork = workInProgress.return; - while (interruptedWork !== null) { - unwindInterruptedWork(interruptedWork); - interruptedWork = interruptedWork.return; - } - } - workInProgressRoot = root; - workInProgress = createWorkInProgress(root.current, null, expirationTime); - renderExpirationTime = expirationTime; - workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = Sync; + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + suspendedTime + ); + scheduleCallbackForRoot(root, priorityLevel, suspendedTime); +} - { - ReactStrictModeWarnings.discardPendingWarnings(); +function retryTimedOutBoundary(boundaryFiber) { + // The boundary fiber (a Suspense component or SuspenseList component) + // previously was rendered in its fallback state. One of the promises that + // suspended it has resolved, which means at least part of the tree was + // likely unblocked. Try rendering again, at a new expiration time. + var currentTime = requestCurrentTime(); + var suspenseConfig = null; // Retries don't carry over the already committed update. + var retryTime = computeExpirationForFiber( + currentTime, + boundaryFiber, + suspenseConfig + ); + // TODO: Special case idle priority? + var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); + var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); + if (root !== null) { + scheduleCallbackForRoot(root, priorityLevel, retryTime); } } -function renderRoot(root, expirationTime, isSync) { - (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Should not already be working."); +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = void 0; + if (enableSuspenseServerRenderer) { + switch (boundaryFiber.tag) { + case SuspenseComponent: + retryCache = boundaryFiber.stateNode; + break; + case DehydratedSuspenseComponent: + retryCache = boundaryFiber.memoizedState; + break; + default: + (function() { + { + throw ReactError( + Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." + ) + ); + } + })(); } - })(); - - if (enableUserTimingAPI && expirationTime !== Sync) { - var didExpire = isSync; - stopRequestCallbackTimer(didExpire); + } else { + retryCache = boundaryFiber.stateNode; } - if (root.firstPendingTime < expirationTime) { - // If there's no work left at this expiration time, exit immediately. This - // happens when multiple callbacks are scheduled for a single root, but an - // earlier callback flushes the work of a later one. - return null; + if (retryCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + retryCache.delete(thenable); } - if (root.pendingCommitExpirationTime === expirationTime) { - // There's already a pending commit at this expiration time. - root.pendingCommitExpirationTime = NoWork; - return commitRoot.bind(null, root, expirationTime); - } + retryTimedOutBoundary(boundaryFiber); +} - flushPassiveEffects(); +// Computes the next Just Noticeable Difference (JND) boundary. +// The theory is that a person can't tell the difference between small differences in time. +// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable +// difference in the experience. However, waiting for longer might mean that we can avoid +// showing an intermediate loading state. The longer we have already waited, the harder it +// is to tell small differences in time. Therefore, the longer we've already waited, +// the longer we can wait additionally. At some point we have to give up though. +// We pick a train model where the next boundary commits at a consistent schedule. +// These particular numbers are vague estimates. We expect to adjust them based on research. +function jnd(timeElapsed) { + return timeElapsed < 120 + ? 120 + : timeElapsed < 480 + ? 480 + : timeElapsed < 1080 + ? 1080 + : timeElapsed < 1920 + ? 1920 + : timeElapsed < 3000 + ? 3000 + : timeElapsed < 4320 + ? 4320 + : ceil(timeElapsed / 1960) * 1960; +} - // If the root or expiration time have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { - prepareFreshStack(root, expirationTime); - startWorkOnPendingInteraction(root, expirationTime); +function computeMsUntilSuspenseLoadingDelay( + mostRecentEventTime, + committedExpirationTime, + suspenseConfig +) { + var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0; + if (busyMinDurationMs <= 0) { + return 0; } + var busyDelayMs = suspenseConfig.busyDelayMs | 0; - // If we have a work-in-progress fiber, it means there's still work to do - // in this root. - if (workInProgress !== null) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; - var prevDispatcher = ReactCurrentDispatcher.current; - if (prevDispatcher === null) { - // The React isomorphic package does not include a default dispatcher. - // Instead the first renderer will lazily attach one, in order to give - // nicer error messages. - prevDispatcher = ContextOnlyDispatcher; - } - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - var prevInteractions = null; - if (enableSchedulerTracing) { - prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; - } - - startWorkLoopTimer(workInProgress); + // Compute the time until this render pass would expire. + var currentTimeMs = now(); + var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig( + mostRecentEventTime, + suspenseConfig + ); + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed <= busyDelayMs) { + // If we haven't yet waited longer than the initial delay, we don't + // have to wait any additional time. + return 0; + } + var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; + // This is the value that is passed to `setTimeout`. + return msUntilTimeout; +} - // TODO: Fork renderRoot into renderRootSync and renderRootAsync - if (isSync) { - if (expirationTime !== Sync) { - // An async update expired. There may be other expired updates on - // this root. We should render all the expired work in a - // single batch. - var currentTime = requestCurrentTime(); - if (currentTime < expirationTime) { - // Restart at the current time. - workPhase = prevWorkPhase; - resetContextDependences(); - ReactCurrentDispatcher.current = prevDispatcher; - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - } - return renderRoot.bind(null, root, currentTime); - } +function checkForNestedUpdates() { + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { + nestedUpdateCount = 0; + rootWithNestedUpdates = null; + (function() { + { + throw ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + ); } - } else { - // Since we know we're in a React event, we can clear the current - // event time. The next update will compute a new event time. - currentEventTime = NoWork; + })(); + } + + { + if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { + nestedPassiveUpdateCount = 0; + warning$1( + false, + "Maximum update depth exceeded. This can happen when a component " + + "calls setState inside useEffect, but useEffect either doesn't " + + "have a dependency array, or one of the dependencies changes on " + + "every render." + ); } + } +} - do { - try { - if (isSync) { - workLoopSync(); - } else { - workLoop(); - } - break; - } catch (thrownValue) { - // Reset module-level state that was set during the render phase. - resetContextDependences(); - resetHooks(); +function flushRenderPhaseStrictModeWarningsInDEV() { + { + ReactStrictModeWarnings.flushLegacyContextWarning(); - var sourceFiber = workInProgress; - if (sourceFiber === null || sourceFiber.return === null) { - // Expected to be working on a non-root fiber. This is a fatal error - // because there's no ancestor that can handle it; the root is - // supposed to capture all errors that weren't caught by an error - // boundary. - prepareFreshStack(root, expirationTime); - workPhase = prevWorkPhase; - throw thrownValue; - } + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); + } + } +} - if (enableProfilerTimer && sourceFiber.mode & ProfileMode) { - // Record the time spent rendering before an error was thrown. This - // avoids inaccurate Profiler durations in the case of a - // suspended render. - stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true); - } +function stopFinishedWorkLoopTimer() { + var didCompleteRoot = true; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} - var returnFiber = sourceFiber.return; - throwException( - root, - returnFiber, - sourceFiber, - thrownValue, - renderExpirationTime - ); - workInProgress = completeUnitOfWork(sourceFiber); - } - } while (true); +function stopInterruptedWorkLoopTimer() { + // TODO: Track which fiber caused the interruption. + var didCompleteRoot = false; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} - workPhase = prevWorkPhase; - resetContextDependences(); - ReactCurrentDispatcher.current = prevDispatcher; - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - } +function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { + if ( + enableUserTimingAPI && + workInProgressRoot !== null && + updateExpirationTime > renderExpirationTime + ) { + interruptedBy = fiberThatReceivedUpdate; + } +} - if (workInProgress !== null) { - // There's still work left over. Return a continuation. - stopInterruptedWorkLoopTimer(); - if (expirationTime !== Sync) { - startRequestCallbackTimer(); +var didWarnStateUpdateForUnmountedComponent = null; +function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + { + var tag = fiber.tag; + if ( + tag !== HostRoot && + tag !== ClassComponent && + tag !== FunctionComponent && + tag !== ForwardRef && + tag !== MemoComponent && + tag !== SimpleMemoComponent + ) { + // Only warn for user-defined components, not internal ones like Suspense. + return; + } + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForUnmountedComponent !== null) { + if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { + return; } - return renderRoot.bind(null, root, expirationTime); + didWarnStateUpdateForUnmountedComponent.add(componentName); + } else { + didWarnStateUpdateForUnmountedComponent = new Set([componentName]); } + warningWithoutStack$1( + false, + "Can't perform a React state update on an unmounted component. This " + + "is a no-op, but it indicates a memory leak in your application. To " + + "fix, cancel all subscriptions and asynchronous tasks in %s.%s", + tag === ClassComponent + ? "the componentWillUnmount method" + : "a useEffect cleanup function", + getStackByFiberInDevAndProd(fiber) + ); } +} - // We now have a consistent tree. The next step is either to commit it, or, if - // something suspended, wait to commit it after a timeout. - stopFinishedWorkLoopTimer(); +var beginWork$$1 = void 0; +if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { + var dummyFiber = null; + beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { + // If a component throws an error, we replay it again in a synchronously + // dispatched event, so that the debugger will treat it as an uncaught + // error See ReactErrorUtils for more information. - var isLocked = resolveLocksOnRoot(root, expirationTime); - if (isLocked) { - // This root has a lock that prevents it from committing. Exit. If we begin - // work on the root again, without any intervening updates, it will finish - // without doing additional work. - return null; - } + // Before entering the begin phase, copy the work-in-progress onto a dummy + // fiber. If beginWork throws, we'll use this to reset the state. + var originalWorkInProgressCopy = assignFiberPropertiesInDEV( + dummyFiber, + unitOfWork + ); + try { + return beginWork$1(current$$1, unitOfWork, expirationTime); + } catch (originalError) { + if ( + originalError !== null && + typeof originalError === "object" && + typeof originalError.then === "function" + ) { + // Don't replay promises. Treat everything else like an error. + throw originalError; + } - // Set this to null to indicate there's no in-progress render. - workInProgressRoot = null; + // Keep this code in sync with renderRoot; any changes here must have + // corresponding changes there. + resetContextDependencies(); + resetHooks(); - switch (workInProgressRootExitStatus) { - case RootIncomplete: { - (function() { - { - throw ReactError("Should have a work-in-progress."); - } - })(); - } - // Flow knows about invariant, so it compains if I add a break statement, - // but eslint doesn't know about invariant, so it complains if I do. - // eslint-disable-next-line no-fallthrough - case RootErrored: { - // An error was thrown. First check if there is lower priority work - // scheduled on this root. - var lastPendingTime = root.lastPendingTime; - if (root.lastPendingTime < expirationTime) { - // There's lower priority work. Before raising the error, try rendering - // at the lower priority to see if it fixes it. Use a continuation to - // maintain the existing priority and position in the queue. - return renderRoot.bind(null, root, lastPendingTime); + // Unwind the failed stack frame + unwindInterruptedWork(unitOfWork); + + // Restore the original properties of the fiber. + assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + + if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { + // Reset the profiler timer. + startProfilerTimer(unitOfWork); } - if (!isSync) { - // If we're rendering asynchronously, it's possible the error was - // caused by tearing due to a mutation during an event. Try rendering - // one more time without yiedling to events. - prepareFreshStack(root, expirationTime); - scheduleCallback( - ImmediatePriority, - renderRoot.bind(null, root, expirationTime) - ); - return null; + + // Run beginWork again. + invokeGuardedCallback( + null, + beginWork$1, + null, + current$$1, + unitOfWork, + expirationTime + ); + + if (hasCaughtError()) { + var replayError = clearCaughtError(); + // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. + // Rethrow this error instead of the original one. + throw replayError; + } else { + // This branch is reachable if the render phase is impure. + throw originalError; } - // If we're already rendering synchronously, commit the root in its - // errored state. - return commitRoot.bind(null, root, expirationTime); } - case RootSuspended: { - if (!isSync) { - var _lastPendingTime = root.lastPendingTime; - if (root.lastPendingTime < expirationTime) { - // There's lower priority work. It might be unsuspended. Try rendering - // at that level. - return renderRoot.bind(null, root, _lastPendingTime); - } - // If workInProgressRootMostRecentEventTime is Sync, that means we didn't - // track any event times. That can happen if we retried but nothing switched - // from fallback to content. There's no reason to delay doing no work. - if (workInProgressRootMostRecentEventTime !== Sync) { - var msUntilTimeout = computeMsUntilTimeout( - workInProgressRootMostRecentEventTime, - expirationTime + }; +} else { + beginWork$$1 = beginWork$1; +} + +var didWarnAboutUpdateInRender = false; +var didWarnAboutUpdateInGetChildContext = false; +function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { + { + if (fiber.tag === ClassComponent) { + switch (phase) { + case "getChildContext": + if (didWarnAboutUpdateInGetChildContext) { + return; + } + warningWithoutStack$1( + false, + "setState(...): Cannot call setState() inside getChildContext()" ); - // Don't bother with a very short suspense time. - if (msUntilTimeout > 10) { - // The render is suspended, it hasn't timed out, and there's no lower - // priority work to do. Instead of committing the fallback - // immediately, wait for more data to arrive. - root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root, expirationTime), - msUntilTimeout - ); - return null; + didWarnAboutUpdateInGetChildContext = true; + break; + case "render": + if (didWarnAboutUpdateInRender) { + return; } - } + warningWithoutStack$1( + false, + "Cannot update during an existing state transition (such as " + + "within `render`). Render methods should be a pure function of " + + "props and state." + ); + didWarnAboutUpdateInRender = true; + break; } - // The work expired. Commit immediately. - return commitRoot.bind(null, root, expirationTime); - } - case RootCompleted: { - // The work completed. Ready to commit. - return commitRoot.bind(null, root, expirationTime); } - default: { - (function() { - { - throw ReactError("Unknown root exit status."); - } - })(); - } - } -} - -function markRenderEventTime(expirationTime) { - if (expirationTime < workInProgressRootMostRecentEventTime) { - workInProgressRootMostRecentEventTime = expirationTime; - } -} - -function renderDidSuspend() { - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootSuspended; - } -} - -function renderDidError() { - if ( - workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended - ) { - workInProgressRootExitStatus = RootErrored; } } -function inferTimeFromExpirationTime(expirationTime) { - // We don't know exactly when the update was scheduled, but we can infer an - // approximate start time from the expiration time. - var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); - return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; -} +// a 'shared' variable that changes when act() opens/closes in tests. +var IsThisRendererActing = { current: false }; -function workLoopSync() { - // Already timed out, so perform work without checking if we need to yield. - while (workInProgress !== null) { - workInProgress = performUnitOfWork(workInProgress); +function warnIfNotScopedWithMatchingAct(fiber) { + { + if ( + warnsIfNotActing === true && + IsSomeRendererActing.current === true && + IsThisRendererActing.current !== true + ) { + warningWithoutStack$1( + false, + "It looks like you're using the wrong act() around your test interactions.\n" + + "Be sure to use the matching version of act() corresponding to your renderer:\n\n" + + "// for react-dom:\n" + + "import {act} from 'react-dom/test-utils';\n" + + "// ...\n" + + "act(() => ...);\n\n" + + "// for react-test-renderer:\n" + + "import TestRenderer from 'react-test-renderer';\n" + + "const {act} = TestRenderer;\n" + + "// ...\n" + + "act(() => ...);" + + "%s", + getStackByFiberInDevAndProd(fiber) + ); + } } } -function workLoop() { - // Perform work until Scheduler asks us to yield - while (workInProgress !== null && !shouldYield()) { - workInProgress = performUnitOfWork(workInProgress); +function warnIfNotCurrentlyActingEffectsInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + (fiber.mode & StrictMode) !== NoMode && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s ran an effect, but was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } } } -function performUnitOfWork(unitOfWork) { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current$$1 = unitOfWork.alternate; - - startWorkTimer(unitOfWork); - setCurrentFiber(unitOfWork); - - var next = void 0; - if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoContext) { - startProfilerTimer(unitOfWork); - next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } else { - next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); - } - - resetCurrentFiber(); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - if (next === null) { - // If this doesn't spawn new work, complete the current work. - next = completeUnitOfWork(unitOfWork); +function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + executionContext === NoContext && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s inside a test was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } } - - ReactCurrentOwner$2.current = null; - return next; } -function completeUnitOfWork(unitOfWork) { - // Attempt to complete the current unit of work, then move to the next - // sibling. If there are no more siblings, return to the parent fiber. - workInProgress = unitOfWork; - do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current$$1 = workInProgress.alternate; - var returnFiber = workInProgress.return; +var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; - // Check if the work completed or if something threw. - if ((workInProgress.effectTag & Incomplete) === NoEffect) { - setCurrentFiber(workInProgress); - var next = void 0; - if ( - !enableProfilerTimer || - (workInProgress.mode & ProfileMode) === NoContext - ) { - next = completeWork(current$$1, workInProgress, renderExpirationTime); - } else { - startProfilerTimer(workInProgress); - next = completeWork(current$$1, workInProgress, renderExpirationTime); - // Update render duration assuming we didn't error. - stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); - } - stopWorkTimer(workInProgress); - resetCurrentFiber(); - resetChildExpirationTime(workInProgress); +// In tests, we want to enforce a mocked scheduler. +var didWarnAboutUnmockedScheduler = false; +// TODO Before we release concurrent mode, revisit this and decide whether a mocked +// scheduler is the actual recommendation. The alternative could be a testing build, +// a new lib, or whatever; we dunno just yet. This message is for early adopters +// to get their tests right. - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - return next; +function warnIfUnmockedScheduler(fiber) { + { + if ( + didWarnAboutUnmockedScheduler === false && + Scheduler.unstable_flushAllWithoutAsserting === undefined + ) { + if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } else if (warnAboutUnmockedScheduler === true) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'Starting from React v17, the "scheduler" module will need to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); } + } + } +} - if ( - returnFiber !== null && - // Do not append effects to parents if a sibling failed to complete - (returnFiber.effectTag & Incomplete) === NoEffect - ) { - // Append all the effects of the subtree and this fiber onto the effect - // list of the parent. The completion order of the children affects the - // side-effect order. - if (returnFiber.firstEffect === null) { - returnFiber.firstEffect = workInProgress.firstEffect; - } - if (workInProgress.lastEffect !== null) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; - } - returnFiber.lastEffect = workInProgress.lastEffect; - } - - // If this fiber had side-effects, we append it AFTER the children's - // side-effects. We can perform certain side-effects earlier if needed, - // by doing multiple passes over the effect list. We don't want to - // schedule our own side-effect on our own list because if end up - // reusing children we'll schedule this effect onto itself since we're - // at the end. - var effectTag = workInProgress.effectTag; - - // Skip both NoWork and PerformedWork tags when creating the effect - // list. PerformedWork effect is read by React DevTools but shouldn't be - // committed. - if (effectTag > PerformedWork) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = workInProgress; - } else { - returnFiber.firstEffect = workInProgress; +var componentsThatTriggeredHighPriSuspend = null; +function checkForWrongSuspensePriorityInDEV(sourceFiber) { + { + var currentPriorityLevel = getCurrentPriorityLevel(); + if ( + (sourceFiber.mode & ConcurrentMode) !== NoEffect && + (currentPriorityLevel === UserBlockingPriority$1 || + currentPriorityLevel === ImmediatePriority) + ) { + var workInProgressNode = sourceFiber; + while (workInProgressNode !== null) { + // Add the component that triggered the suspense + var current$$1 = workInProgressNode.alternate; + if (current$$1 !== null) { + // TODO: warn component that triggers the high priority + // suspend is the HostRoot + switch (workInProgressNode.tag) { + case ClassComponent: + // Loop through the component's update queue and see whether the component + // has triggered any high priority updates + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var update = updateQueue.firstUpdate; + while (update !== null) { + var priorityLevel = update.priority; + if ( + priorityLevel === UserBlockingPriority$1 || + priorityLevel === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + update = update.next; + } + } + break; + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + if ( + workInProgressNode.memoizedState !== null && + workInProgressNode.memoizedState.baseUpdate !== null + ) { + var _update = workInProgressNode.memoizedState.baseUpdate; + // Loop through the functional component's memoized state to see whether + // the component has triggered any high pri updates + while (_update !== null) { + var priority = _update.priority; + if ( + priority === UserBlockingPriority$1 || + priority === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + if ( + _update.next === workInProgressNode.memoizedState.baseUpdate + ) { + break; + } + _update = _update.next; + } + } + break; + default: + break; } - returnFiber.lastEffect = workInProgress; - } - } - } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(workInProgress, renderExpirationTime); - - // Because this fiber did not complete, don't reset its expiration time. - - if ( - enableProfilerTimer && - (workInProgress.mode & ProfileMode) !== NoContext - ) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); - - // Include the time spent working on failed children before continuing. - var actualDuration = workInProgress.actualDuration; - var child = workInProgress.child; - while (child !== null) { - actualDuration += child.actualDuration; - child = child.sibling; } - workInProgress.actualDuration = actualDuration; + workInProgressNode = workInProgressNode.return; } + } + } +} - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - // TODO: The name stopFailedWorkTimer is misleading because Suspense - // also captures and restarts. - stopFailedWorkTimer(workInProgress); - _next.effectTag &= HostEffectMask; - return _next; - } - stopWorkTimer(workInProgress); +function flushSuspensePriorityWarningInDEV() { + { + if (componentsThatTriggeredHighPriSuspend !== null) { + var componentNames = []; + componentsThatTriggeredHighPriSuspend.forEach(function(name) { + return componentNames.push(name); + }); + componentsThatTriggeredHighPriSuspend = null; - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its effect list. - returnFiber.firstEffect = returnFiber.lastEffect = null; - returnFiber.effectTag |= Incomplete; + if (componentNames.length > 0) { + warningWithoutStack$1( + false, + "%s triggered a user-blocking update that suspended." + + "\n\n" + + "The fix is to split the update into multiple parts: a user-blocking " + + "update to provide immediate feedback, and another update that " + + "triggers the bulk of the changes." + + "\n\n" + + "Refer to the documentation for useSuspenseTransition to learn how " + + "to implement this pattern.", + // TODO: Add link to React docs with more information, once it exists + componentNames.sort().join(", ") + ); } } + } +} - var siblingFiber = workInProgress.sibling; - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - return siblingFiber; - } - // Otherwise, return to the parent - workInProgress = returnFiber; - } while (workInProgress !== null); +function computeThreadID(root, expirationTime) { + // Interaction threads are unique per root and expiration time. + return expirationTime * 1000 + root.interactionThreadID; +} - // We've reached the root. - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootCompleted; +function markSpawnedWork(expirationTime) { + if (!enableSchedulerTracing) { + return; + } + if (spawnedWorkDuringRender === null) { + spawnedWorkDuringRender = [expirationTime]; + } else { + spawnedWorkDuringRender.push(expirationTime); } - return null; } -function resetChildExpirationTime(completedWork) { - if ( - renderExpirationTime !== Never && - completedWork.childExpirationTime === Never - ) { - // The children of this component are hidden. Don't bubble their - // expiration times. +function scheduleInteractions(root, expirationTime, interactions) { + if (!enableSchedulerTracing) { return; } - var newChildExpirationTime = NoWork; - - // Bubble up the earliest expiration time. - if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoContext) { - // In profiling mode, resetChildExpirationTime is also used to reset - // profiler durations. - var actualDuration = completedWork.actualDuration; - var treeBaseDuration = completedWork.selfBaseDuration; - - // When a fiber is cloned, its actualDuration is reset to 0. This value will - // only be updated if work is done on the fiber (i.e. it doesn't bailout). - // When work is done, it should bubble to the parent's actualDuration. If - // the fiber has not been cloned though, (meaning no work was done), then - // this value will reflect the amount of time spent working on a previous - // render. In that case it should not bubble. We determine whether it was - // cloned by comparing the child pointer. - var shouldBubbleActualDurations = - completedWork.alternate === null || - completedWork.child !== completedWork.alternate.child; + if (interactions.size > 0) { + var pendingInteractionMap = root.pendingInteractionMap; + var pendingInteractions = pendingInteractionMap.get(expirationTime); + if (pendingInteractions != null) { + interactions.forEach(function(interaction) { + if (!pendingInteractions.has(interaction)) { + // Update the pending async work count for previously unscheduled interaction. + interaction.__count++; + } - var child = completedWork.child; - while (child !== null) { - var childUpdateExpirationTime = child.expirationTime; - var childChildExpirationTime = child.childExpirationTime; - if (childUpdateExpirationTime > newChildExpirationTime) { - newChildExpirationTime = childUpdateExpirationTime; - } - if (childChildExpirationTime > newChildExpirationTime) { - newChildExpirationTime = childChildExpirationTime; - } - if (shouldBubbleActualDurations) { - actualDuration += child.actualDuration; - } - treeBaseDuration += child.treeBaseDuration; - child = child.sibling; + pendingInteractions.add(interaction); + }); + } else { + pendingInteractionMap.set(expirationTime, new Set(interactions)); + + // Update the pending async work count for the current interactions. + interactions.forEach(function(interaction) { + interaction.__count++; + }); } - completedWork.actualDuration = actualDuration; - completedWork.treeBaseDuration = treeBaseDuration; - } else { - var _child = completedWork.child; - while (_child !== null) { - var _childUpdateExpirationTime = _child.expirationTime; - var _childChildExpirationTime = _child.childExpirationTime; - if (_childUpdateExpirationTime > newChildExpirationTime) { - newChildExpirationTime = _childUpdateExpirationTime; - } - if (_childChildExpirationTime > newChildExpirationTime) { - newChildExpirationTime = _childChildExpirationTime; - } - _child = _child.sibling; + + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + subscriber.onWorkScheduled(interactions, threadID); } } - - completedWork.childExpirationTime = newChildExpirationTime; } -function commitRoot(root, expirationTime) { - runWithPriority( - ImmediatePriority, - commitRootImpl.bind(null, root, expirationTime) - ); - // If there are passive effects, schedule a callback to flush them. This goes - // outside commitRootImpl so that it inherits the priority of the render. - if (rootWithPendingPassiveEffects !== null) { - var priorityLevel = getCurrentPriorityLevel(); - scheduleCallback(priorityLevel, function() { - flushPassiveEffects(); - return null; - }); +function schedulePendingInteractions(root, expirationTime) { + // This is called when work is scheduled on a root. + // It associates the current interactions with the newly-scheduled expiration. + // They will be restored when that expiration is later committed. + if (!enableSchedulerTracing) { + return; } - return null; + + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); } -function commitRootImpl(root, expirationTime) { - flushPassiveEffects(); - flushRenderPhaseStrictModeWarningsInDEV(); +function startWorkOnPendingInteractions(root, expirationTime) { + // This is called when new work is started on a root. + if (!enableSchedulerTracing) { + return; + } - (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Should not already be working."); - } - })(); - var finishedWork = root.current.alternate; - (function() { - if (!(finishedWork !== null)) { - throw ReactError("Should have a work-in-progress root."); + // Determine which interactions this batch of work currently includes, So that + // we can accurately attribute time spent working on it, And so that cascading + // work triggered during the render phase will be associated with it. + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + if (scheduledExpirationTime >= expirationTime) { + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); } - })(); - - // commitRoot never returns a continuation; it always finishes synchronously. - // So we can clear these now to allow a new callback to be scheduled. - root.callbackNode = null; - root.callbackExpirationTime = NoWork; + }); - startCommitTimer(); + // Store the current set of interactions on the FiberRoot for a few reasons: + // We can re-use it in hot functions like renderRoot() without having to + // recalculate it. We will also use it in commitWork() to pass to any Profiler + // onRender() hooks. This also provides DevTools with a way to access it when + // the onCommitRoot() hook is called. + root.memoizedInteractions = interactions; - // Update the first and last pending times on this root. The new first - // pending time is whatever is left on the root fiber. - var updateExpirationTimeBeforeCommit = finishedWork.expirationTime; - var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; - var firstPendingTimeBeforeCommit = - childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit - ? childExpirationTimeBeforeCommit - : updateExpirationTimeBeforeCommit; - root.firstPendingTime = firstPendingTimeBeforeCommit; - if (firstPendingTimeBeforeCommit < root.lastPendingTime) { - // This usually means we've finished all the work, but it can also happen - // when something gets downprioritized during render, like a hidden tree. - root.lastPendingTime = firstPendingTimeBeforeCommit; + if (interactions.size > 0) { + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } } +} - if (root === workInProgressRoot) { - // We can reset these now that they are finished. - workInProgressRoot = null; - workInProgress = null; - renderExpirationTime = NoWork; - } else { +function finishPendingInteractions(root, committedExpirationTime) { + if (!enableSchedulerTracing) { + return; } - // This indicates that the last root we worked on is not the same one that - // we're committing now. This most commonly happens when a suspended root - // times out. - // Get the list of effects. - var firstEffect = void 0; - if (finishedWork.effectTag > PerformedWork) { - // A fiber's effect list consists only of its children, not itself. So if - // the root has an effect, we need to add it to the end of the list. The - // resulting list is the set that would belong to the root's parent, if it - // had one; that is, all the effects in the tree including the root. - if (finishedWork.lastEffect !== null) { - finishedWork.lastEffect.nextEffect = finishedWork; - firstEffect = finishedWork.firstEffect; - } else { - firstEffect = finishedWork; - } - } else { - // There is no effect on the root. - firstEffect = finishedWork.firstEffect; - } + var earliestRemainingTimeAfterCommit = root.firstPendingTime; - if (firstEffect !== null) { - var prevWorkPhase = workPhase; - workPhase = CommitPhase; - var prevInteractions = null; - if (enableSchedulerTracing) { - prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; - } + var subscriber = void 0; - // Reset this to null before calling lifecycles - ReactCurrentOwner$2.current = null; + try { + subscriber = tracing.__subscriberRef.current; + if (subscriber !== null && root.memoizedInteractions.size > 0) { + var threadID = computeThreadID(root, committedExpirationTime); + subscriber.onWorkStopped(root.memoizedInteractions, threadID); + } + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } finally { + // Clear completed interactions from the pending Map. + // Unless the render was suspended or cascading work was scheduled, + // In which case– leave pending interactions until the subsequent render. + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + // Only decrement the pending interaction count if we're done. + // If there's still work at the current priority, + // That indicates that we are waiting for suspense data. + if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { + pendingInteractionMap.delete(scheduledExpirationTime); - // The commit phase is broken into several sub-phases. We do a separate pass - // of the effect list for each phase: all mutation effects come before all - // layout effects, and so on. + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; - // The first phase a "before mutation" phase. We use this phase to read the - // state of the host tree right before we mutate it. This is where - // getSnapshotBeforeUpdate is called. - startCommitSnapshotEffectsTimer(); - prepareForCommit(root.containerInfo); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback(null, commitBeforeMutationEffects, null); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); + if (subscriber !== null && interaction.__count === 0) { + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); } - })(); - var error = clearCaughtError(); - captureCommitPhaseError(nextEffect, error); - nextEffect = nextEffect.nextEffect; - } + } + }); } - } while (nextEffect !== null); - stopCommitSnapshotEffectsTimer(); + }); + } +} - if (enableProfilerTimer) { - // Mark the current commit time to be shared by all Profilers in this - // batch. This enables them to be grouped later. - recordCommitTime(); - } +var onCommitFiberRoot = null; +var onCommitFiberUnmount = null; +var hasLoggedError = false; - // The next phase is the mutation phase, where we mutate the host tree. - startCommitHostEffectsTimer(); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback(null, commitMutationEffects, null); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var _error = clearCaughtError(); - captureCommitPhaseError(nextEffect, _error); - nextEffect = nextEffect.nextEffect; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; + +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { + // No DevTools + return false; + } + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } + if (!hook.supportsFiber) { + { + warningWithoutStack$1( + false, + "The installed version of React DevTools is too old and will not work " + + "with the current version of React. Please update React DevTools. " + + "https://fb.me/react-devtools" + ); + } + // DevTools exists, even though it doesn't support Fiber. + return true; + } + try { + var rendererID = hook.inject(internals); + // We have successfully injected, so now it is safe to set up hooks. + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = (root.current.effectTag & DidCapture) === DidCapture; + if (enableProfilerTimer) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } else { + hook.onCommitFiberRoot(rendererID, root, undefined, didError); + } + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); } } - } while (nextEffect !== null); - stopCommitHostEffectsTimer(); - resetAfterCommit(root.containerInfo); - - // The work-in-progress tree is now the current tree. This must come after - // the mutation phase, so that the previous tree is still current during - // componentWillUnmount, but before the layout phase, so that the finished - // work is current during componentDidMount/Update. - root.current = finishedWork; - - // The next phase is the layout phase, where we call effects that read - // the host tree after it's been mutated. The idiomatic use case for this is - // layout, but class component lifecycles also fire here for legacy reasons. - startCommitLifeCyclesTimer(); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback( - null, - commitLayoutEffects, - null, - root, - expirationTime - ); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var _error2 = clearCaughtError(); - captureCommitPhaseError(nextEffect, _error2); - nextEffect = nextEffect.nextEffect; + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); } } - } while (nextEffect !== null); - stopCommitLifeCyclesTimer(); - - nextEffect = null; - - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - } - workPhase = prevWorkPhase; - } else { - // No effects. - root.current = finishedWork; - // Measure these anyway so the flamegraph explicitly shows that there were - // no effects. - // TODO: Maybe there's a better way to report this. - startCommitSnapshotEffectsTimer(); - stopCommitSnapshotEffectsTimer(); - if (enableProfilerTimer) { - recordCommitTime(); + }; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s.", + err + ); } - startCommitHostEffectsTimer(); - stopCommitHostEffectsTimer(); - startCommitLifeCyclesTimer(); - stopCommitLifeCyclesTimer(); } + // DevTools exists + return true; +} - stopCommitTimer(); - - if (rootDoesHavePassiveEffects) { - // This commit has passive effects. Stash a reference to them. But don't - // schedule a callback until after flushing layout work. - rootDoesHavePassiveEffects = false; - rootWithPendingPassiveEffects = root; - pendingPassiveEffectsExpirationTime = expirationTime; - } else { - if (enableSchedulerTracing) { - // If there are no passive effects, then we can complete the pending - // interactions. Otherwise, we'll wait until after the passive effects - // are flushed. - finishPendingInteractions(root, expirationTime); - } +function onCommitRoot(root, expirationTime) { + if (typeof onCommitFiberRoot === "function") { + onCommitFiberRoot(root, expirationTime); } +} - // Check if there's remaining work on this root - var remainingExpirationTime = root.firstPendingTime; - if (remainingExpirationTime !== NoWork) { - var currentTime = requestCurrentTime(); - var priorityLevel = inferPriorityFromExpirationTime( - currentTime, - remainingExpirationTime - ); - scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); - } else { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; +function onCommitUnmount(fiber) { + if (typeof onCommitFiberUnmount === "function") { + onCommitFiberUnmount(fiber); } +} - onCommitRoot(finishedWork.stateNode); +var hasBadMapPolyfill = void 0; - if (remainingExpirationTime === Sync) { - // Count the number of times the root synchronously re-renders without - // finishing. If there are too many, it indicates an infinite update loop. - if (root === rootWithNestedUpdates) { - nestedUpdateCount++; - } else { - nestedUpdateCount = 0; - rootWithNestedUpdates = root; - } - } else { - nestedUpdateCount = 0; +{ + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + var testMap = new Map([[nonExtensibleObject, null]]); + var testSet = new Set([nonExtensibleObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; } +} - if (hasUncaughtError) { - hasUncaughtError = false; - var _error3 = firstUncaughtError; - firstUncaughtError = null; - throw _error3; - } +// A Fiber is work on a Component that needs to be done or was done. There can +// be more than one per component. - if (workPhase === LegacyUnbatchedPhase) { - // This is a legacy edge case. We just committed the initial mount of - // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired - // synchronously, but layout updates should be deferred until the end - // of the batch. - return null; - } +var debugCounter = void 0; - // If layout work was scheduled, flush it now. - flushImmediateQueue(); - return null; +{ + debugCounter = 1; } -function commitBeforeMutationEffects() { - while (nextEffect !== null) { - if ((nextEffect.effectTag & Snapshot) !== NoEffect) { - setCurrentFiber(nextEffect); - recordEffect(); +function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.elementType = null; + this.type = null; + this.stateNode = null; - var current$$1 = nextEffect.alternate; - commitBeforeMutationLifeCycles(current$$1, nextEffect); + // Fiber + this.return = null; + this.child = null; + this.sibling = null; + this.index = 0; - resetCurrentFiber(); - } - nextEffect = nextEffect.nextEffect; - } -} + this.ref = null; -function commitMutationEffects() { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + this.dependencies = null; - var effectTag = nextEffect.effectTag; + this.mode = mode; - if (effectTag & ContentReset) { - commitResetTextContent(nextEffect); - } + // Effects + this.effectTag = NoEffect; + this.nextEffect = null; - if (effectTag & Ref) { - var current$$1 = nextEffect.alternate; - if (current$$1 !== null) { - commitDetachRef(current$$1); - } - } + this.firstEffect = null; + this.lastEffect = null; - // The following switch statement is only concerned about placement, - // updates, and deletions. To avoid needing to add a case for every possible - // bitmap value, we remove the secondary effects from the effect tag and - // switch on that value. - var primaryEffectTag = effectTag & (Placement | Update | Deletion); - switch (primaryEffectTag) { - case Placement: { - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - // TODO: findDOMNode doesn't rely on this any more but isMounted does - // and isMounted is deprecated anyway so we should be able to kill this. - nextEffect.effectTag &= ~Placement; - break; - } - case PlacementAndUpdate: { - // Placement - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - nextEffect.effectTag &= ~Placement; + this.expirationTime = NoWork; + this.childExpirationTime = NoWork; - // Update - var _current = nextEffect.alternate; - commitWork(_current, nextEffect); - break; - } - case Update: { - var _current2 = nextEffect.alternate; - commitWork(_current2, nextEffect); - break; - } - case Deletion: { - commitDeletion(nextEffect); - break; - } - } + this.alternate = null; + + if (enableProfilerTimer) { + // Note: The following is done to avoid a v8 performance cliff. + // + // Initializing the fields below to smis and later updating them with + // double values will cause Fibers to end up having separate shapes. + // This behavior/bug has something to do with Object.preventExtension(). + // Fortunately this only impacts DEV builds. + // Unfortunately it makes React unusably slow for some applications. + // To work around this, initialize the fields below with doubles. + // + // Learn more about this here: + // https://github.com/facebook/react/issues/14365 + // https://bugs.chromium.org/p/v8/issues/detail?id=8538 + this.actualDuration = Number.NaN; + this.actualStartTime = Number.NaN; + this.selfBaseDuration = Number.NaN; + this.treeBaseDuration = Number.NaN; - // TODO: Only record a mutation effect if primaryEffectTag is non-zero. - recordEffect(); + // It's okay to replace the initial doubles with smis after initialization. + // This won't trigger the performance cliff mentioned above, + // and it simplifies other profiler code (including DevTools). + this.actualDuration = 0; + this.actualStartTime = -1; + this.selfBaseDuration = 0; + this.treeBaseDuration = 0; + } - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; + { + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugIsCurrentlyTiming = false; + this._debugNeedsRemount = false; + this._debugHookTypes = null; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { + Object.preventExtensions(this); + } } } -function commitLayoutEffects(root, committedExpirationTime) { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); +// This is a constructor function, rather than a POJO constructor, still +// please ensure we do the following: +// 1) Nobody should add any instance methods on this. Instance methods can be +// more difficult to predict when they get optimized and they are almost +// never inlined properly in static compilers. +// 2) Nobody should rely on `instanceof Fiber` for type testing. We should +// always know when it is a fiber. +// 3) We might want to experiment with using numeric keys since they are easier +// to optimize in a non-JIT environment. +// 4) We can easily go from a constructor to a createFiber object literal if that +// is faster. +// 5) It should be easy to port this to a C struct and keep a C implementation +// compatible. +var createFiber = function(tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); +}; - var effectTag = nextEffect.effectTag; +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} - if (effectTag & (Update | Callback)) { - recordEffect(); - var current$$1 = nextEffect.alternate; - commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); - } +function isSimpleFunctionComponent(type) { + return ( + typeof type === "function" && + !shouldConstruct(type) && + type.defaultProps === undefined + ); +} - if (effectTag & Ref) { - recordEffect(); - commitAttachRef(nextEffect); +function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; } - - if (effectTag & Passive) { - rootDoesHavePassiveEffects = true; + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; } - - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; } + return IndeterminateComponent; } -function flushPassiveEffects() { - if (rootWithPendingPassiveEffects === null) { - return false; - } - var root = rootWithPendingPassiveEffects; - var expirationTime = pendingPassiveEffectsExpirationTime; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsExpirationTime = NoWork; - - var prevInteractions = null; - if (enableSchedulerTracing) { - prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; - } - - (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Cannot flush passive effects while already rendering."); - } - })(); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; +// This is used to create an alternate fiber to do work on. +function createWorkInProgress(current, pendingProps, expirationTime) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + ); + workInProgress.elementType = current.elementType; + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; - // Note: This currently assumes there are no passive effects on the root - // fiber, because the root is not part of its own effect list. This could - // change in the future. - var effect = root.current.firstEffect; - while (effect !== null) { { - setCurrentFiber(effect); - invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); - if (hasCaughtError()) { - (function() { - if (!(effect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var error = clearCaughtError(); - captureCommitPhaseError(effect, error); - } - resetCurrentFiber(); + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; + workInProgress._debugHookTypes = current._debugHookTypes; } - effect = effect.nextEffect; - } - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - finishPendingInteractions(root, expirationTime); - } + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; - workPhase = prevWorkPhase; - flushImmediateQueue(); + // We already have an alternate. + // Reset the effect tag. + workInProgress.effectTag = NoEffect; - // If additional passive effects were scheduled, increment a counter. If this - // exceeds the limit, we'll fire a warning. - nestedPassiveUpdateCount = - rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; - return true; -} + if (enableProfilerTimer) { + // We intentionally reset, rather than copy, actualDuration & actualStartTime. + // This prevents time from endlessly accumulating in new commits. + // This has the downside of resetting values for different priority renders, + // But works for yielding (the common case) and should support resuming. + workInProgress.actualDuration = 0; + workInProgress.actualStartTime = -1; + } + } -function isAlreadyFailedLegacyErrorBoundary(instance) { - return ( - legacyErrorBoundariesThatAlreadyFailed !== null && - legacyErrorBoundariesThatAlreadyFailed.has(instance) - ); -} + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; -function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); - } -} + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; -function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } -} -var onUncaughtError = prepareToThrowUncaughtError; + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); - enqueueUpdate(rootFiber, update); - var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); - if (root !== null) { - scheduleCallbackForRoot(root, ImmediatePriority, Sync); - } -} + // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; -function captureCommitPhaseError(sourceFiber, error) { - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - return; + if (enableProfilerTimer) { + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; } - var fiber = sourceFiber.return; - while (fiber !== null) { - if (fiber.tag === HostRoot) { - captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); - return; - } else if (fiber.tag === ClassComponent) { - var ctor = fiber.type; - var instance = fiber.stateNode; - if ( - typeof ctor.getDerivedStateFromError === "function" || - (typeof instance.componentDidCatch === "function" && - !isAlreadyFailedLegacyErrorBoundary(instance)) - ) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createClassErrorUpdate( - fiber, - errorInfo, - // TODO: This is always sync - Sync - ); - enqueueUpdate(fiber, update); - var root = markUpdateTimeFromFiberToRoot(fiber, Sync); - if (root !== null) { - scheduleCallbackForRoot(root, ImmediatePriority, Sync); - } - return; - } + { + workInProgress._debugNeedsRemount = current._debugNeedsRemount; + switch (workInProgress.tag) { + case IndeterminateComponent: + case FunctionComponent: + case SimpleMemoComponent: + workInProgress.type = resolveFunctionForHotReloading(current.type); + break; + case ClassComponent: + workInProgress.type = resolveClassForHotReloading(current.type); + break; + case ForwardRef: + workInProgress.type = resolveForwardRefForHotReloading(current.type); + break; + default: + break; } - fiber = fiber.return; } + + return workInProgress; } -function pingSuspendedRoot(root, thenable, suspendedTime) { - var pingCache = root.pingCache; - if (pingCache !== null) { - // The thenable resolved, so we no longer need to memoize, because it will - // never be thrown again. - pingCache.delete(thenable); - } +// Used to reuse a Fiber for a second pass. +function resetWorkInProgress(workInProgress, renderExpirationTime) { + // This resets the Fiber to what createFiber or createWorkInProgress would + // have set the values to before during the first pass. Ideally this wouldn't + // be necessary but unfortunately many code paths reads from the workInProgress + // when they should be reading from current and writing to workInProgress. - if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { - // Received a ping at the same priority level at which we're currently - // rendering. Restart from the root. Don't need to schedule a ping because - // we're already working on this tree. - prepareFreshStack(root, renderExpirationTime); - return; - } + // We assume pendingProps, index, key, ref, return are still untouched to + // avoid doing another reconciliation. - var lastPendingTime = root.lastPendingTime; - if (lastPendingTime < suspendedTime) { - // The root is no longer suspended at this time. - return; - } + // Reset the effect tag but keep any Placement tags, since that's something + // that child fiber is setting, not the reconciliation. + workInProgress.effectTag &= Placement; - var pingTime = root.pingTime; - if (pingTime !== NoWork && pingTime < suspendedTime) { - // There's already a lower priority ping scheduled. - return; - } + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; - // Mark the time at which this ping was scheduled. - root.pingTime = suspendedTime; + var current = workInProgress.alternate; + if (current === null) { + // Reset to createFiber's initial values. + workInProgress.childExpirationTime = NoWork; + workInProgress.expirationTime = renderExpirationTime; - var currentTime = requestCurrentTime(); - var priorityLevel = inferPriorityFromExpirationTime( - currentTime, - suspendedTime - ); - scheduleCallbackForRoot(root, priorityLevel, suspendedTime); -} + workInProgress.child = null; + workInProgress.memoizedProps = null; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; -function retryTimedOutBoundary(boundaryFiber) { - // The boundary fiber (a Suspense component) previously timed out and was - // rendered in its fallback state. One of the promises that suspended it has - // resolved, which means at least part of the tree was likely unblocked. Try - // rendering again, at a new expiration time. - var currentTime = requestCurrentTime(); - var retryTime = computeExpirationForFiber(currentTime, boundaryFiber); - // TODO: Special case idle priority? - var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); - var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); - if (root !== null) { - scheduleCallbackForRoot(root, priorityLevel, retryTime); - } -} + workInProgress.dependencies = null; -function resolveRetryThenable(boundaryFiber, thenable) { - var retryCache = void 0; - if (enableSuspenseServerRenderer) { - switch (boundaryFiber.tag) { - case SuspenseComponent: - retryCache = boundaryFiber.stateNode; - break; - case DehydratedSuspenseComponent: - retryCache = boundaryFiber.memoizedState; - break; - default: - (function() { - { - throw ReactError( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); - } - })(); + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = 0; + workInProgress.treeBaseDuration = 0; } } else { - retryCache = boundaryFiber.stateNode; - } + // Reset to the cloned values that createWorkInProgress would've. + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; - if (retryCache !== null) { - // The thenable resolved, so we no longer need to memoize, because it will - // never be thrown again. - retryCache.delete(thenable); + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } } - retryTimedOutBoundary(boundaryFiber); -} - -// Computes the next Just Noticeable Difference (JND) boundary. -// The theory is that a person can't tell the difference between small differences in time. -// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable -// difference in the experience. However, waiting for longer might mean that we can avoid -// showing an intermediate loading state. The longer we have already waited, the harder it -// is to tell small differences in time. Therefore, the longer we've already waited, -// the longer we can wait additionally. At some point we have to give up though. -// We pick a train model where the next boundary commits at a consistent schedule. -// These particular numbers are vague estimates. We expect to adjust them based on research. -function jnd(timeElapsed) { - return timeElapsed < 120 - ? 120 - : timeElapsed < 480 - ? 480 - : timeElapsed < 1080 - ? 1080 - : timeElapsed < 1920 - ? 1920 - : timeElapsed < 3000 - ? 3000 - : timeElapsed < 4320 - ? 4320 - : ceil(timeElapsed / 1960) * 1960; + return workInProgress; } -function computeMsUntilTimeout(mostRecentEventTime, committedExpirationTime) { - if (disableYielding) { - // Timeout immediately when yielding is disabled. - return 0; +function createHostRootFiber(tag) { + var mode = void 0; + if (tag === ConcurrentRoot) { + mode = ConcurrentMode | BatchedMode | StrictMode; + } else if (tag === BatchedRoot) { + mode = BatchedMode | StrictMode; + } else { + mode = NoMode; } - var eventTimeMs = inferTimeFromExpirationTime(mostRecentEventTime); - var currentTimeMs = now(); - var timeElapsed = currentTimeMs - eventTimeMs; - - var msUntilTimeout = jnd(timeElapsed) - timeElapsed; - - // Compute the time until this render pass would expire. - var timeUntilExpirationMs = - expirationTimeToMs(committedExpirationTime) - currentTimeMs; - - // Clamp the timeout to the expiration time. - // TODO: Once the event time is exact instead of inferred from expiration time - // we don't need this. - if (timeUntilExpirationMs < msUntilTimeout) { - msUntilTimeout = timeUntilExpirationMs; + if (enableProfilerTimer && isDevToolsPresent) { + // Always collect profile timings when DevTools are present. + // This enables DevTools to start capturing timing at any point– + // Without some nodes in the tree having empty base times. + mode |= ProfileMode; } - // This is the value that is passed to `setTimeout`. - return msUntilTimeout; + return createFiber(HostRoot, null, null, mode); } -function checkForNestedUpdates() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - nestedUpdateCount = 0; - rootWithNestedUpdates = null; - (function() { +function createFiberFromTypeAndProps( + type, // React$ElementType + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiber = void 0; + + var fiberTag = IndeterminateComponent; + // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var resolvedType = type; + if (typeof type === "function") { + if (shouldConstruct(type)) { + fiberTag = ClassComponent; { - throw ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + resolvedType = resolveClassForHotReloading(resolvedType); + } + } else { + { + resolvedType = resolveFunctionForHotReloading(resolvedType); + } + } + } else if (typeof type === "string") { + fiberTag = HostComponent; + } else { + getTag: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = Mode; + mode |= ConcurrentMode | BatchedMode | StrictMode; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; + break; + case REACT_PROFILER_TYPE: + return createFiberFromProfiler(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_TYPE: + return createFiberFromSuspense(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_LIST_TYPE: + return createFiberFromSuspenseList( + pendingProps, + mode, + expirationTime, + key ); + default: { + if (typeof type === "object" && type !== null) { + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break getTag; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break getTag; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + { + resolvedType = resolveForwardRefForHotReloading(resolvedType); + } + break getTag; + case REACT_MEMO_TYPE: + fiberTag = MemoComponent; + break getTag; + case REACT_LAZY_TYPE: + fiberTag = LazyComponent; + resolvedType = null; + break getTag; + case REACT_FUNDAMENTAL_TYPE: + if (enableFundamentalAPI) { + return createFiberFromFundamental( + type, + pendingProps, + mode, + expirationTime, + key + ); + } + break; + } + } + var info = ""; + { + if ( + type === undefined || + (typeof type === "object" && + type !== null && + Object.keys(type).length === 0) + ) { + info += + " You likely forgot to export your component from the file " + + "it's defined in, or you might have mixed up default and " + + "named imports."; + } + var ownerName = owner ? getComponentName(owner.type) : null; + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + } + (function() { + { + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (type == null ? type : typeof type) + + "." + + info + ) + ); + } + })(); } - })(); - } - - { - if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { - nestedPassiveUpdateCount = 0; - warning$1( - false, - "Maximum update depth exceeded. This can happen when a component " + - "calls setState inside useEffect, but useEffect either doesn't " + - "have a dependency array, or one of the dependencies changes on " + - "every render." - ); } } - performWork(NoWork, true); + + fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.elementType = type; + fiber.type = resolvedType; + fiber.expirationTime = expirationTime; + + return fiber; } -function flushRenderPhaseStrictModeWarningsInDEV() { +function createFiberFromElement(element, mode, expirationTime) { + var owner = null; + { + owner = element._owner; + } + var type = element.type; + var key = element.key; + var pendingProps = element.props; + var fiber = createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime + ); { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - ReactStrictModeWarnings.flushLegacyContextWarning(); - - if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.flushPendingDeprecationWarnings(); - } + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; } + return fiber; } -function stopFinishedWorkLoopTimer() { - var didCompleteRoot = true; - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; -} - -function stopInterruptedWorkLoopTimer() { - // TODO: Track which fiber caused the interruption. - var didCompleteRoot = false; - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; +function createFiberFromFragment(elements, mode, expirationTime, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.expirationTime = expirationTime; + return fiber; } -function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { - if ( - enableUserTimingAPI && - workInProgressRoot !== null && - updateExpirationTime > renderExpirationTime - ) { - interruptedBy = fiberThatReceivedUpdate; - } +function createFiberFromFundamental( + fundamentalComponent, + pendingProps, + mode, + expirationTime, + key +) { + var fiber = createFiber(FundamentalComponent, pendingProps, key, mode); + fiber.elementType = fundamentalComponent; + fiber.type = fundamentalComponent; + fiber.expirationTime = expirationTime; + return fiber; } -var didWarnStateUpdateForUnmountedComponent = null; -function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { +function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { { - var tag = fiber.tag; if ( - tag !== HostRoot && - tag !== ClassComponent && - tag !== FunctionComponent && - tag !== ForwardRef && - tag !== MemoComponent && - tag !== SimpleMemoComponent + typeof pendingProps.id !== "string" || + typeof pendingProps.onRender !== "function" ) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } - // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - var componentName = getComponentName(fiber.type) || "ReactComponent"; - if (didWarnStateUpdateForUnmountedComponent !== null) { - if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { - return; - } - didWarnStateUpdateForUnmountedComponent.add(componentName); - } else { - didWarnStateUpdateForUnmountedComponent = new Set([componentName]); + warningWithoutStack$1( + false, + 'Profiler must specify an "id" string and "onRender" function as props' + ); } - warningWithoutStack$1( - false, - "Can't perform a React state update on an unmounted component. This " + - "is a no-op, but it indicates a memory leak in your application. To " + - "fix, cancel all subscriptions and asynchronous tasks in %s.%s", - tag === ClassComponent - ? "the componentWillUnmount method" - : "a useEffect cleanup function", - getStackByFiberInDevAndProd(fiber) - ); } -} - -var beginWork$$1 = void 0; -if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { - var dummyFiber = null; - beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { - // If a component throws an error, we replay it again in a synchronously - // dispatched event, so that the debugger will treat it as an uncaught - // error See ReactErrorUtils for more information. - - // Before entering the begin phase, copy the work-in-progress onto a dummy - // fiber. If beginWork throws, we'll use this to reset the state. - var originalWorkInProgressCopy = assignFiberPropertiesInDEV( - dummyFiber, - unitOfWork - ); - try { - return beginWork$1(current$$1, unitOfWork, expirationTime); - } catch (originalError) { - if ( - originalError !== null && - typeof originalError === "object" && - typeof originalError.then === "function" - ) { - // Don't replay promises. Treat everything else like an error. - throw originalError; - } - - // Keep this code in sync with renderRoot; any changes here must have - // corresponding changes there. - resetContextDependences(); - resetHooks(); - // Unwind the failed stack frame - unwindInterruptedWork(unitOfWork); + var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); + // TODO: The Profiler fiber shouldn't have a type. It has a tag. + fiber.elementType = REACT_PROFILER_TYPE; + fiber.type = REACT_PROFILER_TYPE; + fiber.expirationTime = expirationTime; - // Restore the original properties of the fiber. - assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + return fiber; +} - if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { - // Reset the profiler timer. - startProfilerTimer(unitOfWork); - } +function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); - // Run beginWork again. - invokeGuardedCallback( - null, - beginWork$1, - null, - current$$1, - unitOfWork, - expirationTime - ); + // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_TYPE; + fiber.elementType = REACT_SUSPENSE_TYPE; - if (hasCaughtError()) { - var replayError = clearCaughtError(); - // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. - // Rethrow this error instead of the original one. - throw replayError; - } else { - // This branch is reachable if the render phase is impure. - throw originalError; - } - } - }; -} else { - beginWork$$1 = beginWork$1; + fiber.expirationTime = expirationTime; + return fiber; } -var didWarnAboutUpdateInRender = false; -var didWarnAboutUpdateInGetChildContext = false; -function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { +function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); { - if (fiber.tag === ClassComponent) { - switch (phase) { - case "getChildContext": - if (didWarnAboutUpdateInGetChildContext) { - return; - } - warningWithoutStack$1( - false, - "setState(...): Cannot call setState() inside getChildContext()" - ); - didWarnAboutUpdateInGetChildContext = true; - break; - case "render": - if (didWarnAboutUpdateInRender) { - return; - } - warningWithoutStack$1( - false, - "Cannot update during an existing state transition (such as " + - "within `render`). Render methods should be a pure function of " + - "props and state." - ); - didWarnAboutUpdateInRender = true; - break; - } - } + // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_LIST_TYPE; } + fiber.elementType = REACT_SUSPENSE_LIST_TYPE; + fiber.expirationTime = expirationTime; + return fiber; } -function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { - { - if ( - workPhase === NotWorking && - ReactShouldWarnActingUpdates.current === false - ) { - warningWithoutStack$1( - false, - "An update to %s inside a test was not wrapped in act(...).\n\n" + - "When testing, code that causes React state updates should be " + - "wrapped into act(...):\n\n" + - "act(() => {\n" + - " /* fire events that update state */\n" + - "});\n" + - "/* assert on the output */\n\n" + - "This ensures that you're testing the behavior the user would see " + - "in the browser." + - " Learn more at https://fb.me/react-wrap-tests-with-act" + - "%s", - getComponentName(fiber.type), - getStackByFiberInDevAndProd(fiber) - ); - } - } +function createFiberFromText(content, mode, expirationTime) { + var fiber = createFiber(HostText, content, null, mode); + fiber.expirationTime = expirationTime; + return fiber; } -var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; +function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoMode); + // TODO: These should not need a type. + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + return fiber; +} -function computeThreadID(root, expirationTime) { - // Interaction threads are unique per root and expiration time. - return expirationTime * 1000 + root.interactionThreadID; +function createFiberFromPortal(portal, mode, expirationTime) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.expirationTime = expirationTime; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, // Used by persistent updates + implementation: portal.implementation + }; + return fiber; } -function schedulePendingInteraction(root, expirationTime) { - // This is called when work is scheduled on a root. It sets up a pending - // interaction, which is completed once the work commits. - if (!enableSchedulerTracing) { - return; +// Used for stashing WIP properties to replay failed work in DEV. +function assignFiberPropertiesInDEV(target, source) { + if (target === null) { + // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoMode); } - var interactions = tracing.__interactionsRef.current; - if (interactions.size > 0) { - var pendingInteractionMap = root.pendingInteractionMap; - var pendingInteractions = pendingInteractionMap.get(expirationTime); - if (pendingInteractions != null) { - interactions.forEach(function(interaction) { - if (!pendingInteractions.has(interaction)) { - // Update the pending async work count for previously unscheduled interaction. - interaction.__count++; - } - - pendingInteractions.add(interaction); - }); - } else { - pendingInteractionMap.set(expirationTime, new Set(interactions)); - - // Update the pending async work count for the current interactions. - interactions.forEach(function(interaction) { - interaction.__count++; - }); - } + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. - var subscriber = tracing.__subscriberRef.current; - if (subscriber !== null) { - var threadID = computeThreadID(root, expirationTime); - subscriber.onWorkScheduled(interactions, threadID); - } + target.tag = source.tag; + target.key = source.key; + target.elementType = source.elementType; + target.type = source.type; + target.stateNode = source.stateNode; + target.return = source.return; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.dependencies = source.dependencies; + target.mode = source.mode; + target.effectTag = source.effectTag; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.expirationTime = source.expirationTime; + target.childExpirationTime = source.childExpirationTime; + target.alternate = source.alternate; + if (enableProfilerTimer) { + target.actualDuration = source.actualDuration; + target.actualStartTime = source.actualStartTime; + target.selfBaseDuration = source.selfBaseDuration; + target.treeBaseDuration = source.treeBaseDuration; } + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; + target._debugNeedsRemount = source._debugNeedsRemount; + target._debugHookTypes = source._debugHookTypes; + return target; } -function startWorkOnPendingInteraction(root, expirationTime) { - // This is called when new work is started on a root. - if (!enableSchedulerTracing) { - return; - } +// TODO: This should be lifted into the renderer. - // Determine which interactions this batch of work currently includes, So that - // we can accurately attribute time spent working on it, And so that cascading - // work triggered during the render phase will be associated with it. - var interactions = new Set(); - root.pendingInteractionMap.forEach(function( - scheduledInteractions, - scheduledExpirationTime - ) { - if (scheduledExpirationTime >= expirationTime) { - scheduledInteractions.forEach(function(interaction) { - return interactions.add(interaction); - }); - } - }); +// The following attributes are only used by interaction tracing builds. +// They enable interactions to be associated with their async work, +// And expose interaction metadata to the React DevTools Profiler plugin. +// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. - // Store the current set of interactions on the FiberRoot for a few reasons: - // We can re-use it in hot functions like renderRoot() without having to - // recalculate it. We will also use it in commitWork() to pass to any Profiler - // onRender() hooks. This also provides DevTools with a way to access it when - // the onCommitRoot() hook is called. - root.memoizedInteractions = interactions; +// Exported FiberRoot type includes all properties, +// To avoid requiring potentially error-prone :any casts throughout the project. +// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). +// The types are defined separately within this file to ensure they stay in sync. +// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) - if (interactions.size > 0) { - var subscriber = tracing.__subscriberRef.current; - if (subscriber !== null) { - var threadID = computeThreadID(root, expirationTime); - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } - } - } -} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pendingChildren = null; + this.pingCache = null; + this.finishedExpirationTime = NoWork; + this.finishedWork = null; + this.timeoutHandle = noTimeout; + this.context = null; + this.pendingContext = null; + this.hydrate = hydrate; + this.firstBatch = null; + this.callbackNode = null; + this.callbackExpirationTime = NoWork; + this.firstPendingTime = NoWork; + this.lastPendingTime = NoWork; + this.pingTime = NoWork; -function finishPendingInteractions(root, committedExpirationTime) { - if (!enableSchedulerTracing) { - return; + if (enableSchedulerTracing) { + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); } +} - var earliestRemainingTimeAfterCommit = root.firstPendingTime; - - var subscriber = void 0; - - try { - subscriber = tracing.__subscriberRef.current; - if (subscriber !== null && root.memoizedInteractions.size > 0) { - var threadID = computeThreadID(root, committedExpirationTime); - subscriber.onWorkStopped(root.memoizedInteractions, threadID); - } - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } finally { - // Clear completed interactions from the pending Map. - // Unless the render was suspended or cascading work was scheduled, - // In which case– leave pending interactions until the subsequent render. - var pendingInteractionMap = root.pendingInteractionMap; - pendingInteractionMap.forEach(function( - scheduledInteractions, - scheduledExpirationTime - ) { - // Only decrement the pending interaction count if we're done. - // If there's still work at the current priority, - // That indicates that we are waiting for suspense data. - if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { - pendingInteractionMap.delete(scheduledExpirationTime); +function createFiberRoot(containerInfo, tag, hydrate) { + var root = new FiberRootNode(containerInfo, tag, hydrate); - scheduledInteractions.forEach(function(interaction) { - interaction.__count--; + // Cyclic construction. This cheats the type system right now because + // stateNode is any. + var uninitializedFiber = createHostRootFiber(tag); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; - if (subscriber !== null && interaction.__count === 0) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } - } - }); - } - }); - } + return root; } // This lets us hook into Fiber to debug what it's doing. @@ -18598,7 +22187,7 @@ function getContextForSubtree(parentComponent) { return emptyContextObject; } - var fiber = get$1(parentComponent); + var fiber = get(parentComponent); var parentContext = findCurrentUnmaskedContext(fiber); if (fiber.tag === ClassComponent) { @@ -18611,7 +22200,13 @@ function getContextForSubtree(parentComponent) { return parentContext; } -function scheduleRootUpdate(current$$1, element, expirationTime, callback) { +function scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback +) { { if (phase === "render" && current !== null && !didWarnAboutNestedUpdates) { didWarnAboutNestedUpdates = true; @@ -18626,7 +22221,7 @@ function scheduleRootUpdate(current$$1, element, expirationTime, callback) { } } - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property // being called "element". update.payload = { element: element }; @@ -18644,7 +22239,9 @@ function scheduleRootUpdate(current$$1, element, expirationTime, callback) { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(current$$1, update); scheduleWork(current$$1, expirationTime); @@ -18656,6 +22253,7 @@ function updateContainerAtExpirationTime( container, parentComponent, expirationTime, + suspenseConfig, callback ) { // TODO: If this is a nested container, this won't be the root. @@ -18680,24 +22278,34 @@ function updateContainerAtExpirationTime( container.pendingContext = context; } - return scheduleRootUpdate(current$$1, element, expirationTime, callback); + return scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback + ); } function findHostInstance(component) { - var fiber = get$1(component); + var fiber = get(component); if (fiber === undefined) { if (typeof component.render === "function") { (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } else { (function() { { throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } })(); @@ -18712,20 +22320,24 @@ function findHostInstance(component) { function findHostInstanceWithWarning(component, methodName) { { - var fiber = get$1(component); + var fiber = get(component); if (fiber === undefined) { if (typeof component.render === "function") { (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } else { (function() { { throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } })(); @@ -18775,19 +22387,32 @@ function findHostInstanceWithWarning(component, methodName) { return findHostInstance(component); } -function createContainer(containerInfo, isConcurrent, hydrate) { - return createFiberRoot(containerInfo, isConcurrent, hydrate); +function createContainer(containerInfo, tag, hydrate) { + return createFiberRoot(containerInfo, tag, hydrate); } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current; var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, current$$1); + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfUnmockedScheduler(current$$1); + warnIfNotScopedWithMatchingAct(current$$1); + } + } + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); return updateContainerAtExpirationTime( element, container, parentComponent, expirationTime, + suspenseConfig, callback ); } @@ -18844,7 +22469,9 @@ var setSuspenseHandler = null; id--; } if (currentHook !== null) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } var newState = copyWithSet(currentHook.memoizedState, path, value); currentHook.memoizedState = newState; @@ -18863,7 +22490,9 @@ var setSuspenseHandler = null; // Support DevTools props for function components, forwardRef, memo, host components, etc. overrideProps = function(fiber, path, value) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); if (fiber.alternate) { fiber.alternate.pendingProps = fiber.pendingProps; @@ -18872,7 +22501,9 @@ var setSuspenseHandler = null; }; scheduleUpdate = function(fiber) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } scheduleWork(fiber, Sync); }; @@ -18905,6 +22536,16 @@ function injectIntoDevTools(devToolsConfig) { return null; } return findFiberByHostInstance(instance); + }, + + // React Refresh + findHostInstancesForRefresh: findHostInstancesForRefresh, + scheduleRefresh: scheduleRefresh, + scheduleRoot: scheduleRoot, + setRefreshHandler: setRefreshHandler, + // Enables DevTools to append owner stacks to error messages in DEV mode. + getCurrentFiber: function() { + return current; } }) ); @@ -18997,7 +22638,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19045,7 +22686,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19108,7 +22749,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { return; } - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -19124,17 +22765,6 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { * Manipulation](docs/direct-manipulation.html)). */ setNativeProps: function(nativeProps) { - { - if (warnAboutDeprecatedSetNativeProps) { - warningWithoutStack$1( - false, - "Warning: Calling ref.setNativeProps(nativeProps) " + - "is deprecated and will be removed in a future release. " + - "Use the setNativeProps export from the react-native package instead." + - "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" - ); - } - } // Class components don't have viewConfig -> validateAttributes. // Nor does it make sense to set native props on a non-native component. // Instead, find the nearest host component and set props on it. @@ -19191,7 +22821,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, viewConfig.uiViewClassName, updatePayload @@ -19204,14 +22834,18 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { * will depend on the platform and type of view. */ focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, /** * Removes focus from an input or view. This is the opposite of `focus()`. */ blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; @@ -19229,7 +22863,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { !NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps ) ) { - throw ReactError("Do not override existing functions."); + throw ReactError(Error("Do not override existing functions.")); } })(); // TODO (bvaughn) Remove cWM and cWRP in a future version of React Native, @@ -19259,13 +22893,13 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { return NativeMethodsMixin; }; -function _classCallCheck$1(instance, Constructor) { +function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { +function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError( "this hasn't been initialised - super() hasn't been called" @@ -19276,7 +22910,7 @@ function _possibleConstructorReturn(self, call) { : self; } -function _inherits(subClass, superClass) { +function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError( "Super expression must either be null or a function, not " + @@ -19298,7 +22932,7 @@ function _inherits(subClass, superClass) { } // Modules provided by RN: -var ReactNativeComponent = function(findNodeHandle, findHostInstance) { +var ReactNativeComponent$1 = function(findNodeHandle, findHostInstance) { /** * Superclass that provides methods to access the underlying native component. * This can be useful when you want to focus a view or measure its dimensions. @@ -19311,12 +22945,12 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * @abstract */ var ReactNativeComponent = (function(_React$Component) { - _inherits(ReactNativeComponent, _React$Component); + _inherits$1(ReactNativeComponent, _React$Component); function ReactNativeComponent() { - _classCallCheck$1(this, ReactNativeComponent); + _classCallCheck$2(this, ReactNativeComponent); - return _possibleConstructorReturn( + return _possibleConstructorReturn$1( this, _React$Component.apply(this, arguments) ); @@ -19331,7 +22965,9 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * declared in the base class need to be redeclared below. */ ReactNativeComponent.prototype.blur = function blur() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; /** @@ -19339,7 +22975,9 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { */ ReactNativeComponent.prototype.focus = function focus() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; /** @@ -19358,7 +22996,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * [`onLayout` prop](docs/view.html#onlayout) instead. */ - ReactNativeComponent.prototype.measure = function measure$$1(callback) { + ReactNativeComponent.prototype.measure = function measure(callback) { var maybeInstance = void 0; // Fiber errors if findNodeHandle is called for an umounted component. @@ -19384,7 +23022,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19405,7 +23043,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * These values are not available until after natives rendering completes. */ - ReactNativeComponent.prototype.measureInWindow = function measureInWindow$$1( + ReactNativeComponent.prototype.measureInWindow = function measureInWindow( callback ) { var maybeInstance = void 0; @@ -19433,7 +23071,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19447,7 +23085,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * Obtain a native node handle with `ReactNative.findNodeHandle(component)`. */ - ReactNativeComponent.prototype.measureLayout = function measureLayout$$1( + ReactNativeComponent.prototype.measureLayout = function measureLayout( relativeToNativeNode, onSuccess, onFail /* currently unused */ @@ -19495,7 +23133,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { return; } - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -19514,18 +23152,6 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { ReactNativeComponent.prototype.setNativeProps = function setNativeProps( nativeProps ) { - { - if (warnAboutDeprecatedSetNativeProps) { - warningWithoutStack$1( - false, - "Warning: Calling ref.setNativeProps(nativeProps) " + - "is deprecated and will be removed in a future release. " + - "Use the setNativeProps export from the react-native package instead." + - "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" - ); - } - } - // Class components don't have viewConfig -> validateAttributes. // Nor does it make sense to set native props on a non-native component. // Instead, find the nearest host component and set props on it. @@ -19578,7 +23204,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, viewConfig.uiViewClassName, updatePayload @@ -19594,16 +23220,16 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { return ReactNativeComponent; }; -var instanceCache = {}; +var instanceCache = new Map(); function getInstanceFromTag(tag) { - return instanceCache[tag] || null; + return instanceCache.get(tag) || null; } // Module provided by RN: -var emptyObject$1 = {}; +var emptyObject$2 = {}; { - Object.freeze(emptyObject$1); + Object.freeze(emptyObject$2); } var getInspectorDataForViewTag = void 0; @@ -19636,9 +23262,9 @@ var getInspectorDataForViewTag = void 0; var getHostProps = function(fiber) { var host = findCurrentHostFiber(fiber); if (host) { - return host.memoizedProps || emptyObject$1; + return host.memoizedProps || emptyObject$2; } - return emptyObject$1; + return emptyObject$2; }; var getHostNode = function(fiber, findNodeHandle) { @@ -19664,7 +23290,7 @@ var getInspectorDataForViewTag = void 0; getInspectorData: function(findNodeHandle) { return { measure: function(callback) { - return UIManager.measure( + return ReactNativePrivateInterface.UIManager.measure( getHostNode(fiber, findNodeHandle), callback ); @@ -19684,7 +23310,7 @@ var getInspectorDataForViewTag = void 0; if (!closestInstance) { return { hierarchy: [], - props: emptyObject$1, + props: emptyObject$2, selection: null, source: null }; @@ -19707,35 +23333,8 @@ var getInspectorDataForViewTag = void 0; }; } -// Module provided by RN: -function setNativeProps(handle, nativeProps) { - if (handle._nativeTag == null) { - !(handle._nativeTag != null) - ? warningWithoutStack$1( - false, - "setNativeProps was called with a ref that isn't a " + - "native component. Use React.forwardRef to get access to the underlying native component" - ) - : void 0; - return; - } - - { - warnForStyleProps(nativeProps, handle.viewConfig.validAttributes); - } - - var updatePayload = create(nativeProps, handle.viewConfig.validAttributes); - // Avoid the overhead of bridge calls if there's no update. - // This is an expensive no-op for Android, and causes an unnecessary - // view invalidation for certain components (eg RCTTextInput) on iOS. - if (updatePayload != null) { - UIManager.updateView( - handle._nativeTag, - handle.viewConfig.uiViewClassName, - updatePayload - ); - } -} +var _nativeFabricUIManage = nativeFabricUIManager; +var fabricDispatchCommand = _nativeFabricUIManage.dispatchCommand; var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; @@ -19793,14 +23392,15 @@ function findNodeHandle(componentOrHandle) { setBatchingImplementation( batchedUpdates$1, - interactiveUpdates$1, - flushInteractiveUpdates$1 + discreteUpdates$1, + flushDiscreteUpdates, + batchedEventUpdates$1 ); var roots = new Map(); var ReactFabric = { - NativeComponent: ReactNativeComponent(findNodeHandle, findHostInstance), + NativeComponent: ReactNativeComponent$1(findNodeHandle, findHostInstance), findNodeHandle: findNodeHandle, @@ -19812,13 +23412,34 @@ var ReactFabric = { return; }, + dispatchCommand: function(handle, command, args) { + var invalid = + handle._nativeTag == null || handle._internalInstanceHandle == null; + + if (invalid) { + !!invalid + ? warningWithoutStack$1( + false, + "dispatchCommand was called with a ref that isn't a " + + "native component. Use React.forwardRef to get access to the underlying native component" + ) + : void 0; + return; + } + + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, render: function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { // TODO (bvaughn): If we decide to keep the wrapper component, // We could create a wrapper for containerTag as well to reduce special casing. - root = createContainer(containerTag, false, false); + root = createContainer(containerTag, LegacyRoot, false); roots.set(containerTag, root); } updateContainer(element, root, null, callback); @@ -19868,4 +23489,4 @@ var fabric = ReactFabric$3.default || ReactFabric$3; module.exports = fabric; })(); -} \ No newline at end of file +} diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js new file mode 100644 index 00000000000000..bdd42bfe734ab4 --- /dev/null +++ b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -0,0 +1,7781 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +"use strict"; +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), + React = require("react"), + Scheduler = require("scheduler"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} +var eventPluginOrder = null, + namesToPlugins = {}; +function recomputePluginOrdering() { + if (eventPluginOrder) + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName], + pluginIndex = eventPluginOrder.indexOf(pluginName); + if (!(-1 < pluginIndex)) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + if (!plugins[pluginIndex]) { + if (!pluginModule.extractEvents) + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + plugins[pluginIndex] = pluginModule; + pluginIndex = pluginModule.eventTypes; + for (var eventName in pluginIndex) { + var JSCompiler_inline_result = void 0; + var dispatchConfig = pluginIndex[eventName], + pluginModule$jscomp$0 = pluginModule, + eventName$jscomp$0 = eventName; + if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) + ); + eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (JSCompiler_inline_result in phasedRegistrationNames) + phasedRegistrationNames.hasOwnProperty( + JSCompiler_inline_result + ) && + publishRegistrationName( + phasedRegistrationNames[JSCompiler_inline_result], + pluginModule$jscomp$0, + eventName$jscomp$0 + ); + JSCompiler_inline_result = !0; + } else + dispatchConfig.registrationName + ? (publishRegistrationName( + dispatchConfig.registrationName, + pluginModule$jscomp$0, + eventName$jscomp$0 + ), + (JSCompiler_inline_result = !0)) + : (JSCompiler_inline_result = !1); + if (!JSCompiler_inline_result) + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + } + } +} +function publishRegistrationName(registrationName, pluginModule) { + if (registrationNameModules[registrationName]) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + registrationNameModules[registrationName] = pluginModule; +} +var plugins = [], + eventNameDispatchConfigs = {}, + registrationNameModules = {}; +function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +} +var hasError = !1, + caughtError = null, + hasRethrowError = !1, + rethrowError = null, + reporter = { + onError: function(error) { + hasError = !0; + caughtError = error; + } + }; +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = !1; + caughtError = null; + invokeGuardedCallbackImpl.apply(reporter, arguments); +} +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + if (hasError) { + var error = caughtError; + hasError = !1; + caughtError = null; + } else + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); + } +} +var getFiberCurrentPropsFromNode = null, + getInstanceFromNode = null, + getNodeFromInstance = null; +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + event.currentTarget = null; +} +function executeDirectDispatch(event) { + var dispatchListener = event._dispatchListeners, + dispatchInstance = event._dispatchInstances; + if (Array.isArray(dispatchListener)) + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + dispatchListener = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return dispatchListener; +} +function accumulateInto(current, next) { + if (null == next) + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + if (null == current) return next; + if (Array.isArray(current)) { + if (Array.isArray(next)) return current.push.apply(current, next), current; + current.push(next); + return current; + } + return Array.isArray(next) ? [current].concat(next) : [current, next]; +} +function forEachAccumulated(arr, cb, scope) { + Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr); +} +var eventQueue = null; +function executeDispatchesAndReleaseTopLevel(e) { + if (e) { + var dispatchListeners = e._dispatchListeners, + dispatchInstances = e._dispatchInstances; + if (Array.isArray(dispatchListeners)) + for ( + var i = 0; + i < dispatchListeners.length && !e.isPropagationStopped(); + i++ + ) + executeDispatch(e, dispatchListeners[i], dispatchInstances[i]); + else + dispatchListeners && + executeDispatch(e, dispatchListeners, dispatchInstances); + e._dispatchListeners = null; + e._dispatchInstances = null; + e.isPersistent() || e.constructor.release(e); + } +} +var injection = { + injectEventPluginOrder: function(injectedEventPluginOrder) { + if (eventPluginOrder) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); + }, + injectEventPluginsByName: function(injectedNamesToPlugins) { + var isOrderingDirty = !1, + pluginName; + for (pluginName in injectedNamesToPlugins) + if (injectedNamesToPlugins.hasOwnProperty(pluginName)) { + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + if (namesToPlugins[pluginName]) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = !0; + } + } + isOrderingDirty && recomputePluginOrdering(); + } +}; +function getListener(inst, registrationName) { + var listener = inst.stateNode; + if (!listener) return null; + var props = getFiberCurrentPropsFromNode(listener); + if (!props) return null; + listener = props[registrationName]; + a: switch (registrationName) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + (props = !props.disabled) || + ((inst = inst.type), + (props = !( + "button" === inst || + "input" === inst || + "select" === inst || + "textarea" === inst + ))); + inst = !props; + break a; + default: + inst = !1; + } + if (inst) return null; + if (listener && "function" !== typeof listener) + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + return listener; +} +function getParent(inst) { + do inst = inst.return; + while (inst && 5 !== inst.tag); + return inst ? inst : null; +} +function traverseTwoPhase(inst, fn, arg) { + for (var path = []; inst; ) path.push(inst), (inst = getParent(inst)); + for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg); + for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg); +} +function accumulateDirectionalDispatches(inst, phase, event) { + if ( + (phase = getListener( + inst, + event.dispatchConfig.phasedRegistrationNames[phase] + )) + ) + (event._dispatchListeners = accumulateInto( + event._dispatchListeners, + phase + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + )); +} +function accumulateTwoPhaseDispatchesSingle(event) { + event && + event.dispatchConfig.phasedRegistrationNames && + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); +} +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + targetInst = targetInst ? getParent(targetInst) : null; + traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event); + } +} +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + var inst = event._targetInst; + if (inst && event && event.dispatchConfig.registrationName) { + var listener = getListener(inst, event.dispatchConfig.registrationName); + listener && + ((event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + ))); + } + } +} +function functionThatReturnsTrue() { + return !0; +} +function functionThatReturnsFalse() { + return !1; +} +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + dispatchConfig = this.constructor.Interface; + for (var propName in dispatchConfig) + dispatchConfig.hasOwnProperty(propName) && + ((targetInst = dispatchConfig[propName]) + ? (this[propName] = targetInst(nativeEvent)) + : "target" === propName + ? (this.target = nativeEventTarget) + : (this[propName] = nativeEvent[propName])); + this.isDefaultPrevented = (null != nativeEvent.defaultPrevented + ? nativeEvent.defaultPrevented + : !1 === nativeEvent.returnValue) + ? functionThatReturnsTrue + : functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = !0; + var event = this.nativeEvent; + event && + (event.preventDefault + ? event.preventDefault() + : "unknown" !== typeof event.returnValue && (event.returnValue = !1), + (this.isDefaultPrevented = functionThatReturnsTrue)); + }, + stopPropagation: function() { + var event = this.nativeEvent; + event && + (event.stopPropagation + ? event.stopPropagation() + : "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0), + (this.isPropagationStopped = functionThatReturnsTrue)); + }, + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + isPersistent: functionThatReturnsFalse, + destructor: function() { + var Interface = this.constructor.Interface, + propName; + for (propName in Interface) this[propName] = null; + this.nativeEvent = this._targetInst = this.dispatchConfig = null; + this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse; + this._dispatchInstances = this._dispatchListeners = null; + } +}); +SyntheticEvent.Interface = { + type: null, + target: null, + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; +SyntheticEvent.extend = function(Interface) { + function E() {} + function Class() { + return Super.apply(this, arguments); + } + var Super = this; + E.prototype = Super.prototype; + var prototype = new E(); + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + return Class; +}; +addEventPoolingTo(SyntheticEvent); +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + if (this.eventPool.length) { + var instance = this.eventPool.pop(); + this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; + } + return new this(dispatchConfig, targetInst, nativeEvent, nativeInst); +} +function releasePooledEvent(event) { + if (!(event instanceof this)) + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + event.destructor(); + 10 > this.eventPool.length && this.eventPool.push(event); +} +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} +var ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function() { + return null; + } +}); +function isStartish(topLevelType) { + return "topTouchStart" === topLevelType; +} +function isMoveish(topLevelType) { + return "topTouchMove" === topLevelType; +} +var startDependencies = ["topTouchStart"], + moveDependencies = ["topTouchMove"], + endDependencies = ["topTouchCancel", "topTouchEnd"], + touchBank = [], + touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 + }; +function timestampForTouch(touch) { + return touch.timeStamp || touch.timestamp; +} +function getTouchIdentifier(_ref) { + _ref = _ref.identifier; + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); + return _ref; +} +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch), + touchRecord = touchBank[identifier]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.startPageX = touch.pageX), + (touchRecord.startPageY = touch.pageY), + (touchRecord.startTimeStamp = timestampForTouch(touch)), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchRecord.previousPageX = touch.pageX), + (touchRecord.previousPageY = touch.pageY), + (touchRecord.previousTimeStamp = timestampForTouch(touch))) + : ((touchRecord = { + touchActive: !0, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }), + (touchBank[identifier] = touchRecord)); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch move without a touch start.\nTouch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !1), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch end without a touch start.\nTouch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, 20)); + 20 < touchBank.length && + (printed += " (original size: " + touchBank.length + ")"); + return printed; +} +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchMove); + else if (isStartish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchStart), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches && + (touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier); + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if ( + (nativeEvent.changedTouches.forEach(recordTouchEnd), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches) + ) + for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) + if ( + ((nativeEvent = touchBank[topLevelType]), + null != nativeEvent && nativeEvent.touchActive) + ) { + touchHistory.indexOfSingleActiveTouch = topLevelType; + break; + } + }, + touchHistory: touchHistory +}; +function accumulate(current, next) { + if (null == next) + throw ReactError( + Error("accumulate(...): Accumulated items must not be null or undefined.") + ); + return null == current + ? next + : Array.isArray(current) + ? current.concat(next) + : Array.isArray(next) + ? [current].concat(next) + : [current, next]; +} +var responderInst = null, + trackedTouchCount = 0; +function changeResponder(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (null !== ResponderEventPlugin.GlobalResponderHandler) + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); +} +var eventTypes = { + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: ["topScroll"] + }, + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: ["topSelectionChange"] + }, + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } + }, + ResponderEventPlugin = { + _getResponder: function() { + return responderInst; + }, + eventTypes: eventTypes, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) trackedTouchCount += 1; + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if (0 <= trackedTouchCount) --trackedTouchCount; + else + return ( + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ), + null + ); + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + if ( + targetInst && + (("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) || + (0 < trackedTouchCount && "topSelectionChange" === topLevelType) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ) { + var JSCompiler_temp = isStartish(topLevelType) + ? eventTypes.startShouldSetResponder + : isMoveish(topLevelType) + ? eventTypes.moveShouldSetResponder + : "topSelectionChange" === topLevelType + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; + if (responderInst) + b: { + var JSCompiler_temp$jscomp$0 = responderInst; + for ( + var depthA = 0, tempA = JSCompiler_temp$jscomp$0; + tempA; + tempA = getParent(tempA) + ) + depthA++; + tempA = 0; + for (var tempB = targetInst; tempB; tempB = getParent(tempB)) + tempA++; + for (; 0 < depthA - tempA; ) + (JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0)), + depthA--; + for (; 0 < tempA - depthA; ) + (targetInst = getParent(targetInst)), tempA--; + for (; depthA--; ) { + if ( + JSCompiler_temp$jscomp$0 === targetInst || + JSCompiler_temp$jscomp$0 === targetInst.alternate + ) + break b; + JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0); + targetInst = getParent(targetInst); + } + JSCompiler_temp$jscomp$0 = null; + } + else JSCompiler_temp$jscomp$0 = targetInst; + targetInst = JSCompiler_temp$jscomp$0 === responderInst; + JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp, + JSCompiler_temp$jscomp$0, + nativeEvent, + nativeEventTarget + ); + JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory; + targetInst + ? forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingleSkipTarget + ) + : forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingle + ); + b: { + JSCompiler_temp = JSCompiler_temp$jscomp$0._dispatchListeners; + targetInst = JSCompiler_temp$jscomp$0._dispatchInstances; + if (Array.isArray(JSCompiler_temp)) + for ( + depthA = 0; + depthA < JSCompiler_temp.length && + !JSCompiler_temp$jscomp$0.isPropagationStopped(); + depthA++ + ) { + if ( + JSCompiler_temp[depthA]( + JSCompiler_temp$jscomp$0, + targetInst[depthA] + ) + ) { + JSCompiler_temp = targetInst[depthA]; + break b; + } + } + else if ( + JSCompiler_temp && + JSCompiler_temp(JSCompiler_temp$jscomp$0, targetInst) + ) { + JSCompiler_temp = targetInst; + break b; + } + JSCompiler_temp = null; + } + JSCompiler_temp$jscomp$0._dispatchInstances = null; + JSCompiler_temp$jscomp$0._dispatchListeners = null; + JSCompiler_temp$jscomp$0.isPersistent() || + JSCompiler_temp$jscomp$0.constructor.release( + JSCompiler_temp$jscomp$0 + ); + JSCompiler_temp && JSCompiler_temp !== responderInst + ? ((JSCompiler_temp$jscomp$0 = void 0), + (targetInst = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (targetInst.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(targetInst, accumulateDirectDispatchesSingle), + (depthA = !0 === executeDirectDispatch(targetInst)), + responderInst + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (tempB = + !tempA._dispatchListeners || executeDirectDispatch(tempA)), + tempA.isPersistent() || tempA.constructor.release(tempA), + tempB + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + [targetInst, tempA] + )), + changeResponder(JSCompiler_temp, depthA)) + : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + JSCompiler_temp + )))) + : ((JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + targetInst + )), + changeResponder(JSCompiler_temp, depthA)), + (JSCompiler_temp = JSCompiler_temp$jscomp$0)) + : (JSCompiler_temp = null); + } else JSCompiler_temp = null; + JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); + targetInst = responderInst && isMoveish(topLevelType); + depthA = + responderInst && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); + if ( + (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 + ? eventTypes.responderStart + : targetInst + ? eventTypes.responderMove + : depthA + ? eventTypes.responderEnd + : null) + ) + (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp$jscomp$0, + responderInst, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp = accumulate( + JSCompiler_temp, + JSCompiler_temp$jscomp$0 + )); + JSCompiler_temp$jscomp$0 = + responderInst && "topTouchCancel" === topLevelType; + if ( + (topLevelType = + responderInst && + !JSCompiler_temp$jscomp$0 && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType)) + ) + a: { + if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) + for (targetInst = 0; targetInst < topLevelType.length; targetInst++) + if ( + ((depthA = topLevelType[targetInst].target), + null !== depthA && void 0 !== depthA && 0 !== depthA) + ) { + tempA = getInstanceFromNode(depthA); + b: { + for (depthA = responderInst; tempA; ) { + if (depthA === tempA || depthA === tempA.alternate) { + depthA = !0; + break b; + } + tempA = getParent(tempA); + } + depthA = !1; + } + if (depthA) { + topLevelType = !1; + break a; + } + } + topLevelType = !0; + } + if ( + (topLevelType = JSCompiler_temp$jscomp$0 + ? eventTypes.responderTerminate + : topLevelType + ? eventTypes.responderRelease + : null) + ) + (nativeEvent = ResponderSyntheticEvent.getPooled( + topLevelType, + responderInst, + nativeEvent, + nativeEventTarget + )), + (nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), + (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), + changeResponder(null); + return JSCompiler_temp; + }, + GlobalResponderHandler: null, + injection: { + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } + }, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (null == targetInst) return null; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; + if (!bubbleDispatchConfig && !directDispatchConfig) + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + topLevelType = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) + forEachAccumulated(topLevelType, accumulateTwoPhaseDispatchesSingle); + else if (directDispatchConfig) + forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle); + else return null; + return topLevelType; + } + } +}); +function getInstanceFromInstance(instanceHandle) { + return instanceHandle; +} +getFiberCurrentPropsFromNode = function(inst) { + return inst.canonical.currentProps; +}; +getInstanceFromNode = getInstanceFromInstance; +getNodeFromInstance = function(inst) { + inst = inst.stateNode.canonical._nativeTag; + if (!inst) throw ReactError(Error("All native instances should have a tag.")); + return inst; +}; +ResponderEventPlugin.injection.injectGlobalResponderHandler({ + onChange: function(from, to, blockNativeResponder) { + null !== to + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode.canonical._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); + } +}); +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || + (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); +var hasSymbol = "function" === typeof Symbol && Symbol.for, + REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, + REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, + REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, + REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, + REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114, + REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109, + REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, + REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 60111, + REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, + REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, + REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, + REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); +var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +function getComponentName(type) { + if (null == type) return null; + if ("function" === typeof type) return type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + innerType = innerType.displayName || innerType.name || ""; + return ( + type.displayName || + ("" !== innerType ? "ForwardRef(" + innerType + ")" : "ForwardRef") + ); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: + if ((type = 1 === type._status ? type._result : null)) + return getComponentName(type); + } + return null; +} +require("../shims/ReactFeatureFlags"); +function isFiberMountedImpl(fiber) { + var node = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + if (0 !== (node.effectTag & 2)) return 1; + for (; node.return; ) + if (((node = node.return), 0 !== (node.effectTag & 2))) return 1; + } + return 3 === node.tag ? 2 : 3; +} +function assertIsMounted(fiber) { + if (2 !== isFiberMountedImpl(fiber)) + throw ReactError(Error("Unable to find node on an unmounted component.")); +} +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = isFiberMountedImpl(fiber); + if (3 === alternate) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return 1 === alternate ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + } + if (a.alternate !== b) + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (3 !== a.tag) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return a.stateNode.current === a ? fiber : alternate; +} +function findCurrentHostFiber(parent) { + parent = findCurrentFiberUsingSlowPath(parent); + if (!parent) return null; + for (var node = parent; ; ) { + if (5 === node.tag || 6 === node.tag) return node; + if (node.child) (node.child.return = node), (node = node.child); + else { + if (node === parent) break; + for (; !node.sibling; ) { + if (!node.return || node.return === parent) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return null; +} +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if ( + callback && + ("boolean" !== typeof context.__isMounted || context.__isMounted) + ) + return callback.apply(context, arguments); + }; +} +var emptyObject = {}, + removedKeys = null, + removedKeyCount = 0; +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) + for (var i = node.length; i-- && 0 < removedKeyCount; ) + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + else if (node && 0 < removedKeyCount) + for (i in removedKeys) + if (removedKeys[i]) { + var nextProp = node[i]; + if (void 0 !== nextProp) { + var attributeConfig = validAttributes[i]; + if (attributeConfig) { + "function" === typeof nextProp && (nextProp = !0); + "undefined" === typeof nextProp && (nextProp = null); + if ("object" !== typeof attributeConfig) + updatePayload[i] = nextProp; + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (nextProp = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[i] = nextProp); + removedKeys[i] = !1; + removedKeyCount--; + } + } + } +} +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) return updatePayload; + if (!prevProp || !nextProp) + return nextProp + ? addNestedProperty(updatePayload, nextProp, validAttributes) + : prevProp + ? clearNestedProperty(updatePayload, prevProp, validAttributes) + : updatePayload; + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + var minLength = + prevProp.length < nextProp.length ? prevProp.length : nextProp.length, + i; + for (i = 0; i < minLength; i++) + updatePayload = diffNestedProperty( + updatePayload, + prevProp[i], + nextProp[i], + validAttributes + ); + for (; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + for (; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; + } + return Array.isArray(prevProp) + ? diffProperties( + updatePayload, + ReactNativePrivateInterface.flattenStyle(prevProp), + nextProp, + validAttributes + ) + : diffProperties( + updatePayload, + prevProp, + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) return updatePayload; + if (!Array.isArray(nextProp)) + return diffProperties( + updatePayload, + emptyObject, + nextProp, + validAttributes + ); + for (var i = 0; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; +} +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) return updatePayload; + if (!Array.isArray(prevProp)) + return diffProperties( + updatePayload, + prevProp, + emptyObject, + validAttributes + ); + for (var i = 0; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + return updatePayload; +} +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig, propKey; + for (propKey in nextProps) + if ((attributeConfig = validAttributes[propKey])) { + var prevProp = prevProps[propKey]; + var nextProp = nextProps[propKey]; + "function" === typeof nextProp && + ((nextProp = !0), "function" === typeof prevProp && (prevProp = !0)); + "undefined" === typeof nextProp && + ((nextProp = null), + "undefined" === typeof prevProp && (prevProp = null)); + removedKeys && (removedKeys[propKey] = !1); + if (updatePayload && void 0 !== updatePayload[propKey]) + if ("object" !== typeof attributeConfig) + updatePayload[propKey] = nextProp; + else { + if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[propKey] = attributeConfig); + } + else if (prevProp !== nextProp) + if ("object" !== typeof attributeConfig) + ("object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && + ((updatePayload || (updatePayload = {}))[propKey] = nextProp); + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) { + if ( + void 0 === prevProp || + ("function" === typeof attributeConfig.diff + ? attributeConfig.diff(prevProp, nextProp) + : "object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + ((updatePayload || (updatePayload = {}))[ + propKey + ] = attributeConfig); + } else + (removedKeys = null), + (removedKeyCount = 0), + (updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + )), + 0 < removedKeyCount && + updatePayload && + (restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ), + (removedKeys = null)); + } + for (var _propKey in prevProps) + void 0 === nextProps[_propKey] && + (!(attributeConfig = validAttributes[_propKey]) || + (updatePayload && void 0 !== updatePayload[_propKey]) || + ((prevProp = prevProps[_propKey]), + void 0 !== prevProp && + ("object" !== typeof attributeConfig || + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ? (((updatePayload || (updatePayload = {}))[_propKey] = null), + removedKeys || (removedKeys = {}), + removedKeys[_propKey] || + ((removedKeys[_propKey] = !0), removedKeyCount++)) + : (updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ))))); + return updatePayload; +} +var restoreTarget = null, + restoreQueue = null; +function restoreStateOfTarget(target) { + if (getInstanceFromNode(target)) + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +function batchedUpdatesImpl(fn, bookkeeping) { + return fn(bookkeeping); +} +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) + if ( + (flushDiscreteUpdatesImpl(), + restoreTarget && + ((bookkeeping = restoreTarget), + (fn = restoreQueue), + (restoreQueue = restoreTarget = null), + restoreStateOfTarget(bookkeeping), + fn)) + ) + for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++) + restoreStateOfTarget(fn[bookkeeping]); + } +} +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +(function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() {}; + ReactNativeComponent.prototype.focus = function() {}; + ReactNativeComponent.prototype.measure = function() {}; + ReactNativeComponent.prototype.measureInWindow = function() {}; + ReactNativeComponent.prototype.measureLayout = function() {}; + ReactNativeComponent.prototype.setNativeProps = function() {}; + return ReactNativeComponent; +})(React.Component); +new Map(); +new Map(); +new Set(); +new Map(); +function dispatchEvent(target, topLevelType, nativeEvent) { + batchedUpdates(function() { + var events = nativeEvent.target; + for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { + var possiblePlugin = plugins[i]; + possiblePlugin && + (possiblePlugin = possiblePlugin.extractEvents( + topLevelType, + target, + nativeEvent, + events + )) && + (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); + } + events = events$jscomp$0; + null !== events && (eventQueue = accumulateInto(eventQueue, events)); + events = eventQueue; + eventQueue = null; + if (events) { + forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); + if (eventQueue) + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + if (hasRethrowError) + throw ((events = rethrowError), + (hasRethrowError = !1), + (rethrowError = null), + events); + } + }); +} +function shim$1() { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +var _nativeFabricUIManage$1 = nativeFabricUIManager, + createNode = _nativeFabricUIManage$1.createNode, + cloneNode = _nativeFabricUIManage$1.cloneNode, + cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren, + cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps, + cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps, + createChildNodeSet = _nativeFabricUIManage$1.createChildSet, + appendChildNode = _nativeFabricUIManage$1.appendChild, + appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet, + completeRoot = _nativeFabricUIManage$1.completeRoot, + registerEventHandler = _nativeFabricUIManage$1.registerEventHandler, + fabricMeasure = _nativeFabricUIManage$1.measure, + fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow, + fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout, + getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + nextReactTag = 2; +registerEventHandler && registerEventHandler(dispatchEvent); +var ReactFabricHostComponent = (function() { + function ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ) { + if (!(this instanceof ReactFabricHostComponent)) + throw new TypeError("Cannot call a class as a function"); + this._nativeTag = tag; + this.viewConfig = viewConfig; + this.currentProps = props; + this._internalInstanceHandle = internalInstanceHandle; + } + ReactFabricHostComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + ReactFabricHostComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + ReactFabricHostComponent.prototype.measure = function(callback) { + fabricMeasure( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactFabricHostComponent.prototype.measureInWindow = function(callback) { + fabricMeasureInWindow( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactFabricHostComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + "number" !== typeof relativeToNativeNode && + relativeToNativeNode instanceof ReactFabricHostComponent && + fabricMeasureLayout( + this._internalInstanceHandle.stateNode.node, + relativeToNativeNode._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + ReactFabricHostComponent.prototype.setNativeProps = function() {}; + return ReactFabricHostComponent; +})(); +function createTextInstance( + text, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + if (!hostContext.isInAParentText) + throw ReactError( + Error("Text strings must be rendered within a component.") + ); + hostContext = nextReactTag; + nextReactTag += 2; + return { + node: createNode( + hostContext, + "RCTRawText", + rootContainerInstance, + { text: text }, + internalInstanceHandle + ) + }; +} +var scheduleTimeout = setTimeout, + cancelTimeout = clearTimeout; +function cloneHiddenInstance(instance) { + var node = instance.node; + var updatePayload = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + instance.canonical.viewConfig.validAttributes + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical + }; +} +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + do { + a: switch (workInProgress.tag) { + case 3: + case 4: + case 6: + case 7: + case 10: + case 9: + var JSCompiler_inline_result = ""; + break a; + default: + var owner = workInProgress._debugOwner, + source = workInProgress._debugSource, + name = getComponentName(workInProgress.type); + JSCompiler_inline_result = null; + owner && (JSCompiler_inline_result = getComponentName(owner.type)); + owner = name; + name = ""; + source + ? (name = + " (at " + + source.fileName.replace(BEFORE_SLASH_RE, "") + + ":" + + source.lineNumber + + ")") + : JSCompiler_inline_result && + (name = " (created by " + JSCompiler_inline_result + ")"); + JSCompiler_inline_result = "\n in " + (owner || "Unknown") + name; + } + info += JSCompiler_inline_result; + workInProgress = workInProgress.return; + } while (workInProgress); + return info; +} +new Set(); +var valueStack = [], + index = -1; +function pop(cursor) { + 0 > index || + ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); +} +function push(cursor, value) { + index++; + valueStack[index] = cursor.current; + cursor.current = value; +} +var emptyContextObject = {}, + contextStackCursor = { current: emptyContextObject }, + didPerformWorkStackCursor = { current: !1 }, + previousContext = emptyContextObject; +function getMaskedContext(workInProgress, unmaskedContext) { + var contextTypes = workInProgress.type.contextTypes; + if (!contextTypes) return emptyContextObject; + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) + return instance.__reactInternalMemoizedMaskedChildContext; + var context = {}, + key; + for (key in contextTypes) context[key] = unmaskedContext[key]; + instance && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return context; +} +function isContextProvider(type) { + type = type.childContextTypes; + return null !== type && void 0 !== type; +} +function popContext(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function popTopLevelContextObject(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function pushTopLevelContextObject(fiber, context, didChange) { + if (contextStackCursor.current !== emptyContextObject) + throw ReactError( + Error( + "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(fiber, type, parentContext) { + var instance = fiber.stateNode; + fiber = type.childContextTypes; + if ("function" !== typeof instance.getChildContext) return parentContext; + instance = instance.getChildContext(); + for (var contextKey in instance) + if (!(contextKey in fiber)) + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + return Object.assign({}, parentContext, instance); +} +function pushContextProvider(workInProgress) { + var instance = workInProgress.stateNode; + instance = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + previousContext = contextStackCursor.current; + push(contextStackCursor, instance, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + return !0; +} +function invalidateContextProvider(workInProgress, type, didChange) { + var instance = workInProgress.stateNode; + if (!instance) + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + didChange + ? ((type = processChildContext(workInProgress, type, previousContext)), + (instance.__reactInternalMemoizedMergedChildContext = type), + pop(didPerformWorkStackCursor, workInProgress), + pop(contextStackCursor, workInProgress), + push(contextStackCursor, type, workInProgress)) + : pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); +} +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, + Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, + Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, + Scheduler_now = Scheduler.unstable_now, + Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel, + Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, + Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, + Scheduler_LowPriority = Scheduler.unstable_LowPriority, + Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, + fakeCallbackNode = {}, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, + immediateQueueCallbackNode = null, + isFlushingSyncQueue = !1, + initialTimeMs = Scheduler_now(), + now = + 1e4 > initialTimeMs + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return 99; + case Scheduler_UserBlockingPriority: + return 98; + case Scheduler_NormalPriority: + return 97; + case Scheduler_LowPriority: + return 96; + case Scheduler_IdlePriority: + return 95; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case 99: + return Scheduler_ImmediatePriority; + case 98: + return Scheduler_UserBlockingPriority; + case 97: + return Scheduler_NormalPriority; + case 96: + return Scheduler_LowPriority; + case 95: + return Scheduler_IdlePriority; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function runWithPriority$1(reactPriorityLevel, fn) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(reactPriorityLevel, fn); +} +function scheduleCallback(reactPriorityLevel, callback, options) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); +} +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { + null !== immediateQueueCallbackNode && + Scheduler_cancelCallback(immediateQueueCallbackNode); + flushSyncCallbackQueueImpl(); +} +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0; + try { + var queue = syncQueue; + runWithPriority$1(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ), + error); + } finally { + isFlushingSyncQueue = !1; + } + } +} +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (1073741823 === expirationTime) return 99; + if (1 === expirationTime) return 95; + currentTime = + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); + return 0 >= currentTime + ? 99 + : 250 >= currentTime + ? 98 + : 5250 >= currentTime + ? 97 + : 95; +} +function is(x, y) { + return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function shallowEqual(objA, objB) { + if (is(objA, objB)) return !0; + if ( + "object" !== typeof objA || + null === objA || + "object" !== typeof objB || + null === objB + ) + return !1; + var keysA = Object.keys(objA), + keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) + if ( + !hasOwnProperty.call(objB, keysA[keysB]) || + !is(objA[keysA[keysB]], objB[keysA[keysB]]) + ) + return !1; + return !0; +} +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + baseProps = Object.assign({}, baseProps); + Component = Component.defaultProps; + for (var propName in Component) + void 0 === baseProps[propName] && + (baseProps[propName] = Component[propName]); + } + return baseProps; +} +function readLazyComponentType(lazyComponent) { + var result = lazyComponent._result; + switch (lazyComponent._status) { + case 1: + return result; + case 2: + throw result; + case 0: + throw result; + default: + lazyComponent._status = 0; + result = lazyComponent._ctor; + result = result(); + result.then( + function(moduleObject) { + 0 === lazyComponent._status && + ((moduleObject = moduleObject.default), + (lazyComponent._status = 1), + (lazyComponent._result = moduleObject)); + }, + function(error) { + 0 === lazyComponent._status && + ((lazyComponent._status = 2), (lazyComponent._result = error)); + } + ); + switch (lazyComponent._status) { + case 1: + return lazyComponent._result; + case 2: + throw lazyComponent._result; + } + lazyComponent._result = result; + throw result; + } +} +var valueCursor = { current: null }, + currentlyRenderingFiber = null, + lastContextDependency = null, + lastContextWithAllBitsObserved = null; +function resetContextDependencies() { + lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; +} +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; +} +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + providerFiber.type._context._currentValue2 = currentValue; +} +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextWithAllBitsObserved = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context, observedBits) { + if ( + lastContextWithAllBitsObserved !== context && + !1 !== observedBits && + 0 !== observedBits + ) { + if ("number" !== typeof observedBits || 1073741823 === observedBits) + (lastContextWithAllBitsObserved = context), (observedBits = 1073741823); + observedBits = { context: context, observedBits: observedBits, next: null }; + if (null === lastContextDependency) { + if (null === currentlyRenderingFiber) + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + lastContextDependency = observedBits; + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null + }; + } else lastContextDependency = lastContextDependency.next = observedBits; + } + return context._currentValue2; +} +var hasForceUpdate = !1; +function createUpdateQueue(baseState) { + return { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function cloneUpdateQueue(currentQueue) { + return { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function createUpdate(expirationTime, suspenseConfig) { + return { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + tag: 0, + payload: null, + callback: null, + next: null, + nextEffect: null + }; +} +function appendUpdateToQueue(queue, update) { + null === queue.lastUpdate + ? (queue.firstUpdate = queue.lastUpdate = update) + : ((queue.lastUpdate.next = update), (queue.lastUpdate = update)); +} +function enqueueUpdate(fiber, update) { + var alternate = fiber.alternate; + if (null === alternate) { + var queue1 = fiber.updateQueue; + var queue2 = null; + null === queue1 && + (queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState)); + } else + (queue1 = fiber.updateQueue), + (queue2 = alternate.updateQueue), + null === queue1 + ? null === queue2 + ? ((queue1 = fiber.updateQueue = createUpdateQueue( + fiber.memoizedState + )), + (queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ))) + : (queue1 = fiber.updateQueue = cloneUpdateQueue(queue2)) + : null === queue2 && + (queue2 = alternate.updateQueue = cloneUpdateQueue(queue1)); + null === queue2 || queue1 === queue2 + ? appendUpdateToQueue(queue1, update) + : null === queue1.lastUpdate || null === queue2.lastUpdate + ? (appendUpdateToQueue(queue1, update), + appendUpdateToQueue(queue2, update)) + : (appendUpdateToQueue(queue1, update), (queue2.lastUpdate = update)); +} +function enqueueCapturedUpdate(workInProgress, update) { + var workInProgressQueue = workInProgress.updateQueue; + workInProgressQueue = + null === workInProgressQueue + ? (workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + )) + : ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue); + null === workInProgressQueue.lastCapturedUpdate + ? (workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update) + : ((workInProgressQueue.lastCapturedUpdate.next = update), + (workInProgressQueue.lastCapturedUpdate = update)); +} +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + null !== current && + queue === current.updateQueue && + (queue = workInProgress.updateQueue = cloneUpdateQueue(queue)); + return queue; +} +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case 1: + return ( + (workInProgress = update.payload), + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress + ); + case 3: + workInProgress.effectTag = (workInProgress.effectTag & -2049) | 64; + case 0: + workInProgress = update.payload; + nextProps = + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress; + if (null === nextProps || void 0 === nextProps) break; + return Object.assign({}, prevState, nextProps); + case 2: + hasForceUpdate = !0; + } + return prevState; +} +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = !1; + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + for ( + var newBaseState = queue.baseState, + newFirstUpdate = null, + newExpirationTime = 0, + update = queue.firstUpdate, + resultState = newBaseState; + null !== update; + + ) { + var updateExpirationTime = update.expirationTime; + updateExpirationTime < renderExpirationTime + ? (null === newFirstUpdate && + ((newFirstUpdate = update), (newBaseState = resultState)), + newExpirationTime < updateExpirationTime && + (newExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), + (resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastEffect + ? (queue.firstEffect = queue.lastEffect = update) + : ((queue.lastEffect.nextEffect = update), + (queue.lastEffect = update)))); + update = update.next; + } + updateExpirationTime = null; + for (update = queue.firstCapturedUpdate; null !== update; ) { + var _updateExpirationTime = update.expirationTime; + _updateExpirationTime < renderExpirationTime + ? (null === updateExpirationTime && + ((updateExpirationTime = update), + null === newFirstUpdate && (newBaseState = resultState)), + newExpirationTime < _updateExpirationTime && + (newExpirationTime = _updateExpirationTime)) + : ((resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastCapturedEffect + ? (queue.firstCapturedEffect = queue.lastCapturedEffect = update) + : ((queue.lastCapturedEffect.nextEffect = update), + (queue.lastCapturedEffect = update)))); + update = update.next; + } + null === newFirstUpdate && (queue.lastUpdate = null); + null === updateExpirationTime + ? (queue.lastCapturedUpdate = null) + : (workInProgress.effectTag |= 32); + null === newFirstUpdate && + null === updateExpirationTime && + (newBaseState = resultState); + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = updateExpirationTime; + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; +} +function commitUpdateQueue(finishedWork, finishedQueue, instance) { + null !== finishedQueue.firstCapturedUpdate && + (null !== finishedQueue.lastUpdate && + ((finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate), + (finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate)), + (finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null)); + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} +function commitUpdateEffects(effect, instance) { + for (; null !== effect; ) { + var _callback3 = effect.callback; + if (null !== _callback3) { + effect.callback = null; + var context = instance; + if ("function" !== typeof _callback3) + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) + ); + _callback3.call(context); + } + effect = effect.nextEffect; + } +} +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + ctor = workInProgress.memoizedState; + getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor); + getDerivedStateFromProps = + null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps + ? ctor + : Object.assign({}, ctor, getDerivedStateFromProps); + workInProgress.memoizedState = getDerivedStateFromProps; + nextProps = workInProgress.updateQueue; + null !== nextProps && + 0 === workInProgress.expirationTime && + (nextProps.baseState = getDerivedStateFromProps); +} +var classComponentUpdater = { + isMounted: function(component) { + return (component = component._reactInternalFiber) + ? 2 === isFiberMountedImpl(component) + : !1; + }, + enqueueSetState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueForceUpdate: function(inst, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + } +}; +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + workInProgress = workInProgress.stateNode; + return "function" === typeof workInProgress.shouldComponentUpdate + ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext) + : ctor.prototype && ctor.prototype.isPureReactComponent + ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + : !0; +} +function constructClassInstance(workInProgress, ctor, props) { + var isLegacyContextConsumer = !1, + unmaskedContext = emptyContextObject; + var context = ctor.contextType; + "object" === typeof context && null !== context + ? (context = readContext(context)) + : ((unmaskedContext = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (isLegacyContextConsumer = ctor.contextTypes), + (context = (isLegacyContextConsumer = + null !== isLegacyContextConsumer && void 0 !== isLegacyContextConsumer) + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject)); + ctor = new ctor(props, context); + workInProgress.memoizedState = + null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; + ctor.updater = classComponentUpdater; + workInProgress.stateNode = ctor; + ctor._reactInternalFiber = workInProgress; + isLegacyContextConsumer && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return ctor; +} +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + workInProgress = instance.state; + "function" === typeof instance.componentWillReceiveProps && + instance.componentWillReceiveProps(newProps, nextContext); + "function" === typeof instance.UNSAFE_componentWillReceiveProps && + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + instance.state !== workInProgress && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); +} +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + var contextType = ctor.contextType; + "object" === typeof contextType && null !== contextType + ? (instance.context = readContext(contextType)) + : ((contextType = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (instance.context = getMaskedContext(workInProgress, contextType))); + contextType = workInProgress.updateQueue; + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState)); + contextType = ctor.getDerivedStateFromProps; + "function" === typeof contextType && + (applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps), + (instance.state = workInProgress.memoizedState)); + "function" === typeof ctor.getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ((ctor = instance.state), + "function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount(), + ctor !== instance.state && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null), + (contextType = workInProgress.updateQueue), + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState))); + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4); +} +var isArray = Array.isArray; +function coerceRef(returnFiber, current$$1, element) { + returnFiber = element.ref; + if ( + null !== returnFiber && + "function" !== typeof returnFiber && + "object" !== typeof returnFiber + ) { + if (element._owner) { + element = element._owner; + var inst = void 0; + if (element) { + if (1 !== element.tag) + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + inst = element.stateNode; + } + if (!inst) + throw ReactError( + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + var stringRef = "" + returnFiber; + if ( + null !== current$$1 && + null !== current$$1.ref && + "function" === typeof current$$1.ref && + current$$1.ref._stringRef === stringRef + ) + return current$$1.ref; + current$$1 = function(value) { + var refs = inst.refs; + refs === emptyRefsObject && (refs = inst.refs = {}); + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + }; + current$$1._stringRef = stringRef; + return current$$1; + } + if ("string" !== typeof returnFiber) + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + if (!element._owner) + throw ReactError( + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + return returnFiber; +} +function throwOnInvalidObjectType(returnFiber, newChild) { + if ("textarea" !== returnFiber.type) + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) + ); +} +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (shouldTrackSideEffects) { + var last = returnFiber.lastEffect; + null !== last + ? ((last.nextEffect = childToDelete), + (returnFiber.lastEffect = childToDelete)) + : (returnFiber.firstEffect = returnFiber.lastEffect = childToDelete); + childToDelete.nextEffect = null; + childToDelete.effectTag = 8; + } + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) return null; + for (; null !== currentFirstChild; ) + deleteChild(returnFiber, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return null; + } + function mapRemainingChildren(returnFiber, currentFirstChild) { + for (returnFiber = new Map(); null !== currentFirstChild; ) + null !== currentFirstChild.key + ? returnFiber.set(currentFirstChild.key, currentFirstChild) + : returnFiber.set(currentFirstChild.index, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return returnFiber; + } + function useFiber(fiber, pendingProps, expirationTime) { + fiber = createWorkInProgress(fiber, pendingProps, expirationTime); + fiber.index = 0; + fiber.sibling = null; + return fiber; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) return lastPlacedIndex; + newIndex = newFiber.alternate; + if (null !== newIndex) + return ( + (newIndex = newIndex.index), + newIndex < lastPlacedIndex + ? ((newFiber.effectTag = 2), lastPlacedIndex) + : newIndex + ); + newFiber.effectTag = 2; + return lastPlacedIndex; + } + function placeSingleChild(newFiber) { + shouldTrackSideEffects && + null === newFiber.alternate && + (newFiber.effectTag = 2); + return newFiber; + } + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (null === current$$1 || 6 !== current$$1.tag) + return ( + (current$$1 = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, textContent, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateElement(returnFiber, current$$1, element, expirationTime) { + if (null !== current$$1 && current$$1.elementType === element.type) + return ( + (expirationTime = useFiber(current$$1, element.props, expirationTime)), + (expirationTime.ref = coerceRef(returnFiber, current$$1, element)), + (expirationTime.return = returnFiber), + expirationTime + ); + expirationTime = createFiberFromTypeAndProps( + element.type, + element.key, + element.props, + null, + returnFiber.mode, + expirationTime + ); + expirationTime.ref = coerceRef(returnFiber, current$$1, element); + expirationTime.return = returnFiber; + return expirationTime; + } + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + null === current$$1 || + 4 !== current$$1.tag || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) + return ( + (current$$1 = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, portal.children || [], expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (null === current$$1 || 7 !== current$$1.tag) + return ( + (current$$1 = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, fragment, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function createChild(returnFiber, newChild, expirationTime) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef(returnFiber, null, newChild)), + (expirationTime.return = returnFiber), + expirationTime + ); + case REACT_PORTAL_TYPE: + return ( + (newChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (newChild = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + )), + (newChild.return = returnFiber), + newChild + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + var key = null !== oldFiber ? oldFiber.key : null; + if ("string" === typeof newChild || "number" === typeof newChild) + return null !== key + ? null + : updateTextNode(returnFiber, oldFiber, "" + newChild, expirationTime); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return newChild.key === key + ? newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ) + : updateElement(returnFiber, oldFiber, newChild, expirationTime) + : null; + case REACT_PORTAL_TYPE: + return newChild.key === key + ? updatePortal(returnFiber, oldFiber, newChild, expirationTime) + : null; + } + if (isArray(newChild) || getIteratorFn(newChild)) + return null !== key + ? null + : updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateTextNode( + returnFiber, + existingChildren, + "" + newChild, + expirationTime + ) + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + existingChildren, + newChild.props.children, + expirationTime, + newChild.key + ) + : updateElement( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + updatePortal( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateFragment( + returnFiber, + existingChildren, + newChild, + expirationTime, + null + ) + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + for ( + var resultingFirstChild = null, + previousNewFiber = null, + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null; + null !== oldFiber && newIdx < newChildren.length; + newIdx++ + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (resultingFirstChild = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) + return ( + deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild + ); + if (null === oldFiber) { + for (; newIdx < newChildren.length; newIdx++) + (oldFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + )), + null !== oldFiber && + ((currentFirstChild = placeChild( + oldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = oldFiber) + : (previousNewFiber.sibling = oldFiber), + (previousNewFiber = oldFiber)); + return resultingFirstChild; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + newIdx < newChildren.length; + newIdx++ + ) + (nextOldFiber = updateFromMap( + oldFiber, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + )), + null !== nextOldFiber && + (shouldTrackSideEffects && + null !== nextOldFiber.alternate && + oldFiber.delete( + null === nextOldFiber.key ? newIdx : nextOldFiber.key + ), + (currentFirstChild = placeChild( + nextOldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = nextOldFiber) + : (previousNewFiber.sibling = nextOldFiber), + (previousNewFiber = nextOldFiber)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + var iteratorFn = getIteratorFn(newChildrenIterable); + if ("function" !== typeof iteratorFn) + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + newChildrenIterable = iteratorFn.call(newChildrenIterable); + if (null == newChildrenIterable) + throw ReactError(Error("An iterable object provided no iterator.")); + for ( + var previousNewFiber = (iteratorFn = null), + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null, + step = newChildrenIterable.next(); + null !== oldFiber && !step.done; + newIdx++, step = newChildrenIterable.next() + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (iteratorFn = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) + return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn; + if (null === oldFiber) { + for (; !step.done; newIdx++, step = newChildrenIterable.next()) + (step = createChild(returnFiber, step.value, expirationTime)), + null !== step && + ((currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + return iteratorFn; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + !step.done; + newIdx++, step = newChildrenIterable.next() + ) + (step = updateFromMap( + oldFiber, + returnFiber, + newIdx, + step.value, + expirationTime + )), + null !== step && + (shouldTrackSideEffects && + null !== step.alternate && + oldFiber.delete(null === step.key ? newIdx : step.key), + (currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return iteratorFn; + } + return function(returnFiber, currentFirstChild, newChild, expirationTime) { + var isUnkeyedTopLevelFragment = + "object" === typeof newChild && + null !== newChild && + newChild.type === REACT_FRAGMENT_TYPE && + null === newChild.key; + isUnkeyedTopLevelFragment && (newChild = newChild.props.children); + var isObject = "object" === typeof newChild && null !== newChild; + if (isObject) + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + a: { + isObject = newChild.key; + for ( + isUnkeyedTopLevelFragment = currentFirstChild; + null !== isUnkeyedTopLevelFragment; + + ) { + if (isUnkeyedTopLevelFragment.key === isObject) { + if ( + 7 === isUnkeyedTopLevelFragment.tag + ? newChild.type === REACT_FRAGMENT_TYPE + : isUnkeyedTopLevelFragment.elementType === newChild.type + ) { + deleteRemainingChildren( + returnFiber, + isUnkeyedTopLevelFragment.sibling + ); + currentFirstChild = useFiber( + isUnkeyedTopLevelFragment, + newChild.type === REACT_FRAGMENT_TYPE + ? newChild.props.children + : newChild.props, + expirationTime + ); + currentFirstChild.ref = coerceRef( + returnFiber, + isUnkeyedTopLevelFragment, + newChild + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, isUnkeyedTopLevelFragment); + break; + } else deleteChild(returnFiber, isUnkeyedTopLevelFragment); + isUnkeyedTopLevelFragment = isUnkeyedTopLevelFragment.sibling; + } + newChild.type === REACT_FRAGMENT_TYPE + ? ((currentFirstChild = createFiberFromFragment( + newChild.props.children, + returnFiber.mode, + expirationTime, + newChild.key + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : ((expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef( + returnFiber, + currentFirstChild, + newChild + )), + (expirationTime.return = returnFiber), + (returnFiber = expirationTime)); + } + return placeSingleChild(returnFiber); + case REACT_PORTAL_TYPE: + a: { + for ( + isUnkeyedTopLevelFragment = newChild.key; + null !== currentFirstChild; + + ) { + if (currentFirstChild.key === isUnkeyedTopLevelFragment) { + if ( + 4 === currentFirstChild.tag && + currentFirstChild.stateNode.containerInfo === + newChild.containerInfo && + currentFirstChild.stateNode.implementation === + newChild.implementation + ) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + currentFirstChild = useFiber( + currentFirstChild, + newChild.children || [], + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + currentFirstChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + } + return placeSingleChild(returnFiber); + } + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = "" + newChild), + null !== currentFirstChild && 6 === currentFirstChild.tag + ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), + (currentFirstChild = useFiber( + currentFirstChild, + newChild, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : (deleteRemainingChildren(returnFiber, currentFirstChild), + (currentFirstChild = createFiberFromText( + newChild, + returnFiber.mode, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)), + placeSingleChild(returnFiber) + ); + if (isArray(newChild)) + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + if (getIteratorFn(newChild)) + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + isObject && throwOnInvalidObjectType(returnFiber, newChild); + if ("undefined" === typeof newChild && !isUnkeyedTopLevelFragment) + switch (returnFiber.tag) { + case 1: + case 0: + throw ((returnFiber = returnFiber.type), + ReactError( + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + )); + } + return deleteRemainingChildren(returnFiber, currentFirstChild); + }; +} +var reconcileChildFibers = ChildReconciler(!0), + mountChildFibers = ChildReconciler(!1), + NO_CONTEXT = {}, + contextStackCursor$1 = { current: NO_CONTEXT }, + contextFiberStackCursor = { current: NO_CONTEXT }, + rootInstanceStackCursor = { current: NO_CONTEXT }; +function requiredContext(c) { + if (c === NO_CONTEXT) + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + return c; +} +function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, NO_CONTEXT, fiber); + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, { isInAParentText: !1 }, fiber); +} +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} +function pushHostContext(fiber) { + requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = fiber.type; + nextContext = + "AndroidTextInput" === nextContext || + "RCTMultilineTextInputView" === nextContext || + "RCTSinglelineTextInputView" === nextContext || + "RCTText" === nextContext || + "RCTVirtualText" === nextContext; + nextContext = + context.isInAParentText !== nextContext + ? { isInAParentText: nextContext } + : context; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor$1, nextContext, fiber)); +} +function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); +} +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} +var NoEffect$1 = 0, + UnmountSnapshot = 2, + UnmountMutation = 4, + MountMutation = 8, + UnmountLayout = 16, + MountLayout = 32, + MountPassive = 64, + UnmountPassive = 128, + ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, + renderExpirationTime$1 = 0, + currentlyRenderingFiber$1 = null, + currentHook = null, + nextCurrentHook = null, + firstWorkInProgressHook = null, + workInProgressHook = null, + nextWorkInProgressHook = null, + remainingExpirationTime = 0, + componentUpdateQueue = null, + sideEffectTag = 0, + didScheduleRenderPhaseUpdate = !1, + renderPhaseUpdates = null, + numberOfReRenders = 0; +function throwInvalidHookError() { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); +} +function areHookInputsEqual(nextDeps, prevDeps) { + if (null === prevDeps) return !1; + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) + if (!is(nextDeps[i], prevDeps[i])) return !1; + return !0; +} +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = null !== current ? current.memoizedState : null; + ReactCurrentDispatcher$1.current = + null === nextCurrentHook ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; + workInProgress = Component(props, refOrContext); + if (didScheduleRenderPhaseUpdate) { + do + (didScheduleRenderPhaseUpdate = !1), + (numberOfReRenders += 1), + (nextCurrentHook = null !== current ? current.memoizedState : null), + (nextWorkInProgressHook = firstWorkInProgressHook), + (componentUpdateQueue = workInProgressHook = currentHook = null), + (ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate), + (workInProgress = Component(props, refOrContext)); + while (didScheduleRenderPhaseUpdate); + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + current = currentlyRenderingFiber$1; + current.memoizedState = firstWorkInProgressHook; + current.expirationTime = remainingExpirationTime; + current.updateQueue = componentUpdateQueue; + current.effectTag |= sideEffectTag; + current = null !== currentHook && null !== currentHook.next; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + if (current) + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + return workInProgress; +} +function resetHooks() { + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + didScheduleRenderPhaseUpdate = !1; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + queue: null, + baseUpdate: null, + next: null + }; + null === workInProgressHook + ? (firstWorkInProgressHook = workInProgressHook = hook) + : (workInProgressHook = workInProgressHook.next = hook); + return workInProgressHook; +} +function updateWorkInProgressHook() { + if (null !== nextWorkInProgressHook) + (workInProgressHook = nextWorkInProgressHook), + (nextWorkInProgressHook = workInProgressHook.next), + (currentHook = nextCurrentHook), + (nextCurrentHook = null !== currentHook ? currentHook.next : null); + else { + if (null === nextCurrentHook) + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + currentHook = nextCurrentHook; + var newHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + next: null + }; + workInProgressHook = + null === workInProgressHook + ? (firstWorkInProgressHook = newHook) + : (workInProgressHook.next = newHook); + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} +function basicStateReducer(state, action) { + return "function" === typeof action ? action(state) : action; +} +function updateReducer(reducer) { + var hook = updateWorkInProgressHook(), + queue = hook.queue; + if (null === queue) + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + queue.lastRenderedReducer = reducer; + if (0 < numberOfReRenders) { + var _dispatch = queue.dispatch; + if (null !== renderPhaseUpdates) { + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (void 0 !== firstRenderPhaseUpdate) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + do + (newState = reducer(newState, firstRenderPhaseUpdate.action)), + (firstRenderPhaseUpdate = firstRenderPhaseUpdate.next); + while (null !== firstRenderPhaseUpdate); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate === queue.last && (hook.baseState = newState); + queue.lastRenderedState = newState; + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + _dispatch = queue.last; + var baseUpdate = hook.baseUpdate; + newState = hook.baseState; + null !== baseUpdate + ? (null !== _dispatch && (_dispatch.next = null), + (_dispatch = baseUpdate.next)) + : (_dispatch = null !== _dispatch ? _dispatch.next : null); + if (null !== _dispatch) { + var newBaseUpdate = (firstRenderPhaseUpdate = null), + _update = _dispatch, + didSkip = !1; + do { + var updateExpirationTime = _update.expirationTime; + updateExpirationTime < renderExpirationTime$1 + ? (didSkip || + ((didSkip = !0), + (newBaseUpdate = baseUpdate), + (firstRenderPhaseUpdate = newState)), + updateExpirationTime > remainingExpirationTime && + (remainingExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), + (newState = + _update.eagerReducer === reducer + ? _update.eagerState + : reducer(newState, _update.action))); + baseUpdate = _update; + _update = _update.next; + } while (null !== _update && _update !== _dispatch); + didSkip || + ((newBaseUpdate = baseUpdate), (firstRenderPhaseUpdate = newState)); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = firstRenderPhaseUpdate; + queue.lastRenderedState = newState; + } + return [hook.memoizedState, queue.dispatch]; +} +function pushEffect(tag, create, destroy, deps) { + tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; + null === componentUpdateQueue + ? ((componentUpdateQueue = { lastEffect: null }), + (componentUpdateQueue.lastEffect = tag.next = tag)) + : ((create = componentUpdateQueue.lastEffect), + null === create + ? (componentUpdateQueue.lastEffect = tag.next = tag) + : ((destroy = create.next), + (create.next = tag), + (tag.next = destroy), + (componentUpdateQueue.lastEffect = tag))); + return tag; +} +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect( + hookEffectTag, + create, + void 0, + void 0 === deps ? null : deps + ); +} +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var destroy = void 0; + if (null !== currentHook) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (null !== deps && areHookInputsEqual(deps, prevEffect.deps)) { + pushEffect(NoEffect$1, create, destroy, deps); + return; + } + } + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, deps); +} +function imperativeHandleEffect(create, ref) { + if ("function" === typeof ref) + return ( + (create = create()), + ref(create), + function() { + ref(null); + } + ); + if (null !== ref && void 0 !== ref) + return ( + (create = create()), + (ref.current = create), + function() { + ref.current = null; + } + ); +} +function mountDebugValue() {} +function dispatchAction(fiber, queue, action) { + if (!(25 > numberOfReRenders)) + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ) + if ( + ((didScheduleRenderPhaseUpdate = !0), + (fiber = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }), + null === renderPhaseUpdates && (renderPhaseUpdates = new Map()), + (action = renderPhaseUpdates.get(queue)), + void 0 === action) + ) + renderPhaseUpdates.set(queue, fiber); + else { + for (queue = action; null !== queue.next; ) queue = queue.next; + queue.next = fiber; + } + else { + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; + else { + var first = _last.next; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; + } + queue.last = _suspenseConfig; + if ( + 0 === fiber.expirationTime && + (null === alternate || 0 === alternate.expirationTime) && + ((alternate = queue.lastRenderedReducer), null !== alternate) + ) + try { + var currentState = queue.lastRenderedState, + _eagerState = alternate(currentState, action); + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; + if (is(_eagerState, currentState)) return; + } catch (error) { + } finally { + } + scheduleUpdateOnFiber(fiber, currentTime); + } +} +var ContextOnlyDispatcher = { + readContext: readContext, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError + }, + HooksDispatcherOnMount = { + readContext: readContext, + useCallback: function(callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return mountEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return mountEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return mountEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + reducer = reducer.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function(initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function(initialState) { + var hook = mountWorkInProgressHook(); + "function" === typeof initialState && (initialState = initialState()); + hook.memoizedState = hook.baseState = initialState; + initialState = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + initialState = initialState.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + initialState + ); + return [hook.memoizedState, initialState]; + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + HooksDispatcherOnUpdate = { + readContext: readContext, + useCallback: function(callback, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + hook.memoizedState = [callback, deps]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return updateEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return updateEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return updateEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: updateReducer, + useRef: function() { + return updateWorkInProgressHook().memoizedState; + }, + useState: function(initialState) { + return updateReducer(basicStateReducer, initialState); + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + hydrationParentFiber = null, + nextHydratableInstance = null, + isHydrating = !1; +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case 5: + return ( + (nextInstance = shim$1(nextInstance, fiber.type, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 6: + return ( + (nextInstance = shim$1(nextInstance, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 13: + return !1; + default: + return !1; + } +} +function tryToClaimNextHydratableInstance(fiber$jscomp$0) { + if (isHydrating) { + var nextInstance = nextHydratableInstance; + if (nextInstance) { + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber$jscomp$0, nextInstance)) { + nextInstance = shim$1(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber$jscomp$0, nextInstance)) { + fiber$jscomp$0.effectTag |= 2; + isHydrating = !1; + hydrationParentFiber = fiber$jscomp$0; + return; + } + var returnFiber = hydrationParentFiber, + fiber = createFiber(5, null, null, 0); + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + fiber.stateNode = firstAttemptedInstance; + fiber.return = returnFiber; + fiber.effectTag = 8; + null !== returnFiber.lastEffect + ? ((returnFiber.lastEffect.nextEffect = fiber), + (returnFiber.lastEffect = fiber)) + : (returnFiber.firstEffect = returnFiber.lastEffect = fiber); + } + hydrationParentFiber = fiber$jscomp$0; + nextHydratableInstance = shim$1(nextInstance); + } else + (fiber$jscomp$0.effectTag |= 2), + (isHydrating = !1), + (hydrationParentFiber = fiber$jscomp$0); + } +} +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner, + didReceiveUpdate = !1; +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + workInProgress.child = + null === current$$1 + ? mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ) + : reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); +} +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + Component = Component.render; + var ref = workInProgress.ref; + prepareToReadContext(workInProgress, renderExpirationTime); + nextProps = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + ref, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + nextProps, + renderExpirationTime + ); + return workInProgress.child; +} +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (null === current$$1) { + var type = Component.type; + if ( + "function" === typeof type && + !shouldConstruct(type) && + void 0 === type.defaultProps && + null === Component.compare && + void 0 === Component.defaultProps + ) + return ( + (workInProgress.tag = 15), + (workInProgress.type = type), + updateSimpleMemoComponent( + current$$1, + workInProgress, + type, + nextProps, + updateExpirationTime, + renderExpirationTime + ) + ); + current$$1 = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); + } + type = current$$1.child; + if ( + updateExpirationTime < renderExpirationTime && + ((updateExpirationTime = type.memoizedProps), + (Component = Component.compare), + (Component = null !== Component ? Component : shallowEqual), + Component(updateExpirationTime, nextProps) && + current$$1.ref === workInProgress.ref) + ) + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + current$$1 = createWorkInProgress(type, nextProps, renderExpirationTime); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); +} +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + return null !== current$$1 && + shallowEqual(current$$1.memoizedProps, nextProps) && + current$$1.ref === workInProgress.ref && + ((didReceiveUpdate = !1), updateExpirationTime < renderExpirationTime) + ? bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + : updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (null === current$$1 && null !== ref) || + (null !== current$$1 && current$$1.ref !== ref) + ) + workInProgress.effectTag |= 128; +} +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor.current; + context = getMaskedContext(workInProgress, context); + prepareToReadContext(workInProgress, renderExpirationTime); + Component = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + Component, + renderExpirationTime + ); + return workInProgress.child; +} +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (isContextProvider(Component)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + prepareToReadContext(workInProgress, renderExpirationTime); + if (null === workInProgress.stateNode) + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + (nextProps = !0); + else if (null === current$$1) { + var instance = workInProgress.stateNode, + oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + var oldContext = instance.context, + contextType = Component.contextType; + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))); + var getDerivedStateFromProps = Component.getDerivedStateFromProps, + hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate; + hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )); + hasForceUpdate = !1; + var oldState = workInProgress.memoizedState; + oldContext = instance.state = oldState; + var updateQueue = workInProgress.updateQueue; + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldContext = workInProgress.memoizedState)); + oldProps !== nextProps || + oldState !== oldContext || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldContext = workInProgress.memoizedState)), + (oldProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldState, + oldContext, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ("function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount()), + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldContext)), + (instance.props = nextProps), + (instance.state = oldContext), + (instance.context = contextType), + (nextProps = oldProps)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (nextProps = !1)); + } else + (instance = workInProgress.stateNode), + (oldProps = workInProgress.memoizedProps), + (instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps)), + (oldContext = instance.context), + (contextType = Component.contextType), + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))), + (getDerivedStateFromProps = Component.getDerivedStateFromProps), + (hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate) || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )), + (hasForceUpdate = !1), + (oldContext = workInProgress.memoizedState), + (oldState = instance.state = oldContext), + (updateQueue = workInProgress.updateQueue), + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldState = workInProgress.memoizedState)), + oldProps !== nextProps || + oldContext !== oldState || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldState = workInProgress.memoizedState)), + (getDerivedStateFromProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldContext, + oldState, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillUpdate && + "function" !== typeof instance.componentWillUpdate) || + ("function" === typeof instance.componentWillUpdate && + instance.componentWillUpdate( + nextProps, + oldState, + contextType + ), + "function" === typeof instance.UNSAFE_componentWillUpdate && + instance.UNSAFE_componentWillUpdate( + nextProps, + oldState, + contextType + )), + "function" === typeof instance.componentDidUpdate && + (workInProgress.effectTag |= 4), + "function" === typeof instance.getSnapshotBeforeUpdate && + (workInProgress.effectTag |= 256)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldState)), + (instance.props = nextProps), + (instance.state = oldState), + (instance.context = contextType), + (nextProps = getDerivedStateFromProps)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (nextProps = !1)); + return finishClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + hasContext, + renderExpirationTime + ); +} +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + markRef(current$$1, workInProgress); + var didCaptureError = 0 !== (workInProgress.effectTag & 64); + if (!shouldUpdate && !didCaptureError) + return ( + hasContext && invalidateContextProvider(workInProgress, Component, !1), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + shouldUpdate = workInProgress.stateNode; + ReactCurrentOwner$3.current = workInProgress; + var nextChildren = + didCaptureError && "function" !== typeof Component.getDerivedStateFromError + ? null + : shouldUpdate.render(); + workInProgress.effectTag |= 1; + null !== current$$1 && didCaptureError + ? ((workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + )), + (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ))) + : reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + workInProgress.memoizedState = shouldUpdate.state; + hasContext && invalidateContextProvider(workInProgress, Component, !0); + return workInProgress.child; +} +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + root.pendingContext + ? pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ) + : root.context && + pushTopLevelContextObject(workInProgress, root.context, !1); + pushHostContainer(workInProgress, root.containerInfo); +} +var SUSPENDED_MARKER = {}; +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode, + nextProps = workInProgress.pendingProps, + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), + (nextDidTimeout = !0), + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); + if (null === current$$1) + if (nextDidTimeout) { + nextProps = nextProps.fallback; + current$$1 = createFiberFromFragment(null, mode, 0, null); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; + } else + mode = renderExpirationTime = mountChildFibers( + workInProgress, + null, + nextProps.children, + renderExpirationTime + ); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } + workInProgress.memoizedState = nextState; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; +} +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + null !== current$$1 && + (workInProgress.dependencies = current$$1.dependencies); + if (workInProgress.childExpirationTime < renderExpirationTime) return null; + if (null !== current$$1 && workInProgress.child !== current$$1.child) + throw ReactError(Error("Resuming work not yet implemented.")); + if (null !== workInProgress.child) { + current$$1 = workInProgress.child; + renderExpirationTime = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + ); + workInProgress.child = renderExpirationTime; + for ( + renderExpirationTime.return = workInProgress; + null !== current$$1.sibling; + + ) + (current$$1 = current$$1.sibling), + (renderExpirationTime = renderExpirationTime.sibling = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + )), + (renderExpirationTime.return = workInProgress); + renderExpirationTime.sibling = null; + } + return workInProgress.child; +} +var appendAllChildren = void 0, + updateHostContainer = void 0, + updateHostComponent$1 = void 0, + updateHostText$1 = void 0; +appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden +) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance( + instance, + node.type, + node.memoizedProps, + node + )); + appendChildNode(parent.node, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + appendChildNode(parent.node, instance.node); + } else if (4 !== node.tag) { + if ( + 13 === node.tag && + 0 !== (node.effectTag & 4) && + (instance = null !== node.memoizedState) + ) { + var primaryChildParent = node.child; + if ( + null !== primaryChildParent && + (null !== primaryChildParent.child && + ((primaryChildParent.child.return = primaryChildParent), + appendAllChildren(parent, primaryChildParent, !0, instance)), + (instance = primaryChildParent.sibling), + null !== instance) + ) { + instance.return = node; + node = instance; + continue; + } + } + if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +}; +function appendAllChildrenToContainer( + containerChildSet, + workInProgress, + needsVisibilityToggle, + isHidden +) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance( + instance, + node.type, + node.memoizedProps, + node + )); + appendChildNodeToSet(containerChildSet, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + appendChildNodeToSet(containerChildSet, instance.node); + } else if (4 !== node.tag) { + if ( + 13 === node.tag && + 0 !== (node.effectTag & 4) && + (instance = null !== node.memoizedState) + ) { + var primaryChildParent = node.child; + if ( + null !== primaryChildParent && + (null !== primaryChildParent.child && + ((primaryChildParent.child.return = primaryChildParent), + appendAllChildrenToContainer( + containerChildSet, + primaryChildParent, + !0, + instance + )), + (instance = primaryChildParent.sibling), + null !== instance) + ) { + instance.return = node; + node = instance; + continue; + } + } + if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} +updateHostContainer = function(workInProgress) { + var portalOrRoot = workInProgress.stateNode; + if (null !== workInProgress.firstEffect) { + var container = portalOrRoot.containerInfo, + newChildSet = createChildNodeSet(container); + appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); + portalOrRoot.pendingChildren = newChildSet; + workInProgress.effectTag |= 4; + completeRoot(container, newChildSet); + } +}; +updateHostComponent$1 = function(current, workInProgress, type, newProps) { + type = current.stateNode; + var oldProps = current.memoizedProps; + if ((current = null === workInProgress.firstEffect) && oldProps === newProps) + workInProgress.stateNode = type; + else { + var recyclableInstance = workInProgress.stateNode; + requiredContext(contextStackCursor$1.current); + var updatePayload = null; + oldProps !== newProps && + ((oldProps = diffProperties( + null, + oldProps, + newProps, + recyclableInstance.canonical.viewConfig.validAttributes + )), + (recyclableInstance.canonical.currentProps = newProps), + (updatePayload = oldProps)); + current && null === updatePayload + ? (workInProgress.stateNode = type) + : ((newProps = updatePayload), + (recyclableInstance = type.node), + (type = { + node: current + ? null !== newProps + ? cloneNodeWithNewProps(recyclableInstance, newProps) + : cloneNode(recyclableInstance) + : null !== newProps + ? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps) + : cloneNodeWithNewChildren(recyclableInstance), + canonical: type.canonical + }), + (workInProgress.stateNode = type), + current + ? (workInProgress.effectTag |= 4) + : appendAllChildren(type, workInProgress, !1, !1)); + } +}; +updateHostText$1 = function(current, workInProgress, oldText, newText) { + oldText !== newText && + ((current = requiredContext(rootInstanceStackCursor.current)), + (oldText = requiredContext(contextStackCursor$1.current)), + (workInProgress.stateNode = createTextInstance( + newText, + current, + oldText, + workInProgress + )), + (workInProgress.effectTag |= 4)); +}; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} +function createCapturedValue(value, source) { + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); +function logCapturedError(capturedError) { + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); +} +var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; +function logError(boundary, errorInfo) { + var source = errorInfo.source, + stack = errorInfo.stack; + null === stack && + null !== source && + (stack = getStackByFiberInDevAndProd(source)); + errorInfo = { + componentName: null !== source ? getComponentName(source.type) : null, + componentStack: null !== stack ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: !1, + willRetry: !1 + }; + null !== boundary && + 1 === boundary.tag && + ((errorInfo.errorBoundary = boundary.stateNode), + (errorInfo.errorBoundaryName = getComponentName(boundary.type)), + (errorInfo.errorBoundaryFound = !0), + (errorInfo.willRetry = !0)); + try { + logCapturedError(errorInfo); + } catch (e) { + setTimeout(function() { + throw e; + }); + } +} +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (null !== ref) + if ("function" === typeof ref) + try { + ref(null); + } catch (refError) { + captureCommitPhaseError(current$$1, refError); + } + else ref.current = null; +} +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + var destroy = effect.destroy; + effect.destroy = void 0; + void 0 !== destroy && destroy(); + } + (effect.tag & mountTag) !== NoEffect$1 && + ((destroy = effect.create), (effect.destroy = destroy())); + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} +function commitWork(current$$1, finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + case 12: + return; + case 13: + null !== finishedWork.memoizedState && + (globalMostRecentFallbackTime = now()); + attachSuspenseRetryListeners(finishedWork); + return; + case 19: + attachSuspenseRetryListeners(finishedWork); + return; + } + switch (finishedWork.tag) { + case 1: + case 5: + case 6: + case 20: + break; + case 3: + case 4: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } +} +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); + thenables.forEach(function(thenable) { + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + retryCache.has(thenable) || + (retryCache.add(thenable), thenable.then(retry, retry)); + }); + } +} +var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + expirationTime.payload = { element: null }; + var error = errorInfo.value; + expirationTime.callback = function() { + hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); + logError(fiber, errorInfo); + }; + return expirationTime; +} +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if ("function" === typeof getDerivedStateFromError) { + var error = errorInfo.value; + expirationTime.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + var inst = fiber.stateNode; + null !== inst && + "function" === typeof inst.componentDidCatch && + (expirationTime.callback = function() { + "function" !== typeof getDerivedStateFromError && + (null === legacyErrorBoundariesThatAlreadyFailed + ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { + componentStack: null !== stack ? stack : "" + }); + }); + return expirationTime; +} +var ceil = Math.ceil, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, + RootIncomplete = 0, + RootErrored = 1, + RootSuspended = 2, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, + workInProgressRoot = null, + workInProgress = null, + renderExpirationTime = 0, + workInProgressRootExitStatus = RootIncomplete, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, + nextEffect = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, + rootsWithPendingDiscreteUpdates = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null, + currentEventTime = 0; +function requestCurrentTime() { + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) + : 0 !== currentEventTime + ? currentEventTime + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } + null !== workInProgressRoot && + currentTime === renderExpirationTime && + --currentTime; + return currentTime; +} +function scheduleUpdateOnFiber(fiber, expirationTime) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + )); + fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) + for ( + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; + + ) + callback = callback(!0); + else + scheduleCallbackForRoot(fiber, 99, 1073741823), + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } +} +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + fiber.expirationTime < expirationTime && + (fiber.expirationTime = expirationTime); + var alternate = fiber.alternate; + null !== alternate && + alternate.expirationTime < expirationTime && + (alternate.expirationTime = expirationTime); + var node = fiber.return, + root = null; + if (null === node && 3 === fiber.tag) root = fiber.stateNode; + else + for (; null !== node; ) { + alternate = node.alternate; + node.childExpirationTime < expirationTime && + (node.childExpirationTime = expirationTime); + null !== alternate && + alternate.childExpirationTime < expirationTime && + (alternate.childExpirationTime = expirationTime); + if (null === node.return && 3 === node.tag) { + root = node.stateNode; + break; + } + node = node.return; + } + null !== root && + (expirationTime > root.firstPendingTime && + (root.firstPendingTime = expirationTime), + (fiber = root.lastPendingTime), + 0 === fiber || expirationTime < fiber) && + (root.lastPendingTime = expirationTime); + return root; +} +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + if (root.callbackExpirationTime < expirationTime) { + var existingCallbackNode = root.callbackNode; + null !== existingCallbackNode && + existingCallbackNode !== fakeCallbackNode && + Scheduler_cancelCallback(existingCallbackNode); + root.callbackExpirationTime = expirationTime; + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); + } +} +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode, + continuation = null; + try { + return ( + (continuation = callback(isSync)), + null !== continuation + ? runRootCallback.bind(null, root, continuation) + : null + ); + } finally { + null === continuation && + prevCallbackNode === root.callbackNode && + ((root.callbackNode = null), (root.callbackExpirationTime = 0)); + } +} +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + return null !== firstBatch && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ? (scheduleCallback(97, function() { + firstBatch._onComplete(); + return null; + }), + !0) + : !1; +} +function flushPendingDiscreteUpdates() { + if (null !== rootsWithPendingDiscreteUpdates) { + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + flushSyncCallbackQueue(); + } +} +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + if (null !== workInProgress) + for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { + var interruptedWork = timeoutHandle; + switch (interruptedWork.tag) { + case 1: + var childContextTypes = interruptedWork.type.childContextTypes; + null !== childContextTypes && + void 0 !== childContextTypes && + popContext(interruptedWork); + break; + case 3: + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(interruptedWork); + break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; + case 10: + popProvider(interruptedWork); + } + timeoutHandle = timeoutHandle.return; + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; +} +function renderRoot(root$jscomp$0, expirationTime, isSync) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + if (root$jscomp$0.firstPendingTime < expirationTime) return null; + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); + flushPassiveEffects(); + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) + prepareFreshStack(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } + if (null !== workInProgress) { + lastPendingTime = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + if (isSync) { + if (1073741823 !== expirationTime) { + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) + return ( + (executionContext = lastPendingTime), + resetContextDependencies(), + (ReactCurrentDispatcher.current = prevDispatcher), + renderRoot.bind(null, root$jscomp$0, currentTime) + ); + } + } else currentEventTime = 0; + do + try { + if (isSync) + for (; null !== workInProgress; ) + workInProgress = performUnitOfWork(workInProgress); + else + for (; null !== workInProgress && !Scheduler_shouldYield(); ) + workInProgress = performUnitOfWork(workInProgress); + break; + } catch (thrownValue) { + resetContextDependencies(); + resetHooks(); + currentTime = workInProgress; + if (null === currentTime || null === currentTime.return) + throw (prepareFreshStack(root$jscomp$0, expirationTime), + (executionContext = lastPendingTime), + thrownValue); + a: { + var root = root$jscomp$0, + returnFiber = currentTime.return, + sourceFiber = currentTime, + value = thrownValue, + renderExpirationTime$jscomp$0 = renderExpirationTime; + sourceFiber.effectTag |= 1024; + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + if ( + null !== value && + "object" === typeof value && + "function" === typeof value.then + ) { + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); + value = returnFiber; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { + returnFiber = value.updateQueue; + null === returnFiber + ? ((returnFiber = new Set()), + returnFiber.add(thenable), + (value.updateQueue = returnFiber)) + : returnFiber.add(thenable); + if (0 === (value.mode & 2)) { + value.effectTag |= 64; + sourceFiber.effectTag &= -1957; + 1 === sourceFiber.tag && + (null === sourceFiber.alternate + ? (sourceFiber.tag = 17) + : ((renderExpirationTime$jscomp$0 = createUpdate( + 1073741823, + null + )), + (renderExpirationTime$jscomp$0.tag = 2), + enqueueUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ))); + sourceFiber.expirationTime = 1073741823; + break a; + } + sourceFiber = root; + root = renderExpirationTime$jscomp$0; + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), + (returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), + void 0 === returnFiber && + ((returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber))); + returnFiber.has(root) || + (returnFiber.add(root), + (sourceFiber = pingSuspendedRoot.bind( + null, + sourceFiber, + thenable, + root + )), + thenable.then(sourceFiber, sourceFiber)); + value.effectTag |= 2048; + value.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + value = value.return; + } while (null !== value); + value = Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); + value = createCapturedValue(value, sourceFiber); + sourceFiber = returnFiber; + do { + switch (sourceFiber.tag) { + case 3: + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createRootErrorUpdate( + sourceFiber, + value, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + case 1: + if ( + ((thenable = value), + (root = sourceFiber.type), + (returnFiber = sourceFiber.stateNode), + 0 === (sourceFiber.effectTag & 64) && + ("function" === typeof root.getDerivedStateFromError || + (null !== returnFiber && + "function" === typeof returnFiber.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has( + returnFiber + ))))) + ) { + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createClassErrorUpdate( + sourceFiber, + thenable, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + } + } + sourceFiber = sourceFiber.return; + } while (null !== sourceFiber); + } + workInProgress = completeUnitOfWork(currentTime); + } + while (1); + executionContext = lastPendingTime; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (null !== workInProgress) + return renderRoot.bind(null, root$jscomp$0, expirationTime); + } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; + if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; + workInProgressRoot = null; + switch (workInProgressRootExitStatus) { + case RootIncomplete: + throw ReactError(Error("Should have a work-in-progress.")); + case RootErrored: + return ( + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) + : isSync + ? commitRoot.bind(null, root$jscomp$0) + : (prepareFreshStack(root$jscomp$0, expirationTime), + scheduleSyncCallback( + renderRoot.bind(null, root$jscomp$0, expirationTime) + ), + null) + ); + case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: + if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + isSync = root$jscomp$0.lastPendingTime; + if (isSync < expirationTime) + return renderRoot.bind(null, root$jscomp$0, isSync); + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) + return ( + (root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + )), + null + ); + } + return commitRoot.bind(null, root$jscomp$0); + case RootCompleted: + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); + default: + throw ReactError(Error("Unknown root exit status.")); + } +} +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} +function performUnitOfWork(unitOfWork) { + var next = beginWork$$1( + unitOfWork.alternate, + unitOfWork, + renderExpirationTime + ); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === next && (next = completeUnitOfWork(unitOfWork)); + ReactCurrentOwner$2.current = null; + return next; +} +function completeUnitOfWork(unitOfWork) { + workInProgress = unitOfWork; + do { + var current$$1 = workInProgress.alternate; + unitOfWork = workInProgress.return; + if (0 === (workInProgress.effectTag & 1024)) { + a: { + var current = current$$1; + current$$1 = workInProgress; + var renderExpirationTime$jscomp$0 = renderExpirationTime, + newProps = current$$1.pendingProps; + switch (current$$1.tag) { + case 2: + break; + case 16: + break; + case 15: + case 0: + break; + case 1: + isContextProvider(current$$1.type) && popContext(current$$1); + break; + case 3: + popHostContainer(current$$1); + popTopLevelContextObject(current$$1); + renderExpirationTime$jscomp$0 = current$$1.stateNode; + renderExpirationTime$jscomp$0.pendingContext && + ((renderExpirationTime$jscomp$0.context = + renderExpirationTime$jscomp$0.pendingContext), + (renderExpirationTime$jscomp$0.pendingContext = null)); + if (null === current || null === current.child) + current$$1.effectTag &= -3; + updateHostContainer(current$$1); + break; + case 5: + popHostContext(current$$1); + renderExpirationTime$jscomp$0 = requiredContext( + rootInstanceStackCursor.current + ); + var type = current$$1.type; + if (null !== current && null != current$$1.stateNode) + updateHostComponent$1( + current, + current$$1, + type, + newProps, + renderExpirationTime$jscomp$0 + ), + current.ref !== current$$1.ref && (current$$1.effectTag |= 128); + else if (newProps) { + requiredContext(contextStackCursor$1.current); + current = newProps; + var rootContainerInstance = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = current$$1; + newProps = nextReactTag; + nextReactTag += 2; + type = getViewConfigForType(type); + var updatePayload = diffProperties( + null, + emptyObject, + current, + type.validAttributes + ); + rootContainerInstance = createNode( + newProps, + type.uiViewClassName, + rootContainerInstance, + updatePayload, + renderExpirationTime$jscomp$0 + ); + current = new ReactFabricHostComponent( + newProps, + type, + current, + renderExpirationTime$jscomp$0 + ); + current = { node: rootContainerInstance, canonical: current }; + appendAllChildren(current, current$$1, !1, !1); + current$$1.stateNode = current; + null !== current$$1.ref && (current$$1.effectTag |= 128); + } else if (null === current$$1.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + if (current && null != current$$1.stateNode) + updateHostText$1( + current, + current$$1, + current.memoizedProps, + newProps + ); + else { + if ("string" !== typeof newProps && null === current$$1.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + current = requiredContext(rootInstanceStackCursor.current); + renderExpirationTime$jscomp$0 = requiredContext( + contextStackCursor$1.current + ); + current$$1.stateNode = createTextInstance( + newProps, + current, + renderExpirationTime$jscomp$0, + current$$1 + ); + } + break; + case 11: + break; + case 13: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (0 !== (current$$1.effectTag & 64)) { + current$$1.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + renderExpirationTime$jscomp$0 = null !== newProps; + newProps = !1; + null !== current && + ((type = current.memoizedState), + (newProps = null !== type), + renderExpirationTime$jscomp$0 || + null === type || + ((type = current.child.sibling), + null !== type && + ((rootContainerInstance = current$$1.firstEffect), + null !== rootContainerInstance + ? ((current$$1.firstEffect = type), + (type.nextEffect = rootContainerInstance)) + : ((current$$1.firstEffect = current$$1.lastEffect = type), + (type.nextEffect = null)), + (type.effectTag = 8)))); + if ( + renderExpirationTime$jscomp$0 && + !newProps && + 0 !== (current$$1.mode & 2) + ) + if ( + (null === current && + !0 !== current$$1.memoizedProps.unstable_avoidThisFallback) || + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + renderExpirationTime$jscomp$0 && (current$$1.effectTag |= 4); + break; + case 7: + break; + case 8: + break; + case 12: + break; + case 4: + popHostContainer(current$$1); + updateHostContainer(current$$1); + break; + case 10: + popProvider(current$$1); + break; + case 9: + break; + case 14: + break; + case 17: + isContextProvider(current$$1.type) && popContext(current$$1); + break; + case 18: + break; + case 19: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (null === newProps) break; + type = 0 !== (current$$1.effectTag & 64); + rootContainerInstance = newProps.rendering; + if (null === rootContainerInstance) + if (type) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = current$$1.child; null !== current; ) { + rootContainerInstance = findFirstSuspended(current); + if (null !== rootContainerInstance) { + current$$1.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = rootContainerInstance.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1.firstEffect = current$$1.lastEffect = null; + current = renderExpirationTime$jscomp$0; + for ( + renderExpirationTime$jscomp$0 = current$$1.child; + null !== renderExpirationTime$jscomp$0; + + ) + (newProps = renderExpirationTime$jscomp$0), + (type = current), + (newProps.effectTag &= 2), + (newProps.nextEffect = null), + (newProps.firstEffect = null), + (newProps.lastEffect = null), + (rootContainerInstance = newProps.alternate), + null === rootContainerInstance + ? ((newProps.childExpirationTime = 0), + (newProps.expirationTime = type), + (newProps.child = null), + (newProps.memoizedProps = null), + (newProps.memoizedState = null), + (newProps.updateQueue = null), + (newProps.dependencies = null)) + : ((newProps.childExpirationTime = + rootContainerInstance.childExpirationTime), + (newProps.expirationTime = + rootContainerInstance.expirationTime), + (newProps.child = rootContainerInstance.child), + (newProps.memoizedProps = + rootContainerInstance.memoizedProps), + (newProps.memoizedState = + rootContainerInstance.memoizedState), + (newProps.updateQueue = + rootContainerInstance.updateQueue), + (type = rootContainerInstance.dependencies), + (newProps.dependencies = + null === type + ? null + : { + expirationTime: type.expirationTime, + firstContext: type.firstContext, + responders: type.responders + })), + (renderExpirationTime$jscomp$0 = + renderExpirationTime$jscomp$0.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & + SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + current$$1 + ); + current$$1 = current$$1.child; + break a; + } + current = current.sibling; + } + } + else { + if (!type) + if ( + ((current = findFirstSuspended(rootContainerInstance)), + null !== current) + ) { + if ( + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1 = current$$1.lastEffect = newProps.lastEffect; + null !== current$$1 && (current$$1.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime$jscomp$0 && + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !1), + (current$$1.expirationTime = current$$1.childExpirationTime = + renderExpirationTime$jscomp$0 - 1)); + newProps.isBackwards + ? ((rootContainerInstance.sibling = current$$1.child), + (current$$1.child = rootContainerInstance)) + : ((current = newProps.last), + null !== current + ? (current.sibling = rootContainerInstance) + : (current$$1.child = rootContainerInstance), + (newProps.last = rootContainerInstance)); + } + if (null !== newProps.tail) { + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500); + current = newProps.tail; + newProps.rendering = current; + newProps.tail = current.sibling; + newProps.lastEffect = current$$1.lastEffect; + current.sibling = null; + renderExpirationTime$jscomp$0 = suspenseStackCursor.current; + renderExpirationTime$jscomp$0 = type + ? (renderExpirationTime$jscomp$0 & SubtreeSuspenseContextMask) | + ForceSuspenseFallback + : renderExpirationTime$jscomp$0 & SubtreeSuspenseContextMask; + push( + suspenseStackCursor, + renderExpirationTime$jscomp$0, + current$$1 + ); + current$$1 = current; + break a; + } + break; + case 20: + break; + default: + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + current$$1 = null; + } + current = workInProgress; + if (1 === renderExpirationTime || 1 !== current.childExpirationTime) { + renderExpirationTime$jscomp$0 = 0; + for (newProps = current.child; null !== newProps; ) + (type = newProps.expirationTime), + (rootContainerInstance = newProps.childExpirationTime), + type > renderExpirationTime$jscomp$0 && + (renderExpirationTime$jscomp$0 = type), + rootContainerInstance > renderExpirationTime$jscomp$0 && + (renderExpirationTime$jscomp$0 = rootContainerInstance), + (newProps = newProps.sibling); + current.childExpirationTime = renderExpirationTime$jscomp$0; + } + if (null !== current$$1) return current$$1; + null !== unitOfWork && + 0 === (unitOfWork.effectTag & 1024) && + (null === unitOfWork.firstEffect && + (unitOfWork.firstEffect = workInProgress.firstEffect), + null !== workInProgress.lastEffect && + (null !== unitOfWork.lastEffect && + (unitOfWork.lastEffect.nextEffect = workInProgress.firstEffect), + (unitOfWork.lastEffect = workInProgress.lastEffect)), + 1 < workInProgress.effectTag && + (null !== unitOfWork.lastEffect + ? (unitOfWork.lastEffect.nextEffect = workInProgress) + : (unitOfWork.firstEffect = workInProgress), + (unitOfWork.lastEffect = workInProgress))); + } else { + current$$1 = unwindWork(workInProgress, renderExpirationTime); + if (null !== current$$1) + return (current$$1.effectTag &= 1023), current$$1; + null !== unitOfWork && + ((unitOfWork.firstEffect = unitOfWork.lastEffect = null), + (unitOfWork.effectTag |= 1024)); + } + current$$1 = workInProgress.sibling; + if (null !== current$$1) return current$$1; + workInProgress = unitOfWork; + } while (null !== workInProgress); + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootCompleted); + return null; +} +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(99, commitRootImpl.bind(null, root, renderPriorityLevel)); + null !== rootWithPendingPassiveEffects && + scheduleCallback(97, function() { + flushPassiveEffects(); + return null; + }); + return null; +} +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + root.callbackNode = null; + root.callbackExpirationTime = 0; + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, + childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + updateExpirationTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = updateExpirationTimeBeforeCommit; + updateExpirationTimeBeforeCommit < root.lastPendingTime && + (root.lastPendingTime = updateExpirationTimeBeforeCommit); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + ReactCurrentOwner$2.current = null; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (; null !== nextEffect; ) { + if (0 !== (nextEffect.effectTag & 256)) { + var current$$1 = nextEffect.alternate, + finishedWork$jscomp$0 = nextEffect; + switch (finishedWork$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountSnapshot, + NoEffect$1, + finishedWork$jscomp$0 + ); + break; + case 1: + if ( + finishedWork$jscomp$0.effectTag & 256 && + null !== current$$1 + ) { + var prevProps = current$$1.memoizedProps, + prevState = current$$1.memoizedState, + instance = finishedWork$jscomp$0.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + finishedWork$jscomp$0.elementType === + finishedWork$jscomp$0.type + ? prevProps + : resolveDefaultProps( + finishedWork$jscomp$0.type, + prevProps + ), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + case 5: + case 6: + case 4: + case 17: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { + var effectTag = nextEffect.effectTag; + if (effectTag & 128) { + var current$$1$jscomp$0 = nextEffect.alternate; + if (null !== current$$1$jscomp$0) { + var currentRef = current$$1$jscomp$0.ref; + null !== currentRef && + ("function" === typeof currentRef + ? currentRef(null) + : (currentRef.current = null)); + } + } + switch (effectTag & 14) { + case 2: + nextEffect.effectTag &= -3; + break; + case 6: + nextEffect.effectTag &= -3; + commitWork(nextEffect.alternate, nextEffect); + break; + case 4: + commitWork(nextEffect.alternate, nextEffect); + break; + case 8: + prevProps = nextEffect; + a: for ( + prevState = prevProps, + instance = current$$1, + snapshot = prevState; + ; + + ) + if ( + (commitUnmount(snapshot, instance), null !== snapshot.child) + ) + (snapshot.child.return = snapshot), + (snapshot = snapshot.child); + else { + if (snapshot === prevState) break; + for (; null === snapshot.sibling; ) { + if ( + null === snapshot.return || + snapshot.return === prevState + ) + break a; + snapshot = snapshot.return; + } + snapshot.sibling.return = snapshot.return; + snapshot = snapshot.sibling; + } + detachFiber(prevProps); + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + root.current = finishedWork; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (effectTag = expirationTime; null !== nextEffect; ) { + var effectTag$jscomp$0 = nextEffect.effectTag; + if (effectTag$jscomp$0 & 36) { + var current$$1$jscomp$1 = nextEffect.alternate; + current$$1$jscomp$0 = nextEffect; + currentRef = effectTag; + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountLayout, + MountLayout, + current$$1$jscomp$0 + ); + break; + case 1: + var instance$jscomp$0 = current$$1$jscomp$0.stateNode; + if (current$$1$jscomp$0.effectTag & 4) + if (null === current$$1$jscomp$1) + instance$jscomp$0.componentDidMount(); + else { + var prevProps$jscomp$0 = + current$$1$jscomp$0.elementType === + current$$1$jscomp$0.type + ? current$$1$jscomp$1.memoizedProps + : resolveDefaultProps( + current$$1$jscomp$0.type, + current$$1$jscomp$1.memoizedProps + ); + instance$jscomp$0.componentDidUpdate( + prevProps$jscomp$0, + current$$1$jscomp$1.memoizedState, + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate + ); + } + var updateQueue = current$$1$jscomp$0.updateQueue; + null !== updateQueue && + commitUpdateQueue( + current$$1$jscomp$0, + updateQueue, + instance$jscomp$0, + currentRef + ); + break; + case 3: + var _updateQueue = current$$1$jscomp$0.updateQueue; + if (null !== _updateQueue) { + current$$1 = null; + if (null !== current$$1$jscomp$0.child) + switch (current$$1$jscomp$0.child.tag) { + case 5: + current$$1 = + current$$1$jscomp$0.child.stateNode.canonical; + break; + case 1: + current$$1 = current$$1$jscomp$0.child.stateNode; + } + commitUpdateQueue( + current$$1$jscomp$0, + _updateQueue, + current$$1, + currentRef + ); + } + break; + case 5: + if ( + null === current$$1$jscomp$1 && + current$$1$jscomp$0.effectTag & 4 + ) + throw ReactError( + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + break; + case 4: + break; + case 12: + break; + case 13: + case 19: + case 17: + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + if (effectTag$jscomp$0 & 128) { + var ref = nextEffect.ref; + if (null !== ref) { + var instance$jscomp$1 = nextEffect.stateNode; + switch (nextEffect.tag) { + case 5: + var instanceToUse = instance$jscomp$1.canonical; + break; + default: + instanceToUse = instance$jscomp$1; + } + "function" === typeof ref + ? ref(instanceToUse) + : (ref.current = instanceToUse); + } + } + effectTag$jscomp$0 & 512 && (rootDoesHavePassiveEffects = !0); + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = null; + requestPaint(); + executionContext = childExpirationTimeBeforeCommit; + } else root.current = finishedWork; + if (rootDoesHavePassiveEffects) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + 0 !== renderPriorityLevel + ? ((effectTag$jscomp$0 = requestCurrentTime()), + (effectTag$jscomp$0 = inferPriorityFromExpirationTime( + effectTag$jscomp$0, + renderPriorityLevel + )), + scheduleCallbackForRoot(root, effectTag$jscomp$0, renderPriorityLevel)) + : (legacyErrorBoundariesThatAlreadyFailed = null); + "function" === typeof onCommitFiberRoot && + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + if (hasUncaughtError) + throw ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); + return null; +} +function flushPassiveEffects() { + if (null === rootWithPendingPassiveEffects) return !1; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + for (root = root.current.firstEffect; null !== root; ) { + try { + var finishedWork = root; + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } + } catch (error) { + if (null === root) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(root, error); + } + finishedWork = root.nextEffect; + root.nextEffect = null; + root = finishedWork; + } + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + return !0; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1073741823); + enqueueUpdate(rootFiber, sourceFiber); + rootFiber = markUpdateTimeFromFiberToRoot(rootFiber, 1073741823); + null !== rootFiber && scheduleCallbackForRoot(rootFiber, 99, 1073741823); +} +function captureCommitPhaseError(sourceFiber, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (var fiber = sourceFiber.return; null !== fiber; ) { + if (3 === fiber.tag) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + break; + } else if (1 === fiber.tag) { + var instance = fiber.stateNode; + if ( + "function" === typeof fiber.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createClassErrorUpdate(fiber, sourceFiber, 1073741823); + enqueueUpdate(fiber, sourceFiber); + fiber = markUpdateTimeFromFiberToRoot(fiber, 1073741823); + null !== fiber && scheduleCallbackForRoot(fiber, 99, 1073741823); + break; + } + } + fiber = fiber.return; + } +} +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(thenable); + workInProgressRoot === root && renderExpirationTime === suspendedTime + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) + : root.lastPendingTime < suspendedTime || + ((thenable = root.pingTime), + (0 !== thenable && thenable < suspendedTime) || + ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), + (thenable = requestCurrentTime()), + (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), + scheduleCallbackForRoot(root, thenable, suspendedTime))); +} +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = boundaryFiber.stateNode; + null !== retryCache && retryCache.delete(thenable); + retryCache = requestCurrentTime(); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); + retryCache = inferPriorityFromExpirationTime(retryCache, thenable); + boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); + null !== boundaryFiber && + scheduleCallbackForRoot(boundaryFiber, retryCache, thenable); +} +var beginWork$$1 = void 0; +beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + if (null !== current$$1) + if ( + current$$1.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = !1; + switch (workInProgress.tag) { + case 3: + pushHostRootContext(workInProgress); + break; + case 5: + pushHostContext(workInProgress); + break; + case 1: + isContextProvider(workInProgress.type) && + pushContextProvider(workInProgress); + break; + case 4: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case 10: + pushProvider(workInProgress, workInProgress.memoizedProps.value); + break; + case 13: + if (null !== workInProgress.memoizedState) { + updateExpirationTime = workInProgress.child.childExpirationTime; + if ( + 0 !== updateExpirationTime && + updateExpirationTime >= renderExpirationTime + ) + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + return null !== workInProgress ? workInProgress.sibling : null; + } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + else didReceiveUpdate = !1; + workInProgress.expirationTime = 0; + switch (workInProgress.tag) { + case 2: + updateExpirationTime = workInProgress.type; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderExpirationTime); + renderState = renderWithHooks( + null, + workInProgress, + updateExpirationTime, + current$$1, + renderState, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + if ( + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof + ) { + workInProgress.tag = 1; + resetHooks(); + if (isContextProvider(updateExpirationTime)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + workInProgress.memoizedState = + null !== renderState.state && void 0 !== renderState.state + ? renderState.state + : null; + var getDerivedStateFromProps = + updateExpirationTime.getDerivedStateFromProps; + "function" === typeof getDerivedStateFromProps && + applyDerivedStateFromProps( + workInProgress, + updateExpirationTime, + getDerivedStateFromProps, + current$$1 + ); + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; + mountClassInstance( + workInProgress, + updateExpirationTime, + current$$1, + renderExpirationTime + ); + workInProgress = finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + hasContext, + renderExpirationTime + ); + } else + (workInProgress.tag = 0), + reconcileChildren( + null, + workInProgress, + renderState, + renderExpirationTime + ), + (workInProgress = workInProgress.child); + return workInProgress; + case 16: + renderState = workInProgress.elementType; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); + switch (hasContext) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + renderState, + resolveDefaultProps(renderState.type, current$$1), + updateExpirationTime, + renderExpirationTime + ); + break; + default: + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) + ); + } + return workInProgress; + case 0: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateFunctionComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 1: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateClassComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 3: + pushHostRootContext(workInProgress); + updateExpirationTime = workInProgress.updateQueue; + if (null === updateExpirationTime) + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; + processUpdateQueue( + workInProgress, + updateExpirationTime, + workInProgress.pendingProps, + null, + renderExpirationTime + ); + updateExpirationTime = workInProgress.memoizedState.element; + updateExpirationTime === renderState + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + )) + : (reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + (workInProgress = workInProgress.child)); + return workInProgress; + case 5: + return ( + pushHostContext(workInProgress), + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + (updateExpirationTime = workInProgress.pendingProps.children), + markRef(current$$1, workInProgress), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 6: + return ( + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + null + ); + case 13: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case 4: + return ( + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (updateExpirationTime = workInProgress.pendingProps), + null === current$$1 + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + updateExpirationTime, + renderExpirationTime + )) + : reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 11: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateForwardRef( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 7: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps, + renderExpirationTime + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 12: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 10: + a: { + updateExpirationTime = workInProgress.type._context; + renderState = workInProgress.pendingProps; + getDerivedStateFromProps = workInProgress.memoizedProps; + hasContext = renderState.value; + pushProvider(workInProgress, hasContext); + if (null !== getDerivedStateFromProps) { + var oldValue = getDerivedStateFromProps.value; + hasContext = is(oldValue, hasContext) + ? 0 + : ("function" === typeof updateExpirationTime._calculateChangedBits + ? updateExpirationTime._calculateChangedBits( + oldValue, + hasContext + ) + : 1073741823) | 0; + if (0 === hasContext) { + if ( + getDerivedStateFromProps.children === renderState.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + break a; + } + } else + for ( + oldValue = workInProgress.child, + null !== oldValue && (oldValue.return = workInProgress); + null !== oldValue; + + ) { + var list = oldValue.dependencies; + if (null !== list) { + getDerivedStateFromProps = oldValue.child; + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { + if ( + dependency.context === updateExpirationTime && + 0 !== (dependency.observedBits & hasContext) + ) { + 1 === oldValue.tag && + ((dependency = createUpdate(renderExpirationTime, null)), + (dependency.tag = 2), + enqueueUpdate(oldValue, dependency)); + oldValue.expirationTime < renderExpirationTime && + (oldValue.expirationTime = renderExpirationTime); + dependency = oldValue.alternate; + null !== dependency && + dependency.expirationTime < renderExpirationTime && + (dependency.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); + list.expirationTime < renderExpirationTime && + (list.expirationTime = renderExpirationTime); + break; + } + dependency = dependency.next; + } + } else + getDerivedStateFromProps = + 10 === oldValue.tag + ? oldValue.type === workInProgress.type + ? null + : oldValue.child + : oldValue.child; + if (null !== getDerivedStateFromProps) + getDerivedStateFromProps.return = oldValue; + else + for ( + getDerivedStateFromProps = oldValue; + null !== getDerivedStateFromProps; + + ) { + if (getDerivedStateFromProps === workInProgress) { + getDerivedStateFromProps = null; + break; + } + oldValue = getDerivedStateFromProps.sibling; + if (null !== oldValue) { + oldValue.return = getDerivedStateFromProps.return; + getDerivedStateFromProps = oldValue; + break; + } + getDerivedStateFromProps = getDerivedStateFromProps.return; + } + oldValue = getDerivedStateFromProps; + } + } + reconcileChildren( + current$$1, + workInProgress, + renderState.children, + renderExpirationTime + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: + return ( + (renderState = workInProgress.type), + (hasContext = workInProgress.pendingProps), + (updateExpirationTime = hasContext.children), + prepareToReadContext(workInProgress, renderExpirationTime), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), + (workInProgress.effectTag |= 1), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 14: + return ( + (renderState = workInProgress.type), + (hasContext = resolveDefaultProps( + renderState, + workInProgress.pendingProps + )), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), + updateMemoComponent( + current$$1, + workInProgress, + renderState, + hasContext, + updateExpirationTime, + renderExpirationTime + ) + ); + case 15: + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + case 17: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + (workInProgress.tag = 1), + isContextProvider(updateExpirationTime) + ? ((current$$1 = !0), pushContextProvider(workInProgress)) + : (current$$1 = !1), + prepareToReadContext(workInProgress, renderExpirationTime), + constructClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + current$$1, + renderExpirationTime + ) + ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); +}; +var onCommitFiberRoot = null, + onCommitFiberUnmount = null; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root) { + try { + hook.onCommitFiberRoot( + rendererID, + root, + void 0, + 64 === (root.current.effectTag & 64) + ); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; +} +function findHostInstance(component) { + var fiber = component._reactInternalFiber; + if (void 0 === fiber) { + if ("function" === typeof component.render) + throw ReactError(Error("Unable to find node on an unmounted component.")); + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + component = findCurrentHostFiber(fiber); + return null === component ? null : component.stateNode; +} +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current, + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + currentTime = container.current; + a: if (parentComponent) { + parentComponent = parentComponent._reactInternalFiber; + b: { + if ( + 2 !== isFiberMountedImpl(parentComponent) || + 1 !== parentComponent.tag + ) + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + var parentContext = parentComponent; + do { + switch (parentContext.tag) { + case 3: + parentContext = parentContext.stateNode.context; + break b; + case 1: + if (isContextProvider(parentContext.type)) { + parentContext = + parentContext.stateNode + .__reactInternalMemoizedMergedChildContext; + break b; + } + } + parentContext = parentContext.return; + } while (null !== parentContext); + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (1 === parentComponent.tag) { + var Component = parentComponent.type; + if (isContextProvider(Component)) { + parentComponent = processChildContext( + parentComponent, + Component, + parentContext + ); + break a; + } + } + parentComponent = parentContext; + } else parentComponent = emptyContextObject; + null === container.context + ? (container.context = parentComponent) + : (container.pendingContext = parentComponent); + container = callback; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; + container = void 0 === container ? null : container; + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); + scheduleUpdateOnFiber(currentTime, current$$1); + return current$$1; +} +function createPortal(children, containerInfo, implementation) { + var key = + 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: REACT_PORTAL_TYPE, + key: null == key ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} +function _inherits$1(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +var getInspectorDataForViewTag = void 0; +getInspectorDataForViewTag = function() { + throw ReactError( + Error("getInspectorDataForViewTag() is not available in production") + ); +}; +var fabricDispatchCommand = nativeFabricUIManager.dispatchCommand; +function findNodeHandle(componentOrHandle) { + if (null == componentOrHandle) return null; + if ("number" === typeof componentOrHandle) return componentOrHandle; + if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag; + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) + return componentOrHandle.canonical._nativeTag; + componentOrHandle = findHostInstance(componentOrHandle); + return null == componentOrHandle + ? componentOrHandle + : componentOrHandle.canonical + ? componentOrHandle.canonical._nativeTag + : componentOrHandle._nativeTag; +} +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; + try { + return fn(a); + } finally { + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); + } +}; +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); +}; +var roots = new Map(), + ReactFabric = { + NativeComponent: (function(findNodeHandle, findHostInstance) { + return (function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || + ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits$1(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.measure = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureInWindow = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }; + ReactNativeComponent.prototype.setNativeProps = function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }; + return ReactNativeComponent; + })(React.Component); + })(findNodeHandle, findHostInstance), + findNodeHandle: findNodeHandle, + setNativeProps: function() {}, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + null != handle._internalInstanceHandle && + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + if (!root) { + root = new FiberRootNode(containerTag, 0, !1); + var uninitializedFiber = createFiber(3, null, null, 0); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + a: if (((element = root.current), element.child)) + switch (element.child.tag) { + case 5: + element = element.child.stateNode.canonical; + break a; + default: + element = element.child.stateNode; + } + else element = null; + return element; + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + root && + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + }, + createPortal: function(children, containerTag) { + return createPortal( + children, + containerTag, + null, + 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null + ); + }, + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + NativeMethodsMixin: (function(findNodeHandle, findHostInstance) { + return { + measure: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureInWindow: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureLayout: function(relativeToNativeNode, onSuccess, onFail) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }, + setNativeProps: function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }, + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + })(findNodeHandle, findHostInstance) + } + }; +(function(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: null, + overrideProps: null, + setSuspenseHandler: null, + scheduleUpdate: null, + currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + fiber = findCurrentHostFiber(fiber); + return null === fiber ? null : fiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + return findFiberByHostInstance + ? findFiberByHostInstance(instance) + : null; + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null + }) + ); +})({ + findFiberByHostInstance: getInstanceFromInstance, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 0, + version: "16.8.6", + rendererPackageName: "react-native-renderer" +}); +var ReactFabric$2 = { default: ReactFabric }, + ReactFabric$3 = (ReactFabric$2 && ReactFabric) || ReactFabric$2; +module.exports = ReactFabric$3.default || ReactFabric$3; diff --git a/Libraries/Renderer/oss/ReactFabric-prod.js b/Libraries/Renderer/implementations/ReactFabric-prod.js similarity index 74% rename from Libraries/Renderer/oss/ReactFabric-prod.js rename to Libraries/Renderer/implementations/ReactFabric-prod.js index afbbd4ce6b1b9f..cb27940208bf4b 100644 --- a/Libraries/Renderer/oss/ReactFabric-prod.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.js @@ -11,20 +11,13 @@ */ "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), - UIManager = require("UIManager"), +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), - deepDiffer = require("deepDiffer"), - flattenStyle = require("flattenStyle"), - TextInputState = require("TextInputState"), - FabricUIManager = require("FabricUIManager"), Scheduler = require("scheduler"); -var ExceptionsManager = require("ExceptionsManager"); -function ReactError(message) { - message = Error(message); - message.name = "Invariant Violation"; - return message; +function ReactError(error) { + error.name = "Invariant Violation"; + return error; } var eventPluginOrder = null, namesToPlugins = {}; @@ -35,16 +28,20 @@ function recomputePluginOrdering() { pluginIndex = eventPluginOrder.indexOf(pluginName); if (!(-1 < pluginIndex)) throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -55,9 +52,11 @@ function recomputePluginOrdering() { eventName$jscomp$0 = eventName; if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -83,11 +82,13 @@ function recomputePluginOrdering() { : (JSCompiler_inline_result = !1); if (!JSCompiler_inline_result) throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } } @@ -96,9 +97,11 @@ function recomputePluginOrdering() { function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); registrationNameModules[registrationName] = pluginModule; } @@ -147,7 +150,9 @@ function invokeGuardedCallbackAndCatchFirstError( caughtError = null; } else throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); } @@ -165,7 +170,7 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; if (Array.isArray(dispatchListener)) - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null; @@ -178,7 +183,9 @@ function executeDirectDispatch(event) { function accumulateInto(current, next) { if (null == next) throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); if (null == current) return next; if (Array.isArray(current)) { @@ -215,7 +222,9 @@ var injection = { injectEventPluginOrder: function(injectedEventPluginOrder) { if (eventPluginOrder) throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); recomputePluginOrdering(); @@ -232,9 +241,11 @@ var injection = { ) { if (namesToPlugins[pluginName]) throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); namesToPlugins[pluginName] = pluginModule; isOrderingDirty = !0; @@ -276,11 +287,13 @@ function getListener(inst, registrationName) { if (inst) return null; if (listener && "function" !== typeof listener) throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); return listener; } @@ -444,7 +457,9 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { function releasePooledEvent(event) { if (!(event instanceof this)) throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); event.destructor(); 10 > this.eventPool.length && this.eventPool.push(event); @@ -480,7 +495,8 @@ function timestampForTouch(touch) { } function getTouchIdentifier(_ref) { _ref = _ref.identifier; - if (null == _ref) throw ReactError("Touch object is missing identifier."); + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); return _ref; } function recordTouchStart(touch) { @@ -523,7 +539,7 @@ function recordTouchMove(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch move without a touch start.\nTouch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -541,7 +557,7 @@ function recordTouchEnd(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch end without a touch start.\nTouch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -595,7 +611,7 @@ var ResponderTouchHistoryStore = { function accumulate(current, next) { if (null == next) throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error("accumulate(...): Accumulated items must not be null or undefined.") ); return null == current ? next @@ -617,7 +633,7 @@ function changeResponder(nextResponderInst, blockHostResponder) { blockHostResponder ); } -var eventTypes$1 = { +var eventTypes = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", @@ -680,7 +696,7 @@ var eventTypes$1 = { _getResponder: function() { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, extractEvents: function( topLevelType, targetInst, @@ -709,12 +725,12 @@ var eventTypes$1 = { isMoveish(topLevelType)) ) { var JSCompiler_temp = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : "topSelectionChange" === topLevelType - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; if (responderInst) b: { var JSCompiler_temp$jscomp$0 = responderInst; @@ -800,7 +816,7 @@ var eventTypes$1 = { JSCompiler_temp && JSCompiler_temp !== responderInst ? ((JSCompiler_temp$jscomp$0 = void 0), (targetInst = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -810,7 +826,7 @@ var eventTypes$1 = { (depthA = !0 === executeDirectDispatch(targetInst)), responderInst ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -822,7 +838,7 @@ var eventTypes$1 = { tempA.isPersistent() || tempA.constructor.release(tempA), tempB ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -836,7 +852,7 @@ var eventTypes$1 = { )), changeResponder(JSCompiler_temp, depthA)) : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -866,11 +882,11 @@ var eventTypes$1 = { ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); if ( (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderStart + ? eventTypes.responderStart : targetInst - ? eventTypes$1.responderMove + ? eventTypes.responderMove : depthA - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null) ) (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( @@ -924,9 +940,9 @@ var eventTypes$1 = { } if ( (topLevelType = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : topLevelType - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null) ) (nativeEvent = ResponderSyntheticEvent.getPooled( @@ -948,8 +964,20 @@ var eventTypes$1 = { } } }, - ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, extractEvents: function( topLevelType, targetInst, @@ -957,13 +985,13 @@ var eventTypes$1 = { nativeEventTarget ) { if (null == targetInst) return null; - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType], - directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; if (!bubbleDispatchConfig && !directDispatchConfig) throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); topLevelType = SyntheticEvent.getPooled( bubbleDispatchConfig || directDispatchConfig, @@ -978,14 +1006,7 @@ var eventTypes$1 = { else return null; return topLevelType; } - }; -injection.injectEventPluginOrder([ - "ResponderEventPlugin", - "ReactNativeBridgeEventPlugin" -]); -injection.injectEventPluginsByName({ - ResponderEventPlugin: ResponderEventPlugin, - ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin + } }); function getInstanceFromInstance(instanceHandle) { return instanceHandle; @@ -996,23 +1017,25 @@ getFiberCurrentPropsFromNode = function(inst) { getInstanceFromNode = getInstanceFromInstance; getNodeFromInstance = function(inst) { inst = inst.stateNode.canonical._nativeTag; - if (!inst) throw ReactError("All native instances should have a tag."); + if (!inst) throw ReactError(Error("All native instances should have a tag.")); return inst; }; ResponderEventPlugin.injection.injectGlobalResponderHandler({ onChange: function(from, to, blockNativeResponder) { null !== to - ? UIManager.setJSResponder( + ? ReactNativePrivateInterface.UIManager.setJSResponder( to.stateNode.canonical._nativeTag, blockNativeResponder ) - : UIManager.clearJSResponder(); + : ReactNativePrivateInterface.UIManager.clearJSResponder(); } }); var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); var hasSymbol = "function" === typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, @@ -1026,11 +1049,13 @@ var hasSymbol = "function" === typeof Symbol && Symbol.for, : 60111, REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; -hasSymbol && Symbol.for("react.event_component"); -hasSymbol && Symbol.for("react.event_target"); -hasSymbol && Symbol.for("react.event_target.touch_hit"); +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; @@ -1044,8 +1069,6 @@ function getComponentName(type) { if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -1056,6 +1079,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { @@ -1090,14 +1115,14 @@ function isFiberMountedImpl(fiber) { } function assertIsMounted(fiber) { if (2 !== isFiberMountedImpl(fiber)) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = isFiberMountedImpl(fiber); if (3 === alternate) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return 1 === alternate ? null : fiber; } for (var a = fiber, b = alternate; ; ) { @@ -1118,7 +1143,7 @@ function findCurrentFiberUsingSlowPath(fiber) { if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } if (a.return !== b.return) (a = parentA), (b = parentB); else { @@ -1155,17 +1180,21 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (!didFindChild) throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } } if (a.alternate !== b) throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (3 !== a.tag) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiber(parent) { @@ -1279,14 +1308,14 @@ function diffNestedProperty( return Array.isArray(prevProp) ? diffProperties( updatePayload, - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), nextProp, validAttributes ) : diffProperties( updatePayload, prevProp, - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -1354,7 +1383,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { if ("object" !== typeof attributeConfig) ("object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) && + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && ((updatePayload || (updatePayload = {}))[propKey] = nextProp); else if ( "function" === typeof attributeConfig.diff || @@ -1366,7 +1395,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { ? attributeConfig.diff(prevProp, nextProp) : "object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) ) (attributeConfig = "function" === typeof attributeConfig.process @@ -1418,23 +1447,28 @@ var restoreTarget = null, function restoreStateOfTarget(target) { if (getInstanceFromNode(target)) throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } -function _batchedUpdatesImpl(fn, bookkeeping) { +function batchedUpdatesImpl(fn, bookkeeping) { return fn(bookkeeping); } -function _flushInteractiveUpdatesImpl() {} -var isBatching = !1; +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; function batchedUpdates(fn, bookkeeping) { - if (isBatching) return fn(bookkeeping); - isBatching = !0; + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue)) + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) if ( - (_flushInteractiveUpdatesImpl(), + (flushDiscreteUpdatesImpl(), restoreTarget && ((bookkeeping = restoreTarget), (fn = restoreQueue), @@ -1446,6 +1480,51 @@ function batchedUpdates(fn, bookkeeping) { restoreStateOfTarget(fn[bookkeeping]); } } +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +(function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() {}; + ReactNativeComponent.prototype.focus = function() {}; + ReactNativeComponent.prototype.measure = function() {}; + ReactNativeComponent.prototype.measureInWindow = function() {}; + ReactNativeComponent.prototype.measureLayout = function() {}; + ReactNativeComponent.prototype.setNativeProps = function() {}; + return ReactNativeComponent; +})(React.Component); +new Map(); +new Map(); +new Set(); +new Map(); function dispatchEvent(target, topLevelType, nativeEvent) { batchedUpdates(function() { var events = nativeEvent.target; @@ -1468,7 +1547,9 @@ function dispatchEvent(target, topLevelType, nativeEvent) { forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); if (hasRethrowError) throw ((events = rethrowError), @@ -1480,12 +1561,30 @@ function dispatchEvent(target, topLevelType, nativeEvent) { } function shim$1() { throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) ); } -var nextReactTag = 2; -FabricUIManager.registerEventHandler && - FabricUIManager.registerEventHandler(dispatchEvent); +var _nativeFabricUIManage$1 = nativeFabricUIManager, + createNode = _nativeFabricUIManage$1.createNode, + cloneNode = _nativeFabricUIManage$1.cloneNode, + cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren, + cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps, + cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps, + createChildNodeSet = _nativeFabricUIManage$1.createChildSet, + appendChildNode = _nativeFabricUIManage$1.appendChild, + appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet, + completeRoot = _nativeFabricUIManage$1.completeRoot, + registerEventHandler = _nativeFabricUIManage$1.registerEventHandler, + fabricMeasure = _nativeFabricUIManage$1.measure, + fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow, + fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout, + getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + nextReactTag = 2; +registerEventHandler && registerEventHandler(dispatchEvent); var ReactFabricHostComponent = (function() { function ReactFabricHostComponent( tag, @@ -1501,19 +1600,19 @@ var ReactFabricHostComponent = (function() { this._internalInstanceHandle = internalInstanceHandle; } ReactFabricHostComponent.prototype.blur = function() { - TextInputState.blurTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); }; ReactFabricHostComponent.prototype.focus = function() { - TextInputState.focusTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); }; ReactFabricHostComponent.prototype.measure = function(callback) { - FabricUIManager.measure( + fabricMeasure( this._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); }; ReactFabricHostComponent.prototype.measureInWindow = function(callback) { - FabricUIManager.measureInWindow( + fabricMeasureInWindow( this._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -1525,7 +1624,7 @@ var ReactFabricHostComponent = (function() { ) { "number" !== typeof relativeToNativeNode && relativeToNativeNode instanceof ReactFabricHostComponent && - FabricUIManager.measureLayout( + fabricMeasureLayout( this._internalInstanceHandle.stateNode.node, relativeToNativeNode._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -1543,12 +1642,12 @@ function createTextInstance( ) { if (!hostContext.isInAParentText) throw ReactError( - "Text strings must be rendered within a component." + Error("Text strings must be rendered within a component.") ); hostContext = nextReactTag; nextReactTag += 2; return { - node: FabricUIManager.createNode( + node: createNode( hostContext, "RCTRawText", rootContainerInstance, @@ -1568,7 +1667,7 @@ function cloneHiddenInstance(instance) { instance.canonical.viewConfig.validAttributes ); return { - node: FabricUIManager.cloneNodeWithNewProps(node, updatePayload), + node: cloneNodeWithNewProps(node, updatePayload), canonical: instance.canonical }; } @@ -1658,7 +1757,9 @@ function popTopLevelContextObject(fiber) { function pushTopLevelContextObject(fiber, context, didChange) { if (contextStackCursor.current !== emptyContextObject) throw ReactError( - "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." + Error( + "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); @@ -1671,10 +1772,12 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in instance) if (!(contextKey in fiber)) throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) ); return Object.assign({}, parentContext, instance); } @@ -1696,7 +1799,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.stateNode; if (!instance) throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) ); didChange ? ((type = processChildContext(workInProgress, type, previousContext)), @@ -1707,33 +1812,11 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } -var onCommitFiberRoot = null, - onCommitFiberUnmount = null; -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) {} - }; -} -function injectInternals(internals) { - if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled || !hook.supportsFiber) return !0; - try { - var rendererID = hook.inject(internals); - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) {} - return !0; -} var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, @@ -1743,10 +1826,11 @@ var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_LowPriority = Scheduler.unstable_LowPriority, Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, fakeCallbackNode = {}, - shouldYield = Scheduler.unstable_shouldYield, - immediateQueue = null, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, immediateQueueCallbackNode = null, - isFlushingImmediate = !1, + isFlushingSyncQueue = !1, initialTimeMs = Scheduler_now(), now = 1e4 > initialTimeMs @@ -1767,7 +1851,7 @@ function getCurrentPriorityLevel() { case Scheduler_IdlePriority: return 95; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function reactPriorityToSchedulerPriority(reactPriorityLevel) { @@ -1783,54 +1867,55 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) { case 95: return Scheduler_IdlePriority; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } -function runWithPriority(reactPriorityLevel, fn) { +function runWithPriority$1(reactPriorityLevel, fn) { reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_runWithPriority(reactPriorityLevel, fn); } function scheduleCallback(reactPriorityLevel, callback, options) { - if (99 === reactPriorityLevel) - return ( - null === immediateQueue - ? ((immediateQueue = [callback]), - (immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ))) - : immediateQueue.push(callback), - fakeCallbackNode - ); reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); } -function flushImmediateQueue() { +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { null !== immediateQueueCallbackNode && Scheduler_cancelCallback(immediateQueueCallbackNode); - flushImmediateQueueImpl(); + flushSyncCallbackQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && null !== immediateQueue) { - isFlushingImmediate = !0; +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; var i = 0; try { - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do callback = callback(!0); - while (null !== callback); - } - immediateQueue = null; + var queue = syncQueue; + runWithPriority$1(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; } catch (error) { - throw (null !== immediateQueue && - (immediateQueue = immediateQueue.slice(i + 1)), + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), Scheduler_scheduleCallback( Scheduler_ImmediatePriority, - flushImmediateQueue + flushSyncCallbackQueue ), error); } finally { - isFlushingImmediate = !1; + isFlushingSyncQueue = !1; } } } @@ -1838,7 +1923,7 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { if (1073741823 === expirationTime) return 99; if (1 === expirationTime) return 95; currentTime = - 10 * (1073741822 - expirationTime) - 10 * (1073741822 - currentTime); + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); return 0 >= currentTime ? 99 : 250 >= currentTime @@ -1847,186 +1932,6 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { ? 97 : 95; } -function FiberNode(tag, pendingProps, key, mode) { - this.tag = tag; - this.key = key; - this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.contextDependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; - this.mode = mode; - this.effectTag = 0; - this.lastEffect = this.firstEffect = this.nextEffect = null; - this.childExpirationTime = this.expirationTime = 0; - this.alternate = null; -} -function createFiber(tag, pendingProps, key, mode) { - return new FiberNode(tag, pendingProps, key, mode); -} -function shouldConstruct(Component) { - Component = Component.prototype; - return !(!Component || !Component.isReactComponent); -} -function resolveLazyComponentTag(Component) { - if ("function" === typeof Component) - return shouldConstruct(Component) ? 1 : 0; - if (void 0 !== Component && null !== Component) { - Component = Component.$$typeof; - if (Component === REACT_FORWARD_REF_TYPE) return 11; - if (Component === REACT_MEMO_TYPE) return 14; - } - return 2; -} -function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - null === workInProgress - ? ((workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - )), - (workInProgress.elementType = current.elementType), - (workInProgress.type = current.type), - (workInProgress.stateNode = current.stateNode), - (workInProgress.alternate = current), - (current.alternate = workInProgress)) - : ((workInProgress.pendingProps = pendingProps), - (workInProgress.effectTag = 0), - (workInProgress.nextEffect = null), - (workInProgress.firstEffect = null), - (workInProgress.lastEffect = null)); - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - return workInProgress; -} -function createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiberTag = 2; - owner = type; - if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); - else if ("string" === typeof type) fiberTag = 5; - else - a: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 3, expirationTime, key); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 2, expirationTime, key); - case REACT_PROFILER_TYPE: - return ( - (type = createFiber(12, pendingProps, key, mode | 4)), - (type.elementType = REACT_PROFILER_TYPE), - (type.type = REACT_PROFILER_TYPE), - (type.expirationTime = expirationTime), - type - ); - case REACT_SUSPENSE_TYPE: - return ( - (type = createFiber(13, pendingProps, key, mode)), - (type.elementType = REACT_SUSPENSE_TYPE), - (type.type = REACT_SUSPENSE_TYPE), - (type.expirationTime = expirationTime), - type - ); - default: - if ("object" === typeof type && null !== type) - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = 10; - break a; - case REACT_CONTEXT_TYPE: - fiberTag = 9; - break a; - case REACT_FORWARD_REF_TYPE: - fiberTag = 11; - break a; - case REACT_MEMO_TYPE: - fiberTag = 14; - break a; - case REACT_LAZY_TYPE: - fiberTag = 16; - owner = null; - break a; - } - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." - ); - } - key = createFiber(fiberTag, pendingProps, key, mode); - key.elementType = type; - key.type = owner; - key.expirationTime = expirationTime; - return key; -} -function createFiberFromFragment(elements, mode, expirationTime, key) { - elements = createFiber(7, elements, key, mode); - elements.expirationTime = expirationTime; - return elements; -} -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - pendingProps = createFiber(8, pendingProps, key, mode); - mode = 0 === (mode & 1) ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE; - pendingProps.elementType = mode; - pendingProps.type = mode; - pendingProps.expirationTime = expirationTime; - return pendingProps; -} -function createFiberFromText(content, mode, expirationTime) { - content = createFiber(6, content, null, mode); - content.expirationTime = expirationTime; - return content; -} -function createFiberFromPortal(portal, mode, expirationTime) { - mode = createFiber( - 4, - null !== portal.children ? portal.children : [], - portal.key, - mode - ); - mode.expirationTime = expirationTime; - mode.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - implementation: portal.implementation - }; - return mode; -} -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pingCache = this.pendingChildren = null; - this.pendingCommitExpirationTime = 0; - this.finishedWork = null; - this.timeoutHandle = -1; - this.pendingContext = this.context = null; - this.hydrate = hydrate; - this.callbackNode = this.firstBatch = null; - this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; -} function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } @@ -2100,7 +2005,7 @@ var valueCursor = { current: null }, currentlyRenderingFiber = null, lastContextDependency = null, lastContextWithAllBitsObserved = null; -function resetContextDependences() { +function resetContextDependencies() { lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; } function pushProvider(providerFiber, nextValue) { @@ -2113,14 +2018,32 @@ function popProvider(providerFiber) { pop(valueCursor, providerFiber); providerFiber.type._context._currentValue2 = currentValue; } +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} function prepareToReadContext(workInProgress, renderExpirationTime) { currentlyRenderingFiber = workInProgress; lastContextWithAllBitsObserved = lastContextDependency = null; - var currentDependencies = workInProgress.contextDependencies; - null !== currentDependencies && - currentDependencies.expirationTime >= renderExpirationTime && - (didReceiveUpdate = !0); - workInProgress.contextDependencies = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } function readContext(context, observedBits) { if ( @@ -2134,12 +2057,15 @@ function readContext(context, observedBits) { if (null === lastContextDependency) { if (null === currentlyRenderingFiber) throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); lastContextDependency = observedBits; - currentlyRenderingFiber.contextDependencies = { - first: observedBits, - expirationTime: 0 + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null }; } else lastContextDependency = lastContextDependency.next = observedBits; } @@ -2172,9 +2098,10 @@ function cloneUpdateQueue(currentQueue) { lastCapturedEffect: null }; } -function createUpdate(expirationTime) { +function createUpdate(expirationTime, suspenseConfig) { return { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: 0, payload: null, callback: null, @@ -2290,8 +2217,10 @@ function processUpdateQueue( ((newFirstUpdate = update), (newBaseState = resultState)), newExpirationTime < updateExpirationTime && (newExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), (resultState = getStateFromUpdate( workInProgress, queue, @@ -2367,15 +2296,18 @@ function commitUpdateEffects(effect, instance) { var context = instance; if ("function" !== typeof _callback3) throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - _callback3 + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) ); _callback3.call(context); } effect = effect.nextEffect; } } -var emptyRefsObject = new React.Component().refs; +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; function applyDerivedStateFromProps( workInProgress, ctor, @@ -2402,36 +2334,42 @@ var classComponentUpdater = { }, enqueueSetState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 1; - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 2; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); } }; @@ -2560,15 +2498,19 @@ function coerceRef(returnFiber, current$$1, element) { if (element) { if (1 !== element.tag) throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); inst = element.stateNode; } if (!inst) throw ReactError( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); var stringRef = "" + returnFiber; if ( @@ -2588,13 +2530,17 @@ function coerceRef(returnFiber, current$$1, element) { } if ("string" !== typeof returnFiber) throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); if (!element._owner) throw ReactError( - "Element ref was specified as a string (" + - returnFiber + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } return returnFiber; @@ -2602,11 +2548,13 @@ function coerceRef(returnFiber, current$$1, element) { function throwOnInvalidObjectType(returnFiber, newChild) { if ("textarea" !== returnFiber.type) throw ReactError( - "Objects are not valid as a React child (found: " + - ("[object Object]" === Object.prototype.toString.call(newChild) - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) ); } function ChildReconciler(shouldTrackSideEffects) { @@ -3009,11 +2957,13 @@ function ChildReconciler(shouldTrackSideEffects) { var iteratorFn = getIteratorFn(newChildrenIterable); if ("function" !== typeof iteratorFn) throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); newChildrenIterable = iteratorFn.call(newChildrenIterable); if (null == newChildrenIterable) - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); for ( var previousNewFiber = (iteratorFn = null), oldFiber = currentFirstChild, @@ -3248,8 +3198,10 @@ function ChildReconciler(shouldTrackSideEffects) { case 0: throw ((returnFiber = returnFiber.type), ReactError( - (returnFiber.displayName || returnFiber.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) )); } return deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3264,7 +3216,9 @@ var reconcileChildFibers = ChildReconciler(!0), function requiredContext(c) { if (c === NO_CONTEXT) throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); return c; } @@ -3302,6 +3256,34 @@ function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); } +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} var NoEffect$1 = 0, UnmountSnapshot = 2, UnmountMutation = 4, @@ -3326,7 +3308,9 @@ var NoEffect$1 = 0, numberOfReRenders = 0; function throwInvalidHookError() { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -3376,7 +3360,9 @@ function renderWithHooks( sideEffectTag = 0; if (current) throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); return workInProgress; } @@ -3412,7 +3398,9 @@ function updateWorkInProgressHook() { (nextCurrentHook = null !== currentHook ? currentHook.next : null); else { if (null === nextCurrentHook) - throw ReactError("Rendered more hooks than during the previous render."); + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); currentHook = nextCurrentHook; var newHook = { memoizedState: currentHook.memoizedState, @@ -3437,7 +3425,9 @@ function updateReducer(reducer) { queue = hook.queue; if (null === queue) throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); queue.lastRenderedReducer = reducer; if (0 < numberOfReRenders) { @@ -3480,8 +3470,10 @@ function updateReducer(reducer) { (firstRenderPhaseUpdate = newState)), updateExpirationTime > remainingExpirationTime && (remainingExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), (newState = _update.eagerReducer === reducer ? _update.eagerState @@ -3560,7 +3552,9 @@ function mountDebugValue() {} function dispatchAction(fiber, queue, action) { if (!(25 > numberOfReRenders)) throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); var alternate = fiber.alternate; if ( @@ -3571,6 +3565,7 @@ function dispatchAction(fiber, queue, action) { ((didScheduleRenderPhaseUpdate = !0), (fiber = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, @@ -3586,24 +3581,29 @@ function dispatchAction(fiber, queue, action) { queue.next = fiber; } else { - flushPassiveEffects(); - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, fiber); - var _update2 = { - expirationTime: currentTime, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }, - _last = queue.last; - if (null === _last) _update2.next = _update2; + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; else { var first = _last.next; - null !== first && (_update2.next = first); - _last.next = _update2; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; } - queue.last = _update2; + queue.last = _suspenseConfig; if ( 0 === fiber.expirationTime && (null === alternate || 0 === alternate.expirationTime) && @@ -3612,8 +3612,8 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, _eagerState = alternate(currentState, action); - _update2.eagerReducer = alternate; - _update2.eagerState = _eagerState; + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; if (is(_eagerState, currentState)) return; } catch (error) { } finally { @@ -3632,7 +3632,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }, HooksDispatcherOnMount = { readContext: readContext, @@ -3705,7 +3706,8 @@ var ContextOnlyDispatcher = { ); return [hook.memoizedState, initialState]; }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, HooksDispatcherOnUpdate = { readContext: readContext, @@ -3759,7 +3761,8 @@ var ContextOnlyDispatcher = { useState: function(initialState) { return updateReducer(basicStateReducer, initialState); }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, hydrationParentFiber = null, nextHydratableInstance = null, @@ -3978,17 +3981,17 @@ function updateFunctionComponent( nextProps, renderExpirationTime ) { - var unmaskedContext = isContextProvider(Component) + var context = isContextProvider(Component) ? previousContext : contextStackCursor.current; - unmaskedContext = getMaskedContext(workInProgress, unmaskedContext); + context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderExpirationTime); Component = renderWithHooks( current$$1, workInProgress, Component, nextProps, - unmaskedContext, + context, renderExpirationTime ); if (null !== current$$1 && !didReceiveUpdate) @@ -4300,6 +4303,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } +var SUSPENDED_MARKER = {}; function updateSuspenseComponent( current$$1, workInProgress, @@ -4307,100 +4311,271 @@ function updateSuspenseComponent( ) { var mode = workInProgress.mode, nextProps = workInProgress.pendingProps, - nextState = workInProgress.memoizedState; - if (0 === (workInProgress.effectTag & 64)) { - nextState = null; - var nextDidTimeout = !1; - } else - (nextState = { - fallbackExpirationTime: - null !== nextState ? nextState.fallbackExpirationTime : 0 - }), + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), (nextDidTimeout = !0), - (workInProgress.effectTag &= -65); + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); if (null === current$$1) if (nextDidTimeout) { - var nextFallbackChildren = nextProps.fallback; + nextProps = nextProps.fallback; current$$1 = createFiberFromFragment(null, mode, 0, null); - 0 === (workInProgress.mode & 1) && - (current$$1.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child); - mode = createFiberFromFragment( - nextFallbackChildren, + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, mode, renderExpirationTime, null ); - current$$1.sibling = mode; - renderExpirationTime = current$$1; - renderExpirationTime.return = mode.return = workInProgress; + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; } else - renderExpirationTime = mode = mountChildFibers( + mode = renderExpirationTime = mountChildFibers( workInProgress, null, nextProps.children, renderExpirationTime ); - else - null !== current$$1.memoizedState - ? ((mode = current$$1.child), - (nextFallbackChildren = mode.sibling), - nextDidTimeout - ? ((renderExpirationTime = nextProps.fallback), - (nextProps = createWorkInProgress(mode, mode.pendingProps, 0)), - 0 === (workInProgress.mode & 1) && - ((nextDidTimeout = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child), - nextDidTimeout !== mode.child && - (nextProps.child = nextDidTimeout)), - (mode = nextProps.sibling = createWorkInProgress( - nextFallbackChildren, - renderExpirationTime, - nextFallbackChildren.expirationTime - )), - (renderExpirationTime = nextProps), - (nextProps.childExpirationTime = 0), - (renderExpirationTime.return = mode.return = workInProgress)) - : (renderExpirationTime = mode = reconcileChildFibers( - workInProgress, - mode.child, - nextProps.children, - renderExpirationTime - ))) - : ((nextFallbackChildren = current$$1.child), - nextDidTimeout - ? ((nextDidTimeout = nextProps.fallback), - (nextProps = createFiberFromFragment(null, mode, 0, null)), - (nextProps.child = nextFallbackChildren), - 0 === (workInProgress.mode & 1) && - (nextProps.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child), - (mode = nextProps.sibling = createFiberFromFragment( - nextDidTimeout, - mode, - renderExpirationTime, - null - )), - (mode.effectTag |= 2), - (renderExpirationTime = nextProps), - (nextProps.childExpirationTime = 0), - (renderExpirationTime.return = mode.return = workInProgress)) - : (mode = renderExpirationTime = reconcileChildFibers( - workInProgress, - nextFallbackChildren, - nextProps.children, - renderExpirationTime - ))), - (workInProgress.stateNode = current$$1.stateNode); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } workInProgress.memoizedState = nextState; - workInProgress.child = renderExpirationTime; - return mode; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; } function bailoutOnAlreadyFinishedWork( current$$1, @@ -4408,10 +4583,10 @@ function bailoutOnAlreadyFinishedWork( renderExpirationTime ) { null !== current$$1 && - (workInProgress.contextDependencies = current$$1.contextDependencies); + (workInProgress.dependencies = current$$1.dependencies); if (workInProgress.childExpirationTime < renderExpirationTime) return null; if (null !== current$$1 && workInProgress.child !== current$$1.child) - throw ReactError("Resuming work not yet implemented."); + throw ReactError(Error("Resuming work not yet implemented.")); if (null !== workInProgress.child) { current$$1 = workInProgress.child; renderExpirationTime = createWorkInProgress( @@ -4457,12 +4632,12 @@ appendAllChildren = function( node.memoizedProps, node )); - FabricUIManager.appendChild(parent.node, instance.node); + appendChildNode(parent.node, instance.node); } else if (6 === node.tag) { instance = node.stateNode; if (needsVisibilityToggle && isHidden) throw Error("Not yet implemented."); - FabricUIManager.appendChild(parent.node, instance.node); + appendChildNode(parent.node, instance.node); } else if (4 !== node.tag) { if ( 13 === node.tag && @@ -4515,12 +4690,12 @@ function appendAllChildrenToContainer( node.memoizedProps, node )); - FabricUIManager.appendChildToSet(containerChildSet, instance.node); + appendChildNodeToSet(containerChildSet, instance.node); } else if (6 === node.tag) { instance = node.stateNode; if (needsVisibilityToggle && isHidden) throw Error("Not yet implemented."); - FabricUIManager.appendChildToSet(containerChildSet, instance.node); + appendChildNodeToSet(containerChildSet, instance.node); } else if (4 !== node.tag) { if ( 13 === node.tag && @@ -4565,11 +4740,11 @@ updateHostContainer = function(workInProgress) { var portalOrRoot = workInProgress.stateNode; if (null !== workInProgress.firstEffect) { var container = portalOrRoot.containerInfo, - newChildSet = FabricUIManager.createChildSet(container); + newChildSet = createChildNodeSet(container); appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); portalOrRoot.pendingChildren = newChildSet; workInProgress.effectTag |= 4; - FabricUIManager.completeRoot(container, newChildSet); + completeRoot(container, newChildSet); } }; updateHostComponent$1 = function(current, workInProgress, type, newProps) { @@ -4597,17 +4772,11 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) { (type = { node: current ? null !== newProps - ? FabricUIManager.cloneNodeWithNewProps( - recyclableInstance, - newProps - ) - : FabricUIManager.cloneNode(recyclableInstance) + ? cloneNodeWithNewProps(recyclableInstance, newProps) + : cloneNode(recyclableInstance) : null !== newProps - ? FabricUIManager.cloneNodeWithNewChildrenAndProps( - recyclableInstance, - newProps - ) - : FabricUIManager.cloneNodeWithNewChildren(recyclableInstance), + ? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps) + : cloneNodeWithNewChildren(recyclableInstance), canonical: type.canonical }), (workInProgress.stateNode = type), @@ -4628,6 +4797,74 @@ updateHostText$1 = function(current, workInProgress, oldText, newText) { )), (workInProgress.effectTag |= 4)); }; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} function createCapturedValue(value, source) { return { value: value, @@ -4635,24 +4872,18 @@ function createCapturedValue(value, source) { stack: getStackByFiberInDevAndProd(source) }; } +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); function logCapturedError(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - if (error instanceof Error) { - capturedError = error.message; - var name = error.name; - try { - error.message = - (capturedError ? name + ": " + capturedError : name) + - "\n\nThis error is located at:" + - componentStack; - } catch (e) {} - } else - error = - "string" === typeof error - ? Error(error + "\n\nThis error is located at:" + componentStack) - : Error("Unspecified error at:" + componentStack); - ExceptionsManager.handleException(error, !1); + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); } var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; function logError(boundary, errorInfo) { @@ -4684,6 +4915,15 @@ function logError(boundary, errorInfo) { }); } } +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} function safelyDetachRef(current$$1) { var ref = current$$1.ref; if (null !== ref) @@ -4712,6 +4952,70 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } while (effect !== finishedWork); } } +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} function commitWork(current$$1, finishedWork) { switch (finishedWork.tag) { case 0: @@ -4723,7 +5027,12 @@ function commitWork(current$$1, finishedWork) { case 12: return; case 13: - commitSuspenseComponent(finishedWork); + null !== finishedWork.memoizedState && + (globalMostRecentFallbackTime = now()); + attachSuspenseRetryListeners(finishedWork); + return; + case 19: + attachSuspenseRetryListeners(finishedWork); return; } switch (finishedWork.tag) { @@ -4731,29 +5040,26 @@ function commitWork(current$$1, finishedWork) { case 5: case 6: case 20: - case 19: break; case 3: case 4: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } -function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState; - null !== newState && - 0 === newState.fallbackExpirationTime && - (newState.fallbackExpirationTime = requestCurrentTime() - 500); - newState = finishedWork.updateQueue; - if (null !== newState) { +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; null === retryCache && (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); - newState.forEach(function(thenable) { + thenables.forEach(function(thenable) { var retry = resolveRetryThenable.bind(null, finishedWork, thenable); retryCache.has(thenable) || (retryCache.add(thenable), thenable.then(retry, retry)); @@ -4762,7 +5068,7 @@ function commitSuspenseComponent(finishedWork) { } var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; expirationTime.payload = { element: null }; var error = errorInfo.value; @@ -4773,13 +5079,14 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { return expirationTime; } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if ("function" === typeof getDerivedStateFromError) { - var error$jscomp$0 = errorInfo.value; + var error = errorInfo.value; expirationTime.payload = function() { - return getDerivedStateFromError(error$jscomp$0); + logError(fiber, errorInfo); + return getDerivedStateFromError(error); }; } var inst = fiber.stateNode; @@ -4789,150 +5096,135 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) - : legacyErrorBoundariesThatAlreadyFailed.add(this)); - var error = errorInfo.value, - stack = errorInfo.stack; - logError(fiber, errorInfo); - this.componentDidCatch(error, { + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); }); return expirationTime; } -function unwindWork(workInProgress) { - switch (workInProgress.tag) { - case 1: - isContextProvider(workInProgress.type) && popContext(workInProgress); - var effectTag = workInProgress.effectTag; - return effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null; - case 3: - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - effectTag = workInProgress.effectTag; - if (0 !== (effectTag & 64)) - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - workInProgress.effectTag = (effectTag & -2049) | 64; - return workInProgress; - case 5: - return popHostContext(workInProgress), null; - case 13: - return ( - (effectTag = workInProgress.effectTag), - effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null - ); - case 18: - return null; - case 4: - return popHostContainer(workInProgress), null; - case 10: - return popProvider(workInProgress), null; - case 19: - case 20: - return null; - default: - return null; - } -} var ceil = Math.ceil, ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - LegacyUnbatchedPhase = 2, - RenderPhase = 4, - CommitPhase = 5, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, RootIncomplete = 0, RootErrored = 1, RootSuspended = 2, - RootCompleted = 3, - workPhase = 0, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, workInProgressRoot = null, workInProgress = null, renderExpirationTime = 0, workInProgressRootExitStatus = RootIncomplete, - workInProgressRootMostRecentEventTime = 1073741823, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, currentEventTime = 0; function requestCurrentTime() { - return workPhase === RenderPhase || workPhase === CommitPhase - ? 1073741822 - ((now() / 10) | 0) + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) : 0 !== currentEventTime ? currentEventTime - : (currentEventTime = 1073741822 - ((now() / 10) | 0)); -} -function computeExpirationForFiber(currentTime, fiber) { - if (0 === (fiber.mode & 1)) return 1073741823; - if (workPhase === RenderPhase) return renderExpirationTime; - switch (getCurrentPriorityLevel()) { - case 99: - currentTime = 1073741823; - break; - case 98: - currentTime = - 1073741822 - 10 * ((((1073741822 - currentTime + 15) / 10) | 0) + 1); - break; - case 97: - case 96: - currentTime = - 1073741822 - 25 * ((((1073741822 - currentTime + 500) / 25) | 0) + 1); - break; - case 95: - currentTime = 1; - break; - default: - throw ReactError("Expected a valid priority level"); - } - null !== workInProgressRoot && - currentTime === renderExpirationTime && - --currentTime; - return currentTime; + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } + null !== workInProgressRoot && + currentTime === renderExpirationTime && + --currentTime; + return currentTime; } function scheduleUpdateOnFiber(fiber, expirationTime) { if (50 < nestedUpdateCount) throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) )); fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); - if (null !== fiber) - if (((fiber.pingTime = 0), 1073741823 === expirationTime)) - if (workPhase === LegacyUnbatchedPhase) + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) for ( - expirationTime = renderRoot(fiber, 1073741823, !0); - null !== expirationTime; + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; ) - expirationTime = expirationTime(!0); + callback = callback(!0); else scheduleCallbackForRoot(fiber, 99, 1073741823), - 0 === workPhase && flushImmediateQueue(); - else { - var priorityLevel = getCurrentPriorityLevel(); - if (98 === priorityLevel) - if (null === rootsWithPendingDiscreteUpdates) - rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]]); - else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(fiber); - (void 0 === lastDiscreteTime || lastDiscreteTime > expirationTime) && - rootsWithPendingDiscreteUpdates.set(fiber, expirationTime); - } - scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); - } + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } } function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { fiber.expirationTime < expirationTime && @@ -4973,21 +5265,28 @@ function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { existingCallbackNode !== fakeCallbackNode && Scheduler_cancelCallback(existingCallbackNode); root.callbackExpirationTime = expirationTime; - existingCallbackNode = null; - 1073741823 !== expirationTime && - 1 !== expirationTime && - ((existingCallbackNode = 10 * (1073741822 - expirationTime) - now()), - 5e3 < existingCallbackNode && (existingCallbackNode = 5e3), - (existingCallbackNode = { timeout: existingCallbackNode })); - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - existingCallbackNode - ); + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); } } function runRootCallback(root, callback, isSync) { @@ -5011,9 +5310,7 @@ function resolveLocksOnRoot(root, expirationTime) { return null !== firstBatch && firstBatch._defer && firstBatch._expirationTime >= expirationTime - ? ((root.finishedWork = root.current.alternate), - (root.pendingCommitExpirationTime = expirationTime), - scheduleCallback(97, function() { + ? (scheduleCallback(97, function() { firstBatch._onComplete(); return null; }), @@ -5025,13 +5322,14 @@ function flushPendingDiscreteUpdates() { var roots = rootsWithPendingDiscreteUpdates; rootsWithPendingDiscreteUpdates = null; roots.forEach(function(expirationTime, root) { - scheduleCallback(99, renderRoot.bind(null, root, expirationTime)); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); }); - flushImmediateQueue(); + flushSyncCallbackQueue(); } } function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = 0; + root.finishedWork = null; + root.finishedExpirationTime = 0; var timeoutHandle = root.timeoutHandle; -1 !== timeoutHandle && ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); @@ -5055,6 +5353,12 @@ function prepareFreshStack(root, expirationTime) { case 4: popHostContainer(interruptedWork); break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; case 10: popProvider(interruptedWork); } @@ -5064,24 +5368,33 @@ function prepareFreshStack(root, expirationTime) { workInProgress = createWorkInProgress(root.current, null, expirationTime); renderExpirationTime = expirationTime; workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = 1073741823; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; } function renderRoot(root$jscomp$0, expirationTime, isSync) { - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); if (root$jscomp$0.firstPendingTime < expirationTime) return null; - if (root$jscomp$0.pendingCommitExpirationTime === expirationTime) - return ( - (root$jscomp$0.pendingCommitExpirationTime = 0), - commitRoot.bind(null, root$jscomp$0, expirationTime) - ); + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); flushPassiveEffects(); - (root$jscomp$0 === workInProgressRoot && - expirationTime === renderExpirationTime) || + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) prepareFreshStack(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } if (null !== workInProgress) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; + lastPendingTime = executionContext; + executionContext |= RenderContext; var prevDispatcher = ReactCurrentDispatcher.current; null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); ReactCurrentDispatcher.current = ContextOnlyDispatcher; @@ -5090,8 +5403,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { var currentTime = requestCurrentTime(); if (currentTime < expirationTime) return ( - (workPhase = prevWorkPhase), - resetContextDependences(), + (executionContext = lastPendingTime), + resetContextDependencies(), (ReactCurrentDispatcher.current = prevDispatcher), renderRoot.bind(null, root$jscomp$0, currentTime) ); @@ -5103,16 +5416,16 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { for (; null !== workInProgress; ) workInProgress = performUnitOfWork(workInProgress); else - for (; null !== workInProgress && !shouldYield(); ) + for (; null !== workInProgress && !Scheduler_shouldYield(); ) workInProgress = performUnitOfWork(workInProgress); break; } catch (thrownValue) { - resetContextDependences(); + resetContextDependencies(); resetHooks(); currentTime = workInProgress; if (null === currentTime || null === currentTime.return) throw (prepareFreshStack(root$jscomp$0, expirationTime), - (workPhase = prevWorkPhase), + (executionContext = lastPendingTime), thrownValue); a: { var root = root$jscomp$0, @@ -5127,29 +5440,41 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { "object" === typeof value && "function" === typeof value.then ) { - var thenable = value; + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); value = returnFiber; do { - if ( - 13 === value.tag && - (void 0 === value.memoizedProps.fallback - ? 0 - : null === value.memoizedState) - ) { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { returnFiber = value.updateQueue; null === returnFiber ? ((returnFiber = new Set()), returnFiber.add(thenable), (value.updateQueue = returnFiber)) : returnFiber.add(thenable); - if (0 === (value.mode & 1)) { + if (0 === (value.mode & 2)) { value.effectTag |= 64; sourceFiber.effectTag &= -1957; 1 === sourceFiber.tag && (null === sourceFiber.alternate ? (sourceFiber.tag = 17) : ((renderExpirationTime$jscomp$0 = createUpdate( - 1073741823 + 1073741823, + null )), (renderExpirationTime$jscomp$0.tag = 2), enqueueUpdate( @@ -5161,15 +5486,15 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { } sourceFiber = root; root = renderExpirationTime$jscomp$0; - var pingCache = sourceFiber.pingCache; - null === pingCache - ? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()), + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), (returnFiber = new Set()), - pingCache.set(thenable, returnFiber)) - : ((returnFiber = pingCache.get(thenable)), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), void 0 === returnFiber && ((returnFiber = new Set()), - pingCache.set(thenable, returnFiber))); + hasInvisibleParentBoundary.set(thenable, returnFiber))); returnFiber.has(root) || (returnFiber.add(root), (sourceFiber = pingSuspendedRoot.bind( @@ -5191,11 +5516,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { getStackByFiberInDevAndProd(sourceFiber) ); } - if ( - workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended - ) - workInProgressRootExitStatus = RootErrored; + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); value = createCapturedValue(value, sourceFiber); sourceFiber = returnFiber; do { @@ -5247,76 +5569,144 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = completeUnitOfWork(currentTime); } while (1); - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = lastPendingTime; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; if (null !== workInProgress) return renderRoot.bind(null, root$jscomp$0, expirationTime); } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; workInProgressRoot = null; switch (workInProgressRootExitStatus) { case RootIncomplete: - throw ReactError("Should have a work-in-progress."); + throw ReactError(Error("Should have a work-in-progress.")); case RootErrored: return ( - (prevWorkPhase = root$jscomp$0.lastPendingTime), - root$jscomp$0.lastPendingTime < expirationTime - ? renderRoot.bind(null, root$jscomp$0, prevWorkPhase) + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) : isSync - ? commitRoot.bind(null, root$jscomp$0, expirationTime) + ? commitRoot.bind(null, root$jscomp$0) : (prepareFreshStack(root$jscomp$0, expirationTime), - scheduleCallback( - 99, + scheduleSyncCallback( renderRoot.bind(null, root$jscomp$0, expirationTime) ), null) ); case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); isSync = root$jscomp$0.lastPendingTime; - if (root$jscomp$0.lastPendingTime < expirationTime) + if (isSync < expirationTime) return renderRoot.bind(null, root$jscomp$0, isSync); - if ( - 1073741823 !== workInProgressRootMostRecentEventTime && - ((prevWorkPhase = - 10 * (1073741822 - workInProgressRootMostRecentEventTime) - 5e3), - (isSync = now()), - (prevWorkPhase = isSync - prevWorkPhase), - (prevWorkPhase = - (120 > prevWorkPhase - ? 120 - : 480 > prevWorkPhase - ? 480 - : 1080 > prevWorkPhase - ? 1080 - : 1920 > prevWorkPhase - ? 1920 - : 3e3 > prevWorkPhase - ? 3e3 - : 4320 > prevWorkPhase - ? 4320 - : 1960 * ceil(prevWorkPhase / 1960)) - prevWorkPhase), - (isSync = 10 * (1073741822 - expirationTime) - isSync), - isSync < prevWorkPhase && (prevWorkPhase = isSync), - (isSync = prevWorkPhase), - 10 < isSync) - ) + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) return ( (root$jscomp$0.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root$jscomp$0, expirationTime), + commitRoot.bind(null, root$jscomp$0), isSync )), null ); } - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return commitRoot.bind(null, root$jscomp$0); case RootCompleted: - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); default: - throw ReactError("Unknown root exit status."); + throw ReactError(Error("Unknown root exit status.")); } } +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} function performUnitOfWork(unitOfWork) { var next = beginWork$$1( unitOfWork.alternate, @@ -5353,10 +5743,11 @@ function completeUnitOfWork(unitOfWork) { case 3: popHostContainer(current$$1); popTopLevelContextObject(current$$1); - newProps = current$$1.stateNode; - newProps.pendingContext && - ((newProps.context = newProps.pendingContext), - (newProps.pendingContext = null)); + renderExpirationTime$jscomp$0 = current$$1.stateNode; + renderExpirationTime$jscomp$0.pendingContext && + ((renderExpirationTime$jscomp$0.context = + renderExpirationTime$jscomp$0.pendingContext), + (renderExpirationTime$jscomp$0.pendingContext = null)); if (null === current || null === current.child) current$$1.effectTag &= -3; updateHostContainer(current$$1); @@ -5380,28 +5771,28 @@ function completeUnitOfWork(unitOfWork) { requiredContext(contextStackCursor$1.current); current = newProps; var rootContainerInstance = renderExpirationTime$jscomp$0; - newProps = current$$1; - renderExpirationTime$jscomp$0 = nextReactTag; + renderExpirationTime$jscomp$0 = current$$1; + newProps = nextReactTag; nextReactTag += 2; - type = ReactNativeViewConfigRegistry.get(type); + type = getViewConfigForType(type); var updatePayload = diffProperties( null, emptyObject, current, type.validAttributes ); - rootContainerInstance = FabricUIManager.createNode( - renderExpirationTime$jscomp$0, + rootContainerInstance = createNode( + newProps, type.uiViewClassName, rootContainerInstance, updatePayload, - newProps + renderExpirationTime$jscomp$0 ); current = new ReactFabricHostComponent( - renderExpirationTime$jscomp$0, + newProps, type, current, - newProps + renderExpirationTime$jscomp$0 ); current = { node: rootContainerInstance, canonical: current }; appendAllChildren(current, current$$1, !1, !1); @@ -5409,7 +5800,9 @@ function completeUnitOfWork(unitOfWork) { null !== current$$1.ref && (current$$1.effectTag |= 128); } else if (null === current$$1.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -5423,7 +5816,9 @@ function completeUnitOfWork(unitOfWork) { else { if ("string" !== typeof newProps && null === current$$1.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); current = requiredContext(rootInstanceStackCursor.current); renderExpirationTime$jscomp$0 = requiredContext( @@ -5440,36 +5835,47 @@ function completeUnitOfWork(unitOfWork) { case 11: break; case 13: + pop(suspenseStackCursor, current$$1); newProps = current$$1.memoizedState; if (0 !== (current$$1.effectTag & 64)) { current$$1.expirationTime = renderExpirationTime$jscomp$0; break a; } - newProps = null !== newProps; - renderExpirationTime$jscomp$0 = !1; + renderExpirationTime$jscomp$0 = null !== newProps; + newProps = !1; null !== current && ((type = current.memoizedState), - (renderExpirationTime$jscomp$0 = null !== type), - newProps || + (newProps = null !== type), + renderExpirationTime$jscomp$0 || null === type || - ((type = type.fallbackExpirationTime), - type < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = type), - (current = current.child.sibling), - null !== current && - ((type = current$$1.firstEffect), - null !== type - ? ((current$$1.firstEffect = current), - (current.nextEffect = type)) - : ((current$$1.firstEffect = current$$1.lastEffect = current), - (current.nextEffect = null)), - (current.effectTag = 8)))); - newProps && - !renderExpirationTime$jscomp$0 && - 0 !== (current$$1.mode & 1) && - workInProgressRootExitStatus === RootIncomplete && - (workInProgressRootExitStatus = RootSuspended); - newProps && (current$$1.effectTag |= 4); + ((type = current.child.sibling), + null !== type && + ((rootContainerInstance = current$$1.firstEffect), + null !== rootContainerInstance + ? ((current$$1.firstEffect = type), + (type.nextEffect = rootContainerInstance)) + : ((current$$1.firstEffect = current$$1.lastEffect = type), + (type.nextEffect = null)), + (type.effectTag = 8)))); + if ( + renderExpirationTime$jscomp$0 && + !newProps && + 0 !== (current$$1.mode & 2) + ) + if ( + (null === current && + !0 !== current$$1.memoizedProps.unstable_avoidThisFallback) || + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + renderExpirationTime$jscomp$0 && (current$$1.effectTag |= 4); break; case 7: break; @@ -5494,33 +5900,166 @@ function completeUnitOfWork(unitOfWork) { case 18: break; case 19: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (null === newProps) break; + type = 0 !== (current$$1.effectTag & 64); + rootContainerInstance = newProps.rendering; + if (null === rootContainerInstance) + if (type) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = current$$1.child; null !== current; ) { + rootContainerInstance = findFirstSuspended(current); + if (null !== rootContainerInstance) { + current$$1.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = rootContainerInstance.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1.firstEffect = current$$1.lastEffect = null; + current = renderExpirationTime$jscomp$0; + for ( + renderExpirationTime$jscomp$0 = current$$1.child; + null !== renderExpirationTime$jscomp$0; + + ) + (newProps = renderExpirationTime$jscomp$0), + (type = current), + (newProps.effectTag &= 2), + (newProps.nextEffect = null), + (newProps.firstEffect = null), + (newProps.lastEffect = null), + (rootContainerInstance = newProps.alternate), + null === rootContainerInstance + ? ((newProps.childExpirationTime = 0), + (newProps.expirationTime = type), + (newProps.child = null), + (newProps.memoizedProps = null), + (newProps.memoizedState = null), + (newProps.updateQueue = null), + (newProps.dependencies = null)) + : ((newProps.childExpirationTime = + rootContainerInstance.childExpirationTime), + (newProps.expirationTime = + rootContainerInstance.expirationTime), + (newProps.child = rootContainerInstance.child), + (newProps.memoizedProps = + rootContainerInstance.memoizedProps), + (newProps.memoizedState = + rootContainerInstance.memoizedState), + (newProps.updateQueue = + rootContainerInstance.updateQueue), + (type = rootContainerInstance.dependencies), + (newProps.dependencies = + null === type + ? null + : { + expirationTime: type.expirationTime, + firstContext: type.firstContext, + responders: type.responders + })), + (renderExpirationTime$jscomp$0 = + renderExpirationTime$jscomp$0.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & + SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + current$$1 + ); + current$$1 = current$$1.child; + break a; + } + current = current.sibling; + } + } + else { + if (!type) + if ( + ((current = findFirstSuspended(rootContainerInstance)), + null !== current) + ) { + if ( + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1 = current$$1.lastEffect = newProps.lastEffect; + null !== current$$1 && (current$$1.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime$jscomp$0 && + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !1), + (current$$1.expirationTime = current$$1.childExpirationTime = + renderExpirationTime$jscomp$0 - 1)); + newProps.isBackwards + ? ((rootContainerInstance.sibling = current$$1.child), + (current$$1.child = rootContainerInstance)) + : ((current = newProps.last), + null !== current + ? (current.sibling = rootContainerInstance) + : (current$$1.child = rootContainerInstance), + (newProps.last = rootContainerInstance)); + } + if (null !== newProps.tail) { + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500); + current = newProps.tail; + newProps.rendering = current; + newProps.tail = current.sibling; + newProps.lastEffect = current$$1.lastEffect; + current.sibling = null; + renderExpirationTime$jscomp$0 = suspenseStackCursor.current; + renderExpirationTime$jscomp$0 = type + ? (renderExpirationTime$jscomp$0 & SubtreeSuspenseContextMask) | + ForceSuspenseFallback + : renderExpirationTime$jscomp$0 & SubtreeSuspenseContextMask; + push( + suspenseStackCursor, + renderExpirationTime$jscomp$0, + current$$1 + ); + current$$1 = current; + break a; + } break; case 20: break; default: throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } current$$1 = null; } current = workInProgress; if (1 === renderExpirationTime || 1 !== current.childExpirationTime) { - newProps = 0; - for ( - renderExpirationTime$jscomp$0 = current.child; - null !== renderExpirationTime$jscomp$0; - - ) - (type = renderExpirationTime$jscomp$0.expirationTime), - (rootContainerInstance = - renderExpirationTime$jscomp$0.childExpirationTime), - type > newProps && (newProps = type), - rootContainerInstance > newProps && - (newProps = rootContainerInstance), - (renderExpirationTime$jscomp$0 = - renderExpirationTime$jscomp$0.sibling); - current.childExpirationTime = newProps; + renderExpirationTime$jscomp$0 = 0; + for (newProps = current.child; null !== newProps; ) + (type = newProps.expirationTime), + (rootContainerInstance = newProps.childExpirationTime), + type > renderExpirationTime$jscomp$0 && + (renderExpirationTime$jscomp$0 = type), + rootContainerInstance > renderExpirationTime$jscomp$0 && + (renderExpirationTime$jscomp$0 = rootContainerInstance), + (newProps = newProps.sibling); + current.childExpirationTime = renderExpirationTime$jscomp$0; } if (null !== current$$1) return current$$1; null !== unitOfWork && @@ -5552,23 +6091,31 @@ function completeUnitOfWork(unitOfWork) { (workInProgressRootExitStatus = RootCompleted); return null; } -function commitRoot(root, expirationTime) { - runWithPriority(99, commitRootImpl.bind(null, root, expirationTime)); +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(99, commitRootImpl.bind(null, root, renderPriorityLevel)); null !== rootWithPendingPassiveEffects && - ((root = getCurrentPriorityLevel()), - scheduleCallback(root, function() { + scheduleCallback(97, function() { flushPassiveEffects(); return null; - })); + }); return null; } -function commitRootImpl(root, expirationTime) { +function commitRootImpl(root, renderPriorityLevel) { flushPassiveEffects(); - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); - var finishedWork = root.current.alternate; - if (null === finishedWork) - throw ReactError("Should have a work-in-progress root."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); root.callbackNode = null; root.callbackExpirationTime = 0; var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, @@ -5585,14 +6132,14 @@ function commitRootImpl(root, expirationTime) { 1 < finishedWork.effectTag ? null !== finishedWork.lastEffect ? ((finishedWork.lastEffect.nextEffect = finishedWork), - (childExpirationTimeBeforeCommit = finishedWork.firstEffect)) - : (childExpirationTimeBeforeCommit = finishedWork) - : (childExpirationTimeBeforeCommit = finishedWork.firstEffect); - if (null !== childExpirationTimeBeforeCommit) { - updateExpirationTimeBeforeCommit = workPhase; - workPhase = CommitPhase; + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; ReactCurrentOwner$2.current = null; - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (; null !== nextEffect; ) { @@ -5635,11 +6182,12 @@ function commitRootImpl(root, expirationTime) { case 6: case 4: case 17: - case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -5647,15 +6195,15 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { - for (; null !== nextEffect; ) { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { var effectTag = nextEffect.effectTag; if (effectTag & 128) { var current$$1$jscomp$0 = nextEffect.alternate; @@ -5679,102 +6227,45 @@ function commitRootImpl(root, expirationTime) { commitWork(nextEffect.alternate, nextEffect); break; case 8: - current$$1 = nextEffect; - a: for (prevState = prevProps = current$$1; ; ) { - instance = prevState; - "function" === typeof onCommitFiberUnmount && - onCommitFiberUnmount(instance); - switch (instance.tag) { - case 0: - case 11: - case 14: - case 15: - var updateQueue = instance.updateQueue; - if (null !== updateQueue) { - var lastEffect = updateQueue.lastEffect; - if (null !== lastEffect) { - var firstEffect = lastEffect.next; - snapshot = firstEffect; - do { - var destroy = snapshot.destroy; - if (void 0 !== destroy) { - finishedWork$jscomp$0 = instance; - try { - destroy(); - } catch (error) { - captureCommitPhaseError( - finishedWork$jscomp$0, - error - ); - } - } - snapshot = snapshot.next; - } while (snapshot !== firstEffect); - } - } - break; - case 1: - safelyDetachRef(instance); - var instance$jscomp$0 = instance.stateNode; - if ( - "function" === - typeof instance$jscomp$0.componentWillUnmount - ) - try { - (instance$jscomp$0.props = instance.memoizedProps), - (instance$jscomp$0.state = instance.memoizedState), - instance$jscomp$0.componentWillUnmount(); - } catch (unmountError) { - captureCommitPhaseError(instance, unmountError); - } - break; - case 5: - safelyDetachRef(instance); - break; - case 4: - FabricUIManager.createChildSet( - instance.stateNode.containerInfo - ); - } - if (null !== prevState.child) - (prevState.child.return = prevState), - (prevState = prevState.child); + prevProps = nextEffect; + a: for ( + prevState = prevProps, + instance = current$$1, + snapshot = prevState; + ; + + ) + if ( + (commitUnmount(snapshot, instance), null !== snapshot.child) + ) + (snapshot.child.return = snapshot), + (snapshot = snapshot.child); else { - if (prevState === prevProps) break; - for (; null === prevState.sibling; ) { + if (snapshot === prevState) break; + for (; null === snapshot.sibling; ) { if ( - null === prevState.return || - prevState.return === prevProps + null === snapshot.return || + snapshot.return === prevState ) break a; - prevState = prevState.return; + snapshot = snapshot.return; } - prevState.sibling.return = prevState.return; - prevState = prevState.sibling; + snapshot.sibling.return = snapshot.return; + snapshot = snapshot.sibling; } - } - current$$1.return = null; - current$$1.child = null; - current$$1.memoizedState = null; - current$$1.updateQueue = null; - var alternate = current$$1.alternate; - null !== alternate && - ((alternate.return = null), - (alternate.child = null), - (alternate.memoizedState = null), - (alternate.updateQueue = null)); + detachFiber(prevProps); } nextEffect = nextEffect.nextEffect; } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); root.current = finishedWork; - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (effectTag = expirationTime; null !== nextEffect; ) { @@ -5794,10 +6285,10 @@ function commitRootImpl(root, expirationTime) { ); break; case 1: - var instance$jscomp$1 = current$$1$jscomp$0.stateNode; + var instance$jscomp$0 = current$$1$jscomp$0.stateNode; if (current$$1$jscomp$0.effectTag & 4) if (null === current$$1$jscomp$1) - instance$jscomp$1.componentDidMount(); + instance$jscomp$0.componentDidMount(); else { var prevProps$jscomp$0 = current$$1$jscomp$0.elementType === @@ -5807,38 +6298,38 @@ function commitRootImpl(root, expirationTime) { current$$1$jscomp$0.type, current$$1$jscomp$1.memoizedProps ); - instance$jscomp$1.componentDidUpdate( + instance$jscomp$0.componentDidUpdate( prevProps$jscomp$0, current$$1$jscomp$1.memoizedState, - instance$jscomp$1.__reactInternalSnapshotBeforeUpdate + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate ); } - var updateQueue$jscomp$0 = current$$1$jscomp$0.updateQueue; - null !== updateQueue$jscomp$0 && + var updateQueue = current$$1$jscomp$0.updateQueue; + null !== updateQueue && commitUpdateQueue( current$$1$jscomp$0, - updateQueue$jscomp$0, - instance$jscomp$1, + updateQueue, + instance$jscomp$0, currentRef ); break; case 3: var _updateQueue = current$$1$jscomp$0.updateQueue; if (null !== _updateQueue) { - updateQueue = null; + current$$1 = null; if (null !== current$$1$jscomp$0.child) switch (current$$1$jscomp$0.child.tag) { case 5: - updateQueue = + current$$1 = current$$1$jscomp$0.child.stateNode.canonical; break; case 1: - updateQueue = current$$1$jscomp$0.child.stateNode; + current$$1 = current$$1$jscomp$0.child.stateNode; } commitUpdateQueue( current$$1$jscomp$0, _updateQueue, - updateQueue, + current$$1, currentRef ); } @@ -5849,7 +6340,9 @@ function commitRootImpl(root, expirationTime) { current$$1$jscomp$0.effectTag & 4 ) throw ReactError( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -5859,28 +6352,28 @@ function commitRootImpl(root, expirationTime) { case 12: break; case 13: + case 19: case 17: - break; case 20: break; - case 19: - break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } if (effectTag$jscomp$0 & 128) { var ref = nextEffect.ref; if (null !== ref) { - var instance$jscomp$2 = nextEffect.stateNode; + var instance$jscomp$1 = nextEffect.stateNode; switch (nextEffect.tag) { case 5: - var instanceToUse = instance$jscomp$2.canonical; + var instanceToUse = instance$jscomp$1.canonical; break; default: - instanceToUse = instance$jscomp$2; + instanceToUse = instance$jscomp$1; } "function" === typeof ref ? ref(instanceToUse) @@ -5892,28 +6385,37 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); nextEffect = null; - workPhase = updateExpirationTimeBeforeCommit; + requestPaint(); + executionContext = childExpirationTimeBeforeCommit; } else root.current = finishedWork; - rootDoesHavePassiveEffects && - ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root)); - expirationTime = root.firstPendingTime; - 0 !== expirationTime + if (rootDoesHavePassiveEffects) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + 0 !== renderPriorityLevel ? ((effectTag$jscomp$0 = requestCurrentTime()), (effectTag$jscomp$0 = inferPriorityFromExpirationTime( effectTag$jscomp$0, - expirationTime + renderPriorityLevel )), - scheduleCallbackForRoot(root, effectTag$jscomp$0, expirationTime)) + scheduleCallbackForRoot(root, effectTag$jscomp$0, renderPriorityLevel)) : (legacyErrorBoundariesThatAlreadyFailed = null); "function" === typeof onCommitFiberRoot && - onCommitFiberRoot(finishedWork.stateNode); - 1073741823 === expirationTime + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -5923,31 +6425,52 @@ function commitRootImpl(root, expirationTime) { (root = firstUncaughtError), (firstUncaughtError = null), root); - if (workPhase === LegacyUnbatchedPhase) return null; - flushImmediateQueue(); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); return null; } function flushPassiveEffects() { if (null === rootWithPendingPassiveEffects) return !1; - var root = rootWithPendingPassiveEffects; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; rootWithPendingPassiveEffects = null; - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Cannot flush passive effects while already rendering."); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; for (root = root.current.firstEffect; null !== root; ) { try { var finishedWork = root; - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } } catch (error) { - if (null === root) throw ReactError("Should be working on an effect."); + if (null === root) + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(root, error); } - root = root.nextEffect; + finishedWork = root.nextEffect; + root.nextEffect = null; + root = finishedWork; } - workPhase = prevWorkPhase; - flushImmediateQueue(); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); return !0; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { @@ -5988,11 +6511,18 @@ function pingSuspendedRoot(root, thenable, suspendedTime) { var pingCache = root.pingCache; null !== pingCache && pingCache.delete(thenable); workInProgressRoot === root && renderExpirationTime === suspendedTime - ? prepareFreshStack(root, renderExpirationTime) + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) : root.lastPendingTime < suspendedTime || ((thenable = root.pingTime), (0 !== thenable && thenable < suspendedTime) || ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), (thenable = requestCurrentTime()), (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), scheduleCallbackForRoot(root, thenable, suspendedTime))); @@ -6001,7 +6531,7 @@ function resolveRetryThenable(boundaryFiber, thenable) { var retryCache = boundaryFiber.stateNode; null !== retryCache && retryCache.delete(thenable); retryCache = requestCurrentTime(); - thenable = computeExpirationForFiber(retryCache, boundaryFiber); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); retryCache = inferPriorityFromExpirationTime(retryCache, thenable); boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); null !== boundaryFiber && @@ -6051,6 +6581,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress, renderExpirationTime ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6058,6 +6593,33 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); return null !== workInProgress ? workInProgress.sibling : null; } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; } return bailoutOnAlreadyFinishedWork( current$$1, @@ -6070,31 +6632,31 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress.expirationTime = 0; switch (workInProgress.tag) { case 2: - updateExpirationTime = workInProgress.elementType; + updateExpirationTime = workInProgress.type; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - var context = getMaskedContext( + renderState = getMaskedContext( workInProgress, contextStackCursor.current ); prepareToReadContext(workInProgress, renderExpirationTime); - context = renderWithHooks( + renderState = renderWithHooks( null, workInProgress, updateExpirationTime, current$$1, - context, + renderState, renderExpirationTime ); workInProgress.effectTag |= 1; if ( - "object" === typeof context && - null !== context && - "function" === typeof context.render && - void 0 === context.$$typeof + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof ) { workInProgress.tag = 1; resetHooks(); @@ -6103,8 +6665,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { pushContextProvider(workInProgress); } else hasContext = !1; workInProgress.memoizedState = - null !== context.state && void 0 !== context.state - ? context.state + null !== renderState.state && void 0 !== renderState.state + ? renderState.state : null; var getDerivedStateFromProps = updateExpirationTime.getDerivedStateFromProps; @@ -6115,9 +6677,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { getDerivedStateFromProps, current$$1 ); - context.updater = classComponentUpdater; - workInProgress.stateNode = context; - context._reactInternalFiber = workInProgress; + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; mountClassInstance( workInProgress, updateExpirationTime, @@ -6137,28 +6699,28 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( null, workInProgress, - context, + renderState, renderExpirationTime ), (workInProgress = workInProgress.child); return workInProgress; case 16: - context = workInProgress.elementType; + renderState = workInProgress.elementType; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - context = readLazyComponentType(context); - workInProgress.type = context; - hasContext = workInProgress.tag = resolveLazyComponentTag(context); - current$$1 = resolveDefaultProps(context, current$$1); + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); switch (hasContext) { case 0: workInProgress = updateFunctionComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6167,7 +6729,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateClassComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6176,7 +6738,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateForwardRef( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6185,49 +6747,51 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateMemoComponent( null, workInProgress, - context, - resolveDefaultProps(context.type, current$$1), + renderState, + resolveDefaultProps(renderState.type, current$$1), updateExpirationTime, renderExpirationTime ); break; default: throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - context + - ". Lazy element type must resolve to a class or function." + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) ); } return workInProgress; case 0: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateFunctionComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); case 1: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateClassComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6236,10 +6800,12 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { updateExpirationTime = workInProgress.updateQueue; if (null === updateExpirationTime) throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); - context = workInProgress.memoizedState; - context = null !== context ? context.element : null; + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; processUpdateQueue( workInProgress, updateExpirationTime, @@ -6248,7 +6814,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); updateExpirationTime = workInProgress.memoizedState.element; - updateExpirationTime === context + updateExpirationTime === renderState ? (workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6312,16 +6878,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 11: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateForwardRef( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6358,9 +6924,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 10: a: { updateExpirationTime = workInProgress.type._context; - context = workInProgress.pendingProps; + renderState = workInProgress.pendingProps; getDerivedStateFromProps = workInProgress.memoizedProps; - hasContext = context.value; + hasContext = renderState.value; pushProvider(workInProgress, hasContext); if (null !== getDerivedStateFromProps) { var oldValue = getDerivedStateFromProps.value; @@ -6374,7 +6940,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { : 1073741823) | 0; if (0 === hasContext) { if ( - getDerivedStateFromProps.children === context.children && + getDerivedStateFromProps.children === renderState.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -6391,16 +6957,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== oldValue; ) { - var list = oldValue.contextDependencies; + var list = oldValue.dependencies; if (null !== list) { getDerivedStateFromProps = oldValue.child; - for (var dependency = list.first; null !== dependency; ) { + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { if ( dependency.context === updateExpirationTime && 0 !== (dependency.observedBits & hasContext) ) { 1 === oldValue.tag && - ((dependency = createUpdate(renderExpirationTime)), + ((dependency = createUpdate(renderExpirationTime, null)), (dependency.tag = 2), enqueueUpdate(oldValue, dependency)); oldValue.expirationTime < renderExpirationTime && @@ -6409,22 +6979,10 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== dependency && dependency.expirationTime < renderExpirationTime && (dependency.expirationTime = renderExpirationTime); - dependency = renderExpirationTime; - for (var node = oldValue.return; null !== node; ) { - var alternate = node.alternate; - if (node.childExpirationTime < dependency) - (node.childExpirationTime = dependency), - null !== alternate && - alternate.childExpirationTime < dependency && - (alternate.childExpirationTime = dependency); - else if ( - null !== alternate && - alternate.childExpirationTime < dependency - ) - alternate.childExpirationTime = dependency; - else break; - node = node.return; - } + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); list.expirationTime < renderExpirationTime && (list.expirationTime = renderExpirationTime); break; @@ -6464,7 +7022,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( current$$1, workInProgress, - context.children, + renderState.children, renderExpirationTime ); workInProgress = workInProgress.child; @@ -6472,12 +7030,15 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { return workInProgress; case 9: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = workInProgress.pendingProps), (updateExpirationTime = hasContext.children), prepareToReadContext(workInProgress, renderExpirationTime), - (context = readContext(context, hasContext.unstable_observedBits)), - (updateExpirationTime = updateExpirationTime(context)), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), (workInProgress.effectTag |= 1), reconcileChildren( current$$1, @@ -6489,16 +7050,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); case 14: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = resolveDefaultProps( - context, + renderState, workInProgress.pendingProps )), - (hasContext = resolveDefaultProps(context.type, hasContext)), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), updateMemoComponent( current$$1, workInProgress, - context, + renderState, hasContext, updateExpirationTime, renderExpirationTime @@ -6516,11 +7077,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 17: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), @@ -6533,13 +7094,13 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { constructClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), mountClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), finishClassComponent( @@ -6551,19 +7112,249 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ) ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); }; +var onCommitFiberRoot = null, + onCommitFiberUnmount = null; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root) { + try { + hook.onCommitFiberRoot( + rendererID, + root, + void 0, + 64 === (root.current.effectTag & 64) + ); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; +} function findHostInstance(component) { var fiber = component._reactInternalFiber; if (void 0 === fiber) { if ("function" === typeof component.render) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } component = findCurrentHostFiber(fiber); @@ -6571,8 +7362,13 @@ function findHostInstance(component) { } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current, - currentTime = requestCurrentTime(); - current$$1 = computeExpirationForFiber(currentTime, current$$1); + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); currentTime = container.current; a: if (parentComponent) { parentComponent = parentComponent._reactInternalFiber; @@ -6582,7 +7378,9 @@ function updateContainer(element, container, parentComponent, callback) { 1 !== parentComponent.tag ) throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) ); var parentContext = parentComponent; do { @@ -6601,7 +7399,9 @@ function updateContainer(element, container, parentComponent, callback) { parentContext = parentContext.return; } while (null !== parentContext); throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (1 === parentComponent.tag) { @@ -6621,12 +7421,11 @@ function updateContainer(element, container, parentComponent, callback) { ? (container.context = parentComponent) : (container.pendingContext = parentComponent); container = callback; - callback = createUpdate(current$$1); - callback.payload = { element: element }; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; container = void 0 === container ? null : container; - null !== container && (callback.callback = container); - flushPassiveEffects(); - enqueueUpdate(currentTime, callback); + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); scheduleUpdateOnFiber(currentTime, current$$1); return current$$1; } @@ -6641,7 +7440,7 @@ function createPortal(children, containerInfo, implementation) { implementation: implementation }; } -function _inherits(subClass, superClass) { +function _inherits$1(subClass, superClass) { if ("function" !== typeof superClass && null !== superClass) throw new TypeError( "Super expression must either be null or a function, not " + @@ -6663,9 +7462,10 @@ function _inherits(subClass, superClass) { var getInspectorDataForViewTag = void 0; getInspectorDataForViewTag = function() { throw ReactError( - "getInspectorDataForViewTag() is not available in production" + Error("getInspectorDataForViewTag() is not available in production") ); }; +var fabricDispatchCommand = nativeFabricUIManager.dispatchCommand; function findNodeHandle(componentOrHandle) { if (null == componentOrHandle) return null; if ("number" === typeof componentOrHandle) return componentOrHandle; @@ -6679,19 +7479,19 @@ function findNodeHandle(componentOrHandle) { ? componentOrHandle.canonical._nativeTag : componentOrHandle._nativeTag; } -_batchedUpdatesImpl = function(fn, a) { - if (0 !== workPhase) return fn(a); - workPhase = 1; +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; try { return fn(a); } finally { - (workPhase = 0), flushImmediateQueue(); + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); } }; -_flushInteractiveUpdatesImpl = function() { - workPhase !== RenderPhase && - workPhase !== CommitPhase && - flushPendingDiscreteUpdates(); +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); }; var roots = new Map(), ReactFabric = { @@ -6710,12 +7510,16 @@ var roots = new Map(), ? this : call; } - _inherits(ReactNativeComponent, _React$Component); + _inherits$1(ReactNativeComponent, _React$Component); ReactNativeComponent.prototype.blur = function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.focus = function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.measure = function(callback) { var maybeInstance = void 0; @@ -6728,7 +7532,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6744,7 +7548,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6766,7 +7570,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -6790,7 +7594,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -6802,10 +7606,19 @@ var roots = new Map(), })(findNodeHandle, findHostInstance), findNodeHandle: findNodeHandle, setNativeProps: function() {}, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + null != handle._internalInstanceHandle && + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, render: function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, !1); + root = new FiberRootNode(containerTag, 0, !1); var uninitializedFiber = createFiber(3, null, null, 0); root.current = uninitializedFiber; uninitializedFiber.stateNode = root; @@ -6852,7 +7665,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6868,7 +7681,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6886,7 +7699,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -6910,7 +7723,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -6918,10 +7731,14 @@ var roots = new Map(), } }, focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; })(findNodeHandle, findHostInstance) @@ -6944,7 +7761,12 @@ var roots = new Map(), return findFiberByHostInstance ? findFiberByHostInstance(instance) : null; - } + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null }) ); })({ diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js new file mode 100644 index 00000000000000..0b076cf2fb1f1e --- /dev/null +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -0,0 +1,8016 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +"use strict"; +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), + React = require("react"), + Scheduler = require("scheduler"), + tracing = require("scheduler/tracing"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} +var eventPluginOrder = null, + namesToPlugins = {}; +function recomputePluginOrdering() { + if (eventPluginOrder) + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName], + pluginIndex = eventPluginOrder.indexOf(pluginName); + if (!(-1 < pluginIndex)) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + if (!plugins[pluginIndex]) { + if (!pluginModule.extractEvents) + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + plugins[pluginIndex] = pluginModule; + pluginIndex = pluginModule.eventTypes; + for (var eventName in pluginIndex) { + var JSCompiler_inline_result = void 0; + var dispatchConfig = pluginIndex[eventName], + pluginModule$jscomp$0 = pluginModule, + eventName$jscomp$0 = eventName; + if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) + ); + eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (JSCompiler_inline_result in phasedRegistrationNames) + phasedRegistrationNames.hasOwnProperty( + JSCompiler_inline_result + ) && + publishRegistrationName( + phasedRegistrationNames[JSCompiler_inline_result], + pluginModule$jscomp$0, + eventName$jscomp$0 + ); + JSCompiler_inline_result = !0; + } else + dispatchConfig.registrationName + ? (publishRegistrationName( + dispatchConfig.registrationName, + pluginModule$jscomp$0, + eventName$jscomp$0 + ), + (JSCompiler_inline_result = !0)) + : (JSCompiler_inline_result = !1); + if (!JSCompiler_inline_result) + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + } + } +} +function publishRegistrationName(registrationName, pluginModule) { + if (registrationNameModules[registrationName]) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + registrationNameModules[registrationName] = pluginModule; +} +var plugins = [], + eventNameDispatchConfigs = {}, + registrationNameModules = {}; +function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +} +var hasError = !1, + caughtError = null, + hasRethrowError = !1, + rethrowError = null, + reporter = { + onError: function(error) { + hasError = !0; + caughtError = error; + } + }; +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = !1; + caughtError = null; + invokeGuardedCallbackImpl.apply(reporter, arguments); +} +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + if (hasError) { + var error = caughtError; + hasError = !1; + caughtError = null; + } else + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); + } +} +var getFiberCurrentPropsFromNode = null, + getInstanceFromNode = null, + getNodeFromInstance = null; +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + event.currentTarget = null; +} +function executeDirectDispatch(event) { + var dispatchListener = event._dispatchListeners, + dispatchInstance = event._dispatchInstances; + if (Array.isArray(dispatchListener)) + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + dispatchListener = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return dispatchListener; +} +function accumulateInto(current, next) { + if (null == next) + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + if (null == current) return next; + if (Array.isArray(current)) { + if (Array.isArray(next)) return current.push.apply(current, next), current; + current.push(next); + return current; + } + return Array.isArray(next) ? [current].concat(next) : [current, next]; +} +function forEachAccumulated(arr, cb, scope) { + Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr); +} +var eventQueue = null; +function executeDispatchesAndReleaseTopLevel(e) { + if (e) { + var dispatchListeners = e._dispatchListeners, + dispatchInstances = e._dispatchInstances; + if (Array.isArray(dispatchListeners)) + for ( + var i = 0; + i < dispatchListeners.length && !e.isPropagationStopped(); + i++ + ) + executeDispatch(e, dispatchListeners[i], dispatchInstances[i]); + else + dispatchListeners && + executeDispatch(e, dispatchListeners, dispatchInstances); + e._dispatchListeners = null; + e._dispatchInstances = null; + e.isPersistent() || e.constructor.release(e); + } +} +var injection = { + injectEventPluginOrder: function(injectedEventPluginOrder) { + if (eventPluginOrder) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); + }, + injectEventPluginsByName: function(injectedNamesToPlugins) { + var isOrderingDirty = !1, + pluginName; + for (pluginName in injectedNamesToPlugins) + if (injectedNamesToPlugins.hasOwnProperty(pluginName)) { + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + if (namesToPlugins[pluginName]) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = !0; + } + } + isOrderingDirty && recomputePluginOrdering(); + } +}; +function getListener(inst, registrationName) { + var listener = inst.stateNode; + if (!listener) return null; + var props = getFiberCurrentPropsFromNode(listener); + if (!props) return null; + listener = props[registrationName]; + a: switch (registrationName) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + (props = !props.disabled) || + ((inst = inst.type), + (props = !( + "button" === inst || + "input" === inst || + "select" === inst || + "textarea" === inst + ))); + inst = !props; + break a; + default: + inst = !1; + } + if (inst) return null; + if (listener && "function" !== typeof listener) + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + return listener; +} +function getParent(inst) { + do inst = inst.return; + while (inst && 5 !== inst.tag); + return inst ? inst : null; +} +function traverseTwoPhase(inst, fn, arg) { + for (var path = []; inst; ) path.push(inst), (inst = getParent(inst)); + for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg); + for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg); +} +function accumulateDirectionalDispatches(inst, phase, event) { + if ( + (phase = getListener( + inst, + event.dispatchConfig.phasedRegistrationNames[phase] + )) + ) + (event._dispatchListeners = accumulateInto( + event._dispatchListeners, + phase + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + )); +} +function accumulateTwoPhaseDispatchesSingle(event) { + event && + event.dispatchConfig.phasedRegistrationNames && + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); +} +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + targetInst = targetInst ? getParent(targetInst) : null; + traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event); + } +} +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + var inst = event._targetInst; + if (inst && event && event.dispatchConfig.registrationName) { + var listener = getListener(inst, event.dispatchConfig.registrationName); + listener && + ((event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + ))); + } + } +} +function functionThatReturnsTrue() { + return !0; +} +function functionThatReturnsFalse() { + return !1; +} +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + dispatchConfig = this.constructor.Interface; + for (var propName in dispatchConfig) + dispatchConfig.hasOwnProperty(propName) && + ((targetInst = dispatchConfig[propName]) + ? (this[propName] = targetInst(nativeEvent)) + : "target" === propName + ? (this.target = nativeEventTarget) + : (this[propName] = nativeEvent[propName])); + this.isDefaultPrevented = (null != nativeEvent.defaultPrevented + ? nativeEvent.defaultPrevented + : !1 === nativeEvent.returnValue) + ? functionThatReturnsTrue + : functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = !0; + var event = this.nativeEvent; + event && + (event.preventDefault + ? event.preventDefault() + : "unknown" !== typeof event.returnValue && (event.returnValue = !1), + (this.isDefaultPrevented = functionThatReturnsTrue)); + }, + stopPropagation: function() { + var event = this.nativeEvent; + event && + (event.stopPropagation + ? event.stopPropagation() + : "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0), + (this.isPropagationStopped = functionThatReturnsTrue)); + }, + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + isPersistent: functionThatReturnsFalse, + destructor: function() { + var Interface = this.constructor.Interface, + propName; + for (propName in Interface) this[propName] = null; + this.nativeEvent = this._targetInst = this.dispatchConfig = null; + this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse; + this._dispatchInstances = this._dispatchListeners = null; + } +}); +SyntheticEvent.Interface = { + type: null, + target: null, + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; +SyntheticEvent.extend = function(Interface) { + function E() {} + function Class() { + return Super.apply(this, arguments); + } + var Super = this; + E.prototype = Super.prototype; + var prototype = new E(); + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + return Class; +}; +addEventPoolingTo(SyntheticEvent); +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + if (this.eventPool.length) { + var instance = this.eventPool.pop(); + this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; + } + return new this(dispatchConfig, targetInst, nativeEvent, nativeInst); +} +function releasePooledEvent(event) { + if (!(event instanceof this)) + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + event.destructor(); + 10 > this.eventPool.length && this.eventPool.push(event); +} +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} +var ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function() { + return null; + } +}); +function isStartish(topLevelType) { + return "topTouchStart" === topLevelType; +} +function isMoveish(topLevelType) { + return "topTouchMove" === topLevelType; +} +var startDependencies = ["topTouchStart"], + moveDependencies = ["topTouchMove"], + endDependencies = ["topTouchCancel", "topTouchEnd"], + touchBank = [], + touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 + }; +function timestampForTouch(touch) { + return touch.timeStamp || touch.timestamp; +} +function getTouchIdentifier(_ref) { + _ref = _ref.identifier; + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); + return _ref; +} +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch), + touchRecord = touchBank[identifier]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.startPageX = touch.pageX), + (touchRecord.startPageY = touch.pageY), + (touchRecord.startTimeStamp = timestampForTouch(touch)), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchRecord.previousPageX = touch.pageX), + (touchRecord.previousPageY = touch.pageY), + (touchRecord.previousTimeStamp = timestampForTouch(touch))) + : ((touchRecord = { + touchActive: !0, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }), + (touchBank[identifier] = touchRecord)); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch move without a touch start.\nTouch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !1), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch end without a touch start.\nTouch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, 20)); + 20 < touchBank.length && + (printed += " (original size: " + touchBank.length + ")"); + return printed; +} +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchMove); + else if (isStartish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchStart), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches && + (touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier); + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if ( + (nativeEvent.changedTouches.forEach(recordTouchEnd), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches) + ) + for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) + if ( + ((nativeEvent = touchBank[topLevelType]), + null != nativeEvent && nativeEvent.touchActive) + ) { + touchHistory.indexOfSingleActiveTouch = topLevelType; + break; + } + }, + touchHistory: touchHistory +}; +function accumulate(current, next) { + if (null == next) + throw ReactError( + Error("accumulate(...): Accumulated items must not be null or undefined.") + ); + return null == current + ? next + : Array.isArray(current) + ? current.concat(next) + : Array.isArray(next) + ? [current].concat(next) + : [current, next]; +} +var responderInst = null, + trackedTouchCount = 0; +function changeResponder(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (null !== ResponderEventPlugin.GlobalResponderHandler) + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); +} +var eventTypes = { + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: ["topScroll"] + }, + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: ["topSelectionChange"] + }, + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } + }, + ResponderEventPlugin = { + _getResponder: function() { + return responderInst; + }, + eventTypes: eventTypes, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) trackedTouchCount += 1; + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if (0 <= trackedTouchCount) --trackedTouchCount; + else + return ( + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ), + null + ); + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + if ( + targetInst && + (("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) || + (0 < trackedTouchCount && "topSelectionChange" === topLevelType) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ) { + var JSCompiler_temp = isStartish(topLevelType) + ? eventTypes.startShouldSetResponder + : isMoveish(topLevelType) + ? eventTypes.moveShouldSetResponder + : "topSelectionChange" === topLevelType + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; + if (responderInst) + b: { + var JSCompiler_temp$jscomp$0 = responderInst; + for ( + var depthA = 0, tempA = JSCompiler_temp$jscomp$0; + tempA; + tempA = getParent(tempA) + ) + depthA++; + tempA = 0; + for (var tempB = targetInst; tempB; tempB = getParent(tempB)) + tempA++; + for (; 0 < depthA - tempA; ) + (JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0)), + depthA--; + for (; 0 < tempA - depthA; ) + (targetInst = getParent(targetInst)), tempA--; + for (; depthA--; ) { + if ( + JSCompiler_temp$jscomp$0 === targetInst || + JSCompiler_temp$jscomp$0 === targetInst.alternate + ) + break b; + JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0); + targetInst = getParent(targetInst); + } + JSCompiler_temp$jscomp$0 = null; + } + else JSCompiler_temp$jscomp$0 = targetInst; + targetInst = JSCompiler_temp$jscomp$0 === responderInst; + JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp, + JSCompiler_temp$jscomp$0, + nativeEvent, + nativeEventTarget + ); + JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory; + targetInst + ? forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingleSkipTarget + ) + : forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingle + ); + b: { + JSCompiler_temp = JSCompiler_temp$jscomp$0._dispatchListeners; + targetInst = JSCompiler_temp$jscomp$0._dispatchInstances; + if (Array.isArray(JSCompiler_temp)) + for ( + depthA = 0; + depthA < JSCompiler_temp.length && + !JSCompiler_temp$jscomp$0.isPropagationStopped(); + depthA++ + ) { + if ( + JSCompiler_temp[depthA]( + JSCompiler_temp$jscomp$0, + targetInst[depthA] + ) + ) { + JSCompiler_temp = targetInst[depthA]; + break b; + } + } + else if ( + JSCompiler_temp && + JSCompiler_temp(JSCompiler_temp$jscomp$0, targetInst) + ) { + JSCompiler_temp = targetInst; + break b; + } + JSCompiler_temp = null; + } + JSCompiler_temp$jscomp$0._dispatchInstances = null; + JSCompiler_temp$jscomp$0._dispatchListeners = null; + JSCompiler_temp$jscomp$0.isPersistent() || + JSCompiler_temp$jscomp$0.constructor.release( + JSCompiler_temp$jscomp$0 + ); + JSCompiler_temp && JSCompiler_temp !== responderInst + ? ((JSCompiler_temp$jscomp$0 = void 0), + (targetInst = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (targetInst.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(targetInst, accumulateDirectDispatchesSingle), + (depthA = !0 === executeDirectDispatch(targetInst)), + responderInst + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (tempB = + !tempA._dispatchListeners || executeDirectDispatch(tempA)), + tempA.isPersistent() || tempA.constructor.release(tempA), + tempB + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + [targetInst, tempA] + )), + changeResponder(JSCompiler_temp, depthA)) + : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + JSCompiler_temp + )))) + : ((JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + targetInst + )), + changeResponder(JSCompiler_temp, depthA)), + (JSCompiler_temp = JSCompiler_temp$jscomp$0)) + : (JSCompiler_temp = null); + } else JSCompiler_temp = null; + JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); + targetInst = responderInst && isMoveish(topLevelType); + depthA = + responderInst && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); + if ( + (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 + ? eventTypes.responderStart + : targetInst + ? eventTypes.responderMove + : depthA + ? eventTypes.responderEnd + : null) + ) + (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp$jscomp$0, + responderInst, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp = accumulate( + JSCompiler_temp, + JSCompiler_temp$jscomp$0 + )); + JSCompiler_temp$jscomp$0 = + responderInst && "topTouchCancel" === topLevelType; + if ( + (topLevelType = + responderInst && + !JSCompiler_temp$jscomp$0 && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType)) + ) + a: { + if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) + for (targetInst = 0; targetInst < topLevelType.length; targetInst++) + if ( + ((depthA = topLevelType[targetInst].target), + null !== depthA && void 0 !== depthA && 0 !== depthA) + ) { + tempA = getInstanceFromNode(depthA); + b: { + for (depthA = responderInst; tempA; ) { + if (depthA === tempA || depthA === tempA.alternate) { + depthA = !0; + break b; + } + tempA = getParent(tempA); + } + depthA = !1; + } + if (depthA) { + topLevelType = !1; + break a; + } + } + topLevelType = !0; + } + if ( + (topLevelType = JSCompiler_temp$jscomp$0 + ? eventTypes.responderTerminate + : topLevelType + ? eventTypes.responderRelease + : null) + ) + (nativeEvent = ResponderSyntheticEvent.getPooled( + topLevelType, + responderInst, + nativeEvent, + nativeEventTarget + )), + (nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), + (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), + changeResponder(null); + return JSCompiler_temp; + }, + GlobalResponderHandler: null, + injection: { + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } + }, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (null == targetInst) return null; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; + if (!bubbleDispatchConfig && !directDispatchConfig) + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + topLevelType = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) + forEachAccumulated(topLevelType, accumulateTwoPhaseDispatchesSingle); + else if (directDispatchConfig) + forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle); + else return null; + return topLevelType; + } + } +}); +function getInstanceFromInstance(instanceHandle) { + return instanceHandle; +} +getFiberCurrentPropsFromNode = function(inst) { + return inst.canonical.currentProps; +}; +getInstanceFromNode = getInstanceFromInstance; +getNodeFromInstance = function(inst) { + inst = inst.stateNode.canonical._nativeTag; + if (!inst) throw ReactError(Error("All native instances should have a tag.")); + return inst; +}; +ResponderEventPlugin.injection.injectGlobalResponderHandler({ + onChange: function(from, to, blockNativeResponder) { + null !== to + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode.canonical._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); + } +}); +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || + (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); +var hasSymbol = "function" === typeof Symbol && Symbol.for, + REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, + REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, + REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, + REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, + REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114, + REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109, + REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, + REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 60111, + REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, + REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, + REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, + REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); +var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +function getComponentName(type) { + if (null == type) return null; + if ("function" === typeof type) return type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + innerType = innerType.displayName || innerType.name || ""; + return ( + type.displayName || + ("" !== innerType ? "ForwardRef(" + innerType + ")" : "ForwardRef") + ); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: + if ((type = 1 === type._status ? type._result : null)) + return getComponentName(type); + } + return null; +} +require("../shims/ReactFeatureFlags"); +function isFiberMountedImpl(fiber) { + var node = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + if (0 !== (node.effectTag & 2)) return 1; + for (; node.return; ) + if (((node = node.return), 0 !== (node.effectTag & 2))) return 1; + } + return 3 === node.tag ? 2 : 3; +} +function assertIsMounted(fiber) { + if (2 !== isFiberMountedImpl(fiber)) + throw ReactError(Error("Unable to find node on an unmounted component.")); +} +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = isFiberMountedImpl(fiber); + if (3 === alternate) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return 1 === alternate ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + } + if (a.alternate !== b) + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (3 !== a.tag) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return a.stateNode.current === a ? fiber : alternate; +} +function findCurrentHostFiber(parent) { + parent = findCurrentFiberUsingSlowPath(parent); + if (!parent) return null; + for (var node = parent; ; ) { + if (5 === node.tag || 6 === node.tag) return node; + if (node.child) (node.child.return = node), (node = node.child); + else { + if (node === parent) break; + for (; !node.sibling; ) { + if (!node.return || node.return === parent) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return null; +} +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if ( + callback && + ("boolean" !== typeof context.__isMounted || context.__isMounted) + ) + return callback.apply(context, arguments); + }; +} +var emptyObject = {}, + removedKeys = null, + removedKeyCount = 0; +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) + for (var i = node.length; i-- && 0 < removedKeyCount; ) + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + else if (node && 0 < removedKeyCount) + for (i in removedKeys) + if (removedKeys[i]) { + var nextProp = node[i]; + if (void 0 !== nextProp) { + var attributeConfig = validAttributes[i]; + if (attributeConfig) { + "function" === typeof nextProp && (nextProp = !0); + "undefined" === typeof nextProp && (nextProp = null); + if ("object" !== typeof attributeConfig) + updatePayload[i] = nextProp; + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (nextProp = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[i] = nextProp); + removedKeys[i] = !1; + removedKeyCount--; + } + } + } +} +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) return updatePayload; + if (!prevProp || !nextProp) + return nextProp + ? addNestedProperty(updatePayload, nextProp, validAttributes) + : prevProp + ? clearNestedProperty(updatePayload, prevProp, validAttributes) + : updatePayload; + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + var minLength = + prevProp.length < nextProp.length ? prevProp.length : nextProp.length, + i; + for (i = 0; i < minLength; i++) + updatePayload = diffNestedProperty( + updatePayload, + prevProp[i], + nextProp[i], + validAttributes + ); + for (; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + for (; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; + } + return Array.isArray(prevProp) + ? diffProperties( + updatePayload, + ReactNativePrivateInterface.flattenStyle(prevProp), + nextProp, + validAttributes + ) + : diffProperties( + updatePayload, + prevProp, + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) return updatePayload; + if (!Array.isArray(nextProp)) + return diffProperties( + updatePayload, + emptyObject, + nextProp, + validAttributes + ); + for (var i = 0; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; +} +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) return updatePayload; + if (!Array.isArray(prevProp)) + return diffProperties( + updatePayload, + prevProp, + emptyObject, + validAttributes + ); + for (var i = 0; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + return updatePayload; +} +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig, propKey; + for (propKey in nextProps) + if ((attributeConfig = validAttributes[propKey])) { + var prevProp = prevProps[propKey]; + var nextProp = nextProps[propKey]; + "function" === typeof nextProp && + ((nextProp = !0), "function" === typeof prevProp && (prevProp = !0)); + "undefined" === typeof nextProp && + ((nextProp = null), + "undefined" === typeof prevProp && (prevProp = null)); + removedKeys && (removedKeys[propKey] = !1); + if (updatePayload && void 0 !== updatePayload[propKey]) + if ("object" !== typeof attributeConfig) + updatePayload[propKey] = nextProp; + else { + if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[propKey] = attributeConfig); + } + else if (prevProp !== nextProp) + if ("object" !== typeof attributeConfig) + ("object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && + ((updatePayload || (updatePayload = {}))[propKey] = nextProp); + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) { + if ( + void 0 === prevProp || + ("function" === typeof attributeConfig.diff + ? attributeConfig.diff(prevProp, nextProp) + : "object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + ((updatePayload || (updatePayload = {}))[ + propKey + ] = attributeConfig); + } else + (removedKeys = null), + (removedKeyCount = 0), + (updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + )), + 0 < removedKeyCount && + updatePayload && + (restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ), + (removedKeys = null)); + } + for (var _propKey in prevProps) + void 0 === nextProps[_propKey] && + (!(attributeConfig = validAttributes[_propKey]) || + (updatePayload && void 0 !== updatePayload[_propKey]) || + ((prevProp = prevProps[_propKey]), + void 0 !== prevProp && + ("object" !== typeof attributeConfig || + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ? (((updatePayload || (updatePayload = {}))[_propKey] = null), + removedKeys || (removedKeys = {}), + removedKeys[_propKey] || + ((removedKeys[_propKey] = !0), removedKeyCount++)) + : (updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ))))); + return updatePayload; +} +var restoreTarget = null, + restoreQueue = null; +function restoreStateOfTarget(target) { + if (getInstanceFromNode(target)) + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +function batchedUpdatesImpl(fn, bookkeeping) { + return fn(bookkeeping); +} +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) + if ( + (flushDiscreteUpdatesImpl(), + restoreTarget && + ((bookkeeping = restoreTarget), + (fn = restoreQueue), + (restoreQueue = restoreTarget = null), + restoreStateOfTarget(bookkeeping), + fn)) + ) + for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++) + restoreStateOfTarget(fn[bookkeeping]); + } +} +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +(function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() {}; + ReactNativeComponent.prototype.focus = function() {}; + ReactNativeComponent.prototype.measure = function() {}; + ReactNativeComponent.prototype.measureInWindow = function() {}; + ReactNativeComponent.prototype.measureLayout = function() {}; + ReactNativeComponent.prototype.setNativeProps = function() {}; + return ReactNativeComponent; +})(React.Component); +new Map(); +new Map(); +new Set(); +new Map(); +function dispatchEvent(target, topLevelType, nativeEvent) { + batchedUpdates(function() { + var events = nativeEvent.target; + for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { + var possiblePlugin = plugins[i]; + possiblePlugin && + (possiblePlugin = possiblePlugin.extractEvents( + topLevelType, + target, + nativeEvent, + events + )) && + (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); + } + events = events$jscomp$0; + null !== events && (eventQueue = accumulateInto(eventQueue, events)); + events = eventQueue; + eventQueue = null; + if (events) { + forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); + if (eventQueue) + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + if (hasRethrowError) + throw ((events = rethrowError), + (hasRethrowError = !1), + (rethrowError = null), + events); + } + }); +} +function shim$1() { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +var _nativeFabricUIManage$1 = nativeFabricUIManager, + createNode = _nativeFabricUIManage$1.createNode, + cloneNode = _nativeFabricUIManage$1.cloneNode, + cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren, + cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps, + cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps, + createChildNodeSet = _nativeFabricUIManage$1.createChildSet, + appendChildNode = _nativeFabricUIManage$1.appendChild, + appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet, + completeRoot = _nativeFabricUIManage$1.completeRoot, + registerEventHandler = _nativeFabricUIManage$1.registerEventHandler, + fabricMeasure = _nativeFabricUIManage$1.measure, + fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow, + fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout, + getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + nextReactTag = 2; +registerEventHandler && registerEventHandler(dispatchEvent); +var ReactFabricHostComponent = (function() { + function ReactFabricHostComponent( + tag, + viewConfig, + props, + internalInstanceHandle + ) { + if (!(this instanceof ReactFabricHostComponent)) + throw new TypeError("Cannot call a class as a function"); + this._nativeTag = tag; + this.viewConfig = viewConfig; + this.currentProps = props; + this._internalInstanceHandle = internalInstanceHandle; + } + ReactFabricHostComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + ReactFabricHostComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + ReactFabricHostComponent.prototype.measure = function(callback) { + fabricMeasure( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactFabricHostComponent.prototype.measureInWindow = function(callback) { + fabricMeasureInWindow( + this._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactFabricHostComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + "number" !== typeof relativeToNativeNode && + relativeToNativeNode instanceof ReactFabricHostComponent && + fabricMeasureLayout( + this._internalInstanceHandle.stateNode.node, + relativeToNativeNode._internalInstanceHandle.stateNode.node, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + ReactFabricHostComponent.prototype.setNativeProps = function() {}; + return ReactFabricHostComponent; +})(); +function createTextInstance( + text, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + if (!hostContext.isInAParentText) + throw ReactError( + Error("Text strings must be rendered within a component.") + ); + hostContext = nextReactTag; + nextReactTag += 2; + return { + node: createNode( + hostContext, + "RCTRawText", + rootContainerInstance, + { text: text }, + internalInstanceHandle + ) + }; +} +var scheduleTimeout = setTimeout, + cancelTimeout = clearTimeout; +function cloneHiddenInstance(instance) { + var node = instance.node; + var updatePayload = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + instance.canonical.viewConfig.validAttributes + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical + }; +} +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + do { + a: switch (workInProgress.tag) { + case 3: + case 4: + case 6: + case 7: + case 10: + case 9: + var JSCompiler_inline_result = ""; + break a; + default: + var owner = workInProgress._debugOwner, + source = workInProgress._debugSource, + name = getComponentName(workInProgress.type); + JSCompiler_inline_result = null; + owner && (JSCompiler_inline_result = getComponentName(owner.type)); + owner = name; + name = ""; + source + ? (name = + " (at " + + source.fileName.replace(BEFORE_SLASH_RE, "") + + ":" + + source.lineNumber + + ")") + : JSCompiler_inline_result && + (name = " (created by " + JSCompiler_inline_result + ")"); + JSCompiler_inline_result = "\n in " + (owner || "Unknown") + name; + } + info += JSCompiler_inline_result; + workInProgress = workInProgress.return; + } while (workInProgress); + return info; +} +new Set(); +var valueStack = [], + index = -1; +function pop(cursor) { + 0 > index || + ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); +} +function push(cursor, value) { + index++; + valueStack[index] = cursor.current; + cursor.current = value; +} +var emptyContextObject = {}, + contextStackCursor = { current: emptyContextObject }, + didPerformWorkStackCursor = { current: !1 }, + previousContext = emptyContextObject; +function getMaskedContext(workInProgress, unmaskedContext) { + var contextTypes = workInProgress.type.contextTypes; + if (!contextTypes) return emptyContextObject; + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) + return instance.__reactInternalMemoizedMaskedChildContext; + var context = {}, + key; + for (key in contextTypes) context[key] = unmaskedContext[key]; + instance && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return context; +} +function isContextProvider(type) { + type = type.childContextTypes; + return null !== type && void 0 !== type; +} +function popContext(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function popTopLevelContextObject(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function pushTopLevelContextObject(fiber, context, didChange) { + if (contextStackCursor.current !== emptyContextObject) + throw ReactError( + Error( + "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(fiber, type, parentContext) { + var instance = fiber.stateNode; + fiber = type.childContextTypes; + if ("function" !== typeof instance.getChildContext) return parentContext; + instance = instance.getChildContext(); + for (var contextKey in instance) + if (!(contextKey in fiber)) + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + return Object.assign({}, parentContext, instance); +} +function pushContextProvider(workInProgress) { + var instance = workInProgress.stateNode; + instance = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + previousContext = contextStackCursor.current; + push(contextStackCursor, instance, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + return !0; +} +function invalidateContextProvider(workInProgress, type, didChange) { + var instance = workInProgress.stateNode; + if (!instance) + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + didChange + ? ((type = processChildContext(workInProgress, type, previousContext)), + (instance.__reactInternalMemoizedMergedChildContext = type), + pop(didPerformWorkStackCursor, workInProgress), + pop(contextStackCursor, workInProgress), + push(contextStackCursor, type, workInProgress)) + : pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); +} +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, + Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, + Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, + Scheduler_now = Scheduler.unstable_now, + Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel, + Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, + Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, + Scheduler_LowPriority = Scheduler.unstable_LowPriority, + Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; +if ( + null == tracing.__interactionsRef || + null == tracing.__interactionsRef.current +) + throw ReactError( + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) + ); +var fakeCallbackNode = {}, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, + immediateQueueCallbackNode = null, + isFlushingSyncQueue = !1, + initialTimeMs = Scheduler_now(), + now = + 1e4 > initialTimeMs + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return 99; + case Scheduler_UserBlockingPriority: + return 98; + case Scheduler_NormalPriority: + return 97; + case Scheduler_LowPriority: + return 96; + case Scheduler_IdlePriority: + return 95; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case 99: + return Scheduler_ImmediatePriority; + case 98: + return Scheduler_UserBlockingPriority; + case 97: + return Scheduler_NormalPriority; + case 96: + return Scheduler_LowPriority; + case 95: + return Scheduler_IdlePriority; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function runWithPriority$1(reactPriorityLevel, fn) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(reactPriorityLevel, fn); +} +function scheduleCallback(reactPriorityLevel, callback, options) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); +} +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { + null !== immediateQueueCallbackNode && + Scheduler_cancelCallback(immediateQueueCallbackNode); + flushSyncCallbackQueueImpl(); +} +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0; + try { + var queue = syncQueue; + runWithPriority$1(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ), + error); + } finally { + isFlushingSyncQueue = !1; + } + } +} +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (1073741823 === expirationTime) return 99; + if (1 === expirationTime) return 95; + currentTime = + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); + return 0 >= currentTime + ? 99 + : 250 >= currentTime + ? 98 + : 5250 >= currentTime + ? 97 + : 95; +} +function is(x, y) { + return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function shallowEqual(objA, objB) { + if (is(objA, objB)) return !0; + if ( + "object" !== typeof objA || + null === objA || + "object" !== typeof objB || + null === objB + ) + return !1; + var keysA = Object.keys(objA), + keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) + if ( + !hasOwnProperty.call(objB, keysA[keysB]) || + !is(objA[keysA[keysB]], objB[keysA[keysB]]) + ) + return !1; + return !0; +} +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + baseProps = Object.assign({}, baseProps); + Component = Component.defaultProps; + for (var propName in Component) + void 0 === baseProps[propName] && + (baseProps[propName] = Component[propName]); + } + return baseProps; +} +function readLazyComponentType(lazyComponent) { + var result = lazyComponent._result; + switch (lazyComponent._status) { + case 1: + return result; + case 2: + throw result; + case 0: + throw result; + default: + lazyComponent._status = 0; + result = lazyComponent._ctor; + result = result(); + result.then( + function(moduleObject) { + 0 === lazyComponent._status && + ((moduleObject = moduleObject.default), + (lazyComponent._status = 1), + (lazyComponent._result = moduleObject)); + }, + function(error) { + 0 === lazyComponent._status && + ((lazyComponent._status = 2), (lazyComponent._result = error)); + } + ); + switch (lazyComponent._status) { + case 1: + return lazyComponent._result; + case 2: + throw lazyComponent._result; + } + lazyComponent._result = result; + throw result; + } +} +var valueCursor = { current: null }, + currentlyRenderingFiber = null, + lastContextDependency = null, + lastContextWithAllBitsObserved = null; +function resetContextDependencies() { + lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; +} +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + push(valueCursor, context._currentValue2, providerFiber); + context._currentValue2 = nextValue; +} +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + providerFiber.type._context._currentValue2 = currentValue; +} +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextWithAllBitsObserved = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context, observedBits) { + if ( + lastContextWithAllBitsObserved !== context && + !1 !== observedBits && + 0 !== observedBits + ) { + if ("number" !== typeof observedBits || 1073741823 === observedBits) + (lastContextWithAllBitsObserved = context), (observedBits = 1073741823); + observedBits = { context: context, observedBits: observedBits, next: null }; + if (null === lastContextDependency) { + if (null === currentlyRenderingFiber) + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + lastContextDependency = observedBits; + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null + }; + } else lastContextDependency = lastContextDependency.next = observedBits; + } + return context._currentValue2; +} +var hasForceUpdate = !1; +function createUpdateQueue(baseState) { + return { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function cloneUpdateQueue(currentQueue) { + return { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function createUpdate(expirationTime, suspenseConfig) { + return { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + tag: 0, + payload: null, + callback: null, + next: null, + nextEffect: null + }; +} +function appendUpdateToQueue(queue, update) { + null === queue.lastUpdate + ? (queue.firstUpdate = queue.lastUpdate = update) + : ((queue.lastUpdate.next = update), (queue.lastUpdate = update)); +} +function enqueueUpdate(fiber, update) { + var alternate = fiber.alternate; + if (null === alternate) { + var queue1 = fiber.updateQueue; + var queue2 = null; + null === queue1 && + (queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState)); + } else + (queue1 = fiber.updateQueue), + (queue2 = alternate.updateQueue), + null === queue1 + ? null === queue2 + ? ((queue1 = fiber.updateQueue = createUpdateQueue( + fiber.memoizedState + )), + (queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ))) + : (queue1 = fiber.updateQueue = cloneUpdateQueue(queue2)) + : null === queue2 && + (queue2 = alternate.updateQueue = cloneUpdateQueue(queue1)); + null === queue2 || queue1 === queue2 + ? appendUpdateToQueue(queue1, update) + : null === queue1.lastUpdate || null === queue2.lastUpdate + ? (appendUpdateToQueue(queue1, update), + appendUpdateToQueue(queue2, update)) + : (appendUpdateToQueue(queue1, update), (queue2.lastUpdate = update)); +} +function enqueueCapturedUpdate(workInProgress, update) { + var workInProgressQueue = workInProgress.updateQueue; + workInProgressQueue = + null === workInProgressQueue + ? (workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + )) + : ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue); + null === workInProgressQueue.lastCapturedUpdate + ? (workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update) + : ((workInProgressQueue.lastCapturedUpdate.next = update), + (workInProgressQueue.lastCapturedUpdate = update)); +} +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + null !== current && + queue === current.updateQueue && + (queue = workInProgress.updateQueue = cloneUpdateQueue(queue)); + return queue; +} +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case 1: + return ( + (workInProgress = update.payload), + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress + ); + case 3: + workInProgress.effectTag = (workInProgress.effectTag & -2049) | 64; + case 0: + workInProgress = update.payload; + nextProps = + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress; + if (null === nextProps || void 0 === nextProps) break; + return Object.assign({}, prevState, nextProps); + case 2: + hasForceUpdate = !0; + } + return prevState; +} +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = !1; + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + for ( + var newBaseState = queue.baseState, + newFirstUpdate = null, + newExpirationTime = 0, + update = queue.firstUpdate, + resultState = newBaseState; + null !== update; + + ) { + var updateExpirationTime = update.expirationTime; + updateExpirationTime < renderExpirationTime + ? (null === newFirstUpdate && + ((newFirstUpdate = update), (newBaseState = resultState)), + newExpirationTime < updateExpirationTime && + (newExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), + (resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastEffect + ? (queue.firstEffect = queue.lastEffect = update) + : ((queue.lastEffect.nextEffect = update), + (queue.lastEffect = update)))); + update = update.next; + } + updateExpirationTime = null; + for (update = queue.firstCapturedUpdate; null !== update; ) { + var _updateExpirationTime = update.expirationTime; + _updateExpirationTime < renderExpirationTime + ? (null === updateExpirationTime && + ((updateExpirationTime = update), + null === newFirstUpdate && (newBaseState = resultState)), + newExpirationTime < _updateExpirationTime && + (newExpirationTime = _updateExpirationTime)) + : ((resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastCapturedEffect + ? (queue.firstCapturedEffect = queue.lastCapturedEffect = update) + : ((queue.lastCapturedEffect.nextEffect = update), + (queue.lastCapturedEffect = update)))); + update = update.next; + } + null === newFirstUpdate && (queue.lastUpdate = null); + null === updateExpirationTime + ? (queue.lastCapturedUpdate = null) + : (workInProgress.effectTag |= 32); + null === newFirstUpdate && + null === updateExpirationTime && + (newBaseState = resultState); + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = updateExpirationTime; + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; +} +function commitUpdateQueue(finishedWork, finishedQueue, instance) { + null !== finishedQueue.firstCapturedUpdate && + (null !== finishedQueue.lastUpdate && + ((finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate), + (finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate)), + (finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null)); + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} +function commitUpdateEffects(effect, instance) { + for (; null !== effect; ) { + var _callback3 = effect.callback; + if (null !== _callback3) { + effect.callback = null; + var context = instance; + if ("function" !== typeof _callback3) + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) + ); + _callback3.call(context); + } + effect = effect.nextEffect; + } +} +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + ctor = workInProgress.memoizedState; + getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor); + getDerivedStateFromProps = + null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps + ? ctor + : Object.assign({}, ctor, getDerivedStateFromProps); + workInProgress.memoizedState = getDerivedStateFromProps; + nextProps = workInProgress.updateQueue; + null !== nextProps && + 0 === workInProgress.expirationTime && + (nextProps.baseState = getDerivedStateFromProps); +} +var classComponentUpdater = { + isMounted: function(component) { + return (component = component._reactInternalFiber) + ? 2 === isFiberMountedImpl(component) + : !1; + }, + enqueueSetState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueForceUpdate: function(inst, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + } +}; +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + workInProgress = workInProgress.stateNode; + return "function" === typeof workInProgress.shouldComponentUpdate + ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext) + : ctor.prototype && ctor.prototype.isPureReactComponent + ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + : !0; +} +function constructClassInstance(workInProgress, ctor, props) { + var isLegacyContextConsumer = !1, + unmaskedContext = emptyContextObject; + var context = ctor.contextType; + "object" === typeof context && null !== context + ? (context = readContext(context)) + : ((unmaskedContext = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (isLegacyContextConsumer = ctor.contextTypes), + (context = (isLegacyContextConsumer = + null !== isLegacyContextConsumer && void 0 !== isLegacyContextConsumer) + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject)); + ctor = new ctor(props, context); + workInProgress.memoizedState = + null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; + ctor.updater = classComponentUpdater; + workInProgress.stateNode = ctor; + ctor._reactInternalFiber = workInProgress; + isLegacyContextConsumer && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return ctor; +} +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + workInProgress = instance.state; + "function" === typeof instance.componentWillReceiveProps && + instance.componentWillReceiveProps(newProps, nextContext); + "function" === typeof instance.UNSAFE_componentWillReceiveProps && + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + instance.state !== workInProgress && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); +} +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + var contextType = ctor.contextType; + "object" === typeof contextType && null !== contextType + ? (instance.context = readContext(contextType)) + : ((contextType = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (instance.context = getMaskedContext(workInProgress, contextType))); + contextType = workInProgress.updateQueue; + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState)); + contextType = ctor.getDerivedStateFromProps; + "function" === typeof contextType && + (applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps), + (instance.state = workInProgress.memoizedState)); + "function" === typeof ctor.getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ((ctor = instance.state), + "function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount(), + ctor !== instance.state && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null), + (contextType = workInProgress.updateQueue), + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState))); + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4); +} +var isArray = Array.isArray; +function coerceRef(returnFiber, current$$1, element) { + returnFiber = element.ref; + if ( + null !== returnFiber && + "function" !== typeof returnFiber && + "object" !== typeof returnFiber + ) { + if (element._owner) { + element = element._owner; + var inst = void 0; + if (element) { + if (1 !== element.tag) + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + inst = element.stateNode; + } + if (!inst) + throw ReactError( + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + var stringRef = "" + returnFiber; + if ( + null !== current$$1 && + null !== current$$1.ref && + "function" === typeof current$$1.ref && + current$$1.ref._stringRef === stringRef + ) + return current$$1.ref; + current$$1 = function(value) { + var refs = inst.refs; + refs === emptyRefsObject && (refs = inst.refs = {}); + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + }; + current$$1._stringRef = stringRef; + return current$$1; + } + if ("string" !== typeof returnFiber) + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + if (!element._owner) + throw ReactError( + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + return returnFiber; +} +function throwOnInvalidObjectType(returnFiber, newChild) { + if ("textarea" !== returnFiber.type) + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) + ); +} +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (shouldTrackSideEffects) { + var last = returnFiber.lastEffect; + null !== last + ? ((last.nextEffect = childToDelete), + (returnFiber.lastEffect = childToDelete)) + : (returnFiber.firstEffect = returnFiber.lastEffect = childToDelete); + childToDelete.nextEffect = null; + childToDelete.effectTag = 8; + } + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) return null; + for (; null !== currentFirstChild; ) + deleteChild(returnFiber, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return null; + } + function mapRemainingChildren(returnFiber, currentFirstChild) { + for (returnFiber = new Map(); null !== currentFirstChild; ) + null !== currentFirstChild.key + ? returnFiber.set(currentFirstChild.key, currentFirstChild) + : returnFiber.set(currentFirstChild.index, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return returnFiber; + } + function useFiber(fiber, pendingProps, expirationTime) { + fiber = createWorkInProgress(fiber, pendingProps, expirationTime); + fiber.index = 0; + fiber.sibling = null; + return fiber; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) return lastPlacedIndex; + newIndex = newFiber.alternate; + if (null !== newIndex) + return ( + (newIndex = newIndex.index), + newIndex < lastPlacedIndex + ? ((newFiber.effectTag = 2), lastPlacedIndex) + : newIndex + ); + newFiber.effectTag = 2; + return lastPlacedIndex; + } + function placeSingleChild(newFiber) { + shouldTrackSideEffects && + null === newFiber.alternate && + (newFiber.effectTag = 2); + return newFiber; + } + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (null === current$$1 || 6 !== current$$1.tag) + return ( + (current$$1 = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, textContent, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateElement(returnFiber, current$$1, element, expirationTime) { + if (null !== current$$1 && current$$1.elementType === element.type) + return ( + (expirationTime = useFiber(current$$1, element.props, expirationTime)), + (expirationTime.ref = coerceRef(returnFiber, current$$1, element)), + (expirationTime.return = returnFiber), + expirationTime + ); + expirationTime = createFiberFromTypeAndProps( + element.type, + element.key, + element.props, + null, + returnFiber.mode, + expirationTime + ); + expirationTime.ref = coerceRef(returnFiber, current$$1, element); + expirationTime.return = returnFiber; + return expirationTime; + } + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + null === current$$1 || + 4 !== current$$1.tag || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) + return ( + (current$$1 = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, portal.children || [], expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (null === current$$1 || 7 !== current$$1.tag) + return ( + (current$$1 = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, fragment, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function createChild(returnFiber, newChild, expirationTime) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef(returnFiber, null, newChild)), + (expirationTime.return = returnFiber), + expirationTime + ); + case REACT_PORTAL_TYPE: + return ( + (newChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (newChild = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + )), + (newChild.return = returnFiber), + newChild + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + var key = null !== oldFiber ? oldFiber.key : null; + if ("string" === typeof newChild || "number" === typeof newChild) + return null !== key + ? null + : updateTextNode(returnFiber, oldFiber, "" + newChild, expirationTime); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return newChild.key === key + ? newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ) + : updateElement(returnFiber, oldFiber, newChild, expirationTime) + : null; + case REACT_PORTAL_TYPE: + return newChild.key === key + ? updatePortal(returnFiber, oldFiber, newChild, expirationTime) + : null; + } + if (isArray(newChild) || getIteratorFn(newChild)) + return null !== key + ? null + : updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateTextNode( + returnFiber, + existingChildren, + "" + newChild, + expirationTime + ) + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + existingChildren, + newChild.props.children, + expirationTime, + newChild.key + ) + : updateElement( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + updatePortal( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateFragment( + returnFiber, + existingChildren, + newChild, + expirationTime, + null + ) + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + for ( + var resultingFirstChild = null, + previousNewFiber = null, + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null; + null !== oldFiber && newIdx < newChildren.length; + newIdx++ + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (resultingFirstChild = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) + return ( + deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild + ); + if (null === oldFiber) { + for (; newIdx < newChildren.length; newIdx++) + (oldFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + )), + null !== oldFiber && + ((currentFirstChild = placeChild( + oldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = oldFiber) + : (previousNewFiber.sibling = oldFiber), + (previousNewFiber = oldFiber)); + return resultingFirstChild; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + newIdx < newChildren.length; + newIdx++ + ) + (nextOldFiber = updateFromMap( + oldFiber, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + )), + null !== nextOldFiber && + (shouldTrackSideEffects && + null !== nextOldFiber.alternate && + oldFiber.delete( + null === nextOldFiber.key ? newIdx : nextOldFiber.key + ), + (currentFirstChild = placeChild( + nextOldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = nextOldFiber) + : (previousNewFiber.sibling = nextOldFiber), + (previousNewFiber = nextOldFiber)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + var iteratorFn = getIteratorFn(newChildrenIterable); + if ("function" !== typeof iteratorFn) + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + newChildrenIterable = iteratorFn.call(newChildrenIterable); + if (null == newChildrenIterable) + throw ReactError(Error("An iterable object provided no iterator.")); + for ( + var previousNewFiber = (iteratorFn = null), + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null, + step = newChildrenIterable.next(); + null !== oldFiber && !step.done; + newIdx++, step = newChildrenIterable.next() + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (iteratorFn = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) + return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn; + if (null === oldFiber) { + for (; !step.done; newIdx++, step = newChildrenIterable.next()) + (step = createChild(returnFiber, step.value, expirationTime)), + null !== step && + ((currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + return iteratorFn; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + !step.done; + newIdx++, step = newChildrenIterable.next() + ) + (step = updateFromMap( + oldFiber, + returnFiber, + newIdx, + step.value, + expirationTime + )), + null !== step && + (shouldTrackSideEffects && + null !== step.alternate && + oldFiber.delete(null === step.key ? newIdx : step.key), + (currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return iteratorFn; + } + return function(returnFiber, currentFirstChild, newChild, expirationTime) { + var isUnkeyedTopLevelFragment = + "object" === typeof newChild && + null !== newChild && + newChild.type === REACT_FRAGMENT_TYPE && + null === newChild.key; + isUnkeyedTopLevelFragment && (newChild = newChild.props.children); + var isObject = "object" === typeof newChild && null !== newChild; + if (isObject) + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + a: { + isObject = newChild.key; + for ( + isUnkeyedTopLevelFragment = currentFirstChild; + null !== isUnkeyedTopLevelFragment; + + ) { + if (isUnkeyedTopLevelFragment.key === isObject) { + if ( + 7 === isUnkeyedTopLevelFragment.tag + ? newChild.type === REACT_FRAGMENT_TYPE + : isUnkeyedTopLevelFragment.elementType === newChild.type + ) { + deleteRemainingChildren( + returnFiber, + isUnkeyedTopLevelFragment.sibling + ); + currentFirstChild = useFiber( + isUnkeyedTopLevelFragment, + newChild.type === REACT_FRAGMENT_TYPE + ? newChild.props.children + : newChild.props, + expirationTime + ); + currentFirstChild.ref = coerceRef( + returnFiber, + isUnkeyedTopLevelFragment, + newChild + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, isUnkeyedTopLevelFragment); + break; + } else deleteChild(returnFiber, isUnkeyedTopLevelFragment); + isUnkeyedTopLevelFragment = isUnkeyedTopLevelFragment.sibling; + } + newChild.type === REACT_FRAGMENT_TYPE + ? ((currentFirstChild = createFiberFromFragment( + newChild.props.children, + returnFiber.mode, + expirationTime, + newChild.key + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : ((expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef( + returnFiber, + currentFirstChild, + newChild + )), + (expirationTime.return = returnFiber), + (returnFiber = expirationTime)); + } + return placeSingleChild(returnFiber); + case REACT_PORTAL_TYPE: + a: { + for ( + isUnkeyedTopLevelFragment = newChild.key; + null !== currentFirstChild; + + ) { + if (currentFirstChild.key === isUnkeyedTopLevelFragment) { + if ( + 4 === currentFirstChild.tag && + currentFirstChild.stateNode.containerInfo === + newChild.containerInfo && + currentFirstChild.stateNode.implementation === + newChild.implementation + ) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + currentFirstChild = useFiber( + currentFirstChild, + newChild.children || [], + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + currentFirstChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + } + return placeSingleChild(returnFiber); + } + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = "" + newChild), + null !== currentFirstChild && 6 === currentFirstChild.tag + ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), + (currentFirstChild = useFiber( + currentFirstChild, + newChild, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : (deleteRemainingChildren(returnFiber, currentFirstChild), + (currentFirstChild = createFiberFromText( + newChild, + returnFiber.mode, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)), + placeSingleChild(returnFiber) + ); + if (isArray(newChild)) + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + if (getIteratorFn(newChild)) + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + isObject && throwOnInvalidObjectType(returnFiber, newChild); + if ("undefined" === typeof newChild && !isUnkeyedTopLevelFragment) + switch (returnFiber.tag) { + case 1: + case 0: + throw ((returnFiber = returnFiber.type), + ReactError( + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + )); + } + return deleteRemainingChildren(returnFiber, currentFirstChild); + }; +} +var reconcileChildFibers = ChildReconciler(!0), + mountChildFibers = ChildReconciler(!1), + NO_CONTEXT = {}, + contextStackCursor$1 = { current: NO_CONTEXT }, + contextFiberStackCursor = { current: NO_CONTEXT }, + rootInstanceStackCursor = { current: NO_CONTEXT }; +function requiredContext(c) { + if (c === NO_CONTEXT) + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + return c; +} +function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, NO_CONTEXT, fiber); + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, { isInAParentText: !1 }, fiber); +} +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} +function pushHostContext(fiber) { + requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = fiber.type; + nextContext = + "AndroidTextInput" === nextContext || + "RCTMultilineTextInputView" === nextContext || + "RCTSinglelineTextInputView" === nextContext || + "RCTText" === nextContext || + "RCTVirtualText" === nextContext; + nextContext = + context.isInAParentText !== nextContext + ? { isInAParentText: nextContext } + : context; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor$1, nextContext, fiber)); +} +function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); +} +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} +var NoEffect$1 = 0, + UnmountSnapshot = 2, + UnmountMutation = 4, + MountMutation = 8, + UnmountLayout = 16, + MountLayout = 32, + MountPassive = 64, + UnmountPassive = 128, + ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, + renderExpirationTime$1 = 0, + currentlyRenderingFiber$1 = null, + currentHook = null, + nextCurrentHook = null, + firstWorkInProgressHook = null, + workInProgressHook = null, + nextWorkInProgressHook = null, + remainingExpirationTime = 0, + componentUpdateQueue = null, + sideEffectTag = 0, + didScheduleRenderPhaseUpdate = !1, + renderPhaseUpdates = null, + numberOfReRenders = 0; +function throwInvalidHookError() { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); +} +function areHookInputsEqual(nextDeps, prevDeps) { + if (null === prevDeps) return !1; + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) + if (!is(nextDeps[i], prevDeps[i])) return !1; + return !0; +} +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = null !== current ? current.memoizedState : null; + ReactCurrentDispatcher$1.current = + null === nextCurrentHook ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; + workInProgress = Component(props, refOrContext); + if (didScheduleRenderPhaseUpdate) { + do + (didScheduleRenderPhaseUpdate = !1), + (numberOfReRenders += 1), + (nextCurrentHook = null !== current ? current.memoizedState : null), + (nextWorkInProgressHook = firstWorkInProgressHook), + (componentUpdateQueue = workInProgressHook = currentHook = null), + (ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate), + (workInProgress = Component(props, refOrContext)); + while (didScheduleRenderPhaseUpdate); + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + current = currentlyRenderingFiber$1; + current.memoizedState = firstWorkInProgressHook; + current.expirationTime = remainingExpirationTime; + current.updateQueue = componentUpdateQueue; + current.effectTag |= sideEffectTag; + current = null !== currentHook && null !== currentHook.next; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + if (current) + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + return workInProgress; +} +function resetHooks() { + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + didScheduleRenderPhaseUpdate = !1; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + queue: null, + baseUpdate: null, + next: null + }; + null === workInProgressHook + ? (firstWorkInProgressHook = workInProgressHook = hook) + : (workInProgressHook = workInProgressHook.next = hook); + return workInProgressHook; +} +function updateWorkInProgressHook() { + if (null !== nextWorkInProgressHook) + (workInProgressHook = nextWorkInProgressHook), + (nextWorkInProgressHook = workInProgressHook.next), + (currentHook = nextCurrentHook), + (nextCurrentHook = null !== currentHook ? currentHook.next : null); + else { + if (null === nextCurrentHook) + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + currentHook = nextCurrentHook; + var newHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + next: null + }; + workInProgressHook = + null === workInProgressHook + ? (firstWorkInProgressHook = newHook) + : (workInProgressHook.next = newHook); + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} +function basicStateReducer(state, action) { + return "function" === typeof action ? action(state) : action; +} +function updateReducer(reducer) { + var hook = updateWorkInProgressHook(), + queue = hook.queue; + if (null === queue) + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + queue.lastRenderedReducer = reducer; + if (0 < numberOfReRenders) { + var _dispatch = queue.dispatch; + if (null !== renderPhaseUpdates) { + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (void 0 !== firstRenderPhaseUpdate) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + do + (newState = reducer(newState, firstRenderPhaseUpdate.action)), + (firstRenderPhaseUpdate = firstRenderPhaseUpdate.next); + while (null !== firstRenderPhaseUpdate); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate === queue.last && (hook.baseState = newState); + queue.lastRenderedState = newState; + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + _dispatch = queue.last; + var baseUpdate = hook.baseUpdate; + newState = hook.baseState; + null !== baseUpdate + ? (null !== _dispatch && (_dispatch.next = null), + (_dispatch = baseUpdate.next)) + : (_dispatch = null !== _dispatch ? _dispatch.next : null); + if (null !== _dispatch) { + var newBaseUpdate = (firstRenderPhaseUpdate = null), + _update = _dispatch, + didSkip = !1; + do { + var updateExpirationTime = _update.expirationTime; + updateExpirationTime < renderExpirationTime$1 + ? (didSkip || + ((didSkip = !0), + (newBaseUpdate = baseUpdate), + (firstRenderPhaseUpdate = newState)), + updateExpirationTime > remainingExpirationTime && + (remainingExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), + (newState = + _update.eagerReducer === reducer + ? _update.eagerState + : reducer(newState, _update.action))); + baseUpdate = _update; + _update = _update.next; + } while (null !== _update && _update !== _dispatch); + didSkip || + ((newBaseUpdate = baseUpdate), (firstRenderPhaseUpdate = newState)); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = firstRenderPhaseUpdate; + queue.lastRenderedState = newState; + } + return [hook.memoizedState, queue.dispatch]; +} +function pushEffect(tag, create, destroy, deps) { + tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; + null === componentUpdateQueue + ? ((componentUpdateQueue = { lastEffect: null }), + (componentUpdateQueue.lastEffect = tag.next = tag)) + : ((create = componentUpdateQueue.lastEffect), + null === create + ? (componentUpdateQueue.lastEffect = tag.next = tag) + : ((destroy = create.next), + (create.next = tag), + (tag.next = destroy), + (componentUpdateQueue.lastEffect = tag))); + return tag; +} +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect( + hookEffectTag, + create, + void 0, + void 0 === deps ? null : deps + ); +} +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var destroy = void 0; + if (null !== currentHook) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (null !== deps && areHookInputsEqual(deps, prevEffect.deps)) { + pushEffect(NoEffect$1, create, destroy, deps); + return; + } + } + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, deps); +} +function imperativeHandleEffect(create, ref) { + if ("function" === typeof ref) + return ( + (create = create()), + ref(create), + function() { + ref(null); + } + ); + if (null !== ref && void 0 !== ref) + return ( + (create = create()), + (ref.current = create), + function() { + ref.current = null; + } + ); +} +function mountDebugValue() {} +function dispatchAction(fiber, queue, action) { + if (!(25 > numberOfReRenders)) + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ) + if ( + ((didScheduleRenderPhaseUpdate = !0), + (fiber = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }), + null === renderPhaseUpdates && (renderPhaseUpdates = new Map()), + (action = renderPhaseUpdates.get(queue)), + void 0 === action) + ) + renderPhaseUpdates.set(queue, fiber); + else { + for (queue = action; null !== queue.next; ) queue = queue.next; + queue.next = fiber; + } + else { + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; + else { + var first = _last.next; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; + } + queue.last = _suspenseConfig; + if ( + 0 === fiber.expirationTime && + (null === alternate || 0 === alternate.expirationTime) && + ((alternate = queue.lastRenderedReducer), null !== alternate) + ) + try { + var currentState = queue.lastRenderedState, + _eagerState = alternate(currentState, action); + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; + if (is(_eagerState, currentState)) return; + } catch (error) { + } finally { + } + scheduleUpdateOnFiber(fiber, currentTime); + } +} +var ContextOnlyDispatcher = { + readContext: readContext, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError + }, + HooksDispatcherOnMount = { + readContext: readContext, + useCallback: function(callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return mountEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return mountEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return mountEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + reducer = reducer.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function(initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function(initialState) { + var hook = mountWorkInProgressHook(); + "function" === typeof initialState && (initialState = initialState()); + hook.memoizedState = hook.baseState = initialState; + initialState = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + initialState = initialState.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + initialState + ); + return [hook.memoizedState, initialState]; + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + HooksDispatcherOnUpdate = { + readContext: readContext, + useCallback: function(callback, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + hook.memoizedState = [callback, deps]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return updateEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return updateEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return updateEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: updateReducer, + useRef: function() { + return updateWorkInProgressHook().memoizedState; + }, + useState: function(initialState) { + return updateReducer(basicStateReducer, initialState); + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + now$1 = Scheduler.unstable_now, + commitTime = 0, + profilerStartTime = -1; +function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { + if (0 <= profilerStartTime) { + var elapsedTime = now$1() - profilerStartTime; + fiber.actualDuration += elapsedTime; + overrideBaseTime && (fiber.selfBaseDuration = elapsedTime); + profilerStartTime = -1; + } +} +var hydrationParentFiber = null, + nextHydratableInstance = null, + isHydrating = !1; +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case 5: + return ( + (nextInstance = shim$1(nextInstance, fiber.type, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 6: + return ( + (nextInstance = shim$1(nextInstance, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 13: + return !1; + default: + return !1; + } +} +function tryToClaimNextHydratableInstance(fiber$jscomp$0) { + if (isHydrating) { + var nextInstance = nextHydratableInstance; + if (nextInstance) { + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber$jscomp$0, nextInstance)) { + nextInstance = shim$1(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber$jscomp$0, nextInstance)) { + fiber$jscomp$0.effectTag |= 2; + isHydrating = !1; + hydrationParentFiber = fiber$jscomp$0; + return; + } + var returnFiber = hydrationParentFiber, + fiber = createFiber(5, null, null, 0); + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + fiber.stateNode = firstAttemptedInstance; + fiber.return = returnFiber; + fiber.effectTag = 8; + null !== returnFiber.lastEffect + ? ((returnFiber.lastEffect.nextEffect = fiber), + (returnFiber.lastEffect = fiber)) + : (returnFiber.firstEffect = returnFiber.lastEffect = fiber); + } + hydrationParentFiber = fiber$jscomp$0; + nextHydratableInstance = shim$1(nextInstance); + } else + (fiber$jscomp$0.effectTag |= 2), + (isHydrating = !1), + (hydrationParentFiber = fiber$jscomp$0); + } +} +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner, + didReceiveUpdate = !1; +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + workInProgress.child = + null === current$$1 + ? mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ) + : reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); +} +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + Component = Component.render; + var ref = workInProgress.ref; + prepareToReadContext(workInProgress, renderExpirationTime); + nextProps = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + ref, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + nextProps, + renderExpirationTime + ); + return workInProgress.child; +} +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (null === current$$1) { + var type = Component.type; + if ( + "function" === typeof type && + !shouldConstruct(type) && + void 0 === type.defaultProps && + null === Component.compare && + void 0 === Component.defaultProps + ) + return ( + (workInProgress.tag = 15), + (workInProgress.type = type), + updateSimpleMemoComponent( + current$$1, + workInProgress, + type, + nextProps, + updateExpirationTime, + renderExpirationTime + ) + ); + current$$1 = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); + } + type = current$$1.child; + if ( + updateExpirationTime < renderExpirationTime && + ((updateExpirationTime = type.memoizedProps), + (Component = Component.compare), + (Component = null !== Component ? Component : shallowEqual), + Component(updateExpirationTime, nextProps) && + current$$1.ref === workInProgress.ref) + ) + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + current$$1 = createWorkInProgress(type, nextProps, renderExpirationTime); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); +} +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + return null !== current$$1 && + shallowEqual(current$$1.memoizedProps, nextProps) && + current$$1.ref === workInProgress.ref && + ((didReceiveUpdate = !1), updateExpirationTime < renderExpirationTime) + ? bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + : updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (null === current$$1 && null !== ref) || + (null !== current$$1 && current$$1.ref !== ref) + ) + workInProgress.effectTag |= 128; +} +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor.current; + context = getMaskedContext(workInProgress, context); + prepareToReadContext(workInProgress, renderExpirationTime); + Component = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + Component, + renderExpirationTime + ); + return workInProgress.child; +} +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (isContextProvider(Component)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + prepareToReadContext(workInProgress, renderExpirationTime); + if (null === workInProgress.stateNode) + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + (nextProps = !0); + else if (null === current$$1) { + var instance = workInProgress.stateNode, + oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + var oldContext = instance.context, + contextType = Component.contextType; + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))); + var getDerivedStateFromProps = Component.getDerivedStateFromProps, + hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate; + hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )); + hasForceUpdate = !1; + var oldState = workInProgress.memoizedState; + oldContext = instance.state = oldState; + var updateQueue = workInProgress.updateQueue; + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldContext = workInProgress.memoizedState)); + oldProps !== nextProps || + oldState !== oldContext || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldContext = workInProgress.memoizedState)), + (oldProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldState, + oldContext, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ("function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount()), + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldContext)), + (instance.props = nextProps), + (instance.state = oldContext), + (instance.context = contextType), + (nextProps = oldProps)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (nextProps = !1)); + } else + (instance = workInProgress.stateNode), + (oldProps = workInProgress.memoizedProps), + (instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps)), + (oldContext = instance.context), + (contextType = Component.contextType), + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))), + (getDerivedStateFromProps = Component.getDerivedStateFromProps), + (hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate) || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )), + (hasForceUpdate = !1), + (oldContext = workInProgress.memoizedState), + (oldState = instance.state = oldContext), + (updateQueue = workInProgress.updateQueue), + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldState = workInProgress.memoizedState)), + oldProps !== nextProps || + oldContext !== oldState || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldState = workInProgress.memoizedState)), + (getDerivedStateFromProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldContext, + oldState, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillUpdate && + "function" !== typeof instance.componentWillUpdate) || + ("function" === typeof instance.componentWillUpdate && + instance.componentWillUpdate( + nextProps, + oldState, + contextType + ), + "function" === typeof instance.UNSAFE_componentWillUpdate && + instance.UNSAFE_componentWillUpdate( + nextProps, + oldState, + contextType + )), + "function" === typeof instance.componentDidUpdate && + (workInProgress.effectTag |= 4), + "function" === typeof instance.getSnapshotBeforeUpdate && + (workInProgress.effectTag |= 256)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldState)), + (instance.props = nextProps), + (instance.state = oldState), + (instance.context = contextType), + (nextProps = getDerivedStateFromProps)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (nextProps = !1)); + return finishClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + hasContext, + renderExpirationTime + ); +} +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + markRef(current$$1, workInProgress); + var didCaptureError = 0 !== (workInProgress.effectTag & 64); + if (!shouldUpdate && !didCaptureError) + return ( + hasContext && invalidateContextProvider(workInProgress, Component, !1), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + shouldUpdate = workInProgress.stateNode; + ReactCurrentOwner$3.current = workInProgress; + if ( + didCaptureError && + "function" !== typeof Component.getDerivedStateFromError + ) { + var nextChildren = null; + profilerStartTime = -1; + } else nextChildren = shouldUpdate.render(); + workInProgress.effectTag |= 1; + null !== current$$1 && didCaptureError + ? ((didCaptureError = nextChildren), + (workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + )), + (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + didCaptureError, + renderExpirationTime + ))) + : reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + workInProgress.memoizedState = shouldUpdate.state; + hasContext && invalidateContextProvider(workInProgress, Component, !0); + return workInProgress.child; +} +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + root.pendingContext + ? pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ) + : root.context && + pushTopLevelContextObject(workInProgress, root.context, !1); + pushHostContainer(workInProgress, root.containerInfo); +} +var SUSPENDED_MARKER = {}; +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode, + nextProps = workInProgress.pendingProps, + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), + (nextDidTimeout = !0), + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); + if (null === current$$1) + if (nextDidTimeout) { + nextProps = nextProps.fallback; + current$$1 = createFiberFromFragment(null, mode, 0, null); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; + } else + mode = renderExpirationTime = mountChildFibers( + workInProgress, + null, + nextProps.children, + renderExpirationTime + ); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + if (workInProgress.mode & 8) { + nextDidTimeout = 0; + for ( + suspenseContext = renderExpirationTime.child; + null !== suspenseContext; + + ) + (nextDidTimeout += suspenseContext.treeBaseDuration), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime.treeBaseDuration = nextDidTimeout; + } + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + if (workInProgress.mode & 8) { + suspenseContext = 0; + for (JSCompiler_temp = nextProps.child; null !== JSCompiler_temp; ) + (suspenseContext += JSCompiler_temp.treeBaseDuration), + (JSCompiler_temp = JSCompiler_temp.sibling); + nextProps.treeBaseDuration = suspenseContext; + } + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } + workInProgress.memoizedState = nextState; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; +} +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + null !== current$$1 && + (workInProgress.dependencies = current$$1.dependencies); + profilerStartTime = -1; + if (workInProgress.childExpirationTime < renderExpirationTime) return null; + if (null !== current$$1 && workInProgress.child !== current$$1.child) + throw ReactError(Error("Resuming work not yet implemented.")); + if (null !== workInProgress.child) { + current$$1 = workInProgress.child; + renderExpirationTime = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + ); + workInProgress.child = renderExpirationTime; + for ( + renderExpirationTime.return = workInProgress; + null !== current$$1.sibling; + + ) + (current$$1 = current$$1.sibling), + (renderExpirationTime = renderExpirationTime.sibling = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + )), + (renderExpirationTime.return = workInProgress); + renderExpirationTime.sibling = null; + } + return workInProgress.child; +} +var appendAllChildren = void 0, + updateHostContainer = void 0, + updateHostComponent$1 = void 0, + updateHostText$1 = void 0; +appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden +) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance( + instance, + node.type, + node.memoizedProps, + node + )); + appendChildNode(parent.node, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + appendChildNode(parent.node, instance.node); + } else if (4 !== node.tag) { + if ( + 13 === node.tag && + 0 !== (node.effectTag & 4) && + (instance = null !== node.memoizedState) + ) { + var primaryChildParent = node.child; + if ( + null !== primaryChildParent && + (null !== primaryChildParent.child && + ((primaryChildParent.child.return = primaryChildParent), + appendAllChildren(parent, primaryChildParent, !0, instance)), + (instance = primaryChildParent.sibling), + null !== instance) + ) { + instance.return = node; + node = instance; + continue; + } + } + if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +}; +function appendAllChildrenToContainer( + containerChildSet, + workInProgress, + needsVisibilityToggle, + isHidden +) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance( + instance, + node.type, + node.memoizedProps, + node + )); + appendChildNodeToSet(containerChildSet, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + appendChildNodeToSet(containerChildSet, instance.node); + } else if (4 !== node.tag) { + if ( + 13 === node.tag && + 0 !== (node.effectTag & 4) && + (instance = null !== node.memoizedState) + ) { + var primaryChildParent = node.child; + if ( + null !== primaryChildParent && + (null !== primaryChildParent.child && + ((primaryChildParent.child.return = primaryChildParent), + appendAllChildrenToContainer( + containerChildSet, + primaryChildParent, + !0, + instance + )), + (instance = primaryChildParent.sibling), + null !== instance) + ) { + instance.return = node; + node = instance; + continue; + } + } + if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} +updateHostContainer = function(workInProgress) { + var portalOrRoot = workInProgress.stateNode; + if (null !== workInProgress.firstEffect) { + var container = portalOrRoot.containerInfo, + newChildSet = createChildNodeSet(container); + appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); + portalOrRoot.pendingChildren = newChildSet; + workInProgress.effectTag |= 4; + completeRoot(container, newChildSet); + } +}; +updateHostComponent$1 = function(current, workInProgress, type, newProps) { + type = current.stateNode; + var oldProps = current.memoizedProps; + if ((current = null === workInProgress.firstEffect) && oldProps === newProps) + workInProgress.stateNode = type; + else { + var recyclableInstance = workInProgress.stateNode; + requiredContext(contextStackCursor$1.current); + var updatePayload = null; + oldProps !== newProps && + ((oldProps = diffProperties( + null, + oldProps, + newProps, + recyclableInstance.canonical.viewConfig.validAttributes + )), + (recyclableInstance.canonical.currentProps = newProps), + (updatePayload = oldProps)); + current && null === updatePayload + ? (workInProgress.stateNode = type) + : ((newProps = updatePayload), + (recyclableInstance = type.node), + (type = { + node: current + ? null !== newProps + ? cloneNodeWithNewProps(recyclableInstance, newProps) + : cloneNode(recyclableInstance) + : null !== newProps + ? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps) + : cloneNodeWithNewChildren(recyclableInstance), + canonical: type.canonical + }), + (workInProgress.stateNode = type), + current + ? (workInProgress.effectTag |= 4) + : appendAllChildren(type, workInProgress, !1, !1)); + } +}; +updateHostText$1 = function(current, workInProgress, oldText, newText) { + oldText !== newText && + ((current = requiredContext(rootInstanceStackCursor.current)), + (oldText = requiredContext(contextStackCursor$1.current)), + (workInProgress.stateNode = createTextInstance( + newText, + current, + oldText, + workInProgress + )), + (workInProgress.effectTag |= 4)); +}; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function completeWork(current, workInProgress, renderExpirationTime) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + break; + case 16: + break; + case 15: + case 0: + break; + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + break; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + newProps = workInProgress.stateNode; + newProps.pendingContext && + ((newProps.context = newProps.pendingContext), + (newProps.pendingContext = null)); + if (null === current || null === current.child) + workInProgress.effectTag &= -3; + updateHostContainer(workInProgress); + break; + case 5: + popHostContext(workInProgress); + var rootContainerInstance = requiredContext( + rootInstanceStackCursor.current + ); + renderExpirationTime = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + updateHostComponent$1( + current, + workInProgress, + renderExpirationTime, + newProps, + rootContainerInstance + ), + current.ref !== workInProgress.ref && + (workInProgress.effectTag |= 128); + else if (newProps) { + requiredContext(contextStackCursor$1.current); + current = nextReactTag; + nextReactTag += 2; + renderExpirationTime = getViewConfigForType(renderExpirationTime); + var updatePayload = diffProperties( + null, + emptyObject, + newProps, + renderExpirationTime.validAttributes + ); + rootContainerInstance = createNode( + current, + renderExpirationTime.uiViewClassName, + rootContainerInstance, + updatePayload, + workInProgress + ); + current = new ReactFabricHostComponent( + current, + renderExpirationTime, + newProps, + workInProgress + ); + current = { node: rootContainerInstance, canonical: current }; + appendAllChildren(current, workInProgress, !1, !1); + workInProgress.stateNode = current; + null !== workInProgress.ref && (workInProgress.effectTag |= 128); + } else if (null === workInProgress.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + if (current && null != workInProgress.stateNode) + updateHostText$1( + current, + workInProgress, + current.memoizedProps, + newProps + ); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + current = requiredContext(rootInstanceStackCursor.current); + rootContainerInstance = requiredContext(contextStackCursor$1.current); + workInProgress.stateNode = createTextInstance( + newProps, + current, + rootContainerInstance, + workInProgress + ); + } + break; + case 11: + break; + case 13: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (0 !== (workInProgress.effectTag & 64)) + return ( + (workInProgress.expirationTime = renderExpirationTime), workInProgress + ); + newProps = null !== newProps; + rootContainerInstance = !1; + null !== current && + ((renderExpirationTime = current.memoizedState), + (rootContainerInstance = null !== renderExpirationTime), + newProps || + null === renderExpirationTime || + ((renderExpirationTime = current.child.sibling), + null !== renderExpirationTime && + ((updatePayload = workInProgress.firstEffect), + null !== updatePayload + ? ((workInProgress.firstEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = updatePayload)) + : ((workInProgress.firstEffect = workInProgress.lastEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = null)), + (renderExpirationTime.effectTag = 8)))); + if (newProps && !rootContainerInstance && 0 !== (workInProgress.mode & 2)) + if ( + (null === current && + !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || + 0 !== (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + newProps && (workInProgress.effectTag |= 4); + break; + case 7: + break; + case 8: + break; + case 12: + break; + case 4: + popHostContainer(workInProgress); + updateHostContainer(workInProgress); + break; + case 10: + popProvider(workInProgress); + break; + case 9: + break; + case 14: + break; + case 17: + isContextProvider(workInProgress.type) && popContext(workInProgress); + break; + case 18: + break; + case 19: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (null === newProps) break; + rootContainerInstance = 0 !== (workInProgress.effectTag & 64); + updatePayload = newProps.rendering; + if (null === updatePayload) + if (rootContainerInstance) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = workInProgress.child; null !== current; ) { + updatePayload = findFirstSuspended(current); + if (null !== updatePayload) { + workInProgress.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = updatePayload.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress.firstEffect = workInProgress.lastEffect = null; + current = renderExpirationTime; + for (newProps = workInProgress.child; null !== newProps; ) + (rootContainerInstance = newProps), + (updatePayload = current), + (rootContainerInstance.effectTag &= 2), + (rootContainerInstance.nextEffect = null), + (rootContainerInstance.firstEffect = null), + (rootContainerInstance.lastEffect = null), + (renderExpirationTime = rootContainerInstance.alternate), + null === renderExpirationTime + ? ((rootContainerInstance.childExpirationTime = 0), + (rootContainerInstance.expirationTime = updatePayload), + (rootContainerInstance.child = null), + (rootContainerInstance.memoizedProps = null), + (rootContainerInstance.memoizedState = null), + (rootContainerInstance.updateQueue = null), + (rootContainerInstance.dependencies = null), + (rootContainerInstance.selfBaseDuration = 0), + (rootContainerInstance.treeBaseDuration = 0)) + : ((rootContainerInstance.childExpirationTime = + renderExpirationTime.childExpirationTime), + (rootContainerInstance.expirationTime = + renderExpirationTime.expirationTime), + (rootContainerInstance.child = + renderExpirationTime.child), + (rootContainerInstance.memoizedProps = + renderExpirationTime.memoizedProps), + (rootContainerInstance.memoizedState = + renderExpirationTime.memoizedState), + (rootContainerInstance.updateQueue = + renderExpirationTime.updateQueue), + (updatePayload = renderExpirationTime.dependencies), + (rootContainerInstance.dependencies = + null === updatePayload + ? null + : { + expirationTime: updatePayload.expirationTime, + firstContext: updatePayload.firstContext, + responders: updatePayload.responders + }), + (rootContainerInstance.selfBaseDuration = + renderExpirationTime.selfBaseDuration), + (rootContainerInstance.treeBaseDuration = + renderExpirationTime.treeBaseDuration)), + (newProps = newProps.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + workInProgress + ); + return workInProgress.child; + } + current = current.sibling; + } + } + else { + if (!rootContainerInstance) + if ( + ((current = findFirstSuspended(updatePayload)), null !== current) + ) { + if ( + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress = workInProgress.lastEffect = newProps.lastEffect; + null !== workInProgress && (workInProgress.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime && + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !1), + (current = renderExpirationTime - 1), + (workInProgress.expirationTime = workInProgress.childExpirationTime = current), + null === spawnedWorkDuringRender + ? (spawnedWorkDuringRender = [current]) + : spawnedWorkDuringRender.push(current)); + newProps.isBackwards + ? ((updatePayload.sibling = workInProgress.child), + (workInProgress.child = updatePayload)) + : ((current = newProps.last), + null !== current + ? (current.sibling = updatePayload) + : (workInProgress.child = updatePayload), + (newProps.last = updatePayload)); + } + if (null !== newProps.tail) + return ( + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500), + (current = newProps.tail), + (newProps.rendering = current), + (newProps.tail = current.sibling), + (newProps.lastEffect = workInProgress.lastEffect), + (current.sibling = null), + (newProps = suspenseStackCursor.current), + (newProps = rootContainerInstance + ? (newProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask), + push(suspenseStackCursor, newProps, workInProgress), + current + ); + break; + case 20: + break; + default: + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + return null; +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} +function createCapturedValue(value, source) { + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); +function logCapturedError(capturedError) { + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); +} +var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; +function logError(boundary, errorInfo) { + var source = errorInfo.source, + stack = errorInfo.stack; + null === stack && + null !== source && + (stack = getStackByFiberInDevAndProd(source)); + errorInfo = { + componentName: null !== source ? getComponentName(source.type) : null, + componentStack: null !== stack ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: !1, + willRetry: !1 + }; + null !== boundary && + 1 === boundary.tag && + ((errorInfo.errorBoundary = boundary.stateNode), + (errorInfo.errorBoundaryName = getComponentName(boundary.type)), + (errorInfo.errorBoundaryFound = !0), + (errorInfo.willRetry = !0)); + try { + logCapturedError(errorInfo); + } catch (e) { + setTimeout(function() { + throw e; + }); + } +} +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (null !== ref) + if ("function" === typeof ref) + try { + ref(null); + } catch (refError) { + captureCommitPhaseError(current$$1, refError); + } + else ref.current = null; +} +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + var destroy = effect.destroy; + effect.destroy = void 0; + void 0 !== destroy && destroy(); + } + (effect.tag & mountTag) !== NoEffect$1 && + ((destroy = effect.create), (effect.destroy = destroy())); + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} +function commitWork(current$$1, finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + case 12: + return; + case 13: + null !== finishedWork.memoizedState && + (globalMostRecentFallbackTime = now()); + attachSuspenseRetryListeners(finishedWork); + return; + case 19: + attachSuspenseRetryListeners(finishedWork); + return; + } + switch (finishedWork.tag) { + case 1: + case 5: + case 6: + case 20: + break; + case 3: + case 4: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } +} +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); + thenables.forEach(function(thenable) { + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + retryCache.has(thenable) || + ((retry = tracing.unstable_wrap(retry)), + retryCache.add(thenable), + thenable.then(retry, retry)); + }); + } +} +var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + expirationTime.payload = { element: null }; + var error = errorInfo.value; + expirationTime.callback = function() { + hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); + logError(fiber, errorInfo); + }; + return expirationTime; +} +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if ("function" === typeof getDerivedStateFromError) { + var error = errorInfo.value; + expirationTime.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + var inst = fiber.stateNode; + null !== inst && + "function" === typeof inst.componentDidCatch && + (expirationTime.callback = function() { + "function" !== typeof getDerivedStateFromError && + (null === legacyErrorBoundariesThatAlreadyFailed + ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { + componentStack: null !== stack ? stack : "" + }); + }); + return expirationTime; +} +var ceil = Math.ceil, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, + RootIncomplete = 0, + RootErrored = 1, + RootSuspended = 2, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, + workInProgressRoot = null, + workInProgress = null, + renderExpirationTime = 0, + workInProgressRootExitStatus = RootIncomplete, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, + nextEffect = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, + rootsWithPendingDiscreteUpdates = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null, + spawnedWorkDuringRender = null, + currentEventTime = 0; +function requestCurrentTime() { + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) + : 0 !== currentEventTime + ? currentEventTime + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } + null !== workInProgressRoot && + currentTime === renderExpirationTime && + --currentTime; + return currentTime; +} +function scheduleUpdateOnFiber(fiber, expirationTime) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + )); + fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + scheduleInteractions( + fiber, + expirationTime, + tracing.__interactionsRef.current + ); + for ( + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; + + ) + callback = callback(!0); + } else + scheduleCallbackForRoot(fiber, 99, 1073741823), + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } +} +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + fiber.expirationTime < expirationTime && + (fiber.expirationTime = expirationTime); + var alternate = fiber.alternate; + null !== alternate && + alternate.expirationTime < expirationTime && + (alternate.expirationTime = expirationTime); + var node = fiber.return, + root = null; + if (null === node && 3 === fiber.tag) root = fiber.stateNode; + else + for (; null !== node; ) { + alternate = node.alternate; + node.childExpirationTime < expirationTime && + (node.childExpirationTime = expirationTime); + null !== alternate && + alternate.childExpirationTime < expirationTime && + (alternate.childExpirationTime = expirationTime); + if (null === node.return && 3 === node.tag) { + root = node.stateNode; + break; + } + node = node.return; + } + null !== root && + (expirationTime > root.firstPendingTime && + (root.firstPendingTime = expirationTime), + (fiber = root.lastPendingTime), + 0 === fiber || expirationTime < fiber) && + (root.lastPendingTime = expirationTime); + return root; +} +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + if (root.callbackExpirationTime < expirationTime) { + var existingCallbackNode = root.callbackNode; + null !== existingCallbackNode && + existingCallbackNode !== fakeCallbackNode && + Scheduler_cancelCallback(existingCallbackNode); + root.callbackExpirationTime = expirationTime; + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); + } + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); +} +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode, + continuation = null; + try { + return ( + (continuation = callback(isSync)), + null !== continuation + ? runRootCallback.bind(null, root, continuation) + : null + ); + } finally { + null === continuation && + prevCallbackNode === root.callbackNode && + ((root.callbackNode = null), (root.callbackExpirationTime = 0)); + } +} +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + return null !== firstBatch && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ? (scheduleCallback(97, function() { + firstBatch._onComplete(); + return null; + }), + !0) + : !1; +} +function flushPendingDiscreteUpdates() { + if (null !== rootsWithPendingDiscreteUpdates) { + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + flushSyncCallbackQueue(); + } +} +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + if (null !== workInProgress) + for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { + var interruptedWork = timeoutHandle; + switch (interruptedWork.tag) { + case 1: + var childContextTypes = interruptedWork.type.childContextTypes; + null !== childContextTypes && + void 0 !== childContextTypes && + popContext(interruptedWork); + break; + case 3: + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(interruptedWork); + break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; + case 10: + popProvider(interruptedWork); + } + timeoutHandle = timeoutHandle.return; + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; + spawnedWorkDuringRender = null; +} +function renderRoot(root$jscomp$0, expirationTime, isSync) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + if (root$jscomp$0.firstPendingTime < expirationTime) return null; + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); + flushPassiveEffects(); + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) + prepareFreshStack(root$jscomp$0, expirationTime), + startWorkOnPendingInteractions(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } + if (null !== workInProgress) { + lastPendingTime = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root$jscomp$0.memoizedInteractions; + if (isSync) { + if (1073741823 !== expirationTime) { + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) + return ( + (executionContext = lastPendingTime), + resetContextDependencies(), + (ReactCurrentDispatcher.current = prevDispatcher), + (tracing.__interactionsRef.current = prevInteractions), + renderRoot.bind(null, root$jscomp$0, currentTime) + ); + } + } else currentEventTime = 0; + do + try { + if (isSync) + for (; null !== workInProgress; ) + workInProgress = performUnitOfWork(workInProgress); + else + for (; null !== workInProgress && !Scheduler_shouldYield(); ) + workInProgress = performUnitOfWork(workInProgress); + break; + } catch (thrownValue) { + resetContextDependencies(); + resetHooks(); + currentTime = workInProgress; + if (null === currentTime || null === currentTime.return) + throw (prepareFreshStack(root$jscomp$0, expirationTime), + (executionContext = lastPendingTime), + thrownValue); + currentTime.mode & 8 && + stopProfilerTimerIfRunningAndRecordDelta(currentTime, !0); + a: { + var root = root$jscomp$0, + returnFiber = currentTime.return, + sourceFiber = currentTime, + value = thrownValue, + renderExpirationTime$jscomp$0 = renderExpirationTime; + sourceFiber.effectTag |= 1024; + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + if ( + null !== value && + "object" === typeof value && + "function" === typeof value.then + ) { + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); + value = returnFiber; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { + returnFiber = value.updateQueue; + null === returnFiber + ? ((returnFiber = new Set()), + returnFiber.add(thenable), + (value.updateQueue = returnFiber)) + : returnFiber.add(thenable); + if (0 === (value.mode & 2)) { + value.effectTag |= 64; + sourceFiber.effectTag &= -1957; + 1 === sourceFiber.tag && + (null === sourceFiber.alternate + ? (sourceFiber.tag = 17) + : ((renderExpirationTime$jscomp$0 = createUpdate( + 1073741823, + null + )), + (renderExpirationTime$jscomp$0.tag = 2), + enqueueUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ))); + sourceFiber.expirationTime = 1073741823; + break a; + } + sourceFiber = root; + root = renderExpirationTime$jscomp$0; + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), + (returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), + void 0 === returnFiber && + ((returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber))); + returnFiber.has(root) || + (returnFiber.add(root), + (sourceFiber = pingSuspendedRoot.bind( + null, + sourceFiber, + thenable, + root + )), + (sourceFiber = tracing.unstable_wrap(sourceFiber)), + thenable.then(sourceFiber, sourceFiber)); + value.effectTag |= 2048; + value.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + value = value.return; + } while (null !== value); + value = Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); + value = createCapturedValue(value, sourceFiber); + sourceFiber = returnFiber; + do { + switch (sourceFiber.tag) { + case 3: + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createRootErrorUpdate( + sourceFiber, + value, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + case 1: + if ( + ((thenable = value), + (root = sourceFiber.type), + (returnFiber = sourceFiber.stateNode), + 0 === (sourceFiber.effectTag & 64) && + ("function" === typeof root.getDerivedStateFromError || + (null !== returnFiber && + "function" === typeof returnFiber.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has( + returnFiber + ))))) + ) { + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createClassErrorUpdate( + sourceFiber, + thenable, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + } + } + sourceFiber = sourceFiber.return; + } while (null !== sourceFiber); + } + workInProgress = completeUnitOfWork(currentTime); + } + while (1); + executionContext = lastPendingTime; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + tracing.__interactionsRef.current = prevInteractions; + if (null !== workInProgress) + return renderRoot.bind(null, root$jscomp$0, expirationTime); + } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; + if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; + workInProgressRoot = null; + switch (workInProgressRootExitStatus) { + case RootIncomplete: + throw ReactError(Error("Should have a work-in-progress.")); + case RootErrored: + return ( + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) + : isSync + ? commitRoot.bind(null, root$jscomp$0) + : (prepareFreshStack(root$jscomp$0, expirationTime), + scheduleSyncCallback( + renderRoot.bind(null, root$jscomp$0, expirationTime) + ), + null) + ); + case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: + if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + isSync = root$jscomp$0.lastPendingTime; + if (isSync < expirationTime) + return renderRoot.bind(null, root$jscomp$0, isSync); + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) + return ( + (root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + )), + null + ); + } + return commitRoot.bind(null, root$jscomp$0); + case RootCompleted: + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); + default: + throw ReactError(Error("Unknown root exit status.")); + } +} +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} +function performUnitOfWork(unitOfWork) { + var current$$1 = unitOfWork.alternate; + 0 !== (unitOfWork.mode & 8) + ? ((profilerStartTime = now$1()), + 0 > unitOfWork.actualStartTime && (unitOfWork.actualStartTime = now$1()), + (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)), + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) + : (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current$$1 && (current$$1 = completeUnitOfWork(unitOfWork)); + ReactCurrentOwner$2.current = null; + return current$$1; +} +function completeUnitOfWork(unitOfWork) { + workInProgress = unitOfWork; + do { + var current$$1 = workInProgress.alternate; + unitOfWork = workInProgress.return; + if (0 === (workInProgress.effectTag & 1024)) { + if (0 === (workInProgress.mode & 8)) + current$$1 = completeWork( + current$$1, + workInProgress, + renderExpirationTime + ); + else { + var fiber = workInProgress; + profilerStartTime = now$1(); + 0 > fiber.actualStartTime && (fiber.actualStartTime = now$1()); + current$$1 = completeWork( + current$$1, + workInProgress, + renderExpirationTime + ); + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); + } + fiber = workInProgress; + if (1 === renderExpirationTime || 1 !== fiber.childExpirationTime) { + var newChildExpirationTime = 0; + if (0 !== (fiber.mode & 8)) { + for ( + var actualDuration = fiber.actualDuration, + treeBaseDuration = fiber.selfBaseDuration, + shouldBubbleActualDurations = + null === fiber.alternate || + fiber.child !== fiber.alternate.child, + child = fiber.child; + null !== child; + + ) { + var childUpdateExpirationTime = child.expirationTime, + childChildExpirationTime = child.childExpirationTime; + childUpdateExpirationTime > newChildExpirationTime && + (newChildExpirationTime = childUpdateExpirationTime); + childChildExpirationTime > newChildExpirationTime && + (newChildExpirationTime = childChildExpirationTime); + shouldBubbleActualDurations && + (actualDuration += child.actualDuration); + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + fiber.actualDuration = actualDuration; + fiber.treeBaseDuration = treeBaseDuration; + } else + for (actualDuration = fiber.child; null !== actualDuration; ) + (treeBaseDuration = actualDuration.expirationTime), + (shouldBubbleActualDurations = + actualDuration.childExpirationTime), + treeBaseDuration > newChildExpirationTime && + (newChildExpirationTime = treeBaseDuration), + shouldBubbleActualDurations > newChildExpirationTime && + (newChildExpirationTime = shouldBubbleActualDurations), + (actualDuration = actualDuration.sibling); + fiber.childExpirationTime = newChildExpirationTime; + } + if (null !== current$$1) return current$$1; + null !== unitOfWork && + 0 === (unitOfWork.effectTag & 1024) && + (null === unitOfWork.firstEffect && + (unitOfWork.firstEffect = workInProgress.firstEffect), + null !== workInProgress.lastEffect && + (null !== unitOfWork.lastEffect && + (unitOfWork.lastEffect.nextEffect = workInProgress.firstEffect), + (unitOfWork.lastEffect = workInProgress.lastEffect)), + 1 < workInProgress.effectTag && + (null !== unitOfWork.lastEffect + ? (unitOfWork.lastEffect.nextEffect = workInProgress) + : (unitOfWork.firstEffect = workInProgress), + (unitOfWork.lastEffect = workInProgress))); + } else { + current$$1 = unwindWork(workInProgress, renderExpirationTime); + if (0 !== (workInProgress.mode & 8)) { + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); + fiber = workInProgress.actualDuration; + for ( + newChildExpirationTime = workInProgress.child; + null !== newChildExpirationTime; + + ) + (fiber += newChildExpirationTime.actualDuration), + (newChildExpirationTime = newChildExpirationTime.sibling); + workInProgress.actualDuration = fiber; + } + if (null !== current$$1) + return (current$$1.effectTag &= 1023), current$$1; + null !== unitOfWork && + ((unitOfWork.firstEffect = unitOfWork.lastEffect = null), + (unitOfWork.effectTag |= 1024)); + } + current$$1 = workInProgress.sibling; + if (null !== current$$1) return current$$1; + workInProgress = unitOfWork; + } while (null !== workInProgress); + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootCompleted); + return null; +} +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(99, commitRootImpl.bind(null, root, renderPriorityLevel)); + null !== rootWithPendingPassiveEffects && + scheduleCallback(97, function() { + flushPassiveEffects(); + return null; + }); + return null; +} +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + root.callbackNode = null; + root.callbackExpirationTime = 0; + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, + childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + updateExpirationTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = updateExpirationTimeBeforeCommit; + updateExpirationTimeBeforeCommit < root.lastPendingTime && + (root.lastPendingTime = updateExpirationTimeBeforeCommit); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + ReactCurrentOwner$2.current = null; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (; null !== nextEffect; ) { + if (0 !== (nextEffect.effectTag & 256)) { + var current$$1 = nextEffect.alternate, + finishedWork$jscomp$0 = nextEffect; + switch (finishedWork$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountSnapshot, + NoEffect$1, + finishedWork$jscomp$0 + ); + break; + case 1: + if ( + finishedWork$jscomp$0.effectTag & 256 && + null !== current$$1 + ) { + var prevProps = current$$1.memoizedProps, + prevState = current$$1.memoizedState, + instance = finishedWork$jscomp$0.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + finishedWork$jscomp$0.elementType === + finishedWork$jscomp$0.type + ? prevProps + : resolveDefaultProps( + finishedWork$jscomp$0.type, + prevProps + ), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + case 5: + case 6: + case 4: + case 17: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + commitTime = now$1(); + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { + var effectTag = nextEffect.effectTag; + if (effectTag & 128) { + var current$$1$jscomp$0 = nextEffect.alternate; + if (null !== current$$1$jscomp$0) { + var currentRef = current$$1$jscomp$0.ref; + null !== currentRef && + ("function" === typeof currentRef + ? currentRef(null) + : (currentRef.current = null)); + } + } + switch (effectTag & 14) { + case 2: + nextEffect.effectTag &= -3; + break; + case 6: + nextEffect.effectTag &= -3; + commitWork(nextEffect.alternate, nextEffect); + break; + case 4: + commitWork(nextEffect.alternate, nextEffect); + break; + case 8: + prevProps = nextEffect; + a: for ( + prevState = prevProps, + instance = current$$1, + snapshot = prevState; + ; + + ) + if ( + (commitUnmount(snapshot, instance), null !== snapshot.child) + ) + (snapshot.child.return = snapshot), + (snapshot = snapshot.child); + else { + if (snapshot === prevState) break; + for (; null === snapshot.sibling; ) { + if ( + null === snapshot.return || + snapshot.return === prevState + ) + break a; + snapshot = snapshot.return; + } + snapshot.sibling.return = snapshot.return; + snapshot = snapshot.sibling; + } + detachFiber(prevProps); + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + root.current = finishedWork; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for ( + effectTag = root, current$$1$jscomp$0 = expirationTime; + null !== nextEffect; + + ) { + var effectTag$jscomp$0 = nextEffect.effectTag; + if (effectTag$jscomp$0 & 36) { + prevProps = effectTag; + var current$$1$jscomp$1 = nextEffect.alternate; + currentRef = nextEffect; + current$$1 = current$$1$jscomp$0; + switch (currentRef.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountLayout, MountLayout, currentRef); + break; + case 1: + var instance$jscomp$0 = currentRef.stateNode; + if (currentRef.effectTag & 4) + if (null === current$$1$jscomp$1) + instance$jscomp$0.componentDidMount(); + else { + var prevProps$jscomp$0 = + currentRef.elementType === currentRef.type + ? current$$1$jscomp$1.memoizedProps + : resolveDefaultProps( + currentRef.type, + current$$1$jscomp$1.memoizedProps + ); + instance$jscomp$0.componentDidUpdate( + prevProps$jscomp$0, + current$$1$jscomp$1.memoizedState, + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate + ); + } + var updateQueue = currentRef.updateQueue; + null !== updateQueue && + commitUpdateQueue( + currentRef, + updateQueue, + instance$jscomp$0, + current$$1 + ); + break; + case 3: + var _updateQueue = currentRef.updateQueue; + if (null !== _updateQueue) { + prevProps = null; + if (null !== currentRef.child) + switch (currentRef.child.tag) { + case 5: + prevProps = currentRef.child.stateNode.canonical; + break; + case 1: + prevProps = currentRef.child.stateNode; + } + commitUpdateQueue( + currentRef, + _updateQueue, + prevProps, + current$$1 + ); + } + break; + case 5: + if (null === current$$1$jscomp$1 && currentRef.effectTag & 4) + throw ReactError( + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + break; + case 4: + break; + case 12: + var onRender = currentRef.memoizedProps.onRender; + "function" === typeof onRender && + onRender( + currentRef.memoizedProps.id, + null === current$$1$jscomp$1 ? "mount" : "update", + currentRef.actualDuration, + currentRef.treeBaseDuration, + currentRef.actualStartTime, + commitTime, + prevProps.memoizedInteractions + ); + break; + case 13: + case 19: + case 17: + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + if (effectTag$jscomp$0 & 128) { + var ref = nextEffect.ref; + if (null !== ref) { + var instance$jscomp$1 = nextEffect.stateNode; + switch (nextEffect.tag) { + case 5: + var instanceToUse = instance$jscomp$1.canonical; + break; + default: + instanceToUse = instance$jscomp$1; + } + "function" === typeof ref + ? ref(instanceToUse) + : (ref.current = instanceToUse); + } + } + effectTag$jscomp$0 & 512 && (rootDoesHavePassiveEffects = !0); + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = null; + requestPaint(); + tracing.__interactionsRef.current = prevInteractions; + executionContext = childExpirationTimeBeforeCommit; + } else (root.current = finishedWork), (commitTime = now$1()); + if ((effectTag$jscomp$0 = rootDoesHavePassiveEffects)) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + if (0 !== renderPriorityLevel) { + current$$1$jscomp$1 = requestCurrentTime(); + current$$1$jscomp$1 = inferPriorityFromExpirationTime( + current$$1$jscomp$1, + renderPriorityLevel + ); + if (null !== spawnedWorkDuringRender) + for ( + instance$jscomp$0 = spawnedWorkDuringRender, + spawnedWorkDuringRender = null, + prevProps$jscomp$0 = 0; + prevProps$jscomp$0 < instance$jscomp$0.length; + prevProps$jscomp$0++ + ) + scheduleInteractions( + root, + instance$jscomp$0[prevProps$jscomp$0], + root.memoizedInteractions + ); + scheduleCallbackForRoot(root, current$$1$jscomp$1, renderPriorityLevel); + } else legacyErrorBoundariesThatAlreadyFailed = null; + effectTag$jscomp$0 || finishPendingInteractions(root, expirationTime); + "function" === typeof onCommitFiberRoot && + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + if (hasUncaughtError) + throw ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); + return null; +} +function flushPassiveEffects() { + if (null === rootWithPendingPassiveEffects) return !1; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + for (var effect = root.current.firstEffect; null !== effect; ) { + try { + var finishedWork = effect; + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } + } catch (error) { + if (null === effect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(effect, error); + } + finishedWork = effect.nextEffect; + effect.nextEffect = null; + effect = finishedWork; + } + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + return !0; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1073741823); + enqueueUpdate(rootFiber, sourceFiber); + rootFiber = markUpdateTimeFromFiberToRoot(rootFiber, 1073741823); + null !== rootFiber && scheduleCallbackForRoot(rootFiber, 99, 1073741823); +} +function captureCommitPhaseError(sourceFiber, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (var fiber = sourceFiber.return; null !== fiber; ) { + if (3 === fiber.tag) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + break; + } else if (1 === fiber.tag) { + var instance = fiber.stateNode; + if ( + "function" === typeof fiber.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createClassErrorUpdate(fiber, sourceFiber, 1073741823); + enqueueUpdate(fiber, sourceFiber); + fiber = markUpdateTimeFromFiberToRoot(fiber, 1073741823); + null !== fiber && scheduleCallbackForRoot(fiber, 99, 1073741823); + break; + } + } + fiber = fiber.return; + } +} +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(thenable); + workInProgressRoot === root && renderExpirationTime === suspendedTime + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) + : root.lastPendingTime < suspendedTime || + ((thenable = root.pingTime), + (0 !== thenable && thenable < suspendedTime) || + ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), + (thenable = requestCurrentTime()), + (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), + scheduleCallbackForRoot(root, thenable, suspendedTime))); +} +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = boundaryFiber.stateNode; + null !== retryCache && retryCache.delete(thenable); + retryCache = requestCurrentTime(); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); + retryCache = inferPriorityFromExpirationTime(retryCache, thenable); + boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); + null !== boundaryFiber && + scheduleCallbackForRoot(boundaryFiber, retryCache, thenable); +} +var beginWork$$1 = void 0; +beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + if (null !== current$$1) + if ( + current$$1.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = !1; + switch (workInProgress.tag) { + case 3: + pushHostRootContext(workInProgress); + break; + case 5: + pushHostContext(workInProgress); + break; + case 1: + isContextProvider(workInProgress.type) && + pushContextProvider(workInProgress); + break; + case 4: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case 10: + pushProvider(workInProgress, workInProgress.memoizedProps.value); + break; + case 12: + workInProgress.effectTag |= 4; + break; + case 13: + if (null !== workInProgress.memoizedState) { + updateExpirationTime = workInProgress.child.childExpirationTime; + if ( + 0 !== updateExpirationTime && + updateExpirationTime >= renderExpirationTime + ) + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + return null !== workInProgress ? workInProgress.sibling : null; + } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + else didReceiveUpdate = !1; + workInProgress.expirationTime = 0; + switch (workInProgress.tag) { + case 2: + updateExpirationTime = workInProgress.type; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderExpirationTime); + renderState = renderWithHooks( + null, + workInProgress, + updateExpirationTime, + current$$1, + renderState, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + if ( + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof + ) { + workInProgress.tag = 1; + resetHooks(); + if (isContextProvider(updateExpirationTime)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + workInProgress.memoizedState = + null !== renderState.state && void 0 !== renderState.state + ? renderState.state + : null; + var getDerivedStateFromProps = + updateExpirationTime.getDerivedStateFromProps; + "function" === typeof getDerivedStateFromProps && + applyDerivedStateFromProps( + workInProgress, + updateExpirationTime, + getDerivedStateFromProps, + current$$1 + ); + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; + mountClassInstance( + workInProgress, + updateExpirationTime, + current$$1, + renderExpirationTime + ); + workInProgress = finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + hasContext, + renderExpirationTime + ); + } else + (workInProgress.tag = 0), + reconcileChildren( + null, + workInProgress, + renderState, + renderExpirationTime + ), + (workInProgress = workInProgress.child); + return workInProgress; + case 16: + renderState = workInProgress.elementType; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); + switch (hasContext) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + renderState, + resolveDefaultProps(renderState.type, current$$1), + updateExpirationTime, + renderExpirationTime + ); + break; + default: + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) + ); + } + return workInProgress; + case 0: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateFunctionComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 1: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateClassComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 3: + pushHostRootContext(workInProgress); + updateExpirationTime = workInProgress.updateQueue; + if (null === updateExpirationTime) + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; + processUpdateQueue( + workInProgress, + updateExpirationTime, + workInProgress.pendingProps, + null, + renderExpirationTime + ); + updateExpirationTime = workInProgress.memoizedState.element; + updateExpirationTime === renderState + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + )) + : (reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + (workInProgress = workInProgress.child)); + return workInProgress; + case 5: + return ( + pushHostContext(workInProgress), + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + (updateExpirationTime = workInProgress.pendingProps.children), + markRef(current$$1, workInProgress), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 6: + return ( + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + null + ); + case 13: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case 4: + return ( + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (updateExpirationTime = workInProgress.pendingProps), + null === current$$1 + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + updateExpirationTime, + renderExpirationTime + )) + : reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 11: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateForwardRef( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 7: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps, + renderExpirationTime + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 12: + return ( + (workInProgress.effectTag |= 4), + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 10: + a: { + updateExpirationTime = workInProgress.type._context; + renderState = workInProgress.pendingProps; + getDerivedStateFromProps = workInProgress.memoizedProps; + hasContext = renderState.value; + pushProvider(workInProgress, hasContext); + if (null !== getDerivedStateFromProps) { + var oldValue = getDerivedStateFromProps.value; + hasContext = is(oldValue, hasContext) + ? 0 + : ("function" === typeof updateExpirationTime._calculateChangedBits + ? updateExpirationTime._calculateChangedBits( + oldValue, + hasContext + ) + : 1073741823) | 0; + if (0 === hasContext) { + if ( + getDerivedStateFromProps.children === renderState.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + break a; + } + } else + for ( + oldValue = workInProgress.child, + null !== oldValue && (oldValue.return = workInProgress); + null !== oldValue; + + ) { + var list = oldValue.dependencies; + if (null !== list) { + getDerivedStateFromProps = oldValue.child; + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { + if ( + dependency.context === updateExpirationTime && + 0 !== (dependency.observedBits & hasContext) + ) { + 1 === oldValue.tag && + ((dependency = createUpdate(renderExpirationTime, null)), + (dependency.tag = 2), + enqueueUpdate(oldValue, dependency)); + oldValue.expirationTime < renderExpirationTime && + (oldValue.expirationTime = renderExpirationTime); + dependency = oldValue.alternate; + null !== dependency && + dependency.expirationTime < renderExpirationTime && + (dependency.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); + list.expirationTime < renderExpirationTime && + (list.expirationTime = renderExpirationTime); + break; + } + dependency = dependency.next; + } + } else + getDerivedStateFromProps = + 10 === oldValue.tag + ? oldValue.type === workInProgress.type + ? null + : oldValue.child + : oldValue.child; + if (null !== getDerivedStateFromProps) + getDerivedStateFromProps.return = oldValue; + else + for ( + getDerivedStateFromProps = oldValue; + null !== getDerivedStateFromProps; + + ) { + if (getDerivedStateFromProps === workInProgress) { + getDerivedStateFromProps = null; + break; + } + oldValue = getDerivedStateFromProps.sibling; + if (null !== oldValue) { + oldValue.return = getDerivedStateFromProps.return; + getDerivedStateFromProps = oldValue; + break; + } + getDerivedStateFromProps = getDerivedStateFromProps.return; + } + oldValue = getDerivedStateFromProps; + } + } + reconcileChildren( + current$$1, + workInProgress, + renderState.children, + renderExpirationTime + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: + return ( + (renderState = workInProgress.type), + (hasContext = workInProgress.pendingProps), + (updateExpirationTime = hasContext.children), + prepareToReadContext(workInProgress, renderExpirationTime), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), + (workInProgress.effectTag |= 1), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 14: + return ( + (renderState = workInProgress.type), + (hasContext = resolveDefaultProps( + renderState, + workInProgress.pendingProps + )), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), + updateMemoComponent( + current$$1, + workInProgress, + renderState, + hasContext, + updateExpirationTime, + renderExpirationTime + ) + ); + case 15: + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + case 17: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + (workInProgress.tag = 1), + isContextProvider(updateExpirationTime) + ? ((current$$1 = !0), pushContextProvider(workInProgress)) + : (current$$1 = !1), + prepareToReadContext(workInProgress, renderExpirationTime), + constructClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + current$$1, + renderExpirationTime + ) + ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); +}; +function scheduleInteractions(root, expirationTime, interactions) { + if (0 < interactions.size) { + var pendingInteractionMap = root.pendingInteractionMap, + pendingInteractions = pendingInteractionMap.get(expirationTime); + null != pendingInteractions + ? interactions.forEach(function(interaction) { + pendingInteractions.has(interaction) || interaction.__count++; + pendingInteractions.add(interaction); + }) + : (pendingInteractionMap.set(expirationTime, new Set(interactions)), + interactions.forEach(function(interaction) { + interaction.__count++; + })); + pendingInteractionMap = tracing.__subscriberRef.current; + if (null !== pendingInteractionMap) + pendingInteractionMap.onWorkScheduled( + interactions, + 1e3 * expirationTime + root.interactionThreadID + ); + } +} +function startWorkOnPendingInteractions(root, expirationTime) { + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + scheduledExpirationTime >= expirationTime && + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + }); + root.memoizedInteractions = interactions; + if (0 < interactions.size) { + var subscriber = tracing.__subscriberRef.current; + if (null !== subscriber) { + root = 1e3 * expirationTime + root.interactionThreadID; + try { + subscriber.onWorkStarted(interactions, root); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } + } + } +} +function finishPendingInteractions(root, committedExpirationTime) { + var earliestRemainingTimeAfterCommit = root.firstPendingTime, + subscriber = void 0; + try { + if ( + ((subscriber = tracing.__subscriberRef.current), + null !== subscriber && 0 < root.memoizedInteractions.size) + ) + subscriber.onWorkStopped( + root.memoizedInteractions, + 1e3 * committedExpirationTime + root.interactionThreadID + ); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } finally { + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + scheduledExpirationTime > earliestRemainingTimeAfterCommit && + (pendingInteractionMap.delete(scheduledExpirationTime), + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; + if (null !== subscriber && 0 === interaction.__count) + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } + })); + }); + } +} +var onCommitFiberRoot = null, + onCommitFiberUnmount = null, + isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = 64 === (root.current.effectTag & 64), + currentTime = requestCurrentTime(), + priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; + this.actualDuration = 0; + this.actualStartTime = -1; + this.treeBaseDuration = this.selfBaseDuration = 0; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null), + (workInProgress.actualDuration = 0), + (workInProgress.actualStartTime = -1)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); +} +function findHostInstance(component) { + var fiber = component._reactInternalFiber; + if (void 0 === fiber) { + if ("function" === typeof component.render) + throw ReactError(Error("Unable to find node on an unmounted component.")); + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + component = findCurrentHostFiber(fiber); + return null === component ? null : component.stateNode; +} +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current, + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + currentTime = container.current; + a: if (parentComponent) { + parentComponent = parentComponent._reactInternalFiber; + b: { + if ( + 2 !== isFiberMountedImpl(parentComponent) || + 1 !== parentComponent.tag + ) + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + var parentContext = parentComponent; + do { + switch (parentContext.tag) { + case 3: + parentContext = parentContext.stateNode.context; + break b; + case 1: + if (isContextProvider(parentContext.type)) { + parentContext = + parentContext.stateNode + .__reactInternalMemoizedMergedChildContext; + break b; + } + } + parentContext = parentContext.return; + } while (null !== parentContext); + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (1 === parentComponent.tag) { + var Component = parentComponent.type; + if (isContextProvider(Component)) { + parentComponent = processChildContext( + parentComponent, + Component, + parentContext + ); + break a; + } + } + parentComponent = parentContext; + } else parentComponent = emptyContextObject; + null === container.context + ? (container.context = parentComponent) + : (container.pendingContext = parentComponent); + container = callback; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; + container = void 0 === container ? null : container; + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); + scheduleUpdateOnFiber(currentTime, current$$1); + return current$$1; +} +function createPortal(children, containerInfo, implementation) { + var key = + 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: REACT_PORTAL_TYPE, + key: null == key ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} +function _inherits$1(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +var getInspectorDataForViewTag = void 0; +getInspectorDataForViewTag = function() { + throw ReactError( + Error("getInspectorDataForViewTag() is not available in production") + ); +}; +var fabricDispatchCommand = nativeFabricUIManager.dispatchCommand; +function findNodeHandle(componentOrHandle) { + if (null == componentOrHandle) return null; + if ("number" === typeof componentOrHandle) return componentOrHandle; + if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag; + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) + return componentOrHandle.canonical._nativeTag; + componentOrHandle = findHostInstance(componentOrHandle); + return null == componentOrHandle + ? componentOrHandle + : componentOrHandle.canonical + ? componentOrHandle.canonical._nativeTag + : componentOrHandle._nativeTag; +} +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; + try { + return fn(a); + } finally { + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); + } +}; +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); +}; +var roots = new Map(), + ReactFabric = { + NativeComponent: (function(findNodeHandle, findHostInstance) { + return (function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || + ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits$1(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.measure = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureInWindow = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }; + ReactNativeComponent.prototype.setNativeProps = function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }; + return ReactNativeComponent; + })(React.Component); + })(findNodeHandle, findHostInstance), + findNodeHandle: findNodeHandle, + setNativeProps: function() {}, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + null != handle._internalInstanceHandle && + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + if (!root) { + root = new FiberRootNode(containerTag, 0, !1); + var uninitializedFiber = 0; + isDevToolsPresent && (uninitializedFiber |= 8); + uninitializedFiber = createFiber(3, null, null, uninitializedFiber); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + a: if (((element = root.current), element.child)) + switch (element.child.tag) { + case 5: + element = element.child.stateNode.canonical; + break a; + default: + element = element.child.stateNode; + } + else element = null; + return element; + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + root && + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + }, + createPortal: function(children, containerTag) { + return createPortal( + children, + containerTag, + null, + 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null + ); + }, + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + NativeMethodsMixin: (function(findNodeHandle, findHostInstance) { + return { + measure: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureInWindow: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureLayout: function(relativeToNativeNode, onSuccess, onFail) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }, + setNativeProps: function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }, + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + })(findNodeHandle, findHostInstance) + } + }; +(function(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: null, + overrideProps: null, + setSuspenseHandler: null, + scheduleUpdate: null, + currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + fiber = findCurrentHostFiber(fiber); + return null === fiber ? null : fiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + return findFiberByHostInstance + ? findFiberByHostInstance(instance) + : null; + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null + }) + ); +})({ + findFiberByHostInstance: getInstanceFromInstance, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 0, + version: "16.8.6", + rendererPackageName: "react-native-renderer" +}); +var ReactFabric$2 = { default: ReactFabric }, + ReactFabric$3 = (ReactFabric$2 && ReactFabric) || ReactFabric$2; +module.exports = ReactFabric$3.default || ReactFabric$3; diff --git a/Libraries/Renderer/oss/ReactFabric-profiling.js b/Libraries/Renderer/implementations/ReactFabric-profiling.js similarity index 74% rename from Libraries/Renderer/oss/ReactFabric-profiling.js rename to Libraries/Renderer/implementations/ReactFabric-profiling.js index fcfe473e5c4921..fe3c3e66758c5e 100644 --- a/Libraries/Renderer/oss/ReactFabric-profiling.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.js @@ -11,21 +11,14 @@ */ "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), - UIManager = require("UIManager"), +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), - deepDiffer = require("deepDiffer"), - flattenStyle = require("flattenStyle"), - TextInputState = require("TextInputState"), - FabricUIManager = require("FabricUIManager"), Scheduler = require("scheduler"), - tracing = require("scheduler/tracing"), - ExceptionsManager = require("ExceptionsManager"); -function ReactError(message) { - message = Error(message); - message.name = "Invariant Violation"; - return message; + tracing = require("scheduler/tracing"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; } var eventPluginOrder = null, namesToPlugins = {}; @@ -36,16 +29,20 @@ function recomputePluginOrdering() { pluginIndex = eventPluginOrder.indexOf(pluginName); if (!(-1 < pluginIndex)) throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -56,9 +53,11 @@ function recomputePluginOrdering() { eventName$jscomp$0 = eventName; if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -84,11 +83,13 @@ function recomputePluginOrdering() { : (JSCompiler_inline_result = !1); if (!JSCompiler_inline_result) throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } } @@ -97,9 +98,11 @@ function recomputePluginOrdering() { function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); registrationNameModules[registrationName] = pluginModule; } @@ -148,7 +151,9 @@ function invokeGuardedCallbackAndCatchFirstError( caughtError = null; } else throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); } @@ -166,7 +171,7 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; if (Array.isArray(dispatchListener)) - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null; @@ -179,7 +184,9 @@ function executeDirectDispatch(event) { function accumulateInto(current, next) { if (null == next) throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); if (null == current) return next; if (Array.isArray(current)) { @@ -216,7 +223,9 @@ var injection = { injectEventPluginOrder: function(injectedEventPluginOrder) { if (eventPluginOrder) throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); recomputePluginOrdering(); @@ -233,9 +242,11 @@ var injection = { ) { if (namesToPlugins[pluginName]) throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); namesToPlugins[pluginName] = pluginModule; isOrderingDirty = !0; @@ -277,11 +288,13 @@ function getListener(inst, registrationName) { if (inst) return null; if (listener && "function" !== typeof listener) throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); return listener; } @@ -445,7 +458,9 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { function releasePooledEvent(event) { if (!(event instanceof this)) throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); event.destructor(); 10 > this.eventPool.length && this.eventPool.push(event); @@ -481,7 +496,8 @@ function timestampForTouch(touch) { } function getTouchIdentifier(_ref) { _ref = _ref.identifier; - if (null == _ref) throw ReactError("Touch object is missing identifier."); + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); return _ref; } function recordTouchStart(touch) { @@ -524,7 +540,7 @@ function recordTouchMove(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch move without a touch start.\nTouch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -542,7 +558,7 @@ function recordTouchEnd(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch end without a touch start.\nTouch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -596,7 +612,7 @@ var ResponderTouchHistoryStore = { function accumulate(current, next) { if (null == next) throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error("accumulate(...): Accumulated items must not be null or undefined.") ); return null == current ? next @@ -618,7 +634,7 @@ function changeResponder(nextResponderInst, blockHostResponder) { blockHostResponder ); } -var eventTypes$1 = { +var eventTypes = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", @@ -681,7 +697,7 @@ var eventTypes$1 = { _getResponder: function() { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, extractEvents: function( topLevelType, targetInst, @@ -710,12 +726,12 @@ var eventTypes$1 = { isMoveish(topLevelType)) ) { var JSCompiler_temp = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : "topSelectionChange" === topLevelType - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; if (responderInst) b: { var JSCompiler_temp$jscomp$0 = responderInst; @@ -801,7 +817,7 @@ var eventTypes$1 = { JSCompiler_temp && JSCompiler_temp !== responderInst ? ((JSCompiler_temp$jscomp$0 = void 0), (targetInst = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -811,7 +827,7 @@ var eventTypes$1 = { (depthA = !0 === executeDirectDispatch(targetInst)), responderInst ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -823,7 +839,7 @@ var eventTypes$1 = { tempA.isPersistent() || tempA.constructor.release(tempA), tempB ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -837,7 +853,7 @@ var eventTypes$1 = { )), changeResponder(JSCompiler_temp, depthA)) : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -867,11 +883,11 @@ var eventTypes$1 = { ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); if ( (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderStart + ? eventTypes.responderStart : targetInst - ? eventTypes$1.responderMove + ? eventTypes.responderMove : depthA - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null) ) (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( @@ -925,9 +941,9 @@ var eventTypes$1 = { } if ( (topLevelType = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : topLevelType - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null) ) (nativeEvent = ResponderSyntheticEvent.getPooled( @@ -949,8 +965,20 @@ var eventTypes$1 = { } } }, - ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, extractEvents: function( topLevelType, targetInst, @@ -958,13 +986,13 @@ var eventTypes$1 = { nativeEventTarget ) { if (null == targetInst) return null; - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType], - directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; if (!bubbleDispatchConfig && !directDispatchConfig) throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); topLevelType = SyntheticEvent.getPooled( bubbleDispatchConfig || directDispatchConfig, @@ -979,14 +1007,7 @@ var eventTypes$1 = { else return null; return topLevelType; } - }; -injection.injectEventPluginOrder([ - "ResponderEventPlugin", - "ReactNativeBridgeEventPlugin" -]); -injection.injectEventPluginsByName({ - ResponderEventPlugin: ResponderEventPlugin, - ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin + } }); function getInstanceFromInstance(instanceHandle) { return instanceHandle; @@ -997,23 +1018,25 @@ getFiberCurrentPropsFromNode = function(inst) { getInstanceFromNode = getInstanceFromInstance; getNodeFromInstance = function(inst) { inst = inst.stateNode.canonical._nativeTag; - if (!inst) throw ReactError("All native instances should have a tag."); + if (!inst) throw ReactError(Error("All native instances should have a tag.")); return inst; }; ResponderEventPlugin.injection.injectGlobalResponderHandler({ onChange: function(from, to, blockNativeResponder) { null !== to - ? UIManager.setJSResponder( + ? ReactNativePrivateInterface.UIManager.setJSResponder( to.stateNode.canonical._nativeTag, blockNativeResponder ) - : UIManager.clearJSResponder(); + : ReactNativePrivateInterface.UIManager.clearJSResponder(); } }); var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); var hasSymbol = "function" === typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, @@ -1027,11 +1050,13 @@ var hasSymbol = "function" === typeof Symbol && Symbol.for, : 60111, REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; -hasSymbol && Symbol.for("react.event_component"); -hasSymbol && Symbol.for("react.event_target"); -hasSymbol && Symbol.for("react.event_target.touch_hit"); +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; @@ -1045,8 +1070,6 @@ function getComponentName(type) { if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -1057,6 +1080,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { @@ -1091,14 +1116,14 @@ function isFiberMountedImpl(fiber) { } function assertIsMounted(fiber) { if (2 !== isFiberMountedImpl(fiber)) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = isFiberMountedImpl(fiber); if (3 === alternate) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return 1 === alternate ? null : fiber; } for (var a = fiber, b = alternate; ; ) { @@ -1119,7 +1144,7 @@ function findCurrentFiberUsingSlowPath(fiber) { if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } if (a.return !== b.return) (a = parentA), (b = parentB); else { @@ -1156,17 +1181,21 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (!didFindChild) throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } } if (a.alternate !== b) throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (3 !== a.tag) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiber(parent) { @@ -1280,14 +1309,14 @@ function diffNestedProperty( return Array.isArray(prevProp) ? diffProperties( updatePayload, - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), nextProp, validAttributes ) : diffProperties( updatePayload, prevProp, - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -1355,7 +1384,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { if ("object" !== typeof attributeConfig) ("object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) && + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && ((updatePayload || (updatePayload = {}))[propKey] = nextProp); else if ( "function" === typeof attributeConfig.diff || @@ -1367,7 +1396,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { ? attributeConfig.diff(prevProp, nextProp) : "object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) ) (attributeConfig = "function" === typeof attributeConfig.process @@ -1419,23 +1448,28 @@ var restoreTarget = null, function restoreStateOfTarget(target) { if (getInstanceFromNode(target)) throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } -function _batchedUpdatesImpl(fn, bookkeeping) { +function batchedUpdatesImpl(fn, bookkeeping) { return fn(bookkeeping); } -function _flushInteractiveUpdatesImpl() {} -var isBatching = !1; +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; function batchedUpdates(fn, bookkeeping) { - if (isBatching) return fn(bookkeeping); - isBatching = !0; + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue)) + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) if ( - (_flushInteractiveUpdatesImpl(), + (flushDiscreteUpdatesImpl(), restoreTarget && ((bookkeeping = restoreTarget), (fn = restoreQueue), @@ -1447,6 +1481,51 @@ function batchedUpdates(fn, bookkeeping) { restoreStateOfTarget(fn[bookkeeping]); } } +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +(function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() {}; + ReactNativeComponent.prototype.focus = function() {}; + ReactNativeComponent.prototype.measure = function() {}; + ReactNativeComponent.prototype.measureInWindow = function() {}; + ReactNativeComponent.prototype.measureLayout = function() {}; + ReactNativeComponent.prototype.setNativeProps = function() {}; + return ReactNativeComponent; +})(React.Component); +new Map(); +new Map(); +new Set(); +new Map(); function dispatchEvent(target, topLevelType, nativeEvent) { batchedUpdates(function() { var events = nativeEvent.target; @@ -1469,7 +1548,9 @@ function dispatchEvent(target, topLevelType, nativeEvent) { forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); if (hasRethrowError) throw ((events = rethrowError), @@ -1481,12 +1562,30 @@ function dispatchEvent(target, topLevelType, nativeEvent) { } function shim$1() { throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) ); } -var nextReactTag = 2; -FabricUIManager.registerEventHandler && - FabricUIManager.registerEventHandler(dispatchEvent); +var _nativeFabricUIManage$1 = nativeFabricUIManager, + createNode = _nativeFabricUIManage$1.createNode, + cloneNode = _nativeFabricUIManage$1.cloneNode, + cloneNodeWithNewChildren = _nativeFabricUIManage$1.cloneNodeWithNewChildren, + cloneNodeWithNewChildrenAndProps = + _nativeFabricUIManage$1.cloneNodeWithNewChildrenAndProps, + cloneNodeWithNewProps = _nativeFabricUIManage$1.cloneNodeWithNewProps, + createChildNodeSet = _nativeFabricUIManage$1.createChildSet, + appendChildNode = _nativeFabricUIManage$1.appendChild, + appendChildNodeToSet = _nativeFabricUIManage$1.appendChildToSet, + completeRoot = _nativeFabricUIManage$1.completeRoot, + registerEventHandler = _nativeFabricUIManage$1.registerEventHandler, + fabricMeasure = _nativeFabricUIManage$1.measure, + fabricMeasureInWindow = _nativeFabricUIManage$1.measureInWindow, + fabricMeasureLayout = _nativeFabricUIManage$1.measureLayout, + getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + nextReactTag = 2; +registerEventHandler && registerEventHandler(dispatchEvent); var ReactFabricHostComponent = (function() { function ReactFabricHostComponent( tag, @@ -1502,19 +1601,19 @@ var ReactFabricHostComponent = (function() { this._internalInstanceHandle = internalInstanceHandle; } ReactFabricHostComponent.prototype.blur = function() { - TextInputState.blurTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); }; ReactFabricHostComponent.prototype.focus = function() { - TextInputState.focusTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); }; ReactFabricHostComponent.prototype.measure = function(callback) { - FabricUIManager.measure( + fabricMeasure( this._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); }; ReactFabricHostComponent.prototype.measureInWindow = function(callback) { - FabricUIManager.measureInWindow( + fabricMeasureInWindow( this._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -1526,7 +1625,7 @@ var ReactFabricHostComponent = (function() { ) { "number" !== typeof relativeToNativeNode && relativeToNativeNode instanceof ReactFabricHostComponent && - FabricUIManager.measureLayout( + fabricMeasureLayout( this._internalInstanceHandle.stateNode.node, relativeToNativeNode._internalInstanceHandle.stateNode.node, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -1544,12 +1643,12 @@ function createTextInstance( ) { if (!hostContext.isInAParentText) throw ReactError( - "Text strings must be rendered within a component." + Error("Text strings must be rendered within a component.") ); hostContext = nextReactTag; nextReactTag += 2; return { - node: FabricUIManager.createNode( + node: createNode( hostContext, "RCTRawText", rootContainerInstance, @@ -1569,7 +1668,7 @@ function cloneHiddenInstance(instance) { instance.canonical.viewConfig.validAttributes ); return { - node: FabricUIManager.cloneNodeWithNewProps(node, updatePayload), + node: cloneNodeWithNewProps(node, updatePayload), canonical: instance.canonical }; } @@ -1659,7 +1758,9 @@ function popTopLevelContextObject(fiber) { function pushTopLevelContextObject(fiber, context, didChange) { if (contextStackCursor.current !== emptyContextObject) throw ReactError( - "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." + Error( + "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); @@ -1672,10 +1773,12 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in instance) if (!(contextKey in fiber)) throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) ); return Object.assign({}, parentContext, instance); } @@ -1697,7 +1800,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.stateNode; if (!instance) throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) ); didChange ? ((type = processChildContext(workInProgress, type, previousContext)), @@ -1708,35 +1813,11 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } -var onCommitFiberRoot = null, - onCommitFiberUnmount = null; -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) {} - }; -} -var isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; -function injectInternals(internals) { - if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled || !hook.supportsFiber) return !0; - try { - var rendererID = hook.inject(internals); - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) {} - return !0; -} var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, @@ -1750,12 +1831,16 @@ if ( null == tracing.__interactionsRef.current ) throw ReactError( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) ); var fakeCallbackNode = {}, - immediateQueue = null, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, immediateQueueCallbackNode = null, - isFlushingImmediate = !1, + isFlushingSyncQueue = !1, initialTimeMs = Scheduler_now(), now = 1e4 > initialTimeMs @@ -1776,7 +1861,7 @@ function getCurrentPriorityLevel() { case Scheduler_IdlePriority: return 95; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function reactPriorityToSchedulerPriority(reactPriorityLevel) { @@ -1792,54 +1877,55 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) { case 95: return Scheduler_IdlePriority; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } -function runWithPriority(reactPriorityLevel, fn) { +function runWithPriority$1(reactPriorityLevel, fn) { reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_runWithPriority(reactPriorityLevel, fn); } function scheduleCallback(reactPriorityLevel, callback, options) { - if (99 === reactPriorityLevel) - return ( - null === immediateQueue - ? ((immediateQueue = [callback]), - (immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ))) - : immediateQueue.push(callback), - fakeCallbackNode - ); reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); } -function flushImmediateQueue() { +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { null !== immediateQueueCallbackNode && Scheduler_cancelCallback(immediateQueueCallbackNode); - flushImmediateQueueImpl(); + flushSyncCallbackQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && null !== immediateQueue) { - isFlushingImmediate = !0; +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; var i = 0; try { - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do callback = callback(!0); - while (null !== callback); - } - immediateQueue = null; + var queue = syncQueue; + runWithPriority$1(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; } catch (error) { - throw (null !== immediateQueue && - (immediateQueue = immediateQueue.slice(i + 1)), + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), Scheduler_scheduleCallback( Scheduler_ImmediatePriority, - flushImmediateQueue + flushSyncCallbackQueue ), error); } finally { - isFlushingImmediate = !1; + isFlushingSyncQueue = !1; } } } @@ -1847,7 +1933,7 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { if (1073741823 === expirationTime) return 99; if (1 === expirationTime) return 95; currentTime = - 10 * (1073741822 - expirationTime) - 10 * (1073741822 - currentTime); + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); return 0 >= currentTime ? 99 : 250 >= currentTime @@ -1856,271 +1942,81 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { ? 97 : 95; } -function FiberNode(tag, pendingProps, key, mode) { - this.tag = tag; - this.key = key; - this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.contextDependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; - this.mode = mode; - this.effectTag = 0; - this.lastEffect = this.firstEffect = this.nextEffect = null; - this.childExpirationTime = this.expirationTime = 0; - this.alternate = null; - this.actualDuration = 0; - this.actualStartTime = -1; - this.treeBaseDuration = this.selfBaseDuration = 0; +function is(x, y) { + return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } -function createFiber(tag, pendingProps, key, mode) { - return new FiberNode(tag, pendingProps, key, mode); +var hasOwnProperty = Object.prototype.hasOwnProperty; +function shallowEqual(objA, objB) { + if (is(objA, objB)) return !0; + if ( + "object" !== typeof objA || + null === objA || + "object" !== typeof objB || + null === objB + ) + return !1; + var keysA = Object.keys(objA), + keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) + if ( + !hasOwnProperty.call(objB, keysA[keysB]) || + !is(objA[keysA[keysB]], objB[keysA[keysB]]) + ) + return !1; + return !0; } -function shouldConstruct(Component) { - Component = Component.prototype; - return !(!Component || !Component.isReactComponent); +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + baseProps = Object.assign({}, baseProps); + Component = Component.defaultProps; + for (var propName in Component) + void 0 === baseProps[propName] && + (baseProps[propName] = Component[propName]); + } + return baseProps; } -function resolveLazyComponentTag(Component) { - if ("function" === typeof Component) - return shouldConstruct(Component) ? 1 : 0; - if (void 0 !== Component && null !== Component) { - Component = Component.$$typeof; - if (Component === REACT_FORWARD_REF_TYPE) return 11; - if (Component === REACT_MEMO_TYPE) return 14; +function readLazyComponentType(lazyComponent) { + var result = lazyComponent._result; + switch (lazyComponent._status) { + case 1: + return result; + case 2: + throw result; + case 0: + throw result; + default: + lazyComponent._status = 0; + result = lazyComponent._ctor; + result = result(); + result.then( + function(moduleObject) { + 0 === lazyComponent._status && + ((moduleObject = moduleObject.default), + (lazyComponent._status = 1), + (lazyComponent._result = moduleObject)); + }, + function(error) { + 0 === lazyComponent._status && + ((lazyComponent._status = 2), (lazyComponent._result = error)); + } + ); + switch (lazyComponent._status) { + case 1: + return lazyComponent._result; + case 2: + throw lazyComponent._result; + } + lazyComponent._result = result; + throw result; } - return 2; } -function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - null === workInProgress - ? ((workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - )), - (workInProgress.elementType = current.elementType), - (workInProgress.type = current.type), - (workInProgress.stateNode = current.stateNode), - (workInProgress.alternate = current), - (current.alternate = workInProgress)) - : ((workInProgress.pendingProps = pendingProps), - (workInProgress.effectTag = 0), - (workInProgress.nextEffect = null), - (workInProgress.firstEffect = null), - (workInProgress.lastEffect = null), - (workInProgress.actualDuration = 0), - (workInProgress.actualStartTime = -1)); - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - return workInProgress; -} -function createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiberTag = 2; - owner = type; - if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); - else if ("string" === typeof type) fiberTag = 5; - else - a: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 3, expirationTime, key); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 2, expirationTime, key); - case REACT_PROFILER_TYPE: - return ( - (type = createFiber(12, pendingProps, key, mode | 4)), - (type.elementType = REACT_PROFILER_TYPE), - (type.type = REACT_PROFILER_TYPE), - (type.expirationTime = expirationTime), - type - ); - case REACT_SUSPENSE_TYPE: - return ( - (type = createFiber(13, pendingProps, key, mode)), - (type.elementType = REACT_SUSPENSE_TYPE), - (type.type = REACT_SUSPENSE_TYPE), - (type.expirationTime = expirationTime), - type - ); - default: - if ("object" === typeof type && null !== type) - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = 10; - break a; - case REACT_CONTEXT_TYPE: - fiberTag = 9; - break a; - case REACT_FORWARD_REF_TYPE: - fiberTag = 11; - break a; - case REACT_MEMO_TYPE: - fiberTag = 14; - break a; - case REACT_LAZY_TYPE: - fiberTag = 16; - owner = null; - break a; - } - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." - ); - } - key = createFiber(fiberTag, pendingProps, key, mode); - key.elementType = type; - key.type = owner; - key.expirationTime = expirationTime; - return key; -} -function createFiberFromFragment(elements, mode, expirationTime, key) { - elements = createFiber(7, elements, key, mode); - elements.expirationTime = expirationTime; - return elements; -} -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - pendingProps = createFiber(8, pendingProps, key, mode); - mode = 0 === (mode & 1) ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE; - pendingProps.elementType = mode; - pendingProps.type = mode; - pendingProps.expirationTime = expirationTime; - return pendingProps; -} -function createFiberFromText(content, mode, expirationTime) { - content = createFiber(6, content, null, mode); - content.expirationTime = expirationTime; - return content; -} -function createFiberFromPortal(portal, mode, expirationTime) { - mode = createFiber( - 4, - null !== portal.children ? portal.children : [], - portal.key, - mode - ); - mode.expirationTime = expirationTime; - mode.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - implementation: portal.implementation - }; - return mode; -} -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pingCache = this.pendingChildren = null; - this.pendingCommitExpirationTime = 0; - this.finishedWork = null; - this.timeoutHandle = -1; - this.pendingContext = this.context = null; - this.hydrate = hydrate; - this.callbackNode = this.firstBatch = null; - this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; - this.interactionThreadID = tracing.unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); -} -function is(x, y) { - return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); -} -var hasOwnProperty = Object.prototype.hasOwnProperty; -function shallowEqual(objA, objB) { - if (is(objA, objB)) return !0; - if ( - "object" !== typeof objA || - null === objA || - "object" !== typeof objB || - null === objB - ) - return !1; - var keysA = Object.keys(objA), - keysB = Object.keys(objB); - if (keysA.length !== keysB.length) return !1; - for (keysB = 0; keysB < keysA.length; keysB++) - if ( - !hasOwnProperty.call(objB, keysA[keysB]) || - !is(objA[keysA[keysB]], objB[keysA[keysB]]) - ) - return !1; - return !0; -} -function resolveDefaultProps(Component, baseProps) { - if (Component && Component.defaultProps) { - baseProps = Object.assign({}, baseProps); - Component = Component.defaultProps; - for (var propName in Component) - void 0 === baseProps[propName] && - (baseProps[propName] = Component[propName]); - } - return baseProps; -} -function readLazyComponentType(lazyComponent) { - var result = lazyComponent._result; - switch (lazyComponent._status) { - case 1: - return result; - case 2: - throw result; - case 0: - throw result; - default: - lazyComponent._status = 0; - result = lazyComponent._ctor; - result = result(); - result.then( - function(moduleObject) { - 0 === lazyComponent._status && - ((moduleObject = moduleObject.default), - (lazyComponent._status = 1), - (lazyComponent._result = moduleObject)); - }, - function(error) { - 0 === lazyComponent._status && - ((lazyComponent._status = 2), (lazyComponent._result = error)); - } - ); - switch (lazyComponent._status) { - case 1: - return lazyComponent._result; - case 2: - throw lazyComponent._result; - } - lazyComponent._result = result; - throw result; - } -} -var valueCursor = { current: null }, - currentlyRenderingFiber = null, - lastContextDependency = null, - lastContextWithAllBitsObserved = null; -function resetContextDependences() { - lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; +var valueCursor = { current: null }, + currentlyRenderingFiber = null, + lastContextDependency = null, + lastContextWithAllBitsObserved = null; +function resetContextDependencies() { + lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; } function pushProvider(providerFiber, nextValue) { var context = providerFiber.type._context; @@ -2132,14 +2028,32 @@ function popProvider(providerFiber) { pop(valueCursor, providerFiber); providerFiber.type._context._currentValue2 = currentValue; } +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} function prepareToReadContext(workInProgress, renderExpirationTime) { currentlyRenderingFiber = workInProgress; lastContextWithAllBitsObserved = lastContextDependency = null; - var currentDependencies = workInProgress.contextDependencies; - null !== currentDependencies && - currentDependencies.expirationTime >= renderExpirationTime && - (didReceiveUpdate = !0); - workInProgress.contextDependencies = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } function readContext(context, observedBits) { if ( @@ -2153,12 +2067,15 @@ function readContext(context, observedBits) { if (null === lastContextDependency) { if (null === currentlyRenderingFiber) throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); lastContextDependency = observedBits; - currentlyRenderingFiber.contextDependencies = { - first: observedBits, - expirationTime: 0 + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null }; } else lastContextDependency = lastContextDependency.next = observedBits; } @@ -2191,9 +2108,10 @@ function cloneUpdateQueue(currentQueue) { lastCapturedEffect: null }; } -function createUpdate(expirationTime) { +function createUpdate(expirationTime, suspenseConfig) { return { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: 0, payload: null, callback: null, @@ -2309,8 +2227,10 @@ function processUpdateQueue( ((newFirstUpdate = update), (newBaseState = resultState)), newExpirationTime < updateExpirationTime && (newExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), (resultState = getStateFromUpdate( workInProgress, queue, @@ -2386,15 +2306,18 @@ function commitUpdateEffects(effect, instance) { var context = instance; if ("function" !== typeof _callback3) throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - _callback3 + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) ); _callback3.call(context); } effect = effect.nextEffect; } } -var emptyRefsObject = new React.Component().refs; +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; function applyDerivedStateFromProps( workInProgress, ctor, @@ -2421,36 +2344,42 @@ var classComponentUpdater = { }, enqueueSetState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 1; - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 2; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); } }; @@ -2579,15 +2508,19 @@ function coerceRef(returnFiber, current$$1, element) { if (element) { if (1 !== element.tag) throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); inst = element.stateNode; } if (!inst) throw ReactError( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); var stringRef = "" + returnFiber; if ( @@ -2607,13 +2540,17 @@ function coerceRef(returnFiber, current$$1, element) { } if ("string" !== typeof returnFiber) throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); if (!element._owner) throw ReactError( - "Element ref was specified as a string (" + - returnFiber + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } return returnFiber; @@ -2621,11 +2558,13 @@ function coerceRef(returnFiber, current$$1, element) { function throwOnInvalidObjectType(returnFiber, newChild) { if ("textarea" !== returnFiber.type) throw ReactError( - "Objects are not valid as a React child (found: " + - ("[object Object]" === Object.prototype.toString.call(newChild) - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) ); } function ChildReconciler(shouldTrackSideEffects) { @@ -3028,11 +2967,13 @@ function ChildReconciler(shouldTrackSideEffects) { var iteratorFn = getIteratorFn(newChildrenIterable); if ("function" !== typeof iteratorFn) throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); newChildrenIterable = iteratorFn.call(newChildrenIterable); if (null == newChildrenIterable) - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); for ( var previousNewFiber = (iteratorFn = null), oldFiber = currentFirstChild, @@ -3267,8 +3208,10 @@ function ChildReconciler(shouldTrackSideEffects) { case 0: throw ((returnFiber = returnFiber.type), ReactError( - (returnFiber.displayName || returnFiber.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) )); } return deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3283,7 +3226,9 @@ var reconcileChildFibers = ChildReconciler(!0), function requiredContext(c) { if (c === NO_CONTEXT) throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); return c; } @@ -3321,6 +3266,34 @@ function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); } +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} var NoEffect$1 = 0, UnmountSnapshot = 2, UnmountMutation = 4, @@ -3345,7 +3318,9 @@ var NoEffect$1 = 0, numberOfReRenders = 0; function throwInvalidHookError() { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -3395,7 +3370,9 @@ function renderWithHooks( sideEffectTag = 0; if (current) throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); return workInProgress; } @@ -3431,7 +3408,9 @@ function updateWorkInProgressHook() { (nextCurrentHook = null !== currentHook ? currentHook.next : null); else { if (null === nextCurrentHook) - throw ReactError("Rendered more hooks than during the previous render."); + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); currentHook = nextCurrentHook; var newHook = { memoizedState: currentHook.memoizedState, @@ -3456,7 +3435,9 @@ function updateReducer(reducer) { queue = hook.queue; if (null === queue) throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); queue.lastRenderedReducer = reducer; if (0 < numberOfReRenders) { @@ -3499,8 +3480,10 @@ function updateReducer(reducer) { (firstRenderPhaseUpdate = newState)), updateExpirationTime > remainingExpirationTime && (remainingExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), (newState = _update.eagerReducer === reducer ? _update.eagerState @@ -3579,7 +3562,9 @@ function mountDebugValue() {} function dispatchAction(fiber, queue, action) { if (!(25 > numberOfReRenders)) throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); var alternate = fiber.alternate; if ( @@ -3590,6 +3575,7 @@ function dispatchAction(fiber, queue, action) { ((didScheduleRenderPhaseUpdate = !0), (fiber = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, @@ -3605,24 +3591,29 @@ function dispatchAction(fiber, queue, action) { queue.next = fiber; } else { - flushPassiveEffects(); - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, fiber); - var _update2 = { - expirationTime: currentTime, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }, - _last = queue.last; - if (null === _last) _update2.next = _update2; + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; else { var first = _last.next; - null !== first && (_update2.next = first); - _last.next = _update2; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; } - queue.last = _update2; + queue.last = _suspenseConfig; if ( 0 === fiber.expirationTime && (null === alternate || 0 === alternate.expirationTime) && @@ -3631,8 +3622,8 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, _eagerState = alternate(currentState, action); - _update2.eagerReducer = alternate; - _update2.eagerState = _eagerState; + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; if (is(_eagerState, currentState)) return; } catch (error) { } finally { @@ -3651,7 +3642,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }, HooksDispatcherOnMount = { readContext: readContext, @@ -3724,7 +3716,8 @@ var ContextOnlyDispatcher = { ); return [hook.memoizedState, initialState]; }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, HooksDispatcherOnUpdate = { readContext: readContext, @@ -3778,7 +3771,8 @@ var ContextOnlyDispatcher = { useState: function(initialState) { return updateReducer(basicStateReducer, initialState); }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, now$1 = Scheduler.unstable_now, commitTime = 0, @@ -4008,17 +4002,17 @@ function updateFunctionComponent( nextProps, renderExpirationTime ) { - var unmaskedContext = isContextProvider(Component) + var context = isContextProvider(Component) ? previousContext : contextStackCursor.current; - unmaskedContext = getMaskedContext(workInProgress, unmaskedContext); + context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderExpirationTime); Component = renderWithHooks( current$$1, workInProgress, Component, nextProps, - unmaskedContext, + context, renderExpirationTime ); if (null !== current$$1 && !didReceiveUpdate) @@ -4334,6 +4328,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } +var SUSPENDED_MARKER = {}; function updateSuspenseComponent( current$$1, workInProgress, @@ -4341,35 +4336,50 @@ function updateSuspenseComponent( ) { var mode = workInProgress.mode, nextProps = workInProgress.pendingProps, - nextState = workInProgress.memoizedState; - if (0 === (workInProgress.effectTag & 64)) { - nextState = null; - var nextDidTimeout = !1; - } else - (nextState = { - fallbackExpirationTime: - null !== nextState ? nextState.fallbackExpirationTime : 0 - }), + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), (nextDidTimeout = !0), - (workInProgress.effectTag &= -65); + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); if (null === current$$1) if (nextDidTimeout) { - var nextFallbackChildren = nextProps.fallback; + nextProps = nextProps.fallback; current$$1 = createFiberFromFragment(null, mode, 0, null); - 0 === (workInProgress.mode & 1) && - (current$$1.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); renderExpirationTime = createFiberFromFragment( - nextFallbackChildren, + nextProps, mode, renderExpirationTime, null ); + renderExpirationTime.return = workInProgress; current$$1.sibling = renderExpirationTime; mode = current$$1; - mode.return = renderExpirationTime.return = workInProgress; } else mode = renderExpirationTime = mountChildFibers( workInProgress, @@ -4380,121 +4390,261 @@ function updateSuspenseComponent( else { if (null !== current$$1.memoizedState) if ( - ((nextFallbackChildren = current$$1.child), - (mode = nextFallbackChildren.sibling), + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), nextDidTimeout) ) { nextProps = nextProps.fallback; renderExpirationTime = createWorkInProgress( - nextFallbackChildren, - nextFallbackChildren.pendingProps, + suspenseContext, + suspenseContext.pendingProps, 0 ); - 0 === (workInProgress.mode & 1) && + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && ((nextDidTimeout = null !== workInProgress.memoizedState ? workInProgress.child.child : workInProgress.child), - nextDidTimeout !== nextFallbackChildren.child && - (renderExpirationTime.child = nextDidTimeout)); - if (workInProgress.mode & 4) { - nextFallbackChildren = 0; + nextDidTimeout !== suspenseContext.child) + ) for ( - nextDidTimeout = renderExpirationTime.child; + renderExpirationTime.child = nextDidTimeout; null !== nextDidTimeout; ) - (nextFallbackChildren += nextDidTimeout.treeBaseDuration), + (nextDidTimeout.return = renderExpirationTime), (nextDidTimeout = nextDidTimeout.sibling); - renderExpirationTime.treeBaseDuration = nextFallbackChildren; + if (workInProgress.mode & 8) { + nextDidTimeout = 0; + for ( + suspenseContext = renderExpirationTime.child; + null !== suspenseContext; + + ) + (nextDidTimeout += suspenseContext.treeBaseDuration), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime.treeBaseDuration = nextDidTimeout; } - nextFallbackChildren = renderExpirationTime.sibling = createWorkInProgress( - mode, - nextProps, - mode.expirationTime - ); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; mode = renderExpirationTime; renderExpirationTime.childExpirationTime = 0; - renderExpirationTime = nextFallbackChildren; - mode.return = renderExpirationTime.return = workInProgress; + renderExpirationTime = nextProps; } else mode = renderExpirationTime = reconcileChildFibers( workInProgress, - nextFallbackChildren.child, + suspenseContext.child, nextProps.children, renderExpirationTime ); - else { - var _currentPrimaryChild = current$$1.child; - if (nextDidTimeout) { - nextProps = nextProps.fallback; - nextFallbackChildren = createFiberFromFragment(null, mode, 0, null); - nextFallbackChildren.child = _currentPrimaryChild; - 0 === (workInProgress.mode & 1) && - (nextFallbackChildren.child = + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = null !== workInProgress.memoizedState ? workInProgress.child.child - : workInProgress.child); - if (workInProgress.mode & 4) { - nextDidTimeout = 0; - for ( - _currentPrimaryChild = nextFallbackChildren.child; - null !== _currentPrimaryChild; + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; - ) - (nextDidTimeout += _currentPrimaryChild.treeBaseDuration), - (_currentPrimaryChild = _currentPrimaryChild.sibling); - nextFallbackChildren.treeBaseDuration = nextDidTimeout; - } - renderExpirationTime = nextFallbackChildren.sibling = createFiberFromFragment( - nextProps, - mode, - renderExpirationTime, - null - ); - renderExpirationTime.effectTag |= 2; - mode = nextFallbackChildren; - nextFallbackChildren.childExpirationTime = 0; - mode.return = renderExpirationTime.return = workInProgress; - } else - renderExpirationTime = mode = reconcileChildFibers( - workInProgress, - _currentPrimaryChild, - nextProps.children, - renderExpirationTime - ); - } + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + if (workInProgress.mode & 8) { + suspenseContext = 0; + for (JSCompiler_temp = nextProps.child; null !== JSCompiler_temp; ) + (suspenseContext += JSCompiler_temp.treeBaseDuration), + (JSCompiler_temp = JSCompiler_temp.sibling); + nextProps.treeBaseDuration = suspenseContext; + } + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); workInProgress.stateNode = current$$1.stateNode; } workInProgress.memoizedState = nextState; workInProgress.child = mode; return renderExpirationTime; } -function bailoutOnAlreadyFinishedWork( +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( current$$1, workInProgress, renderExpirationTime ) { - null !== current$$1 && - (workInProgress.contextDependencies = current$$1.contextDependencies); - profilerStartTime = -1; - if (workInProgress.childExpirationTime < renderExpirationTime) return null; - if (null !== current$$1 && workInProgress.child !== current$$1.child) - throw ReactError("Resuming work not yet implemented."); - if (null !== workInProgress.child) { - current$$1 = workInProgress.child; - renderExpirationTime = createWorkInProgress( - current$$1, - current$$1.pendingProps, - current$$1.expirationTime - ); - workInProgress.child = renderExpirationTime; - for ( - renderExpirationTime.return = workInProgress; - null !== current$$1.sibling; - - ) - (current$$1 = current$$1.sibling), + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; +} +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + null !== current$$1 && + (workInProgress.dependencies = current$$1.dependencies); + profilerStartTime = -1; + if (workInProgress.childExpirationTime < renderExpirationTime) return null; + if (null !== current$$1 && workInProgress.child !== current$$1.child) + throw ReactError(Error("Resuming work not yet implemented.")); + if (null !== workInProgress.child) { + current$$1 = workInProgress.child; + renderExpirationTime = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + ); + workInProgress.child = renderExpirationTime; + for ( + renderExpirationTime.return = workInProgress; + null !== current$$1.sibling; + + ) + (current$$1 = current$$1.sibling), (renderExpirationTime = renderExpirationTime.sibling = createWorkInProgress( current$$1, current$$1.pendingProps, @@ -4526,12 +4676,12 @@ appendAllChildren = function( node.memoizedProps, node )); - FabricUIManager.appendChild(parent.node, instance.node); + appendChildNode(parent.node, instance.node); } else if (6 === node.tag) { instance = node.stateNode; if (needsVisibilityToggle && isHidden) throw Error("Not yet implemented."); - FabricUIManager.appendChild(parent.node, instance.node); + appendChildNode(parent.node, instance.node); } else if (4 !== node.tag) { if ( 13 === node.tag && @@ -4584,12 +4734,12 @@ function appendAllChildrenToContainer( node.memoizedProps, node )); - FabricUIManager.appendChildToSet(containerChildSet, instance.node); + appendChildNodeToSet(containerChildSet, instance.node); } else if (6 === node.tag) { instance = node.stateNode; if (needsVisibilityToggle && isHidden) throw Error("Not yet implemented."); - FabricUIManager.appendChildToSet(containerChildSet, instance.node); + appendChildNodeToSet(containerChildSet, instance.node); } else if (4 !== node.tag) { if ( 13 === node.tag && @@ -4634,11 +4784,11 @@ updateHostContainer = function(workInProgress) { var portalOrRoot = workInProgress.stateNode; if (null !== workInProgress.firstEffect) { var container = portalOrRoot.containerInfo, - newChildSet = FabricUIManager.createChildSet(container); + newChildSet = createChildNodeSet(container); appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); portalOrRoot.pendingChildren = newChildSet; workInProgress.effectTag |= 4; - FabricUIManager.completeRoot(container, newChildSet); + completeRoot(container, newChildSet); } }; updateHostComponent$1 = function(current, workInProgress, type, newProps) { @@ -4666,17 +4816,11 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) { (type = { node: current ? null !== newProps - ? FabricUIManager.cloneNodeWithNewProps( - recyclableInstance, - newProps - ) - : FabricUIManager.cloneNode(recyclableInstance) + ? cloneNodeWithNewProps(recyclableInstance, newProps) + : cloneNode(recyclableInstance) : null !== newProps - ? FabricUIManager.cloneNodeWithNewChildrenAndProps( - recyclableInstance, - newProps - ) - : FabricUIManager.cloneNodeWithNewChildren(recyclableInstance), + ? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps) + : cloneNodeWithNewChildren(recyclableInstance), canonical: type.canonical }), (workInProgress.stateNode = type), @@ -4697,6 +4841,30 @@ updateHostText$1 = function(current, workInProgress, oldText, newText) { )), (workInProgress.effectTag |= 4)); }; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} function completeWork(current, workInProgress, renderExpirationTime) { var newProps = workInProgress.pendingProps; switch (workInProgress.tag) { @@ -4723,15 +4891,17 @@ function completeWork(current, workInProgress, renderExpirationTime) { break; case 5: popHostContext(workInProgress); - renderExpirationTime = requiredContext(rootInstanceStackCursor.current); - var type = workInProgress.type; + var rootContainerInstance = requiredContext( + rootInstanceStackCursor.current + ); + renderExpirationTime = workInProgress.type; if (null !== current && null != workInProgress.stateNode) updateHostComponent$1( current, workInProgress, - type, + renderExpirationTime, newProps, - renderExpirationTime + rootContainerInstance ), current.ref !== workInProgress.ref && (workInProgress.effectTag |= 128); @@ -4739,33 +4909,35 @@ function completeWork(current, workInProgress, renderExpirationTime) { requiredContext(contextStackCursor$1.current); current = nextReactTag; nextReactTag += 2; - type = ReactNativeViewConfigRegistry.get(type); + renderExpirationTime = getViewConfigForType(renderExpirationTime); var updatePayload = diffProperties( null, emptyObject, newProps, - type.validAttributes + renderExpirationTime.validAttributes ); - renderExpirationTime = FabricUIManager.createNode( + rootContainerInstance = createNode( current, - type.uiViewClassName, - renderExpirationTime, + renderExpirationTime.uiViewClassName, + rootContainerInstance, updatePayload, workInProgress ); current = new ReactFabricHostComponent( current, - type, + renderExpirationTime, newProps, workInProgress ); - current = { node: renderExpirationTime, canonical: current }; + current = { node: rootContainerInstance, canonical: current }; appendAllChildren(current, workInProgress, !1, !1); workInProgress.stateNode = current; null !== workInProgress.ref && (workInProgress.effectTag |= 128); } else if (null === workInProgress.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -4779,14 +4951,16 @@ function completeWork(current, workInProgress, renderExpirationTime) { else { if ("string" !== typeof newProps && null === workInProgress.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); current = requiredContext(rootInstanceStackCursor.current); - renderExpirationTime = requiredContext(contextStackCursor$1.current); + rootContainerInstance = requiredContext(contextStackCursor$1.current); workInProgress.stateNode = createTextInstance( newProps, current, - renderExpirationTime, + rootContainerInstance, workInProgress ); } @@ -4794,35 +4968,41 @@ function completeWork(current, workInProgress, renderExpirationTime) { case 11: break; case 13: + pop(suspenseStackCursor, workInProgress); newProps = workInProgress.memoizedState; if (0 !== (workInProgress.effectTag & 64)) return ( (workInProgress.expirationTime = renderExpirationTime), workInProgress ); newProps = null !== newProps; - renderExpirationTime = !1; + rootContainerInstance = !1; null !== current && - ((type = current.memoizedState), - (renderExpirationTime = null !== type), + ((renderExpirationTime = current.memoizedState), + (rootContainerInstance = null !== renderExpirationTime), newProps || - null === type || - ((type = type.fallbackExpirationTime), - type < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = type), - (current = current.child.sibling), - null !== current && - ((type = workInProgress.firstEffect), - null !== type - ? ((workInProgress.firstEffect = current), - (current.nextEffect = type)) - : ((workInProgress.firstEffect = workInProgress.lastEffect = current), - (current.nextEffect = null)), - (current.effectTag = 8)))); - newProps && - !renderExpirationTime && - 0 !== (workInProgress.mode & 1) && - workInProgressRootExitStatus === RootIncomplete && - (workInProgressRootExitStatus = RootSuspended); + null === renderExpirationTime || + ((renderExpirationTime = current.child.sibling), + null !== renderExpirationTime && + ((updatePayload = workInProgress.firstEffect), + null !== updatePayload + ? ((workInProgress.firstEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = updatePayload)) + : ((workInProgress.firstEffect = workInProgress.lastEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = null)), + (renderExpirationTime.effectTag = 8)))); + if (newProps && !rootContainerInstance && 0 !== (workInProgress.mode & 2)) + if ( + (null === current && + !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || + 0 !== (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; newProps && (workInProgress.effectTag |= 4); break; case 7: @@ -4848,16 +5028,195 @@ function completeWork(current, workInProgress, renderExpirationTime) { case 18: break; case 19: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (null === newProps) break; + rootContainerInstance = 0 !== (workInProgress.effectTag & 64); + updatePayload = newProps.rendering; + if (null === updatePayload) + if (rootContainerInstance) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = workInProgress.child; null !== current; ) { + updatePayload = findFirstSuspended(current); + if (null !== updatePayload) { + workInProgress.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = updatePayload.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress.firstEffect = workInProgress.lastEffect = null; + current = renderExpirationTime; + for (newProps = workInProgress.child; null !== newProps; ) + (rootContainerInstance = newProps), + (updatePayload = current), + (rootContainerInstance.effectTag &= 2), + (rootContainerInstance.nextEffect = null), + (rootContainerInstance.firstEffect = null), + (rootContainerInstance.lastEffect = null), + (renderExpirationTime = rootContainerInstance.alternate), + null === renderExpirationTime + ? ((rootContainerInstance.childExpirationTime = 0), + (rootContainerInstance.expirationTime = updatePayload), + (rootContainerInstance.child = null), + (rootContainerInstance.memoizedProps = null), + (rootContainerInstance.memoizedState = null), + (rootContainerInstance.updateQueue = null), + (rootContainerInstance.dependencies = null), + (rootContainerInstance.selfBaseDuration = 0), + (rootContainerInstance.treeBaseDuration = 0)) + : ((rootContainerInstance.childExpirationTime = + renderExpirationTime.childExpirationTime), + (rootContainerInstance.expirationTime = + renderExpirationTime.expirationTime), + (rootContainerInstance.child = + renderExpirationTime.child), + (rootContainerInstance.memoizedProps = + renderExpirationTime.memoizedProps), + (rootContainerInstance.memoizedState = + renderExpirationTime.memoizedState), + (rootContainerInstance.updateQueue = + renderExpirationTime.updateQueue), + (updatePayload = renderExpirationTime.dependencies), + (rootContainerInstance.dependencies = + null === updatePayload + ? null + : { + expirationTime: updatePayload.expirationTime, + firstContext: updatePayload.firstContext, + responders: updatePayload.responders + }), + (rootContainerInstance.selfBaseDuration = + renderExpirationTime.selfBaseDuration), + (rootContainerInstance.treeBaseDuration = + renderExpirationTime.treeBaseDuration)), + (newProps = newProps.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + workInProgress + ); + return workInProgress.child; + } + current = current.sibling; + } + } + else { + if (!rootContainerInstance) + if ( + ((current = findFirstSuspended(updatePayload)), null !== current) + ) { + if ( + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress = workInProgress.lastEffect = newProps.lastEffect; + null !== workInProgress && (workInProgress.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime && + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !1), + (current = renderExpirationTime - 1), + (workInProgress.expirationTime = workInProgress.childExpirationTime = current), + null === spawnedWorkDuringRender + ? (spawnedWorkDuringRender = [current]) + : spawnedWorkDuringRender.push(current)); + newProps.isBackwards + ? ((updatePayload.sibling = workInProgress.child), + (workInProgress.child = updatePayload)) + : ((current = newProps.last), + null !== current + ? (current.sibling = updatePayload) + : (workInProgress.child = updatePayload), + (newProps.last = updatePayload)); + } + if (null !== newProps.tail) + return ( + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500), + (current = newProps.tail), + (newProps.rendering = current), + (newProps.tail = current.sibling), + (newProps.lastEffect = workInProgress.lastEffect), + (current.sibling = null), + (newProps = suspenseStackCursor.current), + (newProps = rootContainerInstance + ? (newProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask), + push(suspenseStackCursor, newProps, workInProgress), + current + ); break; case 20: break; default: throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } return null; } +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} function createCapturedValue(value, source) { return { value: value, @@ -4865,24 +5224,18 @@ function createCapturedValue(value, source) { stack: getStackByFiberInDevAndProd(source) }; } +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); function logCapturedError(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - if (error instanceof Error) { - capturedError = error.message; - var name = error.name; - try { - error.message = - (capturedError ? name + ": " + capturedError : name) + - "\n\nThis error is located at:" + - componentStack; - } catch (e) {} - } else - error = - "string" === typeof error - ? Error(error + "\n\nThis error is located at:" + componentStack) - : Error("Unspecified error at:" + componentStack); - ExceptionsManager.handleException(error, !1); + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); } var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; function logError(boundary, errorInfo) { @@ -4914,6 +5267,15 @@ function logError(boundary, errorInfo) { }); } } +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} function safelyDetachRef(current$$1) { var ref = current$$1.ref; if (null !== ref) @@ -4942,6 +5304,70 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } while (effect !== finishedWork); } } +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} function commitWork(current$$1, finishedWork) { switch (finishedWork.tag) { case 0: @@ -4953,7 +5379,12 @@ function commitWork(current$$1, finishedWork) { case 12: return; case 13: - commitSuspenseComponent(finishedWork); + null !== finishedWork.memoizedState && + (globalMostRecentFallbackTime = now()); + attachSuspenseRetryListeners(finishedWork); + return; + case 19: + attachSuspenseRetryListeners(finishedWork); return; } switch (finishedWork.tag) { @@ -4961,29 +5392,26 @@ function commitWork(current$$1, finishedWork) { case 5: case 6: case 20: - case 19: break; case 3: case 4: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } -function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState; - null !== newState && - 0 === newState.fallbackExpirationTime && - (newState.fallbackExpirationTime = requestCurrentTime() - 500); - newState = finishedWork.updateQueue; - if (null !== newState) { +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; null === retryCache && (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); - newState.forEach(function(thenable) { + thenables.forEach(function(thenable) { var retry = resolveRetryThenable.bind(null, finishedWork, thenable); retryCache.has(thenable) || ((retry = tracing.unstable_wrap(retry)), @@ -4994,7 +5422,7 @@ function commitSuspenseComponent(finishedWork) { } var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; expirationTime.payload = { element: null }; var error = errorInfo.value; @@ -5005,13 +5433,14 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { return expirationTime; } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if ("function" === typeof getDerivedStateFromError) { - var error$jscomp$0 = errorInfo.value; + var error = errorInfo.value; expirationTime.payload = function() { - return getDerivedStateFromError(error$jscomp$0); + logError(fiber, errorInfo); + return getDerivedStateFromError(error); }; } var inst = fiber.stateNode; @@ -5021,114 +5450,95 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) - : legacyErrorBoundariesThatAlreadyFailed.add(this)); - var error = errorInfo.value, - stack = errorInfo.stack; - logError(fiber, errorInfo); - this.componentDidCatch(error, { + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); }); return expirationTime; } -function unwindWork(workInProgress) { - switch (workInProgress.tag) { - case 1: - isContextProvider(workInProgress.type) && popContext(workInProgress); - var effectTag = workInProgress.effectTag; - return effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null; - case 3: - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - effectTag = workInProgress.effectTag; - if (0 !== (effectTag & 64)) - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - workInProgress.effectTag = (effectTag & -2049) | 64; - return workInProgress; - case 5: - return popHostContext(workInProgress), null; - case 13: - return ( - (effectTag = workInProgress.effectTag), - effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null - ); - case 18: - return null; - case 4: - return popHostContainer(workInProgress), null; - case 10: - return popProvider(workInProgress), null; - case 19: - case 20: - return null; - default: - return null; - } -} var ceil = Math.ceil, ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - LegacyUnbatchedPhase = 2, - RenderPhase = 4, - CommitPhase = 5, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, RootIncomplete = 0, RootErrored = 1, RootSuspended = 2, - RootCompleted = 3, - workPhase = 0, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, workInProgressRoot = null, workInProgress = null, renderExpirationTime = 0, workInProgressRootExitStatus = RootIncomplete, - workInProgressRootMostRecentEventTime = 1073741823, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, pendingPassiveEffectsExpirationTime = 0, rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, + spawnedWorkDuringRender = null, currentEventTime = 0; function requestCurrentTime() { - return workPhase === RenderPhase || workPhase === CommitPhase - ? 1073741822 - ((now() / 10) | 0) + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) : 0 !== currentEventTime ? currentEventTime - : (currentEventTime = 1073741822 - ((now() / 10) | 0)); -} -function computeExpirationForFiber(currentTime, fiber) { - if (0 === (fiber.mode & 1)) return 1073741823; - if (workPhase === RenderPhase) return renderExpirationTime; - switch (getCurrentPriorityLevel()) { - case 99: - currentTime = 1073741823; - break; - case 98: - currentTime = - 1073741822 - 10 * ((((1073741822 - currentTime + 15) / 10) | 0) + 1); - break; - case 97: - case 96: - currentTime = - 1073741822 - 25 * ((((1073741822 - currentTime + 500) / 25) | 0) + 1); - break; - case 95: - currentTime = 1; - break; - default: - throw ReactError("Expected a valid priority level"); - } + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } null !== workInProgressRoot && currentTime === renderExpirationTime && --currentTime; @@ -5139,33 +5549,42 @@ function scheduleUpdateOnFiber(fiber, expirationTime) { throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) )); fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); - if (null !== fiber) - if (((fiber.pingTime = 0), 1073741823 === expirationTime)) - if (workPhase === LegacyUnbatchedPhase) + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + scheduleInteractions( + fiber, + expirationTime, + tracing.__interactionsRef.current + ); for ( - expirationTime = renderRoot(fiber, 1073741823, !0); - null !== expirationTime; + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; ) - expirationTime = expirationTime(!0); - else + callback = callback(!0); + } else scheduleCallbackForRoot(fiber, 99, 1073741823), - 0 === workPhase && flushImmediateQueue(); - else { - var priorityLevel = getCurrentPriorityLevel(); - if (98 === priorityLevel) - if (null === rootsWithPendingDiscreteUpdates) - rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]]); - else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(fiber); - (void 0 === lastDiscreteTime || lastDiscreteTime > expirationTime) && - rootsWithPendingDiscreteUpdates.set(fiber, expirationTime); - } - scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); - } + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } } function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { fiber.expirationTime < expirationTime && @@ -5206,23 +5625,30 @@ function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { existingCallbackNode !== fakeCallbackNode && Scheduler_cancelCallback(existingCallbackNode); root.callbackExpirationTime = expirationTime; - existingCallbackNode = null; - 1073741823 !== expirationTime && - 1 !== expirationTime && - ((existingCallbackNode = 10 * (1073741822 - expirationTime) - now()), - 5e3 < existingCallbackNode && (existingCallbackNode = 5e3), - (existingCallbackNode = { timeout: existingCallbackNode })); - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - existingCallbackNode - ); + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); } - schedulePendingInteraction(root, expirationTime); + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); } function runRootCallback(root, callback, isSync) { var prevCallbackNode = root.callbackNode, @@ -5245,9 +5671,7 @@ function resolveLocksOnRoot(root, expirationTime) { return null !== firstBatch && firstBatch._defer && firstBatch._expirationTime >= expirationTime - ? ((root.finishedWork = root.current.alternate), - (root.pendingCommitExpirationTime = expirationTime), - scheduleCallback(97, function() { + ? (scheduleCallback(97, function() { firstBatch._onComplete(); return null; }), @@ -5259,13 +5683,14 @@ function flushPendingDiscreteUpdates() { var roots = rootsWithPendingDiscreteUpdates; rootsWithPendingDiscreteUpdates = null; roots.forEach(function(expirationTime, root) { - scheduleCallback(99, renderRoot.bind(null, root, expirationTime)); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); }); - flushImmediateQueue(); + flushSyncCallbackQueue(); } } function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = 0; + root.finishedWork = null; + root.finishedExpirationTime = 0; var timeoutHandle = root.timeoutHandle; -1 !== timeoutHandle && ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); @@ -5289,6 +5714,12 @@ function prepareFreshStack(root, expirationTime) { case 4: popHostContainer(interruptedWork); break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; case 10: popProvider(interruptedWork); } @@ -5298,27 +5729,35 @@ function prepareFreshStack(root, expirationTime) { workInProgress = createWorkInProgress(root.current, null, expirationTime); renderExpirationTime = expirationTime; workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = 1073741823; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; + spawnedWorkDuringRender = null; } function renderRoot(root$jscomp$0, expirationTime, isSync) { - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); if (root$jscomp$0.firstPendingTime < expirationTime) return null; - if (root$jscomp$0.pendingCommitExpirationTime === expirationTime) - return ( - (root$jscomp$0.pendingCommitExpirationTime = 0), - commitRoot.bind(null, root$jscomp$0, expirationTime) - ); + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); flushPassiveEffects(); if ( root$jscomp$0 !== workInProgressRoot || expirationTime !== renderExpirationTime ) prepareFreshStack(root$jscomp$0, expirationTime), - startWorkOnPendingInteraction(root$jscomp$0, expirationTime); + startWorkOnPendingInteractions(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } if (null !== workInProgress) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; + lastPendingTime = executionContext; + executionContext |= RenderContext; var prevDispatcher = ReactCurrentDispatcher.current; null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); ReactCurrentDispatcher.current = ContextOnlyDispatcher; @@ -5329,8 +5768,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { var currentTime = requestCurrentTime(); if (currentTime < expirationTime) return ( - (workPhase = prevWorkPhase), - resetContextDependences(), + (executionContext = lastPendingTime), + resetContextDependencies(), (ReactCurrentDispatcher.current = prevDispatcher), (tracing.__interactionsRef.current = prevInteractions), renderRoot.bind(null, root$jscomp$0, currentTime) @@ -5347,14 +5786,14 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = performUnitOfWork(workInProgress); break; } catch (thrownValue) { - resetContextDependences(); + resetContextDependencies(); resetHooks(); currentTime = workInProgress; if (null === currentTime || null === currentTime.return) throw (prepareFreshStack(root$jscomp$0, expirationTime), - (workPhase = prevWorkPhase), + (executionContext = lastPendingTime), thrownValue); - currentTime.mode & 4 && + currentTime.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(currentTime, !0); a: { var root = root$jscomp$0, @@ -5369,29 +5808,41 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { "object" === typeof value && "function" === typeof value.then ) { - var thenable = value; + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); value = returnFiber; do { - if ( - 13 === value.tag && - (void 0 === value.memoizedProps.fallback - ? 0 - : null === value.memoizedState) - ) { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { returnFiber = value.updateQueue; null === returnFiber ? ((returnFiber = new Set()), returnFiber.add(thenable), (value.updateQueue = returnFiber)) : returnFiber.add(thenable); - if (0 === (value.mode & 1)) { + if (0 === (value.mode & 2)) { value.effectTag |= 64; sourceFiber.effectTag &= -1957; 1 === sourceFiber.tag && (null === sourceFiber.alternate ? (sourceFiber.tag = 17) : ((renderExpirationTime$jscomp$0 = createUpdate( - 1073741823 + 1073741823, + null )), (renderExpirationTime$jscomp$0.tag = 2), enqueueUpdate( @@ -5403,15 +5854,15 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { } sourceFiber = root; root = renderExpirationTime$jscomp$0; - var pingCache = sourceFiber.pingCache; - null === pingCache - ? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()), + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), (returnFiber = new Set()), - pingCache.set(thenable, returnFiber)) - : ((returnFiber = pingCache.get(thenable)), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), void 0 === returnFiber && ((returnFiber = new Set()), - pingCache.set(thenable, returnFiber))); + hasInvisibleParentBoundary.set(thenable, returnFiber))); returnFiber.has(root) || (returnFiber.add(root), (sourceFiber = pingSuspendedRoot.bind( @@ -5434,11 +5885,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { getStackByFiberInDevAndProd(sourceFiber) ); } - if ( - workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended - ) - workInProgressRootExitStatus = RootErrored; + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); value = createCapturedValue(value, sourceFiber); sourceFiber = returnFiber; do { @@ -5490,80 +5938,148 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = completeUnitOfWork(currentTime); } while (1); - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = lastPendingTime; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; tracing.__interactionsRef.current = prevInteractions; if (null !== workInProgress) return renderRoot.bind(null, root$jscomp$0, expirationTime); } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; workInProgressRoot = null; switch (workInProgressRootExitStatus) { case RootIncomplete: - throw ReactError("Should have a work-in-progress."); + throw ReactError(Error("Should have a work-in-progress.")); case RootErrored: return ( - (prevWorkPhase = root$jscomp$0.lastPendingTime), - root$jscomp$0.lastPendingTime < expirationTime - ? renderRoot.bind(null, root$jscomp$0, prevWorkPhase) + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) : isSync - ? commitRoot.bind(null, root$jscomp$0, expirationTime) + ? commitRoot.bind(null, root$jscomp$0) : (prepareFreshStack(root$jscomp$0, expirationTime), - scheduleCallback( - 99, + scheduleSyncCallback( renderRoot.bind(null, root$jscomp$0, expirationTime) ), null) ); case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); isSync = root$jscomp$0.lastPendingTime; - if (root$jscomp$0.lastPendingTime < expirationTime) + if (isSync < expirationTime) return renderRoot.bind(null, root$jscomp$0, isSync); - if ( - 1073741823 !== workInProgressRootMostRecentEventTime && - ((prevWorkPhase = - 10 * (1073741822 - workInProgressRootMostRecentEventTime) - 5e3), - (isSync = now()), - (prevWorkPhase = isSync - prevWorkPhase), - (prevWorkPhase = - (120 > prevWorkPhase - ? 120 - : 480 > prevWorkPhase - ? 480 - : 1080 > prevWorkPhase - ? 1080 - : 1920 > prevWorkPhase - ? 1920 - : 3e3 > prevWorkPhase - ? 3e3 - : 4320 > prevWorkPhase - ? 4320 - : 1960 * ceil(prevWorkPhase / 1960)) - prevWorkPhase), - (isSync = 10 * (1073741822 - expirationTime) - isSync), - isSync < prevWorkPhase && (prevWorkPhase = isSync), - (isSync = prevWorkPhase), - 10 < isSync) - ) + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) return ( (root$jscomp$0.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root$jscomp$0, expirationTime), + commitRoot.bind(null, root$jscomp$0), isSync )), null ); } - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return commitRoot.bind(null, root$jscomp$0); case RootCompleted: - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); default: - throw ReactError("Unknown root exit status."); + throw ReactError(Error("Unknown root exit status.")); } } +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} function performUnitOfWork(unitOfWork) { var current$$1 = unitOfWork.alternate; - 0 !== (unitOfWork.mode & 4) + 0 !== (unitOfWork.mode & 8) ? ((profilerStartTime = now$1()), 0 > unitOfWork.actualStartTime && (unitOfWork.actualStartTime = now$1()), (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)), @@ -5580,7 +6096,7 @@ function completeUnitOfWork(unitOfWork) { var current$$1 = workInProgress.alternate; unitOfWork = workInProgress.return; if (0 === (workInProgress.effectTag & 1024)) { - if (0 === (workInProgress.mode & 4)) + if (0 === (workInProgress.mode & 8)) current$$1 = completeWork( current$$1, workInProgress, @@ -5600,7 +6116,7 @@ function completeUnitOfWork(unitOfWork) { fiber = workInProgress; if (1 === renderExpirationTime || 1 !== fiber.childExpirationTime) { var newChildExpirationTime = 0; - if (0 !== (fiber.mode & 4)) { + if (0 !== (fiber.mode & 8)) { for ( var actualDuration = fiber.actualDuration, treeBaseDuration = fiber.selfBaseDuration, @@ -5652,7 +6168,7 @@ function completeUnitOfWork(unitOfWork) { (unitOfWork.lastEffect = workInProgress))); } else { current$$1 = unwindWork(workInProgress, renderExpirationTime); - if (0 !== (workInProgress.mode & 4)) { + if (0 !== (workInProgress.mode & 8)) { stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); fiber = workInProgress.actualDuration; for ( @@ -5678,23 +6194,31 @@ function completeUnitOfWork(unitOfWork) { (workInProgressRootExitStatus = RootCompleted); return null; } -function commitRoot(root, expirationTime) { - runWithPriority(99, commitRootImpl.bind(null, root, expirationTime)); +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(99, commitRootImpl.bind(null, root, renderPriorityLevel)); null !== rootWithPendingPassiveEffects && - ((root = getCurrentPriorityLevel()), - scheduleCallback(root, function() { + scheduleCallback(97, function() { flushPassiveEffects(); return null; - })); + }); return null; } -function commitRootImpl(root, expirationTime) { +function commitRootImpl(root, renderPriorityLevel) { flushPassiveEffects(); - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); - var finishedWork = root.current.alternate; - if (null === finishedWork) - throw ReactError("Should have a work-in-progress root."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); root.callbackNode = null; root.callbackExpirationTime = 0; var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, @@ -5708,19 +6232,19 @@ function commitRootImpl(root, expirationTime) { (root.lastPendingTime = updateExpirationTimeBeforeCommit); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); - if (1 < finishedWork.effectTag) - if (null !== finishedWork.lastEffect) { - finishedWork.lastEffect.nextEffect = finishedWork; - var firstEffect = finishedWork.firstEffect; - } else firstEffect = finishedWork; - else firstEffect = finishedWork.firstEffect; - if (null !== firstEffect) { - updateExpirationTimeBeforeCommit = workPhase; - workPhase = CommitPhase; - childExpirationTimeBeforeCommit = tracing.__interactionsRef.current; + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + var prevInteractions = tracing.__interactionsRef.current; tracing.__interactionsRef.current = root.memoizedInteractions; ReactCurrentOwner$2.current = null; - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (; null !== nextEffect; ) { @@ -5763,11 +6287,12 @@ function commitRootImpl(root, expirationTime) { case 6: case 4: case 17: - case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -5775,16 +6300,16 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); commitTime = now$1(); - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { - for (; null !== nextEffect; ) { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { var effectTag = nextEffect.effectTag; if (effectTag & 128) { var current$$1$jscomp$0 = nextEffect.alternate; @@ -5808,102 +6333,45 @@ function commitRootImpl(root, expirationTime) { commitWork(nextEffect.alternate, nextEffect); break; case 8: - current$$1 = nextEffect; - a: for (prevState = prevProps = current$$1; ; ) { - instance = prevState; - "function" === typeof onCommitFiberUnmount && - onCommitFiberUnmount(instance); - switch (instance.tag) { - case 0: - case 11: - case 14: - case 15: - var updateQueue = instance.updateQueue; - if (null !== updateQueue) { - var lastEffect = updateQueue.lastEffect; - if (null !== lastEffect) { - var firstEffect$jscomp$0 = lastEffect.next; - snapshot = firstEffect$jscomp$0; - do { - var destroy = snapshot.destroy; - if (void 0 !== destroy) { - finishedWork$jscomp$0 = instance; - try { - destroy(); - } catch (error) { - captureCommitPhaseError( - finishedWork$jscomp$0, - error - ); - } - } - snapshot = snapshot.next; - } while (snapshot !== firstEffect$jscomp$0); - } - } - break; - case 1: - safelyDetachRef(instance); - var instance$jscomp$0 = instance.stateNode; - if ( - "function" === - typeof instance$jscomp$0.componentWillUnmount - ) - try { - (instance$jscomp$0.props = instance.memoizedProps), - (instance$jscomp$0.state = instance.memoizedState), - instance$jscomp$0.componentWillUnmount(); - } catch (unmountError) { - captureCommitPhaseError(instance, unmountError); - } - break; - case 5: - safelyDetachRef(instance); - break; - case 4: - FabricUIManager.createChildSet( - instance.stateNode.containerInfo - ); - } - if (null !== prevState.child) - (prevState.child.return = prevState), - (prevState = prevState.child); + prevProps = nextEffect; + a: for ( + prevState = prevProps, + instance = current$$1, + snapshot = prevState; + ; + + ) + if ( + (commitUnmount(snapshot, instance), null !== snapshot.child) + ) + (snapshot.child.return = snapshot), + (snapshot = snapshot.child); else { - if (prevState === prevProps) break; - for (; null === prevState.sibling; ) { + if (snapshot === prevState) break; + for (; null === snapshot.sibling; ) { if ( - null === prevState.return || - prevState.return === prevProps + null === snapshot.return || + snapshot.return === prevState ) break a; - prevState = prevState.return; + snapshot = snapshot.return; } - prevState.sibling.return = prevState.return; - prevState = prevState.sibling; + snapshot.sibling.return = snapshot.return; + snapshot = snapshot.sibling; } - } - current$$1.return = null; - current$$1.child = null; - current$$1.memoizedState = null; - current$$1.updateQueue = null; - var alternate = current$$1.alternate; - null !== alternate && - ((alternate.return = null), - (alternate.child = null), - (alternate.memoizedState = null), - (alternate.updateQueue = null)); + detachFiber(prevProps); } nextEffect = nextEffect.nextEffect; } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); root.current = finishedWork; - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { for ( @@ -5913,10 +6381,10 @@ function commitRootImpl(root, expirationTime) { ) { var effectTag$jscomp$0 = nextEffect.effectTag; if (effectTag$jscomp$0 & 36) { - lastEffect = effectTag; + prevProps = effectTag; var current$$1$jscomp$1 = nextEffect.alternate; currentRef = nextEffect; - updateQueue = current$$1$jscomp$0; + current$$1 = current$$1$jscomp$0; switch (currentRef.tag) { case 0: case 11: @@ -5924,10 +6392,10 @@ function commitRootImpl(root, expirationTime) { commitHookEffectList(UnmountLayout, MountLayout, currentRef); break; case 1: - var instance$jscomp$1 = currentRef.stateNode; + var instance$jscomp$0 = currentRef.stateNode; if (currentRef.effectTag & 4) if (null === current$$1$jscomp$1) - instance$jscomp$1.componentDidMount(); + instance$jscomp$0.componentDidMount(); else { var prevProps$jscomp$0 = currentRef.elementType === currentRef.type @@ -5936,45 +6404,47 @@ function commitRootImpl(root, expirationTime) { currentRef.type, current$$1$jscomp$1.memoizedProps ); - instance$jscomp$1.componentDidUpdate( + instance$jscomp$0.componentDidUpdate( prevProps$jscomp$0, current$$1$jscomp$1.memoizedState, - instance$jscomp$1.__reactInternalSnapshotBeforeUpdate + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate ); } - var updateQueue$jscomp$0 = currentRef.updateQueue; - null !== updateQueue$jscomp$0 && + var updateQueue = currentRef.updateQueue; + null !== updateQueue && commitUpdateQueue( currentRef, - updateQueue$jscomp$0, - instance$jscomp$1, - updateQueue + updateQueue, + instance$jscomp$0, + current$$1 ); break; case 3: var _updateQueue = currentRef.updateQueue; if (null !== _updateQueue) { - lastEffect = null; + prevProps = null; if (null !== currentRef.child) switch (currentRef.child.tag) { case 5: - lastEffect = currentRef.child.stateNode.canonical; + prevProps = currentRef.child.stateNode.canonical; break; case 1: - lastEffect = currentRef.child.stateNode; + prevProps = currentRef.child.stateNode; } commitUpdateQueue( currentRef, _updateQueue, - lastEffect, - updateQueue + prevProps, + current$$1 ); } break; case 5: if (null === current$$1$jscomp$1 && currentRef.effectTag & 4) throw ReactError( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -5983,39 +6453,40 @@ function commitRootImpl(root, expirationTime) { break; case 12: var onRender = currentRef.memoizedProps.onRender; - onRender( - currentRef.memoizedProps.id, - null === current$$1$jscomp$1 ? "mount" : "update", - currentRef.actualDuration, - currentRef.treeBaseDuration, - currentRef.actualStartTime, - commitTime, - lastEffect.memoizedInteractions - ); + "function" === typeof onRender && + onRender( + currentRef.memoizedProps.id, + null === current$$1$jscomp$1 ? "mount" : "update", + currentRef.actualDuration, + currentRef.treeBaseDuration, + currentRef.actualStartTime, + commitTime, + prevProps.memoizedInteractions + ); break; case 13: + case 19: case 17: - break; case 20: break; - case 19: - break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } if (effectTag$jscomp$0 & 128) { var ref = nextEffect.ref; if (null !== ref) { - var instance$jscomp$2 = nextEffect.stateNode; + var instance$jscomp$1 = nextEffect.stateNode; switch (nextEffect.tag) { case 5: - var instanceToUse = instance$jscomp$2.canonical; + var instanceToUse = instance$jscomp$1.canonical; break; default: - instanceToUse = instance$jscomp$2; + instanceToUse = instance$jscomp$1; } "function" === typeof ref ? ref(instanceToUse) @@ -6027,32 +6498,52 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); nextEffect = null; - tracing.__interactionsRef.current = childExpirationTimeBeforeCommit; - workPhase = updateExpirationTimeBeforeCommit; + requestPaint(); + tracing.__interactionsRef.current = prevInteractions; + executionContext = childExpirationTimeBeforeCommit; } else (root.current = finishedWork), (commitTime = now$1()); - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), + if ((effectTag$jscomp$0 = rootDoesHavePassiveEffects)) + (rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsExpirationTime = expirationTime)) - : finishPendingInteractions(root, expirationTime); - expirationTime = root.firstPendingTime; - 0 !== expirationTime - ? ((effectTag$jscomp$0 = requestCurrentTime()), - (effectTag$jscomp$0 = inferPriorityFromExpirationTime( - effectTag$jscomp$0, - expirationTime - )), - scheduleCallbackForRoot(root, effectTag$jscomp$0, expirationTime)) - : (legacyErrorBoundariesThatAlreadyFailed = null); + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + if (0 !== renderPriorityLevel) { + current$$1$jscomp$1 = requestCurrentTime(); + current$$1$jscomp$1 = inferPriorityFromExpirationTime( + current$$1$jscomp$1, + renderPriorityLevel + ); + if (null !== spawnedWorkDuringRender) + for ( + instance$jscomp$0 = spawnedWorkDuringRender, + spawnedWorkDuringRender = null, + prevProps$jscomp$0 = 0; + prevProps$jscomp$0 < instance$jscomp$0.length; + prevProps$jscomp$0++ + ) + scheduleInteractions( + root, + instance$jscomp$0[prevProps$jscomp$0], + root.memoizedInteractions + ); + scheduleCallbackForRoot(root, current$$1$jscomp$1, renderPriorityLevel); + } else legacyErrorBoundariesThatAlreadyFailed = null; + effectTag$jscomp$0 || finishPendingInteractions(root, expirationTime); "function" === typeof onCommitFiberRoot && - onCommitFiberRoot(finishedWork.stateNode); - 1073741823 === expirationTime + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -6062,37 +6553,56 @@ function commitRootImpl(root, expirationTime) { (root = firstUncaughtError), (firstUncaughtError = null), root); - if (workPhase === LegacyUnbatchedPhase) return null; - flushImmediateQueue(); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); return null; } function flushPassiveEffects() { if (null === rootWithPendingPassiveEffects) return !1; var root = rootWithPendingPassiveEffects, - expirationTime = pendingPassiveEffectsExpirationTime; + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; rootWithPendingPassiveEffects = null; pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority$1( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root, expirationTime) { var prevInteractions = tracing.__interactionsRef.current; tracing.__interactionsRef.current = root.memoizedInteractions; - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Cannot flush passive effects while already rendering."); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; for (var effect = root.current.firstEffect; null !== effect; ) { try { var finishedWork = effect; - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } } catch (error) { - if (null === effect) throw ReactError("Should be working on an effect."); + if (null === effect) + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(effect, error); } - effect = effect.nextEffect; + finishedWork = effect.nextEffect; + effect.nextEffect = null; + effect = finishedWork; } tracing.__interactionsRef.current = prevInteractions; finishPendingInteractions(root, expirationTime); - workPhase = prevWorkPhase; - flushImmediateQueue(); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); return !0; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { @@ -6133,11 +6643,18 @@ function pingSuspendedRoot(root, thenable, suspendedTime) { var pingCache = root.pingCache; null !== pingCache && pingCache.delete(thenable); workInProgressRoot === root && renderExpirationTime === suspendedTime - ? prepareFreshStack(root, renderExpirationTime) + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) : root.lastPendingTime < suspendedTime || ((thenable = root.pingTime), (0 !== thenable && thenable < suspendedTime) || ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), (thenable = requestCurrentTime()), (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), scheduleCallbackForRoot(root, thenable, suspendedTime))); @@ -6146,7 +6663,7 @@ function resolveRetryThenable(boundaryFiber, thenable) { var retryCache = boundaryFiber.stateNode; null !== retryCache && retryCache.delete(thenable); retryCache = requestCurrentTime(); - thenable = computeExpirationForFiber(retryCache, boundaryFiber); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); retryCache = inferPriorityFromExpirationTime(retryCache, thenable); boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); null !== boundaryFiber && @@ -6199,6 +6716,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress, renderExpirationTime ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6206,6 +6728,33 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); return null !== workInProgress ? workInProgress.sibling : null; } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; } return bailoutOnAlreadyFinishedWork( current$$1, @@ -6218,31 +6767,31 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress.expirationTime = 0; switch (workInProgress.tag) { case 2: - updateExpirationTime = workInProgress.elementType; + updateExpirationTime = workInProgress.type; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - var context = getMaskedContext( + renderState = getMaskedContext( workInProgress, contextStackCursor.current ); prepareToReadContext(workInProgress, renderExpirationTime); - context = renderWithHooks( + renderState = renderWithHooks( null, workInProgress, updateExpirationTime, current$$1, - context, + renderState, renderExpirationTime ); workInProgress.effectTag |= 1; if ( - "object" === typeof context && - null !== context && - "function" === typeof context.render && - void 0 === context.$$typeof + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof ) { workInProgress.tag = 1; resetHooks(); @@ -6251,8 +6800,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { pushContextProvider(workInProgress); } else hasContext = !1; workInProgress.memoizedState = - null !== context.state && void 0 !== context.state - ? context.state + null !== renderState.state && void 0 !== renderState.state + ? renderState.state : null; var getDerivedStateFromProps = updateExpirationTime.getDerivedStateFromProps; @@ -6263,9 +6812,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { getDerivedStateFromProps, current$$1 ); - context.updater = classComponentUpdater; - workInProgress.stateNode = context; - context._reactInternalFiber = workInProgress; + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; mountClassInstance( workInProgress, updateExpirationTime, @@ -6285,28 +6834,28 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( null, workInProgress, - context, + renderState, renderExpirationTime ), (workInProgress = workInProgress.child); return workInProgress; case 16: - context = workInProgress.elementType; + renderState = workInProgress.elementType; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - context = readLazyComponentType(context); - workInProgress.type = context; - hasContext = workInProgress.tag = resolveLazyComponentTag(context); - current$$1 = resolveDefaultProps(context, current$$1); + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); switch (hasContext) { case 0: workInProgress = updateFunctionComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6315,7 +6864,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateClassComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6324,7 +6873,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateForwardRef( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6333,49 +6882,51 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateMemoComponent( null, workInProgress, - context, - resolveDefaultProps(context.type, current$$1), + renderState, + resolveDefaultProps(renderState.type, current$$1), updateExpirationTime, renderExpirationTime ); break; default: throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - context + - ". Lazy element type must resolve to a class or function." + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) ); } return workInProgress; case 0: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateFunctionComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); case 1: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateClassComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6384,10 +6935,12 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { updateExpirationTime = workInProgress.updateQueue; if (null === updateExpirationTime) throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); - context = workInProgress.memoizedState; - context = null !== context ? context.element : null; + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; processUpdateQueue( workInProgress, updateExpirationTime, @@ -6396,7 +6949,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); updateExpirationTime = workInProgress.memoizedState.element; - updateExpirationTime === context + updateExpirationTime === renderState ? (workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6460,16 +7013,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 11: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateForwardRef( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6507,9 +7060,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 10: a: { updateExpirationTime = workInProgress.type._context; - context = workInProgress.pendingProps; + renderState = workInProgress.pendingProps; getDerivedStateFromProps = workInProgress.memoizedProps; - hasContext = context.value; + hasContext = renderState.value; pushProvider(workInProgress, hasContext); if (null !== getDerivedStateFromProps) { var oldValue = getDerivedStateFromProps.value; @@ -6523,7 +7076,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { : 1073741823) | 0; if (0 === hasContext) { if ( - getDerivedStateFromProps.children === context.children && + getDerivedStateFromProps.children === renderState.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -6540,16 +7093,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== oldValue; ) { - var list = oldValue.contextDependencies; + var list = oldValue.dependencies; if (null !== list) { getDerivedStateFromProps = oldValue.child; - for (var dependency = list.first; null !== dependency; ) { + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { if ( dependency.context === updateExpirationTime && 0 !== (dependency.observedBits & hasContext) ) { 1 === oldValue.tag && - ((dependency = createUpdate(renderExpirationTime)), + ((dependency = createUpdate(renderExpirationTime, null)), (dependency.tag = 2), enqueueUpdate(oldValue, dependency)); oldValue.expirationTime < renderExpirationTime && @@ -6558,22 +7115,10 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== dependency && dependency.expirationTime < renderExpirationTime && (dependency.expirationTime = renderExpirationTime); - dependency = renderExpirationTime; - for (var node = oldValue.return; null !== node; ) { - var alternate = node.alternate; - if (node.childExpirationTime < dependency) - (node.childExpirationTime = dependency), - null !== alternate && - alternate.childExpirationTime < dependency && - (alternate.childExpirationTime = dependency); - else if ( - null !== alternate && - alternate.childExpirationTime < dependency - ) - alternate.childExpirationTime = dependency; - else break; - node = node.return; - } + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); list.expirationTime < renderExpirationTime && (list.expirationTime = renderExpirationTime); break; @@ -6613,7 +7158,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( current$$1, workInProgress, - context.children, + renderState.children, renderExpirationTime ); workInProgress = workInProgress.child; @@ -6621,12 +7166,15 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { return workInProgress; case 9: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = workInProgress.pendingProps), (updateExpirationTime = hasContext.children), prepareToReadContext(workInProgress, renderExpirationTime), - (context = readContext(context, hasContext.unstable_observedBits)), - (updateExpirationTime = updateExpirationTime(context)), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), (workInProgress.effectTag |= 1), reconcileChildren( current$$1, @@ -6638,16 +7186,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); case 14: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = resolveDefaultProps( - context, + renderState, workInProgress.pendingProps )), - (hasContext = resolveDefaultProps(context.type, hasContext)), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), updateMemoComponent( current$$1, workInProgress, - context, + renderState, hasContext, updateExpirationTime, renderExpirationTime @@ -6665,11 +7213,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 17: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), @@ -6682,13 +7230,13 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { constructClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), mountClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), finishClassComponent( @@ -6700,13 +7248,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ) ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); }; -function schedulePendingInteraction(root, expirationTime) { - var interactions = tracing.__interactionsRef.current; +function scheduleInteractions(root, expirationTime, interactions) { if (0 < interactions.size) { var pendingInteractionMap = root.pendingInteractionMap, pendingInteractions = pendingInteractionMap.get(expirationTime); @@ -6727,7 +7282,7 @@ function schedulePendingInteraction(root, expirationTime) { ); } } -function startWorkOnPendingInteraction(root, expirationTime) { +function startWorkOnPendingInteractions(root, expirationTime) { var interactions = new Set(); root.pendingInteractionMap.forEach(function( scheduledInteractions, @@ -6752,7 +7307,6 @@ function startWorkOnPendingInteraction(root, expirationTime) { } } } - performWork(0, !0); } function finishPendingInteractions(root, committedExpirationTime) { var earliestRemainingTimeAfterCommit = root.firstPendingTime, @@ -6792,14 +7346,248 @@ function finishPendingInteractions(root, committedExpirationTime) { }); } } +var onCommitFiberRoot = null, + onCommitFiberUnmount = null, + isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = 64 === (root.current.effectTag & 64), + currentTime = requestCurrentTime(), + priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; + this.actualDuration = 0; + this.actualStartTime = -1; + this.treeBaseDuration = this.selfBaseDuration = 0; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null), + (workInProgress.actualDuration = 0), + (workInProgress.actualStartTime = -1)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); +} function findHostInstance(component) { var fiber = component._reactInternalFiber; if (void 0 === fiber) { if ("function" === typeof component.render) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } component = findCurrentHostFiber(fiber); @@ -6807,8 +7595,13 @@ function findHostInstance(component) { } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current, - currentTime = requestCurrentTime(); - current$$1 = computeExpirationForFiber(currentTime, current$$1); + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); currentTime = container.current; a: if (parentComponent) { parentComponent = parentComponent._reactInternalFiber; @@ -6818,7 +7611,9 @@ function updateContainer(element, container, parentComponent, callback) { 1 !== parentComponent.tag ) throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) ); var parentContext = parentComponent; do { @@ -6837,7 +7632,9 @@ function updateContainer(element, container, parentComponent, callback) { parentContext = parentContext.return; } while (null !== parentContext); throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (1 === parentComponent.tag) { @@ -6857,12 +7654,11 @@ function updateContainer(element, container, parentComponent, callback) { ? (container.context = parentComponent) : (container.pendingContext = parentComponent); container = callback; - callback = createUpdate(current$$1); - callback.payload = { element: element }; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; container = void 0 === container ? null : container; - null !== container && (callback.callback = container); - flushPassiveEffects(); - enqueueUpdate(currentTime, callback); + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); scheduleUpdateOnFiber(currentTime, current$$1); return current$$1; } @@ -6877,7 +7673,7 @@ function createPortal(children, containerInfo, implementation) { implementation: implementation }; } -function _inherits(subClass, superClass) { +function _inherits$1(subClass, superClass) { if ("function" !== typeof superClass && null !== superClass) throw new TypeError( "Super expression must either be null or a function, not " + @@ -6899,9 +7695,10 @@ function _inherits(subClass, superClass) { var getInspectorDataForViewTag = void 0; getInspectorDataForViewTag = function() { throw ReactError( - "getInspectorDataForViewTag() is not available in production" + Error("getInspectorDataForViewTag() is not available in production") ); }; +var fabricDispatchCommand = nativeFabricUIManager.dispatchCommand; function findNodeHandle(componentOrHandle) { if (null == componentOrHandle) return null; if ("number" === typeof componentOrHandle) return componentOrHandle; @@ -6915,19 +7712,19 @@ function findNodeHandle(componentOrHandle) { ? componentOrHandle.canonical._nativeTag : componentOrHandle._nativeTag; } -_batchedUpdatesImpl = function(fn, a) { - if (0 !== workPhase) return fn(a); - workPhase = 1; +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; try { return fn(a); } finally { - (workPhase = 0), flushImmediateQueue(); + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); } }; -_flushInteractiveUpdatesImpl = function() { - workPhase !== RenderPhase && - workPhase !== CommitPhase && - flushPendingDiscreteUpdates(); +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); }; var roots = new Map(), ReactFabric = { @@ -6946,12 +7743,16 @@ var roots = new Map(), ? this : call; } - _inherits(ReactNativeComponent, _React$Component); + _inherits$1(ReactNativeComponent, _React$Component); ReactNativeComponent.prototype.blur = function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.focus = function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.measure = function(callback) { var maybeInstance = void 0; @@ -6964,7 +7765,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6980,7 +7781,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7002,7 +7803,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -7026,7 +7827,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -7038,12 +7839,21 @@ var roots = new Map(), })(findNodeHandle, findHostInstance), findNodeHandle: findNodeHandle, setNativeProps: function() {}, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + null != handle._internalInstanceHandle && + fabricDispatchCommand( + handle._internalInstanceHandle.stateNode.node, + command, + args + ); + }, render: function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, !1); + root = new FiberRootNode(containerTag, 0, !1); var uninitializedFiber = 0; - isDevToolsPresent && (uninitializedFiber |= 4); + isDevToolsPresent && (uninitializedFiber |= 8); uninitializedFiber = createFiber(3, null, null, uninitializedFiber); root.current = uninitializedFiber; uninitializedFiber.stateNode = root; @@ -7090,7 +7900,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7106,7 +7916,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7124,7 +7934,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -7148,7 +7958,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -7156,10 +7966,14 @@ var roots = new Map(), } }, focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; })(findNodeHandle, findHostInstance) @@ -7182,7 +7996,12 @@ var roots = new Map(), return findFiberByHostInstance ? findFiberByHostInstance(instance) : null; - } + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null }) ); })({ diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js new file mode 100644 index 00000000000000..7304078eaa2790 --- /dev/null +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -0,0 +1,23104 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +'use strict'; + +if (__DEV__) { + (function() { +"use strict"; + +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"); +var React = require("react"); +var checkPropTypes = require("prop-types/checkPropTypes"); +var Scheduler = require("scheduler"); +var tracing = require("scheduler/tracing"); + +// Do not require this module directly! Use normal `invariant` calls with +// template literal strings. The messages will be converted to ReactError during +// build, and in production they will be minified. + +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} + +/** + * 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. + */ + +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; + +/** + * Injectable mapping from names to event plugin modules. + */ +var namesToPlugins = {}; + +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + (function() { + if (!(pluginIndex > -1)) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + } + })(); + if (plugins[pluginIndex]) { + continue; + } + (function() { + if (!pluginModule.extractEvents) { + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + } + })(); + plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + for (var eventName in publishedEvents) { + (function() { + if ( + !publishEventForPlugin( + publishedEvents[eventName], + pluginModule, + eventName + ) + ) { + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + })(); + } + } +} + +/** + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private + */ +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + (function() { + if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName + + "`." + ) + ); + } + })(); + eventNameDispatchConfigs[eventName] = dispatchConfig; + + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName( + phasedRegistrationName, + pluginModule, + eventName + ); + } + } + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName( + dispatchConfig.registrationName, + pluginModule, + eventName + ); + return true; + } + return false; +} + +/** + * Publishes a registration name that is used to identify dispatched events. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private + */ +function publishRegistrationName(registrationName, pluginModule, eventName) { + (function() { + if (!!registrationNameModules[registrationName]) { + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + } + })(); + registrationNameModules[registrationName] = pluginModule; + registrationNameDependencies[registrationName] = + pluginModule.eventTypes[eventName].dependencies; + + { + var lowerCasedName = registrationName.toLowerCase(); + } +} + +/** + * Registers plugins so that they can extract and dispatch events. + * + * @see {EventPluginHub} + */ + +/** + * Ordered list of injected plugins. + */ +var plugins = []; + +/** + * Mapping from event name to dispatch config + */ +var eventNameDispatchConfigs = {}; + +/** + * Mapping from registration name to plugin module + */ +var registrationNameModules = {}; + +/** + * Mapping from registration name to event name + */ +var registrationNameDependencies = {}; + +/** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in true. + * @type {Object} + */ + +// Trust the developer to only use possibleRegistrationNames in true + +/** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + * @see {EventPluginHub.injection.injectEventPluginOrder} + */ +function injectEventPluginOrder(injectedEventPluginOrder) { + (function() { + if (!!eventPluginOrder) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + } + })(); + // Clone the ordering so it cannot be dynamically mutated. + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); +} + +/** + * Injects plugins to be used by `EventPluginHub`. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. + * + * Plugins can be injected as part of page initialization or on-the-fly. + * + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + * @see {EventPluginHub.injection.injectEventPluginsByName} + */ +function injectEventPluginsByName(injectedNamesToPlugins) { + var isOrderingDirty = false; + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + (function() { + if (!!namesToPlugins[pluginName]) { + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + } + })(); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; + } + } + if (isOrderingDirty) { + recomputePluginOrdering(); + } +} + +var invokeGuardedCallbackImpl = function( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +}; + +{ + // 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 + // "Pause on exceptions" behavior. Because React wraps all user-provided + // functions in invokeGuardedCallback, and the production version of + // invokeGuardedCallback uses a try-catch, all user exceptions are treated + // like caught exceptions, and the DevTools won't pause unless the developer + // takes the extra step of enabling pause on caught exceptions. This is + // unintuitive, though, because even though React has caught the error, from + // the developer's perspective, the error is uncaught. + // + // To preserve the expected "Pause on exceptions" behavior, we don't use a + // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake + // DOM node, and call the user-provided callback from inside an event handler + // for that fake event. If the callback throws, the error is "captured" using + // a global event handler. But because the error happens in a different + // event loop context, it does not interrupt the normal program flow. + // Effectively, this gives us try-catch behavior without actually using + // try-catch. Neat! + + // Check that the browser supports the APIs we need to implement our special + // DEV version of invokeGuardedCallback + if ( + typeof window !== "undefined" && + typeof window.dispatchEvent === "function" && + typeof document !== "undefined" && + typeof document.createEvent === "function" + ) { + var fakeNode = document.createElement("react"); + + var invokeGuardedCallbackDev = function( + name, + func, + context, + a, + b, + c, + d, + e, + f + ) { + // If document doesn't exist we know for sure we will crash in this method + // when we call document.createEvent(). However this can cause confusing + // errors: https://github.com/facebookincubator/create-react-app/issues/3482 + // So we preemptively throw with a better message instead. + (function() { + if (!(typeof document !== "undefined")) { + throw ReactError( + Error( + "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + ) + ); + } + })(); + var evt = document.createEvent("Event"); + + // Keeps track of whether the user-provided callback threw an error. We + // set this to true at the beginning, then set it to false right after + // calling the function. If the function errors, `didError` will never be + // set to false. This strategy works even if the browser is flaky and + // fails to call our global error handler, because it doesn't rely on + // the error event at all. + var didError = true; + + // Keeps track of the value of window.event so that we can reset it + // during the callback to let user code access window.event in the + // browsers that support it. + var windowEvent = window.event; + + // Keeps track of the descriptor of window.event to restore it after event + // dispatching: https://github.com/facebook/react/issues/13688 + var windowEventDescriptor = Object.getOwnPropertyDescriptor( + window, + "event" + ); + + // Create an event handler for our fake event. We will synchronously + // dispatch our fake event using `dispatchEvent`. Inside the handler, we + // call the user-provided callback. + var funcArgs = Array.prototype.slice.call(arguments, 3); + function callCallback() { + // We immediately remove the callback from event listeners so that + // nested `invokeGuardedCallback` calls do not clash. Otherwise, a + // nested call would trigger the fake event handlers of any call higher + // in the stack. + fakeNode.removeEventListener(evtType, callCallback, false); + + // We check for window.hasOwnProperty('event') to prevent the + // window.event assignment in both IE <= 10 as they throw an error + // "Member not found" in strict mode, and in Firefox which does not + // support window.event. + if ( + typeof window.event !== "undefined" && + window.hasOwnProperty("event") + ) { + window.event = windowEvent; + } + + func.apply(context, funcArgs); + didError = false; + } + + // Create a global error event handler. We use this to capture the value + // that was thrown. It's possible that this error handler will fire more + // than once; for example, if non-React code also calls `dispatchEvent` + // and a handler for that event throws. We should be resilient to most of + // those cases. Even if our error event handler fires more than once, the + // last error event is always used. If the callback actually does error, + // we know that the last error event is the correct one, because it's not + // possible for anything else to have happened in between our callback + // erroring and the code that follows the `dispatchEvent` call below. If + // the callback doesn't error, but the error event was fired, we know to + // ignore it because `didError` will be false, as described above. + var error = void 0; + // Use this to track whether the error event is ever called. + var didSetError = false; + var isCrossOriginError = false; + + function handleWindowError(event) { + error = event.error; + didSetError = true; + if (error === null && event.colno === 0 && event.lineno === 0) { + isCrossOriginError = true; + } + if (event.defaultPrevented) { + // Some other error handler has prevented default. + // Browsers silence the error report if this happens. + // We'll remember this to later decide whether to log it or not. + if (error != null && typeof error === "object") { + try { + error._suppressLogging = true; + } catch (inner) { + // Ignore. + } + } + } + } + + // Create a fake event type. + var evtType = "react-" + (name ? name : "invokeguardedcallback"); + + // Attach our event handlers + window.addEventListener("error", handleWindowError); + fakeNode.addEventListener(evtType, callCallback, false); + + // Synchronously dispatch our fake event. If the user-provided function + // errors, it will trigger our global error handler. + evt.initEvent(evtType, false, false); + fakeNode.dispatchEvent(evt); + + if (windowEventDescriptor) { + Object.defineProperty(window, "event", windowEventDescriptor); + } + + if (didError) { + if (!didSetError) { + // The callback errored, but the error event never fired. + error = new Error( + "An error was thrown inside one of your components, but React " + + "doesn't know what it was. This is likely due to browser " + + 'flakiness. React does its best to preserve the "Pause on ' + + 'exceptions" behavior of the DevTools, which requires some ' + + "DEV-mode only tricks. It's possible that these don't work in " + + "your browser. Try triggering the error in production mode, " + + "or switching to a modern browser. If you suspect that this is " + + "actually an issue with React, please file an issue." + ); + } else if (isCrossOriginError) { + error = new Error( + "A cross-origin error was thrown. React doesn't have access to " + + "the actual error object in development. " + + "See https://fb.me/react-crossorigin-error for more information." + ); + } + this.onError(error); + } + + // Remove our event listeners + window.removeEventListener("error", handleWindowError); + }; + + invokeGuardedCallbackImpl = invokeGuardedCallbackDev; + } +} + +var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; + +// Used by Fiber to simulate a try-catch. +var hasError = false; +var caughtError = null; + +// Used by event system to capture/rethrow the first error. +var hasRethrowError = false; +var rethrowError = null; + +var reporter = { + onError: function(error) { + hasError = true; + caughtError = error; + } +}; + +/** + * 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 + */ +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = false; + caughtError = null; + invokeGuardedCallbackImpl$1.apply(reporter, arguments); +} + +/** + * 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 + */ +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + var error = clearCaughtError(); + if (!hasRethrowError) { + hasRethrowError = true; + rethrowError = error; + } + } +} + +/** + * During execution of guarded functions we will capture the first error which + * we will rethrow to be handled by the top level error handler. + */ +function rethrowCaughtError() { + if (hasRethrowError) { + var error = rethrowError; + hasRethrowError = false; + rethrowError = null; + throw error; + } +} + +function hasCaughtError() { + return hasError; +} + +function clearCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + return error; + } else { + (function() { + { + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } +} + +/** + * 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]; + } + + 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 argsWithFormat = args.map(function(item) { + return "" + item; + }); + argsWithFormat.unshift("Warning: " + format); + + // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + Function.prototype.apply.call(console.error, console, argsWithFormat); + } + 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) {} + }; +} + +var warningWithoutStack$1 = warningWithoutStack; + +var getFiberCurrentPropsFromNode = null; +var getInstanceFromNode = null; +var getNodeFromInstance = null; + +function setComponentTree( + getFiberCurrentPropsFromNodeImpl, + getInstanceFromNodeImpl, + getNodeFromInstanceImpl +) { + getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; + getInstanceFromNode = getInstanceFromNodeImpl; + getNodeFromInstance = getNodeFromInstanceImpl; + { + !(getNodeFromInstance && getInstanceFromNode) + ? warningWithoutStack$1( + false, + "EventPluginUtils.setComponentTree(...): Injected " + + "module is missing getNodeFromInstance or getInstanceFromNode." + ) + : void 0; + } +} + +var validateEventDispatches = void 0; +{ + validateEventDispatches = function(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr + ? dispatchListeners.length + : dispatchListeners + ? 1 + : 0; + + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr + ? dispatchInstances.length + : dispatchInstances + ? 1 + : 0; + + !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) + ? warningWithoutStack$1(false, "EventPluginUtils: Invalid `event`.") + : void 0; + }; +} + +/** + * Dispatch the event to the listener. + * @param {SyntheticEvent} event SyntheticEvent to handle + * @param {function} listener Application-level callback + * @param {*} inst Internal component instance + */ +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + event.currentTarget = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches. + */ +function executeDispatchesInOrder(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, dispatchListeners, dispatchInstances); + } + event._dispatchListeners = null; + event._dispatchInstances = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches, but stops + * at the first dispatch execution returning true, and returns that id. + * + * @return {?string} id of the first dispatch execution who's listener returns + * true, or null if no listener returned true. + */ +function executeDispatchesInOrderStopAtTrueImpl(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + if (dispatchListeners[i](event, dispatchInstances[i])) { + return dispatchInstances[i]; + } + } + } else if (dispatchListeners) { + if (dispatchListeners(event, dispatchInstances)) { + return dispatchInstances; + } + } + return null; +} + +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ +function executeDispatchesInOrderStopAtTrue(event) { + var ret = executeDispatchesInOrderStopAtTrueImpl(event); + event._dispatchInstances = null; + event._dispatchListeners = null; + return ret; +} + +/** + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. + * + * @return {*} The return value of executing the single dispatch. + */ +function executeDirectDispatch(event) { + { + validateEventDispatches(event); + } + var dispatchListener = event._dispatchListeners; + var dispatchInstance = event._dispatchInstances; + (function() { + if (!!Array.isArray(dispatchListener)) { + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + } + })(); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + var res = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return res; +} + +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ +function hasDispatches(event) { + return !!event._dispatchListeners; +} + +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. + */ + +function accumulateInto(current, next) { + (function() { + if (!(next != null)) { + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + } + })(); + + if (current == null) { + return next; + } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + current.push(next); + return current; + } + + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; +} + +/** + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + * @param {function} cb Callback invoked with each element or a collection. + * @param {?} [scope] Scope used as `this` in a callback. + */ +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); + } +} + +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ +var eventQueue = null; + +/** + * Dispatches an event and releases it back into the pool, unless persistent. + * + * @param {?object} event Synthetic event to be dispatched. + * @private + */ +var executeDispatchesAndRelease = function(event) { + if (event) { + executeDispatchesInOrder(event); + + if (!event.isPersistent()) { + event.constructor.release(event); + } + } +}; +var executeDispatchesAndReleaseTopLevel = function(e) { + return executeDispatchesAndRelease(e); +}; + +function runEventsInBatch(events) { + if (events !== null) { + eventQueue = accumulateInto(eventQueue, events); + } + + // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + var processingEventQueue = eventQueue; + eventQueue = null; + + if (!processingEventQueue) { + return; + } + + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + (function() { + if (!!eventQueue) { + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + } + })(); + // This would be a good time to rethrow if any of the event handlers threw. + rethrowCaughtError(); +} + +function isInteractive(tag) { + return ( + tag === "button" || + tag === "input" || + tag === "select" || + tag === "textarea" + ); +} + +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + return !!(props.disabled && isInteractive(type)); + default: + return false; + } +} + +/** + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. + * + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public + */ + +/** + * Methods for injecting dependencies. + */ +var injection = { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: injectEventPluginOrder, + + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: injectEventPluginsByName +}; + +/** + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ +function getListener(inst, registrationName) { + var listener = void 0; + + // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not + // live here; needs to be moved to a better place soon + var stateNode = inst.stateNode; + if (!stateNode) { + // Work in progress (ex: onload events in incremental mode). + return null; + } + var props = getFiberCurrentPropsFromNode(stateNode); + if (!props) { + // Work in progress. + return null; + } + listener = props[registrationName]; + if (shouldPreventMouseEvent(registrationName, inst.type, props)) { + return null; + } + (function() { + if (!(!listener || typeof listener === "function")) { + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + } + })(); + return listener; +} + +/** + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. + * + * @return {*} An accumulation of synthetic events. + * @internal + */ +function extractPluginEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + var events = null; + for (var i = 0; i < plugins.length; i++) { + // Not every plugin in the ordering may be loaded at runtime. + var possiblePlugin = plugins[i]; + if (possiblePlugin) { + var extractedEvents = possiblePlugin.extractEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); + } + } + } + return events; +} + +function runExtractedPluginEventsInBatch( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + var events = extractPluginEvents( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ); + runEventsInBatch(events); +} + +var FunctionComponent = 0; +var ClassComponent = 1; +var IndeterminateComponent = 2; // Before we know whether it is function or class +var HostRoot = 3; // Root of a host tree. Could be nested inside another node. +var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. +var HostComponent = 5; +var HostText = 6; +var Fragment = 7; +var Mode = 8; +var ContextConsumer = 9; +var ContextProvider = 10; +var ForwardRef = 11; +var Profiler = 12; +var SuspenseComponent = 13; +var MemoComponent = 14; +var SimpleMemoComponent = 15; +var LazyComponent = 16; +var IncompleteClassComponent = 17; +var DehydratedSuspenseComponent = 18; +var SuspenseListComponent = 19; +var FundamentalComponent = 20; + +function getParent(inst) { + do { + 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 + // host node but that wouldn't work for React Native and doesn't let us + // do the portal feature. + } while (inst && inst.tag !== HostComponent); + if (inst) { + return inst; + } + return null; +} + +/** + * Return the lowest common ancestor of A and B, or null if they are in + * different trees. + */ +function getLowestCommonAncestor(instA, instB) { + var depthA = 0; + for (var tempA = instA; tempA; tempA = getParent(tempA)) { + depthA++; + } + var depthB = 0; + for (var tempB = instB; tempB; tempB = getParent(tempB)) { + depthB++; + } + + // If A is deeper, crawl up. + while (depthA - depthB > 0) { + instA = getParent(instA); + depthA--; + } + + // If B is deeper, crawl up. + while (depthB - depthA > 0) { + instB = getParent(instB); + depthB--; + } + + // Walk in lockstep until we find a match. + var depth = depthA; + while (depth--) { + if (instA === instB || instA === instB.alternate) { + return instA; + } + instA = getParent(instA); + instB = getParent(instB); + } + return null; +} + +/** + * Return if A is an ancestor of B. + */ +function isAncestor(instA, instB) { + while (instB) { + if (instA === instB || instA === instB.alternate) { + return true; + } + instB = getParent(instB); + } + return false; +} + +/** + * Return the parent instance of the passed-in instance. + */ +function getParentInstance(inst) { + return getParent(inst); +} + +/** + * Simulates the traversal of a two-phase, capture/bubble event dispatch. + */ +function traverseTwoPhase(inst, fn, arg) { + var path = []; + while (inst) { + path.push(inst); + inst = getParent(inst); + } + var i = void 0; + for (i = path.length; i-- > 0; ) { + fn(path[i], "captured", arg); + } + for (i = 0; i < path.length; i++) { + fn(path[i], "bubbled", arg); + } +} + +/** + * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that + * should would receive a `mouseEnter` or `mouseLeave` event. + * + * Does not invoke the callback on the nearest common ancestor because nothing + * "entered" or "left" that element. + */ + +/** + * Some event types have a notion of different registration names for different + * "phases" of propagation. This finds listeners by a given phase. + */ +function listenerAtPhase(inst, event, propagationPhase) { + var registrationName = + event.dispatchConfig.phasedRegistrationNames[propagationPhase]; + return getListener(inst, registrationName); +} + +/** + * A small set of propagation patterns, each of which will accept a small amount + * of information, and generate a set of "dispatch ready event objects" - which + * are sets of events that have already been annotated with a set of dispatched + * listener functions/ids. The API is designed this way to discourage these + * propagation strategies from actually executing the dispatches, since we + * always want to collect the entire set of dispatches before executing even a + * single one. + */ + +/** + * Tags a `SyntheticEvent` with dispatched listeners. Creating this function + * here, allows us to not have to bind or create functions for each event. + * Mutating the event's members allows us to not have to create a wrapping + * "dispatch" object that pairs the event with the listener. + */ +function accumulateDirectionalDispatches(inst, phase, event) { + { + !inst + ? warningWithoutStack$1(false, "Dispatching inst must not be null") + : void 0; + } + var listener = listenerAtPhase(inst, event, phase); + if (listener) { + event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + ); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } +} + +/** + * Collect dispatches (must be entirely collected before dispatching - see unit + * tests). Lazily allocate the array to conserve memory. We must loop through + * each event and perform the traversal for each one. We cannot perform a + * single traversal for the entire collection of events because each event may + * have a different target. + */ +function accumulateTwoPhaseDispatchesSingle(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + */ +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + var parentInst = targetInst ? getParentInstance(targetInst) : null; + traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Accumulates without regard to direction, does not look for phased + * registration names. Same as `accumulateDirectDispatchesSingle` but without + * requiring that the `dispatchMarker` be the same as the dispatched ID. + */ +function accumulateDispatches(inst, ignoredDirection, event) { + if (inst && event && event.dispatchConfig.registrationName) { + var registrationName = event.dispatchConfig.registrationName; + var listener = getListener(inst, registrationName); + if (listener) { + event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + ); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } + } +} + +/** + * Accumulates dispatches on an `SyntheticEvent`, but only for the + * `dispatchMarker`. + * @param {SyntheticEvent} event + */ +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + accumulateDispatches(event._targetInst, null, event); + } +} + +function accumulateTwoPhaseDispatches(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); +} + +function accumulateTwoPhaseDispatchesSkipTarget(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); +} + +function accumulateDirectDispatches(events) { + forEachAccumulated(events, accumulateDirectDispatchesSingle); +} + +/* eslint valid-typeof: 0 */ + +var EVENT_POOL_SIZE = 10; + +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var EventInterface = { + type: null, + target: null, + // currentTarget is set when dispatching; no use in copying it here + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + 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. + * + * These systems should generally use pooling to reduce the frequency of garbage + * collection. The system should check `isPersistent` to determine whether the + * event should be released into the pool after being dispatched. Users that + * need a persisted event should invoke `persist`. + * + * Synthetic events (and subclasses) implement the DOM Level 3 Events API by + * normalizing browser quirks. Subclasses do not necessarily have to implement a + * DOM interface; custom application-specific events can also subclass this. + * + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {*} targetInst Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @param {DOMEventTarget} nativeEventTarget Target node. + */ +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + { + // these have a getter/setter for warnings + delete this.nativeEvent; + delete this.preventDefault; + delete this.stopPropagation; + delete this.isDefaultPrevented; + delete this.isPropagationStopped; + } + + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (!Interface.hasOwnProperty(propName)) { + continue; + } + { + delete this[propName]; // this has a getter/setter for warnings + } + var normalize = Interface[propName]; + if (normalize) { + this[propName] = normalize(nativeEvent); + } else { + if (propName === "target") { + this.target = nativeEventTarget; + } else { + this[propName] = nativeEvent[propName]; + } + } + } + + var defaultPrevented = + nativeEvent.defaultPrevented != null + ? nativeEvent.defaultPrevented + : nativeEvent.returnValue === false; + if (defaultPrevented) { + this.isDefaultPrevented = functionThatReturnsTrue; + } else { + this.isDefaultPrevented = functionThatReturnsFalse; + } + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} + +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = true; + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.preventDefault) { + event.preventDefault(); + } else if (typeof event.returnValue !== "unknown") { + event.returnValue = false; + } + this.isDefaultPrevented = functionThatReturnsTrue; + }, + + stopPropagation: function() { + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.stopPropagation) { + event.stopPropagation(); + } else if (typeof event.cancelBubble !== "unknown") { + // The ChangeEventPlugin registers a "propertychange" event for + // IE. This event does not support bubbling or cancelling, and + // any references to cancelBubble throw "Member not found". A + // typeof check of "unknown" circumvents this issue (and is also + // IE specific). + event.cancelBubble = true; + } + + this.isPropagationStopped = functionThatReturnsTrue; + }, + + /** + * We release all dispatched `SyntheticEvent`s after each event loop, adding + * them back into the pool. This allows a way to hold onto a reference that + * won't be added back into the pool. + */ + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + + /** + * Checks if this event should be released back into the pool. + * + * @return {boolean} True if this should not be released, false otherwise. + */ + isPersistent: functionThatReturnsFalse, + + /** + * `PooledClass` looks for `destructor` on each instance it releases. + */ + destructor: function() { + var Interface = this.constructor.Interface; + for (var propName in Interface) { + { + Object.defineProperty( + this, + propName, + getPooledWarningPropertyDefinition(propName, Interface[propName]) + ); + } + } + 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, + "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() {}) + ); + } + } +}); + +SyntheticEvent.Interface = EventInterface; + +/** + * Helper to reduce boilerplate when creating subclasses. + */ +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); + } + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + + return Class; +}; + +addEventPoolingTo(SyntheticEvent); + +/** + * Helper to nullify syntheticEvent instance properties when destructing + * + * @param {String} propName + * @param {?object} getVal + * @return {object} defineProperty object + */ +function getPooledWarningPropertyDefinition(propName, getVal) { + var isFunction = typeof getVal === "function"; + return { + configurable: true, + set: set, + get: get + }; + + function set(val) { + var action = isFunction ? "setting the method" : "setting the property"; + warn(action, "This is effectively a no-op"); + return val; + } + + function get() { + var action = isFunction ? "accessing the method" : "accessing the property"; + var result = isFunction + ? "This is a no-op function" + : "This is set to null"; + warn(action, result); + return getVal; + } + + function warn(action, result) { + var warningCondition = false; + !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; + } +} + +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + var EventConstructor = this; + if (EventConstructor.eventPool.length) { + var instance = EventConstructor.eventPool.pop(); + EventConstructor.call( + instance, + dispatchConfig, + targetInst, + nativeEvent, + nativeInst + ); + return instance; + } + return new EventConstructor( + dispatchConfig, + targetInst, + nativeEvent, + nativeInst + ); +} + +function releasePooledEvent(event) { + var EventConstructor = this; + (function() { + if (!(event instanceof EventConstructor)) { + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + } + })(); + event.destructor(); + if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { + EventConstructor.eventPool.push(event); + } +} + +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} + +/** + * `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 ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function(nativeEvent) { + return null; // Actually doesn't even look at the native event. + } +}); + +var TOP_TOUCH_START = "topTouchStart"; +var TOP_TOUCH_MOVE = "topTouchMove"; +var TOP_TOUCH_END = "topTouchEnd"; +var TOP_TOUCH_CANCEL = "topTouchCancel"; +var TOP_SCROLL = "topScroll"; +var TOP_SELECTION_CHANGE = "topSelectionChange"; + +function isStartish(topLevelType) { + return topLevelType === TOP_TOUCH_START; +} + +function isMoveish(topLevelType) { + return topLevelType === TOP_TOUCH_MOVE; +} + +function isEndish(topLevelType) { + return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL; +} + +var startDependencies = [TOP_TOUCH_START]; +var moveDependencies = [TOP_TOUCH_MOVE]; +var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END]; + +/** + * Tracks the position and time of each active touch by `touch.identifier`. We + * should typically only see IDs in the range of 1-20 because IDs get recycled + * when touches end and start again. + */ + +var MAX_TOUCH_BANK = 20; +var touchBank = []; +var touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + // If there is only one active touch, we remember its location. This prevents + // us having to loop through all of the touches all the time in the most + // common case. + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 +}; + +function timestampForTouch(touch) { + // The legacy internal implementation provides "timeStamp", which has been + // renamed to "timestamp". Let both work for now while we iron it out + // TODO (evv): rename timeStamp to timestamp in internal code + return touch.timeStamp || touch.timestamp; +} + +/** + * TODO: Instead of making gestures recompute filtered velocity, we could + * include a built in velocity computation that can be reused globally. + */ +function createTouchRecord(touch) { + return { + touchActive: true, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }; +} + +function resetTouchRecord(touchRecord, touch) { + touchRecord.touchActive = true; + touchRecord.startPageX = touch.pageX; + touchRecord.startPageY = touch.pageY; + touchRecord.startTimeStamp = timestampForTouch(touch); + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchRecord.previousPageX = touch.pageX; + touchRecord.previousPageY = touch.pageY; + touchRecord.previousTimeStamp = timestampForTouch(touch); +} + +function getTouchIdentifier(_ref) { + var identifier = _ref.identifier; + + (function() { + if (!(identifier != null)) { + throw ReactError(Error("Touch object is missing identifier.")); + } + })(); + { + !(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; +} + +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch); + var touchRecord = touchBank[identifier]; + if (touchRecord) { + resetTouchRecord(touchRecord, touch); + } else { + touchBank[identifier] = createTouchRecord(touch); + } + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} + +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + if (touchRecord) { + touchRecord.touchActive = true; + touchRecord.previousPageX = touchRecord.currentPageX; + touchRecord.previousPageY = touchRecord.currentPageY; + touchRecord.previousTimeStamp = touchRecord.currentTimeStamp; + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); + } else { + console.warn( + "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); + } +} + +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + if (touchRecord) { + touchRecord.touchActive = false; + touchRecord.previousPageX = touchRecord.currentPageX; + touchRecord.previousPageY = touchRecord.currentPageY; + touchRecord.previousTimeStamp = touchRecord.currentTimeStamp; + touchRecord.currentPageX = touch.pageX; + touchRecord.currentPageY = touch.pageY; + touchRecord.currentTimeStamp = timestampForTouch(touch); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); + } else { + console.warn( + "Cannot record touch end without a touch start.\n" + "Touch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); + } +} + +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} + +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK)); + if (touchBank.length > MAX_TOUCH_BANK) { + printed += " (original size: " + touchBank.length + ")"; + } + return printed; +} + +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchMove); + } else if (isStartish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchStart); + touchHistory.numberActiveTouches = nativeEvent.touches.length; + if (touchHistory.numberActiveTouches === 1) { + touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier; + } + } else if (isEndish(topLevelType)) { + nativeEvent.changedTouches.forEach(recordTouchEnd); + touchHistory.numberActiveTouches = nativeEvent.touches.length; + if (touchHistory.numberActiveTouches === 1) { + for (var i = 0; i < touchBank.length; i++) { + var touchTrackToCheck = touchBank[i]; + if (touchTrackToCheck != null && touchTrackToCheck.touchActive) { + touchHistory.indexOfSingleActiveTouch = i; + break; + } + } + { + var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch]; + !(activeRecord != null && activeRecord.touchActive) + ? warningWithoutStack$1(false, "Cannot find single active touch.") + : void 0; + } + } + } + }, + + touchHistory: touchHistory +}; + +/** + * Accumulates items that must not be null or undefined. + * + * This is used to conserve memory by avoiding array allocations. + * + * @return {*|array<*>} An accumulation of items. + */ +function accumulate(current, next) { + (function() { + if (!(next != null)) { + throw ReactError( + Error( + "accumulate(...): Accumulated items must not be null or undefined." + ) + ); + } + })(); + + if (current == null) { + return next; + } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + return current.concat(next); + } + + if (Array.isArray(next)) { + return [current].concat(next); + } + + return [current, next]; +} + +/** + * Instance of element that should respond to touch/move types of interactions, + * as indicated explicitly by relevant callbacks. + */ +var responderInst = null; + +/** + * Count of current touches. A textInput should become responder iff the + * selection changes while there is a touch on the screen. + */ +var trackedTouchCount = 0; + +var changeResponder = function(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (ResponderEventPlugin.GlobalResponderHandler !== null) { + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); + } +}; + +var eventTypes = { + /** + * On a `touchStart`/`mouseDown`, is it desired that this element become the + * responder? + */ + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + + /** + * On a `scroll`, is it desired that this element become the responder? This + * is usually not needed, but should be used to retroactively infer that a + * `touchStart` had occurred during momentum scroll. During a momentum scroll, + * a touch start will be immediately followed by a scroll event if the view is + * currently scrolling. + * + * TODO: This shouldn't bubble. + */ + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: [TOP_SCROLL] + }, + + /** + * On text selection change, should this element become the responder? This + * is needed for text inputs or other views with native selection, so the + * JS view can claim the responder. + * + * TODO: This shouldn't bubble. + */ + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: [TOP_SELECTION_CHANGE] + }, + + /** + * On a `touchMove`/`mouseMove`, is it desired that this element become the + * responder? + */ + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + + /** + * Direct responder events dispatched directly to responder. Do not bubble. + */ + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { + registrationName: "onResponderGrant", + dependencies: [] + }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } +}; + +/** + * + * Responder System: + * ---------------- + * + * - A global, solitary "interaction lock" on a view. + * - If a node becomes the responder, it should convey visual feedback + * immediately to indicate so, either by highlighting or moving accordingly. + * - To be the responder means, that touches are exclusively important to that + * responder view, and no other view. + * - While touches are still occurring, the responder lock can be transferred to + * a new view, but only to increasingly "higher" views (meaning ancestors of + * the current responder). + * + * Responder being granted: + * ------------------------ + * + * - Touch starts, moves, and scrolls can cause an ID to become the responder. + * - We capture/bubble `startShouldSetResponder`/`moveShouldSetResponder` to + * the "appropriate place". + * - If nothing is currently the responder, the "appropriate place" is the + * initiating event's `targetID`. + * - If something *is* already the responder, the "appropriate place" is the + * first common ancestor of the event target and the current `responderInst`. + * - Some negotiation happens: See the timing diagram below. + * - Scrolled views automatically become responder. The reasoning is that a + * platform scroll view that isn't built on top of the responder system has + * began scrolling, and the active responder must now be notified that the + * interaction is no longer locked to it - the system has taken over. + * + * - Responder being released: + * As soon as no more touches that *started* inside of descendants of the + * *current* responderInst, an `onResponderRelease` event is dispatched to the + * current responder, and the responder lock is released. + * + * TODO: + * - on "end", a callback hook for `onResponderEndShouldRemainResponder` that + * determines if the responder lock should remain. + * - If a view shouldn't "remain" the responder, any active touches should by + * default be considered "dead" and do not influence future negotiations or + * bubble paths. It should be as if those touches do not exist. + * -- For multitouch: Usually a translate-z will choose to "remain" responder + * after one out of many touches ended. For translate-y, usually the view + * doesn't wish to "remain" responder after one of many touches end. + * - Consider building this on top of a `stopPropagation` model similar to + * `W3C` events. + * - Ensure that `onResponderTerminate` is called on touch cancels, whether or + * not `onResponderTerminationRequest` returns `true` or `false`. + * + */ + +/* Negotiation Performed + +-----------------------+ + / \ +Process low level events to + Current Responder + wantsResponderID +determine who to perform negot-| (if any exists at all) | +iation/transition | Otherwise just pass through| +-------------------------------+----------------------------+------------------+ +Bubble to find first ID | | +to return true:wantsResponderID| | + | | + +-------------+ | | + | onTouchStart| | | + +------+------+ none | | + | return| | ++-----------v-------------+true| +------------------------+ | +|onStartShouldSetResponder|----->|onResponderStart (cur) |<-----------+ ++-----------+-------------+ | +------------------------+ | | + | | | +--------+-------+ + | returned true for| false:REJECT +-------->|onResponderReject + | wantsResponderID | | | +----------------+ + | (now attempt | +------------------+-----+ | + | handoff) | | onResponder | | + +------------------->| TerminationRequest| | + | +------------------+-----+ | + | | | +----------------+ + | true:GRANT +-------->|onResponderGrant| + | | +--------+-------+ + | +------------------------+ | | + | | onResponderTerminate |<-----------+ + | +------------------+-----+ | + | | | +----------------+ + | +-------->|onResponderStart| + | | +----------------+ +Bubble to find first ID | | +to return true:wantsResponderID| | + | | + +-------------+ | | + | onTouchMove | | | + +------+------+ none | | + | return| | ++-----------v-------------+true| +------------------------+ | +|onMoveShouldSetResponder |----->|onResponderMove (cur) |<-----------+ ++-----------+-------------+ | +------------------------+ | | + | | | +--------+-------+ + | returned true for| false:REJECT +-------->|onResponderRejec| + | wantsResponderID | | | +----------------+ + | (now attempt | +------------------+-----+ | + | handoff) | | onResponder | | + +------------------->| TerminationRequest| | + | +------------------+-----+ | + | | | +----------------+ + | true:GRANT +-------->|onResponderGrant| + | | +--------+-------+ + | +------------------------+ | | + | | onResponderTerminate |<-----------+ + | +------------------+-----+ | + | | | +----------------+ + | +-------->|onResponderMove | + | | +----------------+ + | | + | | + Some active touch started| | + inside current responder | +------------------------+ | + +------------------------->| onResponderEnd | | + | | +------------------------+ | + +---+---------+ | | + | onTouchEnd | | | + +---+---------+ | | + | | +------------------------+ | + +------------------------->| onResponderEnd | | + No active touches started| +-----------+------------+ | + inside current responder | | | + | v | + | +------------------------+ | + | | onResponderRelease | | + | +------------------------+ | + | | + + + */ + +/** + * A note about event ordering in the `EventPluginHub`. + * + * Suppose plugins are injected in the following order: + * + * `[R, S, C]` + * + * To help illustrate the example, assume `S` is `SimpleEventPlugin` (for + * `onClick` etc) and `R` is `ResponderEventPlugin`. + * + * "Deferred-Dispatched Events": + * + * - The current event plugin system will traverse the list of injected plugins, + * in order, and extract events by collecting the plugin's return value of + * `extractEvents()`. + * - These events that are returned from `extractEvents` are "deferred + * dispatched events". + * - When returned from `extractEvents`, deferred-dispatched events contain an + * "accumulation" of deferred dispatches. + * - These deferred dispatches are accumulated/collected before they are + * returned, but processed at a later time by the `EventPluginHub` (hence the + * name deferred). + * + * In the process of returning their deferred-dispatched events, event plugins + * themselves can dispatch events on-demand without returning them from + * `extractEvents`. Plugins might want to do this, so that they can use event + * dispatching as a tool that helps them decide which events should be extracted + * in the first place. + * + * "On-Demand-Dispatched Events": + * + * - On-demand-dispatched events are not returned from `extractEvents`. + * - On-demand-dispatched events are dispatched during the process of returning + * the deferred-dispatched events. + * - They should not have side effects. + * - They should be avoided, and/or eventually be replaced with another + * abstraction that allows event plugins to perform multiple "rounds" of event + * extraction. + * + * Therefore, the sequence of event dispatches becomes: + * + * - `R`s on-demand events (if any) (dispatched by `R` on-demand) + * - `S`s on-demand events (if any) (dispatched by `S` on-demand) + * - `C`s on-demand events (if any) (dispatched by `C` on-demand) + * - `R`s extracted events (if any) (dispatched by `EventPluginHub`) + * - `S`s extracted events (if any) (dispatched by `EventPluginHub`) + * - `C`s extracted events (if any) (dispatched by `EventPluginHub`) + * + * In the case of `ResponderEventPlugin`: If the `startShouldSetResponder` + * on-demand dispatch returns `true` (and some other details are satisfied) the + * `onResponderGrant` deferred dispatched event is returned from + * `extractEvents`. The sequence of dispatch executions in this case + * will appear as follows: + * + * - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand) + * - `touchStartCapture` (`EventPluginHub` dispatches as usual) + * - `touchStart` (`EventPluginHub` dispatches as usual) + * - `responderGrant/Reject` (`EventPluginHub` dispatches as usual) + */ + +function setResponderAndExtractTransfer( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget +) { + 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); + + // When capturing/bubbling the "shouldSet" event, we want to skip the target + // (deepest ID) if it happens to be the current responder. The reasoning: + // It's strange to get an `onMoveShouldSetResponder` when you're *already* + // the responder. + var skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst; + var shouldSetEvent = ResponderSyntheticEvent.getPooled( + shouldSetEventType, + bubbleShouldSetFrom, + nativeEvent, + nativeEventTarget + ); + shouldSetEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + if (skipOverBubbleShouldSetFrom) { + accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent); + } else { + accumulateTwoPhaseDispatches(shouldSetEvent); + } + var wantsResponderInst = executeDispatchesInOrderStopAtTrue(shouldSetEvent); + if (!shouldSetEvent.isPersistent()) { + shouldSetEvent.constructor.release(shouldSetEvent); + } + + if (!wantsResponderInst || wantsResponderInst === responderInst) { + return null; + } + var extracted = void 0; + var grantEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + wantsResponderInst, + nativeEvent, + nativeEventTarget + ); + grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + + accumulateDirectDispatches(grantEvent); + var blockHostResponder = executeDirectDispatch(grantEvent) === true; + if (responderInst) { + var terminationRequestEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + ); + terminationRequestEvent.touchHistory = + ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(terminationRequestEvent); + var shouldSwitch = + !hasDispatches(terminationRequestEvent) || + executeDirectDispatch(terminationRequestEvent); + if (!terminationRequestEvent.isPersistent()) { + terminationRequestEvent.constructor.release(terminationRequestEvent); + } + + if (shouldSwitch) { + var terminateEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + ); + terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(terminateEvent); + extracted = accumulate(extracted, [grantEvent, terminateEvent]); + changeResponder(wantsResponderInst, blockHostResponder); + } else { + var rejectEvent = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + wantsResponderInst, + nativeEvent, + nativeEventTarget + ); + rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(rejectEvent); + extracted = accumulate(extracted, rejectEvent); + } + } else { + extracted = accumulate(extracted, grantEvent); + changeResponder(wantsResponderInst, blockHostResponder); + } + return extracted; +} + +/** + * A transfer is a negotiation between a currently set responder and the next + * element to claim responder status. Any start event could trigger a transfer + * of responderInst. Any move event could trigger a transfer. + * + * @param {string} topLevelType Record from `BrowserEventConstants`. + * @return {boolean} True if a transfer of responder could possibly occur. + */ +function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) { + return ( + topLevelInst && + // 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 === TOP_SCROLL && !nativeEvent.responderIgnoreScroll) || + (trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ); +} + +/** + * Returns whether or not this touch end event makes it such that there are no + * longer any touches that started inside of the current `responderInst`. + * + * @param {NativeEvent} nativeEvent Native touch end event. + * @return {boolean} Whether or not this touch end event ends the responder. + */ +function noResponderTouches(nativeEvent) { + var touches = nativeEvent.touches; + if (!touches || touches.length === 0) { + return true; + } + for (var i = 0; i < touches.length; i++) { + var activeTouch = touches[i]; + 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); + if (isAncestor(responderInst, targetInst)) { + return false; + } + } + } + return true; +} + +var ResponderEventPlugin = { + /* For unit testing only */ + _getResponder: function() { + return responderInst; + }, + + eventTypes: eventTypes, + + /** + * We must be resilient to `targetInst` being `null` on `touchMove` or + * `touchEnd`. On certain platforms, this means that a native scroll has + * assumed control and the original touch targets are destroyed. + */ + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) { + trackedTouchCount += 1; + } else if (isEndish(topLevelType)) { + if (trackedTouchCount >= 0) { + trackedTouchCount -= 1; + } else { + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ); + return null; + } + } + + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + + var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) + ? setResponderAndExtractTransfer( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) + : null; + // Responder may or may not have transferred on a new touch start/move. + // Regardless, whoever is the responder after any potential transfer, we + // direct all touch start/move/ends to them in the form of + // `onResponderMove/Start/End`. These will be called for *every* additional + // finger that move/start/end, dispatched directly to whoever is the + // current responder at that moment, until the responder is "released". + // + // These multiple individual change touch events are are always bookended + // by `onResponderGrant`, and one of + // (`onResponderRelease/onResponderTerminate`). + var isResponderTouchStart = responderInst && isStartish(topLevelType); + var isResponderTouchMove = responderInst && isMoveish(topLevelType); + var isResponderTouchEnd = responderInst && isEndish(topLevelType); + var incrementalTouch = isResponderTouchStart + ? eventTypes.responderStart + : isResponderTouchMove + ? eventTypes.responderMove + : isResponderTouchEnd + ? eventTypes.responderEnd + : null; + + if (incrementalTouch) { + var gesture = ResponderSyntheticEvent.getPooled( + incrementalTouch, + responderInst, + nativeEvent, + nativeEventTarget + ); + gesture.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(gesture); + extracted = accumulate(extracted, gesture); + } + + 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) { + var finalEvent = ResponderSyntheticEvent.getPooled( + finalTouch, + responderInst, + nativeEvent, + nativeEventTarget + ); + finalEvent.touchHistory = ResponderTouchHistoryStore.touchHistory; + accumulateDirectDispatches(finalEvent); + extracted = accumulate(extracted, finalEvent); + changeResponder(null); + } + + return extracted; + }, + + GlobalResponderHandler: null, + + injection: { + /** + * @param {{onChange: (ReactID, ReactID) => void} GlobalResponderHandler + * Object that handles any change in responder. Use this to inject + * integration with an existing touch handling system etc. + */ + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } +}; + +// Module provided by RN: +var customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes; +var customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; + +var ReactNativeBridgeEventPlugin = { + eventTypes: {}, + + /** + * @see {EventPluginHub.extractEvents} + */ + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (targetInst == null) { + // Probably a node belonging to another renderer's tree. + return null; + } + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; + var directDispatchConfig = customDirectEventTypes[topLevelType]; + (function() { + if (!(bubbleDispatchConfig || directDispatchConfig)) { + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + } + })(); + var event = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) { + accumulateTwoPhaseDispatches(event); + } else if (directDispatchConfig) { + accumulateDirectDispatches(event); + } else { + return null; + } + return event; + } +}; + +var ReactNativeEventPluginOrder = [ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]; + +/** + * Make sure essential globals are available and are patched correctly. Please don't remove this + * line. Bundles created by react-packager `require` it before executing any application code. This + * ensures it exists in the dependency graph and can be `require`d. + * TODO: require this in packager, not in React #10932517 + */ +// Module provided by RN: +/** + * Inject module for resolving DOM hierarchy and plugin ordering. + */ +injection.injectEventPluginOrder(ReactNativeEventPluginOrder); + +/** + * Some important event plugins included by default (without having to require + * them). + */ +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin +}); + +var instanceCache = new Map(); +var instanceProps = new Map(); + +function precacheFiberNode(hostInst, tag) { + instanceCache.set(tag, hostInst); +} + +function uncacheFiberNode(tag) { + instanceCache.delete(tag); + instanceProps.delete(tag); +} + +function getInstanceFromTag(tag) { + return instanceCache.get(tag) || null; +} + +function getTagFromInstance(inst) { + var tag = inst.stateNode._nativeTag; + if (tag === undefined) { + tag = inst.stateNode.canonical._nativeTag; + } + (function() { + if (!tag) { + throw ReactError(Error("All native instances should have a tag.")); + } + })(); + return tag; +} + +function getFiberCurrentPropsFromNode$1(stateNode) { + return instanceProps.get(stateNode._nativeTag) || null; +} + +function updateFiberProps(tag, props) { + instanceProps.set(tag, props); +} + +// Use to restore controlled state after a change event has fired. + +var restoreImpl = null; +var restoreTarget = null; +var restoreQueue = null; + +function restoreStateOfTarget(target) { + // We perform this translation at the end of the event loop so that we + // always receive the correct fiber here + var internalInstance = getInstanceFromNode(target); + if (!internalInstance) { + // Unmounted + return; + } + (function() { + if (!(typeof restoreImpl === "function")) { + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); + restoreImpl(internalInstance.stateNode, internalInstance.type, props); +} + +function needsStateRestore() { + return restoreTarget !== null || restoreQueue !== null; +} + +function restoreStateIfNeeded() { + if (!restoreTarget) { + return; + } + var target = restoreTarget; + var queuedTargets = restoreQueue; + restoreTarget = null; + restoreQueue = null; + + restoreStateOfTarget(target); + if (queuedTargets) { + for (var i = 0; i < queuedTargets.length; i++) { + restoreStateOfTarget(queuedTargets[i]); + } + } +} + +// Re-export dynamic flags from the fbsource version. +var _require = require("../shims/ReactFeatureFlags"); + +var debugRenderPhaseSideEffects = _require.debugRenderPhaseSideEffects; + +var enableUserTimingAPI = true; +var enableProfilerTimer = true; +var enableSchedulerTracing = true; +var enableSuspenseServerRenderer = false; + +var debugRenderPhaseSideEffectsForStrictMode = true; + +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; +var warnAboutDeprecatedLifecycles = true; +var warnAboutDeprecatedSetNativeProps = true; +var enableFlareAPI = false; +var enableFundamentalAPI = false; + +var warnAboutUnmockedScheduler = true; +var revertPassiveEffectsChange = false; +var flushSuspenseFallbacksInTests = true; + +var enableSuspenseCallback = false; +var warnAboutDefaultPropsOnFunctionComponents = false; +var warnAboutStringRefs = false; +var disableLegacyContext = false; +var disableSchedulerTimeoutBasedOnReactExpirationTime = false; + +// Only used in www builds. + +// Used as a way to call batchedUpdates when we don't have a reference to +// the renderer. Such as when we're dispatching events or if third party +// libraries need to call batchedUpdates. Eventually, this API will go away when +// everything is batched by default. We'll then have a similar API to opt-out of +// scheduled work and instead do synchronous work. + +// Defaults +var batchedUpdatesImpl = function(fn, bookkeeping) { + return fn(bookkeeping); +}; +var flushDiscreteUpdatesImpl = function() {}; +var isInsideEventHandler = false; + +function finishEventHandler() { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + var controlledComponentsHavePendingUpdates = needsStateRestore(); + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + flushDiscreteUpdatesImpl(); + restoreStateIfNeeded(); + } +} + +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(bookkeeping); + } + isInsideEventHandler = true; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + isInsideEventHandler = false; + finishEventHandler(); + } +} + +function setBatchingImplementation( + _batchedUpdatesImpl, + _discreteUpdatesImpl, + _flushDiscreteUpdatesImpl, + _batchedEventUpdatesImpl +) { + batchedUpdatesImpl = _batchedUpdatesImpl; + flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; +} + +/** + * Version of `ReactBrowserEventEmitter` that works on the receiving side of a + * serialized worker boundary. + */ + +// Shared default empty native event - conserve memory. +var EMPTY_NATIVE_EVENT = {}; + +/** + * Selects a subsequence of `Touch`es, without destroying `touches`. + * + * @param {Array} touches Deserialized touch objects. + * @param {Array} indices Indices by which to pull subsequence. + * @return {Array} Subsequence of touch objects. + */ +var touchSubsequence = function(touches, indices) { + var ret = []; + for (var i = 0; i < indices.length; i++) { + ret.push(touches[indices[i]]); + } + return ret; +}; + +/** + * TODO: Pool all of this. + * + * Destroys `touches` by removing touch objects at indices `indices`. This is + * to maintain compatibility with W3C touch "end" events, where the active + * touches don't include the set that has just been "ended". + * + * @param {Array} touches Deserialized touch objects. + * @param {Array} indices Indices to remove from `touches`. + * @return {Array} Subsequence of removed touch objects. + */ +var removeTouchesAtIndices = function(touches, indices) { + var rippedOut = []; + // use an unsafe downcast to alias to nullable elements, + // so we can delete and then compact. + var temp = touches; + for (var i = 0; i < indices.length; i++) { + var index = indices[i]; + rippedOut.push(touches[index]); + temp[index] = null; + } + var fillAt = 0; + for (var j = 0; j < temp.length; j++) { + var cur = temp[j]; + if (cur !== null) { + temp[fillAt++] = cur; + } + } + temp.length = fillAt; + return rippedOut; +}; + +/** + * Internal version of `receiveEvent` in terms of normalized (non-tag) + * `rootNodeID`. + * + * @see receiveEvent. + * + * @param {rootNodeID} rootNodeID React root node ID that event occurred on. + * @param {TopLevelType} topLevelType Top level type of event. + * @param {?object} nativeEventParam Object passed from native. + */ +function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { + var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT; + var inst = getInstanceFromTag(rootNodeID); + batchedUpdates(function() { + runExtractedPluginEventsInBatch( + topLevelType, + inst, + nativeEvent, + nativeEvent.target + ); + }); + // React Native doesn't use ReactControlledComponent but if it did, here's + // where it would do it. +} + +/** + * Publicly exposed method on module for native objc to invoke when a top + * level event is extracted. + * @param {rootNodeID} rootNodeID React root node ID that event occurred on. + * @param {TopLevelType} topLevelType Top level type of event. + * @param {object} nativeEventParam Object passed from native. + */ +function receiveEvent(rootNodeID, topLevelType, nativeEventParam) { + _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); +} + +/** + * Simple multi-wrapper around `receiveEvent` that is intended to receive an + * efficient representation of `Touch` objects, and other information that + * can be used to construct W3C compliant `Event` and `Touch` lists. + * + * This may create dispatch behavior that differs than web touch handling. We + * loop through each of the changed touches and receive it as a single event. + * So two `touchStart`/`touchMove`s that occur simultaneously are received as + * two separate touch event dispatches - when they arguably should be one. + * + * This implementation reuses the `Touch` objects themselves as the `Event`s + * since we dispatch an event for each touch (though that might not be spec + * compliant). The main purpose of reusing them is to save allocations. + * + * TODO: Dispatch multiple changed touches in one event. The bubble path + * could be the first common ancestor of all the `changedTouches`. + * + * One difference between this behavior and W3C spec: cancelled touches will + * not appear in `.touches`, or in any future `.touches`, though they may + * still be "actively touching the surface". + * + * Web desktop polyfills only need to construct a fake touch event with + * identifier 0, also abandoning traditional click handlers. + */ +function receiveTouches(eventTopLevelType, touches, changedIndices) { + var changedTouches = + eventTopLevelType === "topTouchEnd" || + eventTopLevelType === "topTouchCancel" + ? removeTouchesAtIndices(touches, changedIndices) + : touchSubsequence(touches, changedIndices); + + for (var jj = 0; jj < changedTouches.length; jj++) { + var touch = changedTouches[jj]; + // Touch objects can fulfill the role of `DOM` `Event` objects if we set + // the `changedTouches`/`touches`. This saves allocations. + touch.changedTouches = changedTouches; + touch.touches = touches; + var nativeEvent = touch; + var rootNodeID = null; + var target = nativeEvent.target; + if (target !== null && target !== undefined) { + if (target < 1) { + { + warningWithoutStack$1( + false, + "A view is reporting that a touch occurred on tag zero." + ); + } + } else { + rootNodeID = target; + } + } + // $FlowFixMe Shouldn't we *not* call it if rootNodeID is null? + _receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent); + } +} + +// Module provided by RN: +var ReactNativeGlobalResponderHandler = { + onChange: function(from, to, blockNativeResponder) { + if (to !== null) { + var tag = to.stateNode._nativeTag; + ReactNativePrivateInterface.UIManager.setJSResponder( + tag, + blockNativeResponder + ); + } else { + ReactNativePrivateInterface.UIManager.clearJSResponder(); + } + } +}; + +// Module provided by RN: +/** + * Register the event emitter with the native bridge + */ +ReactNativePrivateInterface.RCTEventEmitter.register({ + receiveEvent: receiveEvent, + receiveTouches: receiveTouches +}); + +setComponentTree( + getFiberCurrentPropsFromNode$1, + getInstanceFromTag, + getTagFromInstance +); + +ResponderEventPlugin.injection.injectGlobalResponderHandler( + ReactNativeGlobalResponderHandler +); + +/** + * `ReactInstanceMap` maintains a mapping from a public facing stateful + * instance (key) and the internal representation (value). This allows public + * methods to accept the user facing instance as an argument and map them back + * to internal methods. + * + * Note that this module is currently shared and assumed to be stateless. + * If this becomes an actual Map, that will break. + */ + +/** + * This API should be called `delete` but we'd have to make sure to always + * transform these to strings for IE support. When this transform is fully + * supported we can rename it. + */ + +function get(key) { + return key._reactInternalFiber; +} + +function set(key, value) { + key._reactInternalFiber = value; +} + +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +// Prevent newer renderers from RTE when used with older react package versions. +// Current owner and dispatcher used to share the same ref, +// but PR #14548 split them out to better support the react-debug-tools package. +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) { + ReactSharedInternals.ReactCurrentDispatcher = { + current: null + }; +} +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === "function" && Symbol.for; + +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol + ? Symbol.for("react.strict_mode") + : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; +// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol + ? Symbol.for("react.forward_ref") + : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4; +var REACT_FUNDAMENTAL_TYPE = hasSymbol + ? Symbol.for("react.fundamental") + : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6; + +var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = "@@iterator"; + +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== "object") { + return null; + } + var maybeIterator = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable[FAUX_ITERATOR_SYMBOL]; + if (typeof maybeIterator === "function") { + return maybeIterator; + } + return null; +} + +var Pending = 0; +var Resolved = 1; +var Rejected = 2; + +function refineResolvedLazyComponent(lazyComponent) { + return lazyComponent._status === Resolved ? lazyComponent._result : null; +} + +function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName) + ); +} + +function getComponentName(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + { + if (typeof type.tag === "number") { + warningWithoutStack$1( + false, + "Received an unexpected object in getComponentName(). " + + "This is likely a bug in React. Please file an issue." + ); + } + } + if (typeof type === "function") { + return type.displayName || type.name || null; + } + if (typeof type === "string") { + return type; + } + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if (typeof type === "object") { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, "ForwardRef"); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: { + var thenable = type; + var resolvedThenable = refineResolvedLazyComponent(thenable); + if (resolvedThenable) { + return getComponentName(resolvedThenable); + } + break; + } + } + } + return null; +} + +// Don't change these two values. They're used by React Dev Tools. +var NoEffect = /* */ 0; +var PerformedWork = /* */ 1; + +// You can change the rest (and add more). +var Placement = /* */ 2; +var Update = /* */ 4; +var PlacementAndUpdate = /* */ 6; +var Deletion = /* */ 8; +var ContentReset = /* */ 16; +var Callback = /* */ 32; +var DidCapture = /* */ 64; +var Ref = /* */ 128; +var Snapshot = /* */ 256; +var Passive = /* */ 512; + +// Passive & Update & Callback & Ref & Snapshot +var LifecycleEffectMask = /* */ 932; + +// Union of all host effects +var HostEffectMask = /* */ 1023; + +var Incomplete = /* */ 1024; +var ShouldCapture = /* */ 2048; + +var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + +var MOUNTING = 1; +var MOUNTED = 2; +var UNMOUNTED = 3; + +function isFiberMountedImpl(fiber) { + var node = fiber; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + while (node.return) { + node = node.return; + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + } + } else { + while (node.return) { + node = node.return; + } + } + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return MOUNTED; + } + // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + return UNMOUNTED; +} + +function isFiberMounted(fiber) { + return isFiberMountedImpl(fiber) === MOUNTED; +} + +function isMounted(component) { + { + var owner = ReactCurrentOwner$1.current; + if (owner !== null && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + !instance._warnedAboutRefsInRender + ? warningWithoutStack$1( + false, + "%s is accessing isMounted inside its render() function. " + + "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(ownerFiber.type) || "A component" + ) + : void 0; + instance._warnedAboutRefsInRender = true; + } + } + + var fiber = get(component); + if (!fiber) { + return false; + } + return isFiberMountedImpl(fiber) === MOUNTED; +} + +function assertIsMounted(fiber) { + (function() { + if (!(isFiberMountedImpl(fiber) === MOUNTED)) { + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + })(); +} + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var state = isFiberMountedImpl(fiber); + (function() { + if (!(state !== UNMOUNTED)) { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + if (state === MOUNTING) { + return null; + } + return fiber; + } + // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + var a = fiber; + var b = alternate; + while (true) { + var parentA = a.return; + if (parentA === null) { + // We're at the root. + break; + } + var parentB = parentA.alternate; + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + if (nextParent !== null) { + a = b = nextParent; + continue; + } + // If there's no parent, we're at the root. + break; + } + + // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + if (parentA.child === parentB.child) { + var child = parentA.child; + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + child = child.sibling; + } + // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + (function() { + if (!didFindChild) { + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + })(); + } + } + + (function() { + if (!(a.alternate === b)) { + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + (function() { + if (!(a.tag === HostRoot)) { + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + })(); + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } + // Otherwise B has to be current branch. + return alternate; +} + +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + if (!currentParent) { + return null; + } + + // Next we'll drill down this component to find the first HostComponent/Text. + var node = currentParent; + while (true) { + if (node.tag === HostComponent || node.tag === HostText) { + return node; + } else if (node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === currentParent) { + return null; + } + while (!node.sibling) { + if (!node.return || node.return === currentParent) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + // Flow needs the return null here, but ESLint complains about it. + // eslint-disable-next-line no-unreachable + return null; +} + +// Modules provided by RN: +var emptyObject = {}; + +/** + * Create a payload that contains all the updates between two sets of props. + * + * These helpers are all encapsulated into a single module, because they use + * mutation as a performance optimization which leads to subtle shared + * dependencies between the code paths. To avoid this mutable state leaking + * across modules, I've kept them isolated to this module. + */ + +// Tracks removed keys +var removedKeys = null; +var removedKeyCount = 0; + +function defaultDiffer(prevProp, nextProp) { + if (typeof nextProp !== "object" || nextProp === null) { + // Scalars have already been checked for equality + return true; + } else { + // For objects and arrays, the default diffing algorithm is a deep compare + return ReactNativePrivateInterface.deepDiffer(prevProp, nextProp); + } +} + +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) { + var i = node.length; + while (i-- && removedKeyCount > 0) { + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + } + } else if (node && removedKeyCount > 0) { + var obj = node; + for (var propKey in removedKeys) { + if (!removedKeys[propKey]) { + continue; + } + var nextProp = obj[propKey]; + if (nextProp === undefined) { + continue; + } + + var attributeConfig = validAttributes[propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + if (typeof nextProp === "function") { + nextProp = true; + } + if (typeof nextProp === "undefined") { + nextProp = null; + } + + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + updatePayload[propKey] = nextProp; + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + updatePayload[propKey] = nextValue; + } + removedKeys[propKey] = false; + removedKeyCount--; + } + } +} + +function diffNestedArrayProperty( + updatePayload, + prevArray, + nextArray, + validAttributes +) { + var minLength = + prevArray.length < nextArray.length ? prevArray.length : nextArray.length; + var i = void 0; + for (i = 0; i < minLength; i++) { + // Diff any items in the array in the forward direction. Repeated keys + // will be overwritten by later values. + updatePayload = diffNestedProperty( + updatePayload, + prevArray[i], + nextArray[i], + validAttributes + ); + } + for (; i < prevArray.length; i++) { + // Clear out all remaining properties. + updatePayload = clearNestedProperty( + updatePayload, + prevArray[i], + validAttributes + ); + } + for (; i < nextArray.length; i++) { + // Add all remaining properties. + updatePayload = addNestedProperty( + updatePayload, + nextArray[i], + validAttributes + ); + } + return updatePayload; +} + +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) { + // If no properties have been added, then we can bail out quickly on object + // equality. + return updatePayload; + } + + if (!prevProp || !nextProp) { + if (nextProp) { + return addNestedProperty(updatePayload, nextProp, validAttributes); + } + if (prevProp) { + return clearNestedProperty(updatePayload, prevProp, validAttributes); + } + return updatePayload; + } + + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) { + // Both are leaves, we can diff the leaves. + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + } + + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + // Both are arrays, we can diff the arrays. + return diffNestedArrayProperty( + updatePayload, + prevProp, + nextProp, + validAttributes + ); + } + + if (Array.isArray(prevProp)) { + return diffProperties( + updatePayload, + // $FlowFixMe - We know that this is always an object when the input is. + ReactNativePrivateInterface.flattenStyle(prevProp), + // $FlowFixMe - We know that this isn't an array because of above flow. + nextProp, + validAttributes + ); + } + + return diffProperties( + updatePayload, + prevProp, + // $FlowFixMe - We know that this is always an object when the input is. + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} + +/** + * addNestedProperty takes a single set of props and valid attribute + * attribute configurations. It processes each prop and adds it to the + * updatePayload. + */ +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) { + return updatePayload; + } + + if (!Array.isArray(nextProp)) { + // Add each property of the leaf. + return addProperties(updatePayload, nextProp, validAttributes); + } + + for (var i = 0; i < nextProp.length; i++) { + // Add all the properties of the array. + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + } + + return updatePayload; +} + +/** + * clearNestedProperty takes a single set of props and valid attributes. It + * adds a null sentinel to the updatePayload, for each prop key. + */ +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) { + return updatePayload; + } + + if (!Array.isArray(prevProp)) { + // Add each property of the leaf. + return clearProperties(updatePayload, prevProp, validAttributes); + } + + for (var i = 0; i < prevProp.length; i++) { + // Add all the properties of the array. + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + } + return updatePayload; +} + +/** + * diffProperties takes two sets of props and a set of valid attributes + * and write to updatePayload the values that changed or were deleted. + * If no updatePayload is provided, a new one is created and returned if + * anything changed. + */ +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig = void 0; + var nextProp = void 0; + var prevProp = void 0; + + for (var propKey in nextProps) { + attributeConfig = validAttributes[propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + prevProp = prevProps[propKey]; + nextProp = nextProps[propKey]; + + // functions are converted to booleans as markers that the associated + // events should be sent from native. + if (typeof nextProp === "function") { + nextProp = true; + // If nextProp is not a function, then don't bother changing prevProp + // since nextProp will win and go into the updatePayload regardless. + if (typeof prevProp === "function") { + prevProp = true; + } + } + + // An explicit value of undefined is treated as a null because it overrides + // any other preceding value. + if (typeof nextProp === "undefined") { + nextProp = null; + if (typeof prevProp === "undefined") { + prevProp = null; + } + } + + if (removedKeys) { + removedKeys[propKey] = false; + } + + if (updatePayload && updatePayload[propKey] !== undefined) { + // Something else already triggered an update to this key because another + // value diffed. Since we're now later in the nested arrays our value is + // more important so we need to calculate it and override the existing + // value. It doesn't matter if nothing changed, we'll set it anyway. + + // Pattern match on: attributeConfig + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + updatePayload[propKey] = nextProp; + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + updatePayload[propKey] = nextValue; + } + continue; + } + + if (prevProp === nextProp) { + continue; // nothing changed + } + + // Pattern match on: attributeConfig + if (typeof attributeConfig !== "object") { + // case: !Object is the default case + if (defaultDiffer(prevProp, nextProp)) { + // a normal leaf has changed + (updatePayload || (updatePayload = {}))[propKey] = nextProp; + } + } else if ( + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration + var shouldUpdate = + prevProp === undefined || + (typeof attributeConfig.diff === "function" + ? attributeConfig.diff(prevProp, nextProp) + : defaultDiffer(prevProp, nextProp)); + if (shouldUpdate) { + var _nextValue = + typeof attributeConfig.process === "function" + ? attributeConfig.process(nextProp) + : nextProp; + (updatePayload || (updatePayload = {}))[propKey] = _nextValue; + } + } else { + // default: fallthrough case when nested properties are defined + removedKeys = null; + removedKeyCount = 0; + // We think that attributeConfig is not CustomAttributeConfiguration at + // this point so we assume it must be AttributeConfiguration. + updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + ); + if (removedKeyCount > 0 && updatePayload) { + restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ); + removedKeys = null; + } + } + } + + // Also iterate through all the previous props to catch any that have been + // removed and make sure native gets the signal so it can reset them to the + // default. + for (var _propKey in prevProps) { + if (nextProps[_propKey] !== undefined) { + continue; // we've already covered this key in the previous pass + } + attributeConfig = validAttributes[_propKey]; + if (!attributeConfig) { + continue; // not a valid native prop + } + + if (updatePayload && updatePayload[_propKey] !== undefined) { + // This was already updated to a diff result earlier. + continue; + } + + prevProp = prevProps[_propKey]; + if (prevProp === undefined) { + continue; // was already empty anyway + } + // Pattern match on: attributeConfig + if ( + typeof attributeConfig !== "object" || + typeof attributeConfig.diff === "function" || + typeof attributeConfig.process === "function" + ) { + // case: CustomAttributeConfiguration | !Object + // Flag the leaf property for removal by sending a sentinel. + (updatePayload || (updatePayload = {}))[_propKey] = null; + if (!removedKeys) { + removedKeys = {}; + } + if (!removedKeys[_propKey]) { + removedKeys[_propKey] = true; + removedKeyCount++; + } + } else { + // default: + // This is a nested attribute configuration where all the properties + // were removed so we need to go through and clear out all of them. + updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ); + } + } + return updatePayload; +} + +/** + * addProperties adds all the valid props to the payload after being processed. + */ +function addProperties(updatePayload, props, validAttributes) { + // TODO: Fast path + return diffProperties(updatePayload, emptyObject, props, validAttributes); +} + +/** + * clearProperties clears all the previous props by adding a null sentinel + * to the payload for each valid key. + */ +function clearProperties(updatePayload, prevProps, validAttributes) { + // TODO: Fast path + return diffProperties(updatePayload, prevProps, emptyObject, validAttributes); +} + +function create(props, validAttributes) { + return addProperties( + null, // updatePayload + props, + validAttributes + ); +} + +function diff(prevProps, nextProps, validAttributes) { + return diffProperties( + null, // updatePayload + prevProps, + nextProps, + validAttributes + ); +} + +/** + * In the future, we should cleanup callbacks by cancelling them instead of + * using this. + */ +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if (!callback) { + return undefined; + } + // This protects against createClass() components. + // We don't know if there is code depending on it. + // We intentionally don't use isMounted() because even accessing + // isMounted property on a React ES6 class will trigger a warning. + if (typeof context.__isMounted === "boolean") { + if (!context.__isMounted) { + return undefined; + } + } + + // FIXME: there used to be other branches that protected + // against unmounted host components. But RN host components don't + // define isMounted() anymore, so those checks didn't do anything. + + // They caused false positive warning noise so we removed them: + // https://github.com/facebook/react-native/issues/18868#issuecomment-413579095 + + // However, this means that the callback is NOT guaranteed to be safe + // for host components. The solution we should implement is to make + // UIManager.measure() and similar calls truly cancelable. Then we + // can change our own code calling them to cancel when something unmounts. + + return callback.apply(context, arguments); + }; +} + +function throwOnStylesProp(component, props) { + if (props.styles !== undefined) { + var owner = component._owner || null; + var name = component.constructor.displayName; + var msg = + "`styles` is not a supported property of `" + + name + + "`, did " + + "you mean `style` (singular)?"; + if (owner && owner.constructor && owner.constructor.displayName) { + msg += + "\n\nCheck the `" + + owner.constructor.displayName + + "` parent " + + " component."; + } + throw new Error(msg); + } +} + +function warnForStyleProps(props, validAttributes) { + for (var key in validAttributes.style) { + if (!(validAttributes[key] || props[key] === undefined)) { + console.error( + "You are setting the style `{ " + + key + + ": ... }` as a prop. You " + + "should nest it in a style object. " + + "E.g. `{ style: { " + + key + + ": ... } }`" + ); + } + } +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +// Modules provided by RN: +/** + * This component defines the same methods as NativeMethodsMixin but without the + * findNodeHandle wrapper. This wrapper is unnecessary for HostComponent views + * and would also result in a circular require.js dependency (since + * ReactNativeFiber depends on this component and NativeMethodsMixin depends on + * ReactNativeFiber). + */ + +var ReactNativeFiberHostComponent = (function() { + function ReactNativeFiberHostComponent(tag, viewConfig) { + _classCallCheck(this, ReactNativeFiberHostComponent); + + this._nativeTag = tag; + this._children = []; + this.viewConfig = viewConfig; + } + + ReactNativeFiberHostComponent.prototype.blur = function blur() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + + ReactNativeFiberHostComponent.prototype.focus = function focus() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + + ReactNativeFiberHostComponent.prototype.measure = function measure(callback) { + ReactNativePrivateInterface.UIManager.measure( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + + ReactNativeFiberHostComponent.prototype.measureInWindow = function measureInWindow( + callback + ) { + ReactNativePrivateInterface.UIManager.measureInWindow( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + + ReactNativeFiberHostComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + var relativeNode = void 0; + + if (typeof relativeToNativeNode === "number") { + // Already a node handle + relativeNode = relativeToNativeNode; + } else if (relativeToNativeNode._nativeTag) { + relativeNode = relativeToNativeNode._nativeTag; + } else if ( + relativeToNativeNode.canonical && + relativeToNativeNode.canonical._nativeTag + ) { + relativeNode = relativeToNativeNode.canonical._nativeTag; + } + + if (relativeNode == null) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a node handle or a ref to a native component." + ); + + return; + } + + ReactNativePrivateInterface.UIManager.measureLayout( + this._nativeTag, + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + + ReactNativeFiberHostComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) { + { + if (warnAboutDeprecatedSetNativeProps) { + warningWithoutStack$1( + false, + "Warning: Calling ref.setNativeProps(nativeProps) " + + "is deprecated and will be removed in a future release. " + + "Use the setNativeProps export from the react-native package instead." + + "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" + ); + } + warnForStyleProps(nativeProps, this.viewConfig.validAttributes); + } + + var updatePayload = create(nativeProps, this.viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + this._nativeTag, + this.viewConfig.uiViewClassName, + updatePayload + ); + } + }; + + return ReactNativeFiberHostComponent; +})(); + +// Renderers that don't support persistence +// can re-export everything from this module. + +function shim() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +// Persistence (when unsupported) +var supportsPersistence = false; +var cloneInstance = shim; +var cloneFundamentalInstance = shim; +var createContainerChildSet = shim; +var appendChildToContainerChildSet = shim; +var finalizeContainerChildren = shim; +var replaceContainerChildren = shim; +var cloneHiddenInstance = shim; +var cloneHiddenTextInstance = shim; + +// Renderers that don't support hydration +// can re-export everything from this module. + +function shim$1() { + (function() { + { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +// Hydration (when unsupported) + +var supportsHydration = false; +var canHydrateInstance = shim$1; +var canHydrateTextInstance = shim$1; +var canHydrateSuspenseInstance = shim$1; +var isSuspenseInstancePending = shim$1; +var isSuspenseInstanceFallback = shim$1; +var registerSuspenseInstanceRetry = shim$1; +var getNextHydratableSibling = shim$1; +var getFirstHydratableChild = shim$1; +var hydrateInstance = shim$1; +var hydrateTextInstance = shim$1; +var getNextHydratableInstanceAfterSuspenseInstance = shim$1; +var clearSuspenseBoundary = shim$1; +var clearSuspenseBoundaryFromContainer = shim$1; +var didNotMatchHydratedContainerTextInstance = shim$1; +var didNotMatchHydratedTextInstance = shim$1; +var didNotHydrateContainerInstance = shim$1; +var didNotHydrateInstance = shim$1; +var didNotFindHydratableContainerInstance = shim$1; +var didNotFindHydratableContainerTextInstance = shim$1; +var didNotFindHydratableContainerSuspenseInstance = shim$1; +var didNotFindHydratableInstance = shim$1; +var didNotFindHydratableTextInstance = shim$1; +var didNotFindHydratableSuspenseInstance = shim$1; + +// Modules provided by RN: +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; // Unused +// Unused + +var UPDATE_SIGNAL = {}; +{ + Object.freeze(UPDATE_SIGNAL); +} + +// Counter for uniquely identifying views. +// % 10 === 1 means it is a rootTag. +// % 2 === 0 means it is a Fabric tag. +var nextReactTag = 3; +function allocateTag() { + var tag = nextReactTag; + if (tag % 10 === 1) { + tag += 2; + } + nextReactTag = tag + 2; + return tag; +} + +function recursivelyUncacheFiberNode(node) { + if (typeof node === "number") { + // Leaf node (eg text) + uncacheFiberNode(node); + } else { + uncacheFiberNode(node._nativeTag); + + node._children.forEach(recursivelyUncacheFiberNode); + } +} + +function appendInitialChild(parentInstance, child) { + parentInstance._children.push(child); +} + +function createInstance( + type, + props, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + var tag = allocateTag(); + var viewConfig = getViewConfigForType(type); + + { + for (var key in viewConfig.validAttributes) { + if (props.hasOwnProperty(key)) { + ReactNativePrivateInterface.deepFreezeAndThrowOnMutationInDev( + props[key] + ); + } + } + } + + var updatePayload = create(props, viewConfig.validAttributes); + + ReactNativePrivateInterface.UIManager.createView( + tag, // reactTag + viewConfig.uiViewClassName, // viewName + rootContainerInstance, // rootTag + updatePayload // props + ); + + var component = new ReactNativeFiberHostComponent(tag, viewConfig); + + precacheFiberNode(internalInstanceHandle, tag); + updateFiberProps(tag, props); + + // Not sure how to avoid this cast. Flow is okay if the component is defined + // in the same file but if it's external it can't see the types. + return component; +} + +function createTextInstance( + text, + rootContainerInstance, + hostContext, + internalInstanceHandle +) { + (function() { + if (!hostContext.isInAParentText) { + throw ReactError( + Error("Text strings must be rendered within a component.") + ); + } + })(); + + var tag = allocateTag(); + + ReactNativePrivateInterface.UIManager.createView( + tag, // reactTag + "RCTRawText", // viewName + rootContainerInstance, // rootTag + { text: text } // props + ); + + precacheFiberNode(internalInstanceHandle, tag); + + return tag; +} + +function finalizeInitialChildren( + parentInstance, + type, + props, + rootContainerInstance, + hostContext +) { + // Don't send a no-op message over the bridge. + if (parentInstance._children.length === 0) { + return false; + } + + // Map from child objects to native tags. + // Either way we need to pass a copy of the Array to prevent it from being frozen. + var nativeTags = parentInstance._children.map(function(child) { + return typeof child === "number" + ? child // Leaf node (eg text) + : child._nativeTag; + }); + + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance._nativeTag, // containerTag + nativeTags // reactTags + ); + + return false; +} + +function getRootHostContext(rootContainerInstance) { + return { isInAParentText: false }; +} + +function getChildHostContext(parentHostContext, type, rootContainerInstance) { + var prevIsInAParentText = parentHostContext.isInAParentText; + var isInAParentText = + type === "AndroidTextInput" || // Android + type === "RCTMultilineTextInputView" || // iOS + type === "RCTSinglelineTextInputView" || // iOS + type === "RCTText" || + type === "RCTVirtualText"; + + if (prevIsInAParentText !== isInAParentText) { + return { isInAParentText: isInAParentText }; + } else { + return parentHostContext; + } +} + +function getPublicInstance(instance) { + return instance; +} + +function prepareForCommit(containerInfo) { + // Noop +} + +function prepareUpdate( + instance, + type, + oldProps, + newProps, + rootContainerInstance, + hostContext +) { + return UPDATE_SIGNAL; +} + +function resetAfterCommit(containerInfo) { + // Noop +} + +var isPrimaryRenderer = true; +var warnsIfNotActing = true; + +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; + +function shouldDeprioritizeSubtree(type, props) { + return false; +} + +function shouldSetTextContent(type, props) { + // TODO (bvaughn) Revisit this decision. + // Always returning false simplifies the createInstance() implementation, + // But creates an additional child Fiber for raw text children. + // No additional native views are created though. + // It's not clear to me which is better so I'm deferring for now. + // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 + return false; +} + +// ------------------- +// Mutation +// ------------------- + +var supportsMutation = true; + +function appendChild(parentInstance, child) { + var childTag = typeof child === "number" ? child : child._nativeTag; + var children = parentInstance._children; + var index = children.indexOf(child); + + if (index >= 0) { + children.splice(index, 1); + children.push(child); + + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance._nativeTag, // containerTag + [index], // moveFromIndices + [children.length - 1], // moveToIndices + [], // addChildReactTags + [], // addAtIndices + [] // removeAtIndices + ); + } else { + children.push(child); + + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance._nativeTag, // containerTag + [], // moveFromIndices + [], // moveToIndices + [childTag], // addChildReactTags + [children.length - 1], // addAtIndices + [] // removeAtIndices + ); + } +} + +function appendChildToContainer(parentInstance, child) { + var childTag = typeof child === "number" ? child : child._nativeTag; + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance, // containerTag + [childTag] // reactTags + ); +} + +function commitTextUpdate(textInstance, oldText, newText) { + ReactNativePrivateInterface.UIManager.updateView( + textInstance, // reactTag + "RCTRawText", // viewName + { text: newText } // props + ); +} + +function commitUpdate( + instance, + updatePayloadTODO, + type, + oldProps, + newProps, + internalInstanceHandle +) { + var viewConfig = instance.viewConfig; + + updateFiberProps(instance._nativeTag, newProps); + + var updatePayload = diff(oldProps, newProps, viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, // reactTag + viewConfig.uiViewClassName, // viewName + updatePayload // props + ); + } +} + +function insertBefore(parentInstance, child, beforeChild) { + var children = parentInstance._children; + var index = children.indexOf(child); + + // Move existing child or add new child? + if (index >= 0) { + children.splice(index, 1); + var beforeChildIndex = children.indexOf(beforeChild); + children.splice(beforeChildIndex, 0, child); + + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance._nativeTag, // containerID + [index], // moveFromIndices + [beforeChildIndex], // moveToIndices + [], // addChildReactTags + [], // addAtIndices + [] // removeAtIndices + ); + } else { + var _beforeChildIndex = children.indexOf(beforeChild); + children.splice(_beforeChildIndex, 0, child); + + var childTag = typeof child === "number" ? child : child._nativeTag; + + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance._nativeTag, // containerID + [], // moveFromIndices + [], // moveToIndices + [childTag], // addChildReactTags + [_beforeChildIndex], // addAtIndices + [] // removeAtIndices + ); + } +} + +function insertInContainerBefore(parentInstance, child, beforeChild) { + // TODO (bvaughn): Remove this check when... + // We create a wrapper object for the container in ReactNative render() + // Or we refactor to remove wrapper objects entirely. + // For more info on pros/cons see PR #8560 description. + (function() { + if (!(typeof parentInstance !== "number")) { + throw ReactError( + Error("Container does not support insertBefore operation") + ); + } + })(); +} + +function removeChild(parentInstance, child) { + recursivelyUncacheFiberNode(child); + var children = parentInstance._children; + var index = children.indexOf(child); + + children.splice(index, 1); + + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance._nativeTag, // containerID + [], // moveFromIndices + [], // moveToIndices + [], // addChildReactTags + [], // addAtIndices + [index] // removeAtIndices + ); +} + +function removeChildFromContainer(parentInstance, child) { + recursivelyUncacheFiberNode(child); + ReactNativePrivateInterface.UIManager.manageChildren( + parentInstance, // containerID + [], // moveFromIndices + [], // moveToIndices + [], // addChildReactTags + [], // addAtIndices + [0] // removeAtIndices + ); +} + +function resetTextContent(instance) { + // Noop +} + +function hideInstance(instance) { + var viewConfig = instance.viewConfig; + var updatePayload = create( + { style: { display: "none" } }, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); +} + +function hideTextInstance(textInstance) { + throw new Error("Not yet implemented."); +} + +function unhideInstance(instance, props) { + var viewConfig = instance.viewConfig; + var updatePayload = diff( + Object.assign({}, props, { style: [props.style, { display: "none" }] }), + props, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); +} + +function unhideTextInstance(textInstance, text) { + throw new Error("Not yet implemented."); +} + +function mountResponderInstance( + responder, + responderInstance, + props, + state, + instance, + rootContainerInstance +) { + throw new Error("Not yet implemented."); +} + +function unmountResponderInstance(responderInstance) { + throw new Error("Not yet implemented."); +} + +function getFundamentalComponentInstance(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function mountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function shouldUpdateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function updateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function unmountFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; + +var describeComponentFrame = function(name, source, ownerName) { + var sourceInfo = ""; + if (source) { + var path = source.fileName; + var fileName = path.replace(BEFORE_SLASH_RE, ""); + { + // In DEV, include code for a common special case: + // prefer "folder/index.js" instead of just "index.js". + if (/^index\./.test(fileName)) { + var match = path.match(BEFORE_SLASH_RE); + if (match) { + var pathBeforeSlash = match[1]; + if (pathBeforeSlash) { + var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ""); + fileName = folderName + "/" + fileName; + } + } + } + } + sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")"; + } else if (ownerName) { + sourceInfo = " (created by " + ownerName + ")"; + } + return "\n in " + (name || "Unknown") + sourceInfo; +}; + +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostRoot: + case HostPortal: + case HostText: + case Fragment: + case ContextProvider: + case ContextConsumer: + return ""; + default: + var owner = fiber._debugOwner; + var source = fiber._debugSource; + var name = getComponentName(fiber.type); + var ownerName = null; + if (owner) { + ownerName = getComponentName(owner.type); + } + return describeComponentFrame(name, source, ownerName); + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + var node = workInProgress; + do { + info += describeFiber(node); + node = node.return; + } while (node); + return info; +} + +var current = null; +var phase = null; + +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + var owner = current._debugOwner; + if (owner !== null && typeof owner !== "undefined") { + return getComponentName(owner.type); + } + } + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ""; + } + // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + return getStackByFiberInDevAndProd(current); + } + return ""; +} + +function resetCurrentFiber() { + { + ReactDebugCurrentFrame.getCurrentStack = null; + current = null; + phase = null; + } +} + +function setCurrentFiber(fiber) { + { + ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; + current = fiber; + phase = null; + } +} + +function setCurrentPhase(lifeCyclePhase) { + { + phase = lifeCyclePhase; + } +} + +// Prefix measurements so that it's possible to filter them. +// Longer prefixes are hard to read in DevTools. +var reactEmoji = "\u269B"; +var warningEmoji = "\u26D4"; +var supportsUserTiming = + typeof performance !== "undefined" && + typeof performance.mark === "function" && + typeof performance.clearMarks === "function" && + typeof performance.measure === "function" && + typeof performance.clearMeasures === "function"; + +// Keep track of current fiber so that we know the path to unwind on pause. +// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? +var currentFiber = null; +// If we're in the middle of user code, which fiber and method is it? +// Reusing `currentFiber` would be confusing for this because user code fiber +// can change during commit phase too, but we don't need to unwind it (since +// lifecycles in the commit phase don't resemble a tree). +var currentPhase = null; +var currentPhaseFiber = null; +// Did lifecycle hook schedule an update? This is often a performance problem, +// so we will keep track of it, and include it in the report. +// Track commits caused by cascading updates. +var isCommitting = false; +var hasScheduledUpdateInCurrentCommit = false; +var hasScheduledUpdateInCurrentPhase = false; +var commitCountInCurrentWorkLoop = 0; +var effectCountInCurrentCommit = 0; +var isWaitingForCallback = false; +// During commits, we only show a measurement once per method name +// to avoid stretch the commit phase with measurement overhead. +var labelsInCurrentCommit = new Set(); + +var formatMarkName = function(markName) { + return reactEmoji + " " + markName; +}; + +var formatLabel = function(label, warning) { + var prefix = warning ? warningEmoji + " " : reactEmoji + " "; + var suffix = warning ? " Warning: " + warning : ""; + return "" + prefix + label + suffix; +}; + +var beginMark = function(markName) { + performance.mark(formatMarkName(markName)); +}; + +var clearMark = function(markName) { + performance.clearMarks(formatMarkName(markName)); +}; + +var endMark = function(label, markName, warning) { + var formattedMarkName = formatMarkName(markName); + var formattedLabel = formatLabel(label, warning); + try { + performance.measure(formattedLabel, formattedMarkName); + } catch (err) {} + // If previous mark was missing for some reason, this will throw. + // This could only happen if React crashed in an unexpected place earlier. + // Don't pile on with more errors. + + // Clear marks immediately to avoid growing buffer. + performance.clearMarks(formattedMarkName); + performance.clearMeasures(formattedLabel); +}; + +var getFiberMarkName = function(label, debugID) { + return label + " (#" + debugID + ")"; +}; + +var getFiberLabel = function(componentName, isMounted, phase) { + if (phase === null) { + // These are composite component total time measurements. + return componentName + " [" + (isMounted ? "update" : "mount") + "]"; + } else { + // Composite component methods. + return componentName + "." + phase; + } +}; + +var beginFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + + if (isCommitting && labelsInCurrentCommit.has(label)) { + // During the commit phase, we don't show duplicate labels because + // there is a fixed overhead for every measurement, and we don't + // want to stretch the commit phase beyond necessary. + return false; + } + labelsInCurrentCommit.add(label); + + var markName = getFiberMarkName(label, debugID); + beginMark(markName); + return true; +}; + +var clearFiberMark = function(fiber, phase) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + clearMark(markName); +}; + +var endFiberMark = function(fiber, phase, warning) { + var componentName = getComponentName(fiber.type) || "Unknown"; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + endMark(label, markName, warning); +}; + +var shouldIgnoreFiber = function(fiber) { + // Host components should be skipped in the timeline. + // We could check typeof fiber.type, but does this work with RN? + switch (fiber.tag) { + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case Fragment: + case ContextProvider: + case ContextConsumer: + case Mode: + return true; + default: + return false; + } +}; + +var clearPendingPhaseMeasurement = function() { + if (currentPhase !== null && currentPhaseFiber !== null) { + clearFiberMark(currentPhaseFiber, currentPhase); + } + currentPhaseFiber = null; + currentPhase = null; + hasScheduledUpdateInCurrentPhase = false; +}; + +var pauseTimers = function() { + // Stops all currently active measurements so that they can be resumed + // if we continue in a later deferred loop from the same unit of work. + var fiber = currentFiber; + while (fiber) { + if (fiber._debugIsCurrentlyTiming) { + endFiberMark(fiber, null, null); + } + fiber = fiber.return; + } +}; + +var resumeTimersRecursively = function(fiber) { + if (fiber.return !== null) { + resumeTimersRecursively(fiber.return); + } + if (fiber._debugIsCurrentlyTiming) { + beginFiberMark(fiber, null); + } +}; + +var resumeTimers = function() { + // Resumes all measurements that were active during the last deferred loop. + if (currentFiber !== null) { + resumeTimersRecursively(currentFiber); + } +}; + +function recordEffect() { + if (enableUserTimingAPI) { + effectCountInCurrentCommit++; + } +} + +function recordScheduleUpdate() { + if (enableUserTimingAPI) { + if (isCommitting) { + hasScheduledUpdateInCurrentCommit = true; + } + if ( + currentPhase !== null && + currentPhase !== "componentWillMount" && + currentPhase !== "componentWillReceiveProps" + ) { + hasScheduledUpdateInCurrentPhase = true; + } + } +} + +function startRequestCallbackTimer() { + if (enableUserTimingAPI) { + if (supportsUserTiming && !isWaitingForCallback) { + isWaitingForCallback = true; + beginMark("(Waiting for async callback...)"); + } + } +} + +function stopRequestCallbackTimer(didExpire) { + if (enableUserTimingAPI) { + if (supportsUserTiming) { + isWaitingForCallback = false; + var warning = didExpire + ? "Update expired; will flush synchronously" + : null; + endMark( + "(Waiting for async callback...)", + "(Waiting for async callback...)", + warning + ); + } + } +} + +function startWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, this is the fiber to unwind from. + currentFiber = fiber; + if (!beginFiberMark(fiber, null)) { + return; + } + fiber._debugIsCurrentlyTiming = true; + } +} + +function cancelWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // Remember we shouldn't complete measurement for this fiber. + // Otherwise flamechart will be deep even for small updates. + fiber._debugIsCurrentlyTiming = false; + clearFiberMark(fiber, null); + } +} + +function stopWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + endFiberMark(fiber, null, null); + } +} + +function stopFailedWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber.return; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + var warning = + fiber.tag === SuspenseComponent || + fiber.tag === DehydratedSuspenseComponent + ? "Rendering was suspended" + : "An error was thrown inside this error boundary"; + endFiberMark(fiber, null, warning); + } +} + +function startPhaseTimer(fiber, phase) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + clearPendingPhaseMeasurement(); + if (!beginFiberMark(fiber, phase)) { + return; + } + currentPhaseFiber = fiber; + currentPhase = phase; + } +} + +function stopPhaseTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + if (currentPhase !== null && currentPhaseFiber !== null) { + var warning = hasScheduledUpdateInCurrentPhase + ? "Scheduled a cascading update" + : null; + endFiberMark(currentPhaseFiber, currentPhase, warning); + } + currentPhase = null; + currentPhaseFiber = null; + } +} + +function startWorkLoopTimer(nextUnitOfWork) { + if (enableUserTimingAPI) { + currentFiber = nextUnitOfWork; + if (!supportsUserTiming) { + return; + } + commitCountInCurrentWorkLoop = 0; + // This is top level call. + // Any other measurements are performed within. + beginMark("(React Tree Reconciliation)"); + // Resume any measurements that were in progress during the last loop. + resumeTimers(); + } +} + +function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var warning = null; + if (interruptedBy !== null) { + if (interruptedBy.tag === HostRoot) { + warning = "A top-level update interrupted the previous render"; + } else { + var componentName = getComponentName(interruptedBy.type) || "Unknown"; + warning = + "An update to " + componentName + " interrupted the previous render"; + } + } else if (commitCountInCurrentWorkLoop > 1) { + warning = "There were cascading updates"; + } + commitCountInCurrentWorkLoop = 0; + var label = didCompleteRoot + ? "(React Tree Reconciliation: Completed Root)" + : "(React Tree Reconciliation: Yielded)"; + // Pause any measurements until the next loop. + pauseTimers(); + endMark(label, "(React Tree Reconciliation)", warning); + } +} + +function startCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + isCommitting = true; + hasScheduledUpdateInCurrentCommit = false; + labelsInCurrentCommit.clear(); + beginMark("(Committing Changes)"); + } +} + +function stopCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + + var warning = null; + if (hasScheduledUpdateInCurrentCommit) { + warning = "Lifecycle hook scheduled a cascading update"; + } else if (commitCountInCurrentWorkLoop > 0) { + warning = "Caused by a cascading update in earlier commit"; + } + hasScheduledUpdateInCurrentCommit = false; + commitCountInCurrentWorkLoop++; + isCommitting = false; + labelsInCurrentCommit.clear(); + + endMark("(Committing Changes)", "(Committing Changes)", warning); + } +} + +function startCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Committing Snapshot Effects)"); + } +} + +function stopCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Snapshot Effects: " + count + " Total)", + "(Committing Snapshot Effects)", + null + ); + } +} + +function startCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Committing Host Effects)"); + } +} + +function stopCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Committing Host Effects: " + count + " Total)", + "(Committing Host Effects)", + null + ); + } +} + +function startCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark("(Calling Lifecycle Methods)"); + } +} + +function stopCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark( + "(Calling Lifecycle Methods: " + count + " Total)", + "(Calling Lifecycle Methods)", + null + ); + } +} + +var valueStack = []; + +var fiberStack = void 0; + +{ + fiberStack = []; +} + +var index = -1; + +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} + +function pop(cursor, fiber) { + if (index < 0) { + { + warningWithoutStack$1(false, "Unexpected pop."); + } + return; + } + + { + if (fiber !== fiberStack[index]) { + warningWithoutStack$1(false, "Unexpected Fiber popped."); + } + } + + cursor.current = valueStack[index]; + + valueStack[index] = null; + + { + fiberStack[index] = null; + } + + index--; +} + +function push(cursor, value, fiber) { + index++; + + valueStack[index] = cursor.current; + + { + fiberStack[index] = fiber; + } + + cursor.current = value; +} + +var warnedAboutMissingGetChildContext = void 0; + +{ + warnedAboutMissingGetChildContext = {}; +} + +var emptyContextObject = {}; +{ + Object.freeze(emptyContextObject); +} + +// A cursor to the current merged context object on the stack. +var contextStackCursor = createCursor(emptyContextObject); +// A cursor to a boolean indicating whether the context has changed. +var didPerformWorkStackCursor = createCursor(false); +// Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. +var previousContext = emptyContextObject; + +function getUnmaskedContext( + workInProgress, + Component, + didPushOwnContextIfProvider +) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; + } + return contextStackCursor.current; + } +} + +function cacheContext(workInProgress, unmaskedContext, maskedContext) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + } +} + +function getMaskedContext(workInProgress, unmaskedContext) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + var type = workInProgress.type; + var contextTypes = type.contextTypes; + if (!contextTypes) { + return emptyContextObject; + } + + // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) { + return instance.__reactInternalMemoizedMaskedChildContext; + } + + var context = {}; + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } + + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + contextTypes, + context, + "context", + name, + getCurrentFiberStackInDev + ); + } + + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } + + return context; + } +} + +function hasContextChanged() { + if (disableLegacyContext) { + return false; + } else { + return didPerformWorkStackCursor.current; + } +} + +function isContextProvider(type) { + if (disableLegacyContext) { + return false; + } else { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } +} + +function popContext(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } +} + +function popTopLevelContextObject(fiber) { + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } +} + +function pushTopLevelContextObject(fiber, context, didChange) { + if (disableLegacyContext) { + return; + } else { + (function() { + if (!(contextStackCursor.current === emptyContextObject)) { + throw ReactError( + Error( + "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(fiber, type, parentContext) { + if (disableLegacyContext) { + return parentContext; + } else { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; + + // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== "function") { + { + var componentName = getComponentName(type) || "Unknown"; + + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + warningWithoutStack$1( + false, + "%s.childContextTypes is specified but there is no getChildContext() method " + + "on the instance. You can either define getChildContext() on %s or remove " + + "childContextTypes from it.", + componentName, + componentName + ); + } + } + return parentContext; + } + + var childContext = void 0; + { + setCurrentPhase("getChildContext"); + } + startPhaseTimer(fiber, "getChildContext"); + childContext = instance.getChildContext(); + stopPhaseTimer(); + { + setCurrentPhase(null); + } + for (var contextKey in childContext) { + (function() { + if (!(contextKey in childContextTypes)) { + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + } + })(); + } + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + childContextTypes, + childContext, + "child context", + name, + // In practice, there is one case in which we won't get a stack. It's when + // somebody calls unstable_renderSubtreeIntoContainer() and we process + // context from the parent component instance. The stack will be missing + // because it's outside of the reconciliation, and so the pointer has not + // been set. This is rare and doesn't matter. We'll also remove that API. + getCurrentFiberStackInDev + ); + } + + return Object.assign({}, parentContext, childContext); + } +} + +function pushContextProvider(workInProgress) { + if (disableLegacyContext) { + return false; + } else { + var instance = workInProgress.stateNode; + // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + + // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. + previousContext = contextStackCursor.current; + push(contextStackCursor, memoizedMergedChildContext, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + + return true; + } +} + +function invalidateContextProvider(workInProgress, type, didChange) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + (function() { + if (!instance) { + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext( + workInProgress, + type, + previousContext + ); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; + + // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor, workInProgress); + // Now push the new context and mark that it has changed. + push(contextStackCursor, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } + } +} + +function findCurrentUnmaskedContext(fiber) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + (function() { + if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + var node = fiber; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; + case ClassComponent: { + var Component = node.type; + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; + } + break; + } + } + node = node.return; + } while (node !== null); + (function() { + { + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } +} + +var LegacyRoot = 0; +var BatchedRoot = 1; +var ConcurrentRoot = 2; + +/** + * 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 warning = warningWithoutStack$1; + +{ + warning = function(condition, format) { + if (condition) { + return; + } + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + // eslint-disable-next-line react-internal/warning-and-invariant-args + + for ( + var _len = arguments.length, + args = Array(_len > 2 ? _len - 2 : 0), + _key = 2; + _key < _len; + _key++ + ) { + args[_key - 2] = arguments[_key]; + } + + warningWithoutStack$1.apply( + undefined, + [false, format + "%s"].concat(args, [stack]) + ); + }; +} + +var warning$1 = warning; + +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority; +var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback; +var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback; +var Scheduler_shouldYield = Scheduler.unstable_shouldYield; +var Scheduler_requestPaint = Scheduler.unstable_requestPaint; +var Scheduler_now = Scheduler.unstable_now; +var Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel; +var Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var Scheduler_NormalPriority = Scheduler.unstable_NormalPriority; +var Scheduler_LowPriority = Scheduler.unstable_LowPriority; +var Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; + +if (enableSchedulerTracing) { + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + (function() { + if ( + !( + tracing.__interactionsRef != null && + tracing.__interactionsRef.current != null + ) + ) { + throw ReactError( + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) + ); + } + })(); +} + +var fakeCallbackNode = {}; + +// Except for NoPriority, these correspond to Scheduler priorities. We use +// ascending numbers so we can compare them like numbers. They start at 90 to +// avoid clashing with Scheduler's priorities. +var ImmediatePriority = 99; +var UserBlockingPriority = 98; +var NormalPriority = 97; +var LowPriority = 96; +var IdlePriority = 95; +// NoPriority is the absence of priority. Also React-only. +var NoPriority = 90; + +var shouldYield = Scheduler_shouldYield; +var requestPaint = + // Fall back gracefully if we're running an older version of Scheduler. + Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; + +var syncQueue = null; +var immediateQueueCallbackNode = null; +var isFlushingSyncQueue = false; +var initialTimeMs = Scheduler_now(); + +// If the initial timestamp is reasonably small, use Scheduler's `now` directly. +// This will be the case for modern browsers that support `performance.now`. In +// older browsers, Scheduler falls back to `Date.now`, which returns a Unix +// timestamp. In that case, subtract the module initialization time to simulate +// the behavior of performance.now and keep our times small enough to fit +// within 32 bits. +// TODO: Consider lifting this into Scheduler. +var now = + initialTimeMs < 10000 + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; + +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return ImmediatePriority; + case Scheduler_UserBlockingPriority: + return UserBlockingPriority; + case Scheduler_NormalPriority: + return NormalPriority; + case Scheduler_LowPriority: + return LowPriority; + case Scheduler_IdlePriority: + return IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case ImmediatePriority: + return Scheduler_ImmediatePriority; + case UserBlockingPriority: + return Scheduler_UserBlockingPriority; + case NormalPriority: + return Scheduler_NormalPriority; + case LowPriority: + return Scheduler_LowPriority; + case IdlePriority: + return Scheduler_IdlePriority; + default: + (function() { + { + throw ReactError(Error("Unknown priority level.")); + } + })(); + } +} + +function runWithPriority(reactPriorityLevel, fn) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(priorityLevel, fn); +} + +function scheduleCallback(reactPriorityLevel, callback, options) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(priorityLevel, callback, options); +} + +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + // Flush the queue in the next tick, at the earliest. + immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ); + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } + return fakeCallbackNode; +} + +function cancelCallback(callbackNode) { + if (callbackNode !== fakeCallbackNode) { + Scheduler_cancelCallback(callbackNode); + } +} + +function flushSyncCallbackQueue() { + if (immediateQueueCallbackNode !== null) { + Scheduler_cancelCallback(immediateQueueCallbackNode); + } + flushSyncCallbackQueueImpl(); +} + +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + try { + var _isSync = true; + var queue = syncQueue; + runWithPriority(ImmediatePriority, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + callback = callback(_isSync); + } while (callback !== null); + } + }); + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); + } + // Resume flushing in the next tick + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ); + throw error; + } finally { + isFlushingSyncQueue = false; + } + } +} + +var NoMode = 0; +var StrictMode = 1; +// TODO: Remove BatchedMode and ConcurrentMode by reading from the root +// tag instead +var BatchedMode = 2; +var ConcurrentMode = 4; +var ProfileMode = 8; + +// Max 31 bit integer. The max integer size in V8 for 32-bit systems. +// Math.pow(2, 30) - 1 +// 0b111111111111111111111111111111 +var MAX_SIGNED_31_BIT_INT = 1073741823; + +var NoWork = 0; +var Never = 1; +var Sync = MAX_SIGNED_31_BIT_INT; +var Batched = Sync - 1; + +var UNIT_SIZE = 10; +var MAGIC_NUMBER_OFFSET = Batched - 1; + +// 1 unit of expiration time represents 10ms. +function msToExpirationTime(ms) { + // Always add an offset so that we don't clash with the magic number for NoWork. + return MAGIC_NUMBER_OFFSET - ((ms / UNIT_SIZE) | 0); +} + +function expirationTimeToMs(expirationTime) { + return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE; +} + +function ceiling(num, precision) { + return (((num / precision) | 0) + 1) * precision; +} + +function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { + return ( + MAGIC_NUMBER_OFFSET - + ceiling( + MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, + bucketSizeMs / UNIT_SIZE + ) + ); +} + +// TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update +// the names to reflect. +var LOW_PRIORITY_EXPIRATION = 5000; +var LOW_PRIORITY_BATCH_SIZE = 250; + +function computeAsyncExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + LOW_PRIORITY_EXPIRATION, + LOW_PRIORITY_BATCH_SIZE + ); +} + +function computeSuspenseExpiration(currentTime, timeoutMs) { + // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time? + return computeExpirationBucket( + currentTime, + timeoutMs, + LOW_PRIORITY_BATCH_SIZE + ); +} + +// We intentionally set a higher expiration time for interactive updates in +// dev than in production. +// +// If the main thread is being blocked so long that you hit the expiration, +// it's a problem that could be solved with better scheduling. +// +// People will be more likely to notice this and fix it with the long +// expiration time in development. +// +// In production we opt for better UX at the risk of masking scheduling +// problems, by expiring fast. +var HIGH_PRIORITY_EXPIRATION = 500; +var HIGH_PRIORITY_BATCH_SIZE = 100; + +function computeInteractiveExpiration(currentTime) { + return computeExpirationBucket( + currentTime, + HIGH_PRIORITY_EXPIRATION, + HIGH_PRIORITY_BATCH_SIZE + ); +} + +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (expirationTime === Sync) { + return ImmediatePriority; + } + if (expirationTime === Never) { + return IdlePriority; + } + var msUntil = + expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime); + if (msUntil <= 0) { + return ImmediatePriority; + } + if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) { + return UserBlockingPriority; + } + if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) { + return NormalPriority; + } + + // TODO: Handle LowPriority + + // Assume anything lower has idle priority + return IdlePriority; +} + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return ( + (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare + ); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if ( + typeof objA !== "object" || + objA === null || + typeof objB !== "object" || + objB === null + ) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if ( + !hasOwnProperty.call(objB, keysA[i]) || + !is(objA[keysA[i]], objB[keysA[i]]) + ) { + return false; + } + } + + return true; +} + +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * 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 lowPriorityWarning = function() {}; + +{ + var 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; + var message = + "Warning: " + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== "undefined") { + console.warn(message); + } + 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. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function(condition, format) { + if (format === undefined) { + throw new Error( + "`lowPriorityWarning(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(undefined, [format].concat(args)); + } + }; +} + +var lowPriorityWarning$1 = lowPriorityWarning; + +var ReactStrictModeWarnings = { + recordUnsafeLifecycleWarnings: function(fiber, instance) {}, + flushPendingUnsafeLifecycleWarnings: function() {}, + recordLegacyContextWarning: function(fiber, instance) {}, + flushLegacyContextWarning: function() {}, + discardPendingWarnings: function() {} +}; + +{ + var findStrictRoot = function(fiber) { + var maybeStrictRoot = null; + + var node = fiber; + while (node !== null) { + if (node.mode & StrictMode) { + maybeStrictRoot = node; + } + node = node.return; + } + + return maybeStrictRoot; + }; + + var setToSortedString = function(set) { + var array = []; + set.forEach(function(value) { + array.push(value); + }); + return array.sort().join(", "); + }; + + var pendingComponentWillMountWarnings = []; + var pendingUNSAFE_ComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUNSAFE_ComponentWillUpdateWarnings = []; + + // Tracks components we have already warned about. + var didWarnAboutUnsafeLifecycles = new Set(); + + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( + fiber, + instance + ) { + // Dedup strategy: Warn once per component. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { + return; + } + + if ( + typeof instance.componentWillMount === "function" && + // Don't warn about react-lifecycles-compat polyfilled components. + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + pendingComponentWillMountWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillMount === "function" + ) { + pendingUNSAFE_ComponentWillMountWarnings.push(fiber); + } + + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + pendingComponentWillReceivePropsWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); + } + + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + pendingComponentWillUpdateWarnings.push(fiber); + } + + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillUpdate === "function" + ) { + pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); + } + }; + + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { + // We do an initial pass to gather component names + var componentWillMountUniqueNames = new Set(); + if (pendingComponentWillMountWarnings.length > 0) { + pendingComponentWillMountWarnings.forEach(function(fiber) { + componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillMountWarnings = []; + } + + var UNSAFE_componentWillMountUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { + pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { + UNSAFE_componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillMountWarnings = []; + } + + var componentWillReceivePropsUniqueNames = new Set(); + if (pendingComponentWillReceivePropsWarnings.length > 0) { + pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { + componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingComponentWillReceivePropsWarnings = []; + } + + var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { + UNSAFE_componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + } + + var componentWillUpdateUniqueNames = new Set(); + if (pendingComponentWillUpdateWarnings.length > 0) { + pendingComponentWillUpdateWarnings.forEach(function(fiber) { + componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingComponentWillUpdateWarnings = []; + } + + var UNSAFE_componentWillUpdateUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { + pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { + UNSAFE_componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingUNSAFE_ComponentWillUpdateWarnings = []; + } + + // Finally, we flush all the warnings + // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' + if (UNSAFE_componentWillMountUniqueNames.size > 0) { + var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "\nPlease update the following components: %s", + sortedNames + ); + } + + if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames = setToSortedString( + UNSAFE_componentWillReceivePropsUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillReceiveProps in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, " + + "refactor your code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "\nPlease update the following components: %s", + _sortedNames + ); + } + + if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { + var _sortedNames2 = setToSortedString( + UNSAFE_componentWillUpdateUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillUpdate in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "\nPlease update the following components: %s", + _sortedNames2 + ); + } + + if (componentWillMountUniqueNames.size > 0) { + var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); + + lowPriorityWarning$1( + false, + "componentWillMount has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "* Rename componentWillMount to UNSAFE_componentWillMount to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames3 + ); + } + + if (componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames4 = setToSortedString( + componentWillReceivePropsUniqueNames + ); + + lowPriorityWarning$1( + false, + "componentWillReceiveProps has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, refactor your " + + "code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames4 + ); + } + + if (componentWillUpdateUniqueNames.size > 0) { + var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); + + lowPriorityWarning$1( + false, + "componentWillUpdate has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames5 + ); + } + }; + + var pendingLegacyContextWarning = new Map(); + + // Tracks components we have already warned about. + var didWarnAboutLegacyContext = new Set(); + + ReactStrictModeWarnings.recordLegacyContextWarning = function( + fiber, + instance + ) { + var strictRoot = findStrictRoot(fiber); + if (strictRoot === null) { + warningWithoutStack$1( + false, + "Expected to find a StrictMode component in a strict mode tree. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + return; + } + + // Dedup strategy: Warn once per component. + if (didWarnAboutLegacyContext.has(fiber.type)) { + return; + } + + var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); + + if ( + fiber.type.contextTypes != null || + fiber.type.childContextTypes != null || + (instance !== null && typeof instance.getChildContext === "function") + ) { + if (warningsForRoot === undefined) { + warningsForRoot = []; + pendingLegacyContextWarning.set(strictRoot, warningsForRoot); + } + warningsForRoot.push(fiber); + } + }; + + ReactStrictModeWarnings.flushLegacyContextWarning = function() { + pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) { + var uniqueNames = new Set(); + fiberArray.forEach(function(fiber) { + uniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutLegacyContext.add(fiber.type); + }); + + var sortedNames = setToSortedString(uniqueNames); + var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); + + warningWithoutStack$1( + false, + "Legacy context API has been detected within a strict-mode tree: %s" + + "\n\nThe old API will be supported in all 16.x releases, but applications " + + "using it should migrate to the new version." + + "\n\nPlease update the following components: %s" + + "\n\nLearn more about this warning here:" + + "\nhttps://fb.me/react-legacy-context", + strictRootComponentStack, + sortedNames + ); + }); + }; + + ReactStrictModeWarnings.discardPendingWarnings = function() { + pendingComponentWillMountWarnings = []; + pendingUNSAFE_ComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUNSAFE_ComponentWillUpdateWarnings = []; + pendingLegacyContextWarning = new Map(); + }; +} + +// Resolves type to a family. + +// Used by React Refresh runtime through DevTools Global Hook. + +var resolveFamily = null; +// $FlowFixMe Flow gets confused by a WeakSet feature check below. +var failedBoundaries = null; + +var setRefreshHandler = function(handler) { + { + resolveFamily = handler; + } +}; + +function resolveFunctionForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + return type; + } + // Use the latest known implementation. + return family.current; + } +} + +function resolveClassForHotReloading(type) { + // No implementation differences. + return resolveFunctionForHotReloading(type); +} + +function resolveForwardRefForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + // Check if we're dealing with a real forwardRef. Don't want to crash early. + if ( + type !== null && + type !== undefined && + typeof type.render === "function" + ) { + // ForwardRef is special because its resolved .type is an object, + // but it's possible that we only have its inner render function in the map. + // If that inner render function is different, we'll build a new forwardRef type. + var currentRender = resolveFunctionForHotReloading(type.render); + if (type.render !== currentRender) { + var syntheticType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: currentRender + }; + if (type.displayName !== undefined) { + syntheticType.displayName = type.displayName; + } + return syntheticType; + } + } + return type; + } + // Use the latest known implementation. + return family.current; + } +} + +function isCompatibleFamilyForHotReloading(fiber, element) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return false; + } + + var prevType = fiber.elementType; + var nextType = element.type; + + // If we got here, we know types aren't === equal. + var needsCompareFamilies = false; + + var $$typeofNextType = + typeof nextType === "object" && nextType !== null + ? nextType.$$typeof + : null; + + switch (fiber.tag) { + case ClassComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } + break; + } + case FunctionComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + // We don't know the inner type yet. + // We're going to assume that the lazy inner type is stable, + // and so it is sufficient to avoid reconciling it away. + // We're not going to unwrap or actually use the new lazy type. + needsCompareFamilies = true; + } + break; + } + case ForwardRef: { + if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + case MemoComponent: + case SimpleMemoComponent: { + if ($$typeofNextType === REACT_MEMO_TYPE) { + // TODO: if it was but can no longer be simple, + // we shouldn't set this. + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + default: + return false; + } + + // Check if both types have a family and it's the same one. + if (needsCompareFamilies) { + // Note: memo() and forwardRef() we'll compare outer rather than inner type. + // This means both of them need to be registered to preserve state. + // If we unwrapped and compared the inner types for wrappers instead, + // then we would risk falsely saying two separate memo(Foo) + // calls are equivalent because they wrap the same Foo function. + var prevFamily = resolveFamily(prevType); + if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { + return true; + } + } + return false; + } +} + +function markFailedErrorBoundaryForHotReloading(fiber) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + if (typeof WeakSet !== "function") { + return; + } + if (failedBoundaries === null) { + failedBoundaries = new WeakSet(); + } + failedBoundaries.add(fiber); + } +} + +var scheduleRefresh = function(root, update) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + var _staleFamilies = update.staleFamilies, + _updatedFamilies = update.updatedFamilies; + + flushPassiveEffects(); + flushSync(function() { + scheduleFibersWithFamiliesRecursively( + root.current, + _updatedFamilies, + _staleFamilies + ); + }); + } +}; + +var scheduleRoot = function(root, element) { + { + if (root.context !== emptyContextObject) { + // Super edge case: root has a legacy _renderSubtree context + // but we don't know the parentComponent so we can't pass it. + // Just ignore. We'll delete this with _renderSubtree code path later. + return; + } + flushPassiveEffects(); + updateContainerAtExpirationTime(element, root, null, Sync, null); + } +}; + +function scheduleFibersWithFamiliesRecursively( + fiber, + updatedFamilies, + staleFamilies +) { + { + var alternate = fiber.alternate, + child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + if (resolveFamily === null) { + throw new Error("Expected resolveFamily to be set during hot reload."); + } + + var needsRender = false; + var needsRemount = false; + if (candidateType !== null) { + var family = resolveFamily(candidateType); + if (family !== undefined) { + if (staleFamilies.has(family)) { + needsRemount = true; + } else if (updatedFamilies.has(family)) { + if (tag === ClassComponent) { + needsRemount = true; + } else { + needsRender = true; + } + } + } + } + if (failedBoundaries !== null) { + if ( + failedBoundaries.has(fiber) || + (alternate !== null && failedBoundaries.has(alternate)) + ) { + needsRemount = true; + } + } + + if (needsRemount) { + fiber._debugNeedsRemount = true; + } + if (needsRemount || needsRender) { + scheduleWork(fiber, Sync); + } + if (child !== null && !needsRemount) { + scheduleFibersWithFamiliesRecursively( + child, + updatedFamilies, + staleFamilies + ); + } + if (sibling !== null) { + scheduleFibersWithFamiliesRecursively( + sibling, + updatedFamilies, + staleFamilies + ); + } + } +} + +var findHostInstancesForRefresh = function(root, families) { + { + var hostInstances = new Set(); + var types = new Set( + families.map(function(family) { + return family.current; + }) + ); + findHostInstancesForMatchingFibersRecursively( + root.current, + types, + hostInstances + ); + return hostInstances; + } +}; + +function findHostInstancesForMatchingFibersRecursively( + fiber, + types, + hostInstances +) { + { + var child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } + + var didMatch = false; + if (candidateType !== null) { + if (types.has(candidateType)) { + didMatch = true; + } + } + + if (didMatch) { + // We have a match. This only drills down to the closest host components. + // There's no need to search deeper because for the purpose of giving + // visual feedback, "flashing" outermost parent rectangles is sufficient. + findHostInstancesForFiberShallowly(fiber, hostInstances); + } else { + // If there's no match, maybe there will be one further down in the child tree. + if (child !== null) { + findHostInstancesForMatchingFibersRecursively( + child, + types, + hostInstances + ); + } + } + + if (sibling !== null) { + findHostInstancesForMatchingFibersRecursively( + sibling, + types, + hostInstances + ); + } + } +} + +function findHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var foundHostInstances = findChildHostInstancesForFiberShallowly( + fiber, + hostInstances + ); + if (foundHostInstances) { + return; + } + // If we didn't find any host children, fallback to closest host parent. + var node = fiber; + while (true) { + switch (node.tag) { + case HostComponent: + hostInstances.add(node.stateNode); + return; + case HostPortal: + hostInstances.add(node.stateNode.containerInfo); + return; + case HostRoot: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (node.return === null) { + throw new Error("Expected to reach root first."); + } + node = node.return; + } + } +} + +function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var node = fiber; + var foundHostInstances = false; + while (true) { + if (node.tag === HostComponent) { + // We got a match. + foundHostInstances = true; + hostInstances.add(node.stateNode); + // There may still be more, so keep searching. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === fiber) { + return foundHostInstances; + } + while (node.sibling === null) { + if (node.return === null || node.return === fiber) { + return foundHostInstances; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return false; +} + +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + // Resolve default props. Taken from ReactElement + var props = Object.assign({}, baseProps); + var defaultProps = Component.defaultProps; + for (var propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + return props; + } + return baseProps; +} + +function readLazyComponentType(lazyComponent) { + var status = lazyComponent._status; + var result = lazyComponent._result; + switch (status) { + case Resolved: { + var Component = result; + return Component; + } + case Rejected: { + var error = result; + throw error; + } + case Pending: { + var thenable = result; + throw thenable; + } + default: { + lazyComponent._status = Pending; + var ctor = lazyComponent._ctor; + var _thenable = ctor(); + _thenable.then( + function(moduleObject) { + if (lazyComponent._status === Pending) { + var defaultExport = moduleObject.default; + { + if (defaultExport === undefined) { + warning$1( + false, + "lazy: Expected the result of a dynamic import() call. " + + "Instead received: %s\n\nYour code should look like: \n " + + "const MyComponent = lazy(() => import('./MyComponent'))", + moduleObject + ); + } + } + lazyComponent._status = Resolved; + lazyComponent._result = defaultExport; + } + }, + function(error) { + if (lazyComponent._status === Pending) { + lazyComponent._status = Rejected; + lazyComponent._result = error; + } + } + ); + // Handle synchronous thenables. + switch (lazyComponent._status) { + case Resolved: + return lazyComponent._result; + case Rejected: + throw lazyComponent._result; + } + lazyComponent._result = _thenable; + throw _thenable; + } + } +} + +var valueCursor = createCursor(null); + +var rendererSigil = void 0; +{ + // Use this to detect multiple renderers using the same context + rendererSigil = {}; +} + +var currentlyRenderingFiber = null; +var lastContextDependency = null; +var lastContextWithAllBitsObserved = null; + +var isDisallowedContextReadInDEV = false; + +function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber = null; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + { + isDisallowedContextReadInDEV = false; + } +} + +function enterDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = true; + } +} + +function exitDisallowedContextReadInDEV() { + { + isDisallowedContextReadInDEV = false; + } +} + +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + + if (isPrimaryRenderer) { + push(valueCursor, context._currentValue, providerFiber); + + context._currentValue = nextValue; + { + !( + context._currentRenderer === undefined || + context._currentRenderer === null || + context._currentRenderer === rendererSigil + ) + ? warningWithoutStack$1( + false, + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ) + : void 0; + context._currentRenderer = rendererSigil; + } + } else { + push(valueCursor, context._currentValue2, providerFiber); + + context._currentValue2 = nextValue; + { + !( + context._currentRenderer2 === undefined || + context._currentRenderer2 === null || + context._currentRenderer2 === rendererSigil + ) + ? warningWithoutStack$1( + false, + "Detected multiple renderers concurrently rendering the " + + "same context provider. This is currently unsupported." + ) + : void 0; + context._currentRenderer2 = rendererSigil; + } + } +} + +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + + pop(valueCursor, providerFiber); + + var context = providerFiber.type._context; + if (isPrimaryRenderer) { + context._currentValue = currentValue; + } else { + context._currentValue2 = currentValue; + } +} + +function calculateChangedBits(context, newValue, oldValue) { + if (is(oldValue, newValue)) { + // No change + return 0; + } else { + var changedBits = + typeof context._calculateChangedBits === "function" + ? context._calculateChangedBits(oldValue, newValue) + : MAX_SIGNED_31_BIT_INT; + + { + !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) + ? warning$1( + false, + "calculateChangedBits: Expected the return value to be a " + + "31-bit integer. Instead received: %s", + changedBits + ) + : void 0; + } + return changedBits | 0; + } +} + +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + // Update the child expiration time of all the ancestors, including + // the alternates. + var node = parent; + while (node !== null) { + var alternate = node.alternate; + if (node.childExpirationTime < renderExpirationTime) { + node.childExpirationTime = renderExpirationTime; + if ( + alternate !== null && + alternate.childExpirationTime < renderExpirationTime + ) { + alternate.childExpirationTime = renderExpirationTime; + } + } else if ( + alternate !== null && + alternate.childExpirationTime < renderExpirationTime + ) { + alternate.childExpirationTime = renderExpirationTime; + } else { + // Neither alternate was updated, which means the rest of the + // ancestor path already has sufficient priority. + break; + } + node = node.return; + } +} + +function propagateContextChange( + workInProgress, + context, + changedBits, + renderExpirationTime +) { + var fiber = workInProgress.child; + if (fiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + } + while (fiber !== null) { + var nextFiber = void 0; + + // Visit this fiber. + var list = fiber.dependencies; + if (list !== null) { + nextFiber = fiber.child; + + var dependency = list.firstContext; + while (dependency !== null) { + // Check if the context matches. + if ( + dependency.context === context && + (dependency.observedBits & changedBits) !== 0 + ) { + // Match! Schedule an update on this fiber. + + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var update = createUpdate(renderExpirationTime, null); + update.tag = ForceUpdate; + // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + enqueueUpdate(fiber, update); + } + + if (fiber.expirationTime < renderExpirationTime) { + fiber.expirationTime = renderExpirationTime; + } + var alternate = fiber.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + + scheduleWorkOnParentPath(fiber.return, renderExpirationTime); + + // Mark the expiration time on the list, too. + if (list.expirationTime < renderExpirationTime) { + list.expirationTime = renderExpirationTime; + } + + // Since we already found a match, we can stop traversing the + // dependency list. + break; + } + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) { + // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + } else if ( + enableSuspenseServerRenderer && + fiber.tag === DehydratedSuspenseComponent + ) { + // If a dehydrated suspense component is in this subtree, we don't know + // if it will have any context consumers in it. The best we can do is + // mark it as having updates on its children. + if (fiber.expirationTime < renderExpirationTime) { + fiber.expirationTime = renderExpirationTime; + } + var _alternate = fiber.alternate; + if ( + _alternate !== null && + _alternate.expirationTime < renderExpirationTime + ) { + _alternate.expirationTime = renderExpirationTime; + } + // This is intentionally passing this fiber as the parent + // because we want to schedule this fiber as having work + // on its children. We'll use the childExpirationTime on + // this fiber to indicate that a context has changed. + scheduleWorkOnParentPath(fiber, renderExpirationTime); + nextFiber = fiber.sibling; + } else { + // Traverse down. + nextFiber = fiber.child; + } + + if (nextFiber !== null) { + // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + } else { + // No child. Traverse to next sibling. + nextFiber = fiber; + while (nextFiber !== null) { + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + var sibling = nextFiber.sibling; + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } + // No more siblings. Traverse up. + nextFiber = nextFiber.return; + } + } + fiber = nextFiber; + } +} + +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + + var dependencies = workInProgress.dependencies; + if (dependencies !== null) { + var firstContext = dependencies.firstContext; + if (firstContext !== null) { + if (dependencies.expirationTime >= renderExpirationTime) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } + // Reset the work-in-progress list + dependencies.firstContext = null; + } + } +} + +function readContext(context, observedBits) { + { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + !!isDisallowedContextReadInDEV + ? warning$1( + false, + "Context can only be read while React is rendering. " + + "In classes, you can read it in the render method or getDerivedStateFromProps. " + + "In function components, you can read it directly in the function body, but not " + + "inside Hooks like useReducer() or useMemo()." + ) + : void 0; + } + + if (lastContextWithAllBitsObserved === context) { + // Nothing to do. We already observe everything in this context. + } else if (observedBits === false || observedBits === 0) { + // Do not observe any updates. + } else { + var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types. + if ( + typeof observedBits !== "number" || + observedBits === MAX_SIGNED_31_BIT_INT + ) { + // Observe all updates. + lastContextWithAllBitsObserved = context; + resolvedObservedBits = MAX_SIGNED_31_BIT_INT; + } else { + resolvedObservedBits = observedBits; + } + + var contextItem = { + context: context, + observedBits: resolvedObservedBits, + next: null + }; + + if (lastContextDependency === null) { + (function() { + if (!(currentlyRenderingFiber !== null)) { + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + } + })(); + + // This is the first dependency for this component. Create a new list. + lastContextDependency = contextItem; + currentlyRenderingFiber.dependencies = { + expirationTime: NoWork, + firstContext: contextItem, + responders: null + }; + } else { + // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + } + return isPrimaryRenderer ? context._currentValue : context._currentValue2; +} + +// UpdateQueue is a linked list of prioritized updates. +// +// Like fibers, update queues come in pairs: a current queue, which represents +// the visible state of the screen, and a work-in-progress queue, which can be +// mutated and processed asynchronously before it is committed — a form of +// double buffering. If a work-in-progress render is discarded before finishing, +// we create a new work-in-progress by cloning the current queue. +// +// Both queues share a persistent, singly-linked list structure. To schedule an +// update, we append it to the end of both queues. Each queue maintains a +// pointer to first update in the persistent list that hasn't been processed. +// The work-in-progress pointer always has a position equal to or greater than +// the current queue, since we always work on that one. The current queue's +// pointer is only updated during the commit phase, when we swap in the +// work-in-progress. +// +// For example: +// +// Current pointer: A - B - C - D - E - F +// Work-in-progress pointer: D - E - F +// ^ +// The work-in-progress queue has +// processed more updates than current. +// +// The reason we append to both queues is because otherwise we might drop +// updates without ever processing them. For example, if we only add updates to +// the work-in-progress queue, some updates could be lost whenever a work-in +// -progress render restarts by cloning from current. Similarly, if we only add +// updates to the current queue, the updates will be lost whenever an already +// in-progress queue commits and swaps with the current queue. However, by +// adding to both queues, we guarantee that the update will be part of the next +// work-in-progress. (And because the work-in-progress queue becomes the +// current queue once it commits, there's no danger of applying the same +// update twice.) +// +// Prioritization +// -------------- +// +// Updates are not sorted by priority, but by insertion; new updates are always +// appended to the end of the list. +// +// The priority is still important, though. When processing the update queue +// during the render phase, only the updates with sufficient priority are +// included in the result. If we skip an update because it has insufficient +// priority, it remains in the queue to be processed later, during a lower +// priority render. Crucially, all updates subsequent to a skipped update also +// remain in the queue *regardless of their priority*. That means high priority +// updates are sometimes processed twice, at two separate priorities. We also +// keep track of a base state, that represents the state before the first +// update in the queue is applied. +// +// For example: +// +// Given a base state of '', and the following queue of updates +// +// A1 - B2 - C1 - D2 +// +// where the number indicates the priority, and the update is applied to the +// previous state by appending a letter, React will process these updates as +// two separate renders, one per distinct priority level: +// +// First render, at priority 1: +// Base state: '' +// Updates: [A1, C1] +// Result state: 'AC' +// +// Second render, at priority 2: +// Base state: 'A' <- The base state does not include C1, +// because B2 was skipped. +// Updates: [B2, C1, D2] <- C1 was rebased on top of B2 +// Result state: 'ABCD' +// +// Because we process updates in insertion order, and rebase high priority +// updates when preceding updates are skipped, the final result is deterministic +// regardless of priority. Intermediate state may vary according to system +// resources, but the final state is always the same. + +var UpdateState = 0; +var ReplaceState = 1; +var ForceUpdate = 2; +var CaptureUpdate = 3; + +// Global state that is reset at the beginning of calling `processUpdateQueue`. +// It should only be read right after calling `processUpdateQueue`, via +// `checkHasForceUpdateAfterProcessing`. +var hasForceUpdate = false; + +var didWarnUpdateInsideUpdate = void 0; +var currentlyProcessingQueue = void 0; + +{ + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; +} + +function createUpdateQueue(baseState) { + var queue = { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; + return queue; +} + +function cloneUpdateQueue(currentQueue) { + var queue = { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + + // TODO: With resuming, if we bail out and resuse the child tree, we should + // keep these effects. + firstCapturedUpdate: null, + lastCapturedUpdate: null, + + firstEffect: null, + lastEffect: null, + + firstCapturedEffect: null, + lastCapturedEffect: null + }; + return queue; +} + +function createUpdate(expirationTime, suspenseConfig) { + var update = { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + + tag: UpdateState, + payload: null, + callback: null, + + next: null, + nextEffect: null + }; + { + update.priority = getCurrentPriorityLevel(); + } + return update; +} + +function appendUpdateToQueue(queue, update) { + // Append the update to the end of the list. + if (queue.lastUpdate === null) { + // Queue is empty + queue.firstUpdate = queue.lastUpdate = update; + } else { + queue.lastUpdate.next = update; + queue.lastUpdate = update; + } +} + +function enqueueUpdate(fiber, update) { + // Update queues are created lazily. + var alternate = fiber.alternate; + var queue1 = void 0; + var queue2 = void 0; + if (alternate === null) { + // There's only one fiber. + queue1 = fiber.updateQueue; + queue2 = null; + if (queue1 === null) { + queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState); + } + } else { + // There are two owners. + queue1 = fiber.updateQueue; + queue2 = alternate.updateQueue; + if (queue1 === null) { + if (queue2 === null) { + // Neither fiber has an update queue. Create new ones. + queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState); + queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ); + } else { + // Only one fiber has an update queue. Clone to create a new one. + queue1 = fiber.updateQueue = cloneUpdateQueue(queue2); + } + } else { + if (queue2 === null) { + // Only one fiber has an update queue. Clone to create a new one. + queue2 = alternate.updateQueue = cloneUpdateQueue(queue1); + } else { + // Both owners have an update queue. + } + } + } + if (queue2 === null || queue1 === queue2) { + // There's only a single queue. + appendUpdateToQueue(queue1, update); + } else { + // There are two queues. We need to append the update to both queues, + // while accounting for the persistent structure of the list — we don't + // want the same update to be added multiple times. + if (queue1.lastUpdate === null || queue2.lastUpdate === null) { + // One of the queues is not empty. We must add the update to both queues. + appendUpdateToQueue(queue1, update); + appendUpdateToQueue(queue2, update); + } else { + // Both queues are non-empty. The last update is the same in both lists, + // because of structural sharing. So, only append to one of the lists. + appendUpdateToQueue(queue1, update); + // But we still need to update the `lastUpdate` pointer of queue2. + queue2.lastUpdate = update; + } + } + + { + if ( + fiber.tag === ClassComponent && + (currentlyProcessingQueue === queue1 || + (queue2 !== null && currentlyProcessingQueue === queue2)) && + !didWarnUpdateInsideUpdate + ) { + warningWithoutStack$1( + false, + "An update (setState, replaceState, or forceUpdate) was scheduled " + + "from inside an update function. Update functions should be pure, " + + "with zero side-effects. Consider using componentDidUpdate or a " + + "callback." + ); + didWarnUpdateInsideUpdate = true; + } + } +} + +function enqueueCapturedUpdate(workInProgress, update) { + // Captured updates go into a separate list, and only on the work-in- + // progress queue. + var workInProgressQueue = workInProgress.updateQueue; + if (workInProgressQueue === null) { + workInProgressQueue = workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + ); + } else { + // TODO: I put this here rather than createWorkInProgress so that we don't + // clone the queue unnecessarily. There's probably a better way to + // structure this. + workInProgressQueue = ensureWorkInProgressQueueIsAClone( + workInProgress, + workInProgressQueue + ); + } + + // Append the update to the end of the list. + if (workInProgressQueue.lastCapturedUpdate === null) { + // This is the first render phase update + workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update; + } else { + workInProgressQueue.lastCapturedUpdate.next = update; + workInProgressQueue.lastCapturedUpdate = update; + } +} + +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + if (current !== null) { + // If the work-in-progress queue is equal to the current queue, + // we need to clone it first. + if (queue === current.updateQueue) { + queue = workInProgress.updateQueue = cloneUpdateQueue(queue); + } + } + return queue; +} + +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case ReplaceState: { + var _payload = update.payload; + if (typeof _payload === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + _payload.call(instance, prevState, nextProps); + } + } + var nextState = _payload.call(instance, prevState, nextProps); + { + exitDisallowedContextReadInDEV(); + } + return nextState; + } + // State object + return _payload; + } + case CaptureUpdate: { + workInProgress.effectTag = + (workInProgress.effectTag & ~ShouldCapture) | DidCapture; + } + // Intentional fallthrough + case UpdateState: { + var _payload2 = update.payload; + var partialState = void 0; + if (typeof _payload2 === "function") { + // Updater function + { + enterDisallowedContextReadInDEV(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + _payload2.call(instance, prevState, nextProps); + } + } + partialState = _payload2.call(instance, prevState, nextProps); + { + exitDisallowedContextReadInDEV(); + } + } else { + // Partial state object + partialState = _payload2; + } + if (partialState === null || partialState === undefined) { + // Null and undefined are treated as no-ops. + return prevState; + } + // Merge the partial state and the previous state. + return Object.assign({}, prevState, partialState); + } + case ForceUpdate: { + hasForceUpdate = true; + return prevState; + } + } + return prevState; +} + +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = false; + + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + + { + currentlyProcessingQueue = queue; + } + + // These values may change as we process the queue. + var newBaseState = queue.baseState; + var newFirstUpdate = null; + var newExpirationTime = NoWork; + + // Iterate through the list of updates to compute the result. + var update = queue.firstUpdate; + var resultState = newBaseState; + while (update !== null) { + var updateExpirationTime = update.expirationTime; + if (updateExpirationTime < renderExpirationTime) { + // This update does not have sufficient priority. Skip it. + if (newFirstUpdate === null) { + // This is the first skipped update. It will be the first update in + // the new list. + newFirstUpdate = update; + // Since this is the first update that was skipped, the current result + // is the new base state. + newBaseState = resultState; + } + // Since this update will remain in the list, update the remaining + // expiration time. + if (newExpirationTime < updateExpirationTime) { + newExpirationTime = updateExpirationTime; + } + } else { + // This update does have sufficient priority. + + // Mark the event time of this update as relevant to this render pass. + // TODO: This should ideally use the true event time of this update rather than + // its priority which is a derived and not reverseable value. + // TODO: We should skip this update if it was already committed but currently + // we have no way of detecting the difference between a committed and suspended + // update here. + markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); + + // Process it and compute a new result. + resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + ); + var _callback = update.callback; + if (_callback !== null) { + workInProgress.effectTag |= Callback; + // Set this to null, in case it was mutated during an aborted render. + update.nextEffect = null; + if (queue.lastEffect === null) { + queue.firstEffect = queue.lastEffect = update; + } else { + queue.lastEffect.nextEffect = update; + queue.lastEffect = update; + } + } + } + // Continue to the next update. + update = update.next; + } + + // Separately, iterate though the list of captured updates. + var newFirstCapturedUpdate = null; + update = queue.firstCapturedUpdate; + while (update !== null) { + var _updateExpirationTime = update.expirationTime; + if (_updateExpirationTime < renderExpirationTime) { + // This update does not have sufficient priority. Skip it. + if (newFirstCapturedUpdate === null) { + // This is the first skipped captured update. It will be the first + // update in the new list. + newFirstCapturedUpdate = update; + // If this is the first update that was skipped, the current result is + // the new base state. + if (newFirstUpdate === null) { + newBaseState = resultState; + } + } + // Since this update will remain in the list, update the remaining + // expiration time. + if (newExpirationTime < _updateExpirationTime) { + newExpirationTime = _updateExpirationTime; + } + } else { + // This update does have sufficient priority. Process it and compute + // a new result. + resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + ); + var _callback2 = update.callback; + if (_callback2 !== null) { + workInProgress.effectTag |= Callback; + // Set this to null, in case it was mutated during an aborted render. + update.nextEffect = null; + if (queue.lastCapturedEffect === null) { + queue.firstCapturedEffect = queue.lastCapturedEffect = update; + } else { + queue.lastCapturedEffect.nextEffect = update; + queue.lastCapturedEffect = update; + } + } + } + update = update.next; + } + + if (newFirstUpdate === null) { + queue.lastUpdate = null; + } + if (newFirstCapturedUpdate === null) { + queue.lastCapturedUpdate = null; + } else { + workInProgress.effectTag |= Callback; + } + if (newFirstUpdate === null && newFirstCapturedUpdate === null) { + // We processed every update, without skipping. That means the new base + // state is the same as the result state. + newBaseState = resultState; + } + + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = newFirstCapturedUpdate; + + // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; + + { + currentlyProcessingQueue = null; + } +} + +function callCallback(callback, context) { + (function() { + if (!(typeof callback === "function")) { + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + callback + ) + ); + } + })(); + callback.call(context); +} + +function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; +} + +function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; +} + +function commitUpdateQueue( + finishedWork, + finishedQueue, + instance, + renderExpirationTime +) { + // If the finished render included captured updates, and there are still + // lower priority updates left over, we need to keep the captured updates + // in the queue so that they are rebased and not dropped once we process the + // queue again at the lower priority. + if (finishedQueue.firstCapturedUpdate !== null) { + // Join the captured update list to the end of the normal list. + if (finishedQueue.lastUpdate !== null) { + finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate; + finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate; + } + // Clear the list of captured updates. + finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null; + } + + // Commit the effects + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} + +function commitUpdateEffects(effect, instance) { + while (effect !== null) { + var _callback3 = effect.callback; + if (_callback3 !== null) { + effect.callback = null; + callCallback(_callback3, instance); + } + effect = effect.nextEffect; + } +} + +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + +function requestCurrentSuspenseConfig() { + return ReactCurrentBatchConfig.suspense; +} + +var fakeInternalInstance = {}; +var isArray$1 = Array.isArray; + +// React.Component uses a shared frozen object by default. +// We'll use it to determine whether we need to initialize legacy refs. +var emptyRefsObject = new React.Component().refs; + +var didWarnAboutStateAssignmentForComponent = void 0; +var didWarnAboutUninitializedState = void 0; +var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0; +var didWarnAboutLegacyLifecyclesAndDerivedState = void 0; +var didWarnAboutUndefinedDerivedState = void 0; +var warnOnUndefinedDerivedState = void 0; +var warnOnInvalidCallback = void 0; +var didWarnAboutDirectlyAssigningPropsToState = void 0; +var didWarnAboutContextTypeAndContextTypes = void 0; +var didWarnAboutInvalidateContextType = void 0; + +{ + didWarnAboutStateAssignmentForComponent = new Set(); + didWarnAboutUninitializedState = new Set(); + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); + didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); + didWarnAboutDirectlyAssigningPropsToState = new Set(); + didWarnAboutUndefinedDerivedState = new Set(); + didWarnAboutContextTypeAndContextTypes = new Set(); + didWarnAboutInvalidateContextType = new Set(); + + var didWarnOnInvalidCallback = new Set(); + + warnOnInvalidCallback = function(callback, callerName) { + if (callback === null || typeof callback === "function") { + return; + } + var key = callerName + "_" + callback; + if (!didWarnOnInvalidCallback.has(key)) { + didWarnOnInvalidCallback.add(key); + warningWithoutStack$1( + false, + "%s(...): Expected the last optional `callback` argument to be a " + + "function. Instead received: %s.", + callerName, + callback + ); + } + }; + + warnOnUndefinedDerivedState = function(type, partialState) { + if (partialState === undefined) { + var componentName = getComponentName(type) || "Component"; + if (!didWarnAboutUndefinedDerivedState.has(componentName)) { + didWarnAboutUndefinedDerivedState.add(componentName); + warningWithoutStack$1( + false, + "%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. " + + "You have returned undefined.", + componentName + ); + } + } + }; + + // This is so gross but it's at least non-critical and can be removed if + // it causes problems. This is meant to give a nicer error message for + // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, + // ...)) which otherwise throws a "_processChildContext is not a function" + // exception. + Object.defineProperty(fakeInternalInstance, "_processChildContext", { + enumerable: false, + value: function() { + (function() { + { + throw ReactError( + Error( + "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + ) + ); + } + })(); + } + }); + Object.freeze(fakeInternalInstance); +} + +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + var prevState = workInProgress.memoizedState; + + { + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Invoke the function an extra time to help detect side-effects. + getDerivedStateFromProps(nextProps, prevState); + } + } + + var partialState = getDerivedStateFromProps(nextProps, prevState); + + { + warnOnUndefinedDerivedState(ctor, partialState); + } + // Merge the partial state and the previous state. + var memoizedState = + partialState === null || partialState === undefined + ? prevState + : Object.assign({}, prevState, partialState); + workInProgress.memoizedState = memoizedState; + + // Once the update queue is empty, persist the derived state onto the + // base state. + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null && workInProgress.expirationTime === NoWork) { + updateQueue.baseState = memoizedState; + } +} + +var classComponentUpdater = { + isMounted: isMounted, + enqueueSetState: function(inst, payload, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.payload = payload; + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "setState"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.tag = ReplaceState; + update.payload = payload; + + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "replaceState"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueForceUpdate: function(inst, callback) { + var fiber = get(inst); + var currentTime = requestCurrentTime(); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); + + var update = createUpdate(expirationTime, suspenseConfig); + update.tag = ForceUpdate; + + if (callback !== undefined && callback !== null) { + { + warnOnInvalidCallback(callback, "forceUpdate"); + } + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(fiber, update); + scheduleWork(fiber, expirationTime); + } +}; + +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + var instance = workInProgress.stateNode; + if (typeof instance.shouldComponentUpdate === "function") { + startPhaseTimer(workInProgress, "shouldComponentUpdate"); + var shouldUpdate = instance.shouldComponentUpdate( + newProps, + newState, + nextContext + ); + stopPhaseTimer(); + + { + !(shouldUpdate !== undefined) + ? warningWithoutStack$1( + false, + "%s.shouldComponentUpdate(): Returned undefined instead of a " + + "boolean value. Make sure to return true or false.", + getComponentName(ctor) || "Component" + ) + : void 0; + } + + return shouldUpdate; + } + + if (ctor.prototype && ctor.prototype.isPureReactComponent) { + return ( + !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + ); + } + + return true; +} + +function checkClassInstance(workInProgress, ctor, newProps) { + var instance = workInProgress.stateNode; + { + var name = getComponentName(ctor) || "Component"; + var renderPresent = instance.render; + + if (!renderPresent) { + if (ctor.prototype && typeof ctor.prototype.render === "function") { + warningWithoutStack$1( + false, + "%s(...): No `render` method found on the returned component " + + "instance: did you accidentally return an object from the constructor?", + name + ); + } else { + warningWithoutStack$1( + false, + "%s(...): No `render` method found on the returned component " + + "instance: you may have forgotten to define `render`.", + name + ); + } + } + + var noGetInitialStateOnES6 = + !instance.getInitialState || + instance.getInitialState.isReactClassApproved || + instance.state; + !noGetInitialStateOnES6 + ? warningWithoutStack$1( + false, + "getInitialState was defined on %s, a plain JavaScript class. " + + "This is only supported for classes created using React.createClass. " + + "Did you mean to define a state property instead?", + name + ) + : void 0; + var noGetDefaultPropsOnES6 = + !instance.getDefaultProps || + instance.getDefaultProps.isReactClassApproved; + !noGetDefaultPropsOnES6 + ? warningWithoutStack$1( + false, + "getDefaultProps was defined on %s, a plain JavaScript class. " + + "This is only supported for classes created using React.createClass. " + + "Use a static property to define defaultProps instead.", + name + ) + : void 0; + var noInstancePropTypes = !instance.propTypes; + !noInstancePropTypes + ? warningWithoutStack$1( + false, + "propTypes was defined as an instance property on %s. Use a static " + + "property to define propTypes instead.", + name + ) + : void 0; + var noInstanceContextType = !instance.contextType; + !noInstanceContextType + ? warningWithoutStack$1( + false, + "contextType was defined as an instance property on %s. Use a static " + + "property to define contextType instead.", + name + ) + : void 0; + + if (disableLegacyContext) { + if (ctor.childContextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy childContextTypes API which is no longer supported. " + + "Use React.createContext() instead.", + name + ); + } + if (ctor.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with static contextType instead.", + name + ); + } + } else { + var noInstanceContextTypes = !instance.contextTypes; + !noInstanceContextTypes + ? warningWithoutStack$1( + false, + "contextTypes was defined as an instance property on %s. Use a static " + + "property to define contextTypes instead.", + name + ) + : void 0; + + if ( + ctor.contextType && + ctor.contextTypes && + !didWarnAboutContextTypeAndContextTypes.has(ctor) + ) { + didWarnAboutContextTypeAndContextTypes.add(ctor); + warningWithoutStack$1( + false, + "%s declares both contextTypes and contextType static properties. " + + "The legacy contextTypes property will be ignored.", + name + ); + } + } + + var noComponentShouldUpdate = + typeof instance.componentShouldUpdate !== "function"; + !noComponentShouldUpdate + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentShouldUpdate(). Did you mean shouldComponentUpdate()? " + + "The name is phrased as a question because the function is " + + "expected to return a value.", + name + ) + : void 0; + if ( + ctor.prototype && + ctor.prototype.isPureReactComponent && + typeof instance.shouldComponentUpdate !== "undefined" + ) { + warningWithoutStack$1( + false, + "%s has a method called shouldComponentUpdate(). " + + "shouldComponentUpdate should not be used when extending React.PureComponent. " + + "Please extend React.Component if shouldComponentUpdate is used.", + getComponentName(ctor) || "A pure component" + ); + } + var noComponentDidUnmount = + typeof instance.componentDidUnmount !== "function"; + !noComponentDidUnmount + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentDidUnmount(). But there is no such lifecycle method. " + + "Did you mean componentWillUnmount()?", + name + ) + : void 0; + var noComponentDidReceiveProps = + typeof instance.componentDidReceiveProps !== "function"; + !noComponentDidReceiveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentDidReceiveProps(). But there is no such lifecycle method. " + + "If you meant to update the state in response to changing props, " + + "use componentWillReceiveProps(). If you meant to fetch data or " + + "run side-effects or mutations after React has updated the UI, use componentDidUpdate().", + name + ) + : void 0; + var noComponentWillRecieveProps = + typeof instance.componentWillRecieveProps !== "function"; + !noComponentWillRecieveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", + name + ) + : void 0; + var noUnsafeComponentWillRecieveProps = + typeof instance.UNSAFE_componentWillRecieveProps !== "function"; + !noUnsafeComponentWillRecieveProps + ? warningWithoutStack$1( + false, + "%s has a method called " + + "UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", + name + ) + : void 0; + var hasMutatedProps = instance.props !== newProps; + !(instance.props === undefined || !hasMutatedProps) + ? warningWithoutStack$1( + false, + "%s(...): When calling super() in `%s`, make sure to pass " + + "up the same props that your component's constructor was passed.", + name, + name + ) + : void 0; + var noInstanceDefaultProps = !instance.defaultProps; + !noInstanceDefaultProps + ? warningWithoutStack$1( + false, + "Setting defaultProps as an instance property on %s is not supported and will be ignored." + + " Instead, define defaultProps as a static property on %s.", + name, + name + ) + : void 0; + + if ( + typeof instance.getSnapshotBeforeUpdate === "function" && + typeof instance.componentDidUpdate !== "function" && + !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor) + ) { + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); + warningWithoutStack$1( + false, + "%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). " + + "This component defines getSnapshotBeforeUpdate() only.", + getComponentName(ctor) + ); + } + + var noInstanceGetDerivedStateFromProps = + typeof instance.getDerivedStateFromProps !== "function"; + !noInstanceGetDerivedStateFromProps + ? warningWithoutStack$1( + false, + "%s: getDerivedStateFromProps() is defined as an instance method " + + "and will be ignored. Instead, declare it as a static method.", + name + ) + : void 0; + var noInstanceGetDerivedStateFromCatch = + typeof instance.getDerivedStateFromError !== "function"; + !noInstanceGetDerivedStateFromCatch + ? warningWithoutStack$1( + false, + "%s: getDerivedStateFromError() is defined as an instance method " + + "and will be ignored. Instead, declare it as a static method.", + name + ) + : void 0; + var noStaticGetSnapshotBeforeUpdate = + typeof ctor.getSnapshotBeforeUpdate !== "function"; + !noStaticGetSnapshotBeforeUpdate + ? warningWithoutStack$1( + false, + "%s: getSnapshotBeforeUpdate() is defined as a static method " + + "and will be ignored. Instead, declare it as an instance method.", + name + ) + : void 0; + var _state = instance.state; + if (_state && (typeof _state !== "object" || isArray$1(_state))) { + warningWithoutStack$1( + false, + "%s.state: must be set to an object or null", + name + ); + } + if (typeof instance.getChildContext === "function") { + !(typeof ctor.childContextTypes === "object") + ? warningWithoutStack$1( + false, + "%s.getChildContext(): childContextTypes must be defined in order to " + + "use getChildContext().", + name + ) + : void 0; + } + } +} + +function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; + // The instance needs access to the fiber so that it can schedule updates + set(instance, workInProgress); + { + instance._reactInternalInstance = fakeInternalInstance; + } +} + +function constructClassInstance( + workInProgress, + ctor, + props, + renderExpirationTime +) { + var isLegacyContextConsumer = false; + var unmaskedContext = emptyContextObject; + var context = emptyContextObject; + var contextType = ctor.contextType; + + { + if ("contextType" in ctor) { + var isValid = + // Allow null for conditional declaration + contextType === null || + (contextType !== undefined && + contextType.$$typeof === REACT_CONTEXT_TYPE && + contextType._context === undefined); // Not a + + if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { + didWarnAboutInvalidateContextType.add(ctor); + + var addendum = ""; + if (contextType === undefined) { + addendum = + " However, it is set to undefined. " + + "This can be caused by a typo or by mixing up named and default imports. " + + "This can also happen due to a circular dependency, so " + + "try moving the createContext() call to a separate file."; + } else if (typeof contextType !== "object") { + addendum = " However, it is set to a " + typeof contextType + "."; + } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { + addendum = " Did you accidentally pass the Context.Provider instead?"; + } else if (contextType._context !== undefined) { + // + addendum = " Did you accidentally pass the Context.Consumer instead?"; + } else { + addendum = + " However, it is set to an object with keys {" + + Object.keys(contextType).join(", ") + + "}."; + } + warningWithoutStack$1( + false, + "%s defines an invalid contextType. " + + "contextType should point to the Context object returned by React.createContext().%s", + getComponentName(ctor) || "Component", + addendum + ); + } + } + } + + if (typeof contextType === "object" && contextType !== null) { + context = readContext(contextType); + } else if (!disableLegacyContext) { + unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + var contextTypes = ctor.contextTypes; + isLegacyContextConsumer = + contextTypes !== null && contextTypes !== undefined; + context = isLegacyContextConsumer + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject; + } + + // Instantiate twice to help detect side-effects. + { + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + new ctor(props, context); // eslint-disable-line no-new + } + } + + var instance = new ctor(props, context); + var state = (workInProgress.memoizedState = + instance.state !== null && instance.state !== undefined + ? instance.state + : null); + adoptClassInstance(workInProgress, instance); + + { + if (typeof ctor.getDerivedStateFromProps === "function" && state === null) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutUninitializedState.has(componentName)) { + didWarnAboutUninitializedState.add(componentName); + warningWithoutStack$1( + false, + "`%s` uses `getDerivedStateFromProps` but its initial state is " + + "%s. This is not recommended. Instead, define the initial state by " + + "assigning an object to `this.state` in the constructor of `%s`. " + + "This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", + componentName, + instance.state === null ? "null" : "undefined", + componentName + ); + } + } + + // If new component APIs are defined, "unsafe" lifecycles won't be called. + // Warn about these lifecycles if they are present. + // Don't warn about react-lifecycles-compat polyfilled methods though. + if ( + typeof ctor.getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function" + ) { + var foundWillMountName = null; + var foundWillReceivePropsName = null; + var foundWillUpdateName = null; + if ( + typeof instance.componentWillMount === "function" && + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + foundWillMountName = "componentWillMount"; + } else if (typeof instance.UNSAFE_componentWillMount === "function") { + foundWillMountName = "UNSAFE_componentWillMount"; + } + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + foundWillReceivePropsName = "componentWillReceiveProps"; + } else if ( + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps"; + } + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + foundWillUpdateName = "componentWillUpdate"; + } else if (typeof instance.UNSAFE_componentWillUpdate === "function") { + foundWillUpdateName = "UNSAFE_componentWillUpdate"; + } + if ( + foundWillMountName !== null || + foundWillReceivePropsName !== null || + foundWillUpdateName !== null + ) { + var _componentName = getComponentName(ctor) || "Component"; + var newApiName = + typeof ctor.getDerivedStateFromProps === "function" + ? "getDerivedStateFromProps()" + : "getSnapshotBeforeUpdate()"; + if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { + didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); + warningWithoutStack$1( + false, + "Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n" + + "%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n" + + "The above lifecycles should be removed. Learn more about this warning here:\n" + + "https://fb.me/react-async-component-lifecycle-hooks", + _componentName, + newApiName, + foundWillMountName !== null ? "\n " + foundWillMountName : "", + foundWillReceivePropsName !== null + ? "\n " + foundWillReceivePropsName + : "", + foundWillUpdateName !== null ? "\n " + foundWillUpdateName : "" + ); + } + } + } + } + + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // ReactFiberContext usually updates this cache but can't for newly-created instances. + if (isLegacyContextConsumer) { + cacheContext(workInProgress, unmaskedContext, context); + } + + return instance; +} + +function callComponentWillMount(workInProgress, instance) { + startPhaseTimer(workInProgress, "componentWillMount"); + var oldState = instance.state; + + if (typeof instance.componentWillMount === "function") { + instance.componentWillMount(); + } + if (typeof instance.UNSAFE_componentWillMount === "function") { + instance.UNSAFE_componentWillMount(); + } + + stopPhaseTimer(); + + if (oldState !== instance.state) { + { + warningWithoutStack$1( + false, + "%s.componentWillMount(): Assigning directly to this.state is " + + "deprecated (except inside a component's " + + "constructor). Use setState instead.", + getComponentName(workInProgress.type) || "Component" + ); + } + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } +} + +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + var oldState = instance.state; + startPhaseTimer(workInProgress, "componentWillReceiveProps"); + if (typeof instance.componentWillReceiveProps === "function") { + instance.componentWillReceiveProps(newProps, nextContext); + } + if (typeof instance.UNSAFE_componentWillReceiveProps === "function") { + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + } + stopPhaseTimer(); + + if (instance.state !== oldState) { + { + var componentName = getComponentName(workInProgress.type) || "Component"; + if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { + didWarnAboutStateAssignmentForComponent.add(componentName); + warningWithoutStack$1( + false, + "%s.componentWillReceiveProps(): Assigning directly to " + + "this.state is deprecated (except inside a component's " + + "constructor). Use setState instead.", + componentName + ); + } + } + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } +} + +// Invokes the mount life-cycles on a previously never rendered instance. +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + { + checkClassInstance(workInProgress, ctor, newProps); + } + + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + + var contextType = ctor.contextType; + if (typeof contextType === "object" && contextType !== null) { + instance.context = readContext(contextType); + } else if (disableLegacyContext) { + instance.context = emptyContextObject; + } else { + var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + instance.context = getMaskedContext(workInProgress, unmaskedContext); + } + + { + if (instance.state === newProps) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { + didWarnAboutDirectlyAssigningPropsToState.add(componentName); + warningWithoutStack$1( + false, + "%s: It is not recommended to assign props directly to state " + + "because updates to props won't be reflected in state. " + + "In most cases, it is better to use props directly.", + componentName + ); + } + } + + if (workInProgress.mode & StrictMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + instance + ); + } + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( + workInProgress, + instance + ); + } + } + + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + instance.state = workInProgress.memoizedState; + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + instance.state = workInProgress.memoizedState; + } + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + typeof ctor.getDerivedStateFromProps !== "function" && + typeof instance.getSnapshotBeforeUpdate !== "function" && + (typeof instance.UNSAFE_componentWillMount === "function" || + typeof instance.componentWillMount === "function") + ) { + callComponentWillMount(workInProgress, instance); + // If we had additional state updates during this life-cycle, let's + // process them now. + updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + instance.state = workInProgress.memoizedState; + } + } + + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } +} + +function resumeMountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + + var oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) { + nextContext = readContext(contextType); + } else if (!disableLegacyContext) { + var nextLegacyUnmaskedContext = getUnmaskedContext( + workInProgress, + ctor, + true + ); + nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = + typeof getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function"; + + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillReceiveProps === "function" || + typeof instance.componentWillReceiveProps === "function") + ) { + if (oldProps !== newProps || oldContext !== nextContext) { + callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext + ); + } + } + + resetHasForceUpdateBeforeProcessing(); + + var oldState = workInProgress.memoizedState; + var newState = (instance.state = oldState); + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + newState = workInProgress.memoizedState; + } + if ( + oldProps === newProps && + oldState === newState && + !hasContextChanged() && + !checkHasForceUpdateAfterProcessing() + ) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + return false; + } + + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + newState = workInProgress.memoizedState; + } + + var shouldUpdate = + checkHasForceUpdateAfterProcessing() || + checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext + ); + + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillMount === "function" || + typeof instance.componentWillMount === "function") + ) { + startPhaseTimer(workInProgress, "componentWillMount"); + if (typeof instance.componentWillMount === "function") { + instance.componentWillMount(); + } + if (typeof instance.UNSAFE_componentWillMount === "function") { + instance.UNSAFE_componentWillMount(); + } + stopPhaseTimer(); + } + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") { + workInProgress.effectTag |= Update; + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } + + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + + return shouldUpdate; +} + +// Invokes the update life-cycles and returns false if it shouldn't rerender. +function updateClassInstance( + current, + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + + var oldProps = workInProgress.memoizedProps; + instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps); + + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) { + nextContext = readContext(contextType); + } else if (!disableLegacyContext) { + var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); + } + + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = + typeof getDerivedStateFromProps === "function" || + typeof instance.getSnapshotBeforeUpdate === "function"; + + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillReceiveProps === "function" || + typeof instance.componentWillReceiveProps === "function") + ) { + if (oldProps !== newProps || oldContext !== nextContext) { + callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext + ); + } + } + + resetHasForceUpdateBeforeProcessing(); + + var oldState = workInProgress.memoizedState; + var newState = (instance.state = oldState); + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + processUpdateQueue( + workInProgress, + updateQueue, + newProps, + instance, + renderExpirationTime + ); + newState = workInProgress.memoizedState; + } + + if ( + oldProps === newProps && + oldState === newState && + !hasContextChanged() && + !checkHasForceUpdateAfterProcessing() + ) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Update; + } + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Snapshot; + } + } + return false; + } + + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + newProps + ); + newState = workInProgress.memoizedState; + } + + var shouldUpdate = + checkHasForceUpdateAfterProcessing() || + checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext + ); + + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if ( + !hasNewLifecycles && + (typeof instance.UNSAFE_componentWillUpdate === "function" || + typeof instance.componentWillUpdate === "function") + ) { + startPhaseTimer(workInProgress, "componentWillUpdate"); + if (typeof instance.componentWillUpdate === "function") { + instance.componentWillUpdate(newProps, newState, nextContext); + } + if (typeof instance.UNSAFE_componentWillUpdate === "function") { + instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); + } + stopPhaseTimer(); + } + if (typeof instance.componentDidUpdate === "function") { + workInProgress.effectTag |= Update; + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + workInProgress.effectTag |= Snapshot; + } + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Update; + } + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if ( + oldProps !== current.memoizedProps || + oldState !== current.memoizedState + ) { + workInProgress.effectTag |= Snapshot; + } + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized props/state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } + + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + + return shouldUpdate; +} + +var didWarnAboutMaps = void 0; +var didWarnAboutGenerators = void 0; +var didWarnAboutStringRefs = void 0; +var ownerHasKeyUseWarning = void 0; +var ownerHasFunctionTypeWarning = void 0; +var warnForMissingKey = function(child) {}; + +{ + didWarnAboutMaps = false; + didWarnAboutGenerators = false; + didWarnAboutStringRefs = {}; + + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + ownerHasKeyUseWarning = {}; + ownerHasFunctionTypeWarning = {}; + + warnForMissingKey = function(child) { + if (child === null || typeof child !== "object") { + return; + } + if (!child._store || child._store.validated || child.key != null) { + return; + } + (function() { + if (!(typeof child._store === "object")) { + throw ReactError( + Error( + "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + child._store.validated = true; + + var currentComponentErrorInfo = + "Each child in a list should have a unique " + + '"key" prop. See https://fb.me/react-warning-keys for ' + + "more information." + + getCurrentFiberStackInDev(); + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; + + warning$1( + false, + "Each child in a list should have a unique " + + '"key" prop. See https://fb.me/react-warning-keys for ' + + "more information." + ); + }; +} + +var isArray = Array.isArray; + +function coerceRef(returnFiber, current$$1, element) { + var mixedRef = element.ref; + if ( + mixedRef !== null && + typeof mixedRef !== "function" && + typeof mixedRef !== "object" + ) { + { + // TODO: Clean this up once we turn on the string ref warning for + // everyone, because the strict mode case will no longer be relevant + if (returnFiber.mode & StrictMode || warnAboutStringRefs) { + var componentName = getComponentName(returnFiber.type) || "Component"; + if (!didWarnAboutStringRefs[componentName]) { + if (warnAboutStringRefs) { + warningWithoutStack$1( + false, + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + componentName, + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } else { + warningWithoutStack$1( + false, + 'A string ref, "%s", has been found within a strict mode tree. ' + + "String refs are a source of potential bugs and should be avoided. " + + "We recommend using useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } + didWarnAboutStringRefs[componentName] = true; + } + } + } + + if (element._owner) { + var owner = element._owner; + var inst = void 0; + if (owner) { + var ownerFiber = owner; + (function() { + if (!(ownerFiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + } + })(); + inst = ownerFiber.stateNode; + } + (function() { + if (!inst) { + throw ReactError( + Error( + "Missing owner for string ref " + + mixedRef + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var stringRef = "" + mixedRef; + // Check if previous string ref matches new string ref + if ( + current$$1 !== null && + current$$1.ref !== null && + typeof current$$1.ref === "function" && + current$$1.ref._stringRef === stringRef + ) { + return current$$1.ref; + } + var ref = function(value) { + var refs = inst.refs; + if (refs === emptyRefsObject) { + // This is a lazy pooled frozen object, so we need to initialize. + refs = inst.refs = {}; + } + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + }; + ref._stringRef = stringRef; + return ref; + } else { + (function() { + if (!(typeof mixedRef === "string")) { + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + } + })(); + (function() { + if (!element._owner) { + throw ReactError( + Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + })(); + } + } + return mixedRef; +} + +function throwOnInvalidObjectType(returnFiber, newChild) { + if (returnFiber.type !== "textarea") { + var addendum = ""; + { + addendum = + " If you meant to render a collection of children, use an array " + + "instead." + + getCurrentFiberStackInDev(); + } + (function() { + { + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + (Object.prototype.toString.call(newChild) === "[object Object]" + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + + addendum + ) + ); + } + })(); + } +} + +function warnOnFunctionType() { + var currentComponentErrorInfo = + "Functions are not valid as a React child. This may happen if " + + "you return a Component instead of from render. " + + "Or maybe you meant to call this function rather than return it." + + getCurrentFiberStackInDev(); + + if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) { + return; + } + ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true; + + warning$1( + false, + "Functions are not valid as a React child. This may happen if " + + "you return a Component instead of from render. " + + "Or maybe you meant to call this function rather than return it." + ); +} + +// This wrapper function exists because I expect to clone the code in each path +// to be able to optimize each path individually by branching early. This needs +// a compiler or we can do it manually. Helpers that don't need this branching +// live outside of this function. +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (!shouldTrackSideEffects) { + // Noop. + return; + } + // Deletions are added in reversed order so we add it to the front. + // At this point, the return fiber's effect list is empty except for + // deletions, so we can just append the deletion to the list. The remaining + // effects aren't added until the complete phase. Once we implement + // resuming, this may not be true. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + } + childToDelete.nextEffect = null; + childToDelete.effectTag = Deletion; + } + + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) { + // Noop. + return null; + } + + // TODO: For the shouldClone case, this could be micro-optimized a bit by + // assuming that after the first child we've already added everything. + var childToDelete = currentFirstChild; + while (childToDelete !== null) { + deleteChild(returnFiber, childToDelete); + childToDelete = childToDelete.sibling; + } + return null; + } + + function mapRemainingChildren(returnFiber, currentFirstChild) { + // Add the remaining children to a temporary map so that we can find them by + // keys quickly. Implicit (null) keys get added to this set with their index + var existingChildren = new Map(); + + var existingChild = currentFirstChild; + while (existingChild !== null) { + if (existingChild.key !== null) { + existingChildren.set(existingChild.key, existingChild); + } else { + existingChildren.set(existingChild.index, existingChild); + } + existingChild = existingChild.sibling; + } + return existingChildren; + } + + function useFiber(fiber, pendingProps, expirationTime) { + // We currently set sibling to null and index to 0 here because it is easy + // to forget to do before returning it. E.g. for the single child case. + var clone = createWorkInProgress(fiber, pendingProps, expirationTime); + clone.index = 0; + clone.sibling = null; + return clone; + } + + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) { + // Noop. + return lastPlacedIndex; + } + var current$$1 = newFiber.alternate; + if (current$$1 !== null) { + var oldIndex = current$$1.index; + if (oldIndex < lastPlacedIndex) { + // This is a move. + newFiber.effectTag = Placement; + return lastPlacedIndex; + } else { + // This item can stay in place. + return oldIndex; + } + } else { + // This is an insertion. + newFiber.effectTag = Placement; + return lastPlacedIndex; + } + } + + function placeSingleChild(newFiber) { + // This is simpler for the single child case. We only need to do a + // placement for inserting new children. + if (shouldTrackSideEffects && newFiber.alternate === null) { + newFiber.effectTag = Placement; + } + return newFiber; + } + + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (current$$1 === null || current$$1.tag !== HostText) { + // Insert + var created = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current$$1, textContent, expirationTime); + existing.return = returnFiber; + return existing; + } + } + + function updateElement(returnFiber, current$$1, element, expirationTime) { + if ( + current$$1 !== null && + (current$$1.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(current$$1, element)) + ) { + // Move based on index + var existing = useFiber(current$$1, element.props, expirationTime); + existing.ref = coerceRef(returnFiber, current$$1, element); + existing.return = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; + } + return existing; + } else { + // Insert + var created = createFiberFromElement( + element, + returnFiber.mode, + expirationTime + ); + created.ref = coerceRef(returnFiber, current$$1, element); + created.return = returnFiber; + return created; + } + } + + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + current$$1 === null || + current$$1.tag !== HostPortal || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) { + // Insert + var created = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber( + current$$1, + portal.children || [], + expirationTime + ); + existing.return = returnFiber; + return existing; + } + } + + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (current$$1 === null || current$$1.tag !== Fragment) { + // Insert + var created = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + ); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current$$1, fragment, expirationTime); + existing.return = returnFiber; + return existing; + } + } + + function createChild(returnFiber, newChild, expirationTime) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + var created = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + var _created = createFiberFromElement( + newChild, + returnFiber.mode, + expirationTime + ); + _created.ref = coerceRef(returnFiber, null, newChild); + _created.return = returnFiber; + return _created; + } + case REACT_PORTAL_TYPE: { + var _created2 = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + _created2.return = returnFiber; + return _created2; + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + var _created3 = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + ); + _created3.return = returnFiber; + return _created3; + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + // Update the fiber if the keys match, otherwise return null. + + var key = oldFiber !== null ? oldFiber.key : null; + + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + if (key !== null) { + return null; + } + return updateTextNode( + returnFiber, + oldFiber, + "" + newChild, + expirationTime + ); + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + if (newChild.key === key) { + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ); + } + return updateElement( + returnFiber, + oldFiber, + newChild, + expirationTime + ); + } else { + return null; + } + } + case REACT_PORTAL_TYPE: { + if (newChild.key === key) { + return updatePortal( + returnFiber, + oldFiber, + newChild, + expirationTime + ); + } else { + return null; + } + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + if (key !== null) { + return null; + } + + return updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys, so we neither have to check the old nor + // new node for the key. If both are text nodes, they match. + var matchedFiber = existingChildren.get(newIdx) || null; + return updateTextNode( + returnFiber, + matchedFiber, + "" + newChild, + expirationTime + ); + } + + if (typeof newChild === "object" && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: { + var _matchedFiber = + existingChildren.get( + newChild.key === null ? newIdx : newChild.key + ) || null; + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment( + returnFiber, + _matchedFiber, + newChild.props.children, + expirationTime, + newChild.key + ); + } + return updateElement( + returnFiber, + _matchedFiber, + newChild, + expirationTime + ); + } + case REACT_PORTAL_TYPE: { + var _matchedFiber2 = + existingChildren.get( + newChild.key === null ? newIdx : newChild.key + ) || null; + return updatePortal( + returnFiber, + _matchedFiber2, + newChild, + expirationTime + ); + } + } + + if (isArray(newChild) || getIteratorFn(newChild)) { + var _matchedFiber3 = existingChildren.get(newIdx) || null; + return updateFragment( + returnFiber, + _matchedFiber3, + newChild, + expirationTime, + null + ); + } + + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + + return null; + } + + /** + * Warns if there is a duplicate or missing key + */ + function warnOnInvalidKey(child, knownKeys) { + { + if (typeof child !== "object" || child === null) { + return knownKeys; + } + switch (child.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + warnForMissingKey(child); + var key = child.key; + if (typeof key !== "string") { + break; + } + if (knownKeys === null) { + knownKeys = new Set(); + knownKeys.add(key); + break; + } + if (!knownKeys.has(key)) { + knownKeys.add(key); + break; + } + warning$1( + false, + "Encountered two children with the same key, `%s`. " + + "Keys should be unique so that components maintain their identity " + + "across updates. Non-unique keys may cause children to be " + + "duplicated and/or omitted — the behavior is unsupported and " + + "could change in a future version.", + key + ); + break; + default: + break; + } + } + return knownKeys; + } + + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + // This algorithm can't optimize by searching from both ends since we + // don't have backpointers on fibers. I'm trying to see how far we can get + // with that model. If it ends up not being worth the tradeoffs, we can + // add it later. + + // Even with a two ended optimization, we'd want to optimize for the case + // where there are few changes and brute force the comparison instead of + // going for the Map. It'd like to explore hitting that path first in + // forward-only mode and only go for the Map once we notice that we need + // lots of look ahead. This doesn't handle reversal as well as two ended + // search but that's unusual. Besides, for the two ended optimization to + // work on Iterables, we'd need to copy the whole set. + + // In this first iteration, we'll just live with hitting the bad case + // (adding everything to a Map) in for every insert/move. + + // If you change this code, also update reconcileChildrenIterator() which + // uses the same algorithm. + + { + // First, validate keys. + var knownKeys = null; + for (var i = 0; i < newChildren.length; i++) { + var child = newChildren[i]; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } + + var resultingFirstChild = null; + var previousNewFiber = null; + + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; + } + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) { + oldFiber = nextOldFiber; + } + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + + if (newIdx === newChildren.length) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + ); + if (_newFiber === null) { + continue; + } + lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber; + } else { + previousNewFiber.sibling = _newFiber; + } + previousNewFiber = _newFiber; + } + return resultingFirstChild; + } + + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); + + // Keep scanning and use the map to restore deleted items as moves. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber2 = updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + ); + if (_newFiber2 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber2.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete( + _newFiber2.key === null ? newIdx : _newFiber2.key + ); + } + } + lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber2; + } else { + previousNewFiber.sibling = _newFiber2; + } + previousNewFiber = _newFiber2; + } + } + + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + } + + return resultingFirstChild; + } + + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + // This is the same implementation as reconcileChildrenArray(), + // but using the iterator instead. + + var iteratorFn = getIteratorFn(newChildrenIterable); + (function() { + if (!(typeof iteratorFn === "function")) { + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + { + // We don't support rendering Generators because it's a mutation. + // See https://github.com/facebook/react/issues/12995 + if ( + typeof Symbol === "function" && + // $FlowFixMe Flow doesn't know about toStringTag + newChildrenIterable[Symbol.toStringTag] === "Generator" + ) { + !didWarnAboutGenerators + ? warning$1( + false, + "Using Generators as children is unsupported and will likely yield " + + "unexpected results because enumerating a generator mutates it. " + + "You may convert it to an array with `Array.from()` or the " + + "`[...spread]` operator before rendering. Keep in mind " + + "you might need to polyfill these features for older browsers." + ) + : void 0; + didWarnAboutGenerators = true; + } + + // Warn about using Maps as children + if (newChildrenIterable.entries === iteratorFn) { + !didWarnAboutMaps + ? warning$1( + false, + "Using Maps as children is unsupported and will likely yield " + + "unexpected results. Convert it to a sequence/iterable of keyed " + + "ReactElements instead." + ) + : void 0; + didWarnAboutMaps = true; + } + + // First, validate keys. + // We'll get a different iterator later for the main pass. + var _newChildren = iteratorFn.call(newChildrenIterable); + if (_newChildren) { + var knownKeys = null; + var _step = _newChildren.next(); + for (; !_step.done; _step = _newChildren.next()) { + var child = _step.value; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } + } + + var newChildren = iteratorFn.call(newChildrenIterable); + (function() { + if (!(newChildren != null)) { + throw ReactError(Error("An iterable object provided no iterator.")); + } + })(); + + var resultingFirstChild = null; + var previousNewFiber = null; + + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + + var step = newChildren.next(); + for ( + ; + oldFiber !== null && !step.done; + newIdx++, step = newChildren.next() + ) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; + } + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) { + oldFiber = nextOldFiber; + } + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + + if (step.done) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber3 = createChild(returnFiber, step.value, expirationTime); + if (_newFiber3 === null) { + continue; + } + lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber3; + } else { + previousNewFiber.sibling = _newFiber3; + } + previousNewFiber = _newFiber3; + } + return resultingFirstChild; + } + + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); + + // Keep scanning and use the map to restore deleted items as moves. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber4 = updateFromMap( + existingChildren, + returnFiber, + newIdx, + step.value, + expirationTime + ); + if (_newFiber4 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber4.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete( + _newFiber4.key === null ? newIdx : _newFiber4.key + ); + } + } + lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber4; + } else { + previousNewFiber.sibling = _newFiber4; + } + previousNewFiber = _newFiber4; + } + } + + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + } + + return resultingFirstChild; + } + + function reconcileSingleTextNode( + returnFiber, + currentFirstChild, + textContent, + expirationTime + ) { + // There's no need to check for keys on text nodes since we don't have a + // way to define them. + if (currentFirstChild !== null && currentFirstChild.tag === HostText) { + // We already have an existing node so let's just update it and delete + // the rest. + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + var existing = useFiber(currentFirstChild, textContent, expirationTime); + existing.return = returnFiber; + return existing; + } + // The existing first child is not a text node so we need to create one + // and delete the existing ones. + deleteRemainingChildren(returnFiber, currentFirstChild); + var created = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + function reconcileSingleElement( + returnFiber, + currentFirstChild, + element, + expirationTime + ) { + var key = element.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if ( + child.tag === Fragment + ? element.type === REACT_FRAGMENT_TYPE + : child.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(child, element) + ) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber( + child, + element.type === REACT_FRAGMENT_TYPE + ? element.props.children + : element.props, + expirationTime + ); + existing.ref = coerceRef(returnFiber, child, element); + existing.return = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; + } + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else { + deleteChild(returnFiber, child); + } + child = child.sibling; + } + + if (element.type === REACT_FRAGMENT_TYPE) { + var created = createFiberFromFragment( + element.props.children, + returnFiber.mode, + expirationTime, + element.key + ); + created.return = returnFiber; + return created; + } else { + var _created4 = createFiberFromElement( + element, + returnFiber.mode, + expirationTime + ); + _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + _created4.return = returnFiber; + return _created4; + } + } + + function reconcileSinglePortal( + returnFiber, + currentFirstChild, + portal, + expirationTime + ) { + var key = portal.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if ( + child.tag === HostPortal && + child.stateNode.containerInfo === portal.containerInfo && + child.stateNode.implementation === portal.implementation + ) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, portal.children || [], expirationTime); + existing.return = returnFiber; + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else { + deleteChild(returnFiber, child); + } + child = child.sibling; + } + + var created = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + ); + created.return = returnFiber; + return created; + } + + // This API will tag the children with the side-effect of the reconciliation + // itself. They will be added to the side-effect list as we pass through the + // children and the parent. + function reconcileChildFibers( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) { + // This function is not recursive. + // If the top level item is an array, we treat it as a set of children, + // not as a fragment. Nested arrays on the other hand will be treated as + // fragment nodes. Recursion happens at the normal flow. + + // Handle top level unkeyed fragments as if they were arrays. + // This leads to an ambiguity between <>{[...]} and <>.... + // We treat the ambiguous cases above the same. + var isUnkeyedTopLevelFragment = + typeof newChild === "object" && + newChild !== null && + newChild.type === REACT_FRAGMENT_TYPE && + newChild.key === null; + if (isUnkeyedTopLevelFragment) { + newChild = newChild.props.children; + } + + // Handle object types + var isObject = typeof newChild === "object" && newChild !== null; + + if (isObject) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return placeSingleChild( + reconcileSingleElement( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return placeSingleChild( + reconcileSinglePortal( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ) + ); + } + } + + if (typeof newChild === "string" || typeof newChild === "number") { + return placeSingleChild( + reconcileSingleTextNode( + returnFiber, + currentFirstChild, + "" + newChild, + expirationTime + ) + ); + } + + if (isArray(newChild)) { + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + } + + if (getIteratorFn(newChild)) { + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + } + + if (isObject) { + throwOnInvalidObjectType(returnFiber, newChild); + } + + { + if (typeof newChild === "function") { + warnOnFunctionType(); + } + } + if (typeof newChild === "undefined" && !isUnkeyedTopLevelFragment) { + // If the new child is undefined, and the return fiber is a composite + // component, throw an error. If Fiber return types are disabled, + // we already threw above. + switch (returnFiber.tag) { + case ClassComponent: { + { + var instance = returnFiber.stateNode; + if (instance.render._isMockFunction) { + // We allow auto-mocks to proceed as if they're returning null. + break; + } + } + } + // Intentionally fall through to the next case, which handles both + // functions and classes + // eslint-disable-next-lined no-fallthrough + case FunctionComponent: { + var Component = returnFiber.type; + (function() { + { + throw ReactError( + Error( + (Component.displayName || Component.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + ); + } + })(); + } + } + } + + // Remaining cases are all treated as empty. + return deleteRemainingChildren(returnFiber, currentFirstChild); + } + + return reconcileChildFibers; +} + +var reconcileChildFibers = ChildReconciler(true); +var mountChildFibers = ChildReconciler(false); + +function cloneChildFibers(current$$1, workInProgress) { + (function() { + if (!(current$$1 === null || workInProgress.child === current$$1.child)) { + throw ReactError(Error("Resuming work not yet implemented.")); + } + })(); + + if (workInProgress.child === null) { + return; + } + + var currentChild = workInProgress.child; + var newChild = createWorkInProgress( + currentChild, + currentChild.pendingProps, + currentChild.expirationTime + ); + workInProgress.child = newChild; + + newChild.return = workInProgress; + while (currentChild.sibling !== null) { + currentChild = currentChild.sibling; + newChild = newChild.sibling = createWorkInProgress( + currentChild, + currentChild.pendingProps, + currentChild.expirationTime + ); + newChild.return = workInProgress; + } + newChild.sibling = null; +} + +// Reset a workInProgress child set to prepare it for a second pass. +function resetChildFibers(workInProgress, renderExpirationTime) { + var child = workInProgress.child; + while (child !== null) { + resetWorkInProgress(child, renderExpirationTime); + child = child.sibling; + } +} + +var NO_CONTEXT = {}; + +var contextStackCursor$1 = createCursor(NO_CONTEXT); +var contextFiberStackCursor = createCursor(NO_CONTEXT); +var rootInstanceStackCursor = createCursor(NO_CONTEXT); + +function requiredContext(c) { + (function() { + if (!(c !== NO_CONTEXT)) { + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + return c; +} + +function getRootHostContainer() { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + return rootInstance; +} + +function pushHostContainer(fiber, nextRootInstance) { + // Push current root instance onto the stack; + // This allows us to reset root when portals are popped. + push(rootInstanceStackCursor, nextRootInstance, fiber); + // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); + + // Finally, we need to push the host context to the stack. + // However, we can't just call getRootHostContext() and push it because + // we'd have a different number of entries on the stack depending on + // whether getRootHostContext() throws somewhere in renderer code or not. + // So we push an empty value first. This lets us safely unwind on errors. + push(contextStackCursor$1, NO_CONTEXT, fiber); + var nextRootContext = getRootHostContext(nextRootInstance); + // Now that we know this function doesn't throw, replace it. + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, nextRootContext, fiber); +} + +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} + +function getHostContext() { + var context = requiredContext(contextStackCursor$1.current); + return context; +} + +function pushHostContext(fiber) { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = getChildHostContext(context, fiber.type, rootInstance); + + // Don't push this Fiber's context unless it's unique. + if (context === nextContext) { + return; + } + + // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, nextContext, fiber); +} + +function popHostContext(fiber) { + // Do not pop unless this Fiber provided the current context. + // pushHostContext() only pushes Fibers that provide unique contexts. + if (contextFiberStackCursor.current !== fiber) { + return; + } + + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); +} + +var DefaultSuspenseContext = 0; + +// The Suspense Context is split into two parts. The lower bits is +// inherited deeply down the subtree. The upper bits only affect +// this immediate suspense boundary and gets reset each new +// boundary or suspense list. +var SubtreeSuspenseContextMask = 1; + +// Subtree Flags: + +// InvisibleParentSuspenseContext indicates that one of our parent Suspense +// boundaries is not currently showing visible main content. +// Either because it is already showing a fallback or is not mounted at all. +// We can use this to determine if it is desirable to trigger a fallback at +// the parent. If not, then we might need to trigger undesirable boundaries +// and/or suspend the commit to avoid hiding the parent content. +var InvisibleParentSuspenseContext = 1; + +// Shallow Flags: + +// ForceSuspenseFallback can be used by SuspenseList to force newly added +// items into their fallback state during one of the render passes. +var ForceSuspenseFallback = 2; + +var suspenseStackCursor = createCursor(DefaultSuspenseContext); + +function hasSuspenseContext(parentContext, flag) { + return (parentContext & flag) !== 0; +} + +function setDefaultShallowSuspenseContext(parentContext) { + return parentContext & SubtreeSuspenseContextMask; +} + +function setShallowSuspenseContext(parentContext, shallowContext) { + return (parentContext & SubtreeSuspenseContextMask) | shallowContext; +} + +function addSubtreeSuspenseContext(parentContext, subtreeContext) { + return parentContext | subtreeContext; +} + +function pushSuspenseContext(fiber, newContext) { + push(suspenseStackCursor, newContext, fiber); +} + +function popSuspenseContext(fiber) { + pop(suspenseStackCursor, fiber); +} + +// TODO: This is now an empty object. Should we switch this to a boolean? +// Alternatively we can make this use an effect tag similar to SuspenseList. + +function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { + // If it was the primary children that just suspended, capture and render the + var nextState = workInProgress.memoizedState; + if (nextState !== null) { + return false; + } + var props = workInProgress.memoizedProps; + // In order to capture, the Suspense component must have a fallback prop. + if (props.fallback === undefined) { + return false; + } + // Regular boundaries always capture. + if (props.unstable_avoidThisFallback !== true) { + return true; + } + // If it's a boundary we should avoid, then we prefer to bubble up to the + // parent boundary if it is currently invisible. + if (hasInvisibleParent) { + return false; + } + // If the parent is not able to handle it, we must handle it. + return true; +} + +function findFirstSuspended(row) { + var node = row; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + return node; + } + } else if ( + node.tag === SuspenseListComponent && + // revealOrder undefined can't be trusted because it don't + // keep track of whether it suspended or not. + node.memoizedProps.revealOrder !== undefined + ) { + var didSuspend = (node.effectTag & DidCapture) !== NoEffect; + if (didSuspend) { + return node; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) { + return null; + } + while (node.sibling === null) { + if (node.return === null || node.return === row) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} + +function createResponderListener(responder, props) { + var eventResponderListener = { + responder: responder, + props: props + }; + { + Object.freeze(eventResponderListener); + } + return eventResponderListener; +} + +function createResponderInstance( + responder, + responderProps, + responderState, + target, + fiber +) { + return { + fiber: fiber, + props: responderProps, + responder: responder, + rootEventTypes: null, + state: responderState, + target: target + }; +} + +var NoEffect$1 = /* */ 0; +var UnmountSnapshot = /* */ 2; +var UnmountMutation = /* */ 4; +var MountMutation = /* */ 8; +var UnmountLayout = /* */ 16; +var MountLayout = /* */ 32; +var MountPassive = /* */ 64; +var UnmountPassive = /* */ 128; + +var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; + +var didWarnAboutMismatchedHooksForComponent = void 0; +{ + didWarnAboutMismatchedHooksForComponent = new Set(); +} + +// These are set right before calling the component. +var renderExpirationTime$1 = NoWork; +// The work-in-progress fiber. I've named it differently to distinguish it from +// the work-in-progress hook. +var currentlyRenderingFiber$1 = null; + +// Hooks are stored as a linked list on the fiber's memoizedState field. The +// current hook list is the list that belongs to the current fiber. The +// work-in-progress hook list is a new list that will be added to the +// work-in-progress fiber. +var currentHook = null; +var nextCurrentHook = null; +var firstWorkInProgressHook = null; +var workInProgressHook = null; +var nextWorkInProgressHook = null; + +var remainingExpirationTime = NoWork; +var componentUpdateQueue = null; +var sideEffectTag = 0; + +// Updates scheduled during render will trigger an immediate re-render at the +// end of the current pass. We can't store these updates on the normal queue, +// because if the work is aborted, they should be discarded. Because this is +// a relatively rare case, we also don't want to add an additional field to +// either the hook or queue object types. So we store them in a lazily create +// map of queue -> render-phase updates, which are discarded once the component +// completes without re-rendering. + +// Whether an update was scheduled during the currently executing render pass. +var didScheduleRenderPhaseUpdate = false; +// Lazily created map of render-phase updates +var renderPhaseUpdates = null; +// Counter to prevent infinite loops. +var numberOfReRenders = 0; +var RE_RENDER_LIMIT = 25; + +// In DEV, this is the name of the currently executing primitive hook +var currentHookNameInDev = null; + +// In DEV, this list ensures that hooks are called in the same order between renders. +// The list stores the order of hooks used during the initial render (mount). +// Subsequent renders (updates) reference this list. +var hookTypesDev = null; +var hookTypesUpdateIndexDev = -1; + +// In DEV, this tracks whether currently rendering component needs to ignore +// the dependencies for Hooks that need them (e.g. useEffect or useMemo). +// When true, such Hooks will always be "remounted". Only used during hot reload. +var ignorePreviousDependencies = false; + +function mountHookTypesDev() { + { + var hookName = currentHookNameInDev; + + if (hookTypesDev === null) { + hookTypesDev = [hookName]; + } else { + hookTypesDev.push(hookName); + } + } +} + +function updateHookTypesDev() { + { + var hookName = currentHookNameInDev; + + if (hookTypesDev !== null) { + hookTypesUpdateIndexDev++; + if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { + warnOnHookMismatchInDev(hookName); + } + } + } +} + +function checkDepsAreArrayDev(deps) { + { + if (deps !== undefined && deps !== null && !Array.isArray(deps)) { + // Verify deps, but only on mount to avoid extra checks. + // It's unlikely their type would change as usually you define them inline. + warning$1( + false, + "%s received a final argument that is not an array (instead, received `%s`). When " + + "specified, the final argument must be an array.", + currentHookNameInDev, + typeof deps + ); + } + } +} + +function warnOnHookMismatchInDev(currentHookName) { + { + var componentName = getComponentName(currentlyRenderingFiber$1.type); + if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { + didWarnAboutMismatchedHooksForComponent.add(componentName); + + if (hookTypesDev !== null) { + var table = ""; + + var secondColumnStart = 30; + + for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { + var oldHookName = hookTypesDev[i]; + var newHookName = + i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; + + var row = i + 1 + ". " + oldHookName; + + // Extra space so second column lines up + // lol @ IE not supporting String#repeat + while (row.length < secondColumnStart) { + row += " "; + } + + row += newHookName + "\n"; + + table += row; + } + + warning$1( + false, + "React has detected a change in the order of Hooks called by %s. " + + "This will lead to bugs and errors if not fixed. " + + "For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n" + + " Previous render Next render\n" + + " ------------------------------------------------------\n" + + "%s" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + componentName, + table + ); + } + } + } +} + +function throwInvalidHookError() { + (function() { + { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); + } + })(); +} + +function areHookInputsEqual(nextDeps, prevDeps) { + { + if (ignorePreviousDependencies) { + // Only true when this component is being hot reloaded. + return false; + } + } + + if (prevDeps === null) { + { + warning$1( + false, + "%s received a final argument during this render, but not during " + + "the previous render. Even though the final argument is optional, " + + "its type cannot change between renders.", + currentHookNameInDev + ); + } + return false; + } + + { + // Don't bother comparing lengths in prod because these arrays should be + // passed inline. + if (nextDeps.length !== prevDeps.length) { + warning$1( + false, + "The final argument passed to %s changed size between renders. The " + + "order and size of this array must remain constant.\n\n" + + "Previous: %s\n" + + "Incoming: %s", + currentHookNameInDev, + "[" + prevDeps.join(", ") + "]", + "[" + nextDeps.join(", ") + "]" + ); + } + } + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { + if (is(nextDeps[i], prevDeps[i])) { + continue; + } + return false; + } + return true; +} + +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = current !== null ? current.memoizedState : null; + + { + hookTypesDev = current !== null ? current._debugHookTypes : null; + hookTypesUpdateIndexDev = -1; + // Used for hot reloading: + ignorePreviousDependencies = + current !== null && current.type !== workInProgress.type; + } + + // The following should have already been reset + // currentHook = null; + // workInProgressHook = null; + + // remainingExpirationTime = NoWork; + // componentUpdateQueue = null; + + // didScheduleRenderPhaseUpdate = false; + // renderPhaseUpdates = null; + // numberOfReRenders = 0; + // sideEffectTag = 0; + + // TODO Warn if no hooks are used at all during mount, then some are used during update. + // Currently we will identify the update render as a mount because nextCurrentHook === null. + // This is tricky because it's valid for certain types of components (e.g. React.lazy) + + // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used. + // Non-stateful hooks (e.g. context) don't get added to memoizedState, + // so nextCurrentHook would be null during updates and mounts. + { + if (nextCurrentHook !== null) { + ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + } else if (hookTypesDev !== null) { + // This dispatcher handles an edge case where a component is updating, + // but no stateful hooks have been used. + // We want to match the production code behavior (which will use HooksDispatcherOnMount), + // but with the extra DEV validation to ensure hooks ordering hasn't changed. + // This dispatcher does that. + ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; + } else { + ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + } + } + + var children = Component(props, refOrContext); + + if (didScheduleRenderPhaseUpdate) { + do { + didScheduleRenderPhaseUpdate = false; + numberOfReRenders += 1; + { + // Even when hot reloading, allow dependencies to stabilize + // after first render to prevent infinite render phase updates. + ignorePreviousDependencies = false; + } + + // Start over from the beginning of the list + nextCurrentHook = current !== null ? current.memoizedState : null; + nextWorkInProgressHook = firstWorkInProgressHook; + + currentHook = null; + workInProgressHook = null; + componentUpdateQueue = null; + + { + // Also validate hook order for cascading updates. + hookTypesUpdateIndexDev = -1; + } + + ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + + children = Component(props, refOrContext); + } while (didScheduleRenderPhaseUpdate); + + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + + // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + + var renderedWork = currentlyRenderingFiber$1; + + renderedWork.memoizedState = firstWorkInProgressHook; + renderedWork.expirationTime = remainingExpirationTime; + renderedWork.updateQueue = componentUpdateQueue; + renderedWork.effectTag |= sideEffectTag; + + { + renderedWork._debugHookTypes = hookTypesDev; + } + + // This check uses currentHook so that it works the same in DEV and prod bundles. + // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. + var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; + + renderExpirationTime$1 = NoWork; + currentlyRenderingFiber$1 = null; + + currentHook = null; + nextCurrentHook = null; + firstWorkInProgressHook = null; + workInProgressHook = null; + nextWorkInProgressHook = null; + + { + currentHookNameInDev = null; + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + } + + remainingExpirationTime = NoWork; + componentUpdateQueue = null; + sideEffectTag = 0; + + // These were reset above + // didScheduleRenderPhaseUpdate = false; + // renderPhaseUpdates = null; + // numberOfReRenders = 0; + + (function() { + if (!!didRenderTooFewHooks) { + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + } + })(); + + return children; +} + +function bailoutHooks(current, workInProgress, expirationTime) { + workInProgress.updateQueue = current.updateQueue; + workInProgress.effectTag &= ~(Passive | Update); + if (current.expirationTime <= expirationTime) { + current.expirationTime = NoWork; + } +} + +function resetHooks() { + // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + + // This is used to reset the state of this module when a component throws. + // It's also called inside mountIndeterminateComponent if we determine the + // component is a module-style component. + renderExpirationTime$1 = NoWork; + currentlyRenderingFiber$1 = null; + + currentHook = null; + nextCurrentHook = null; + firstWorkInProgressHook = null; + workInProgressHook = null; + nextWorkInProgressHook = null; + + { + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + + currentHookNameInDev = null; + } + + remainingExpirationTime = NoWork; + componentUpdateQueue = null; + sideEffectTag = 0; + + didScheduleRenderPhaseUpdate = false; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} + +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + + baseState: null, + queue: null, + baseUpdate: null, + + next: null + }; + + if (workInProgressHook === null) { + // This is the first hook in the list + firstWorkInProgressHook = workInProgressHook = hook; + } else { + // Append to the end of the list + workInProgressHook = workInProgressHook.next = hook; + } + return workInProgressHook; +} + +function updateWorkInProgressHook() { + // This function is used both for updates and for re-renders triggered by a + // render phase update. It assumes there is either a current hook we can + // clone, or a work-in-progress hook from a previous render pass that we can + // use as a base. When we reach the end of the base list, we must switch to + // the dispatcher used for mounts. + if (nextWorkInProgressHook !== null) { + // There's already a work-in-progress. Reuse it. + workInProgressHook = nextWorkInProgressHook; + nextWorkInProgressHook = workInProgressHook.next; + + currentHook = nextCurrentHook; + nextCurrentHook = currentHook !== null ? currentHook.next : null; + } else { + // Clone from the current hook. + (function() { + if (!(nextCurrentHook !== null)) { + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + } + })(); + currentHook = nextCurrentHook; + + var newHook = { + memoizedState: currentHook.memoizedState, + + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + + next: null + }; + + if (workInProgressHook === null) { + // This is the first hook in the list. + workInProgressHook = firstWorkInProgressHook = newHook; + } else { + // Append to the end of the list. + workInProgressHook = workInProgressHook.next = newHook; + } + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} + +function createFunctionComponentUpdateQueue() { + return { + lastEffect: null + }; +} + +function basicStateReducer(state, action) { + return typeof action === "function" ? action(state) : action; +} + +function mountReducer(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + var initialState = void 0; + if (init !== undefined) { + initialState = init(initialArg); + } else { + initialState = initialArg; + } + hook.memoizedState = hook.baseState = initialState; + var queue = (hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialState + }); + var dispatch = (queue.dispatch = dispatchAction.bind( + null, + // Flow doesn't know this is non-null, but we do. + currentlyRenderingFiber$1, + queue + )); + return [hook.memoizedState, dispatch]; +} + +function updateReducer(reducer, initialArg, init) { + var hook = updateWorkInProgressHook(); + var queue = hook.queue; + (function() { + if (!(queue !== null)) { + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + + queue.lastRenderedReducer = reducer; + + if (numberOfReRenders > 0) { + // This is a re-render. Apply the new render phase updates to the previous + var _dispatch = queue.dispatch; + if (renderPhaseUpdates !== null) { + // Render phase updates are stored in a map of queue -> linked list + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (firstRenderPhaseUpdate !== undefined) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + var update = firstRenderPhaseUpdate; + do { + // Process this render phase update. We don't have to check the + // priority because it will always be the same as the current + // render's. + var _action = update.action; + newState = reducer(newState, _action); + update = update.next; + } while (update !== null); + + // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!is(newState, hook.memoizedState)) { + markWorkInProgressReceivedUpdate(); + } + + hook.memoizedState = newState; + // Don't persist the state accumulated from the render phase updates to + // the base state unless the queue is empty. + // TODO: Not sure if this is the desired semantics, but it's what we + // do for gDSFP. I can't remember why. + if (hook.baseUpdate === queue.last) { + hook.baseState = newState; + } + + queue.lastRenderedState = newState; + + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + + // The last update in the entire queue + var last = queue.last; + // The last update that is part of the base state. + var baseUpdate = hook.baseUpdate; + var baseState = hook.baseState; + + // Find the first unprocessed update. + var first = void 0; + if (baseUpdate !== null) { + if (last !== null) { + // For the first update, the queue is a circular linked list where + // `queue.last.next = queue.first`. Once the first update commits, and + // the `baseUpdate` is no longer empty, we can unravel the list. + last.next = null; + } + first = baseUpdate.next; + } else { + first = last !== null ? last.next : null; + } + if (first !== null) { + var _newState = baseState; + var newBaseState = null; + var newBaseUpdate = null; + var prevUpdate = baseUpdate; + var _update = first; + var didSkip = false; + do { + var updateExpirationTime = _update.expirationTime; + if (updateExpirationTime < renderExpirationTime$1) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + if (!didSkip) { + didSkip = true; + newBaseUpdate = prevUpdate; + newBaseState = _newState; + } + // Update the remaining priority in the queue. + if (updateExpirationTime > remainingExpirationTime) { + remainingExpirationTime = updateExpirationTime; + } + } else { + // This update does have sufficient priority. + + // Mark the event time of this update as relevant to this render pass. + // TODO: This should ideally use the true event time of this update rather than + // its priority which is a derived and not reverseable value. + // TODO: We should skip this update if it was already committed but currently + // we have no way of detecting the difference between a committed and suspended + // update here. + markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ); + + // Process this update. + if (_update.eagerReducer === reducer) { + // If this update was processed eagerly, and its reducer matches the + // current reducer, we can use the eagerly computed state. + _newState = _update.eagerState; + } else { + var _action2 = _update.action; + _newState = reducer(_newState, _action2); + } + } + prevUpdate = _update; + _update = _update.next; + } while (_update !== null && _update !== first); + + if (!didSkip) { + newBaseUpdate = prevUpdate; + newBaseState = _newState; + } + + // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!is(_newState, hook.memoizedState)) { + markWorkInProgressReceivedUpdate(); + } + + hook.memoizedState = _newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = newBaseState; + + queue.lastRenderedState = _newState; + } + + var dispatch = queue.dispatch; + return [hook.memoizedState, dispatch]; +} + +function mountState(initialState) { + var hook = mountWorkInProgressHook(); + if (typeof initialState === "function") { + initialState = initialState(); + } + hook.memoizedState = hook.baseState = initialState; + var queue = (hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }); + var dispatch = (queue.dispatch = dispatchAction.bind( + null, + // Flow doesn't know this is non-null, but we do. + currentlyRenderingFiber$1, + queue + )); + return [hook.memoizedState, dispatch]; +} + +function updateState(initialState) { + return updateReducer(basicStateReducer, initialState); +} + +function pushEffect(tag, create, destroy, deps) { + var effect = { + tag: tag, + create: create, + destroy: destroy, + deps: deps, + // Circular + next: null + }; + if (componentUpdateQueue === null) { + componentUpdateQueue = createFunctionComponentUpdateQueue(); + componentUpdateQueue.lastEffect = effect.next = effect; + } else { + var _lastEffect = componentUpdateQueue.lastEffect; + if (_lastEffect === null) { + componentUpdateQueue.lastEffect = effect.next = effect; + } else { + var firstEffect = _lastEffect.next; + _lastEffect.next = effect; + effect.next = firstEffect; + componentUpdateQueue.lastEffect = effect; + } + } + return effect; +} + +function mountRef(initialValue) { + var hook = mountWorkInProgressHook(); + var ref = { current: initialValue }; + { + Object.seal(ref); + } + hook.memoizedState = ref; + return ref; +} + +function updateRef(initialValue) { + var hook = updateWorkInProgressHook(); + return hook.memoizedState; +} + +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps); +} + +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var destroy = undefined; + + if (currentHook !== null) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (nextDeps !== null) { + var prevDeps = prevEffect.deps; + if (areHookInputsEqual(nextDeps, prevDeps)) { + pushEffect(NoEffect$1, create, destroy, nextDeps); + return; + } + } + } + + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps); +} + +function mountEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } + return mountEffectImpl( + Update | Passive, + UnmountPassive | MountPassive, + create, + deps + ); +} + +function updateEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } + return updateEffectImpl( + Update | Passive, + UnmountPassive | MountPassive, + create, + deps + ); +} + +function mountLayoutEffect(create, deps) { + return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps); +} + +function updateLayoutEffect(create, deps) { + return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps); +} + +function imperativeHandleEffect(create, ref) { + if (typeof ref === "function") { + var refCallback = ref; + var _inst = create(); + refCallback(_inst); + return function() { + refCallback(null); + }; + } else if (ref !== null && ref !== undefined) { + var refObject = ref; + { + !refObject.hasOwnProperty("current") + ? warning$1( + false, + "Expected useImperativeHandle() first argument to either be a " + + "ref callback or React.createRef() object. Instead received: %s.", + "an object with keys {" + Object.keys(refObject).join(", ") + "}" + ) + : void 0; + } + var _inst2 = create(); + refObject.current = _inst2; + return function() { + refObject.current = null; + }; + } +} + +function mountImperativeHandle(ref, create, deps) { + { + !(typeof create === "function") + ? warning$1( + false, + "Expected useImperativeHandle() second argument to be a function " + + "that creates a handle. Instead received: %s.", + create !== null ? typeof create : "null" + ) + : void 0; + } + + // TODO: If deps are provided, should we skip comparing the ref itself? + var effectDeps = + deps !== null && deps !== undefined ? deps.concat([ref]) : null; + + return mountEffectImpl( + Update, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + effectDeps + ); +} + +function updateImperativeHandle(ref, create, deps) { + { + !(typeof create === "function") + ? warning$1( + false, + "Expected useImperativeHandle() second argument to be a function " + + "that creates a handle. Instead received: %s.", + create !== null ? typeof create : "null" + ) + : void 0; + } + + // TODO: If deps are provided, should we skip comparing the ref itself? + var effectDeps = + deps !== null && deps !== undefined ? deps.concat([ref]) : null; + + return updateEffectImpl( + Update, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + effectDeps + ); +} + +function mountDebugValue(value, formatterFn) { + // This hook is normally a no-op. + // The react-debug-hooks package injects its own implementation + // so that e.g. DevTools can display custom hook values. +} + +var updateDebugValue = mountDebugValue; + +function mountCallback(callback, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + hook.memoizedState = [callback, nextDeps]; + return callback; +} + +function updateCallback(callback, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) { + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) { + return prevState[0]; + } + } + } + hook.memoizedState = [callback, nextDeps]; + return callback; +} + +function mountMemo(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var nextValue = nextCreate(); + hook.memoizedState = [nextValue, nextDeps]; + return nextValue; +} + +function updateMemo(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) { + // Assume these are defined. If they're not, areHookInputsEqual will warn. + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) { + return prevState[0]; + } + } + } + var nextValue = nextCreate(); + hook.memoizedState = [nextValue, nextDeps]; + return nextValue; +} + +function dispatchAction(fiber, queue, action) { + (function() { + if (!(numberOfReRenders < RE_RENDER_LIMIT)) { + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + } + })(); + + { + !(arguments.length <= 3) + ? warning$1( + false, + "State updates from the useState() and useReducer() Hooks don't support the " + + "second callback argument. To execute a side effect after " + + "rendering, declare it in the component body with useEffect()." + ) + : void 0; + } + + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (alternate !== null && alternate === currentlyRenderingFiber$1) + ) { + // This is a render phase update. Stash it in a lazily-created map of + // queue -> linked list of updates. After this render pass, we'll restart + // and apply the stashed updates on top of the work-in-progress hook. + didScheduleRenderPhaseUpdate = true; + var update = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + { + update.priority = getCurrentPriorityLevel(); + } + if (renderPhaseUpdates === null) { + renderPhaseUpdates = new Map(); + } + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (firstRenderPhaseUpdate === undefined) { + renderPhaseUpdates.set(queue, update); + } else { + // Append the update to the end of the list. + var lastRenderPhaseUpdate = firstRenderPhaseUpdate; + while (lastRenderPhaseUpdate.next !== null) { + lastRenderPhaseUpdate = lastRenderPhaseUpdate.next; + } + lastRenderPhaseUpdate.next = update; + } + } else { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + + var currentTime = requestCurrentTime(); + var _suspenseConfig = requestCurrentSuspenseConfig(); + var _expirationTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + + var _update2 = { + expirationTime: _expirationTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + + { + _update2.priority = getCurrentPriorityLevel(); + } + + // Append the update to the end of the list. + var _last = queue.last; + if (_last === null) { + // This is the first update. Create a circular list. + _update2.next = _update2; + } else { + var first = _last.next; + if (first !== null) { + // Still circular. + _update2.next = first; + } + _last.next = _update2; + } + queue.last = _update2; + + if ( + fiber.expirationTime === NoWork && + (alternate === null || alternate.expirationTime === NoWork) + ) { + // The queue is currently empty, which means we can eagerly compute the + // next state before entering the render phase. If the new state is the + // same as the current state, we may be able to bail out entirely. + var _lastRenderedReducer = queue.lastRenderedReducer; + if (_lastRenderedReducer !== null) { + var prevDispatcher = void 0; + { + prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + } + try { + var currentState = queue.lastRenderedState; + var _eagerState = _lastRenderedReducer(currentState, action); + // Stash the eagerly computed state, and the reducer used to compute + // it, on the update object. If the reducer hasn't changed by the + // time we enter the render phase, then the eager state can be used + // without calling the reducer again. + _update2.eagerReducer = _lastRenderedReducer; + _update2.eagerState = _eagerState; + if (is(_eagerState, currentState)) { + // Fast path. We can bail out without scheduling React to re-render. + // It's still possible that we'll need to rebase this update later, + // if the component re-renders for a different reason and by that + // time the reducer has changed. + return; + } + } catch (error) { + // Suppress the error. It will throw again in the render phase. + } finally { + { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + } + } + } + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotScopedWithMatchingAct(fiber); + warnIfNotCurrentlyActingUpdatesInDev(fiber); + } + } + scheduleWork(fiber, _expirationTime); + } +} + +var ContextOnlyDispatcher = { + readContext: readContext, + + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError +}; + +var HooksDispatcherOnMountInDEV = null; +var HooksDispatcherOnMountWithHookTypesInDEV = null; +var HooksDispatcherOnUpdateInDEV = null; +var InvalidNestedHooksDispatcherOnMountInDEV = null; +var InvalidNestedHooksDispatcherOnUpdateInDEV = null; + +{ + var warnInvalidContextAccess = function() { + warning$1( + false, + "Context can only be read while React is rendering. " + + "In classes, you can read it in the render method or getDerivedStateFromProps. " + + "In function components, you can read it directly in the function body, but not " + + "inside Hooks like useReducer() or useMemo()." + ); + }; + + var warnInvalidHookAccess = function() { + warning$1( + false, + "Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. " + + "You can only call Hooks at the top level of your React function. " + + "For more information, see " + + "https://fb.me/rules-of-hooks" + ); + }; + + HooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + mountHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + mountHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + HooksDispatcherOnMountWithHookTypesInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + HooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return updateRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + InvalidNestedHooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return createResponderListener(responder, props); + } + }; + + InvalidNestedHooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return createResponderListener(responder, props); + } + }; +} + +// Intentionally not named imports because Rollup would use dynamic dispatch for +// CommonJS interop named imports. +var now$1 = Scheduler.unstable_now; + +var commitTime = 0; +var profilerStartTime = -1; + +function getCommitTime() { + return commitTime; +} + +function recordCommitTime() { + if (!enableProfilerTimer) { + return; + } + commitTime = now$1(); +} + +function startProfilerTimer(fiber) { + if (!enableProfilerTimer) { + return; + } + + profilerStartTime = now$1(); + + if (fiber.actualStartTime < 0) { + fiber.actualStartTime = now$1(); + } +} + +function stopProfilerTimerIfRunning(fiber) { + if (!enableProfilerTimer) { + return; + } + profilerStartTime = -1; +} + +function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { + if (!enableProfilerTimer) { + return; + } + + if (profilerStartTime >= 0) { + var elapsedTime = now$1() - profilerStartTime; + fiber.actualDuration += elapsedTime; + if (overrideBaseTime) { + fiber.selfBaseDuration = elapsedTime; + } + profilerStartTime = -1; + } +} + +// The deepest Fiber on the stack involved in a hydration context. +// This may have been an insertion or a hydration. +var hydrationParentFiber = null; +var nextHydratableInstance = null; +var isHydrating = false; + +function warnIfHydrating() { + { + !!isHydrating + ? warning$1( + false, + "We should not be hydrating here. This is a bug in React. Please file a bug." + ) + : void 0; + } +} + +function enterHydrationState(fiber) { + if (!supportsHydration) { + return false; + } + + var parentInstance = fiber.stateNode.containerInfo; + nextHydratableInstance = getFirstHydratableChild(parentInstance); + hydrationParentFiber = fiber; + isHydrating = true; + return true; +} + +function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) { + if (!supportsHydration) { + return false; + } + + var suspenseInstance = fiber.stateNode; + nextHydratableInstance = getNextHydratableSibling(suspenseInstance); + popToNextHostParent(fiber); + isHydrating = true; + return true; +} + +function deleteHydratableInstance(returnFiber, instance) { + { + switch (returnFiber.tag) { + case HostRoot: + didNotHydrateContainerInstance( + returnFiber.stateNode.containerInfo, + instance + ); + break; + case HostComponent: + didNotHydrateInstance( + returnFiber.type, + returnFiber.memoizedProps, + returnFiber.stateNode, + instance + ); + break; + } + } + + var childToDelete = createFiberFromHostInstanceForDeletion(); + childToDelete.stateNode = instance; + childToDelete.return = returnFiber; + childToDelete.effectTag = Deletion; + + // This might seem like it belongs on progressedFirstDeletion. However, + // these children are not part of the reconciliation list of children. + // Even if we abort and rereconcile the children, that will try to hydrate + // again and the nodes are still in the host tree so these will be + // recreated. + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + } +} + +function insertNonHydratedInstance(returnFiber, fiber) { + fiber.effectTag |= Placement; + { + switch (returnFiber.tag) { + case HostRoot: { + var parentContainer = returnFiber.stateNode.containerInfo; + switch (fiber.tag) { + case HostComponent: + var type = fiber.type; + var props = fiber.pendingProps; + didNotFindHydratableContainerInstance(parentContainer, type, props); + break; + case HostText: + var text = fiber.pendingProps; + didNotFindHydratableContainerTextInstance(parentContainer, text); + break; + case SuspenseComponent: + didNotFindHydratableContainerSuspenseInstance(parentContainer); + break; + } + break; + } + case HostComponent: { + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + switch (fiber.tag) { + case HostComponent: + var _type = fiber.type; + var _props = fiber.pendingProps; + didNotFindHydratableInstance( + parentType, + parentProps, + parentInstance, + _type, + _props + ); + break; + case HostText: + var _text = fiber.pendingProps; + didNotFindHydratableTextInstance( + parentType, + parentProps, + parentInstance, + _text + ); + break; + case SuspenseComponent: + didNotFindHydratableSuspenseInstance( + parentType, + parentProps, + parentInstance + ); + break; + } + break; + } + default: + return; + } + } +} + +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case HostComponent: { + var type = fiber.type; + var props = fiber.pendingProps; + var instance = canHydrateInstance(nextInstance, type, props); + if (instance !== null) { + fiber.stateNode = instance; + return true; + } + return false; + } + case HostText: { + var text = fiber.pendingProps; + var textInstance = canHydrateTextInstance(nextInstance, text); + if (textInstance !== null) { + fiber.stateNode = textInstance; + return true; + } + return false; + } + case SuspenseComponent: { + if (enableSuspenseServerRenderer) { + var suspenseInstance = canHydrateSuspenseInstance(nextInstance); + if (suspenseInstance !== null) { + // Downgrade the tag to a dehydrated component until we've hydrated it. + fiber.tag = DehydratedSuspenseComponent; + fiber.stateNode = suspenseInstance; + return true; + } + } + return false; + } + default: + return false; + } +} + +function tryToClaimNextHydratableInstance(fiber) { + if (!isHydrating) { + return; + } + var nextInstance = nextHydratableInstance; + if (!nextInstance) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber, nextInstance)) { + // If we can't hydrate this instance let's try the next one. + // We use this as a heuristic. It's based on intuition and not data so it + // might be flawed or unnecessary. + nextInstance = getNextHydratableSibling(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber, nextInstance)) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } + // We matched the next one, we'll now assume that the first one was + // superfluous and we'll delete it. Since we can't eagerly delete it + // we'll have to schedule a deletion. To do that, this node needs a dummy + // fiber associated with it. + deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance); + } + hydrationParentFiber = fiber; + nextHydratableInstance = getFirstHydratableChild(nextInstance); +} + +function prepareToHydrateHostInstance( + fiber, + rootContainerInstance, + hostContext +) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + var instance = fiber.stateNode; + var updatePayload = hydrateInstance( + instance, + fiber.type, + fiber.memoizedProps, + rootContainerInstance, + hostContext, + fiber + ); + // TODO: Type this specific to this type of component. + fiber.updateQueue = updatePayload; + // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. + if (updatePayload !== null) { + return true; + } + return false; +} + +function prepareToHydrateHostTextInstance(fiber) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + var textInstance = fiber.stateNode; + var textContent = fiber.memoizedProps; + var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); + { + if (shouldUpdate) { + // We assume that prepareToHydrateHostTextInstance is called in a context where the + // hydration parent is the parent host component of this host text. + var returnFiber = hydrationParentFiber; + if (returnFiber !== null) { + switch (returnFiber.tag) { + case HostRoot: { + var parentContainer = returnFiber.stateNode.containerInfo; + didNotMatchHydratedContainerTextInstance( + parentContainer, + textInstance, + textContent + ); + break; + } + case HostComponent: { + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + didNotMatchHydratedTextInstance( + parentType, + parentProps, + parentInstance, + textInstance, + textContent + ); + break; + } + } + } + } + } + return shouldUpdate; +} + +function skipPastDehydratedSuspenseInstance(fiber) { + if (!supportsHydration) { + (function() { + { + throw ReactError( + Error( + "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + var suspenseInstance = fiber.stateNode; + (function() { + if (!suspenseInstance) { + throw ReactError( + Error( + "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance( + suspenseInstance + ); +} + +function popToNextHostParent(fiber) { + var parent = fiber.return; + while ( + parent !== null && + parent.tag !== HostComponent && + parent.tag !== HostRoot && + parent.tag !== DehydratedSuspenseComponent + ) { + parent = parent.return; + } + hydrationParentFiber = parent; +} + +function popHydrationState(fiber) { + if (!supportsHydration) { + return false; + } + if (fiber !== hydrationParentFiber) { + // We're deeper than the current hydration context, inside an inserted + // tree. + return false; + } + if (!isHydrating) { + // If we're not currently hydrating but we're in a hydration context, then + // we were an insertion and now need to pop up reenter hydration of our + // siblings. + popToNextHostParent(fiber); + isHydrating = true; + return false; + } + + var type = fiber.type; + + // If we have any remaining hydratable nodes, we need to delete them now. + // We only do this deeper than head and body since they tend to have random + // other nodes in them. We also ignore components with pure text content in + // side of them. + // TODO: Better heuristic. + if ( + fiber.tag !== HostComponent || + (type !== "head" && + type !== "body" && + !shouldSetTextContent(type, fiber.memoizedProps)) + ) { + var nextInstance = nextHydratableInstance; + while (nextInstance) { + deleteHydratableInstance(fiber, nextInstance); + nextInstance = getNextHydratableSibling(nextInstance); + } + } + + popToNextHostParent(fiber); + nextHydratableInstance = hydrationParentFiber + ? getNextHydratableSibling(fiber.stateNode) + : null; + return true; +} + +function resetHydrationState() { + if (!supportsHydration) { + return; + } + + hydrationParentFiber = null; + nextHydratableInstance = null; + isHydrating = false; +} + +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; + +var didReceiveUpdate = false; + +var didWarnAboutBadClass = void 0; +var didWarnAboutModulePatternComponent = void 0; +var didWarnAboutContextTypeOnFunctionComponent = void 0; +var didWarnAboutGetDerivedStateOnFunctionComponent = void 0; +var didWarnAboutFunctionRefs = void 0; +var didWarnAboutReassigningProps = void 0; +var didWarnAboutMaxDuration = void 0; +var didWarnAboutRevealOrder = void 0; +var didWarnAboutTailOptions = void 0; +var didWarnAboutDefaultPropsOnFunctionComponent = void 0; + +{ + didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; + didWarnAboutContextTypeOnFunctionComponent = {}; + didWarnAboutGetDerivedStateOnFunctionComponent = {}; + didWarnAboutFunctionRefs = {}; + didWarnAboutReassigningProps = false; + didWarnAboutMaxDuration = false; + didWarnAboutRevealOrder = {}; + didWarnAboutTailOptions = {}; + didWarnAboutDefaultPropsOnFunctionComponent = {}; +} + +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + if (current$$1 === null) { + // If this is a fresh new component that hasn't been rendered yet, we + // won't update its child set by applying minimal side-effects. Instead, + // we will add them all to the child before it gets rendered. That means + // we can optimize this reconciliation pass by not tracking side-effects. + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + // If the current child is the same as the work in progress, it means that + // we haven't yet started any work on these children. Therefore, we use + // the clone algorithm to create a copy of all the current children. + + // If we had any progressed work already, that is invalid at this point so + // let's throw it out. + workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); + } +} + +function forceUnmountCurrentAndReconcile( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + // This function is fork of reconcileChildren. It's used in cases where we + // want to reconcile without matching against the existing set. This has the + // effect of all current children being unmounted; even if the type and key + // are the same, the old child is unmounted and a new child is created. + // + // To do this, we're going to go through the reconcile algorithm twice. In + // the first pass, we schedule a deletion for all the current children by + // passing null. + workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + ); + // In the second pass, we mount the new children. The trick here is that we + // pass null in place of where we usually pass the current child set. This has + // the effect of remounting all children regardless of whether their their + // identity matches. + workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); +} + +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + // TODO: current can be non-null here even if the component + // hasn't yet mounted. This happens after the first render suspends. + // We'll need to figure out if this is fine or can cause issues. + + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + var render = Component.render; + var ref = workInProgress.ref; + + // The rest is a fork of updateFunctionComponent + var nextChildren = void 0; + prepareToReadContext(workInProgress, renderExpirationTime); + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + nextChildren = renderWithHooks( + current$$1, + workInProgress, + render, + nextProps, + ref, + renderExpirationTime + ); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + nextChildren = renderWithHooks( + current$$1, + workInProgress, + render, + nextProps, + ref, + renderExpirationTime + ); + } + } + setCurrentPhase(null); + } + + if (current$$1 !== null && !didReceiveUpdate) { + bailoutHooks(current$$1, workInProgress, renderExpirationTime); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (current$$1 === null) { + var type = Component.type; + if ( + isSimpleFunctionComponent(type) && + Component.compare === null && + // SimpleMemoComponent codepath doesn't resolve outer props either. + Component.defaultProps === undefined + ) { + var resolvedType = type; + { + resolvedType = resolveFunctionForHotReloading(type); + } + // If this is a plain function component without default props, + // and with only the default shallow comparison, we upgrade it + // to a SimpleMemoComponent to allow fast path updates. + workInProgress.tag = SimpleMemoComponent; + workInProgress.type = resolvedType; + { + validateFunctionComponentInDev(workInProgress, type); + } + return updateSimpleMemoComponent( + current$$1, + workInProgress, + resolvedType, + nextProps, + updateExpirationTime, + renderExpirationTime + ); + } + { + var innerPropTypes = type.propTypes; + if (innerPropTypes) { + // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(type), + getCurrentFiberStackInDev + ); + } + } + var child = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + child.ref = workInProgress.ref; + child.return = workInProgress; + workInProgress.child = child; + return child; + } + { + var _type = Component.type; + var _innerPropTypes = _type.propTypes; + if (_innerPropTypes) { + // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes( + _innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(_type), + getCurrentFiberStackInDev + ); + } + } + var currentChild = current$$1.child; // This is always exactly one child + if (updateExpirationTime < renderExpirationTime) { + // This will be the props with resolved defaultProps, + // unlike current.memoizedProps which will be the unresolved ones. + var prevProps = currentChild.memoizedProps; + // Default to shallow comparison + var compare = Component.compare; + compare = compare !== null ? compare : shallowEqual; + if ( + compare(prevProps, nextProps) && + current$$1.ref === workInProgress.ref + ) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + var newChild = createWorkInProgress( + currentChild, + nextProps, + renderExpirationTime + ); + newChild.ref = workInProgress.ref; + newChild.return = workInProgress; + workInProgress.child = newChild; + return newChild; +} + +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + // TODO: current can be non-null here even if the component + // hasn't yet mounted. This happens when the inner render suspends. + // We'll need to figure out if this is fine or can cause issues. + + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var outerMemoType = workInProgress.elementType; + if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { + // We warn when you define propTypes on lazy() + // so let's just skip over it to find memo() outer wrapper. + // Inner props for memo are validated later. + outerMemoType = refineResolvedLazyComponent(outerMemoType); + } + var outerPropTypes = outerMemoType && outerMemoType.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + nextProps, // Resolved (SimpleMemoComponent has no defaultProps) + "prop", + getComponentName(outerMemoType), + getCurrentFiberStackInDev + ); + } + // Inner propTypes will be validated in the function component path. + } + } + if (current$$1 !== null) { + var prevProps = current$$1.memoizedProps; + if ( + shallowEqual(prevProps, nextProps) && + current$$1.ref === workInProgress.ref && + // Prevent bailout if the implementation changed due to hot reload: + workInProgress.type === current$$1.type + ) { + didReceiveUpdate = false; + if (updateExpirationTime < renderExpirationTime) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + } + return updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} + +function updateFragment(current$$1, workInProgress, renderExpirationTime) { + var nextChildren = workInProgress.pendingProps; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateMode(current$$1, workInProgress, renderExpirationTime) { + var nextChildren = workInProgress.pendingProps.children; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateProfiler(current$$1, workInProgress, renderExpirationTime) { + if (enableProfilerTimer) { + workInProgress.effectTag |= Update; + } + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (current$$1 === null && ref !== null) || + (current$$1 !== null && current$$1.ref !== ref) + ) { + // Schedule a Ref effect + workInProgress.effectTag |= Ref; + } +} + +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + var nextChildren = void 0; + prepareToReadContext(workInProgress, renderExpirationTime); + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + nextChildren = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + nextChildren = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + } + } + setCurrentPhase(null); + } + + if (current$$1 !== null && !didReceiveUpdate) { + bailoutHooks(current$$1, workInProgress, renderExpirationTime); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) { + checkPropTypes( + innerPropTypes, + nextProps, // Resolved props + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = void 0; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + prepareToReadContext(workInProgress, renderExpirationTime); + + var instance = workInProgress.stateNode; + var shouldUpdate = void 0; + if (instance === null) { + if (current$$1 !== null) { + // An class component without an instance only mounts if it suspended + // inside a non- concurrent tree, in an inconsistent state. We want to + // tree it like a new mount, even though an empty version of it already + // committed. Disconnect the alternate pointers. + current$$1.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + // In the initial pass we might need to construct the instance. + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + shouldUpdate = true; + } else if (current$$1 === null) { + // In a resume, we'll already have an instance we can reuse. + shouldUpdate = resumeMountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + } else { + shouldUpdate = updateClassInstance( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + } + var nextUnitOfWork = finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime + ); + { + var inst = workInProgress.stateNode; + if (inst.props !== nextProps) { + !didWarnAboutReassigningProps + ? warning$1( + false, + "It looks like %s is reassigning its own `this.props` while rendering. " + + "This is not supported and can lead to confusing bugs.", + getComponentName(workInProgress.type) || "a component" + ) + : void 0; + didWarnAboutReassigningProps = true; + } + } + return nextUnitOfWork; +} + +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + // Refs should update even if shouldComponentUpdate returns false + markRef(current$$1, workInProgress); + + var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect; + + if (!shouldUpdate && !didCaptureError) { + // Context providers should defer to sCU for rendering + if (hasContext) { + invalidateContextProvider(workInProgress, Component, false); + } + + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + + var instance = workInProgress.stateNode; + + // Rerender + ReactCurrentOwner$3.current = workInProgress; + var nextChildren = void 0; + if ( + didCaptureError && + typeof Component.getDerivedStateFromError !== "function" + ) { + // If we captured an error, but getDerivedStateFrom catch is not defined, + // unmount all the children. componentDidCatch will schedule an update to + // re-render a fallback. This is temporary until we migrate everyone to + // the new API. + // TODO: Warn in a future release. + nextChildren = null; + + if (enableProfilerTimer) { + stopProfilerTimerIfRunning(workInProgress); + } + } else { + { + setCurrentPhase("render"); + nextChildren = instance.render(); + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + instance.render(); + } + setCurrentPhase(null); + } + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + if (current$$1 !== null && didCaptureError) { + // If we're recovering from an error, reconcile without reusing any of + // the existing children. Conceptually, the normal children and the children + // that are shown on error are two different sets, so we shouldn't reuse + // normal children even if their identities match. + forceUnmountCurrentAndReconcile( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } else { + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } + + // Memoize state using the values we just used to render. + // TODO: Restructure so we never read values from the instance. + workInProgress.memoizedState = instance.state; + + // The context might have changed so we need to recalculate it. + if (hasContext) { + invalidateContextProvider(workInProgress, Component, true); + } + + return workInProgress.child; +} + +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + if (root.pendingContext) { + pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ); + } else if (root.context) { + // Should always be set + pushTopLevelContextObject(workInProgress, root.context, false); + } + pushHostContainer(workInProgress, root.containerInfo); +} + +function updateHostRoot(current$$1, workInProgress, renderExpirationTime) { + pushHostRootContext(workInProgress); + var updateQueue = workInProgress.updateQueue; + (function() { + if (!(updateQueue !== null)) { + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var nextProps = workInProgress.pendingProps; + var prevState = workInProgress.memoizedState; + var prevChildren = prevState !== null ? prevState.element : null; + processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + null, + renderExpirationTime + ); + var nextState = workInProgress.memoizedState; + // Caution: React DevTools currently depends on this property + // being called "element". + var nextChildren = nextState.element; + if (nextChildren === prevChildren) { + // If the state is the same as before, that's a bailout because we had + // no work that expires at this time. + resetHydrationState(); + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + var root = workInProgress.stateNode; + if ( + (current$$1 === null || current$$1.child === null) && + root.hydrate && + enterHydrationState(workInProgress) + ) { + // If we don't have any current children this might be the first pass. + // We always try to hydrate. If this isn't a hydration pass there won't + // be any children to hydrate which is effectively the same thing as + // not hydrating. + + // This is a bit of a hack. We track the host root as a placement to + // know that we're currently in a mounting state. That way isMounted + // works as expected. We must reset this before committing. + // TODO: Delete this when we delete isMounted and findDOMNode. + workInProgress.effectTag |= Placement; + + // Ensure that children mount into this root without tracking + // side-effects. This ensures that we don't store Placement effects on + // nodes that will be hydrated. + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + // Otherwise reset hydration state in case we aborted and resumed another + // root. + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + resetHydrationState(); + } + return workInProgress.child; +} + +function updateHostComponent(current$$1, workInProgress, renderExpirationTime) { + pushHostContext(workInProgress); + + if (current$$1 === null) { + tryToClaimNextHydratableInstance(workInProgress); + } + + var type = workInProgress.type; + var nextProps = workInProgress.pendingProps; + var prevProps = current$$1 !== null ? current$$1.memoizedProps : null; + + var nextChildren = nextProps.children; + var isDirectTextChild = shouldSetTextContent(type, nextProps); + + if (isDirectTextChild) { + // We special case a direct text child of a host node. This is a common + // case. We won't handle it as a reified child. We will instead handle + // this in the host environment that also have access to this prop. That + // avoids allocating another HostText fiber and traversing it. + nextChildren = null; + } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) { + // If we're switching from a direct text child to a normal child, or to + // empty, we need to schedule the text content to be reset. + workInProgress.effectTag |= ContentReset; + } + + markRef(current$$1, workInProgress); + + // Check the host config to see if the children are offscreen/hidden. + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(type, nextProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } + + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateHostText(current$$1, workInProgress) { + if (current$$1 === null) { + tryToClaimNextHydratableInstance(workInProgress); + } + // Nothing to do here. This is terminal. We'll do the completion step + // immediately after. + return null; +} + +function mountLazyComponent( + _current, + workInProgress, + elementType, + updateExpirationTime, + renderExpirationTime +) { + if (_current !== null) { + // An lazy component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + var props = workInProgress.pendingProps; + // We can't start a User Timing measurement with correct label yet. + // Cancel and resume right after we know the tag. + cancelWorkTimer(workInProgress); + var Component = readLazyComponentType(elementType); + // Store the unwrapped component in the type. + workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = resolveLazyComponentTag(Component)); + startWorkTimer(workInProgress); + var resolvedProps = resolveDefaultProps(Component, props); + var child = void 0; + switch (resolvedTag) { + case FunctionComponent: { + { + validateFunctionComponentInDev(workInProgress, Component); + workInProgress.type = Component = resolveFunctionForHotReloading( + Component + ); + } + child = updateFunctionComponent( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case ClassComponent: { + { + workInProgress.type = Component = resolveClassForHotReloading( + Component + ); + } + child = updateClassComponent( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case ForwardRef: { + { + workInProgress.type = Component = resolveForwardRefForHotReloading( + Component + ); + } + child = updateForwardRef( + null, + workInProgress, + Component, + resolvedProps, + renderExpirationTime + ); + break; + } + case MemoComponent: { + { + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = Component.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + resolvedProps, // Resolved for outer only + "prop", + getComponentName(Component), + getCurrentFiberStackInDev + ); + } + } + } + child = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too + updateExpirationTime, + renderExpirationTime + ); + break; + } + default: { + var hint = ""; + { + if ( + Component !== null && + typeof Component === "object" && + Component.$$typeof === REACT_LAZY_TYPE + ) { + hint = " Did you wrap a component in React.lazy() more than once?"; + } + } + // This message intentionally doesn't mention ForwardRef or MemoComponent + // because the fact that it's a separate type of work is an + // implementation detail. + (function() { + { + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." + + hint + ) + ); + } + })(); + } + } + return child; +} + +function mountIncompleteClassComponent( + _current, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (_current !== null) { + // An incomplete component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + // Promote the fiber to a class and try rendering again. + workInProgress.tag = ClassComponent; + + // The rest of this function is a fork of `updateClassComponent` + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = void 0; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + prepareToReadContext(workInProgress, renderExpirationTime); + + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ); + + return finishClassComponent( + null, + workInProgress, + Component, + true, + hasContext, + renderExpirationTime + ); +} + +function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderExpirationTime +) { + if (_current !== null) { + // An indeterminate component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; + // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.effectTag |= Placement; + } + + var props = workInProgress.pendingProps; + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderExpirationTime); + var value = void 0; + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + warningWithoutStack$1( + false, + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictMode) { + ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); + } + + ReactCurrentOwner$3.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderExpirationTime + ); + } + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + { + var _componentName = getComponentName(Component) || "Unknown"; + if (!didWarnAboutModulePatternComponent[_componentName]) { + warningWithoutStack$1( + false, + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + + // Proceed under the assumption that this is a class instance + workInProgress.tag = ClassComponent; + + // Throw out any hooks that were used. + resetHooks(); + + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = false; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else { + hasContext = false; + } + + workInProgress.memoizedState = + value.state !== null && value.state !== undefined ? value.state : null; + + var getDerivedStateFromProps = Component.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + props + ); + } + + adoptClassInstance(workInProgress, value); + mountClassInstance(workInProgress, Component, props, renderExpirationTime); + return finishClassComponent( + null, + workInProgress, + Component, + true, + hasContext, + renderExpirationTime + ); + } else { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + { + if (disableLegacyContext && Component.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with React.useContext() instead.", + getComponentName(Component) || "Unknown" + ); + } + + if ( + debugRenderPhaseSideEffects || + (debugRenderPhaseSideEffectsForStrictMode && + workInProgress.mode & StrictMode) + ) { + // Only double-render components with Hooks + if (workInProgress.memoizedState !== null) { + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderExpirationTime + ); + } + } + } + reconcileChildren(null, workInProgress, value, renderExpirationTime); + { + validateFunctionComponentInDev(workInProgress, Component); + } + return workInProgress.child; + } +} + +function validateFunctionComponentInDev(workInProgress, Component) { + if (Component) { + !!Component.childContextTypes + ? warningWithoutStack$1( + false, + "%s(...): childContextTypes cannot be defined on a function component.", + Component.displayName || Component.name || "Component" + ) + : void 0; + } + if (workInProgress.ref !== null) { + var info = ""; + var ownerName = getCurrentFiberOwnerNameInDevOrNull(); + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + + var warningKey = ownerName || workInProgress._debugID || ""; + var debugSource = workInProgress._debugSource; + if (debugSource) { + warningKey = debugSource.fileName + ":" + debugSource.lineNumber; + } + if (!didWarnAboutFunctionRefs[warningKey]) { + didWarnAboutFunctionRefs[warningKey] = true; + warning$1( + false, + "Function components cannot be given refs. " + + "Attempts to access this ref will fail. " + + "Did you mean to use React.forwardRef()?%s", + info + ); + } + } + + if ( + warnAboutDefaultPropsOnFunctionComponents && + Component.defaultProps !== undefined + ) { + var componentName = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { + warningWithoutStack$1( + false, + "%s: Support for defaultProps will be removed from function components " + + "in a future major release. Use JavaScript default parameters instead.", + componentName + ); + didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; + } + } + + if (typeof Component.getDerivedStateFromProps === "function") { + var _componentName2 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) { + warningWithoutStack$1( + false, + "%s: Function components do not support getDerivedStateFromProps.", + _componentName2 + ); + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true; + } + } + + if ( + typeof Component.contextType === "object" && + Component.contextType !== null + ) { + var _componentName3 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + warningWithoutStack$1( + false, + "%s: Function components do not support contextType.", + _componentName3 + ); + didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + } + } +} + +// TODO: This is now an empty object. Should we just make it a boolean? +var SUSPENDED_MARKER = {}; + +function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) { + // If the context is telling us that we should show a fallback, and we're not + // already showing content, then we should show the fallback instead. + return ( + hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && + (current$$1 === null || current$$1.memoizedState !== null) + ); +} + +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode; + var nextProps = workInProgress.pendingProps; + + // This is used by DevTools to force a boundary to suspend. + { + if (shouldSuspend(workInProgress)) { + workInProgress.effectTag |= DidCapture; + } + } + + var suspenseContext = suspenseStackCursor.current; + + var nextState = null; + var nextDidTimeout = false; + + if ( + (workInProgress.effectTag & DidCapture) !== NoEffect || + shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) + ) { + // Something in this boundary's subtree already suspended. Switch to + // rendering the fallback children. + nextState = SUSPENDED_MARKER; + nextDidTimeout = true; + workInProgress.effectTag &= ~DidCapture; + } else { + // Attempting the main content + if (current$$1 === null || current$$1.memoizedState !== null) { + // This is a new mount or this boundary is already showing a fallback state. + // Mark this subtree context as having at least one invisible parent that could + // handle the fallback state. + // Boundaries without fallbacks or should be avoided are not considered since + // they cannot handle preferred fallback states. + if ( + nextProps.fallback !== undefined && + nextProps.unstable_avoidThisFallback !== true + ) { + suspenseContext = addSubtreeSuspenseContext( + suspenseContext, + InvisibleParentSuspenseContext + ); + } + } + } + + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + + pushSuspenseContext(workInProgress, suspenseContext); + + { + if ("maxDuration" in nextProps) { + if (!didWarnAboutMaxDuration) { + didWarnAboutMaxDuration = true; + warning$1( + false, + "maxDuration has been removed from React. " + + "Remove the maxDuration prop." + ); + } + } + } + + // This next part is a bit confusing. If the children timeout, we switch to + // showing the fallback children in place of the "primary" children. + // However, we don't want to delete the primary children because then their + // state will be lost (both the React state and the host state, e.g. + // uncontrolled form inputs). Instead we keep them mounted and hide them. + // Both the fallback children AND the primary children are rendered at the + // same time. Once the primary children are un-suspended, we can delete + // the fallback children — don't need to preserve their state. + // + // The two sets of children are siblings in the host environment, but + // semantically, for purposes of reconciliation, they are two separate sets. + // So we store them using two fragment fibers. + // + // However, we want to avoid allocating extra fibers for every placeholder. + // They're only necessary when the children time out, because that's the + // only time when both sets are mounted. + // + // So, the extra fragment fibers are only used if the children time out. + // Otherwise, we render the primary children directly. This requires some + // custom reconciliation logic to preserve the state of the primary + // children. It's essentially a very basic form of re-parenting. + + // `child` points to the child fiber. In the normal case, this is the first + // fiber of the primary children set. In the timed-out case, it's a + // a fragment fiber containing the primary children. + var child = void 0; + // `next` points to the next fiber React should render. In the normal case, + // it's the same as `child`: the first fiber of the primary children set. + // In the timed-out case, it's a fragment fiber containing the *fallback* + // children -- we skip over the primary children entirely. + var next = void 0; + if (current$$1 === null) { + if (enableSuspenseServerRenderer) { + // If we're currently hydrating, try to hydrate this boundary. + // But only if this has a fallback. + if (nextProps.fallback !== undefined) { + tryToClaimNextHydratableInstance(workInProgress); + // This could've changed the tag if this was a dehydrated suspense component. + if (workInProgress.tag === DehydratedSuspenseComponent) { + popSuspenseContext(workInProgress); + return updateDehydratedSuspenseComponent( + null, + workInProgress, + renderExpirationTime + ); + } + } + } + + // This is the initial mount. This branch is pretty simple because there's + // no previous state that needs to be preserved. + if (nextDidTimeout) { + // Mount separate fragments for primary and fallback children. + var nextFallbackChildren = nextProps.fallback; + var primaryChildFragment = createFiberFromFragment( + null, + mode, + NoWork, + null + ); + primaryChildFragment.return = workInProgress; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var progressedState = workInProgress.memoizedState; + var progressedPrimaryChild = + progressedState !== null + ? workInProgress.child.child + : workInProgress.child; + primaryChildFragment.child = progressedPrimaryChild; + var progressedChild = progressedPrimaryChild; + while (progressedChild !== null) { + progressedChild.return = primaryChildFragment; + progressedChild = progressedChild.sibling; + } + } + + var fallbackChildFragment = createFiberFromFragment( + nextFallbackChildren, + mode, + renderExpirationTime, + null + ); + fallbackChildFragment.return = workInProgress; + primaryChildFragment.sibling = fallbackChildFragment; + child = primaryChildFragment; + // Skip the primary children, and continue working on the + // fallback children. + next = fallbackChildFragment; + } else { + // Mount the primary children without an intermediate fragment fiber. + var nextPrimaryChildren = nextProps.children; + child = next = mountChildFibers( + workInProgress, + null, + nextPrimaryChildren, + renderExpirationTime + ); + } + } else { + // This is an update. This branch is more complicated because we need to + // ensure the state of the primary children is preserved. + var prevState = current$$1.memoizedState; + var prevDidTimeout = prevState !== null; + if (prevDidTimeout) { + // The current tree already timed out. That means each child set is + var currentPrimaryChildFragment = current$$1.child; + var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; + if (nextDidTimeout) { + // Still timed out. Reuse the current primary children by cloning + // its fragment. We're going to skip over these entirely. + var _nextFallbackChildren = nextProps.fallback; + var _primaryChildFragment = createWorkInProgress( + currentPrimaryChildFragment, + currentPrimaryChildFragment.pendingProps, + NoWork + ); + _primaryChildFragment.return = workInProgress; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var _progressedState = workInProgress.memoizedState; + var _progressedPrimaryChild = + _progressedState !== null + ? workInProgress.child.child + : workInProgress.child; + if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) { + _primaryChildFragment.child = _progressedPrimaryChild; + var _progressedChild = _progressedPrimaryChild; + while (_progressedChild !== null) { + _progressedChild.return = _primaryChildFragment; + _progressedChild = _progressedChild.sibling; + } + } + } + + // Because primaryChildFragment is a new fiber that we're inserting as the + // parent of a new tree, we need to set its treeBaseDuration. + if (enableProfilerTimer && workInProgress.mode & ProfileMode) { + // treeBaseDuration is the sum of all the child tree base durations. + var treeBaseDuration = 0; + var hiddenChild = _primaryChildFragment.child; + while (hiddenChild !== null) { + treeBaseDuration += hiddenChild.treeBaseDuration; + hiddenChild = hiddenChild.sibling; + } + _primaryChildFragment.treeBaseDuration = treeBaseDuration; + } + + // Clone the fallback child fragment, too. These we'll continue + // working on. + var _fallbackChildFragment = createWorkInProgress( + currentFallbackChildFragment, + _nextFallbackChildren, + currentFallbackChildFragment.expirationTime + ); + _fallbackChildFragment.return = workInProgress; + _primaryChildFragment.sibling = _fallbackChildFragment; + child = _primaryChildFragment; + _primaryChildFragment.childExpirationTime = NoWork; + // Skip the primary children, and continue working on the + // fallback children. + next = _fallbackChildFragment; + } else { + // No longer suspended. Switch back to showing the primary children, + // and remove the intermediate fragment fiber. + var _nextPrimaryChildren = nextProps.children; + var currentPrimaryChild = currentPrimaryChildFragment.child; + var primaryChild = reconcileChildFibers( + workInProgress, + currentPrimaryChild, + _nextPrimaryChildren, + renderExpirationTime + ); + + // If this render doesn't suspend, we need to delete the fallback + // children. Wait until the complete phase, after we've confirmed the + // fallback is no longer needed. + // TODO: Would it be better to store the fallback fragment on + // the stateNode? + + // Continue rendering the children, like we normally do. + child = next = primaryChild; + } + } else { + // The current tree has not already timed out. That means the primary + // children are not wrapped in a fragment fiber. + var _currentPrimaryChild = current$$1.child; + if (nextDidTimeout) { + // Timed out. Wrap the children in a fragment fiber to keep them + // separate from the fallback children. + var _nextFallbackChildren2 = nextProps.fallback; + var _primaryChildFragment2 = createFiberFromFragment( + // It shouldn't matter what the pending props are because we aren't + // going to render this fragment. + null, + mode, + NoWork, + null + ); + _primaryChildFragment2.return = workInProgress; + _primaryChildFragment2.child = _currentPrimaryChild; + if (_currentPrimaryChild !== null) { + _currentPrimaryChild.return = _primaryChildFragment2; + } + + // Even though we're creating a new fiber, there are no new children, + // because we're reusing an already mounted tree. So we don't need to + // schedule a placement. + // primaryChildFragment.effectTag |= Placement; + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the + var _progressedState2 = workInProgress.memoizedState; + var _progressedPrimaryChild2 = + _progressedState2 !== null + ? workInProgress.child.child + : workInProgress.child; + _primaryChildFragment2.child = _progressedPrimaryChild2; + var _progressedChild2 = _progressedPrimaryChild2; + while (_progressedChild2 !== null) { + _progressedChild2.return = _primaryChildFragment2; + _progressedChild2 = _progressedChild2.sibling; + } + } + + // Because primaryChildFragment is a new fiber that we're inserting as the + // parent of a new tree, we need to set its treeBaseDuration. + if (enableProfilerTimer && workInProgress.mode & ProfileMode) { + // treeBaseDuration is the sum of all the child tree base durations. + var _treeBaseDuration = 0; + var _hiddenChild = _primaryChildFragment2.child; + while (_hiddenChild !== null) { + _treeBaseDuration += _hiddenChild.treeBaseDuration; + _hiddenChild = _hiddenChild.sibling; + } + _primaryChildFragment2.treeBaseDuration = _treeBaseDuration; + } + + // Create a fragment from the fallback children, too. + var _fallbackChildFragment2 = createFiberFromFragment( + _nextFallbackChildren2, + mode, + renderExpirationTime, + null + ); + _fallbackChildFragment2.return = workInProgress; + _primaryChildFragment2.sibling = _fallbackChildFragment2; + _fallbackChildFragment2.effectTag |= Placement; + child = _primaryChildFragment2; + _primaryChildFragment2.childExpirationTime = NoWork; + // Skip the primary children, and continue working on the + // fallback children. + next = _fallbackChildFragment2; + } else { + // Still haven't timed out. Continue rendering the children, like we + // normally do. + var _nextPrimaryChildren2 = nextProps.children; + next = child = reconcileChildFibers( + workInProgress, + _currentPrimaryChild, + _nextPrimaryChildren2, + renderExpirationTime + ); + } + } + workInProgress.stateNode = current$$1.stateNode; + } + + workInProgress.memoizedState = nextState; + workInProgress.child = child; + return next; +} + +function retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime +) { + // Detach from the current dehydrated boundary. + current$$1.alternate = null; + workInProgress.alternate = null; + + // Insert a deletion in the effect list. + var returnFiber = workInProgress.return; + (function() { + if (!(returnFiber !== null)) { + throw ReactError( + Error( + "Suspense boundaries are never on the root. This is probably a bug in React." + ) + ); + } + })(); + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + popSuspenseContext(workInProgress); + + // Upgrade this work in progress to a real Suspense component. + workInProgress.tag = SuspenseComponent; + workInProgress.stateNode = null; + workInProgress.memoizedState = null; + // This is now an insertion. + workInProgress.effectTag |= Placement; + // Retry as a real Suspense component. + return updateSuspenseComponent(null, workInProgress, renderExpirationTime); +} + +function updateDehydratedSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + var suspenseInstance = workInProgress.stateNode; + if (current$$1 === null) { + // During the first pass, we'll bail out and not drill into the children. + // Instead, we'll leave the content in place and try to hydrate it later. + if (isSuspenseInstanceFallback(suspenseInstance)) { + // This is a client-only boundary. Since we won't get any content from the server + // for this, we need to schedule that at a higher priority based on when it would + // have timed out. In theory we could render it in this pass but it would have the + // wrong priority associated with it and will prevent hydration of parent path. + // Instead, we'll leave work left on it to render it in a separate commit. + + // TODO This time should be the time at which the server rendered response that is + // a parent to this boundary was displayed. However, since we currently don't have + // a protocol to transfer that time, we'll just estimate it by using the current + // time. This will mean that Suspense timeouts are slightly shifted to later than + // they should be. + var serverDisplayTime = requestCurrentTime(); + // Schedule a normal pri update to render this content. + workInProgress.expirationTime = computeAsyncExpiration(serverDisplayTime); + } else { + // We'll continue hydrating the rest at offscreen priority since we'll already + // be showing the right content coming from the server, it is no rush. + workInProgress.expirationTime = Never; + } + return null; + } + + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { + // Something suspended. Leave the existing children in place. + // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far? + workInProgress.child = null; + return null; + } + + // We should never be hydrating at this point because it is the first pass, + // but after we've already committed once. + warnIfHydrating(); + + if (isSuspenseInstanceFallback(suspenseInstance)) { + // This boundary is in a permanent fallback state. In this case, we'll never + // get an update and we'll never be able to hydrate the final content. Let's just try the + // client side render instead. + return retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // We use childExpirationTime to indicate that a child might depend on context, so if + // any context has changed, we need to treat is as if the input might have changed. + var hasContextChanged$$1 = + current$$1.childExpirationTime >= renderExpirationTime; + if (didReceiveUpdate || hasContextChanged$$1) { + // This boundary has changed since the first render. This means that we are now unable to + // hydrate it. We might still be able to hydrate it using an earlier expiration time but + // during this render we can't. Instead, we're going to delete the whole subtree and + // instead inject a new real Suspense boundary to take its place, which may render content + // or fallback. The real Suspense boundary will suspend for a while so we have some time + // to ensure it can produce real content, but all state and pending events will be lost. + return retrySuspenseComponentWithoutHydrating( + current$$1, + workInProgress, + renderExpirationTime + ); + } else if (isSuspenseInstancePending(suspenseInstance)) { + // This component is still pending more data from the server, so we can't hydrate its + // content. We treat it as if this component suspended itself. It might seem as if + // we could just try to render it client-side instead. However, this will perform a + // lot of unnecessary work and is unlikely to complete since it often will suspend + // on missing data anyway. Additionally, the server might be able to render more + // than we can on the client yet. In that case we'd end up with more fallback states + // on the client than if we just leave it alone. If the server times out or errors + // these should update this boundary to the permanent Fallback state instead. + // Mark it as having captured (i.e. suspended). + workInProgress.effectTag |= DidCapture; + // Leave the children in place. I.e. empty. + workInProgress.child = null; + // Register a callback to retry this boundary once the server has sent the result. + registerSuspenseInstanceRetry( + suspenseInstance, + retryTimedOutBoundary.bind(null, current$$1) + ); + return null; + } else { + // This is the first attempt. + reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress); + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + workInProgress.child = mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; + } +} + +function propagateSuspenseContextChange( + workInProgress, + firstChild, + renderExpirationTime +) { + // Mark any Suspense boundaries with fallbacks as having work to do. + // If they were previously forced into fallbacks, they may now be able + // to unblock. + var node = firstChild; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + if (node.expirationTime < renderExpirationTime) { + node.expirationTime = renderExpirationTime; + } + var alternate = node.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + scheduleWorkOnParentPath(node.return, renderExpirationTime); + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function findLastContentRow(firstChild) { + // This is going to find the last row among these children that is already + // showing content on the screen, as opposed to being in fallback state or + // new. If a row has multiple Suspense boundaries, any of them being in the + // fallback state, counts as the whole row being in a fallback state. + // Note that the "rows" will be workInProgress, but any nested children + // will still be current since we haven't rendered them yet. The mounted + // order may not be the same as the new order. We use the new order. + var row = firstChild; + var lastContentRow = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + lastContentRow = row; + } + row = row.sibling; + } + return lastContentRow; +} + +function validateRevealOrder(revealOrder) { + { + if ( + revealOrder !== undefined && + revealOrder !== "forwards" && + revealOrder !== "backwards" && + revealOrder !== "together" && + !didWarnAboutRevealOrder[revealOrder] + ) { + didWarnAboutRevealOrder[revealOrder] = true; + if (typeof revealOrder === "string") { + switch (revealOrder.toLowerCase()) { + case "together": + case "forwards": + case "backwards": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'Use lowercase "%s" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + case "forward": + case "backward": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'React uses the -s suffix in the spelling. Use "%ss" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + default: + warning$1( + false, + '"%s" is not a supported revealOrder on . ' + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + break; + } + } else { + warning$1( + false, + "%s is not a supported value for revealOrder on . " + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + } + } + } +} + +function validateTailOptions(tailMode, revealOrder) { + { + if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { + if (tailMode !== "collapsed" && tailMode !== "hidden") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + '"%s" is not a supported value for tail on . ' + + 'Did you mean "collapsed" or "hidden"?', + tailMode + ); + } else if (revealOrder !== "forwards" && revealOrder !== "backwards") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + ' is only valid if revealOrder is ' + + '"forwards" or "backwards". ' + + 'Did you mean to specify revealOrder="forwards"?', + tailMode + ); + } + } + } +} + +function validateSuspenseListNestedChild(childSlot, index) { + { + var isArray = Array.isArray(childSlot); + var isIterable = !isArray && typeof getIteratorFn(childSlot) === "function"; + if (isArray || isIterable) { + var type = isArray ? "array" : "iterable"; + warning$1( + false, + "A nested %s was passed to row #%s in . Wrap it in " + + "an additional SuspenseList to configure its revealOrder: " + + " ... " + + "{%s} ... " + + "", + type, + index, + type + ); + return false; + } + } + return true; +} + +function validateSuspenseListChildren(children, revealOrder) { + { + if ( + (revealOrder === "forwards" || revealOrder === "backwards") && + children !== undefined && + children !== null && + children !== false + ) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + if (!validateSuspenseListNestedChild(children[i], i)) { + return; + } + } + } else { + var iteratorFn = getIteratorFn(children); + if (typeof iteratorFn === "function") { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) { + var step = childrenIterator.next(); + var _i = 0; + for (; !step.done; step = childrenIterator.next()) { + if (!validateSuspenseListNestedChild(step.value, _i)) { + return; + } + _i++; + } + } + } else { + warning$1( + false, + 'A single row was passed to a . ' + + "This is not useful since it needs multiple rows. " + + "Did you mean to pass multiple children or an array?", + revealOrder + ); + } + } + } + } +} + +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + if (renderState === null) { + workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }; + } else { + // We can reuse the existing object from previous renders. + renderState.isBackwards = isBackwards; + renderState.rendering = null; + renderState.last = lastContentRow; + renderState.tail = tail; + renderState.tailExpiration = 0; + renderState.tailMode = tailMode; + } +} + +// This can end up rendering this component multiple passes. +// The first pass splits the children fibers into two sets. A head and tail. +// We first render the head. If anything is in fallback state, we do another +// pass through beginWork to rerender all children (including the tail) with +// the force suspend context. If the first render didn't have anything in +// in fallback state. Then we render each row in the tail one-by-one. +// That happens in the completeWork phase without going back to beginWork. +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps; + var revealOrder = nextProps.revealOrder; + var tailMode = nextProps.tail; + var newChildren = nextProps.children; + + validateRevealOrder(revealOrder); + validateTailOptions(tailMode, revealOrder); + validateSuspenseListChildren(newChildren, revealOrder); + + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + + var suspenseContext = suspenseStackCursor.current; + + var shouldForceFallback = hasSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + if (shouldForceFallback) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + workInProgress.effectTag |= DidCapture; + } else { + var didSuspendBefore = + current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect; + if (didSuspendBefore) { + // If we previously forced a fallback, we need to schedule work + // on any nested boundaries to let them know to try to render + // again. This is the same as context updating. + propagateSuspenseContextChange( + workInProgress, + workInProgress.child, + renderExpirationTime + ); + } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, SuspenseList doesn't work so we just + // use make it a noop by treating it as the default revealOrder. + workInProgress.memoizedState = null; + } else { + switch (revealOrder) { + case "forwards": { + var lastContentRow = findLastContentRow(workInProgress.child); + var tail = void 0; + if (lastContentRow === null) { + // The whole list is part of the tail. + // TODO: We could fast path by just rendering the tail now. + tail = workInProgress.child; + workInProgress.child = null; + } else { + // Disconnect the tail rows after the content row. + // We're going to render them separately later. + tail = lastContentRow.sibling; + lastContentRow.sibling = null; + } + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + tail, + lastContentRow, + tailMode + ); + break; + } + case "backwards": { + // We're going to find the first row that has existing content. + // At the same time we're going to reverse the list of everything + // we pass in the meantime. That's going to be our tail in reverse + // order. + var _tail = null; + var row = workInProgress.child; + workInProgress.child = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + // This is the beginning of the main content. + workInProgress.child = row; + break; + } + var nextRow = row.sibling; + row.sibling = _tail; + _tail = row; + row = nextRow; + } + // TODO: If workInProgress.child is null, we can continue on the tail immediately. + initSuspenseListRenderState( + workInProgress, + true, // isBackwards + _tail, + null, // last + tailMode + ); + break; + } + case "together": { + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + null, // tail + null, // last + undefined + ); + break; + } + default: { + // The default reveal order is the same as not having + // a boundary. + workInProgress.memoizedState = null; + } + } + } + return workInProgress.child; +} + +function updatePortalComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + var nextChildren = workInProgress.pendingProps; + if (current$$1 === null) { + // Portals are special because we don't append the children during mount + // but at commit. Therefore we need to track insertions which the normal + // flow doesn't do during mount. This doesn't happen at the root because + // the root always starts with a "current" with a null child. + // TODO: Consider unifying this with how the root works. + workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } + return workInProgress.child; +} + +function updateContextProvider( + current$$1, + workInProgress, + renderExpirationTime +) { + var providerType = workInProgress.type; + var context = providerType._context; + + var newProps = workInProgress.pendingProps; + var oldProps = workInProgress.memoizedProps; + + var newValue = newProps.value; + + { + var providerPropTypes = workInProgress.type.propTypes; + + if (providerPropTypes) { + checkPropTypes( + providerPropTypes, + newProps, + "prop", + "Context.Provider", + getCurrentFiberStackInDev + ); + } + } + + pushProvider(workInProgress, newValue); + + if (oldProps !== null) { + var oldValue = oldProps.value; + var changedBits = calculateChangedBits(context, newValue, oldValue); + if (changedBits === 0) { + // No change. Bailout early if children are the same. + if (oldProps.children === newProps.children && !hasContextChanged()) { + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } else { + // The context value changed. Search for matching consumers and schedule + // them to update. + propagateContextChange( + workInProgress, + context, + changedBits, + renderExpirationTime + ); + } + } + + var newChildren = newProps.children; + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +var hasWarnedAboutUsingContextAsConsumer = false; + +function updateContextConsumer( + current$$1, + workInProgress, + renderExpirationTime +) { + var context = workInProgress.type; + // The logic below for Context differs depending on PROD or DEV mode. In + // DEV mode, we create a separate object for Context.Consumer that acts + // like a proxy to Context. This proxy object adds unnecessary code in PROD + // so we use the old behaviour (Context.Consumer references Context) to + // reduce size and overhead. The separate object references context via + // a property called "_context", which also gives us the ability to check + // in DEV mode if this property exists or not and warn if it does not. + { + if (context._context === undefined) { + // This may be because it's a Context (rather than a Consumer). + // Or it may be because it's older React where they're the same thing. + // We only want to warn if we're sure it's a new React. + if (context !== context.Consumer) { + if (!hasWarnedAboutUsingContextAsConsumer) { + hasWarnedAboutUsingContextAsConsumer = true; + warning$1( + false, + "Rendering directly is not supported and will be removed in " + + "a future major release. Did you mean to render instead?" + ); + } + } + } else { + context = context._context; + } + } + var newProps = workInProgress.pendingProps; + var render = newProps.children; + + { + !(typeof render === "function") + ? warningWithoutStack$1( + false, + "A context consumer was rendered with multiple children, or a child " + + "that isn't a function. A context consumer expects a single child " + + "that is a function. If you did pass a function, make sure there " + + "is no trailing or leading whitespace around it." + ) + : void 0; + } + + prepareToReadContext(workInProgress, renderExpirationTime); + var newValue = readContext(context, newProps.unstable_observedBits); + var newChildren = void 0; + { + ReactCurrentOwner$3.current = workInProgress; + setCurrentPhase("render"); + newChildren = render(newValue); + setCurrentPhase(null); + } + + // React DevTools reads this flag. + workInProgress.effectTag |= PerformedWork; + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function updateFundamentalComponent$1( + current$$1, + workInProgress, + renderExpirationTime +) { + var fundamentalImpl = workInProgress.type.impl; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + return workInProgress.child; +} + +function markWorkInProgressReceivedUpdate() { + didReceiveUpdate = true; +} + +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + cancelWorkTimer(workInProgress); + + if (current$$1 !== null) { + // Reuse previous dependencies + workInProgress.dependencies = current$$1.dependencies; + } + + if (enableProfilerTimer) { + // Don't update "base" render times for bailouts. + stopProfilerTimerIfRunning(workInProgress); + } + + // Check if the children have any pending work. + var childExpirationTime = workInProgress.childExpirationTime; + if (childExpirationTime < renderExpirationTime) { + // The children don't have any work either. We can skip them. + // TODO: Once we add back resuming, we should check if the children are + // a work-in-progress set. If so, we need to transfer their effects. + return null; + } else { + // This fiber doesn't have work, but its subtree does. Clone the child + // fibers and continue. + cloneChildFibers(current$$1, workInProgress); + return workInProgress.child; + } +} + +function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) { + { + var returnFiber = oldWorkInProgress.return; + if (returnFiber === null) { + throw new Error("Cannot swap the root fiber."); + } + + // Disconnect from the old current. + // It will get deleted. + current$$1.alternate = null; + oldWorkInProgress.alternate = null; + + // Connect to the new tree. + newWorkInProgress.index = oldWorkInProgress.index; + newWorkInProgress.sibling = oldWorkInProgress.sibling; + newWorkInProgress.return = oldWorkInProgress.return; + newWorkInProgress.ref = oldWorkInProgress.ref; + + // Replace the child/sibling pointers above it. + if (oldWorkInProgress === returnFiber.child) { + returnFiber.child = newWorkInProgress; + } else { + var prevSibling = returnFiber.child; + if (prevSibling === null) { + throw new Error("Expected parent to have a child."); + } + while (prevSibling.sibling !== oldWorkInProgress) { + prevSibling = prevSibling.sibling; + if (prevSibling === null) { + throw new Error("Expected to find the previous sibling."); + } + } + prevSibling.sibling = newWorkInProgress; + } + + // Delete the old fiber and place the new one. + // Since the old fiber is disconnected, we have to schedule it manually. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + newWorkInProgress.effectTag |= Placement; + + // Restart work from the new fiber. + return newWorkInProgress; + } +} + +function beginWork$1(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + + { + if (workInProgress._debugNeedsRemount && current$$1 !== null) { + // This will restart the begin phase with a new fiber. + return remountFiber( + current$$1, + workInProgress, + createFiberFromTypeAndProps( + workInProgress.type, + workInProgress.key, + workInProgress.pendingProps, + workInProgress._debugOwner || null, + workInProgress.mode, + workInProgress.expirationTime + ) + ); + } + } + + if (current$$1 !== null) { + var oldProps = current$$1.memoizedProps; + var newProps = workInProgress.pendingProps; + + if ( + oldProps !== newProps || + hasContextChanged() || + // Force a re-render if the implementation changed due to hot reload: + workInProgress.type !== current$$1.type + ) { + // If props or context changed, mark the fiber as having performed work. + // This may be unset if the props are determined to be equal later (memo). + didReceiveUpdate = true; + } else if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = false; + // This fiber does not have any pending work. Bailout without entering + // the begin phase. There's still some bookkeeping we that needs to be done + // in this optimized path, mostly pushing stuff onto the stack. + switch (workInProgress.tag) { + case HostRoot: + pushHostRootContext(workInProgress); + resetHydrationState(); + break; + case HostComponent: + pushHostContext(workInProgress); + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(workInProgress.type, newProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } + break; + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + pushContextProvider(workInProgress); + } + break; + } + case HostPortal: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case ContextProvider: { + var newValue = workInProgress.memoizedProps.value; + pushProvider(workInProgress, newValue); + break; + } + case Profiler: + if (enableProfilerTimer) { + workInProgress.effectTag |= Update; + } + break; + case SuspenseComponent: { + var state = workInProgress.memoizedState; + var didTimeout = state !== null; + if (didTimeout) { + // If this boundary is currently timed out, we need to decide + // whether to retry the primary children, or to skip over it and + // go straight to the fallback. Check the priority of the primary + var primaryChildFragment = workInProgress.child; + var primaryChildExpirationTime = + primaryChildFragment.childExpirationTime; + if ( + primaryChildExpirationTime !== NoWork && + primaryChildExpirationTime >= renderExpirationTime + ) { + // The primary children have pending work. Use the normal path + // to attempt to render the primary children again. + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + // The primary children do not have pending work with sufficient + // priority. Bailout. + var child = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + if (child !== null) { + // The fallback children have pending work. Skip over the + // primary children and work on the fallback. + return child.sibling; + } else { + return null; + } + } + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + } + break; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); + // We know that this component will suspend again because if it has + // been unsuspended it has committed as a regular Suspense component. + // If it needs to be retried, it should have work scheduled on it. + workInProgress.effectTag |= DidCapture; + } + break; + } + case SuspenseListComponent: { + var didSuspendBefore = + (current$$1.effectTag & DidCapture) !== NoEffect; + + var hasChildWork = + workInProgress.childExpirationTime >= renderExpirationTime; + + if (didSuspendBefore) { + if (hasChildWork) { + // If something was in fallback state last time, and we have all the + // same children then we're still in progressive loading state. + // Something might get unblocked by state updates or retries in the + // tree which will affect the tail. So we need to use the normal + // path to compute the correct tail. + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + workInProgress.effectTag |= DidCapture; + } + + // If nothing suspended before and we're rendering the same children, + // then the tail doesn't matter. Anything new that suspends will work + // in the "together" mode, so we can continue from the state we had. + var renderState = workInProgress.memoizedState; + if (renderState !== null) { + // Reset to the "together" mode in case we've started a different + // update in the past but didn't complete it. + renderState.rendering = null; + renderState.tail = null; + } + pushSuspenseContext(workInProgress, suspenseStackCursor.current); + + if (hasChildWork) { + break; + } else { + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + return null; + } + } + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } else { + didReceiveUpdate = false; + } + + // Before entering the begin phase, clear the expiration time. + workInProgress.expirationTime = NoWork; + + switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current$$1, + workInProgress, + workInProgress.type, + renderExpirationTime + ); + } + case LazyComponent: { + var elementType = workInProgress.elementType; + return mountLazyComponent( + current$$1, + workInProgress, + elementType, + updateExpirationTime, + renderExpirationTime + ); + } + case FunctionComponent: { + var _Component = workInProgress.type; + var unresolvedProps = workInProgress.pendingProps; + var resolvedProps = + workInProgress.elementType === _Component + ? unresolvedProps + : resolveDefaultProps(_Component, unresolvedProps); + return updateFunctionComponent( + current$$1, + workInProgress, + _Component, + resolvedProps, + renderExpirationTime + ); + } + case ClassComponent: { + var _Component2 = workInProgress.type; + var _unresolvedProps = workInProgress.pendingProps; + var _resolvedProps = + workInProgress.elementType === _Component2 + ? _unresolvedProps + : resolveDefaultProps(_Component2, _unresolvedProps); + return updateClassComponent( + current$$1, + workInProgress, + _Component2, + _resolvedProps, + renderExpirationTime + ); + } + case HostRoot: + return updateHostRoot(current$$1, workInProgress, renderExpirationTime); + case HostComponent: + return updateHostComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case HostText: + return updateHostText(current$$1, workInProgress); + case SuspenseComponent: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case HostPortal: + return updatePortalComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case ForwardRef: { + var type = workInProgress.type; + var _unresolvedProps2 = workInProgress.pendingProps; + var _resolvedProps2 = + workInProgress.elementType === type + ? _unresolvedProps2 + : resolveDefaultProps(type, _unresolvedProps2); + return updateForwardRef( + current$$1, + workInProgress, + type, + _resolvedProps2, + renderExpirationTime + ); + } + case Fragment: + return updateFragment(current$$1, workInProgress, renderExpirationTime); + case Mode: + return updateMode(current$$1, workInProgress, renderExpirationTime); + case Profiler: + return updateProfiler(current$$1, workInProgress, renderExpirationTime); + case ContextProvider: + return updateContextProvider( + current$$1, + workInProgress, + renderExpirationTime + ); + case ContextConsumer: + return updateContextConsumer( + current$$1, + workInProgress, + renderExpirationTime + ); + case MemoComponent: { + var _type2 = workInProgress.type; + var _unresolvedProps3 = workInProgress.pendingProps; + // Resolve outer props first, then resolve inner props. + var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); + { + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = _type2.propTypes; + if (outerPropTypes) { + checkPropTypes( + outerPropTypes, + _resolvedProps3, // Resolved for outer only + "prop", + getComponentName(_type2), + getCurrentFiberStackInDev + ); + } + } + } + _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); + return updateMemoComponent( + current$$1, + workInProgress, + _type2, + _resolvedProps3, + updateExpirationTime, + renderExpirationTime + ); + } + case SimpleMemoComponent: { + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + } + case IncompleteClassComponent: { + var _Component3 = workInProgress.type; + var _unresolvedProps4 = workInProgress.pendingProps; + var _resolvedProps4 = + workInProgress.elementType === _Component3 + ? _unresolvedProps4 + : resolveDefaultProps(_Component3, _unresolvedProps4); + return mountIncompleteClassComponent( + current$$1, + workInProgress, + _Component3, + _resolvedProps4, + renderExpirationTime + ); + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + return updateDehydratedSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + break; + } + case SuspenseListComponent: { + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + return updateFundamentalComponent$1( + current$$1, + workInProgress, + renderExpirationTime + ); + } + break; + } + } + (function() { + { + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +function createFundamentalStateInstance(currentFiber, props, impl, state) { + return { + currentFiber: currentFiber, + impl: impl, + instance: null, + prevProps: null, + props: props, + state: state + }; +} + +var emptyObject$1 = {}; +var isArray$2 = Array.isArray; + +function markUpdate(workInProgress) { + // Tag the fiber with an update effect. This turns a Placement into + // a PlacementAndUpdate. + workInProgress.effectTag |= Update; +} + +function markRef$1(workInProgress) { + workInProgress.effectTag |= Ref; +} + +var appendAllChildren = void 0; +var updateHostContainer = void 0; +var updateHostComponent$1 = void 0; +var updateHostText$1 = void 0; +if (supportsMutation) { + // Mutation mode + + appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + if (node.tag === HostComponent || node.tag === HostText) { + appendInitialChild(parent, node.stateNode); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + appendInitialChild(parent, node.stateNode.instance); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + + updateHostContainer = function(workInProgress) { + // Noop + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + // If we have an alternate, that means this is an update and we need to + // schedule a side-effect to do the updates. + var oldProps = current.memoizedProps; + if (oldProps === newProps) { + // In mutation mode, this is sufficient for a bailout because + // we won't touch this node even if children changed. + return; + } + + // If we get updated because one of our children updated, we don't + // have newProps so we'll have to reuse them. + // TODO: Split the update API as separate for the props vs. children. + // Even better would be if children weren't special cased at all tho. + var instance = workInProgress.stateNode; + var currentHostContext = getHostContext(); + // TODO: Experiencing an error where oldProps is null. Suggests a host + // component is hitting the resume path. Figure out why. Possibly + // related to `hidden`. + var updatePayload = prepareUpdate( + instance, + type, + oldProps, + newProps, + rootContainerInstance, + currentHostContext + ); + // TODO: Type this specific to this type of component. + workInProgress.updateQueue = updatePayload; + // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. All the work is done in commitWork. + if (updatePayload) { + markUpdate(workInProgress); + } + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + // If the text differs, mark it as an update. All the work in done in commitWork. + if (oldText !== newText) { + markUpdate(workInProgress); + } + }; +} else if (supportsPersistence) { + // Persistent host tree mode + + appendAllChildren = function( + parent, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + // eslint-disable-next-line no-labels + branches: if (node.tag === HostComponent) { + var instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var props = node.memoizedProps; + var type = node.type; + instance = cloneHiddenInstance(instance, type, props, node); + } + appendInitialChild(parent, instance); + } else if (node.tag === HostText) { + var _instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var text = node.memoizedProps; + _instance = cloneHiddenTextInstance(_instance, text, node); + } + appendInitialChild(parent, _instance); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance2 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props = node.memoizedProps; + var _type = node.type; + _instance2 = cloneHiddenInstance(_instance2, _type, _props, node); + } + appendInitialChild(parent, _instance2); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.tag === SuspenseComponent) { + if ((node.effectTag & Update) !== NoEffect) { + // Need to toggle the visibility of the primary children. + var newIsHidden = node.memoizedState !== null; + if (newIsHidden) { + var primaryChildParent = node.child; + if (primaryChildParent !== null) { + if (primaryChildParent.child !== null) { + primaryChildParent.child.return = primaryChildParent; + appendAllChildren( + parent, + primaryChildParent, + true, + newIsHidden + ); + } + var fallbackChildParent = primaryChildParent.sibling; + if (fallbackChildParent !== null) { + fallbackChildParent.return = node; + node = fallbackChildParent; + continue; + } + } + } + } + if (node.child !== null) { + // Continue traversing like normal + node.child.return = node; + node = node.child; + continue; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + // $FlowFixMe This is correct but Flow is confused by the labeled break. + node = node; + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + + // An unfortunate fork of appendAllChildren because we have two different parent types. + var appendAllChildrenToContainer = function( + containerChildSet, + workInProgress, + needsVisibilityToggle, + isHidden + ) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while (node !== null) { + // eslint-disable-next-line no-labels + branches: if (node.tag === HostComponent) { + var instance = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var props = node.memoizedProps; + var type = node.type; + instance = cloneHiddenInstance(instance, type, props, node); + } + appendChildToContainerChildSet(containerChildSet, instance); + } else if (node.tag === HostText) { + var _instance3 = node.stateNode; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var text = node.memoizedProps; + _instance3 = cloneHiddenTextInstance(_instance3, text, node); + } + appendChildToContainerChildSet(containerChildSet, _instance3); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance4 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props2 = node.memoizedProps; + var _type2 = node.type; + _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node); + } + appendChildToContainerChildSet(containerChildSet, _instance4); + } else if (node.tag === HostPortal) { + // If we have a portal child, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.tag === SuspenseComponent) { + if ((node.effectTag & Update) !== NoEffect) { + // Need to toggle the visibility of the primary children. + var newIsHidden = node.memoizedState !== null; + if (newIsHidden) { + var primaryChildParent = node.child; + if (primaryChildParent !== null) { + if (primaryChildParent.child !== null) { + primaryChildParent.child.return = primaryChildParent; + appendAllChildrenToContainer( + containerChildSet, + primaryChildParent, + true, + newIsHidden + ); + } + var fallbackChildParent = primaryChildParent.sibling; + if (fallbackChildParent !== null) { + fallbackChildParent.return = node; + node = fallbackChildParent; + continue; + } + } + } + } + if (node.child !== null) { + // Continue traversing like normal + node.child.return = node; + node = node.child; + continue; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + // $FlowFixMe This is correct but Flow is confused by the labeled break. + node = node; + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + updateHostContainer = function(workInProgress) { + var portalOrRoot = workInProgress.stateNode; + var childrenUnchanged = workInProgress.firstEffect === null; + if (childrenUnchanged) { + // No changes, just reuse the existing instance. + } else { + var container = portalOrRoot.containerInfo; + var newChildSet = createContainerChildSet(container); + // If children might have changed, we have to add them all to the set. + appendAllChildrenToContainer(newChildSet, workInProgress, false, false); + portalOrRoot.pendingChildren = newChildSet; + // Schedule an update on the container to swap out the container. + markUpdate(workInProgress); + finalizeContainerChildren(container, newChildSet); + } + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + var currentInstance = current.stateNode; + var oldProps = current.memoizedProps; + // If there are no effects associated with this node, then none of our children had any updates. + // This guarantees that we can reuse all of them. + var childrenUnchanged = workInProgress.firstEffect === null; + if (childrenUnchanged && oldProps === newProps) { + // No changes, just reuse the existing instance. + // Note that this might release a previous clone. + workInProgress.stateNode = currentInstance; + return; + } + var recyclableInstance = workInProgress.stateNode; + var currentHostContext = getHostContext(); + var updatePayload = null; + if (oldProps !== newProps) { + updatePayload = prepareUpdate( + recyclableInstance, + type, + oldProps, + newProps, + rootContainerInstance, + currentHostContext + ); + } + if (childrenUnchanged && updatePayload === null) { + // No changes, just reuse the existing instance. + // Note that this might release a previous clone. + workInProgress.stateNode = currentInstance; + return; + } + var newInstance = cloneInstance( + currentInstance, + updatePayload, + type, + oldProps, + newProps, + workInProgress, + childrenUnchanged, + recyclableInstance + ); + if ( + finalizeInitialChildren( + newInstance, + type, + newProps, + rootContainerInstance, + currentHostContext + ) + ) { + markUpdate(workInProgress); + } + workInProgress.stateNode = newInstance; + if (childrenUnchanged) { + // If there are no other effects in this tree, we need to flag this node as having one. + // Even though we're not going to use it for anything. + // Otherwise parents won't know that there are new children to propagate upwards. + markUpdate(workInProgress); + } else { + // If children might have changed, we have to add them all to the set. + appendAllChildren(newInstance, workInProgress, false, false); + } + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + if (oldText !== newText) { + // If the text content differs, we'll create a new text instance for it. + var rootContainerInstance = getRootHostContainer(); + var currentHostContext = getHostContext(); + workInProgress.stateNode = createTextInstance( + newText, + rootContainerInstance, + currentHostContext, + workInProgress + ); + // We'll have to mark it as having an effect, even though we won't use the effect for anything. + // This lets the parents know that at least one of their children has changed. + markUpdate(workInProgress); + } + }; +} else { + // No host operations + updateHostContainer = function(workInProgress) { + // Noop + }; + updateHostComponent$1 = function( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ) { + // Noop + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + // Noop + }; +} + +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var tailNode = renderState.tail; + var lastTailNode = null; + while (tailNode !== null) { + if (tailNode.alternate !== null) { + lastTailNode = tailNode; + } + tailNode = tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (lastTailNode === null) { + // All remaining items in the tail are insertions. + renderState.tail = null; + } else { + // Detach the insertion after the last node that was already + // inserted. + lastTailNode.sibling = null; + } + break; + } + case "collapsed": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var _tailNode = renderState.tail; + var _lastTailNode = null; + while (_tailNode !== null) { + if (_tailNode.alternate !== null) { + _lastTailNode = _tailNode; + } + _tailNode = _tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (_lastTailNode === null) { + // All remaining items in the tail are insertions. + if (!hasRenderedATailFallback && renderState.tail !== null) { + // We suspended during the head. We want to show at least one + // row at the tail. So we'll keep on and cut off the rest. + renderState.tail.sibling = null; + } else { + renderState.tail = null; + } + } else { + // Detach the insertion after the last node that was already + // inserted. + _lastTailNode.sibling = null; + } + break; + } + } +} + +function completeWork(current, workInProgress, renderExpirationTime) { + var newProps = workInProgress.pendingProps; + + switch (workInProgress.tag) { + case IndeterminateComponent: + break; + case LazyComponent: + break; + case SimpleMemoComponent: + case FunctionComponent: + break; + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + break; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var fiberRoot = workInProgress.stateNode; + if (fiberRoot.pendingContext) { + fiberRoot.context = fiberRoot.pendingContext; + fiberRoot.pendingContext = null; + } + if (current === null || current.child === null) { + // If we hydrated, pop so that we can delete any remaining children + // that weren't hydrated. + popHydrationState(workInProgress); + // This resets the hacky state to fix isMounted before committing. + // TODO: Delete this when we delete isMounted and findDOMNode. + workInProgress.effectTag &= ~Placement; + } + updateHostContainer(workInProgress); + break; + } + case HostComponent: { + popHostContext(workInProgress); + var rootContainerInstance = getRootHostContainer(); + var type = workInProgress.type; + if (current !== null && workInProgress.stateNode != null) { + updateHostComponent$1( + current, + workInProgress, + type, + newProps, + rootContainerInstance + ); + + if (enableFlareAPI) { + var prevListeners = current.memoizedProps.listeners; + var nextListeners = newProps.listeners; + var instance = workInProgress.stateNode; + if (prevListeners !== nextListeners) { + updateEventListeners( + nextListeners, + instance, + rootContainerInstance, + workInProgress + ); + } + } + + if (current.ref !== workInProgress.ref) { + markRef$1(workInProgress); + } + } else { + if (!newProps) { + (function() { + if (!(workInProgress.stateNode !== null)) { + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + // This can happen when we abort work. + break; + } + + var currentHostContext = getHostContext(); + // TODO: Move createInstance to beginWork and keep it on a context + // "stack" as the parent. Then append children as we go in beginWork + // or completeWork depending on we want to add then top->down or + // bottom->up. Top->down is faster in IE11. + var wasHydrated = popHydrationState(workInProgress); + if (wasHydrated) { + // TODO: Move this and createInstance step into the beginPhase + // to consolidate. + if ( + prepareToHydrateHostInstance( + workInProgress, + rootContainerInstance, + currentHostContext + ) + ) { + // If changes to the hydrated node needs to be applied at the + // commit-phase we mark this as such. + markUpdate(workInProgress); + } + if (enableFlareAPI) { + var _instance5 = workInProgress.stateNode; + var listeners = newProps.listeners; + if (listeners != null) { + updateEventListeners( + listeners, + _instance5, + rootContainerInstance, + workInProgress + ); + } + } + } else { + var _instance6 = createInstance( + type, + newProps, + rootContainerInstance, + currentHostContext, + workInProgress + ); + + appendAllChildren(_instance6, workInProgress, false, false); + + if (enableFlareAPI) { + var _listeners = newProps.listeners; + if (_listeners != null) { + updateEventListeners( + _listeners, + _instance6, + rootContainerInstance, + workInProgress + ); + } + } + + // Certain renderers require commit-time effects for initial mount. + // (eg DOM renderer supports auto-focus for certain elements). + // Make sure such renderers get scheduled for later work. + if ( + finalizeInitialChildren( + _instance6, + type, + newProps, + rootContainerInstance, + currentHostContext + ) + ) { + markUpdate(workInProgress); + } + workInProgress.stateNode = _instance6; + } + + if (workInProgress.ref !== null) { + // If there is a ref on a host node we need to schedule a callback + markRef$1(workInProgress); + } + } + break; + } + case HostText: { + var newText = newProps; + if (current && workInProgress.stateNode != null) { + var oldText = current.memoizedProps; + // If we have an alternate, that means this is an update and we need + // to schedule a side-effect to do the updates. + updateHostText$1(current, workInProgress, oldText, newText); + } else { + if (typeof newText !== "string") { + (function() { + if (!(workInProgress.stateNode !== null)) { + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + // This can happen when we abort work. + } + var _rootContainerInstance = getRootHostContainer(); + var _currentHostContext = getHostContext(); + var _wasHydrated = popHydrationState(workInProgress); + if (_wasHydrated) { + if (prepareToHydrateHostTextInstance(workInProgress)) { + markUpdate(workInProgress); + } + } else { + workInProgress.stateNode = createTextInstance( + newText, + _rootContainerInstance, + _currentHostContext, + workInProgress + ); + } + } + break; + } + case ForwardRef: + break; + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var nextState = workInProgress.memoizedState; + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { + // Something suspended. Re-render with the fallback children. + workInProgress.expirationTime = renderExpirationTime; + // Do not reset the effect list. + return workInProgress; + } + + var nextDidTimeout = nextState !== null; + var prevDidTimeout = false; + if (current === null) { + // In cases where we didn't find a suitable hydration boundary we never + // downgraded this to a DehydratedSuspenseComponent, but we still need to + // pop the hydration state since we might be inside the insertion tree. + popHydrationState(workInProgress); + } else { + var prevState = current.memoizedState; + prevDidTimeout = prevState !== null; + if (!nextDidTimeout && prevState !== null) { + // We just switched from the fallback to the normal children. + // Delete the fallback. + // TODO: Would it be better to store the fallback fragment on + var currentFallbackChild = current.child.sibling; + if (currentFallbackChild !== null) { + // Deletions go at the beginning of the return fiber's effect list + var first = workInProgress.firstEffect; + if (first !== null) { + workInProgress.firstEffect = currentFallbackChild; + currentFallbackChild.nextEffect = first; + } else { + workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild; + currentFallbackChild.nextEffect = null; + } + currentFallbackChild.effectTag = Deletion; + } + } + } + + if (nextDidTimeout && !prevDidTimeout) { + // If this subtreee is running in batched mode we can suspend, + // otherwise we won't suspend. + // TODO: This will still suspend a synchronous tree if anything + // in the concurrent tree already suspended during this render. + // This is a known bug. + if ((workInProgress.mode & BatchedMode) !== NoMode) { + // TODO: Move this back to throwException because this is too late + // if this is a large tree which is common for initial loads. We + // don't know if we should restart a render or not until we get + // this marker, and this is too late. + // If this render already had a ping or lower pri updates, + // and this is the first time we know we're going to suspend we + // should be able to immediately restart from within throwException. + var hasInvisibleChildContext = + current === null && + workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + if ( + hasInvisibleChildContext || + hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ) + ) { + // If this was in an invisible tree or a new render, then showing + // this boundary is ok. + renderDidSuspend(); + } else { + // Otherwise, we're going to have to hide content so we should + // suspend for longer if possible. + renderDidSuspendDelayIfPossible(); + } + } + } + + if (supportsPersistence) { + // TODO: Only schedule updates if not prevDidTimeout. + if (nextDidTimeout) { + // If this boundary just timed out, schedule an effect to attach a + // retry listener to the proimse. This flag is also used to hide the + // primary children. + workInProgress.effectTag |= Update; + } + } + if (supportsMutation) { + // TODO: Only schedule updates if these values are non equal, i.e. it changed. + if (nextDidTimeout || prevDidTimeout) { + // If this boundary just timed out, schedule an effect to attach a + // retry listener to the proimse. This flag is also used to hide the + // primary children. In mutation mode, we also need the flag to + // *unhide* children that were previously hidden, so check if the + // is currently timed out, too. + workInProgress.effectTag |= Update; + } + } + if ( + enableSuspenseCallback && + workInProgress.updateQueue !== null && + workInProgress.memoizedProps.suspenseCallback != null + ) { + // Always notify the callback + workInProgress.effectTag |= Update; + } + break; + } + case Fragment: + break; + case Mode: + break; + case Profiler: + break; + case HostPortal: + popHostContainer(workInProgress); + updateHostContainer(workInProgress); + break; + case ContextProvider: + // Pop provider fiber + popProvider(workInProgress); + break; + case ContextConsumer: + break; + case MemoComponent: + break; + case IncompleteClassComponent: { + // Same as class component case. I put it down here so that the tags are + // sequential to ensure this switch is compiled to a jump table. + var _Component = workInProgress.type; + if (isContextProvider(_Component)) { + popContext(workInProgress); + } + break; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (current === null) { + var _wasHydrated2 = popHydrationState(workInProgress); + (function() { + if (!_wasHydrated2) { + throw ReactError( + Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ) + ); + } + })(); + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + skipPastDehydratedSuspenseInstance(workInProgress); + } else { + // We should never have been in a hydration state if we didn't have a current. + // However, in some of those paths, we might have reentered a hydration state + // and then we might be inside a hydration state. In that case, we'll need to + // exit out of it. + resetHydrationState(); + if ((workInProgress.effectTag & DidCapture) === NoEffect) { + // This boundary did not suspend so it's now hydrated. + // To handle any future suspense cases, we're going to now upgrade it + // to a Suspense component. We detach it from the existing current fiber. + current.alternate = null; + workInProgress.alternate = null; + workInProgress.tag = SuspenseComponent; + workInProgress.memoizedState = null; + workInProgress.stateNode = null; + } + } + } + break; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + + var renderState = workInProgress.memoizedState; + + if (renderState === null) { + // We're running in the default, "independent" mode. We don't do anything + // in this mode. + break; + } + + var didSuspendAlready = + (workInProgress.effectTag & DidCapture) !== NoEffect; + + var renderedTail = renderState.rendering; + if (renderedTail === null) { + // We just rendered the head. + if (!didSuspendAlready) { + // This is the first pass. We need to figure out if anything is still + // suspended in the rendered set. + + // If new content unsuspended, but there's still some content that + // didn't. Then we need to do a second pass that forces everything + // to keep showing their fallbacks. + + // We might be suspended if something in this render pass suspended, or + // something in the previous committed pass suspended. Otherwise, + // there's no chance so we can skip the expensive call to + // findFirstSuspended. + var cannotBeSuspended = + renderHasNotSuspendedYet() && + (current === null || (current.effectTag & DidCapture) === NoEffect); + if (!cannotBeSuspended) { + var row = workInProgress.child; + while (row !== null) { + var suspended = findFirstSuspended(row); + if (suspended !== null) { + didSuspendAlready = true; + workInProgress.effectTag |= DidCapture; + cutOffTailIfNeeded(renderState, false); + + // If this is a newly suspended tree, it might not get committed as + // part of the second pass. In that case nothing will subscribe to + // its thennables. Instead, we'll transfer its thennables to the + // SuspenseList so that it can retry if they resolve. + // There might be multiple of these in the list but since we're + // going to wait for all of them anyway, it doesn't really matter + // which ones gets to ping. In theory we could get clever and keep + // track of how many dependencies remain but it gets tricky because + // in the meantime, we can add/remove/change items and dependencies. + // We might bail out of the loop before finding any but that + // doesn't matter since that means that the other boundaries that + // we did find already has their listeners attached. + var newThennables = suspended.updateQueue; + if (newThennables !== null) { + workInProgress.updateQueue = newThennables; + workInProgress.effectTag |= Update; + } + + // Rerender the whole list, but this time, we'll force fallbacks + // to stay in place. + // Reset the effect list before doing the second pass since that's now invalid. + workInProgress.firstEffect = workInProgress.lastEffect = null; + // Reset the child fibers to their original state. + resetChildFibers(workInProgress, renderExpirationTime); + + // Set up the Suspense Context to force suspense and immediately + // rerender the children. + pushSuspenseContext( + workInProgress, + setShallowSuspenseContext( + suspenseStackCursor.current, + ForceSuspenseFallback + ) + ); + return workInProgress.child; + } + row = row.sibling; + } + } + } else { + cutOffTailIfNeeded(renderState, false); + } + // Next we're going to render the tail. + } else { + // Append the rendered row to the child list. + if (!didSuspendAlready) { + var _suspended = findFirstSuspended(renderedTail); + if (_suspended !== null) { + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, true); + // This might have been modified. + if ( + renderState.tail === null && + renderState.tailMode === "hidden" + ) { + // We need to delete the row we just rendered. + // Ensure we transfer the update queue to the parent. + var _newThennables = _suspended.updateQueue; + if (_newThennables !== null) { + workInProgress.updateQueue = _newThennables; + workInProgress.effectTag |= Update; + } + // Reset the effect list to what it w as before we rendered this + // child. The nested children have already appended themselves. + var lastEffect = (workInProgress.lastEffect = + renderState.lastEffect); + // Remove any effects that were appended after this point. + if (lastEffect !== null) { + lastEffect.nextEffect = null; + } + // We're done. + return null; + } + } else if ( + now() > renderState.tailExpiration && + renderExpirationTime > Never + ) { + // We have now passed our CPU deadline and we'll just give up further + // attempts to render the main content and only render fallbacks. + // The assumption is that this is usually faster. + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + + cutOffTailIfNeeded(renderState, false); + + // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. If we can show + // them, then they really have the same priority as this render. + // So we'll pick it back up the very next render pass once we've had + // an opportunity to yield for paint. + + var nextPriority = renderExpirationTime - 1; + workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority; + if (enableSchedulerTracing) { + markSpawnedWork(nextPriority); + } + } + } + if (renderState.isBackwards) { + // The effect list of the backwards tail will have been added + // to the end. This breaks the guarantee that life-cycles fire in + // sibling order but that isn't a strong guarantee promised by React. + // Especially since these might also just pop in during future commits. + // Append to the beginning of the list. + renderedTail.sibling = workInProgress.child; + workInProgress.child = renderedTail; + } else { + var previousSibling = renderState.last; + if (previousSibling !== null) { + previousSibling.sibling = renderedTail; + } else { + workInProgress.child = renderedTail; + } + renderState.last = renderedTail; + } + } + + if (renderState.tail !== null) { + // We still have tail rows to render. + if (renderState.tailExpiration === 0) { + // Heuristic for how long we're willing to spend rendering rows + // until we just give up and show what we have so far. + var TAIL_EXPIRATION_TIMEOUT_MS = 500; + renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; + } + // Pop a row. + var next = renderState.tail; + renderState.rendering = next; + renderState.tail = next.sibling; + renderState.lastEffect = workInProgress.lastEffect; + next.sibling = null; + + // Restore the context. + // TODO: We can probably just avoid popping it instead and only + // setting it the first time we go from not suspended to suspended. + var suspenseContext = suspenseStackCursor.current; + if (didSuspendAlready) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + } else { + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + // Do a pass over the next row. + return next; + } + break; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalImpl = workInProgress.type.impl; + var fundamentalInstance = workInProgress.stateNode; + + if (fundamentalInstance === null) { + var getInitialState = fundamentalImpl.getInitialState; + var fundamentalState = void 0; + if (getInitialState !== undefined) { + fundamentalState = getInitialState(newProps); + } + fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance( + workInProgress, + newProps, + fundamentalImpl, + fundamentalState || {} + ); + var _instance7 = getFundamentalComponentInstance(fundamentalInstance); + fundamentalInstance.instance = _instance7; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + appendAllChildren(_instance7, workInProgress, false, false); + mountFundamentalComponent(fundamentalInstance); + } else { + // We fire update in commit phase + var prevProps = fundamentalInstance.props; + fundamentalInstance.prevProps = prevProps; + fundamentalInstance.props = newProps; + fundamentalInstance.currentFiber = workInProgress; + if (supportsPersistence) { + var _instance8 = cloneFundamentalInstance(fundamentalInstance); + fundamentalInstance.instance = _instance8; + appendAllChildren(_instance8, workInProgress, false, false); + } + var shouldUpdate = shouldUpdateFundamentalComponent( + fundamentalInstance + ); + if (shouldUpdate) { + markUpdate(workInProgress); + } + } + } + break; + } + default: + (function() { + { + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + + return null; +} + +function mountEventResponder( + responder, + responderProps, + instance, + rootContainerInstance, + fiber, + respondersMap +) { + var responderState = emptyObject$1; + var getInitialState = responder.getInitialState; + if (getInitialState !== null) { + responderState = getInitialState(responderProps); + } + var responderInstance = createResponderInstance( + responder, + responderProps, + responderState, + instance, + fiber + ); + mountResponderInstance( + responder, + responderInstance, + responderProps, + responderState, + instance, + rootContainerInstance + ); + respondersMap.set(responder, responderInstance); +} + +function updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance +) { + var responder = void 0; + var props = void 0; + + if (listener) { + responder = listener.responder; + props = listener.props; + } + (function() { + if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) { + throw ReactError( + Error( + "An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer()." + ) + ); + } + })(); + var listenerProps = props; + if (visistedResponders.has(responder)) { + // show warning + { + warning$1( + false, + 'Duplicate event responder "%s" found in event listeners. ' + + "Event listeners passed to elements cannot use the same event responder more than once.", + responder.displayName + ); + } + return; + } + visistedResponders.add(responder); + var responderInstance = respondersMap.get(responder); + + if (responderInstance === undefined) { + // Mount + mountEventResponder( + responder, + listenerProps, + instance, + rootContainerInstance, + fiber, + respondersMap + ); + } else { + // Update + responderInstance.props = listenerProps; + responderInstance.fiber = fiber; + } +} + +function updateEventListeners( + listeners, + instance, + rootContainerInstance, + fiber +) { + var visistedResponders = new Set(); + var dependencies = fiber.dependencies; + if (listeners != null) { + if (dependencies === null) { + dependencies = fiber.dependencies = { + expirationTime: NoWork, + firstContext: null, + responders: new Map() + }; + } + var respondersMap = dependencies.responders; + if (respondersMap === null) { + respondersMap = new Map(); + } + if (isArray$2(listeners)) { + for (var i = 0, length = listeners.length; i < length; i++) { + var listener = listeners[i]; + updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } else { + updateEventListener( + listeners, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } + if (dependencies !== null) { + var _respondersMap = dependencies.responders; + if (_respondersMap !== null) { + // Unmount + var mountedResponders = Array.from(_respondersMap.keys()); + for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) { + var mountedResponder = mountedResponders[_i]; + if (!visistedResponders.has(mountedResponder)) { + var responderInstance = _respondersMap.get(mountedResponder); + unmountResponderInstance(responderInstance); + _respondersMap.delete(mountedResponder); + } + } + } + } +} + +function unwindWork(workInProgress, renderExpirationTime) { + switch (workInProgress.tag) { + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + var effectTag = workInProgress.effectTag; + if (effectTag & ShouldCapture) { + workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + return null; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var _effectTag = workInProgress.effectTag; + (function() { + if (!((_effectTag & DidCapture) === NoEffect)) { + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + case HostComponent: { + // TODO: popHydrationState + popHostContext(workInProgress); + return null; + } + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var _effectTag2 = workInProgress.effectTag; + if (_effectTag2 & ShouldCapture) { + workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + return null; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (workInProgress.alternate === null) { + // TODO: popHydrationState + } else { + resetHydrationState(); + } + var _effectTag3 = workInProgress.effectTag; + if (_effectTag3 & ShouldCapture) { + workInProgress.effectTag = + (_effectTag3 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + } + return null; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + // SuspenseList doesn't actually catch anything. It should've been + // caught by a nested boundary. If not, it should bubble through. + return null; + } + case HostPortal: + popHostContainer(workInProgress); + return null; + case ContextProvider: + popProvider(workInProgress); + return null; + default: + return null; + } +} + +function unwindInterruptedWork(interruptedWork) { + switch (interruptedWork.tag) { + case ClassComponent: { + var childContextTypes = interruptedWork.type.childContextTypes; + if (childContextTypes !== null && childContextTypes !== undefined) { + popContext(interruptedWork); + } + break; + } + case HostRoot: { + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + } + case HostComponent: { + popHostContext(interruptedWork); + break; + } + case HostPortal: + popHostContainer(interruptedWork); + break; + case SuspenseComponent: + popSuspenseContext(interruptedWork); + break; + case DehydratedSuspenseComponent: + if (enableSuspenseServerRenderer) { + popSuspenseContext(interruptedWork); + } + break; + case SuspenseListComponent: + popSuspenseContext(interruptedWork); + break; + case ContextProvider: + popProvider(interruptedWork); + break; + default: + break; + } +} + +function createCapturedValue(value, source) { + // If the value is an error, call this function immediately after it is thrown + // so the stack is accurate. + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} + +// Module provided by RN: +(function() { + if ( + !( + typeof ReactNativePrivateInterface.ReactFiberErrorDialog + .showErrorDialog === "function" + ) + ) { + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); + } +})(); + +function showErrorDialog(capturedError) { + return ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ); +} + +function logCapturedError(capturedError) { + var logError = showErrorDialog(capturedError); + + // Allow injected showErrorDialog() to prevent default console.error logging. + // This enables renderers like ReactNative to better manage redbox behavior. + if (logError === false) { + return; + } + + var error = capturedError.error; + { + var componentName = capturedError.componentName, + componentStack = capturedError.componentStack, + errorBoundaryName = capturedError.errorBoundaryName, + errorBoundaryFound = capturedError.errorBoundaryFound, + willRetry = capturedError.willRetry; + + // Browsers support silencing uncaught errors by calling + // `preventDefault()` in window `error` handler. + // We record this information as an expando on the error. + + if (error != null && error._suppressLogging) { + if (errorBoundaryFound && willRetry) { + // The error is recoverable and was silenced. + // Ignore it and don't print the stack addendum. + // This is handy for testing error boundaries without noise. + return; + } + // The error is fatal. Since the silencing might have + // been accidental, we'll surface it anyway. + // However, the browser would have silenced the original error + // so we'll print it first, and then print the stack addendum. + console.error(error); + // For a more detailed description of this block, see: + // https://github.com/facebook/react/pull/13384 + } + + var componentNameMessage = componentName + ? "The above error occurred in the <" + componentName + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryMessage = void 0; + // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. + if (errorBoundaryFound && errorBoundaryName) { + if (willRetry) { + errorBoundaryMessage = + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + errorBoundaryName + "."); + } else { + errorBoundaryMessage = + "This error was initially handled by the error boundary " + + errorBoundaryName + + ".\n" + + "Recreating the tree from scratch failed so React will unmount the tree."; + } + } else { + errorBoundaryMessage = + "Consider adding an error boundary to your tree to customize error handling behavior.\n" + + "Visit https://fb.me/react-error-boundaries to learn more about error boundaries."; + } + var combinedMessage = + "" + + componentNameMessage + + componentStack + + "\n\n" + + ("" + errorBoundaryMessage); + + // In development, we provide our own message with just the component stack. + // We don't include the original error message and JS stack because the browser + // has already printed it. Even if the application swallows the error, it is still + // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. + console.error(combinedMessage); + } +} + +var didWarnAboutUndefinedSnapshotBeforeUpdate = null; +{ + didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); +} + +var PossiblyWeakSet$1 = typeof WeakSet === "function" ? WeakSet : Set; + +function logError(boundary, errorInfo) { + var source = errorInfo.source; + var stack = errorInfo.stack; + if (stack === null && source !== null) { + stack = getStackByFiberInDevAndProd(source); + } + + var capturedError = { + componentName: source !== null ? getComponentName(source.type) : null, + componentStack: stack !== null ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: false, + willRetry: false + }; + + if (boundary !== null && boundary.tag === ClassComponent) { + capturedError.errorBoundary = boundary.stateNode; + capturedError.errorBoundaryName = getComponentName(boundary.type); + capturedError.errorBoundaryFound = true; + capturedError.willRetry = true; + } + + try { + logCapturedError(capturedError); + } catch (e) { + // This method must not throw, or React internal state will get messed up. + // If console.error is overridden, or logCapturedError() shows a dialog that throws, + // we want to report this error outside of the normal stack as a last resort. + // https://github.com/facebook/react/issues/13188 + setTimeout(function() { + throw e; + }); + } +} + +var callComponentWillUnmountWithTimer = function(current$$1, instance) { + startPhaseTimer(current$$1, "componentWillUnmount"); + instance.props = current$$1.memoizedProps; + instance.state = current$$1.memoizedState; + instance.componentWillUnmount(); + stopPhaseTimer(); +}; + +// Capture errors so they don't interrupt unmounting. +function safelyCallComponentWillUnmount(current$$1, instance) { + { + invokeGuardedCallback( + null, + callComponentWillUnmountWithTimer, + null, + current$$1, + instance + ); + if (hasCaughtError()) { + var unmountError = clearCaughtError(); + captureCommitPhaseError(current$$1, unmountError); + } + } +} + +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (ref !== null) { + if (typeof ref === "function") { + { + invokeGuardedCallback(null, ref, null, null); + if (hasCaughtError()) { + var refError = clearCaughtError(); + captureCommitPhaseError(current$$1, refError); + } + } + } else { + ref.current = null; + } + } +} + +function safelyCallDestroy(current$$1, destroy) { + { + invokeGuardedCallback(null, destroy, null); + if (hasCaughtError()) { + var error = clearCaughtError(); + captureCommitPhaseError(current$$1, error); + } + } +} + +function commitBeforeMutationLifeCycles(current$$1, finishedWork) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork); + return; + } + case ClassComponent: { + if (finishedWork.effectTag & Snapshot) { + if (current$$1 !== null) { + var prevProps = current$$1.memoizedProps; + var prevState = current$$1.memoizedState; + startPhaseTimer(finishedWork, "getSnapshotBeforeUpdate"); + var instance = finishedWork.stateNode; + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "getSnapshotBeforeUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "getSnapshotBeforeUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + var snapshot = instance.getSnapshotBeforeUpdate( + finishedWork.elementType === finishedWork.type + ? prevProps + : resolveDefaultProps(finishedWork.type, prevProps), + prevState + ); + { + var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; + if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { + didWarnSet.add(finishedWork.type); + warningWithoutStack$1( + false, + "%s.getSnapshotBeforeUpdate(): A snapshot value (or null) " + + "must be returned. You have returned undefined.", + getComponentName(finishedWork.type) + ); + } + } + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + stopPhaseTimer(); + } + } + return; + } + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case IncompleteClassComponent: + // Nothing to do for these component types + return; + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + var updateQueue = finishedWork.updateQueue; + var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + // Unmount + var destroy = effect.destroy; + effect.destroy = undefined; + if (destroy !== undefined) { + destroy(); + } + } + if ((effect.tag & mountTag) !== NoEffect$1) { + // Mount + var create = effect.create; + effect.destroy = create(); + + { + var _destroy = effect.destroy; + if (_destroy !== undefined && typeof _destroy !== "function") { + var addendum = void 0; + if (_destroy === null) { + addendum = + " You returned null. If your effect does not require clean " + + "up, return undefined (or nothing)."; + } else if (typeof _destroy.then === "function") { + addendum = + "\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. " + + "Instead, write the async function inside your effect " + + "and call it immediately:\n\n" + + "useEffect(() => {\n" + + " async function fetchData() {\n" + + " // You can await here\n" + + " const response = await MyAPI.getData(someId);\n" + + " // ...\n" + + " }\n" + + " fetchData();\n" + + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + + "Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching"; + } else { + addendum = " You returned: " + _destroy; + } + warningWithoutStack$1( + false, + "An effect function must not return anything besides a function, " + + "which is used for clean-up.%s%s", + addendum, + getStackByFiberInDevAndProd(finishedWork) + ); + } + } + } + effect = effect.next; + } while (effect !== firstEffect); + } +} + +function commitPassiveHookEffects(finishedWork) { + if ((finishedWork.effectTag & Passive) !== NoEffect) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + break; + } + default: + break; + } + } +} + +function commitLifeCycles( + finishedRoot, + current$$1, + finishedWork, + committedExpirationTime +) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountLayout, MountLayout, finishedWork); + break; + } + case ClassComponent: { + var instance = finishedWork.stateNode; + if (finishedWork.effectTag & Update) { + if (current$$1 === null) { + startPhaseTimer(finishedWork, "componentDidMount"); + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "componentDidMount. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "componentDidMount. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + instance.componentDidMount(); + stopPhaseTimer(); + } else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current$$1.memoizedProps + : resolveDefaultProps( + finishedWork.type, + current$$1.memoizedProps + ); + var prevState = current$$1.memoizedState; + startPhaseTimer(finishedWork, "componentDidUpdate"); + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "componentDidUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "componentDidUpdate. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + instance.componentDidUpdate( + prevProps, + prevState, + instance.__reactInternalSnapshotBeforeUpdate + ); + stopPhaseTimer(); + } + } + var updateQueue = finishedWork.updateQueue; + if (updateQueue !== null) { + { + if ( + finishedWork.type === finishedWork.elementType && + !didWarnAboutReassigningProps + ) { + !(instance.props === finishedWork.memoizedProps) + ? warning$1( + false, + "Expected %s props to match memoized props before " + + "processing the update queue. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + !(instance.state === finishedWork.memoizedState) + ? warning$1( + false, + "Expected %s state to match memoized state before " + + "processing the update queue. " + + "This might either be because of a bug in React, or because " + + "a component reassigns its own `this.props`. " + + "Please file an issue.", + getComponentName(finishedWork.type) || "instance" + ) + : void 0; + } + } + // We could update instance props and state here, + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + commitUpdateQueue( + finishedWork, + updateQueue, + instance, + committedExpirationTime + ); + } + return; + } + case HostRoot: { + var _updateQueue = finishedWork.updateQueue; + if (_updateQueue !== null) { + var _instance = null; + if (finishedWork.child !== null) { + switch (finishedWork.child.tag) { + case HostComponent: + _instance = getPublicInstance(finishedWork.child.stateNode); + break; + case ClassComponent: + _instance = finishedWork.child.stateNode; + break; + } + } + commitUpdateQueue( + finishedWork, + _updateQueue, + _instance, + committedExpirationTime + ); + } + return; + } + case HostComponent: { + var _instance2 = finishedWork.stateNode; + + // Renderers may schedule work to be done after host components are mounted + // (eg DOM renderer may schedule auto-focus for inputs and form controls). + // These effects should only be committed when components are first mounted, + // aka when there is no current/alternate. + if (current$$1 === null && finishedWork.effectTag & Update) { + var type = finishedWork.type; + var props = finishedWork.memoizedProps; + } + + return; + } + case HostText: { + // We have no life-cycles associated with text. + return; + } + case HostPortal: { + // We have no life-cycles associated with portals. + return; + } + case Profiler: { + if (enableProfilerTimer) { + var onRender = finishedWork.memoizedProps.onRender; + + if (typeof onRender === "function") { + if (enableSchedulerTracing) { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime(), + finishedRoot.memoizedInteractions + ); + } else { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime() + ); + } + } + } + return; + } + case SuspenseComponent: + case SuspenseListComponent: + case IncompleteClassComponent: + case FundamentalComponent: + return; + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function hideOrUnhideAllChildren(finishedWork, isHidden) { + if (supportsMutation) { + // We only have the top Fiber that was inserted but we need to recurse down its + var node = finishedWork; + while (true) { + if (node.tag === HostComponent) { + var instance = node.stateNode; + if (isHidden) { + hideInstance(instance); + } else { + unhideInstance(node.stateNode, node.memoizedProps); + } + } else if (node.tag === HostText) { + var _instance3 = node.stateNode; + if (isHidden) { + hideTextInstance(_instance3); + } else { + unhideTextInstance(_instance3, node.memoizedProps); + } + } else if ( + node.tag === SuspenseComponent && + node.memoizedState !== null + ) { + // Found a nested Suspense component that timed out. Skip over the + var fallbackChildFragment = node.child.sibling; + fallbackChildFragment.return = node; + node = fallbackChildFragment; + continue; + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === finishedWork) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } +} + +function commitAttachRef(finishedWork) { + var ref = finishedWork.ref; + if (ref !== null) { + var instance = finishedWork.stateNode; + var instanceToUse = void 0; + switch (finishedWork.tag) { + case HostComponent: + instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; + } + if (typeof ref === "function") { + ref(instanceToUse); + } else { + { + if (!ref.hasOwnProperty("current")) { + warningWithoutStack$1( + false, + "Unexpected ref object provided for %s. " + + "Use either a ref-setter function or React.createRef().%s", + getComponentName(finishedWork.type), + getStackByFiberInDevAndProd(finishedWork) + ); + } + } + + ref.current = instanceToUse; + } + } +} + +function commitDetachRef(current$$1) { + var currentRef = current$$1.ref; + if (currentRef !== null) { + if (typeof currentRef === "function") { + currentRef(null); + } else { + currentRef.current = null; + } + } +} + +// User-originating errors (lifecycles and refs) should not interrupt +// deletion, so don't let them throw. Host-originating errors should +// interrupt deletion, so it's okay +function commitUnmount(current$$1, renderPriorityLevel) { + onCommitUnmount(current$$1); + + switch (current$$1.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var lastEffect = updateQueue.lastEffect; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + + // When the owner fiber is deleted, the destroy function of a passive + // effect hook is called during the synchronous commit phase. This is + // a concession to implementation complexity. Calling it in the + // passive effect phase (like they usually are, when dependencies + // change during an update) would require either traversing the + // children of the deleted fiber again, or including unmount effects + // as part of the fiber effect list. + // + // Because this is during the sync commit phase, we need to change + // the priority. + // + // TODO: Reconsider this implementation trade off. + var priorityLevel = + renderPriorityLevel > NormalPriority + ? NormalPriority + : renderPriorityLevel; + runWithPriority(priorityLevel, function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (destroy !== undefined) { + safelyCallDestroy(current$$1, destroy); + } + effect = effect.next; + } while (effect !== firstEffect); + }); + } + } + break; + } + case ClassComponent: { + safelyDetachRef(current$$1); + var instance = current$$1.stateNode; + if (typeof instance.componentWillUnmount === "function") { + safelyCallComponentWillUnmount(current$$1, instance); + } + return; + } + case HostComponent: { + if (enableFlareAPI) { + var dependencies = current$$1.dependencies; + + if (dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for ( + var i = 0, length = responderInstances.length; + i < length; + i++ + ) { + var responderInstance = responderInstances[i]; + unmountResponderInstance(responderInstance); + } + dependencies.responders = null; + } + } + } + safelyDetachRef(current$$1); + return; + } + case HostPortal: { + // TODO: this is recursive. + // We are also not using this parent because + // the portal will get pushed immediately. + if (supportsMutation) { + unmountHostComponents(current$$1, renderPriorityLevel); + } else if (supportsPersistence) { + emptyPortalContainer(current$$1); + } + return; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = current$$1.stateNode; + if (fundamentalInstance !== null) { + unmountFundamentalComponent(fundamentalInstance); + current$$1.stateNode = null; + } + } + } + } +} + +function commitNestedUnmounts(root, renderPriorityLevel) { + // While we're inside a removed host node we don't want to call + // removeChild on the inner nodes because they're removed by the top + // call anyway. We also want to call componentWillUnmount on all + // composites before this host node is removed from the tree. Therefore + var node = root; + while (true) { + commitUnmount(node, renderPriorityLevel); + // Visit children because they may contain more composite or host nodes. + // Skip portals because commitUnmount() currently visits them recursively. + if ( + node.child !== null && + // If we use mutation we drill down into portals using commitUnmount above. + // If we don't use mutation we drill down into portals here instead. + (!supportsMutation || node.tag !== HostPortal) + ) { + node.child.return = node; + node = node.child; + continue; + } + if (node === root) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === root) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + // Cut off the return pointers to disconnect it from the tree. Ideally, we + // should clear the child pointer of the parent alternate to let this + // get GC:ed but we don't know which for sure which parent is the current + // one so we'll settle for GC:ing the subtree of this child. This child + // itself will be GC:ed when the parent updates the next time. + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + if (alternate !== null) { + detachFiber(alternate); + } +} + +function emptyPortalContainer(current$$1) { + if (!supportsPersistence) { + return; + } + + var portal = current$$1.stateNode; + var containerInfo = portal.containerInfo; + + var emptyChildSet = createContainerChildSet(containerInfo); + replaceContainerChildren(containerInfo, emptyChildSet); +} + +function commitContainer(finishedWork) { + if (!supportsPersistence) { + return; + } + + switch (finishedWork.tag) { + case ClassComponent: + case HostComponent: + case HostText: + case FundamentalComponent: { + return; + } + case HostRoot: + case HostPortal: { + var portalOrRoot = finishedWork.stateNode; + var containerInfo = portalOrRoot.containerInfo, + _pendingChildren = portalOrRoot.pendingChildren; + + replaceContainerChildren(containerInfo, _pendingChildren); + return; + } + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function getHostParentFiber(fiber) { + var parent = fiber.return; + while (parent !== null) { + if (isHostParent(parent)) { + return parent; + } + parent = parent.return; + } + (function() { + { + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); +} + +function isHostParent(fiber) { + return ( + fiber.tag === HostComponent || + fiber.tag === HostRoot || + fiber.tag === HostPortal + ); +} + +function getHostSibling(fiber) { + // We're going to search forward into the tree until we find a sibling host + // node. Unfortunately, if multiple insertions are done in a row we have to + // search past them. This leads to exponential search for the next sibling. + var node = fiber; + siblings: while (true) { + // If we didn't find anything, let's try the next sibling. + while (node.sibling === null) { + if (node.return === null || isHostParent(node.return)) { + // If we pop out of the root or hit the parent the fiber we are the + // last sibling. + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + while ( + node.tag !== HostComponent && + node.tag !== HostText && + node.tag !== DehydratedSuspenseComponent + ) { + // If it is not host node and, we might have a host node inside it. + // Try to search down until we find one. + if (node.effectTag & Placement) { + // If we don't have a child, try the siblings instead. + continue siblings; + } + // If we don't have a child, try the siblings instead. + // We also skip portals because they are not part of this host tree. + if (node.child === null || node.tag === HostPortal) { + continue siblings; + } else { + node.child.return = node; + node = node.child; + } + } + // Check if this host node is stable or about to be placed. + if (!(node.effectTag & Placement)) { + // Found it! + return node.stateNode; + } + } +} + +function commitPlacement(finishedWork) { + if (!supportsMutation) { + return; + } + + // Recursively insert all host nodes into the parent. + var parentFiber = getHostParentFiber(finishedWork); + + // Note: these two variables *must* always be updated together. + var parent = void 0; + var isContainer = void 0; + var parentStateNode = parentFiber.stateNode; + switch (parentFiber.tag) { + case HostComponent: + parent = parentStateNode; + isContainer = false; + break; + case HostRoot: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case HostPortal: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case FundamentalComponent: + if (enableFundamentalAPI) { + parent = parentStateNode.instance; + isContainer = false; + } + // eslint-disable-next-line-no-fallthrough + default: + (function() { + { + throw ReactError( + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + if (parentFiber.effectTag & ContentReset) { + // Reset the text content of the parent before doing any insertions + parentFiber.effectTag &= ~ContentReset; + } + + var before = getHostSibling(finishedWork); + // We only have the top Fiber that was inserted but we need to recurse down its + // children to find all the terminal nodes. + var node = finishedWork; + while (true) { + var isHost = node.tag === HostComponent || node.tag === HostText; + if (isHost || (enableFundamentalAPI && node.tag === FundamentalComponent)) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (before) { + if (isContainer) { + insertInContainerBefore(parent, stateNode, before); + } else { + insertBefore(parent, stateNode, before); + } + } else { + if (isContainer) { + appendChildToContainer(parent, stateNode); + } else { + appendChild(parent, stateNode); + } + } + } else if (node.tag === HostPortal) { + // If the insertion itself is a portal, then we don't want to traverse + // down its children. Instead, we'll get insertions from each child in + // the portal directly. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === finishedWork) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function unmountHostComponents(current$$1, renderPriorityLevel) { + // We only have the top Fiber that was deleted but we need to recurse down its + var node = current$$1; + + // Each iteration, currentParent is populated with node's host parent if not + // currentParentIsValid. + var currentParentIsValid = false; + + // Note: these two variables *must* always be updated together. + var currentParent = void 0; + var currentParentIsContainer = void 0; + + while (true) { + if (!currentParentIsValid) { + var parent = node.return; + findParent: while (true) { + (function() { + if (!(parent !== null)) { + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var parentStateNode = parent.stateNode; + switch (parent.tag) { + case HostComponent: + currentParent = parentStateNode; + currentParentIsContainer = false; + break findParent; + case HostRoot: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + case HostPortal: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + case FundamentalComponent: + if (enableFundamentalAPI) { + currentParent = parentStateNode.instance; + currentParentIsContainer = false; + } + } + parent = parent.return; + } + currentParentIsValid = true; + } + + if (node.tag === HostComponent || node.tag === HostText) { + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, node.stateNode); + } else { + removeChild(currentParent, node.stateNode); + } + // Don't visit children because we already visited them. + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var fundamentalNode = node.stateNode.instance; + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, fundamentalNode); + } else { + removeChild(currentParent, fundamentalNode); + } + } else if ( + enableSuspenseServerRenderer && + node.tag === DehydratedSuspenseComponent + ) { + // Delete the dehydrated suspense boundary and all of its content. + if (currentParentIsContainer) { + clearSuspenseBoundaryFromContainer(currentParent, node.stateNode); + } else { + clearSuspenseBoundary(currentParent, node.stateNode); + } + } else if (node.tag === HostPortal) { + if (node.child !== null) { + // When we go into a portal, it becomes the parent to remove from. + // We will reassign it back when we pop the portal on the way up. + currentParent = node.stateNode.containerInfo; + currentParentIsContainer = true; + // Visit children because portals might contain host components. + node.child.return = node; + node = node.child; + continue; + } + } else { + commitUnmount(node, renderPriorityLevel); + // Visit children because we may find more host components below. + if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === current$$1) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === current$$1) { + return; + } + node = node.return; + if (node.tag === HostPortal) { + // When we go out of the portal, we need to restore the parent. + // Since we don't keep a stack of them, we will search for it. + currentParentIsValid = false; + } + } + node.sibling.return = node.return; + node = node.sibling; + } +} + +function commitDeletion(current$$1, renderPriorityLevel) { + if (supportsMutation) { + // Recursively delete all host nodes from the parent. + // Detach refs and call componentWillUnmount() on the whole subtree. + unmountHostComponents(current$$1, renderPriorityLevel); + } else { + // Detach refs and call componentWillUnmount() on the whole subtree. + commitNestedUnmounts(current$$1, renderPriorityLevel); + } + detachFiber(current$$1); +} + +function commitWork(current$$1, finishedWork) { + if (!supportsMutation) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + // Note: We currently never use MountMutation, but useLayout uses + // UnmountMutation. + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + } + case Profiler: { + return; + } + case SuspenseComponent: { + commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); + return; + } + } + + commitContainer(finishedWork); + return; + } + + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: { + // Note: We currently never use MountMutation, but useLayout uses + // UnmountMutation. + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + return; + } + case ClassComponent: { + return; + } + case HostComponent: { + var instance = finishedWork.stateNode; + if (instance != null) { + // Commit the work prepared earlier. + var newProps = finishedWork.memoizedProps; + // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldProps = + current$$1 !== null ? current$$1.memoizedProps : newProps; + var type = finishedWork.type; + // TODO: Type the updateQueue to be specific to host components. + var updatePayload = finishedWork.updateQueue; + finishedWork.updateQueue = null; + if (updatePayload !== null) { + commitUpdate( + instance, + updatePayload, + type, + oldProps, + newProps, + finishedWork + ); + } + } + return; + } + case HostText: { + (function() { + if (!(finishedWork.stateNode !== null)) { + throw ReactError( + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + var textInstance = finishedWork.stateNode; + var newText = finishedWork.memoizedProps; + // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldText = current$$1 !== null ? current$$1.memoizedProps : newText; + commitTextUpdate(textInstance, oldText, newText); + return; + } + case HostRoot: { + return; + } + case Profiler: { + return; + } + case SuspenseComponent: { + commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); + return; + } + case IncompleteClassComponent: { + return; + } + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = finishedWork.stateNode; + updateFundamentalComponent(fundamentalInstance); + } + return; + } + default: { + (function() { + { + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + } + } +} + +function commitSuspenseComponent(finishedWork) { + var newState = finishedWork.memoizedState; + + var newDidTimeout = void 0; + var primaryChildParent = finishedWork; + if (newState === null) { + newDidTimeout = false; + } else { + newDidTimeout = true; + primaryChildParent = finishedWork.child; + markCommitTimeOfFallback(); + } + + if (supportsMutation && primaryChildParent !== null) { + hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); + } + + if (enableSuspenseCallback && newState !== null) { + var suspenseCallback = finishedWork.memoizedProps.suspenseCallback; + if (typeof suspenseCallback === "function") { + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + suspenseCallback(new Set(thenables)); + } + } else { + if (suspenseCallback !== undefined) { + warning$1(false, "Unexpected type for suspenseCallback."); + } + } + } +} + +function attachSuspenseRetryListeners(finishedWork) { + // If this boundary just timed out, then it will have a set of thenables. + // For each thenable, attach a listener so that when it resolves, React + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + if (retryCache === null) { + retryCache = finishedWork.stateNode = new PossiblyWeakSet$1(); + } + thenables.forEach(function(thenable) { + // Memoize using the boundary fiber to prevent redundant listeners. + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + if (!retryCache.has(thenable)) { + if (enableSchedulerTracing) { + retry = tracing.unstable_wrap(retry); + } + retryCache.add(thenable); + thenable.then(retry, retry); + } + }); + } +} + +function commitResetTextContent(current$$1) { + if (!supportsMutation) { + return; + } + resetTextContent(current$$1.stateNode); +} + +var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; +var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; + +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + var update = createUpdate(expirationTime, null); + // Unmount the root by rendering null. + update.tag = CaptureUpdate; + // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { element: null }; + var error = errorInfo.value; + update.callback = function() { + onUncaughtError(error); + logError(fiber, errorInfo); + }; + return update; +} + +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + var update = createUpdate(expirationTime, null); + update.tag = CaptureUpdate; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if (typeof getDerivedStateFromError === "function") { + var error = errorInfo.value; + update.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + + var inst = fiber.stateNode; + if (inst !== null && typeof inst.componentDidCatch === "function") { + update.callback = function callback() { + { + markFailedErrorBoundaryForHotReloading(fiber); + } + if (typeof getDerivedStateFromError !== "function") { + // To preserve the preexisting retry behavior of error boundaries, + // we keep track of which ones already failed during this batch. + // This gets reset before we yield back to the browser. + // TODO: Warn in strict mode if getDerivedStateFromError is + // not defined. + markLegacyErrorBoundaryAsFailed(this); + + // Only log here if componentDidCatch is the only error boundary method defined + logError(fiber, errorInfo); + } + var error = errorInfo.value; + var stack = errorInfo.stack; + this.componentDidCatch(error, { + componentStack: stack !== null ? stack : "" + }); + { + if (typeof getDerivedStateFromError !== "function") { + // If componentDidCatch is the only error boundary method defined, + // then it needs to call setState to recover from errors. + // If no state update is scheduled then the boundary will swallow the error. + !(fiber.expirationTime === Sync) + ? warningWithoutStack$1( + false, + "%s: Error boundaries should implement getDerivedStateFromError(). " + + "In that method, return a state update to display an error message or fallback UI.", + getComponentName(fiber.type) || "Unknown" + ) + : void 0; + } + } + }; + } else { + update.callback = function() { + markFailedErrorBoundaryForHotReloading(fiber); + }; + } + return update; +} + +function attachPingListener(root, renderExpirationTime, thenable) { + // Attach a listener to the promise to "ping" the root and retry. But + // only if one does not already exist for the current render expiration + // time (which acts like a "thread ID" here). + var pingCache = root.pingCache; + var threadIDs = void 0; + if (pingCache === null) { + pingCache = root.pingCache = new PossiblyWeakMap(); + threadIDs = new Set(); + pingCache.set(thenable, threadIDs); + } else { + threadIDs = pingCache.get(thenable); + if (threadIDs === undefined) { + threadIDs = new Set(); + pingCache.set(thenable, threadIDs); + } + } + if (!threadIDs.has(renderExpirationTime)) { + // Memoize using the thread ID to prevent redundant listeners. + threadIDs.add(renderExpirationTime); + var ping = pingSuspendedRoot.bind( + null, + root, + thenable, + renderExpirationTime + ); + if (enableSchedulerTracing) { + ping = tracing.unstable_wrap(ping); + } + thenable.then(ping, ping); + } +} + +function throwException( + root, + returnFiber, + sourceFiber, + value, + renderExpirationTime +) { + // The source fiber did not complete. + sourceFiber.effectTag |= Incomplete; + // Its effect list is no longer valid. + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + + if ( + value !== null && + typeof value === "object" && + typeof value.then === "function" + ) { + // This is a thenable. + var thenable = value; + + checkForWrongSuspensePriorityInDEV(sourceFiber); + + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + + // Schedule the nearest Suspense to re-render the timed out view. + var _workInProgress = returnFiber; + do { + if ( + _workInProgress.tag === SuspenseComponent && + shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) + ) { + // Found the nearest boundary. + + // Stash the promise on the boundary fiber. If the boundary times out, we'll + var thenables = _workInProgress.updateQueue; + if (thenables === null) { + var updateQueue = new Set(); + updateQueue.add(thenable); + _workInProgress.updateQueue = updateQueue; + } else { + thenables.add(thenable); + } + + // If the boundary is outside of batched mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. In the commit phase, we'll schedule a + // subsequent synchronous update to re-render the Suspense. + // + // Note: It doesn't matter whether the component that suspended was + // inside a batched mode tree. If the Suspense is outside of it, we + // should *not* suspend the commit. + if ((_workInProgress.mode & BatchedMode) === NoMode) { + _workInProgress.effectTag |= DidCapture; + + // We're going to commit this fiber even though it didn't complete. + // But we shouldn't call any lifecycle methods or callbacks. Remove + // all lifecycle effect tags. + sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete); + + if (sourceFiber.tag === ClassComponent) { + var currentSourceFiber = sourceFiber.alternate; + if (currentSourceFiber === null) { + // This is a new mount. Change the tag so it's not mistaken for a + // completed class component. For example, we should not call + // componentWillUnmount if it is deleted. + sourceFiber.tag = IncompleteClassComponent; + } else { + // When we try rendering again, we should not reuse the current fiber, + // since it's known to be in an inconsistent state. Use a force update to + // prevent a bail out. + var update = createUpdate(Sync, null); + update.tag = ForceUpdate; + enqueueUpdate(sourceFiber, update); + } + } + + // The source fiber did not complete. Mark it with Sync priority to + // indicate that it still has pending work. + sourceFiber.expirationTime = Sync; + + // Exit without suspending. + return; + } + + // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. SuspenseConfig applies to + // this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. + + attachPingListener(root, renderExpirationTime, thenable); + + _workInProgress.effectTag |= ShouldCapture; + _workInProgress.expirationTime = renderExpirationTime; + + return; + } else if ( + enableSuspenseServerRenderer && + _workInProgress.tag === DehydratedSuspenseComponent + ) { + attachPingListener(root, renderExpirationTime, thenable); + + // Since we already have a current fiber, we can eagerly add a retry listener. + var retryCache = _workInProgress.memoizedState; + if (retryCache === null) { + retryCache = _workInProgress.memoizedState = new PossiblyWeakSet(); + var current$$1 = _workInProgress.alternate; + (function() { + if (!current$$1) { + throw ReactError( + Error( + "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + ) + ); + } + })(); + current$$1.memoizedState = retryCache; + } + // Memoize using the boundary fiber to prevent redundant listeners. + if (!retryCache.has(thenable)) { + retryCache.add(thenable); + var retry = resolveRetryThenable.bind( + null, + _workInProgress, + thenable + ); + if (enableSchedulerTracing) { + retry = tracing.unstable_wrap(retry); + } + thenable.then(retry, retry); + } + _workInProgress.effectTag |= ShouldCapture; + _workInProgress.expirationTime = renderExpirationTime; + return; + } + // This boundary already captured during this render. Continue to the next + // boundary. + _workInProgress = _workInProgress.return; + } while (_workInProgress !== null); + // No boundary was found. Fallthrough to error mode. + // TODO: Use invariant so the message is stripped in prod? + value = new Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n" + + "\n" + + "Add a component higher in the tree to " + + "provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + + // We didn't find a boundary that could handle this type of exception. Start + // over and traverse parent path again, this time treating the exception + // as an error. + renderDidError(); + value = createCapturedValue(value, sourceFiber); + var workInProgress = returnFiber; + do { + switch (workInProgress.tag) { + case HostRoot: { + var _errorInfo = value; + workInProgress.effectTag |= ShouldCapture; + workInProgress.expirationTime = renderExpirationTime; + var _update = createRootErrorUpdate( + workInProgress, + _errorInfo, + renderExpirationTime + ); + enqueueCapturedUpdate(workInProgress, _update); + return; + } + case ClassComponent: + // Capture and retry + var errorInfo = value; + var ctor = workInProgress.type; + var instance = workInProgress.stateNode; + if ( + (workInProgress.effectTag & DidCapture) === NoEffect && + (typeof ctor.getDerivedStateFromError === "function" || + (instance !== null && + typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance))) + ) { + workInProgress.effectTag |= ShouldCapture; + workInProgress.expirationTime = renderExpirationTime; + // Schedule the error boundary to re-render using updated state + var _update2 = createClassErrorUpdate( + workInProgress, + errorInfo, + renderExpirationTime + ); + enqueueCapturedUpdate(workInProgress, _update2); + return; + } + break; + default: + break; + } + workInProgress = workInProgress.return; + } while (workInProgress !== null); +} + +// The scheduler is imported here *only* to detect whether it's been mocked +// DEV stuff +var ceil = Math.ceil; + +var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; +var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; +var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; + +var NoContext = /* */ 0; +var BatchedContext = /* */ 1; +var EventContext = /* */ 2; +var DiscreteEventContext = /* */ 4; +var LegacyUnbatchedContext = /* */ 8; +var RenderContext = /* */ 16; +var CommitContext = /* */ 32; + +var RootIncomplete = 0; +var RootErrored = 1; +var RootSuspended = 2; +var RootSuspendedWithDelay = 3; +var RootCompleted = 4; + +// Describes where we are in the React execution stack +var executionContext = NoContext; +// The root we're working on +var workInProgressRoot = null; +// The fiber we're working on +var workInProgress = null; +// The expiration time we're rendering +var renderExpirationTime = NoWork; +// Whether to root completed, errored, suspended, etc. +var workInProgressRootExitStatus = RootIncomplete; +// Most recent event time among processed updates during this render. +// This is conceptually a time stamp but expressed in terms of an ExpirationTime +// because we deal mostly with expiration times in the hot path, so this avoids +// the conversion happening in the hot path. +var workInProgressRootLatestProcessedExpirationTime = Sync; +var workInProgressRootLatestSuspenseTimeout = Sync; +var workInProgressRootCanSuspendUsingConfig = null; +// If we're pinged while rendering we don't always restart immediately. +// This flag determines if it might be worthwhile to restart if an opportunity +// happens latere. +var workInProgressRootHasPendingPing = false; +// The most recent time we committed a fallback. This lets us ensure a train +// model where we don't commit new loading states in too quick succession. +var globalMostRecentFallbackTime = 0; +var FALLBACK_THROTTLE_MS = 500; + +var nextEffect = null; +var hasUncaughtError = false; +var firstUncaughtError = null; +var legacyErrorBoundariesThatAlreadyFailed = null; + +var rootDoesHavePassiveEffects = false; +var rootWithPendingPassiveEffects = null; +var pendingPassiveEffectsRenderPriority = NoPriority; +var pendingPassiveEffectsExpirationTime = NoWork; + +var rootsWithPendingDiscreteUpdates = null; + +// Use these to prevent an infinite loop of nested updates +var NESTED_UPDATE_LIMIT = 50; +var nestedUpdateCount = 0; +var rootWithNestedUpdates = null; + +var NESTED_PASSIVE_UPDATE_LIMIT = 50; +var nestedPassiveUpdateCount = 0; + +var interruptedBy = null; + +// Marks the need to reschedule pending interactions at these expiration times +// during the commit phase. This enables them to be traced across components +// that spawn new work during render. E.g. hidden boundaries, suspended SSR +// hydration or SuspenseList. +var spawnedWorkDuringRender = null; + +// Expiration times are computed by adding to the current time (the start +// time). However, if two updates are scheduled within the same event, we +// should treat their start times as simultaneous, even if the actual clock +// time has advanced between the first and second call. + +// In other words, because expiration times determine how updates are batched, +// we want all updates of like priority that occur within the same event to +// receive the same expiration time. Otherwise we get tearing. +var currentEventTime = NoWork; + +function requestCurrentTime() { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + // We're inside React, so it's fine to read the actual time. + return msToExpirationTime(now()); + } + // We're not inside React, so we may be in the middle of a browser event. + if (currentEventTime !== NoWork) { + // Use the same start time for all updates until we enter React again. + return currentEventTime; + } + // This is the first update since React yielded. Compute a new start time. + currentEventTime = msToExpirationTime(now()); + return currentEventTime; +} + +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + var mode = fiber.mode; + if ((mode & BatchedMode) === NoMode) { + return Sync; + } + + var priorityLevel = getCurrentPriorityLevel(); + if ((mode & ConcurrentMode) === NoMode) { + return priorityLevel === ImmediatePriority ? Sync : Batched; + } + + if ((executionContext & RenderContext) !== NoContext) { + // Use whatever time we're already rendering + return renderExpirationTime; + } + + var expirationTime = void 0; + if (suspenseConfig !== null) { + // Compute an expiration time based on the Suspense timeout. + expirationTime = computeSuspenseExpiration( + currentTime, + suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION + ); + } else { + // Compute an expiration time based on the Scheduler priority. + switch (priorityLevel) { + case ImmediatePriority: + expirationTime = Sync; + break; + case UserBlockingPriority: + // TODO: Rename this to computeUserBlockingExpiration + expirationTime = computeInteractiveExpiration(currentTime); + break; + case NormalPriority: + case LowPriority: + // TODO: Handle LowPriority + // TODO: Rename this to... something better. + expirationTime = computeAsyncExpiration(currentTime); + break; + case IdlePriority: + expirationTime = Never; + break; + default: + (function() { + { + throw ReactError(Error("Expected a valid priority level")); + } + })(); + } + } + + // If we're in the middle of rendering a tree, do not update at the same + // expiration time that is already rendering. + // TODO: We shouldn't have to do this if the update is on a different root. + // Refactor computeExpirationForFiber + scheduleUpdate so we have access to + // the root when we check for this condition. + if (workInProgressRoot !== null && expirationTime === renderExpirationTime) { + // This is a trick to move this update into a separate batch + expirationTime -= 1; + } + + return expirationTime; +} + +function scheduleUpdateOnFiber(fiber, expirationTime) { + checkForNestedUpdates(); + warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber); + + var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (root === null) { + warnAboutUpdateOnUnmountedFiberInDEV(fiber); + return; + } + + root.pingTime = NoWork; + + checkForInterruption(fiber, expirationTime); + recordScheduleUpdate(); + + // TODO: computeExpirationForFiber also reads the priority. Pass the + // priority as an argument to that function and this one. + var priorityLevel = getCurrentPriorityLevel(); + + if (expirationTime === Sync) { + if ( + // Check if we're inside unbatchedUpdates + (executionContext & LegacyUnbatchedContext) !== NoContext && + // Check if we're not already rendering + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Register pending interactions on the root to avoid losing traced interaction data. + schedulePendingInteractions(root, expirationTime); + + // This is a legacy edge case. The initial mount of a ReactDOM.render-ed + // root inside of batchedUpdates should be synchronous, but layout updates + // should be deferred until the end of the batch. + var callback = renderRoot(root, Sync, true); + while (callback !== null) { + callback = callback(true); + } + } else { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + if (executionContext === NoContext) { + // Flush the synchronous work now, wnless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of sync mode. + flushSyncCallbackQueue(); + } + } + } else { + scheduleCallbackForRoot(root, priorityLevel, expirationTime); + } + + if ( + (executionContext & DiscreteEventContext) !== NoContext && + // Only updates at user-blocking priority or greater are considered + // discrete, even inside a discrete event. + (priorityLevel === UserBlockingPriority || + priorityLevel === ImmediatePriority) + ) { + // This is the result of a discrete event. Track the lowest priority + // discrete update per root so we can flush them early, if needed. + if (rootsWithPendingDiscreteUpdates === null) { + rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); + } else { + var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); + if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) { + rootsWithPendingDiscreteUpdates.set(root, expirationTime); + } + } + } +} +var scheduleWork = scheduleUpdateOnFiber; + +// This is split into a separate function so we can mark a fiber with pending +// work without treating it as a typical update that originates from an event; +// e.g. retrying a Suspense boundary isn't an update, but it does schedule work +// on a fiber. +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + // Update the source fiber's expiration time + if (fiber.expirationTime < expirationTime) { + fiber.expirationTime = expirationTime; + } + var alternate = fiber.alternate; + if (alternate !== null && alternate.expirationTime < expirationTime) { + alternate.expirationTime = expirationTime; + } + // Walk the parent path to the root and update the child expiration time. + var node = fiber.return; + var root = null; + if (node === null && fiber.tag === HostRoot) { + root = fiber.stateNode; + } else { + while (node !== null) { + alternate = node.alternate; + if (node.childExpirationTime < expirationTime) { + node.childExpirationTime = expirationTime; + if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + } else if ( + alternate !== null && + alternate.childExpirationTime < expirationTime + ) { + alternate.childExpirationTime = expirationTime; + } + if (node.return === null && node.tag === HostRoot) { + root = node.stateNode; + break; + } + node = node.return; + } + } + + if (root !== null) { + // Update the first and last pending expiration times in this root + var firstPendingTime = root.firstPendingTime; + if (expirationTime > firstPendingTime) { + root.firstPendingTime = expirationTime; + } + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime === NoWork || expirationTime < lastPendingTime) { + root.lastPendingTime = expirationTime; + } + } + + return root; +} + +// Use this function, along with runRootCallback, to ensure that only a single +// callback per root is scheduled. It's still possible to call renderRoot +// directly, but scheduling via this function helps avoid excessive callbacks. +// It works by storing the callback node and expiration time on the root. When a +// new callback comes in, it compares the expiration time to determine if it +// should cancel the previous one. It also relies on commitRoot scheduling a +// callback to render the next level, because that means we don't need a +// separate callback per expiration time. +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + var existingCallbackExpirationTime = root.callbackExpirationTime; + if (existingCallbackExpirationTime < expirationTime) { + // New callback has higher priority than the existing one. + var existingCallbackNode = root.callbackNode; + if (existingCallbackNode !== null) { + cancelCallback(existingCallbackNode); + } + root.callbackExpirationTime = expirationTime; + + if (expirationTime === Sync) { + // Sync React callbacks are scheduled on a special internal queue + root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + ); + } else { + var options = null; + if ( + !disableSchedulerTimeoutBasedOnReactExpirationTime && + expirationTime !== Never + ) { + var timeout = expirationTimeToMs(expirationTime) - now(); + options = { timeout: timeout }; + } + + root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + options + ); + if ( + enableUserTimingAPI && + expirationTime !== Sync && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Scheduled an async callback, and we're not already working. Add an + // entry to the flamegraph that shows we're waiting for a callback + // to fire. + startRequestCallbackTimer(); + } + } + } + + // Associate the current interactions with this new root+priority. + schedulePendingInteractions(root, expirationTime); +} + +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode; + var continuation = null; + try { + continuation = callback(isSync); + if (continuation !== null) { + return runRootCallback.bind(null, root, continuation); + } else { + return null; + } + } finally { + // If the callback exits without returning a continuation, remove the + // corresponding callback node from the root. Unless the callback node + // has changed, which implies that it was already cancelled by a high + // priority update. + if (continuation === null && prevCallbackNode === root.callbackNode) { + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + } + } +} + +function flushDiscreteUpdates() { + // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. + // However, `act` uses `batchedUpdates`, so there's no way to distinguish + // those two cases. Need to fix this before exposing flushDiscreteUpdates + // as a public API. + if ( + (executionContext & (BatchedContext | RenderContext | CommitContext)) !== + NoContext + ) { + if (true && (executionContext & RenderContext) !== NoContext) { + warning$1( + false, + "unstable_flushDiscreteUpdates: Cannot flush updates when React is " + + "already rendering." + ); + } + // We're already rendering, so we can't synchronously flush pending work. + // This is probably a nested event dispatch triggered by a lifecycle/effect, + // like `el.focus()`. Exit. + return; + } + flushPendingDiscreteUpdates(); + if (!revertPassiveEffectsChange) { + // If the discrete updates scheduled passive effects, flush them now so that + // they fire before the next serial event. + flushPassiveEffects(); + } +} + +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + if ( + firstBatch !== null && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ) { + scheduleCallback(NormalPriority, function() { + firstBatch._onComplete(); + return null; + }); + return true; + } else { + return false; + } +} + +function flushPendingDiscreteUpdates() { + if (rootsWithPendingDiscreteUpdates !== null) { + // For each root with pending discrete updates, schedule a callback to + // immediately flush them. + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + // Now flush the immediate queue. + flushSyncCallbackQueue(); + } +} + +function batchedUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function batchedEventUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= EventContext; + try { + return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function discreteUpdates$1(fn, a, b, c) { + var prevExecutionContext = executionContext; + executionContext |= DiscreteEventContext; + try { + // Should this + return runWithPriority(UserBlockingPriority, fn.bind(null, a, b, c)); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function flushSync(fn, a) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + (function() { + { + throw ReactError( + Error( + "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." + ) + ); + } + })(); + } + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return runWithPriority(ImmediatePriority, fn.bind(null, a)); + } finally { + executionContext = prevExecutionContext; + // Flush the immediate callbacks that were scheduled during this batch. + // Note that this will happen even if batchedUpdates is higher up + // the stack. + flushSyncCallbackQueue(); + } +} + +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + var timeoutHandle = root.timeoutHandle; + if (timeoutHandle !== noTimeout) { + // The root previous suspended and scheduled a timeout to commit a fallback + // state. Now that we have additional work, cancel the timeout. + root.timeoutHandle = noTimeout; + // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above + cancelTimeout(timeoutHandle); + } + + if (workInProgress !== null) { + var interruptedWork = workInProgress.return; + while (interruptedWork !== null) { + unwindInterruptedWork(interruptedWork); + interruptedWork = interruptedWork.return; + } + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestProcessedExpirationTime = Sync; + workInProgressRootLatestSuspenseTimeout = Sync; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = false; + + if (enableSchedulerTracing) { + spawnedWorkDuringRender = null; + } + + { + ReactStrictModeWarnings.discardPendingWarnings(); + componentsThatTriggeredHighPriSuspend = null; + } +} + +function renderRoot(root, expirationTime, isSync) { + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + if (enableUserTimingAPI && expirationTime !== Sync) { + var didExpire = isSync; + stopRequestCallbackTimer(didExpire); + } + + if (root.firstPendingTime < expirationTime) { + // If there's no work left at this expiration time, exit immediately. This + // happens when multiple callbacks are scheduled for a single root, but an + // earlier callback flushes the work of a later one. + return null; + } + + if (isSync && root.finishedExpirationTime === expirationTime) { + // There's already a pending commit at this expiration time. + // TODO: This is poorly factored. This case only exists for the + // batch.commit() API. + return commitRoot.bind(null, root); + } + + flushPassiveEffects(); + + // If the root or expiration time have changed, throw out the existing stack + // and prepare a fresh one. Otherwise we'll continue where we left off. + if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { + prepareFreshStack(root, expirationTime); + startWorkOnPendingInteractions(root, expirationTime); + } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // We could've received an update at a lower priority while we yielded. + // We're suspended in a delayed state. Once we complete this render we're + // just going to try to recover at the last pending time anyway so we might + // as well start doing that eagerly. + // Ideally we should be able to do this even for retries but we don't yet + // know if we're going to process an update which wants to commit earlier, + // and this path happens very early so it would happen too often. Instead, + // for that case, we'll wait until we complete. + if (workInProgressRootHasPendingPing) { + // We have a ping at this expiration. Let's restart to see if we get unblocked. + prepareFreshStack(root, expirationTime); + } else { + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately, while preserving the position in the queue. + return renderRoot.bind(null, root, lastPendingTime); + } + } + } + + // If we have a work-in-progress fiber, it means there's still work to do + // in this root. + if (workInProgress !== null) { + var prevExecutionContext = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + if (prevDispatcher === null) { + // The React isomorphic package does not include a default dispatcher. + // Instead the first renderer will lazily attach one, in order to give + // nicer error messages. + prevDispatcher = ContextOnlyDispatcher; + } + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + startWorkLoopTimer(workInProgress); + + // TODO: Fork renderRoot into renderRootSync and renderRootAsync + if (isSync) { + if (expirationTime !== Sync) { + // An async update expired. There may be other expired updates on + // this root. We should render all the expired work in a + // single batch. + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) { + // Restart at the current time. + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + return renderRoot.bind(null, root, currentTime); + } + } + } else { + // Since we know we're in a React event, we can clear the current + // event time. The next update will compute a new event time. + currentEventTime = NoWork; + } + + do { + try { + if (isSync) { + workLoopSync(); + } else { + workLoop(); + } + break; + } catch (thrownValue) { + // Reset module-level state that was set during the render phase. + resetContextDependencies(); + resetHooks(); + + var sourceFiber = workInProgress; + if (sourceFiber === null || sourceFiber.return === null) { + // Expected to be working on a non-root fiber. This is a fatal error + // because there's no ancestor that can handle it; the root is + // supposed to capture all errors that weren't caught by an error + // boundary. + prepareFreshStack(root, expirationTime); + executionContext = prevExecutionContext; + throw thrownValue; + } + + if (enableProfilerTimer && sourceFiber.mode & ProfileMode) { + // Record the time spent rendering before an error was thrown. This + // avoids inaccurate Profiler durations in the case of a + // suspended render. + stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true); + } + + var returnFiber = sourceFiber.return; + throwException( + root, + returnFiber, + sourceFiber, + thrownValue, + renderExpirationTime + ); + workInProgress = completeUnitOfWork(sourceFiber); + } + } while (true); + + executionContext = prevExecutionContext; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + + if (workInProgress !== null) { + // There's still work left over. Return a continuation. + stopInterruptedWorkLoopTimer(); + if (expirationTime !== Sync) { + startRequestCallbackTimer(); + } + return renderRoot.bind(null, root, expirationTime); + } + } + + // We now have a consistent tree. The next step is either to commit it, or, if + // something suspended, wait to commit it after a timeout. + stopFinishedWorkLoopTimer(); + + root.finishedWork = root.current.alternate; + root.finishedExpirationTime = expirationTime; + + var isLocked = resolveLocksOnRoot(root, expirationTime); + if (isLocked) { + // This root has a lock that prevents it from committing. Exit. If we begin + // work on the root again, without any intervening updates, it will finish + // without doing additional work. + return null; + } + + // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; + + switch (workInProgressRootExitStatus) { + case RootIncomplete: { + (function() { + { + throw ReactError(Error("Should have a work-in-progress.")); + } + })(); + } + // Flow knows about invariant, so it complains if I add a break statement, + // but eslint doesn't know about invariant, so it complains if I do. + // eslint-disable-next-line no-fallthrough + case RootErrored: { + // An error was thrown. First check if there is lower priority work + // scheduled on this root. + var _lastPendingTime = root.lastPendingTime; + if (_lastPendingTime < expirationTime) { + // There's lower priority work. Before raising the error, try rendering + // at the lower priority to see if it fixes it. Use a continuation to + // maintain the existing priority and position in the queue. + return renderRoot.bind(null, root, _lastPendingTime); + } + if (!isSync) { + // If we're rendering asynchronously, it's possible the error was + // caused by tearing due to a mutation during an event. Try rendering + // one more time without yiedling to events. + prepareFreshStack(root, expirationTime); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + return null; + } + // If we're already rendering synchronously, commit the root in its + // errored state. + return commitRoot.bind(null, root); + } + case RootSuspended: { + flushSuspensePriorityWarningInDEV(); + + // We have an acceptable loading state. We need to figure out if we should + // immediately commit it or wait a bit. + + // If we have processed new updates during this render, we may now have a + // new loading state ready. We want to ensure that we commit that as soon as + // possible. + var hasNotProcessedNewUpdates = + workInProgressRootLatestProcessedExpirationTime === Sync; + if ( + hasNotProcessedNewUpdates && + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // If we have not processed any new updates during this pass, then this is + // either a retry of an existing fallback state or a hidden tree. + // Hidden trees shouldn't be batched with other work and after that's + // fixed it can only be a retry. + // We're going to throttle committing retries so that we don't show too + // many loading states too quickly. + var msUntilTimeout = + globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); + // Don't bother with a very short suspense time. + if (msUntilTimeout > 10) { + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime2 = root.lastPendingTime; + if (_lastPendingTime2 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level. + return renderRoot.bind(null, root, _lastPendingTime2); + } + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootSuspendedWithDelay: { + flushSuspensePriorityWarningInDEV(); + + if ( + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // We're suspended in a state that should be avoided. We'll try to avoid committing + // it for as long as the timeouts let us. + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime3 = root.lastPendingTime; + if (_lastPendingTime3 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately. + return renderRoot.bind(null, root, _lastPendingTime3); + } + + var _msUntilTimeout = void 0; + if (workInProgressRootLatestSuspenseTimeout !== Sync) { + // We have processed a suspense config whose expiration time we can use as + // the timeout. + _msUntilTimeout = + expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now(); + } else if (workInProgressRootLatestProcessedExpirationTime === Sync) { + // This should never normally happen because only new updates cause + // delayed states, so we should have processed something. However, + // this could also happen in an offscreen tree. + _msUntilTimeout = 0; + } else { + // If we don't have a suspense config, we're going to use a heuristic to + var eventTimeMs = inferTimeFromExpirationTime( + workInProgressRootLatestProcessedExpirationTime + ); + var currentTimeMs = now(); + var timeUntilExpirationMs = + expirationTimeToMs(expirationTime) - currentTimeMs; + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed < 0) { + // We get this wrong some time since we estimate the time. + timeElapsed = 0; + } + + _msUntilTimeout = jnd(timeElapsed) - timeElapsed; + + // Clamp the timeout to the expiration time. + // TODO: Once the event time is exact instead of inferred from expiration time + // we don't need this. + if (timeUntilExpirationMs < _msUntilTimeout) { + _msUntilTimeout = timeUntilExpirationMs; + } + } + + // Don't bother with a very short suspense time. + if (_msUntilTimeout > 10) { + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootCompleted: { + // The work completed. Ready to commit. + if ( + !isSync && + // do not delay if we're inside an act() scope + !( + true && + flushSuspenseFallbacksInTests && + IsThisRendererActing.current + ) && + workInProgressRootLatestProcessedExpirationTime !== Sync && + workInProgressRootCanSuspendUsingConfig !== null + ) { + // If we have exceeded the minimum loading delay, which probably + // means we have shown a spinner already, we might have to suspend + // a bit longer to ensure that the spinner is shown for enough time. + var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay( + workInProgressRootLatestProcessedExpirationTime, + expirationTime, + workInProgressRootCanSuspendUsingConfig + ); + if (_msUntilTimeout2 > 10) { + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout2 + ); + return null; + } + } + return commitRoot.bind(null, root); + } + default: { + (function() { + { + throw ReactError(Error("Unknown root exit status.")); + } + })(); + } + } +} + +function markCommitTimeOfFallback() { + globalMostRecentFallbackTime = now(); +} + +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + if ( + expirationTime < workInProgressRootLatestProcessedExpirationTime && + expirationTime > Never + ) { + workInProgressRootLatestProcessedExpirationTime = expirationTime; + } + if (suspenseConfig !== null) { + if ( + expirationTime < workInProgressRootLatestSuspenseTimeout && + expirationTime > Never + ) { + workInProgressRootLatestSuspenseTimeout = expirationTime; + // Most of the time we only have one config and getting wrong is not bad. + workInProgressRootCanSuspendUsingConfig = suspenseConfig; + } + } +} + +function renderDidSuspend() { + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootSuspended; + } +} + +function renderDidSuspendDelayIfPossible() { + if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) { + workInProgressRootExitStatus = RootSuspendedWithDelay; + } +} + +function renderDidError() { + if (workInProgressRootExitStatus !== RootCompleted) { + workInProgressRootExitStatus = RootErrored; + } +} + +// Called during render to determine if anything has suspended. +// Returns false if we're not sure. +function renderHasNotSuspendedYet() { + // If something errored or completed, we can't really be sure, + // so those are false. + return workInProgressRootExitStatus === RootIncomplete; +} + +function inferTimeFromExpirationTime(expirationTime) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; +} + +function inferTimeFromExpirationTimeWithSuspenseConfig( + expirationTime, + suspenseConfig +) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time by subtracting the timeout + // that was added to the event time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return ( + earliestExpirationTimeMs - + (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION) + ); +} + +function workLoopSync() { + // Already timed out, so perform work without checking if we need to yield. + while (workInProgress !== null) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function workLoop() { + // Perform work until Scheduler asks us to yield + while (workInProgress !== null && !shouldYield()) { + workInProgress = performUnitOfWork(workInProgress); + } +} + +function performUnitOfWork(unitOfWork) { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = unitOfWork.alternate; + + startWorkTimer(unitOfWork); + setCurrentFiber(unitOfWork); + + var next = void 0; + if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) { + startProfilerTimer(unitOfWork); + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); + } else { + next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); + } + + resetCurrentFiber(); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + if (next === null) { + // If this doesn't spawn new work, complete the current work. + next = completeUnitOfWork(unitOfWork); + } + + ReactCurrentOwner$2.current = null; + return next; +} + +function completeUnitOfWork(unitOfWork) { + // Attempt to complete the current unit of work, then move to the next + // sibling. If there are no more siblings, return to the parent fiber. + workInProgress = unitOfWork; + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current$$1 = workInProgress.alternate; + var returnFiber = workInProgress.return; + + // Check if the work completed or if something threw. + if ((workInProgress.effectTag & Incomplete) === NoEffect) { + setCurrentFiber(workInProgress); + var next = void 0; + if ( + !enableProfilerTimer || + (workInProgress.mode & ProfileMode) === NoMode + ) { + next = completeWork(current$$1, workInProgress, renderExpirationTime); + } else { + startProfilerTimer(workInProgress); + next = completeWork(current$$1, workInProgress, renderExpirationTime); + // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + } + stopWorkTimer(workInProgress); + resetCurrentFiber(); + resetChildExpirationTime(workInProgress); + + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + return next; + } + + if ( + returnFiber !== null && + // Do not append effects to parents if a sibling failed to complete + (returnFiber.effectTag & Incomplete) === NoEffect + ) { + // Append all the effects of the subtree and this fiber onto the effect + // list of the parent. The completion order of the children affects the + // side-effect order. + if (returnFiber.firstEffect === null) { + returnFiber.firstEffect = workInProgress.firstEffect; + } + if (workInProgress.lastEffect !== null) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; + } + returnFiber.lastEffect = workInProgress.lastEffect; + } + + // If this fiber had side-effects, we append it AFTER the children's + // side-effects. We can perform certain side-effects earlier if needed, + // by doing multiple passes over the effect list. We don't want to + // schedule our own side-effect on our own list because if end up + // reusing children we'll schedule this effect onto itself since we're + // at the end. + var effectTag = workInProgress.effectTag; + + // Skip both NoWork and PerformedWork tags when creating the effect + // list. PerformedWork effect is read by React DevTools but shouldn't be + // committed. + if (effectTag > PerformedWork) { + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = workInProgress; + } else { + returnFiber.firstEffect = workInProgress; + } + returnFiber.lastEffect = workInProgress; + } + } + } else { + // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + var _next = unwindWork(workInProgress, renderExpirationTime); + + // Because this fiber did not complete, don't reset its expiration time. + + if ( + enableProfilerTimer && + (workInProgress.mode & ProfileMode) !== NoMode + ) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); + + // Include the time spent working on failed children before continuing. + var actualDuration = workInProgress.actualDuration; + var child = workInProgress.child; + while (child !== null) { + actualDuration += child.actualDuration; + child = child.sibling; + } + workInProgress.actualDuration = actualDuration; + } + + if (_next !== null) { + // If completing this work spawned new work, do that next. We'll come + // back here again. + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + // TODO: The name stopFailedWorkTimer is misleading because Suspense + // also captures and restarts. + stopFailedWorkTimer(workInProgress); + _next.effectTag &= HostEffectMask; + return _next; + } + stopWorkTimer(workInProgress); + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its effect list. + returnFiber.firstEffect = returnFiber.lastEffect = null; + returnFiber.effectTag |= Incomplete; + } + } + + var siblingFiber = workInProgress.sibling; + if (siblingFiber !== null) { + // If there is more work to do in this returnFiber, do that next. + return siblingFiber; + } + // Otherwise, return to the parent + workInProgress = returnFiber; + } while (workInProgress !== null); + + // We've reached the root. + if (workInProgressRootExitStatus === RootIncomplete) { + workInProgressRootExitStatus = RootCompleted; + } + return null; +} + +function resetChildExpirationTime(completedWork) { + if ( + renderExpirationTime !== Never && + completedWork.childExpirationTime === Never + ) { + // The children of this component are hidden. Don't bubble their + // expiration times. + return; + } + + var newChildExpirationTime = NoWork; + + // Bubble up the earliest expiration time. + if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) { + // In profiling mode, resetChildExpirationTime is also used to reset + // profiler durations. + var actualDuration = completedWork.actualDuration; + var treeBaseDuration = completedWork.selfBaseDuration; + + // When a fiber is cloned, its actualDuration is reset to 0. This value will + // only be updated if work is done on the fiber (i.e. it doesn't bailout). + // When work is done, it should bubble to the parent's actualDuration. If + // the fiber has not been cloned though, (meaning no work was done), then + // this value will reflect the amount of time spent working on a previous + // render. In that case it should not bubble. We determine whether it was + // cloned by comparing the child pointer. + var shouldBubbleActualDurations = + completedWork.alternate === null || + completedWork.child !== completedWork.alternate.child; + + var child = completedWork.child; + while (child !== null) { + var childUpdateExpirationTime = child.expirationTime; + var childChildExpirationTime = child.childExpirationTime; + if (childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childUpdateExpirationTime; + } + if (childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = childChildExpirationTime; + } + if (shouldBubbleActualDurations) { + actualDuration += child.actualDuration; + } + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + completedWork.actualDuration = actualDuration; + completedWork.treeBaseDuration = treeBaseDuration; + } else { + var _child = completedWork.child; + while (_child !== null) { + var _childUpdateExpirationTime = _child.expirationTime; + var _childChildExpirationTime = _child.childExpirationTime; + if (_childUpdateExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childUpdateExpirationTime; + } + if (_childChildExpirationTime > newChildExpirationTime) { + newChildExpirationTime = _childChildExpirationTime; + } + _child = _child.sibling; + } + } + + completedWork.childExpirationTime = newChildExpirationTime; +} + +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority( + ImmediatePriority, + commitRootImpl.bind(null, root, renderPriorityLevel) + ); + // If there are passive effects, schedule a callback to flush them. This goes + // outside commitRootImpl so that it inherits the priority of the render. + if (rootWithPendingPassiveEffects !== null) { + scheduleCallback(NormalPriority, function() { + flushPassiveEffects(); + return null; + }); + } + return null; +} + +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + flushRenderPhaseStrictModeWarningsInDEV(); + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); + } + })(); + + var finishedWork = root.finishedWork; + var expirationTime = root.finishedExpirationTime; + if (finishedWork === null) { + return null; + } + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + + (function() { + if (!(finishedWork !== root.current)) { + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); + + // commitRoot never returns a continuation; it always finishes synchronously. + // So we can clear these now to allow a new callback to be scheduled. + root.callbackNode = null; + root.callbackExpirationTime = NoWork; + + startCommitTimer(); + + // Update the first and last pending times on this root. The new first + // pending time is whatever is left on the root fiber. + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime; + var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + var firstPendingTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = firstPendingTimeBeforeCommit; + if (firstPendingTimeBeforeCommit < root.lastPendingTime) { + // This usually means we've finished all the work, but it can also happen + // when something gets downprioritized during render, like a hidden tree. + root.lastPendingTime = firstPendingTimeBeforeCommit; + } + + if (root === workInProgressRoot) { + // We can reset these now that they are finished. + workInProgressRoot = null; + workInProgress = null; + renderExpirationTime = NoWork; + } else { + } + // This indicates that the last root we worked on is not the same one that + // we're committing now. This most commonly happens when a suspended root + // times out. + + // Get the list of effects. + var firstEffect = void 0; + if (finishedWork.effectTag > PerformedWork) { + // A fiber's effect list consists only of its children, not itself. So if + // the root has an effect, we need to add it to the end of the list. The + // resulting list is the set that would belong to the root's parent, if it + // had one; that is, all the effects in the tree including the root. + if (finishedWork.lastEffect !== null) { + finishedWork.lastEffect.nextEffect = finishedWork; + firstEffect = finishedWork.firstEffect; + } else { + firstEffect = finishedWork; + } + } else { + // There is no effect on the root. + firstEffect = finishedWork.firstEffect; + } + + if (firstEffect !== null) { + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + // Reset this to null before calling lifecycles + ReactCurrentOwner$2.current = null; + + // The commit phase is broken into several sub-phases. We do a separate pass + // of the effect list for each phase: all mutation effects come before all + // layout effects, and so on. + + // The first phase a "before mutation" phase. We use this phase to read the + // state of the host tree right before we mutate it. This is where + // getSnapshotBeforeUpdate is called. + startCommitSnapshotEffectsTimer(); + prepareForCommit(root.containerInfo); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback(null, commitBeforeMutationEffects, null); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitSnapshotEffectsTimer(); + + if (enableProfilerTimer) { + // Mark the current commit time to be shared by all Profilers in this + // batch. This enables them to be grouped later. + recordCommitTime(); + } + + // The next phase is the mutation phase, where we mutate the host tree. + startCommitHostEffectsTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitMutationEffects, + null, + renderPriorityLevel + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitHostEffectsTimer(); + resetAfterCommit(root.containerInfo); + + // The work-in-progress tree is now the current tree. This must come after + // the mutation phase, so that the previous tree is still current during + // componentWillUnmount, but before the layout phase, so that the finished + // work is current during componentDidMount/Update. + root.current = finishedWork; + + // The next phase is the layout phase, where we call effects that read + // the host tree after it's been mutated. The idiomatic use case for this is + // layout, but class component lifecycles also fire here for legacy reasons. + startCommitLifeCyclesTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitLayoutEffects, + null, + root, + expirationTime + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error2 = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error2); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitLifeCyclesTimer(); + + nextEffect = null; + + // Tell Scheduler to yield at the end of the frame, so the browser has an + // opportunity to paint. + requestPaint(); + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + executionContext = prevExecutionContext; + } else { + // No effects. + root.current = finishedWork; + // Measure these anyway so the flamegraph explicitly shows that there were + // no effects. + // TODO: Maybe there's a better way to report this. + startCommitSnapshotEffectsTimer(); + stopCommitSnapshotEffectsTimer(); + if (enableProfilerTimer) { + recordCommitTime(); + } + startCommitHostEffectsTimer(); + stopCommitHostEffectsTimer(); + startCommitLifeCyclesTimer(); + stopCommitLifeCyclesTimer(); + } + + stopCommitTimer(); + + var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; + + if (rootDoesHavePassiveEffects) { + // This commit has passive effects. Stash a reference to them. But don't + // schedule a callback until after flushing layout work. + rootDoesHavePassiveEffects = false; + rootWithPendingPassiveEffects = root; + pendingPassiveEffectsExpirationTime = expirationTime; + pendingPassiveEffectsRenderPriority = renderPriorityLevel; + } else { + // We are done with the effect chain at this point so let's clear the + // nextEffect pointers to assist with GC. If we have passive effects, we'll + // clear this in flushPassiveEffects. + nextEffect = firstEffect; + while (nextEffect !== null) { + var nextNextEffect = nextEffect.nextEffect; + nextEffect.nextEffect = null; + nextEffect = nextNextEffect; + } + } + + // Check if there's remaining work on this root + var remainingExpirationTime = root.firstPendingTime; + if (remainingExpirationTime !== NoWork) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + remainingExpirationTime + ); + + if (enableSchedulerTracing) { + if (spawnedWorkDuringRender !== null) { + var expirationTimes = spawnedWorkDuringRender; + spawnedWorkDuringRender = null; + for (var i = 0; i < expirationTimes.length; i++) { + scheduleInteractions( + root, + expirationTimes[i], + root.memoizedInteractions + ); + } + } + } + + scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); + } else { + // If there's no remaining work, we can clear the set of already failed + // error boundaries. + legacyErrorBoundariesThatAlreadyFailed = null; + } + + if (enableSchedulerTracing) { + if (!rootDidHavePassiveEffects) { + // If there are no passive effects, then we can complete the pending interactions. + // Otherwise, we'll wait until after the passive effects are flushed. + // Wait to do this until after remaining work has been scheduled, + // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. + finishPendingInteractions(root, expirationTime); + } + } + + onCommitRoot(finishedWork.stateNode, expirationTime); + + if (remainingExpirationTime === Sync) { + // Count the number of times the root synchronously re-renders without + // finishing. If there are too many, it indicates an infinite update loop. + if (root === rootWithNestedUpdates) { + nestedUpdateCount++; + } else { + nestedUpdateCount = 0; + rootWithNestedUpdates = root; + } + } else { + nestedUpdateCount = 0; + } + + if (hasUncaughtError) { + hasUncaughtError = false; + var _error3 = firstUncaughtError; + firstUncaughtError = null; + throw _error3; + } + + if ((executionContext & LegacyUnbatchedContext) !== NoContext) { + // This is a legacy edge case. We just committed the initial mount of + // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired + // synchronously, but layout updates should be deferred until the end + // of the batch. + return null; + } + + // If layout work was scheduled, flush it now. + flushSyncCallbackQueue(); + return null; +} + +function commitBeforeMutationEffects() { + while (nextEffect !== null) { + if ((nextEffect.effectTag & Snapshot) !== NoEffect) { + setCurrentFiber(nextEffect); + recordEffect(); + + var current$$1 = nextEffect.alternate; + commitBeforeMutationLifeCycles(current$$1, nextEffect); + + resetCurrentFiber(); + } + nextEffect = nextEffect.nextEffect; + } +} + +function commitMutationEffects(renderPriorityLevel) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & ContentReset) { + commitResetTextContent(nextEffect); + } + + if (effectTag & Ref) { + var current$$1 = nextEffect.alternate; + if (current$$1 !== null) { + commitDetachRef(current$$1); + } + } + + // The following switch statement is only concerned about placement, + // updates, and deletions. To avoid needing to add a case for every possible + // bitmap value, we remove the secondary effects from the effect tag and + // switch on that value. + var primaryEffectTag = effectTag & (Placement | Update | Deletion); + switch (primaryEffectTag) { + case Placement: { + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + // TODO: findDOMNode doesn't rely on this any more but isMounted does + // and isMounted is deprecated anyway so we should be able to kill this. + nextEffect.effectTag &= ~Placement; + break; + } + case PlacementAndUpdate: { + // Placement + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + nextEffect.effectTag &= ~Placement; + + // Update + var _current = nextEffect.alternate; + commitWork(_current, nextEffect); + break; + } + case Update: { + var _current2 = nextEffect.alternate; + commitWork(_current2, nextEffect); + break; + } + case Deletion: { + commitDeletion(nextEffect, renderPriorityLevel); + break; + } + } + + // TODO: Only record a mutation effect if primaryEffectTag is non-zero. + recordEffect(); + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function commitLayoutEffects(root, committedExpirationTime) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & (Update | Callback)) { + recordEffect(); + var current$$1 = nextEffect.alternate; + commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); + } + + if (effectTag & Ref) { + recordEffect(); + commitAttachRef(nextEffect); + } + + if (effectTag & Passive) { + rootDoesHavePassiveEffects = true; + } + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function flushPassiveEffects() { + if (rootWithPendingPassiveEffects === null) { + return false; + } + var root = rootWithPendingPassiveEffects; + var expirationTime = pendingPassiveEffectsExpirationTime; + var renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = NoWork; + pendingPassiveEffectsRenderPriority = NoPriority; + var priorityLevel = + renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; + return runWithPriority( + priorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} + +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + } + })(); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + + // Note: This currently assumes there are no passive effects on the root + // fiber, because the root is not part of its own effect list. This could + // change in the future. + var effect = root.current.firstEffect; + while (effect !== null) { + { + setCurrentFiber(effect); + invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); + if (hasCaughtError()) { + (function() { + if (!(effect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(effect, error); + } + resetCurrentFiber(); + } + var nextNextEffect = effect.nextEffect; + // Remove nextEffect pointer to assist GC + effect.nextEffect = null; + effect = nextNextEffect; + } + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); + } + + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + + // If additional passive effects were scheduled, increment a counter. If this + // exceeds the limit, we'll fire a warning. + nestedPassiveUpdateCount = + rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + + return true; +} + +function isAlreadyFailedLegacyErrorBoundary(instance) { + return ( + legacyErrorBoundariesThatAlreadyFailed !== null && + legacyErrorBoundariesThatAlreadyFailed.has(instance) + ); +} + +function markLegacyErrorBoundaryAsFailed(instance) { + if (legacyErrorBoundariesThatAlreadyFailed === null) { + legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); + } else { + legacyErrorBoundariesThatAlreadyFailed.add(instance); + } +} + +function prepareToThrowUncaughtError(error) { + if (!hasUncaughtError) { + hasUncaughtError = true; + firstUncaughtError = error; + } +} +var onUncaughtError = prepareToThrowUncaughtError; + +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); + enqueueUpdate(rootFiber, update); + var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } +} + +function captureCommitPhaseError(sourceFiber, error) { + if (sourceFiber.tag === HostRoot) { + // Error was thrown at the root. There is no parent, so the root + // itself should capture it. + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } + + var fiber = sourceFiber.return; + while (fiber !== null) { + if (fiber.tag === HostRoot) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } else if (fiber.tag === ClassComponent) { + var ctor = fiber.type; + var instance = fiber.stateNode; + if ( + typeof ctor.getDerivedStateFromError === "function" || + (typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance)) + ) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createClassErrorUpdate( + fiber, + errorInfo, + // TODO: This is always sync + Sync + ); + enqueueUpdate(fiber, update); + var root = markUpdateTimeFromFiberToRoot(fiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } + return; + } + } + fiber = fiber.return; + } +} + +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + if (pingCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + pingCache.delete(thenable); + } + + if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { + // Received a ping at the same priority level at which we're currently + // rendering. We might want to restart this render. This should mirror + // the logic of whether or not a root suspends once it completes. + + // TODO: If we're rendering sync either due to Sync, Batched or expired, + // we should probably never restart. + + // If we're suspended with delay, we'll always suspend so we can always + // restart. If we're suspended without any updates, it might be a retry. + // If it's early in the retry we can restart. We can't know for sure + // whether we'll eventually process an update during this render pass, + // but it's somewhat unlikely that we get to a ping before that, since + // getting to the root most update is usually very fast. + if ( + workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + workInProgressRootLatestProcessedExpirationTime === Sync && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ) { + // Restart from the root. Don't need to schedule a ping because + // we're already working on this tree. + prepareFreshStack(root, renderExpirationTime); + } else { + // Even though we can't restart right now, we might get an + // opportunity later. So we mark this render as having a ping. + workInProgressRootHasPendingPing = true; + } + return; + } + + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < suspendedTime) { + // The root is no longer suspended at this time. + return; + } + + var pingTime = root.pingTime; + if (pingTime !== NoWork && pingTime < suspendedTime) { + // There's already a lower priority ping scheduled. + return; + } + + // Mark the time at which this ping was scheduled. + root.pingTime = suspendedTime; + + if (root.finishedExpirationTime === suspendedTime) { + // If there's a pending fallback waiting to commit, throw it away. + root.finishedExpirationTime = NoWork; + root.finishedWork = null; + } + + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + suspendedTime + ); + scheduleCallbackForRoot(root, priorityLevel, suspendedTime); +} + +function retryTimedOutBoundary(boundaryFiber) { + // The boundary fiber (a Suspense component or SuspenseList component) + // previously was rendered in its fallback state. One of the promises that + // suspended it has resolved, which means at least part of the tree was + // likely unblocked. Try rendering again, at a new expiration time. + var currentTime = requestCurrentTime(); + var suspenseConfig = null; // Retries don't carry over the already committed update. + var retryTime = computeExpirationForFiber( + currentTime, + boundaryFiber, + suspenseConfig + ); + // TODO: Special case idle priority? + var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); + var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); + if (root !== null) { + scheduleCallbackForRoot(root, priorityLevel, retryTime); + } +} + +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = void 0; + if (enableSuspenseServerRenderer) { + switch (boundaryFiber.tag) { + case SuspenseComponent: + retryCache = boundaryFiber.stateNode; + break; + case DehydratedSuspenseComponent: + retryCache = boundaryFiber.memoizedState; + break; + default: + (function() { + { + throw ReactError( + Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." + ) + ); + } + })(); + } + } else { + retryCache = boundaryFiber.stateNode; + } + + if (retryCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + retryCache.delete(thenable); + } + + retryTimedOutBoundary(boundaryFiber); +} + +// Computes the next Just Noticeable Difference (JND) boundary. +// The theory is that a person can't tell the difference between small differences in time. +// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable +// difference in the experience. However, waiting for longer might mean that we can avoid +// showing an intermediate loading state. The longer we have already waited, the harder it +// is to tell small differences in time. Therefore, the longer we've already waited, +// the longer we can wait additionally. At some point we have to give up though. +// We pick a train model where the next boundary commits at a consistent schedule. +// These particular numbers are vague estimates. We expect to adjust them based on research. +function jnd(timeElapsed) { + return timeElapsed < 120 + ? 120 + : timeElapsed < 480 + ? 480 + : timeElapsed < 1080 + ? 1080 + : timeElapsed < 1920 + ? 1920 + : timeElapsed < 3000 + ? 3000 + : timeElapsed < 4320 + ? 4320 + : ceil(timeElapsed / 1960) * 1960; +} + +function computeMsUntilSuspenseLoadingDelay( + mostRecentEventTime, + committedExpirationTime, + suspenseConfig +) { + var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0; + if (busyMinDurationMs <= 0) { + return 0; + } + var busyDelayMs = suspenseConfig.busyDelayMs | 0; + + // Compute the time until this render pass would expire. + var currentTimeMs = now(); + var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig( + mostRecentEventTime, + suspenseConfig + ); + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed <= busyDelayMs) { + // If we haven't yet waited longer than the initial delay, we don't + // have to wait any additional time. + return 0; + } + var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; + // This is the value that is passed to `setTimeout`. + return msUntilTimeout; +} + +function checkForNestedUpdates() { + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { + nestedUpdateCount = 0; + rootWithNestedUpdates = null; + (function() { + { + throw ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + ); + } + })(); + } + + { + if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { + nestedPassiveUpdateCount = 0; + warning$1( + false, + "Maximum update depth exceeded. This can happen when a component " + + "calls setState inside useEffect, but useEffect either doesn't " + + "have a dependency array, or one of the dependencies changes on " + + "every render." + ); + } + } +} + +function flushRenderPhaseStrictModeWarningsInDEV() { + { + ReactStrictModeWarnings.flushLegacyContextWarning(); + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); + } + } +} + +function stopFinishedWorkLoopTimer() { + var didCompleteRoot = true; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function stopInterruptedWorkLoopTimer() { + // TODO: Track which fiber caused the interruption. + var didCompleteRoot = false; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { + if ( + enableUserTimingAPI && + workInProgressRoot !== null && + updateExpirationTime > renderExpirationTime + ) { + interruptedBy = fiberThatReceivedUpdate; + } +} + +var didWarnStateUpdateForUnmountedComponent = null; +function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + { + var tag = fiber.tag; + if ( + tag !== HostRoot && + tag !== ClassComponent && + tag !== FunctionComponent && + tag !== ForwardRef && + tag !== MemoComponent && + tag !== SimpleMemoComponent + ) { + // Only warn for user-defined components, not internal ones like Suspense. + return; + } + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForUnmountedComponent !== null) { + if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { + return; + } + didWarnStateUpdateForUnmountedComponent.add(componentName); + } else { + didWarnStateUpdateForUnmountedComponent = new Set([componentName]); + } + warningWithoutStack$1( + false, + "Can't perform a React state update on an unmounted component. This " + + "is a no-op, but it indicates a memory leak in your application. To " + + "fix, cancel all subscriptions and asynchronous tasks in %s.%s", + tag === ClassComponent + ? "the componentWillUnmount method" + : "a useEffect cleanup function", + getStackByFiberInDevAndProd(fiber) + ); + } +} + +var beginWork$$1 = void 0; +if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { + var dummyFiber = null; + beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { + // If a component throws an error, we replay it again in a synchronously + // dispatched event, so that the debugger will treat it as an uncaught + // error See ReactErrorUtils for more information. + + // Before entering the begin phase, copy the work-in-progress onto a dummy + // fiber. If beginWork throws, we'll use this to reset the state. + var originalWorkInProgressCopy = assignFiberPropertiesInDEV( + dummyFiber, + unitOfWork + ); + try { + return beginWork$1(current$$1, unitOfWork, expirationTime); + } catch (originalError) { + if ( + originalError !== null && + typeof originalError === "object" && + typeof originalError.then === "function" + ) { + // Don't replay promises. Treat everything else like an error. + throw originalError; + } + + // Keep this code in sync with renderRoot; any changes here must have + // corresponding changes there. + resetContextDependencies(); + resetHooks(); + + // Unwind the failed stack frame + unwindInterruptedWork(unitOfWork); + + // Restore the original properties of the fiber. + assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + + if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { + // Reset the profiler timer. + startProfilerTimer(unitOfWork); + } + + // Run beginWork again. + invokeGuardedCallback( + null, + beginWork$1, + null, + current$$1, + unitOfWork, + expirationTime + ); + + if (hasCaughtError()) { + var replayError = clearCaughtError(); + // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. + // Rethrow this error instead of the original one. + throw replayError; + } else { + // This branch is reachable if the render phase is impure. + throw originalError; + } + } + }; +} else { + beginWork$$1 = beginWork$1; +} + +var didWarnAboutUpdateInRender = false; +var didWarnAboutUpdateInGetChildContext = false; +function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { + { + if (fiber.tag === ClassComponent) { + switch (phase) { + case "getChildContext": + if (didWarnAboutUpdateInGetChildContext) { + return; + } + warningWithoutStack$1( + false, + "setState(...): Cannot call setState() inside getChildContext()" + ); + didWarnAboutUpdateInGetChildContext = true; + break; + case "render": + if (didWarnAboutUpdateInRender) { + return; + } + warningWithoutStack$1( + false, + "Cannot update during an existing state transition (such as " + + "within `render`). Render methods should be a pure function of " + + "props and state." + ); + didWarnAboutUpdateInRender = true; + break; + } + } + } +} + +// a 'shared' variable that changes when act() opens/closes in tests. +var IsThisRendererActing = { current: false }; + +function warnIfNotScopedWithMatchingAct(fiber) { + { + if ( + warnsIfNotActing === true && + IsSomeRendererActing.current === true && + IsThisRendererActing.current !== true + ) { + warningWithoutStack$1( + false, + "It looks like you're using the wrong act() around your test interactions.\n" + + "Be sure to use the matching version of act() corresponding to your renderer:\n\n" + + "// for react-dom:\n" + + "import {act} from 'react-dom/test-utils';\n" + + "// ...\n" + + "act(() => ...);\n\n" + + "// for react-test-renderer:\n" + + "import TestRenderer from 'react-test-renderer';\n" + + "const {act} = TestRenderer;\n" + + "// ...\n" + + "act(() => ...);" + + "%s", + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +function warnIfNotCurrentlyActingEffectsInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + (fiber.mode & StrictMode) !== NoMode && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s ran an effect, but was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + executionContext === NoContext && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s inside a test was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; + +// In tests, we want to enforce a mocked scheduler. +var didWarnAboutUnmockedScheduler = false; +// TODO Before we release concurrent mode, revisit this and decide whether a mocked +// scheduler is the actual recommendation. The alternative could be a testing build, +// a new lib, or whatever; we dunno just yet. This message is for early adopters +// to get their tests right. + +function warnIfUnmockedScheduler(fiber) { + { + if ( + didWarnAboutUnmockedScheduler === false && + Scheduler.unstable_flushAllWithoutAsserting === undefined + ) { + if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } else if (warnAboutUnmockedScheduler === true) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'Starting from React v17, the "scheduler" module will need to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } + } + } +} + +var componentsThatTriggeredHighPriSuspend = null; +function checkForWrongSuspensePriorityInDEV(sourceFiber) { + { + var currentPriorityLevel = getCurrentPriorityLevel(); + if ( + (sourceFiber.mode & ConcurrentMode) !== NoEffect && + (currentPriorityLevel === UserBlockingPriority || + currentPriorityLevel === ImmediatePriority) + ) { + var workInProgressNode = sourceFiber; + while (workInProgressNode !== null) { + // Add the component that triggered the suspense + var current$$1 = workInProgressNode.alternate; + if (current$$1 !== null) { + // TODO: warn component that triggers the high priority + // suspend is the HostRoot + switch (workInProgressNode.tag) { + case ClassComponent: + // Loop through the component's update queue and see whether the component + // has triggered any high priority updates + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var update = updateQueue.firstUpdate; + while (update !== null) { + var priorityLevel = update.priority; + if ( + priorityLevel === UserBlockingPriority || + priorityLevel === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + update = update.next; + } + } + break; + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + if ( + workInProgressNode.memoizedState !== null && + workInProgressNode.memoizedState.baseUpdate !== null + ) { + var _update = workInProgressNode.memoizedState.baseUpdate; + // Loop through the functional component's memoized state to see whether + // the component has triggered any high pri updates + while (_update !== null) { + var priority = _update.priority; + if ( + priority === UserBlockingPriority || + priority === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + if ( + _update.next === workInProgressNode.memoizedState.baseUpdate + ) { + break; + } + _update = _update.next; + } + } + break; + default: + break; + } + } + workInProgressNode = workInProgressNode.return; + } + } + } +} + +function flushSuspensePriorityWarningInDEV() { + { + if (componentsThatTriggeredHighPriSuspend !== null) { + var componentNames = []; + componentsThatTriggeredHighPriSuspend.forEach(function(name) { + return componentNames.push(name); + }); + componentsThatTriggeredHighPriSuspend = null; + + if (componentNames.length > 0) { + warningWithoutStack$1( + false, + "%s triggered a user-blocking update that suspended." + + "\n\n" + + "The fix is to split the update into multiple parts: a user-blocking " + + "update to provide immediate feedback, and another update that " + + "triggers the bulk of the changes." + + "\n\n" + + "Refer to the documentation for useSuspenseTransition to learn how " + + "to implement this pattern.", + // TODO: Add link to React docs with more information, once it exists + componentNames.sort().join(", ") + ); + } + } + } +} + +function computeThreadID(root, expirationTime) { + // Interaction threads are unique per root and expiration time. + return expirationTime * 1000 + root.interactionThreadID; +} + +function markSpawnedWork(expirationTime) { + if (!enableSchedulerTracing) { + return; + } + if (spawnedWorkDuringRender === null) { + spawnedWorkDuringRender = [expirationTime]; + } else { + spawnedWorkDuringRender.push(expirationTime); + } +} + +function scheduleInteractions(root, expirationTime, interactions) { + if (!enableSchedulerTracing) { + return; + } + + if (interactions.size > 0) { + var pendingInteractionMap = root.pendingInteractionMap; + var pendingInteractions = pendingInteractionMap.get(expirationTime); + if (pendingInteractions != null) { + interactions.forEach(function(interaction) { + if (!pendingInteractions.has(interaction)) { + // Update the pending async work count for previously unscheduled interaction. + interaction.__count++; + } + + pendingInteractions.add(interaction); + }); + } else { + pendingInteractionMap.set(expirationTime, new Set(interactions)); + + // Update the pending async work count for the current interactions. + interactions.forEach(function(interaction) { + interaction.__count++; + }); + } + + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + subscriber.onWorkScheduled(interactions, threadID); + } + } +} + +function schedulePendingInteractions(root, expirationTime) { + // This is called when work is scheduled on a root. + // It associates the current interactions with the newly-scheduled expiration. + // They will be restored when that expiration is later committed. + if (!enableSchedulerTracing) { + return; + } + + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); +} + +function startWorkOnPendingInteractions(root, expirationTime) { + // This is called when new work is started on a root. + if (!enableSchedulerTracing) { + return; + } + + // Determine which interactions this batch of work currently includes, So that + // we can accurately attribute time spent working on it, And so that cascading + // work triggered during the render phase will be associated with it. + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + if (scheduledExpirationTime >= expirationTime) { + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + } + }); + + // Store the current set of interactions on the FiberRoot for a few reasons: + // We can re-use it in hot functions like renderRoot() without having to + // recalculate it. We will also use it in commitWork() to pass to any Profiler + // onRender() hooks. This also provides DevTools with a way to access it when + // the onCommitRoot() hook is called. + root.memoizedInteractions = interactions; + + if (interactions.size > 0) { + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } + } +} + +function finishPendingInteractions(root, committedExpirationTime) { + if (!enableSchedulerTracing) { + return; + } + + var earliestRemainingTimeAfterCommit = root.firstPendingTime; + + var subscriber = void 0; + + try { + subscriber = tracing.__subscriberRef.current; + if (subscriber !== null && root.memoizedInteractions.size > 0) { + var threadID = computeThreadID(root, committedExpirationTime); + subscriber.onWorkStopped(root.memoizedInteractions, threadID); + } + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } finally { + // Clear completed interactions from the pending Map. + // Unless the render was suspended or cascading work was scheduled, + // In which case– leave pending interactions until the subsequent render. + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + // Only decrement the pending interaction count if we're done. + // If there's still work at the current priority, + // That indicates that we are waiting for suspense data. + if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { + pendingInteractionMap.delete(scheduledExpirationTime); + + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; + + if (subscriber !== null && interaction.__count === 0) { + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } + }); + } + }); + } +} + +var onCommitFiberRoot = null; +var onCommitFiberUnmount = null; +var hasLoggedError = false; + +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; + +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { + // No DevTools + return false; + } + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } + if (!hook.supportsFiber) { + { + warningWithoutStack$1( + false, + "The installed version of React DevTools is too old and will not work " + + "with the current version of React. Please update React DevTools. " + + "https://fb.me/react-devtools" + ); + } + // DevTools exists, even though it doesn't support Fiber. + return true; + } + try { + var rendererID = hook.inject(internals); + // We have successfully injected, so now it is safe to set up hooks. + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = (root.current.effectTag & DidCapture) === DidCapture; + if (enableProfilerTimer) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } else { + hook.onCommitFiberRoot(rendererID, root, undefined, didError); + } + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } + } + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } + } + }; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s.", + err + ); + } + } + // DevTools exists + return true; +} + +function onCommitRoot(root, expirationTime) { + if (typeof onCommitFiberRoot === "function") { + onCommitFiberRoot(root, expirationTime); + } +} + +function onCommitUnmount(fiber) { + if (typeof onCommitFiberUnmount === "function") { + onCommitFiberUnmount(fiber); + } +} + +var hasBadMapPolyfill = void 0; + +{ + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + var testMap = new Map([[nonExtensibleObject, null]]); + var testSet = new Set([nonExtensibleObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; + } +} + +// A Fiber is work on a Component that needs to be done or was done. There can +// be more than one per component. + +var debugCounter = void 0; + +{ + debugCounter = 1; +} + +function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.elementType = null; + this.type = null; + this.stateNode = null; + + // Fiber + this.return = null; + this.child = null; + this.sibling = null; + this.index = 0; + + this.ref = null; + + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + this.dependencies = null; + + this.mode = mode; + + // Effects + this.effectTag = NoEffect; + this.nextEffect = null; + + this.firstEffect = null; + this.lastEffect = null; + + this.expirationTime = NoWork; + this.childExpirationTime = NoWork; + + this.alternate = null; + + if (enableProfilerTimer) { + // Note: The following is done to avoid a v8 performance cliff. + // + // Initializing the fields below to smis and later updating them with + // double values will cause Fibers to end up having separate shapes. + // This behavior/bug has something to do with Object.preventExtension(). + // Fortunately this only impacts DEV builds. + // Unfortunately it makes React unusably slow for some applications. + // To work around this, initialize the fields below with doubles. + // + // Learn more about this here: + // https://github.com/facebook/react/issues/14365 + // https://bugs.chromium.org/p/v8/issues/detail?id=8538 + this.actualDuration = Number.NaN; + this.actualStartTime = Number.NaN; + this.selfBaseDuration = Number.NaN; + this.treeBaseDuration = Number.NaN; + + // It's okay to replace the initial doubles with smis after initialization. + // This won't trigger the performance cliff mentioned above, + // and it simplifies other profiler code (including DevTools). + this.actualDuration = 0; + this.actualStartTime = -1; + this.selfBaseDuration = 0; + this.treeBaseDuration = 0; + } + + { + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugIsCurrentlyTiming = false; + this._debugNeedsRemount = false; + this._debugHookTypes = null; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { + Object.preventExtensions(this); + } + } +} + +// This is a constructor function, rather than a POJO constructor, still +// please ensure we do the following: +// 1) Nobody should add any instance methods on this. Instance methods can be +// more difficult to predict when they get optimized and they are almost +// never inlined properly in static compilers. +// 2) Nobody should rely on `instanceof Fiber` for type testing. We should +// always know when it is a fiber. +// 3) We might want to experiment with using numeric keys since they are easier +// to optimize in a non-JIT environment. +// 4) We can easily go from a constructor to a createFiber object literal if that +// is faster. +// 5) It should be easy to port this to a C struct and keep a C implementation +// compatible. +var createFiber = function(tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); +}; + +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} + +function isSimpleFunctionComponent(type) { + return ( + typeof type === "function" && + !shouldConstruct(type) && + type.defaultProps === undefined + ); +} + +function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + return IndeterminateComponent; +} + +// This is used to create an alternate fiber to do work on. +function createWorkInProgress(current, pendingProps, expirationTime) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + ); + workInProgress.elementType = current.elementType; + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; + + { + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; + workInProgress._debugHookTypes = current._debugHookTypes; + } + + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; + + // We already have an alternate. + // Reset the effect tag. + workInProgress.effectTag = NoEffect; + + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + + if (enableProfilerTimer) { + // We intentionally reset, rather than copy, actualDuration & actualStartTime. + // This prevents time from endlessly accumulating in new commits. + // This has the downside of resetting values for different priority renders, + // But works for yielding (the common case) and should support resuming. + workInProgress.actualDuration = 0; + workInProgress.actualStartTime = -1; + } + } + + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; + + // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + + if (enableProfilerTimer) { + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } + + { + workInProgress._debugNeedsRemount = current._debugNeedsRemount; + switch (workInProgress.tag) { + case IndeterminateComponent: + case FunctionComponent: + case SimpleMemoComponent: + workInProgress.type = resolveFunctionForHotReloading(current.type); + break; + case ClassComponent: + workInProgress.type = resolveClassForHotReloading(current.type); + break; + case ForwardRef: + workInProgress.type = resolveForwardRefForHotReloading(current.type); + break; + default: + break; + } + } + + return workInProgress; +} + +// Used to reuse a Fiber for a second pass. +function resetWorkInProgress(workInProgress, renderExpirationTime) { + // This resets the Fiber to what createFiber or createWorkInProgress would + // have set the values to before during the first pass. Ideally this wouldn't + // be necessary but unfortunately many code paths reads from the workInProgress + // when they should be reading from current and writing to workInProgress. + + // We assume pendingProps, index, key, ref, return are still untouched to + // avoid doing another reconciliation. + + // Reset the effect tag but keep any Placement tags, since that's something + // that child fiber is setting, not the reconciliation. + workInProgress.effectTag &= Placement; + + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + + var current = workInProgress.alternate; + if (current === null) { + // Reset to createFiber's initial values. + workInProgress.childExpirationTime = NoWork; + workInProgress.expirationTime = renderExpirationTime; + + workInProgress.child = null; + workInProgress.memoizedProps = null; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; + + workInProgress.dependencies = null; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = 0; + workInProgress.treeBaseDuration = 0; + } + } else { + // Reset to the cloned values that createWorkInProgress would've. + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } + } + + return workInProgress; +} + +function createHostRootFiber(tag) { + var mode = void 0; + if (tag === ConcurrentRoot) { + mode = ConcurrentMode | BatchedMode | StrictMode; + } else if (tag === BatchedRoot) { + mode = BatchedMode | StrictMode; + } else { + mode = NoMode; + } + + if (enableProfilerTimer && isDevToolsPresent) { + // Always collect profile timings when DevTools are present. + // This enables DevTools to start capturing timing at any point– + // Without some nodes in the tree having empty base times. + mode |= ProfileMode; + } + + return createFiber(HostRoot, null, null, mode); +} + +function createFiberFromTypeAndProps( + type, // React$ElementType + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiber = void 0; + + var fiberTag = IndeterminateComponent; + // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var resolvedType = type; + if (typeof type === "function") { + if (shouldConstruct(type)) { + fiberTag = ClassComponent; + { + resolvedType = resolveClassForHotReloading(resolvedType); + } + } else { + { + resolvedType = resolveFunctionForHotReloading(resolvedType); + } + } + } else if (typeof type === "string") { + fiberTag = HostComponent; + } else { + getTag: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = Mode; + mode |= ConcurrentMode | BatchedMode | StrictMode; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; + break; + case REACT_PROFILER_TYPE: + return createFiberFromProfiler(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_TYPE: + return createFiberFromSuspense(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_LIST_TYPE: + return createFiberFromSuspenseList( + pendingProps, + mode, + expirationTime, + key + ); + default: { + if (typeof type === "object" && type !== null) { + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break getTag; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break getTag; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + { + resolvedType = resolveForwardRefForHotReloading(resolvedType); + } + break getTag; + case REACT_MEMO_TYPE: + fiberTag = MemoComponent; + break getTag; + case REACT_LAZY_TYPE: + fiberTag = LazyComponent; + resolvedType = null; + break getTag; + case REACT_FUNDAMENTAL_TYPE: + if (enableFundamentalAPI) { + return createFiberFromFundamental( + type, + pendingProps, + mode, + expirationTime, + key + ); + } + break; + } + } + var info = ""; + { + if ( + type === undefined || + (typeof type === "object" && + type !== null && + Object.keys(type).length === 0) + ) { + info += + " You likely forgot to export your component from the file " + + "it's defined in, or you might have mixed up default and " + + "named imports."; + } + var ownerName = owner ? getComponentName(owner.type) : null; + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + } + (function() { + { + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (type == null ? type : typeof type) + + "." + + info + ) + ); + } + })(); + } + } + } + + fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.elementType = type; + fiber.type = resolvedType; + fiber.expirationTime = expirationTime; + + return fiber; +} + +function createFiberFromElement(element, mode, expirationTime) { + var owner = null; + { + owner = element._owner; + } + var type = element.type; + var key = element.key; + var pendingProps = element.props; + var fiber = createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime + ); + { + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; + } + return fiber; +} + +function createFiberFromFragment(elements, mode, expirationTime, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromFundamental( + fundamentalComponent, + pendingProps, + mode, + expirationTime, + key +) { + var fiber = createFiber(FundamentalComponent, pendingProps, key, mode); + fiber.elementType = fundamentalComponent; + fiber.type = fundamentalComponent; + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { + { + if ( + typeof pendingProps.id !== "string" || + typeof pendingProps.onRender !== "function" + ) { + warningWithoutStack$1( + false, + 'Profiler must specify an "id" string and "onRender" function as props' + ); + } + } + + var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); + // TODO: The Profiler fiber shouldn't have a type. It has a tag. + fiber.elementType = REACT_PROFILER_TYPE; + fiber.type = REACT_PROFILER_TYPE; + fiber.expirationTime = expirationTime; + + return fiber; +} + +function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); + + // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_TYPE; + fiber.elementType = REACT_SUSPENSE_TYPE; + + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); + { + // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_LIST_TYPE; + } + fiber.elementType = REACT_SUSPENSE_LIST_TYPE; + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromText(content, mode, expirationTime) { + var fiber = createFiber(HostText, content, null, mode); + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoMode); + // TODO: These should not need a type. + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + return fiber; +} + +function createFiberFromPortal(portal, mode, expirationTime) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.expirationTime = expirationTime; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, // Used by persistent updates + implementation: portal.implementation + }; + return fiber; +} + +// Used for stashing WIP properties to replay failed work in DEV. +function assignFiberPropertiesInDEV(target, source) { + if (target === null) { + // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoMode); + } + + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. + + target.tag = source.tag; + target.key = source.key; + target.elementType = source.elementType; + target.type = source.type; + target.stateNode = source.stateNode; + target.return = source.return; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.dependencies = source.dependencies; + target.mode = source.mode; + target.effectTag = source.effectTag; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.expirationTime = source.expirationTime; + target.childExpirationTime = source.childExpirationTime; + target.alternate = source.alternate; + if (enableProfilerTimer) { + target.actualDuration = source.actualDuration; + target.actualStartTime = source.actualStartTime; + target.selfBaseDuration = source.selfBaseDuration; + target.treeBaseDuration = source.treeBaseDuration; + } + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; + target._debugNeedsRemount = source._debugNeedsRemount; + target._debugHookTypes = source._debugHookTypes; + return target; +} + +// TODO: This should be lifted into the renderer. + +// The following attributes are only used by interaction tracing builds. +// They enable interactions to be associated with their async work, +// And expose interaction metadata to the React DevTools Profiler plugin. +// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. + +// Exported FiberRoot type includes all properties, +// To avoid requiring potentially error-prone :any casts throughout the project. +// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). +// The types are defined separately within this file to ensure they stay in sync. +// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) + +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pendingChildren = null; + this.pingCache = null; + this.finishedExpirationTime = NoWork; + this.finishedWork = null; + this.timeoutHandle = noTimeout; + this.context = null; + this.pendingContext = null; + this.hydrate = hydrate; + this.firstBatch = null; + this.callbackNode = null; + this.callbackExpirationTime = NoWork; + this.firstPendingTime = NoWork; + this.lastPendingTime = NoWork; + this.pingTime = NoWork; + + if (enableSchedulerTracing) { + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); + } +} + +function createFiberRoot(containerInfo, tag, hydrate) { + var root = new FiberRootNode(containerInfo, tag, hydrate); + + // Cyclic construction. This cheats the type system right now because + // stateNode is any. + var uninitializedFiber = createHostRootFiber(tag); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + + return root; +} + +// This lets us hook into Fiber to debug what it's doing. +// See https://github.com/facebook/react/pull/8033. +// This is not part of the public API, not even for React DevTools. +// You may only inject a debugTool if you work on React Fiber itself. +var ReactFiberInstrumentation = { + debugTool: null +}; + +var ReactFiberInstrumentation_1 = ReactFiberInstrumentation; + +// 0 is PROD, 1 is DEV. +// Might add PROFILE later. + +var didWarnAboutNestedUpdates = void 0; +var didWarnAboutFindNodeInStrictMode = void 0; + +{ + didWarnAboutNestedUpdates = false; + didWarnAboutFindNodeInStrictMode = {}; +} + +function getContextForSubtree(parentComponent) { + if (!parentComponent) { + return emptyContextObject; + } + + var fiber = get(parentComponent); + var parentContext = findCurrentUnmaskedContext(fiber); + + if (fiber.tag === ClassComponent) { + var Component = fiber.type; + if (isContextProvider(Component)) { + return processChildContext(fiber, Component, parentContext); + } + } + + return parentContext; +} + +function scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback +) { + { + if (phase === "render" && current !== null && !didWarnAboutNestedUpdates) { + didWarnAboutNestedUpdates = true; + warningWithoutStack$1( + false, + "Render methods should be a pure function of props and state; " + + "triggering nested component updates from render is not allowed. " + + "If necessary, trigger nested updates in componentDidUpdate.\n\n" + + "Check the render method of %s.", + getComponentName(current.type) || "Unknown" + ); + } + } + + var update = createUpdate(expirationTime, suspenseConfig); + // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { element: element }; + + callback = callback === undefined ? null : callback; + if (callback !== null) { + !(typeof callback === "function") + ? warningWithoutStack$1( + false, + "render(...): Expected the last optional `callback` argument to be a " + + "function. Instead received: %s.", + callback + ) + : void 0; + update.callback = callback; + } + + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + enqueueUpdate(current$$1, update); + scheduleWork(current$$1, expirationTime); + + return expirationTime; +} + +function updateContainerAtExpirationTime( + element, + container, + parentComponent, + expirationTime, + suspenseConfig, + callback +) { + // TODO: If this is a nested container, this won't be the root. + var current$$1 = container.current; + + { + if (ReactFiberInstrumentation_1.debugTool) { + if (current$$1.alternate === null) { + ReactFiberInstrumentation_1.debugTool.onMountContainer(container); + } else if (element === null) { + ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container); + } else { + ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container); + } + } + } + + var context = getContextForSubtree(parentComponent); + if (container.context === null) { + container.context = context; + } else { + container.pendingContext = context; + } + + return scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback + ); +} + +function findHostInstance(component) { + var fiber = get(component); + if (fiber === undefined) { + if (typeof component.render === "function") { + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } else { + (function() { + { + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + })(); + } + } + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + return hostFiber.stateNode; +} + +function findHostInstanceWithWarning(component, methodName) { + { + var fiber = get(component); + if (fiber === undefined) { + if (typeof component.render === "function") { + (function() { + { + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); + } + })(); + } else { + (function() { + { + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + })(); + } + } + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + if (hostFiber.mode & StrictMode) { + var componentName = getComponentName(fiber.type) || "Component"; + if (!didWarnAboutFindNodeInStrictMode[componentName]) { + didWarnAboutFindNodeInStrictMode[componentName] = true; + if (fiber.mode & StrictMode) { + warningWithoutStack$1( + false, + "%s is deprecated in StrictMode. " + + "%s was passed an instance of %s which is inside StrictMode. " + + "Instead, add a ref directly to the element you want to reference." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-find-node", + methodName, + methodName, + componentName, + getStackByFiberInDevAndProd(hostFiber) + ); + } else { + warningWithoutStack$1( + false, + "%s is deprecated in StrictMode. " + + "%s was passed an instance of %s which renders StrictMode children. " + + "Instead, add a ref directly to the element you want to reference." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-find-node", + methodName, + methodName, + componentName, + getStackByFiberInDevAndProd(hostFiber) + ); + } + } + } + return hostFiber.stateNode; + } + return findHostInstance(component); +} + +function createContainer(containerInfo, tag, hydrate) { + return createFiberRoot(containerInfo, tag, hydrate); +} + +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current; + var currentTime = requestCurrentTime(); + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfUnmockedScheduler(current$$1); + warnIfNotScopedWithMatchingAct(current$$1); + } + } + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + return updateContainerAtExpirationTime( + element, + container, + parentComponent, + expirationTime, + suspenseConfig, + callback + ); +} + +function getPublicRootInstance(container) { + var containerFiber = container.current; + if (!containerFiber.child) { + return null; + } + switch (containerFiber.child.tag) { + case HostComponent: + return getPublicInstance(containerFiber.child.stateNode); + default: + return containerFiber.child.stateNode; + } +} + +var shouldSuspendImpl = function(fiber) { + return false; +}; + +function shouldSuspend(fiber) { + return shouldSuspendImpl(fiber); +} + +var overrideHookState = null; +var overrideProps = null; +var scheduleUpdate = null; +var setSuspenseHandler = null; + +{ + var copyWithSetImpl = function(obj, path, idx, value) { + if (idx >= path.length) { + return value; + } + var key = path[idx]; + var updated = Array.isArray(obj) ? obj.slice() : Object.assign({}, obj); + // $FlowFixMe number or string is fine here + updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value); + return updated; + }; + + var copyWithSet = function(obj, path, value) { + return copyWithSetImpl(obj, path, 0, value); + }; + + // Support DevTools editable values for useState and useReducer. + overrideHookState = function(fiber, id, path, value) { + // For now, the "id" of stateful hooks is just the stateful hook index. + // This may change in the future with e.g. nested hooks. + var currentHook = fiber.memoizedState; + while (currentHook !== null && id > 0) { + currentHook = currentHook.next; + id--; + } + if (currentHook !== null) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + + var newState = copyWithSet(currentHook.memoizedState, path, value); + currentHook.memoizedState = newState; + currentHook.baseState = newState; + + // We aren't actually adding an update to the queue, + // because there is no update we can add for useReducer hooks that won't trigger an error. + // (There's no appropriate action type for DevTools overrides.) + // As a result though, React will see the scheduled update as a noop and bailout. + // Shallow cloning props works as a workaround for now to bypass the bailout check. + fiber.memoizedProps = Object.assign({}, fiber.memoizedProps); + + scheduleWork(fiber, Sync); + } + }; + + // Support DevTools props for function components, forwardRef, memo, host components, etc. + overrideProps = function(fiber, path, value) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); + if (fiber.alternate) { + fiber.alternate.pendingProps = fiber.pendingProps; + } + scheduleWork(fiber, Sync); + }; + + scheduleUpdate = function(fiber) { + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } + scheduleWork(fiber, Sync); + }; + + setSuspenseHandler = function(newShouldSuspendImpl) { + shouldSuspendImpl = newShouldSuspendImpl; + }; +} + +function injectIntoDevTools(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; + + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: overrideHookState, + overrideProps: overrideProps, + setSuspenseHandler: setSuspenseHandler, + scheduleUpdate: scheduleUpdate, + currentDispatcherRef: ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) { + return null; + } + return hostFiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + if (!findFiberByHostInstance) { + // Might not be implemented by the renderer. + return null; + } + return findFiberByHostInstance(instance); + }, + + // React Refresh + findHostInstancesForRefresh: findHostInstancesForRefresh, + scheduleRefresh: scheduleRefresh, + scheduleRoot: scheduleRoot, + setRefreshHandler: setRefreshHandler, + // Enables DevTools to append owner stacks to error messages in DEV mode. + getCurrentFiber: function() { + return current; + } + }) + ); +} + +// This file intentionally does *not* have the Flow annotation. +// Don't add it. See `./inline-typed.js` for an explanation. + +function createPortal( + children, + containerInfo, + // TODO: figure out the API for cross-renderer implementation. + implementation +) { + var key = + arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + + return { + // This tag allow us to uniquely identify this as a React Portal + $$typeof: REACT_PORTAL_TYPE, + key: key == null ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} + +// TODO: this is special because it gets imported during build. + +var ReactVersion = "16.8.6"; + +// Modules provided by RN: +var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { + /** + * `NativeMethodsMixin` provides methods to access the underlying native + * component directly. This can be useful in cases when you want to focus + * a view or measure its on-screen dimensions, for example. + * + * The methods described here are available on most of the default components + * provided by React Native. Note, however, that they are *not* available on + * composite components that aren't directly backed by a native view. This will + * generally include most components that you define in your own app. For more + * information, see [Direct + * Manipulation](docs/direct-manipulation.html). + * + * Note the Flow $Exact<> syntax is required to support mixins. + * React createClass mixins can only be used with exact types. + */ + var NativeMethodsMixin = { + /** + * Determines the location on screen, width, and height of the given view and + * returns the values via an async callback. If successful, the callback will + * be called with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * Note that these measurements are not available until after the rendering + * has been completed in native. If you need the measurements as soon as + * possible, consider using the [`onLayout` + * prop](docs/view.html#onlayout) instead. + */ + measure: function(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }, + + /** + * Determines the location of the given view in the window and returns the + * values via an async callback. If the React root view is embedded in + * another native view, this will give you the absolute coordinates. If + * successful, the callback will be called with the following + * arguments: + * + * - x + * - y + * - width + * - height + * + * Note that these measurements are not available until after the rendering + * has been completed in native. + */ + measureInWindow: function(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }, + + /** + * Like [`measure()`](#measure), but measures the view relative an ancestor, + * specified as `relativeToNativeNode`. This means that the returned x, y + * are relative to the origin x, y of the ancestor view. + * + * As always, to obtain a native node handle for a component, you can use + * `findNodeHandle(component)`. + */ + measureLayout: function( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: measureLayout on components using NativeMethodsMixin " + + "or ReactNative.NativeComponent is not currently supported in Fabric. " + + "measureLayout must be called on a native ref. Consider using forwardRef." + ); + return; + } else { + var relativeNode = void 0; + + if (typeof relativeToNativeNode === "number") { + // Already a node handle + relativeNode = relativeToNativeNode; + } else if (relativeToNativeNode._nativeTag) { + relativeNode = relativeToNativeNode._nativeTag; + } + + if (relativeNode == null) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a node handle or a ref to a native component." + ); + + return; + } + + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + } + }, + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](docs/direct-manipulation.html)). + */ + setNativeProps: function(nativeProps) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than findNodeHandle() because + // We want the instance/wrapper (not the native tag). + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + return; + } + + { + if (warnAboutDeprecatedSetNativeProps) { + warningWithoutStack$1( + false, + "Warning: Calling ref.setNativeProps(nativeProps) " + + "is deprecated and will be removed in a future release. " + + "Use the setNativeProps export from the react-native package instead." + + "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" + ); + } + } + + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + var viewConfig = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + + { + warnForStyleProps(nativeProps, viewConfig.validAttributes); + } + + var updatePayload = create(nativeProps, viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } + }, + + /** + * Requests focus for the given input or view. The exact behavior triggered + * will depend on the platform and type of view. + */ + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + + /** + * Removes focus from an input or view. This is the opposite of `focus()`. + */ + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + + { + // hide this from Flow since we can't define these properties outside of + // true without actually implementing them (setting them to undefined + // isn't allowed by ReactClass) + var NativeMethodsMixin_DEV = NativeMethodsMixin; + (function() { + if ( + !( + !NativeMethodsMixin_DEV.componentWillMount && + !NativeMethodsMixin_DEV.componentWillReceiveProps && + !NativeMethodsMixin_DEV.UNSAFE_componentWillMount && + !NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps + ) + ) { + throw ReactError(Error("Do not override existing functions.")); + } + })(); + // TODO (bvaughn) Remove cWM and cWRP in a future version of React Native, + // Once these lifecycles have been remove from the reconciler. + NativeMethodsMixin_DEV.componentWillMount = function() { + throwOnStylesProp(this, this.props); + }; + NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) { + throwOnStylesProp(this, newProps); + }; + NativeMethodsMixin_DEV.UNSAFE_componentWillMount = function() { + throwOnStylesProp(this, this.props); + }; + NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps = function( + newProps + ) { + throwOnStylesProp(this, newProps); + }; + + // React may warn about cWM/cWRP/cWU methods being deprecated. + // Add a flag to suppress these warnings for this special case. + // TODO (bvaughn) Remove this flag once the above methods have been removed. + NativeMethodsMixin_DEV.componentWillMount.__suppressDeprecationWarning = true; + NativeMethodsMixin_DEV.componentWillReceiveProps.__suppressDeprecationWarning = true; + } + + return NativeMethodsMixin; +}; + +function _classCallCheck$1(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + } + return call && (typeof call === "object" || typeof call === "function") + ? call + : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) + Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass); +} + +// Modules provided by RN: +var ReactNativeComponent = function(findNodeHandle, findHostInstance) { + /** + * Superclass that provides methods to access the underlying native component. + * This can be useful when you want to focus a view or measure its dimensions. + * + * Methods implemented by this class are available on most default components + * provided by React Native. However, they are *not* available on composite + * components that are not directly backed by a native view. For more + * information, see [Direct Manipulation](docs/direct-manipulation.html). + * + * @abstract + */ + var ReactNativeComponent = (function(_React$Component) { + _inherits(ReactNativeComponent, _React$Component); + + function ReactNativeComponent() { + _classCallCheck$1(this, ReactNativeComponent); + + return _possibleConstructorReturn( + this, + _React$Component.apply(this, arguments) + ); + } + + /** + * Removes focus. This is the opposite of `focus()`. + */ + + /** + * Due to bugs in Flow's handling of React.createClass, some fields already + * declared in the base class need to be redeclared below. + */ + ReactNativeComponent.prototype.blur = function blur() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + + /** + * Requests focus. The exact behavior depends on the platform and view. + */ + + ReactNativeComponent.prototype.focus = function focus() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + + /** + * Measures the on-screen location and dimensions. If successful, the callback + * will be called asynchronously with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * These values are not available until after natives rendering completes. If + * you need the measurements as soon as possible, consider using the + * [`onLayout` prop](docs/view.html#onlayout) instead. + */ + + ReactNativeComponent.prototype.measure = function measure(callback) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }; + + /** + * Measures the on-screen location and dimensions. Even if the React Native + * root view is embedded within another native view, this method will give you + * the absolute coordinates measured from the window. If successful, the + * callback will be called asynchronously with the following arguments: + * + * - x + * - y + * - width + * - height + * + * These values are not available until after natives rendering completes. + */ + + ReactNativeComponent.prototype.measureInWindow = function measureInWindow( + callback + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + // We can't call FabricUIManager here because it won't be loaded in paper + // at initialization time. See https://github.com/facebook/react/pull/15490 + // for more info. + nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } else { + ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + } + }; + + /** + * Similar to [`measure()`](#measure), but the resulting location will be + * relative to the supplied ancestor's location. + * + * Obtain a native node handle with `ReactNative.findNodeHandle(component)`. + */ + + ReactNativeComponent.prototype.measureLayout = function measureLayout( + relativeToNativeNode, + onSuccess, + onFail /* currently unused */ + ) { + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: measureLayout on components using NativeMethodsMixin " + + "or ReactNative.NativeComponent is not currently supported in Fabric. " + + "measureLayout must be called on a native ref. Consider using forwardRef." + ); + return; + } else { + var relativeNode = void 0; + + if (typeof relativeToNativeNode === "number") { + // Already a node handle + relativeNode = relativeToNativeNode; + } else if (relativeToNativeNode._nativeTag) { + relativeNode = relativeToNativeNode._nativeTag; + } + + if (relativeNode == null) { + warningWithoutStack$1( + false, + "Warning: ref.measureLayout must be called with a node handle or a ref to a native component." + ); + + return; + } + + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + } + }; + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](docs/direct-manipulation.html)). + */ + + ReactNativeComponent.prototype.setNativeProps = function setNativeProps( + nativeProps + ) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than ReactNative.findNodeHandle() because + // We want the instance/wrapper (not the native tag). + var maybeInstance = void 0; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + if (maybeInstance.canonical) { + warningWithoutStack$1( + false, + "Warning: setNativeProps is not currently supported in Fabric" + ); + return; + } + + { + if (warnAboutDeprecatedSetNativeProps) { + warningWithoutStack$1( + false, + "Warning: Calling ref.setNativeProps(nativeProps) " + + "is deprecated and will be removed in a future release. " + + "Use the setNativeProps export from the react-native package instead." + + "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" + ); + } + } + + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + var viewConfig = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + + var updatePayload = create(nativeProps, viewConfig.validAttributes); + + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } + }; + + return ReactNativeComponent; + })(React.Component); + + // eslint-disable-next-line no-unused-expressions + + return ReactNativeComponent; +}; + +// Module provided by RN: +var emptyObject$2 = {}; +{ + Object.freeze(emptyObject$2); +} + +var getInspectorDataForViewTag = void 0; + +{ + var traverseOwnerTreeUp = function(hierarchy, instance) { + if (instance) { + hierarchy.unshift(instance); + traverseOwnerTreeUp(hierarchy, instance._debugOwner); + } + }; + + var getOwnerHierarchy = function(instance) { + var hierarchy = []; + traverseOwnerTreeUp(hierarchy, instance); + return hierarchy; + }; + + var lastNonHostInstance = function(hierarchy) { + for (var i = hierarchy.length - 1; i > 1; i--) { + var instance = hierarchy[i]; + + if (instance.tag !== HostComponent) { + return instance; + } + } + return hierarchy[0]; + }; + + var getHostProps = function(fiber) { + var host = findCurrentHostFiber(fiber); + if (host) { + return host.memoizedProps || emptyObject$2; + } + return emptyObject$2; + }; + + var getHostNode = function(fiber, findNodeHandle) { + var hostNode = void 0; + // look for children first for the hostNode + // as composite fibers do not have a hostNode + while (fiber) { + if (fiber.stateNode !== null && fiber.tag === HostComponent) { + hostNode = findNodeHandle(fiber.stateNode); + } + if (hostNode) { + return hostNode; + } + fiber = fiber.child; + } + return null; + }; + + var createHierarchy = function(fiberHierarchy) { + return fiberHierarchy.map(function(fiber) { + return { + name: getComponentName(fiber.type), + getInspectorData: function(findNodeHandle) { + return { + measure: function(callback) { + return ReactNativePrivateInterface.UIManager.measure( + getHostNode(fiber, findNodeHandle), + callback + ); + }, + props: getHostProps(fiber), + source: fiber._debugSource + }; + } + }; + }); + }; + + getInspectorDataForViewTag = function(viewTag) { + var closestInstance = getInstanceFromTag(viewTag); + + // Handle case where user clicks outside of ReactNative + if (!closestInstance) { + return { + hierarchy: [], + props: emptyObject$2, + selection: null, + source: null + }; + } + + var fiber = findCurrentFiberUsingSlowPath(closestInstance); + var fiberHierarchy = getOwnerHierarchy(fiber); + var instance = lastNonHostInstance(fiberHierarchy); + var hierarchy = createHierarchy(fiberHierarchy); + var props = getHostProps(instance); + var source = instance._debugSource; + var selection = fiberHierarchy.indexOf(instance); + + return { + hierarchy: hierarchy, + props: props, + selection: selection, + source: source + }; + }; +} + +// Module provided by RN: +function setNativeProps(handle, nativeProps) { + if (handle._nativeTag == null) { + !(handle._nativeTag != null) + ? warningWithoutStack$1( + false, + "setNativeProps was called with a ref that isn't a " + + "native component. Use React.forwardRef to get access to the underlying native component" + ) + : void 0; + return; + } + + { + warnForStyleProps(nativeProps, handle.viewConfig.validAttributes); + } + + var updatePayload = create(nativeProps, handle.viewConfig.validAttributes); + // Avoid the overhead of bridge calls if there's no update. + // This is an expensive no-op for Android, and causes an unnecessary + // view invalidation for certain components (eg RCTTextInput) on iOS. + if (updatePayload != null) { + ReactNativePrivateInterface.UIManager.updateView( + handle._nativeTag, + handle.viewConfig.uiViewClassName, + updatePayload + ); + } +} + +// TODO: direct imports like some-package/src/* are bad. Fix me. +// Module provided by RN: +var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; + +function findNodeHandle(componentOrHandle) { + { + var owner = ReactCurrentOwner.current; + if (owner !== null && owner.stateNode !== null) { + !owner.stateNode._warnedAboutRefsInRender + ? warningWithoutStack$1( + false, + "%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(owner.type) || "A component" + ) + : void 0; + + owner.stateNode._warnedAboutRefsInRender = true; + } + } + if (componentOrHandle == null) { + return null; + } + if (typeof componentOrHandle === "number") { + // Already a node handle + return componentOrHandle; + } + if (componentOrHandle._nativeTag) { + return componentOrHandle._nativeTag; + } + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) { + return componentOrHandle.canonical._nativeTag; + } + var hostInstance = void 0; + { + hostInstance = findHostInstanceWithWarning( + componentOrHandle, + "findNodeHandle" + ); + } + + if (hostInstance == null) { + return hostInstance; + } + if (hostInstance.canonical) { + // Fabric + return hostInstance.canonical._nativeTag; + } + return hostInstance._nativeTag; +} + +setBatchingImplementation( + batchedUpdates$1, + discreteUpdates$1, + flushDiscreteUpdates, + batchedEventUpdates$1 +); + +function computeComponentStackForErrorReporting(reactTag) { + var fiber = getInstanceFromTag(reactTag); + if (!fiber) { + return ""; + } + return getStackByFiberInDevAndProd(fiber); +} + +var roots = new Map(); + +var ReactNativeRenderer = { + NativeComponent: ReactNativeComponent(findNodeHandle, findHostInstance), + + findNodeHandle: findNodeHandle, + + dispatchCommand: function(handle, command, args) { + if (handle._nativeTag == null) { + !(handle._nativeTag != null) + ? warningWithoutStack$1( + false, + "dispatchCommand was called with a ref that isn't a " + + "native component. Use React.forwardRef to get access to the underlying native component" + ) + : void 0; + return; + } + + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, + + setNativeProps: setNativeProps, + + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + + if (!root) { + // TODO (bvaughn): If we decide to keep the wrapper component, + // We could create a wrapper for containerTag as well to reduce special casing. + root = createContainer(containerTag, LegacyRoot, false); + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + + return getPublicRootInstance(root); + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + if (root) { + // TODO: Is it safe to reset this now or should I wait since this unmount could be deferred? + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + } + }, + unmountComponentAtNodeAndRemoveContainer: function(containerTag) { + ReactNativeRenderer.unmountComponentAtNode(containerTag); + + // Call back into native to remove all of the subviews from this container + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); + }, + createPortal: function(children, containerTag) { + var key = + arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + return createPortal(children, containerTag, null, key); + }, + + unstable_batchedUpdates: batchedUpdates, + + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + // Used as a mixin in many createClass-based components + NativeMethodsMixin: NativeMethodsMixin(findNodeHandle, findHostInstance), + computeComponentStackForErrorReporting: computeComponentStackForErrorReporting + } +}; + +injectIntoDevTools({ + findFiberByHostInstance: getInstanceFromTag, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 1, + version: ReactVersion, + rendererPackageName: "react-native-renderer" +}); + +var ReactNativeRenderer$2 = Object.freeze({ + default: ReactNativeRenderer +}); + +var ReactNativeRenderer$3 = + (ReactNativeRenderer$2 && ReactNativeRenderer) || ReactNativeRenderer$2; + +// TODO: decide on the top-level export form. +// This is hacky but makes it work with both Rollup and Jest. +var reactNativeRenderer = + ReactNativeRenderer$3.default || ReactNativeRenderer$3; + +module.exports = reactNativeRenderer; + + })(); +} \ No newline at end of file diff --git a/Libraries/Renderer/oss/ReactNativeRenderer-dev.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js similarity index 78% rename from Libraries/Renderer/oss/ReactNativeRenderer-dev.js rename to Libraries/Renderer/implementations/ReactNativeRenderer-dev.js index 1aa431603cdfea..f145b4faab1a93 100644 --- a/Libraries/Renderer/oss/ReactNativeRenderer-dev.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js @@ -16,26 +16,18 @@ if (__DEV__) { (function() { "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"); -var UIManager = require("UIManager"); -var RCTEventEmitter = require("RCTEventEmitter"); +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"); var React = require("react"); -var deepFreezeAndThrowOnMutationInDev = require("deepFreezeAndThrowOnMutationInDev"); -var deepDiffer = require("deepDiffer"); -var flattenStyle = require("flattenStyle"); -var TextInputState = require("TextInputState"); var checkPropTypes = require("prop-types/checkPropTypes"); var Scheduler = require("scheduler"); var tracing = require("scheduler/tracing"); -var ExceptionsManager = require("ExceptionsManager"); -// Do not require this module directly! Use a normal error constructor with +// Do not require this module directly! Use normal `invariant` calls with // template literal strings. The messages will be converted to ReactError during // build, and in production they will be minified. -function ReactError(message) { - var error = new Error(message); +function ReactError(error) { error.name = "Invariant Violation"; return error; } @@ -77,9 +69,11 @@ function recomputePluginOrdering() { (function() { if (!(pluginIndex > -1)) { throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); } })(); @@ -89,9 +83,11 @@ function recomputePluginOrdering() { (function() { if (!pluginModule.extractEvents) { throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); } })(); @@ -107,11 +103,13 @@ function recomputePluginOrdering() { ) ) { throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } })(); @@ -131,9 +129,11 @@ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { (function() { if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName + + "`." + ) ); } })(); @@ -174,9 +174,11 @@ function publishRegistrationName(registrationName, pluginModule, eventName) { (function() { if (!!registrationNameModules[registrationName]) { throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); } })(); @@ -237,7 +239,9 @@ function injectEventPluginOrder(injectedEventPluginOrder) { (function() { if (!!eventPluginOrder) { throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); } })(); @@ -270,9 +274,11 @@ function injectEventPluginsByName(injectedNamesToPlugins) { (function() { if (!!namesToPlugins[pluginName]) { throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); } })(); @@ -352,7 +358,9 @@ var invokeGuardedCallbackImpl = function( (function() { if (!(typeof document !== "undefined")) { throw ReactError( - "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + Error( + "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." + ) ); } })(); @@ -581,7 +589,9 @@ function clearCaughtError() { (function() { { throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -795,7 +805,7 @@ function executeDirectDispatch(event) { var dispatchInstance = event._dispatchInstances; (function() { if (!!Array.isArray(dispatchListener)) { - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); } })(); event.currentTarget = dispatchListener @@ -833,7 +843,9 @@ function accumulateInto(current, next) { (function() { if (!(next != null)) { throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); } })(); @@ -921,7 +933,9 @@ function runEventsInBatch(events) { (function() { if (!!eventQueue) { throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); } })(); @@ -1022,11 +1036,13 @@ function getListener(inst, registrationName) { (function() { if (!(!listener || typeof listener === "function")) { throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); } })(); @@ -1099,8 +1115,8 @@ var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedSuspenseComponent = 18; -var EventComponent = 19; -var EventTarget = 20; +var SuspenseListComponent = 19; +var FundamentalComponent = 20; function getParent(inst) { do { @@ -1561,7 +1577,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) { return { configurable: true, set: set, - get: get$$1 + get: get }; function set(val) { @@ -1570,7 +1586,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) { return val; } - function get$$1() { + function get() { var action = isFunction ? "accessing the method" : "accessing the property"; var result = isFunction ? "This is a no-op function" @@ -1622,7 +1638,9 @@ function releasePooledEvent(event) { (function() { if (!(event instanceof EventConstructor)) { throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); } })(); @@ -1734,7 +1752,7 @@ function getTouchIdentifier(_ref) { (function() { if (!(identifier != null)) { - throw ReactError("Touch object is missing identifier."); + throw ReactError(Error("Touch object is missing identifier.")); } })(); { @@ -1774,7 +1792,7 @@ function recordTouchMove(touch) { touchRecord.currentTimeStamp = timestampForTouch(touch); touchHistory.mostRecentTimeStamp = timestampForTouch(touch); } else { - console.error( + console.warn( "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -1795,7 +1813,7 @@ function recordTouchEnd(touch) { touchRecord.currentTimeStamp = timestampForTouch(touch); touchHistory.mostRecentTimeStamp = timestampForTouch(touch); } else { - console.error( + console.warn( "Cannot record touch end without a touch start.\n" + "Touch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -1867,7 +1885,9 @@ function accumulate(current, next) { (function() { if (!(next != null)) { throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error( + "accumulate(...): Accumulated items must not be null or undefined." + ) ); } })(); @@ -1913,7 +1933,7 @@ var changeResponder = function(nextResponderInst, blockHostResponder) { } }; -var eventTypes$1 = { +var eventTypes = { /** * On a `touchStart`/`mouseDown`, is it desired that this element become the * responder? @@ -2204,12 +2224,12 @@ function setResponderAndExtractTransfer( nativeEventTarget ) { var shouldSetEventType = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; // TODO: stop one short of the current responder. var bubbleShouldSetFrom = !responderInst @@ -2243,7 +2263,7 @@ function setResponderAndExtractTransfer( } var extracted = void 0; var grantEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget @@ -2254,7 +2274,7 @@ function setResponderAndExtractTransfer( var blockHostResponder = executeDirectDispatch(grantEvent) === true; if (responderInst) { var terminationRequestEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -2271,7 +2291,7 @@ function setResponderAndExtractTransfer( if (shouldSwitch) { var terminateEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -2282,7 +2302,7 @@ function setResponderAndExtractTransfer( changeResponder(wantsResponderInst, blockHostResponder); } else { var rejectEvent = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget @@ -2351,7 +2371,7 @@ var ResponderEventPlugin = { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, /** * We must be resilient to `targetInst` being `null` on `touchMove` or @@ -2401,11 +2421,11 @@ var ResponderEventPlugin = { var isResponderTouchMove = responderInst && isMoveish(topLevelType); var isResponderTouchEnd = responderInst && isEndish(topLevelType); var incrementalTouch = isResponderTouchStart - ? eventTypes$1.responderStart + ? eventTypes.responderStart : isResponderTouchMove - ? eventTypes$1.responderMove + ? eventTypes.responderMove : isResponderTouchEnd - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null; if (incrementalTouch) { @@ -2428,9 +2448,9 @@ var ResponderEventPlugin = { isEndish(topLevelType) && noResponderTouches(nativeEvent); var finalTouch = isResponderTerminate - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : isResponderRelease - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null; if (finalTouch) { var finalEvent = ResponderSyntheticEvent.getPooled( @@ -2462,8 +2482,16 @@ var ResponderEventPlugin = { } }; +// Module provided by RN: +var customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes; +var customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; + var ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + eventTypes: {}, /** * @see {EventPluginHub.extractEvents} @@ -2478,14 +2506,14 @@ var ReactNativeBridgeEventPlugin = { // Probably a node belonging to another renderer's tree. return null; } - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType]; - var directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; + var directDispatchConfig = customDirectEventTypes[topLevelType]; (function() { if (!(bubbleDispatchConfig || directDispatchConfig)) { throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); } })(); @@ -2532,20 +2560,20 @@ injection.injectEventPluginsByName({ ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin }); -var instanceCache = {}; -var instanceProps = {}; +var instanceCache = new Map(); +var instanceProps = new Map(); function precacheFiberNode(hostInst, tag) { - instanceCache[tag] = hostInst; + instanceCache.set(tag, hostInst); } function uncacheFiberNode(tag) { - delete instanceCache[tag]; - delete instanceProps[tag]; + instanceCache.delete(tag); + instanceProps.delete(tag); } function getInstanceFromTag(tag) { - return instanceCache[tag] || null; + return instanceCache.get(tag) || null; } function getTagFromInstance(inst) { @@ -2555,18 +2583,18 @@ function getTagFromInstance(inst) { } (function() { if (!tag) { - throw ReactError("All native instances should have a tag."); + throw ReactError(Error("All native instances should have a tag.")); } })(); return tag; } function getFiberCurrentPropsFromNode$1(stateNode) { - return instanceProps[stateNode._nativeTag] || null; + return instanceProps.get(stateNode._nativeTag) || null; } function updateFiberProps(tag, props) { - instanceProps[tag] = props; + instanceProps.set(tag, props); } // Use to restore controlled state after a change event has fired. @@ -2586,7 +2614,9 @@ function restoreStateOfTarget(target) { (function() { if (!(typeof restoreImpl === "function")) { throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -2615,6 +2645,31 @@ function restoreStateIfNeeded() { } } +var debugRenderPhaseSideEffects = false; +var debugRenderPhaseSideEffectsForStrictMode = false; +var enableUserTimingAPI = true; +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; +var warnAboutDeprecatedLifecycles = true; +var enableProfilerTimer = true; +var enableSchedulerTracing = true; +var enableSuspenseServerRenderer = false; + +var warnAboutDeprecatedSetNativeProps = false; +var enableFlareAPI = false; +var enableFundamentalAPI = false; + +var warnAboutUnmockedScheduler = false; +var revertPassiveEffectsChange = false; +var flushSuspenseFallbacksInTests = true; + +var enableSuspenseCallback = false; +var warnAboutDefaultPropsOnFunctionComponents = false; +var warnAboutStringRefs = false; +var disableLegacyContext = false; +var disableSchedulerTimeoutBasedOnReactExpirationTime = false; + +// Only used in www builds. + // Used as a way to call batchedUpdates when we don't have a reference to // the renderer. Such as when we're dispatching events or if third party // libraries need to call batchedUpdates. Eventually, this API will go away when @@ -2622,45 +2677,50 @@ function restoreStateIfNeeded() { // scheduled work and instead do synchronous work. // Defaults -var _batchedUpdatesImpl = function(fn, bookkeeping) { +var batchedUpdatesImpl = function(fn, bookkeeping) { return fn(bookkeeping); }; -var _flushInteractiveUpdatesImpl = function() {}; +var flushDiscreteUpdatesImpl = function() {}; +var isInsideEventHandler = false; + +function finishEventHandler() { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + var controlledComponentsHavePendingUpdates = needsStateRestore(); + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + flushDiscreteUpdatesImpl(); + restoreStateIfNeeded(); + } +} -var isBatching = false; function batchedUpdates(fn, bookkeeping) { - if (isBatching) { + if (isInsideEventHandler) { // If we are currently inside another batch, we need to wait until it // fully completes before restoring state. return fn(bookkeeping); } - isBatching = true; + isInsideEventHandler = true; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - // Here we wait until all updates have propagated, which is important - // when using controlled components within layers: - // https://github.com/facebook/react/issues/1698 - // Then we restore state of any controlled component. - isBatching = false; - var controlledComponentsHavePendingUpdates = needsStateRestore(); - if (controlledComponentsHavePendingUpdates) { - // If a controlled event was fired, we may need to restore the state of - // the DOM node back to the controlled value. This is necessary when React - // bails out of the update without touching the DOM. - _flushInteractiveUpdatesImpl(); - restoreStateIfNeeded(); - } + isInsideEventHandler = false; + finishEventHandler(); } } function setBatchingImplementation( - batchedUpdatesImpl, - interactiveUpdatesImpl, - flushInteractiveUpdatesImpl + _batchedUpdatesImpl, + _discreteUpdatesImpl, + _flushDiscreteUpdatesImpl, + _batchedEventUpdatesImpl ) { - _batchedUpdatesImpl = batchedUpdatesImpl; - _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl; + batchedUpdatesImpl = _batchedUpdatesImpl; + flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; } /** @@ -2816,9 +2876,12 @@ var ReactNativeGlobalResponderHandler = { onChange: function(from, to, blockNativeResponder) { if (to !== null) { var tag = to.stateNode._nativeTag; - UIManager.setJSResponder(tag, blockNativeResponder); + ReactNativePrivateInterface.UIManager.setJSResponder( + tag, + blockNativeResponder + ); } else { - UIManager.clearJSResponder(); + ReactNativePrivateInterface.UIManager.clearJSResponder(); } } }; @@ -2827,7 +2890,7 @@ var ReactNativeGlobalResponderHandler = { /** * Register the event emitter with the native bridge */ -RCTEventEmitter.register({ +ReactNativePrivateInterface.RCTEventEmitter.register({ receiveEvent: receiveEvent, receiveTouches: receiveTouches }); @@ -2858,7 +2921,7 @@ ResponderEventPlugin.injection.injectGlobalResponderHandler( * supported we can rename it. */ -function get$1(key) { +function get(key) { return key._reactInternalFiber; } @@ -2877,6 +2940,11 @@ if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) { current: null }; } +if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. @@ -2891,6 +2959,8 @@ var REACT_STRICT_MODE_TYPE = hasSymbol var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; +// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") @@ -2899,19 +2969,15 @@ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4; -var REACT_EVENT_COMPONENT_TYPE = hasSymbol - ? Symbol.for("react.event_component") +var REACT_FUNDAMENTAL_TYPE = hasSymbol + ? Symbol.for("react.fundamental") : 0xead5; -var REACT_EVENT_TARGET_TYPE = hasSymbol - ? Symbol.for("react.event_target") - : 0xead6; - -// React event targets -var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol - ? Symbol.for("react.event_target.touch_hit") - : 0xead7; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6; var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; @@ -2937,22 +3003,6 @@ function refineResolvedLazyComponent(lazyComponent) { return lazyComponent._status === Resolved ? lazyComponent._result : null; } -var debugRenderPhaseSideEffects = false; -var debugRenderPhaseSideEffectsForStrictMode = false; -var enableUserTimingAPI = true; -var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; -var warnAboutDeprecatedLifecycles = true; -var enableProfilerTimer = true; -var enableSchedulerTracing = true; -var enableSuspenseServerRenderer = false; - -var disableYielding = false; - -var warnAboutDeprecatedSetNativeProps = false; -var enableEventAPI = false; - -// Only used in www builds. - function getWrappedName(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ""; return ( @@ -2982,8 +3032,6 @@ function getComponentName(type) { return type; } switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -2994,6 +3042,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { @@ -3013,28 +3063,6 @@ function getComponentName(type) { } break; } - case REACT_EVENT_COMPONENT_TYPE: { - if (enableEventAPI) { - var eventComponent = type; - var displayName = eventComponent.displayName; - if (displayName !== undefined) { - return displayName; - } - } - break; - } - case REACT_EVENT_TARGET_TYPE: { - if (enableEventAPI) { - var eventTarget = type; - if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) { - return "TouchHitTarget"; - } - var _displayName = eventTarget.displayName; - if (_displayName !== undefined) { - return _displayName; - } - } - } } } return null; @@ -3125,7 +3153,7 @@ function isMounted(component) { } } - var fiber = get$1(component); + var fiber = get(component); if (!fiber) { return false; } @@ -3135,7 +3163,7 @@ function isMounted(component) { function assertIsMounted(fiber) { (function() { if (!(isFiberMountedImpl(fiber) === MOUNTED)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } })(); } @@ -3147,7 +3175,9 @@ function findCurrentFiberUsingSlowPath(fiber) { var state = isFiberMountedImpl(fiber); (function() { if (!(state !== UNMOUNTED)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); if (state === MOUNTING) { @@ -3203,7 +3233,9 @@ function findCurrentFiberUsingSlowPath(fiber) { // way this could possibly happen is if this was unmounted, if at all. (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } @@ -3259,7 +3291,9 @@ function findCurrentFiberUsingSlowPath(fiber) { (function() { if (!didFindChild) { throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } })(); @@ -3269,7 +3303,9 @@ function findCurrentFiberUsingSlowPath(fiber) { (function() { if (!(a.alternate === b)) { throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -3278,7 +3314,7 @@ function findCurrentFiberUsingSlowPath(fiber) { // unmounted. (function() { if (!(a.tag === HostRoot)) { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } })(); if (a.stateNode.current === a) { @@ -3344,7 +3380,7 @@ function defaultDiffer(prevProp, nextProp) { return true; } else { // For objects and arrays, the default diffing algorithm is a deep compare - return deepDiffer(prevProp, nextProp); + return ReactNativePrivateInterface.deepDiffer(prevProp, nextProp); } } @@ -3484,7 +3520,7 @@ function diffNestedProperty( return diffProperties( updatePayload, // $FlowFixMe - We know that this is always an object when the input is. - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), // $FlowFixMe - We know that this isn't an array because of above flow. nextProp, validAttributes @@ -3495,7 +3531,7 @@ function diffNestedProperty( updatePayload, prevProp, // $FlowFixMe - We know that this is always an object when the input is. - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -3827,19 +3863,6 @@ function warnForStyleProps(props, validAttributes) { } } -var debugRenderPhaseSideEffects = false; -var debugRenderPhaseSideEffectsForStrictMode = false; -var enableUserTimingAPI = true; -var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; -var warnAboutDeprecatedLifecycles = false; -var enableProfilerTimer = true; -var enableSchedulerTracing = true; -var enableSuspenseServerRenderer = false; - -var warnAboutDeprecatedSetNativeProps = false; - -// Only used in www builds. - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); @@ -3865,15 +3888,15 @@ var ReactNativeFiberHostComponent = (function() { } ReactNativeFiberHostComponent.prototype.blur = function blur() { - TextInputState.blurTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.focus = function focus() { - TextInputState.focusTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.measure = function measure(callback) { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -3882,7 +3905,7 @@ var ReactNativeFiberHostComponent = (function() { ReactNativeFiberHostComponent.prototype.measureInWindow = function measureInWindow( callback ) { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -3916,7 +3939,7 @@ var ReactNativeFiberHostComponent = (function() { return; } - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( this._nativeTag, relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -3946,7 +3969,7 @@ var ReactNativeFiberHostComponent = (function() { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( this._nativeTag, this.viewConfig.uiViewClassName, updatePayload @@ -3964,7 +3987,9 @@ function shim() { (function() { { throw ReactError( - "The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -3973,6 +3998,7 @@ function shim() { // Persistence (when unsupported) var supportsPersistence = false; var cloneInstance = shim; +var cloneFundamentalInstance = shim; var createContainerChildSet = shim; var appendChildToContainerChildSet = shim; var finalizeContainerChildren = shim; @@ -3987,7 +4013,9 @@ function shim$1() { (function() { { throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -4021,6 +4049,8 @@ var didNotFindHydratableTextInstance = shim$1; var didNotFindHydratableSuspenseInstance = shim$1; // Modules provided by RN: +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; // Unused // Unused var UPDATE_SIGNAL = {}; @@ -4064,19 +4094,21 @@ function createInstance( internalInstanceHandle ) { var tag = allocateTag(); - var viewConfig = ReactNativeViewConfigRegistry.get(type); + var viewConfig = getViewConfigForType(type); { for (var key in viewConfig.validAttributes) { if (props.hasOwnProperty(key)) { - deepFreezeAndThrowOnMutationInDev(props[key]); + ReactNativePrivateInterface.deepFreezeAndThrowOnMutationInDev( + props[key] + ); } } } var updatePayload = create(props, viewConfig.validAttributes); - UIManager.createView( + ReactNativePrivateInterface.UIManager.createView( tag, // reactTag viewConfig.uiViewClassName, // viewName rootContainerInstance, // rootTag @@ -4102,14 +4134,14 @@ function createTextInstance( (function() { if (!hostContext.isInAParentText) { throw ReactError( - "Text strings must be rendered within a component." + Error("Text strings must be rendered within a component.") ); } })(); var tag = allocateTag(); - UIManager.createView( + ReactNativePrivateInterface.UIManager.createView( tag, // reactTag "RCTRawText", // viewName rootContainerInstance, // rootTag @@ -4141,7 +4173,7 @@ function finalizeInitialChildren( : child._nativeTag; }); - UIManager.setChildren( + ReactNativePrivateInterface.UIManager.setChildren( parentInstance._nativeTag, // containerTag nativeTags // reactTags ); @@ -4169,16 +4201,6 @@ function getChildHostContext(parentHostContext, type, rootContainerInstance) { } } -function getChildHostContextForEventComponent(parentHostContext) { - // TODO: add getChildHostContextForEventComponent implementation - return parentHostContext; -} - -function getChildHostContextForEventTarget(parentHostContext, type) { - // TODO: add getChildHostContextForEventTarget implementation - return parentHostContext; -} - function getPublicInstance(instance) { return instance; } @@ -4203,6 +4225,7 @@ function resetAfterCommit(containerInfo) { } var isPrimaryRenderer = true; +var warnsIfNotActing = true; var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; @@ -4237,7 +4260,7 @@ function appendChild(parentInstance, child) { children.splice(index, 1); children.push(child); - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance._nativeTag, // containerTag [index], // moveFromIndices [children.length - 1], // moveToIndices @@ -4248,7 +4271,7 @@ function appendChild(parentInstance, child) { } else { children.push(child); - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance._nativeTag, // containerTag [], // moveFromIndices [], // moveToIndices @@ -4261,14 +4284,14 @@ function appendChild(parentInstance, child) { function appendChildToContainer(parentInstance, child) { var childTag = typeof child === "number" ? child : child._nativeTag; - UIManager.setChildren( + ReactNativePrivateInterface.UIManager.setChildren( parentInstance, // containerTag [childTag] // reactTags ); } function commitTextUpdate(textInstance, oldText, newText) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( textInstance, // reactTag "RCTRawText", // viewName { text: newText } // props @@ -4293,7 +4316,7 @@ function commitUpdate( // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( instance._nativeTag, // reactTag viewConfig.uiViewClassName, // viewName updatePayload // props @@ -4311,7 +4334,7 @@ function insertBefore(parentInstance, child, beforeChild) { var beforeChildIndex = children.indexOf(beforeChild); children.splice(beforeChildIndex, 0, child); - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance._nativeTag, // containerID [index], // moveFromIndices [beforeChildIndex], // moveToIndices @@ -4325,7 +4348,7 @@ function insertBefore(parentInstance, child, beforeChild) { var childTag = typeof child === "number" ? child : child._nativeTag; - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance._nativeTag, // containerID [], // moveFromIndices [], // moveToIndices @@ -4343,7 +4366,9 @@ function insertInContainerBefore(parentInstance, child, beforeChild) { // For more info on pros/cons see PR #8560 description. (function() { if (!(typeof parentInstance !== "number")) { - throw ReactError("Container does not support insertBefore operation"); + throw ReactError( + Error("Container does not support insertBefore operation") + ); } })(); } @@ -4355,7 +4380,7 @@ function removeChild(parentInstance, child) { children.splice(index, 1); - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance._nativeTag, // containerID [], // moveFromIndices [], // moveToIndices @@ -4367,7 +4392,7 @@ function removeChild(parentInstance, child) { function removeChildFromContainer(parentInstance, child) { recursivelyUncacheFiberNode(child); - UIManager.manageChildren( + ReactNativePrivateInterface.UIManager.manageChildren( parentInstance, // containerID [], // moveFromIndices [], // moveToIndices @@ -4387,7 +4412,7 @@ function hideInstance(instance) { { style: { display: "none" } }, viewConfig.validAttributes ); - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( instance._nativeTag, viewConfig.uiViewClassName, updatePayload @@ -4405,7 +4430,7 @@ function unhideInstance(instance, props) { props, viewConfig.validAttributes ); - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( instance._nativeTag, viewConfig.uiViewClassName, updatePayload @@ -4416,32 +4441,38 @@ function unhideTextInstance(textInstance, text) { throw new Error("Not yet implemented."); } -function mountEventComponent(eventComponentInstance) { +function mountResponderInstance( + responder, + responderInstance, + props, + state, + instance, + rootContainerInstance +) { throw new Error("Not yet implemented."); } -function updateEventComponent(eventComponentInstance) { +function unmountResponderInstance(responderInstance) { throw new Error("Not yet implemented."); } -function unmountEventComponent(eventComponentInstance) { +function getFundamentalComponentInstance(fundamentalInstance) { throw new Error("Not yet implemented."); } -function getEventTargetChildElement(type, props) { +function mountFundamentalComponent(fundamentalInstance) { throw new Error("Not yet implemented."); } -function handleEventTarget( - type, - props, - rootContainerInstance, - internalInstanceHandle -) { +function shouldUpdateFundamentalComponent(fundamentalInstance) { throw new Error("Not yet implemented."); } -function commitEventTarget(type, props, instance, parentInstance) { +function updateFundamentalComponent(fundamentalInstance) { + throw new Error("Not yet implemented."); +} + +function unmountFundamentalComponent(fundamentalInstance) { throw new Error("Not yet implemented."); } @@ -5093,340 +5124,352 @@ function getUnmaskedContext( Component, didPushOwnContextIfProvider ) { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; + if (disableLegacyContext) { + return emptyContextObject; + } else { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; + } + return contextStackCursor.current; } - return contextStackCursor.current; } function cacheContext(workInProgress, unmaskedContext, maskedContext) { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + } } function getMaskedContext(workInProgress, unmaskedContext) { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - if (!contextTypes) { + if (disableLegacyContext) { return emptyContextObject; - } + } else { + var type = workInProgress.type; + var contextTypes = type.contextTypes; + if (!contextTypes) { + return emptyContextObject; + } - // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. - var instance = workInProgress.stateNode; - if ( - instance && - instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext - ) { - return instance.__reactInternalMemoizedMaskedChildContext; - } + // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) { + return instance.__reactInternalMemoizedMaskedChildContext; + } - var context = {}; - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } + var context = {}; + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } - { - var name = getComponentName(type) || "Unknown"; - checkPropTypes( - contextTypes, - context, - "context", - name, - getCurrentFiberStackInDev - ); - } + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + contextTypes, + context, + "context", + name, + getCurrentFiberStackInDev + ); + } - // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); - } + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } - return context; + return context; + } } function hasContextChanged() { - return didPerformWorkStackCursor.current; + if (disableLegacyContext) { + return false; + } else { + return didPerformWorkStackCursor.current; + } } function isContextProvider(type) { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; + if (disableLegacyContext) { + return false; + } else { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } } function popContext(fiber) { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } } function popTopLevelContextObject(fiber) { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); + if (disableLegacyContext) { + return; + } else { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } } function pushTopLevelContextObject(fiber, context, didChange) { - (function() { - if (!(contextStackCursor.current === emptyContextObject)) { - throw ReactError( - "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); + if (disableLegacyContext) { + return; + } else { + (function() { + if (!(contextStackCursor.current === emptyContextObject)) { + throw ReactError( + Error( + "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); + push(contextStackCursor, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); + } } function processChildContext(fiber, type, parentContext) { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; + if (disableLegacyContext) { + return parentContext; + } else { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; - // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - if (typeof instance.getChildContext !== "function") { - { - var componentName = getComponentName(type) || "Unknown"; + // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== "function") { + { + var componentName = getComponentName(type) || "Unknown"; - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - warningWithoutStack$1( - false, - "%s.childContextTypes is specified but there is no getChildContext() method " + - "on the instance. You can either define getChildContext() on %s or remove " + - "childContextTypes from it.", - componentName, - componentName - ); + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + warningWithoutStack$1( + false, + "%s.childContextTypes is specified but there is no getChildContext() method " + + "on the instance. You can either define getChildContext() on %s or remove " + + "childContextTypes from it.", + componentName, + componentName + ); + } } + return parentContext; } - return parentContext; - } - var childContext = void 0; - { - setCurrentPhase("getChildContext"); + var childContext = void 0; + { + setCurrentPhase("getChildContext"); + } + startPhaseTimer(fiber, "getChildContext"); + childContext = instance.getChildContext(); + stopPhaseTimer(); + { + setCurrentPhase(null); + } + for (var contextKey in childContext) { + (function() { + if (!(contextKey in childContextTypes)) { + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + } + })(); + } + { + var name = getComponentName(type) || "Unknown"; + checkPropTypes( + childContextTypes, + childContext, + "child context", + name, + // In practice, there is one case in which we won't get a stack. It's when + // somebody calls unstable_renderSubtreeIntoContainer() and we process + // context from the parent component instance. The stack will be missing + // because it's outside of the reconciliation, and so the pointer has not + // been set. This is rare and doesn't matter. We'll also remove that API. + getCurrentFiberStackInDev + ); + } + + return Object.assign({}, parentContext, childContext); } - startPhaseTimer(fiber, "getChildContext"); - childContext = instance.getChildContext(); - stopPhaseTimer(); - { - setCurrentPhase(null); +} + +function pushContextProvider(workInProgress) { + if (disableLegacyContext) { + return false; + } else { + var instance = workInProgress.stateNode; + // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + + // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. + previousContext = contextStackCursor.current; + push(contextStackCursor, memoizedMergedChildContext, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + + return true; } - for (var contextKey in childContext) { +} + +function invalidateContextProvider(workInProgress, type, didChange) { + if (disableLegacyContext) { + return; + } else { + var instance = workInProgress.stateNode; (function() { - if (!(contextKey in childContextTypes)) { + if (!instance) { throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); - } - { - var name = getComponentName(type) || "Unknown"; - checkPropTypes( - childContextTypes, - childContext, - "child context", - name, - // In practice, there is one case in which we won't get a stack. It's when - // somebody calls unstable_renderSubtreeIntoContainer() and we process - // context from the parent component instance. The stack will be missing - // because it's outside of the reconciliation, and so the pointer has not - // been set. This is rare and doesn't matter. We'll also remove that API. - getCurrentFiberStackInDev - ); - } - return Object.assign({}, parentContext, childContext); + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext( + workInProgress, + type, + previousContext + ); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; + + // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor, workInProgress); + // Now push the new context and mark that it has changed. + push(contextStackCursor, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } + } } -function pushContextProvider(workInProgress) { - var instance = workInProgress.stateNode; - // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. - var memoizedMergedChildContext = - (instance && instance.__reactInternalMemoizedMergedChildContext) || - emptyContextObject; - - // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - previousContext = contextStackCursor.current; - push(contextStackCursor, memoizedMergedChildContext, workInProgress); - push( - didPerformWorkStackCursor, - didPerformWorkStackCursor.current, - workInProgress - ); +function findCurrentUnmaskedContext(fiber) { + if (disableLegacyContext) { + return emptyContextObject; + } else { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + (function() { + if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + })(); - return true; -} - -function invalidateContextProvider(workInProgress, type, didChange) { - var instance = workInProgress.stateNode; - (function() { - if (!instance) { - throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); - - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext( - workInProgress, - type, - previousContext - ); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; - - // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor, workInProgress); - // Now push the new context and mark that it has changed. - push(contextStackCursor, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } -} - -function findCurrentUnmaskedContext(fiber) { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - (function() { - if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { - throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); - - var node = fiber; - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - case ClassComponent: { - var Component = node.type; - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; + var node = fiber; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; + case ClassComponent: { + var Component = node.type; + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; + } + break; } - break; } - } - node = node.return; - } while (node !== null); - (function() { - { - throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); -} - -var onCommitFiberRoot = null; -var onCommitFiberUnmount = null; -var hasLoggedError = false; - -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) { - if (true && !hasLoggedError) { - hasLoggedError = true; - warningWithoutStack$1( - false, - "React DevTools encountered an error: %s", - err + node = node.return; + } while (node !== null); + (function() { + { + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } - } - }; + })(); + } } -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; +var LegacyRoot = 0; +var BatchedRoot = 1; +var ConcurrentRoot = 2; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { - // No DevTools - return false; - } - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } - if (!hook.supportsFiber) { - { - warningWithoutStack$1( - false, - "The installed version of React DevTools is too old and will not work " + - "with the current version of React. Please update React DevTools. " + - "https://fb.me/react-devtools" - ); - } - // DevTools exists, even though it doesn't support Fiber. - return true; - } - try { - var rendererID = hook.inject(internals); - // We have successfully injected, so now it is safe to set up hooks. - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - warningWithoutStack$1( - false, - "React DevTools encountered an error: %s.", - err - ); +/** + * 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 warning = warningWithoutStack$1; + +{ + warning = function(condition, format) { + if (condition) { + return; } - } - // DevTools exists - return true; -} + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + // eslint-disable-next-line react-internal/warning-and-invariant-args -function onCommitRoot(root) { - if (typeof onCommitFiberRoot === "function") { - onCommitFiberRoot(root); - } -} + for ( + var _len = arguments.length, + args = Array(_len > 2 ? _len - 2 : 0), + _key = 2; + _key < _len; + _key++ + ) { + args[_key - 2] = arguments[_key]; + } -function onCommitUnmount(fiber) { - if (typeof onCommitFiberUnmount === "function") { - onCommitFiberUnmount(fiber); - } + warningWithoutStack$1.apply( + undefined, + [false, format + "%s"].concat(args, [stack]) + ); + }; } -// Max 31 bit integer. The max integer size in V8 for 32-bit systems. -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 -var MAX_SIGNED_31_BIT_INT = 1073741823; +var warning$1 = warning; // Intentionally not named imports because Rollup would use dynamic dispatch for // CommonJS interop named imports. @@ -5434,6 +5477,7 @@ var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority; var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback; var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback; var Scheduler_shouldYield = Scheduler.unstable_shouldYield; +var Scheduler_requestPaint = Scheduler.unstable_requestPaint; var Scheduler_now = Scheduler.unstable_now; var Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel; @@ -5455,7 +5499,9 @@ if (enableSchedulerTracing) { ) ) { throw ReactError( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) ); } })(); @@ -5472,16 +5518,16 @@ var NormalPriority = 97; var LowPriority = 96; var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. +var NoPriority = 90; -var shouldYield = disableYielding - ? function() { - return false; - } // Never yield when `disableYielding` is on - : Scheduler_shouldYield; +var shouldYield = Scheduler_shouldYield; +var requestPaint = + // Fall back gracefully if we're running an older version of Scheduler. + Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; -var immediateQueue = null; +var syncQueue = null; var immediateQueueCallbackNode = null; -var isFlushingImmediate = false; +var isFlushingSyncQueue = false; var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. @@ -5513,7 +5559,7 @@ function getCurrentPriorityLevel() { default: (function() { { - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } })(); } @@ -5534,7 +5580,7 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) { default: (function() { { - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } })(); } @@ -5546,78 +5592,95 @@ function runWithPriority(reactPriorityLevel, fn) { } function scheduleCallback(reactPriorityLevel, callback, options) { - if (reactPriorityLevel === ImmediatePriority) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushImmediateQueue`. - if (immediateQueue === null) { - immediateQueue = [callback]; - // Flush the queue in the next tick, at the earliest. - immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ); - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - immediateQueue.push(callback); - } - return fakeCallbackNode; - } - // Otherwise pass through to Scheduler. var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_scheduleCallback(priorityLevel, callback, options); } +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + // Flush the queue in the next tick, at the earliest. + immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ); + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } + return fakeCallbackNode; +} + function cancelCallback(callbackNode) { if (callbackNode !== fakeCallbackNode) { Scheduler_cancelCallback(callbackNode); } } -function flushImmediateQueue() { +function flushSyncCallbackQueue() { if (immediateQueueCallbackNode !== null) { Scheduler_cancelCallback(immediateQueueCallbackNode); } - flushImmediateQueueImpl(); + flushSyncCallbackQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && immediateQueue !== null) { +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && syncQueue !== null) { // Prevent re-entrancy. - isFlushingImmediate = true; + isFlushingSyncQueue = true; var i = 0; try { var _isSync = true; - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do { - callback = callback(_isSync); - } while (callback !== null); - } - immediateQueue = null; + var queue = syncQueue; + runWithPriority(ImmediatePriority, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do { + callback = callback(_isSync); + } while (callback !== null); + } + }); + syncQueue = null; } catch (error) { // If something throws, leave the remaining callbacks on the queue. - if (immediateQueue !== null) { - immediateQueue = immediateQueue.slice(i + 1); + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); } // Resume flushing in the next tick Scheduler_scheduleCallback( Scheduler_ImmediatePriority, - flushImmediateQueue + flushSyncCallbackQueue ); throw error; } finally { - isFlushingImmediate = false; + isFlushingSyncQueue = false; } } } +var NoMode = 0; +var StrictMode = 1; +// TODO: Remove BatchedMode and ConcurrentMode by reading from the root +// tag instead +var BatchedMode = 2; +var ConcurrentMode = 4; +var ProfileMode = 8; + +// Max 31 bit integer. The max integer size in V8 for 32-bit systems. +// Math.pow(2, 30) - 1 +// 0b111111111111111111111111111111 +var MAX_SIGNED_31_BIT_INT = 1073741823; + var NoWork = 0; var Never = 1; var Sync = MAX_SIGNED_31_BIT_INT; +var Batched = Sync - 1; var UNIT_SIZE = 10; -var MAGIC_NUMBER_OFFSET = MAX_SIGNED_31_BIT_INT - 1; +var MAGIC_NUMBER_OFFSET = Batched - 1; // 1 unit of expiration time represents 10ms. function msToExpirationTime(ms) { @@ -5656,10 +5719,13 @@ function computeAsyncExpiration(currentTime) { ); } -// Same as computeAsyncExpiration but without the bucketing logic. This is -// used to compute timestamps instead of actual expiration times. -function computeAsyncExpirationNoBucket(currentTime) { - return currentTime - LOW_PRIORITY_EXPIRATION / UNIT_SIZE; +function computeSuspenseExpiration(currentTime, timeoutMs) { + // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time? + return computeExpirationBucket( + currentTime, + timeoutMs, + LOW_PRIORITY_BATCH_SIZE + ); } // We intentionally set a higher expiration time for interactive updates in @@ -5709,1099 +5775,881 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { return IdlePriority; } -var NoContext = 0; -var ConcurrentMode = 1; -var StrictMode = 2; -var ProfileMode = 4; +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return ( + (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare + ); +} -var hasBadMapPolyfill = void 0; +var hasOwnProperty = Object.prototype.hasOwnProperty; -{ - hasBadMapPolyfill = false; - try { - var nonExtensibleObject = Object.preventExtensions({}); - var testMap = new Map([[nonExtensibleObject, null]]); - var testSet = new Set([nonExtensibleObject]); - // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - testMap.set(0, 0); - testSet.add(0); - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; } -} -// A Fiber is work on a Component that needs to be done or was done. There can -// be more than one per component. - -var debugCounter = void 0; + if ( + typeof objA !== "object" || + objA === null || + typeof objB !== "object" || + objB === null + ) { + return false; + } -{ - debugCounter = 1; -} + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); -function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.elementType = null; - this.type = null; - this.stateNode = null; + if (keysA.length !== keysB.length) { + return false; + } - // Fiber - this.return = null; - this.child = null; - this.sibling = null; - this.index = 0; + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if ( + !hasOwnProperty.call(objB, keysA[i]) || + !is(objA[keysA[i]], objB[keysA[i]]) + ) { + return false; + } + } - this.ref = null; + return true; +} - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; - this.contextDependencies = null; - - this.mode = mode; - - // Effects - this.effectTag = NoEffect; - this.nextEffect = null; - - this.firstEffect = null; - this.lastEffect = null; +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * 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. + */ - this.expirationTime = NoWork; - this.childExpirationTime = NoWork; +var lowPriorityWarning = function() {}; - this.alternate = null; +{ + var 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]; + } - if (enableProfilerTimer) { - // Note: The following is done to avoid a v8 performance cliff. - // - // Initializing the fields below to smis and later updating them with - // double values will cause Fibers to end up having separate shapes. - // This behavior/bug has something to do with Object.preventExtension(). - // Fortunately this only impacts DEV builds. - // Unfortunately it makes React unusably slow for some applications. - // To work around this, initialize the fields below with doubles. - // - // Learn more about this here: - // https://github.com/facebook/react/issues/14365 - // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; + var argIndex = 0; + var message = + "Warning: " + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== "undefined") { + console.warn(message); + } + 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. + throw new Error(message); + } catch (x) {} + }; - // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; - } + lowPriorityWarning = function(condition, format) { + if (format === undefined) { + throw new Error( + "`lowPriorityWarning(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]; + } - { - this._debugID = debugCounter++; - this._debugSource = null; - this._debugOwner = null; - this._debugIsCurrentlyTiming = false; - this._debugHookTypes = null; - if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { - Object.preventExtensions(this); + printWarning.apply(undefined, [format].concat(args)); } - } + }; } -// This is a constructor function, rather than a POJO constructor, still -// please ensure we do the following: -// 1) Nobody should add any instance methods on this. Instance methods can be -// more difficult to predict when they get optimized and they are almost -// never inlined properly in static compilers. -// 2) Nobody should rely on `instanceof Fiber` for type testing. We should -// always know when it is a fiber. -// 3) We might want to experiment with using numeric keys since they are easier -// to optimize in a non-JIT environment. -// 4) We can easily go from a constructor to a createFiber object literal if that -// is faster. -// 5) It should be easy to port this to a C struct and keep a C implementation -// compatible. -var createFiber = function(tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); -}; +var lowPriorityWarning$1 = lowPriorityWarning; -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} +var ReactStrictModeWarnings = { + recordUnsafeLifecycleWarnings: function(fiber, instance) {}, + flushPendingUnsafeLifecycleWarnings: function() {}, + recordLegacyContextWarning: function(fiber, instance) {}, + flushLegacyContextWarning: function() {}, + discardPendingWarnings: function() {} +}; -function isSimpleFunctionComponent(type) { - return ( - typeof type === "function" && - !shouldConstruct(type) && - type.defaultProps === undefined - ); -} +{ + var findStrictRoot = function(fiber) { + var maybeStrictRoot = null; -function resolveLazyComponentTag(Component) { - if (typeof Component === "function") { - return shouldConstruct(Component) ? ClassComponent : FunctionComponent; - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - if ($$typeof === REACT_FORWARD_REF_TYPE) { - return ForwardRef; - } - if ($$typeof === REACT_MEMO_TYPE) { - return MemoComponent; + var node = fiber; + while (node !== null) { + if (node.mode & StrictMode) { + maybeStrictRoot = node; + } + node = node.return; } - } - return IndeterminateComponent; -} - -// This is used to create an alternate fiber to do work on. -function createWorkInProgress(current, pendingProps, expirationTime) { - var workInProgress = current.alternate; - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - ); - workInProgress.elementType = current.elementType; - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; - { - // DEV-only fields - workInProgress._debugID = current._debugID; - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; - workInProgress._debugHookTypes = current._debugHookTypes; - } + return maybeStrictRoot; + }; - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; + var setToSortedString = function(set) { + var array = []; + set.forEach(function(value) { + array.push(value); + }); + return array.sort().join(", "); + }; - // We already have an alternate. - // Reset the effect tag. - workInProgress.effectTag = NoEffect; + var pendingComponentWillMountWarnings = []; + var pendingUNSAFE_ComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUNSAFE_ComponentWillUpdateWarnings = []; - // The effect list is no longer valid. - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; + // Tracks components we have already warned about. + var didWarnAboutUnsafeLifecycles = new Set(); - if (enableProfilerTimer) { - // We intentionally reset, rather than copy, actualDuration & actualStartTime. - // This prevents time from endlessly accumulating in new commits. - // This has the downside of resetting values for different priority renders, - // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( + fiber, + instance + ) { + // Dedup strategy: Warn once per component. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { + return; } - } - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; + if ( + typeof instance.componentWillMount === "function" && + // Don't warn about react-lifecycles-compat polyfilled components. + instance.componentWillMount.__suppressDeprecationWarning !== true + ) { + pendingComponentWillMountWarnings.push(fiber); + } - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillMount === "function" + ) { + pendingUNSAFE_ComponentWillMountWarnings.push(fiber); + } - // These will be overridden during the parent's reconciliation - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; + if ( + typeof instance.componentWillReceiveProps === "function" && + instance.componentWillReceiveProps.__suppressDeprecationWarning !== true + ) { + pendingComponentWillReceivePropsWarnings.push(fiber); + } - if (enableProfilerTimer) { - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillReceiveProps === "function" + ) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); + } - return workInProgress; -} + if ( + typeof instance.componentWillUpdate === "function" && + instance.componentWillUpdate.__suppressDeprecationWarning !== true + ) { + pendingComponentWillUpdateWarnings.push(fiber); + } -function createHostRootFiber(isConcurrent) { - var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext; + if ( + fiber.mode & StrictMode && + typeof instance.UNSAFE_componentWillUpdate === "function" + ) { + pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); + } + }; - if (enableProfilerTimer && isDevToolsPresent) { - // Always collect profile timings when DevTools are present. - // This enables DevTools to start capturing timing at any point– - // Without some nodes in the tree having empty base times. - mode |= ProfileMode; - } + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { + // We do an initial pass to gather component names + var componentWillMountUniqueNames = new Set(); + if (pendingComponentWillMountWarnings.length > 0) { + pendingComponentWillMountWarnings.forEach(function(fiber) { + componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillMountWarnings = []; + } - return createFiber(HostRoot, null, null, mode); -} + var UNSAFE_componentWillMountUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { + pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { + UNSAFE_componentWillMountUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillMountWarnings = []; + } -function createFiberFromTypeAndProps( - type, // React$ElementType - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiber = void 0; + var componentWillReceivePropsUniqueNames = new Set(); + if (pendingComponentWillReceivePropsWarnings.length > 0) { + pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { + componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); - var fiberTag = IndeterminateComponent; - // The resolved type is set if we know what the final type will be. I.e. it's not lazy. - var resolvedType = type; - if (typeof type === "function") { - if (shouldConstruct(type)) { - fiberTag = ClassComponent; + pendingComponentWillReceivePropsWarnings = []; } - } else if (typeof type === "string") { - fiberTag = HostComponent; - } else { - getTag: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode( - pendingProps, - mode | ConcurrentMode | StrictMode, - expirationTime, - key - ); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode( - pendingProps, - mode | StrictMode, - expirationTime, - key + + var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { + UNSAFE_componentWillReceivePropsUniqueNames.add( + getComponentName(fiber.type) || "Component" ); - case REACT_PROFILER_TYPE: - return createFiberFromProfiler(pendingProps, mode, expirationTime, key); - case REACT_SUSPENSE_TYPE: - return createFiberFromSuspense(pendingProps, mode, expirationTime, key); - default: { - if (typeof type === "object" && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break getTag; - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break getTag; - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - break getTag; - case REACT_MEMO_TYPE: - fiberTag = MemoComponent; - break getTag; - case REACT_LAZY_TYPE: - fiberTag = LazyComponent; - resolvedType = null; - break getTag; - case REACT_EVENT_COMPONENT_TYPE: - if (enableEventAPI) { - return createFiberFromEventComponent( - type, - pendingProps, - mode, - expirationTime, - key - ); - } - break; - case REACT_EVENT_TARGET_TYPE: - if (enableEventAPI) { - return createFiberFromEventTarget( - type, - pendingProps, - mode, - expirationTime, - key - ); - } - break; - } - } - var info = ""; - { - if ( - type === undefined || - (typeof type === "object" && - type !== null && - Object.keys(type).length === 0) - ) { - info += - " You likely forgot to export your component from the file " + - "it's defined in, or you might have mixed up default and " + - "named imports."; - } - var ownerName = owner ? getComponentName(owner.type) : null; - if (ownerName) { - info += "\n\nCheck the render method of `" + ownerName + "`."; - } - } - (function() { - { - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (type == null ? type : typeof type) + - "." + - info - ); - } - })(); - } + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; } - } - fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.elementType = type; - fiber.type = resolvedType; - fiber.expirationTime = expirationTime; + var componentWillUpdateUniqueNames = new Set(); + if (pendingComponentWillUpdateWarnings.length > 0) { + pendingComponentWillUpdateWarnings.forEach(function(fiber) { + componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); - return fiber; -} + pendingComponentWillUpdateWarnings = []; + } -function createFiberFromElement(element, mode, expirationTime) { - var owner = null; - { - owner = element._owner; - } - var type = element.type; - var key = element.key; - var pendingProps = element.props; - var fiber = createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime - ); - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; - } - return fiber; -} + var UNSAFE_componentWillUpdateUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { + pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { + UNSAFE_componentWillUpdateUniqueNames.add( + getComponentName(fiber.type) || "Component" + ); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); -function createFiberFromFragment(elements, mode, expirationTime, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.expirationTime = expirationTime; - return fiber; -} + pendingUNSAFE_ComponentWillUpdateWarnings = []; + } -function createFiberFromEventComponent( - eventComponent, - pendingProps, - mode, - expirationTime, - key -) { - var fiber = createFiber(EventComponent, pendingProps, key, mode); - fiber.elementType = eventComponent; - fiber.type = eventComponent; - fiber.expirationTime = expirationTime; - return fiber; -} + // Finally, we flush all the warnings + // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' + if (UNSAFE_componentWillMountUniqueNames.size > 0) { + var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "\nPlease update the following components: %s", + sortedNames + ); + } -function createFiberFromEventTarget( - eventTarget, - pendingProps, - mode, - expirationTime, - key -) { - var fiber = createFiber(EventTarget, pendingProps, key, mode); - fiber.elementType = eventTarget; - fiber.type = eventTarget; - fiber.expirationTime = expirationTime; - // Store latest props - fiber.stateNode = { - props: pendingProps - }; - return fiber; -} + if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames = setToSortedString( + UNSAFE_componentWillReceivePropsUniqueNames + ); + warningWithoutStack$1( + false, + "Using UNSAFE_componentWillReceiveProps in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, " + + "refactor your code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "\nPlease update the following components: %s", + _sortedNames + ); + } -function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { - { - if ( - typeof pendingProps.id !== "string" || - typeof pendingProps.onRender !== "function" - ) { + if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { + var _sortedNames2 = setToSortedString( + UNSAFE_componentWillUpdateUniqueNames + ); warningWithoutStack$1( false, - 'Profiler must specify an "id" string and "onRender" function as props' + "Using UNSAFE_componentWillUpdate in strict mode is not recommended " + + "and may indicate bugs in your code. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "\nPlease update the following components: %s", + _sortedNames2 ); } - } - var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); - // TODO: The Profiler fiber shouldn't have a type. It has a tag. - fiber.elementType = REACT_PROFILER_TYPE; - fiber.type = REACT_PROFILER_TYPE; - fiber.expirationTime = expirationTime; + if (componentWillMountUniqueNames.size > 0) { + var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); - return fiber; -} + lowPriorityWarning$1( + false, + "componentWillMount has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move code with side effects to componentDidMount, and set initial state in the constructor.\n" + + "* Rename componentWillMount to UNSAFE_componentWillMount to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames3 + ); + } -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - var fiber = createFiber(Mode, pendingProps, key, mode); + if (componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames4 = setToSortedString( + componentWillReceivePropsUniqueNames + ); - // TODO: The Mode fiber shouldn't have a type. It has a tag. - var type = - (mode & ConcurrentMode) === NoContext - ? REACT_STRICT_MODE_TYPE - : REACT_CONCURRENT_MODE_TYPE; - fiber.elementType = type; - fiber.type = type; + lowPriorityWarning$1( + false, + "componentWillReceiveProps has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* If you're updating state whenever props change, refactor your " + + "code to use memoization techniques or move it to " + + "static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n" + + "* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames4 + ); + } - fiber.expirationTime = expirationTime; - return fiber; -} + if (componentWillUpdateUniqueNames.size > 0) { + var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); -function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { - var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); + lowPriorityWarning$1( + false, + "componentWillUpdate has been renamed, and is not recommended for use. " + + "See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n" + + "* Move data fetching code or side effects to componentDidUpdate.\n" + + "* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress " + + "this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. " + + "To rename all deprecated lifecycles to their new names, you can run " + + "`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n" + + "\nPlease update the following components: %s", + _sortedNames5 + ); + } + }; - // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. - var type = REACT_SUSPENSE_TYPE; - fiber.elementType = type; - fiber.type = type; + var pendingLegacyContextWarning = new Map(); - fiber.expirationTime = expirationTime; - return fiber; -} + // Tracks components we have already warned about. + var didWarnAboutLegacyContext = new Set(); -function createFiberFromText(content, mode, expirationTime) { - var fiber = createFiber(HostText, content, null, mode); - fiber.expirationTime = expirationTime; - return fiber; -} + ReactStrictModeWarnings.recordLegacyContextWarning = function( + fiber, + instance + ) { + var strictRoot = findStrictRoot(fiber); + if (strictRoot === null) { + warningWithoutStack$1( + false, + "Expected to find a StrictMode component in a strict mode tree. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + return; + } -function createFiberFromHostInstanceForDeletion() { - var fiber = createFiber(HostComponent, null, null, NoContext); - // TODO: These should not need a type. - fiber.elementType = "DELETED"; - fiber.type = "DELETED"; - return fiber; -} + // Dedup strategy: Warn once per component. + if (didWarnAboutLegacyContext.has(fiber.type)) { + return; + } -function createFiberFromPortal(portal, mode, expirationTime) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.expirationTime = expirationTime; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, // Used by persistent updates - implementation: portal.implementation + var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); + + if ( + fiber.type.contextTypes != null || + fiber.type.childContextTypes != null || + (instance !== null && typeof instance.getChildContext === "function") + ) { + if (warningsForRoot === undefined) { + warningsForRoot = []; + pendingLegacyContextWarning.set(strictRoot, warningsForRoot); + } + warningsForRoot.push(fiber); + } }; - return fiber; -} -// Used for stashing WIP properties to replay failed work in DEV. -function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoContext); - } + ReactStrictModeWarnings.flushLegacyContextWarning = function() { + pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) { + var uniqueNames = new Set(); + fiberArray.forEach(function(fiber) { + uniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutLegacyContext.add(fiber.type); + }); - // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. + var sortedNames = setToSortedString(uniqueNames); + var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); - target.tag = source.tag; - target.key = source.key; - target.elementType = source.elementType; - target.type = source.type; - target.stateNode = source.stateNode; - target.return = source.return; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.contextDependencies = source.contextDependencies; - target.mode = source.mode; - target.effectTag = source.effectTag; - target.nextEffect = source.nextEffect; - target.firstEffect = source.firstEffect; - target.lastEffect = source.lastEffect; - target.expirationTime = source.expirationTime; - target.childExpirationTime = source.childExpirationTime; - target.alternate = source.alternate; - if (enableProfilerTimer) { - target.actualDuration = source.actualDuration; - target.actualStartTime = source.actualStartTime; - target.selfBaseDuration = source.selfBaseDuration; - target.treeBaseDuration = source.treeBaseDuration; - } - target._debugID = source._debugID; - target._debugSource = source._debugSource; - target._debugOwner = source._debugOwner; - target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; - target._debugHookTypes = source._debugHookTypes; - return target; + warningWithoutStack$1( + false, + "Legacy context API has been detected within a strict-mode tree: %s" + + "\n\nThe old API will be supported in all 16.x releases, but applications " + + "using it should migrate to the new version." + + "\n\nPlease update the following components: %s" + + "\n\nLearn more about this warning here:" + + "\nhttps://fb.me/react-legacy-context", + strictRootComponentStack, + sortedNames + ); + }); + }; + + ReactStrictModeWarnings.discardPendingWarnings = function() { + pendingComponentWillMountWarnings = []; + pendingUNSAFE_ComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUNSAFE_ComponentWillUpdateWarnings = []; + pendingLegacyContextWarning = new Map(); + }; } -// TODO: This should be lifted into the renderer. +// Resolves type to a family. -// The following attributes are only used by interaction tracing builds. -// They enable interactions to be associated with their async work, -// And expose interaction metadata to the React DevTools Profiler plugin. -// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. +// Used by React Refresh runtime through DevTools Global Hook. -// Exported FiberRoot type includes all properties, -// To avoid requiring potentially error-prone :any casts throughout the project. -// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). -// The types are defined separately within this file to ensure they stay in sync. -// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) +var resolveFamily = null; +// $FlowFixMe Flow gets confused by a WeakSet feature check below. +var failedBoundaries = null; -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pendingChildren = null; - this.pingCache = null; - this.pendingCommitExpirationTime = NoWork; - this.finishedWork = null; - this.timeoutHandle = noTimeout; - this.context = null; - this.pendingContext = null; - this.hydrate = hydrate; - this.firstBatch = null; - this.callbackNode = null; - this.callbackExpirationTime = NoWork; - this.firstPendingTime = NoWork; - this.lastPendingTime = NoWork; - this.pingTime = NoWork; +var setRefreshHandler = function(handler) { + { + resolveFamily = handler; + } +}; - if (enableSchedulerTracing) { - this.interactionThreadID = tracing.unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); +function resolveFunctionForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + return type; + } + // Use the latest known implementation. + return family.current; } } -function createFiberRoot(containerInfo, isConcurrent, hydrate) { - var root = new FiberRootNode(containerInfo, hydrate); - - // Cyclic construction. This cheats the type system right now because - // stateNode is any. - var uninitializedFiber = createHostRootFiber(isConcurrent); - root.current = uninitializedFiber; - uninitializedFiber.stateNode = root; +function resolveClassForHotReloading(type) { + // No implementation differences. + return resolveFunctionForHotReloading(type); +} - return root; +function resolveForwardRefForHotReloading(type) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return type; + } + var family = resolveFamily(type); + if (family === undefined) { + // Check if we're dealing with a real forwardRef. Don't want to crash early. + if ( + type !== null && + type !== undefined && + typeof type.render === "function" + ) { + // ForwardRef is special because its resolved .type is an object, + // but it's possible that we only have its inner render function in the map. + // If that inner render function is different, we'll build a new forwardRef type. + var currentRender = resolveFunctionForHotReloading(type.render); + if (type.render !== currentRender) { + var syntheticType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: currentRender + }; + if (type.displayName !== undefined) { + syntheticType.displayName = type.displayName; + } + return syntheticType; + } + } + return type; + } + // Use the latest known implementation. + return family.current; + } } -/** - * 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. - */ +function isCompatibleFamilyForHotReloading(fiber, element) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return false; + } -var warning = warningWithoutStack$1; + var prevType = fiber.elementType; + var nextType = element.type; -{ - warning = function(condition, format) { - if (condition) { - return; - } - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - // eslint-disable-next-line react-internal/warning-and-invariant-args + // If we got here, we know types aren't === equal. + var needsCompareFamilies = false; - for ( - var _len = arguments.length, - args = Array(_len > 2 ? _len - 2 : 0), - _key = 2; - _key < _len; - _key++ - ) { - args[_key - 2] = arguments[_key]; + var $$typeofNextType = + typeof nextType === "object" && nextType !== null + ? nextType.$$typeof + : null; + + switch (fiber.tag) { + case ClassComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } + break; + } + case FunctionComponent: { + if (typeof nextType === "function") { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + // We don't know the inner type yet. + // We're going to assume that the lazy inner type is stable, + // and so it is sufficient to avoid reconciling it away. + // We're not going to unwrap or actually use the new lazy type. + needsCompareFamilies = true; + } + break; + } + case ForwardRef: { + if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + case MemoComponent: + case SimpleMemoComponent: { + if ($$typeofNextType === REACT_MEMO_TYPE) { + // TODO: if it was but can no longer be simple, + // we shouldn't set this. + needsCompareFamilies = true; + } else if ($$typeofNextType === REACT_LAZY_TYPE) { + needsCompareFamilies = true; + } + break; + } + default: + return false; } - warningWithoutStack$1.apply( - undefined, - [false, format + "%s"].concat(args, [stack]) - ); - }; + // Check if both types have a family and it's the same one. + if (needsCompareFamilies) { + // Note: memo() and forwardRef() we'll compare outer rather than inner type. + // This means both of them need to be registered to preserve state. + // If we unwrapped and compared the inner types for wrappers instead, + // then we would risk falsely saying two separate memo(Foo) + // calls are equivalent because they wrap the same Foo function. + var prevFamily = resolveFamily(prevType); + if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { + return true; + } + } + return false; + } } -var warning$1 = warning; - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return ( - (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare - ); +function markFailedErrorBoundaryForHotReloading(fiber) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + if (typeof WeakSet !== "function") { + return; + } + if (failedBoundaries === null) { + failedBoundaries = new WeakSet(); + } + failedBoundaries.add(fiber); + } } -var hasOwnProperty = Object.prototype.hasOwnProperty; - -/** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ -function shallowEqual(objA, objB) { - if (is(objA, objB)) { - return true; - } - - if ( - typeof objA !== "object" || - objA === null || - typeof objB !== "object" || - objB === null - ) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); +var scheduleRefresh = function(root, update) { + { + if (resolveFamily === null) { + // Hot reloading is disabled. + return; + } + var _staleFamilies = update.staleFamilies, + _updatedFamilies = update.updatedFamilies; - if (keysA.length !== keysB.length) { - return false; + flushPassiveEffects(); + flushSync(function() { + scheduleFibersWithFamiliesRecursively( + root.current, + _updatedFamilies, + _staleFamilies + ); + }); } +}; - // Test for A's keys different from B. - for (var i = 0; i < keysA.length; i++) { - if ( - !hasOwnProperty.call(objB, keysA[i]) || - !is(objA[keysA[i]], objB[keysA[i]]) - ) { - return false; +var scheduleRoot = function(root, element) { + { + if (root.context !== emptyContextObject) { + // Super edge case: root has a legacy _renderSubtree context + // but we don't know the parentComponent so we can't pass it. + // Just ignore. We'll delete this with _renderSubtree code path later. + return; } + flushPassiveEffects(); + updateContainerAtExpirationTime(element, root, null, Sync, null); } +}; - return true; -} - -/** - * Forked from fbjs/warning: - * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js - * - * Only change is we use console.warn instead of console.error, - * and do nothing when 'console' is not supported. - * This really simplifies the code. - * --- - * 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 lowPriorityWarning = function() {}; - -{ - var 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]; +function scheduleFibersWithFamiliesRecursively( + fiber, + updatedFamilies, + staleFamilies +) { + { + var alternate = fiber.alternate, + child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; + + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; } - var argIndex = 0; - var message = - "Warning: " + - format.replace(/%s/g, function() { - return args[argIndex++]; - }); - if (typeof console !== "undefined") { - console.warn(message); + if (resolveFamily === null) { + throw new Error("Expected resolveFamily to be set during hot reload."); } - 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. - throw new Error(message); - } catch (x) {} - }; - lowPriorityWarning = function(condition, format) { - if (format === undefined) { - throw new Error( - "`lowPriorityWarning(condition, format, ...args)` requires a warning " + - "message argument" - ); + var needsRender = false; + var needsRemount = false; + if (candidateType !== null) { + var family = resolveFamily(candidateType); + if (family !== undefined) { + if (staleFamilies.has(family)) { + needsRemount = true; + } else if (updatedFamilies.has(family)) { + if (tag === ClassComponent) { + needsRemount = true; + } else { + needsRender = true; + } + } + } } - if (!condition) { - for ( - var _len2 = arguments.length, - args = Array(_len2 > 2 ? _len2 - 2 : 0), - _key2 = 2; - _key2 < _len2; - _key2++ + if (failedBoundaries !== null) { + if ( + failedBoundaries.has(fiber) || + (alternate !== null && failedBoundaries.has(alternate)) ) { - args[_key2 - 2] = arguments[_key2]; + needsRemount = true; } + } - printWarning.apply(undefined, [format].concat(args)); + if (needsRemount) { + fiber._debugNeedsRemount = true; } - }; + if (needsRemount || needsRender) { + scheduleWork(fiber, Sync); + } + if (child !== null && !needsRemount) { + scheduleFibersWithFamiliesRecursively( + child, + updatedFamilies, + staleFamilies + ); + } + if (sibling !== null) { + scheduleFibersWithFamiliesRecursively( + sibling, + updatedFamilies, + staleFamilies + ); + } + } } -var lowPriorityWarning$1 = lowPriorityWarning; - -var ReactStrictModeWarnings = { - discardPendingWarnings: function() {}, - flushPendingDeprecationWarnings: function() {}, - flushPendingUnsafeLifecycleWarnings: function() {}, - recordDeprecationWarnings: function(fiber, instance) {}, - recordUnsafeLifecycleWarnings: function(fiber, instance) {}, - recordLegacyContextWarning: function(fiber, instance) {}, - flushLegacyContextWarning: function() {} +var findHostInstancesForRefresh = function(root, families) { + { + var hostInstances = new Set(); + var types = new Set( + families.map(function(family) { + return family.current; + }) + ); + findHostInstancesForMatchingFibersRecursively( + root.current, + types, + hostInstances + ); + return hostInstances; + } }; -{ - var LIFECYCLE_SUGGESTIONS = { - UNSAFE_componentWillMount: "componentDidMount", - UNSAFE_componentWillReceiveProps: "static getDerivedStateFromProps", - UNSAFE_componentWillUpdate: "componentDidUpdate" - }; - - var pendingComponentWillMountWarnings = []; - var pendingComponentWillReceivePropsWarnings = []; - var pendingComponentWillUpdateWarnings = []; - var pendingUnsafeLifecycleWarnings = new Map(); - var pendingLegacyContextWarning = new Map(); - - // Tracks components we have already warned about. - var didWarnAboutDeprecatedLifecycles = new Set(); - var didWarnAboutUnsafeLifecycles = new Set(); - var didWarnAboutLegacyContext = new Set(); - - var setToSortedString = function(set) { - var array = []; - set.forEach(function(value) { - array.push(value); - }); - return array.sort().join(", "); - }; - - ReactStrictModeWarnings.discardPendingWarnings = function() { - pendingComponentWillMountWarnings = []; - pendingComponentWillReceivePropsWarnings = []; - pendingComponentWillUpdateWarnings = []; - pendingUnsafeLifecycleWarnings = new Map(); - pendingLegacyContextWarning = new Map(); - }; - - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { - pendingUnsafeLifecycleWarnings.forEach(function( - lifecycleWarningsMap, - strictRoot - ) { - var lifecyclesWarningMessages = []; - - Object.keys(lifecycleWarningsMap).forEach(function(lifecycle) { - var lifecycleWarnings = lifecycleWarningsMap[lifecycle]; - if (lifecycleWarnings.length > 0) { - var componentNames = new Set(); - lifecycleWarnings.forEach(function(fiber) { - componentNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - - var formatted = lifecycle.replace("UNSAFE_", ""); - var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle]; - var sortedComponentNames = setToSortedString(componentNames); +function findHostInstancesForMatchingFibersRecursively( + fiber, + types, + hostInstances +) { + { + var child = fiber.child, + sibling = fiber.sibling, + tag = fiber.tag, + type = fiber.type; - lifecyclesWarningMessages.push( - formatted + - ": Please update the following components to use " + - (suggestion + " instead: " + sortedComponentNames) - ); - } - }); + var candidateType = null; + switch (tag) { + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + default: + break; + } - if (lifecyclesWarningMessages.length > 0) { - var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); + var didMatch = false; + if (candidateType !== null) { + if (types.has(candidateType)) { + didMatch = true; + } + } - warningWithoutStack$1( - false, - "Unsafe lifecycle methods were found within a strict-mode tree:%s" + - "\n\n%s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-strict-mode-warnings", - strictRootComponentStack, - lifecyclesWarningMessages.join("\n\n") + if (didMatch) { + // We have a match. This only drills down to the closest host components. + // There's no need to search deeper because for the purpose of giving + // visual feedback, "flashing" outermost parent rectangles is sufficient. + findHostInstancesForFiberShallowly(fiber, hostInstances); + } else { + // If there's no match, maybe there will be one further down in the child tree. + if (child !== null) { + findHostInstancesForMatchingFibersRecursively( + child, + types, + hostInstances ); } - }); - - pendingUnsafeLifecycleWarnings = new Map(); - }; + } - var findStrictRoot = function(fiber) { - var maybeStrictRoot = null; + if (sibling !== null) { + findHostInstancesForMatchingFibersRecursively( + sibling, + types, + hostInstances + ); + } + } +} +function findHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var foundHostInstances = findChildHostInstancesForFiberShallowly( + fiber, + hostInstances + ); + if (foundHostInstances) { + return; + } + // If we didn't find any host children, fallback to closest host parent. var node = fiber; - while (node !== null) { - if (node.mode & StrictMode) { - maybeStrictRoot = node; + while (true) { + switch (node.tag) { + case HostComponent: + hostInstances.add(node.stateNode); + return; + case HostPortal: + hostInstances.add(node.stateNode.containerInfo); + return; + case HostRoot: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (node.return === null) { + throw new Error("Expected to reach root first."); } node = node.return; } + } +} - return maybeStrictRoot; - }; - - ReactStrictModeWarnings.flushPendingDeprecationWarnings = function() { - if (pendingComponentWillMountWarnings.length > 0) { - var uniqueNames = new Set(); - pendingComponentWillMountWarnings.forEach(function(fiber) { - uniqueNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); - - var sortedNames = setToSortedString(uniqueNames); - - lowPriorityWarning$1( - false, - "componentWillMount is deprecated and will be removed in the next major version. " + - "Use componentDidMount instead. As a temporary workaround, " + - "you can rename to UNSAFE_componentWillMount." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - sortedNames - ); - - pendingComponentWillMountWarnings = []; +function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { + { + var node = fiber; + var foundHostInstances = false; + while (true) { + if (node.tag === HostComponent) { + // We got a match. + foundHostInstances = true; + hostInstances.add(node.stateNode); + // There may still be more, so keep searching. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === fiber) { + return foundHostInstances; + } + while (node.sibling === null) { + if (node.return === null || node.return === fiber) { + return foundHostInstances; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; } - - if (pendingComponentWillReceivePropsWarnings.length > 0) { - var _uniqueNames = new Set(); - pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { - _uniqueNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); - - var _sortedNames = setToSortedString(_uniqueNames); - - lowPriorityWarning$1( - false, - "componentWillReceiveProps is deprecated and will be removed in the next major version. " + - "Use static getDerivedStateFromProps instead." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - _sortedNames - ); - - pendingComponentWillReceivePropsWarnings = []; - } - - if (pendingComponentWillUpdateWarnings.length > 0) { - var _uniqueNames2 = new Set(); - pendingComponentWillUpdateWarnings.forEach(function(fiber) { - _uniqueNames2.add(getComponentName(fiber.type) || "Component"); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); - - var _sortedNames2 = setToSortedString(_uniqueNames2); - - lowPriorityWarning$1( - false, - "componentWillUpdate is deprecated and will be removed in the next major version. " + - "Use componentDidUpdate instead. As a temporary workaround, " + - "you can rename to UNSAFE_componentWillUpdate." + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-async-component-lifecycle-hooks", - _sortedNames2 - ); - - pendingComponentWillUpdateWarnings = []; - } - }; - - ReactStrictModeWarnings.recordDeprecationWarnings = function( - fiber, - instance - ) { - // Dedup strategy: Warn once per component. - if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) { - return; - } - - // Don't warn about react-lifecycles-compat polyfilled components. - if ( - typeof instance.componentWillMount === "function" && - instance.componentWillMount.__suppressDeprecationWarning !== true - ) { - pendingComponentWillMountWarnings.push(fiber); - } - if ( - typeof instance.componentWillReceiveProps === "function" && - instance.componentWillReceiveProps.__suppressDeprecationWarning !== true - ) { - pendingComponentWillReceivePropsWarnings.push(fiber); - } - if ( - typeof instance.componentWillUpdate === "function" && - instance.componentWillUpdate.__suppressDeprecationWarning !== true - ) { - pendingComponentWillUpdateWarnings.push(fiber); - } - }; - - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function( - fiber, - instance - ) { - var strictRoot = findStrictRoot(fiber); - if (strictRoot === null) { - warningWithoutStack$1( - false, - "Expected to find a StrictMode component in a strict mode tree. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - return; - } - - // Dedup strategy: Warn once per component. - // This is difficult to track any other way since component names - // are often vague and are likely to collide between 3rd party libraries. - // An expand property is probably okay to use here since it's DEV-only, - // and will only be set in the event of serious warnings. - if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { - return; - } - - var warningsForRoot = void 0; - if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) { - warningsForRoot = { - UNSAFE_componentWillMount: [], - UNSAFE_componentWillReceiveProps: [], - UNSAFE_componentWillUpdate: [] - }; - - pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot); - } else { - warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot); - } - - var unsafeLifecycles = []; - if ( - (typeof instance.componentWillMount === "function" && - instance.componentWillMount.__suppressDeprecationWarning !== true) || - typeof instance.UNSAFE_componentWillMount === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillMount"); - } - if ( - (typeof instance.componentWillReceiveProps === "function" && - instance.componentWillReceiveProps.__suppressDeprecationWarning !== - true) || - typeof instance.UNSAFE_componentWillReceiveProps === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillReceiveProps"); - } - if ( - (typeof instance.componentWillUpdate === "function" && - instance.componentWillUpdate.__suppressDeprecationWarning !== true) || - typeof instance.UNSAFE_componentWillUpdate === "function" - ) { - unsafeLifecycles.push("UNSAFE_componentWillUpdate"); - } - - if (unsafeLifecycles.length > 0) { - unsafeLifecycles.forEach(function(lifecycle) { - warningsForRoot[lifecycle].push(fiber); - }); - } - }; - - ReactStrictModeWarnings.recordLegacyContextWarning = function( - fiber, - instance - ) { - var strictRoot = findStrictRoot(fiber); - if (strictRoot === null) { - warningWithoutStack$1( - false, - "Expected to find a StrictMode component in a strict mode tree. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - return; - } - - // Dedup strategy: Warn once per component. - if (didWarnAboutLegacyContext.has(fiber.type)) { - return; - } - - var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); - - if ( - fiber.type.contextTypes != null || - fiber.type.childContextTypes != null || - (instance !== null && typeof instance.getChildContext === "function") - ) { - if (warningsForRoot === undefined) { - warningsForRoot = []; - pendingLegacyContextWarning.set(strictRoot, warningsForRoot); - } - warningsForRoot.push(fiber); - } - }; - - ReactStrictModeWarnings.flushLegacyContextWarning = function() { - pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) { - var uniqueNames = new Set(); - fiberArray.forEach(function(fiber) { - uniqueNames.add(getComponentName(fiber.type) || "Component"); - didWarnAboutLegacyContext.add(fiber.type); - }); - - var sortedNames = setToSortedString(uniqueNames); - var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot); - - warningWithoutStack$1( - false, - "Legacy context API has been detected within a strict-mode tree: %s" + - "\n\nPlease update the following components: %s" + - "\n\nLearn more about this warning here:" + - "\nhttps://fb.me/react-strict-mode-warnings", - strictRootComponentStack, - sortedNames - ); - }); - }; -} + } + return false; +} function resolveDefaultProps(Component, baseProps) { if (Component && Component.defaultProps) { @@ -6891,7 +6739,7 @@ var lastContextWithAllBitsObserved = null; var isDisallowedContextReadInDEV = false; -function resetContextDependences() { +function resetContextDependencies() { // This is called right before React yields execution, to ensure `readContext` // cannot be called outside the render phase. currentlyRenderingFiber = null; @@ -7036,11 +6884,11 @@ function propagateContextChange( var nextFiber = void 0; // Visit this fiber. - var list = fiber.contextDependencies; + var list = fiber.dependencies; if (list !== null) { nextFiber = fiber.child; - var dependency = list.first; + var dependency = list.firstContext; while (dependency !== null) { // Check if the context matches. if ( @@ -7051,7 +6899,7 @@ function propagateContextChange( if (fiber.tag === ClassComponent) { // Schedule a force update on the work-in-progress. - var update = createUpdate(renderExpirationTime); + var update = createUpdate(renderExpirationTime, null); update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the // update to the current fiber, too, which means it will persist even if @@ -7147,17 +6995,18 @@ function prepareToReadContext(workInProgress, renderExpirationTime) { lastContextDependency = null; lastContextWithAllBitsObserved = null; - var currentDependencies = workInProgress.contextDependencies; - if ( - currentDependencies !== null && - currentDependencies.expirationTime >= renderExpirationTime - ) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); + var dependencies = workInProgress.dependencies; + if (dependencies !== null) { + var firstContext = dependencies.firstContext; + if (firstContext !== null) { + if (dependencies.expirationTime >= renderExpirationTime) { + // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + } + // Reset the work-in-progress list + dependencies.firstContext = null; + } } - - // Reset the work-in-progress list - workInProgress.contextDependencies = null; } function readContext(context, observedBits) { @@ -7202,16 +7051,19 @@ function readContext(context, observedBits) { (function() { if (!(currentlyRenderingFiber !== null)) { throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); } })(); // This is the first dependency for this component. Create a new list. lastContextDependency = contextItem; - currentlyRenderingFiber.contextDependencies = { - first: contextItem, - expirationTime: NoWork + currentlyRenderingFiber.dependencies = { + expirationTime: NoWork, + firstContext: contextItem, + responders: null }; } else { // Append a new context item. @@ -7351,9 +7203,10 @@ function cloneUpdateQueue(currentQueue) { return queue; } -function createUpdate(expirationTime) { - return { +function createUpdate(expirationTime, suspenseConfig) { + var update = { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: UpdateState, payload: null, @@ -7362,6 +7215,10 @@ function createUpdate(expirationTime) { next: null, nextEffect: null }; + { + update.priority = getCurrentPriorityLevel(); + } + return update; } function appendUpdateToQueue(queue, update) { @@ -7614,7 +7471,7 @@ function processUpdateQueue( // TODO: We should skip this update if it was already committed but currently // we have no way of detecting the difference between a committed and suspended // update here. - markRenderEventTime(updateExpirationTime); + markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process it and compute a new result. resultState = getStateFromUpdate( @@ -7728,8 +7585,10 @@ function callCallback(callback, context) { (function() { if (!(typeof callback === "function")) { throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - callback + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + callback + ) ); } })(); @@ -7783,6 +7642,12 @@ function commitUpdateEffects(effect, instance) { } } +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + +function requestCurrentSuspenseConfig() { + return ReactCurrentBatchConfig.suspense; +} + var fakeInternalInstance = {}; var isArray$1 = Array.isArray; @@ -7856,7 +7721,9 @@ var didWarnAboutInvalidateContextType = void 0; (function() { { throw ReactError( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + Error( + "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." + ) ); } })(); @@ -7907,11 +7774,16 @@ function applyDerivedStateFromProps( var classComponentUpdater = { isMounted: isMounted, enqueueSetState: function(inst, payload, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.payload = payload; if (callback !== undefined && callback !== null) { { @@ -7920,16 +7792,23 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); }, enqueueReplaceState: function(inst, payload, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.tag = ReplaceState; update.payload = payload; @@ -7940,16 +7819,23 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); }, enqueueForceUpdate: function(inst, callback) { - var fiber = get$1(inst); + var fiber = get(inst); var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, fiber); + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + fiber, + suspenseConfig + ); - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); update.tag = ForceUpdate; if (callback !== undefined && callback !== null) { @@ -7959,7 +7845,9 @@ var classComponentUpdater = { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(fiber, update); scheduleWork(fiber, expirationTime); } @@ -8074,28 +7962,48 @@ function checkClassInstance(workInProgress, ctor, newProps) { name ) : void 0; - var noInstanceContextTypes = !instance.contextTypes; - !noInstanceContextTypes - ? warningWithoutStack$1( + + if (disableLegacyContext) { + if (ctor.childContextTypes) { + warningWithoutStack$1( false, - "contextTypes was defined as an instance property on %s. Use a static " + - "property to define contextTypes instead.", + "%s uses the legacy childContextTypes API which is no longer supported. " + + "Use React.createContext() instead.", name - ) - : void 0; + ); + } + if (ctor.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with static contextType instead.", + name + ); + } + } else { + var noInstanceContextTypes = !instance.contextTypes; + !noInstanceContextTypes + ? warningWithoutStack$1( + false, + "contextTypes was defined as an instance property on %s. Use a static " + + "property to define contextTypes instead.", + name + ) + : void 0; - if ( - ctor.contextType && - ctor.contextTypes && - !didWarnAboutContextTypeAndContextTypes.has(ctor) - ) { - didWarnAboutContextTypeAndContextTypes.add(ctor); - warningWithoutStack$1( - false, - "%s declares both contextTypes and contextType static properties. " + - "The legacy contextTypes property will be ignored.", - name - ); + if ( + ctor.contextType && + ctor.contextTypes && + !didWarnAboutContextTypeAndContextTypes.has(ctor) + ) { + didWarnAboutContextTypeAndContextTypes.add(ctor); + warningWithoutStack$1( + false, + "%s declares both contextTypes and contextType static properties. " + + "The legacy contextTypes property will be ignored.", + name + ); + } } var noComponentShouldUpdate = @@ -8271,7 +8179,7 @@ function constructClassInstance( ) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; - var context = null; + var context = emptyContextObject; var contextType = ctor.contextType; { @@ -8319,7 +8227,7 @@ function constructClassInstance( if (typeof contextType === "object" && contextType !== null) { context = readContext(contextType); - } else { + } else if (!disableLegacyContext) { unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); var contextTypes = ctor.contextTypes; isLegacyContextConsumer = @@ -8521,6 +8429,8 @@ function mountClassInstance( var contextType = ctor.contextType; if (typeof contextType === "object" && contextType !== null) { instance.context = readContext(contextType); + } else if (disableLegacyContext) { + instance.context = emptyContextObject; } else { var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); instance.context = getMaskedContext(workInProgress, unmaskedContext); @@ -8542,11 +8452,6 @@ function mountClassInstance( } if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( - workInProgress, - instance - ); - ReactStrictModeWarnings.recordLegacyContextWarning( workInProgress, instance @@ -8554,7 +8459,7 @@ function mountClassInstance( } if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.recordDeprecationWarnings( + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings( workInProgress, instance ); @@ -8626,10 +8531,10 @@ function resumeMountClassInstance( var oldContext = instance.context; var contextType = ctor.contextType; - var nextContext = void 0; + var nextContext = emptyContextObject; if (typeof contextType === "object" && contextType !== null) { nextContext = readContext(contextType); - } else { + } else if (!disableLegacyContext) { var nextLegacyUnmaskedContext = getUnmaskedContext( workInProgress, ctor, @@ -8775,10 +8680,10 @@ function updateClassInstance( var oldContext = instance.context; var contextType = ctor.contextType; - var nextContext = void 0; + var nextContext = emptyContextObject; if (typeof contextType === "object" && contextType !== null) { nextContext = readContext(contextType); - } else { + } else if (!disableLegacyContext) { var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); } @@ -8934,7 +8839,7 @@ function updateClassInstance( var didWarnAboutMaps = void 0; var didWarnAboutGenerators = void 0; -var didWarnAboutStringRefInStrictMode = void 0; +var didWarnAboutStringRefs = void 0; var ownerHasKeyUseWarning = void 0; var ownerHasFunctionTypeWarning = void 0; var warnForMissingKey = function(child) {}; @@ -8942,7 +8847,7 @@ var warnForMissingKey = function(child) {}; { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefInStrictMode = {}; + didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or @@ -8962,7 +8867,9 @@ var warnForMissingKey = function(child) {}; (function() { if (!(typeof child._store === "object")) { throw ReactError( - "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + Error( + "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -8997,21 +8904,38 @@ function coerceRef(returnFiber, current$$1, element) { typeof mixedRef !== "object" ) { { - if (returnFiber.mode & StrictMode) { + // TODO: Clean this up once we turn on the string ref warning for + // everyone, because the strict mode case will no longer be relevant + if (returnFiber.mode & StrictMode || warnAboutStringRefs) { var componentName = getComponentName(returnFiber.type) || "Component"; - if (!didWarnAboutStringRefInStrictMode[componentName]) { - warningWithoutStack$1( - false, - 'A string ref, "%s", has been found within a strict mode tree. ' + - "String refs are a source of potential bugs and should be avoided. " + - "We recommend using createRef() instead." + - "\n%s" + - "\n\nLearn more about using refs safely here:" + - "\nhttps://fb.me/react-strict-mode-string-ref", - mixedRef, - getStackByFiberInDevAndProd(returnFiber) - ); - didWarnAboutStringRefInStrictMode[componentName] = true; + if (!didWarnAboutStringRefs[componentName]) { + if (warnAboutStringRefs) { + warningWithoutStack$1( + false, + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + componentName, + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } else { + warningWithoutStack$1( + false, + 'A string ref, "%s", has been found within a strict mode tree. ' + + "String refs are a source of potential bugs and should be avoided. " + + "We recommend using useRef() or createRef() instead." + + "\n%s" + + "\n\nLearn more about using refs safely here:" + + "\nhttps://fb.me/react-strict-mode-string-ref", + mixedRef, + getStackByFiberInDevAndProd(returnFiber) + ); + } + didWarnAboutStringRefs[componentName] = true; } } } @@ -9024,7 +8948,9 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!(ownerFiber.tag === ClassComponent)) { throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); } })(); @@ -9033,9 +8959,11 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!inst) { throw ReactError( - "Missing owner for string ref " + - mixedRef + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + mixedRef + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -9067,16 +8995,20 @@ function coerceRef(returnFiber, current$$1, element) { (function() { if (!(typeof mixedRef === "string")) { throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); } })(); (function() { if (!element._owner) { throw ReactError( - "Element ref was specified as a string (" + - mixedRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } })(); @@ -9097,12 +9029,14 @@ function throwOnInvalidObjectType(returnFiber, newChild) { (function() { { throw ReactError( - "Objects are not valid as a React child (found: " + - (Object.prototype.toString.call(newChild) === "[object Object]" - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + - addendum + Error( + "Objects are not valid as a React child (found: " + + (Object.prototype.toString.call(newChild) === "[object Object]" + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + + addendum + ) ); } })(); @@ -9254,7 +9188,12 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateElement(returnFiber, current$$1, element, expirationTime) { - if (current$$1 !== null && current$$1.elementType === element.type) { + if ( + current$$1 !== null && + (current$$1.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(current$$1, element)) + ) { // Move based on index var existing = useFiber(current$$1, element.props, expirationTime); existing.ref = coerceRef(returnFiber, current$$1, element); @@ -9767,7 +9706,9 @@ function ChildReconciler(shouldTrackSideEffects) { (function() { if (!(typeof iteratorFn === "function")) { throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -9822,7 +9763,7 @@ function ChildReconciler(shouldTrackSideEffects) { var newChildren = iteratorFn.call(newChildrenIterable); (function() { if (!(newChildren != null)) { - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); } })(); @@ -9998,7 +9939,9 @@ function ChildReconciler(shouldTrackSideEffects) { if ( child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE - : child.elementType === element.type + : child.elementType === element.type || + // Keep this check inline so it only runs on the false path: + isCompatibleFamilyForHotReloading(child, element) ) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber( @@ -10198,8 +10141,10 @@ function ChildReconciler(shouldTrackSideEffects) { (function() { { throw ReactError( - (Component.displayName || Component.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (Component.displayName || Component.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) ); } })(); @@ -10220,7 +10165,7 @@ var mountChildFibers = ChildReconciler(false); function cloneChildFibers(current$$1, workInProgress) { (function() { if (!(current$$1 === null || workInProgress.child === current$$1.child)) { - throw ReactError("Resuming work not yet implemented."); + throw ReactError(Error("Resuming work not yet implemented.")); } })(); @@ -10249,6 +10194,15 @@ function cloneChildFibers(current$$1, workInProgress) { newChild.sibling = null; } +// Reset a workInProgress child set to prepare it for a second pass. +function resetChildFibers(workInProgress, renderExpirationTime) { + var child = workInProgress.child; + while (child !== null) { + resetWorkInProgress(child, renderExpirationTime); + child = child.sibling; + } +} + var NO_CONTEXT = {}; var contextStackCursor$1 = createCursor(NO_CONTEXT); @@ -10259,7 +10213,9 @@ function requiredContext(c) { (function() { if (!(c !== NO_CONTEXT)) { throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -10318,46 +10274,158 @@ function pushHostContext(fiber) { push(contextStackCursor$1, nextContext, fiber); } -function pushHostContextForEventComponent(fiber) { - var context = requiredContext(contextStackCursor$1.current); - var nextContext = getChildHostContextForEventComponent(context); - - // Don't push this Fiber's context unless it's unique. - if (context === nextContext) { +function popHostContext(fiber) { + // Do not pop unless this Fiber provided the current context. + // pushHostContext() only pushes Fibers that provide unique contexts. + if (contextFiberStackCursor.current !== fiber) { return; } - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); } -function pushHostContextForEventTarget(fiber) { - var context = requiredContext(contextStackCursor$1.current); - var eventTargetType = fiber.type.type; - var nextContext = getChildHostContextForEventTarget(context, eventTargetType); +var DefaultSuspenseContext = 0; - // Don't push this Fiber's context unless it's unique. - if (context === nextContext) { - return; +// The Suspense Context is split into two parts. The lower bits is +// inherited deeply down the subtree. The upper bits only affect +// this immediate suspense boundary and gets reset each new +// boundary or suspense list. +var SubtreeSuspenseContextMask = 1; + +// Subtree Flags: + +// InvisibleParentSuspenseContext indicates that one of our parent Suspense +// boundaries is not currently showing visible main content. +// Either because it is already showing a fallback or is not mounted at all. +// We can use this to determine if it is desirable to trigger a fallback at +// the parent. If not, then we might need to trigger undesirable boundaries +// and/or suspend the commit to avoid hiding the parent content. +var InvisibleParentSuspenseContext = 1; + +// Shallow Flags: + +// ForceSuspenseFallback can be used by SuspenseList to force newly added +// items into their fallback state during one of the render passes. +var ForceSuspenseFallback = 2; + +var suspenseStackCursor = createCursor(DefaultSuspenseContext); + +function hasSuspenseContext(parentContext, flag) { + return (parentContext & flag) !== 0; +} + +function setDefaultShallowSuspenseContext(parentContext) { + return parentContext & SubtreeSuspenseContextMask; +} + +function setShallowSuspenseContext(parentContext, shallowContext) { + return (parentContext & SubtreeSuspenseContextMask) | shallowContext; +} + +function addSubtreeSuspenseContext(parentContext, subtreeContext) { + return parentContext | subtreeContext; +} + +function pushSuspenseContext(fiber, newContext) { + push(suspenseStackCursor, newContext, fiber); +} + +function popSuspenseContext(fiber) { + pop(suspenseStackCursor, fiber); +} + +// TODO: This is now an empty object. Should we switch this to a boolean? +// Alternatively we can make this use an effect tag similar to SuspenseList. + +function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { + // If it was the primary children that just suspended, capture and render the + var nextState = workInProgress.memoizedState; + if (nextState !== null) { + return false; + } + var props = workInProgress.memoizedProps; + // In order to capture, the Suspense component must have a fallback prop. + if (props.fallback === undefined) { + return false; + } + // Regular boundaries always capture. + if (props.unstable_avoidThisFallback !== true) { + return true; } + // If it's a boundary we should avoid, then we prefer to bubble up to the + // parent boundary if it is currently invisible. + if (hasInvisibleParent) { + return false; + } + // If the parent is not able to handle it, we must handle it. + return true; +} - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); +function findFirstSuspended(row) { + var node = row; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + return node; + } + } else if ( + node.tag === SuspenseListComponent && + // revealOrder undefined can't be trusted because it don't + // keep track of whether it suspended or not. + node.memoizedProps.revealOrder !== undefined + ) { + var didSuspend = (node.effectTag & DidCapture) !== NoEffect; + if (didSuspend) { + return node; + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) { + return null; + } + while (node.sibling === null) { + if (node.return === null || node.return === row) { + return null; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; } -function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; +function createResponderListener(responder, props) { + var eventResponderListener = { + responder: responder, + props: props + }; + { + Object.freeze(eventResponderListener); } + return eventResponderListener; +} - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); +function createResponderInstance( + responder, + responderProps, + responderState, + target, + fiber +) { + return { + fiber: fiber, + props: responderProps, + responder: responder, + rootEventTypes: null, + state: responderState, + target: target + }; } var NoEffect$1 = /* */ 0; @@ -10421,6 +10489,11 @@ var currentHookNameInDev = null; var hookTypesDev = null; var hookTypesUpdateIndexDev = -1; +// In DEV, this tracks whether currently rendering component needs to ignore +// the dependencies for Hooks that need them (e.g. useEffect or useMemo). +// When true, such Hooks will always be "remounted". Only used during hot reload. +var ignorePreviousDependencies = false; + function mountHookTypesDev() { { var hookName = currentHookNameInDev; @@ -10512,13 +10585,22 @@ function throwInvalidHookError() { (function() { { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } })(); } function areHookInputsEqual(nextDeps, prevDeps) { + { + if (ignorePreviousDependencies) { + // Only true when this component is being hot reloaded. + return false; + } + } + if (prevDeps === null) { { warning$1( @@ -10572,6 +10654,9 @@ function renderWithHooks( { hookTypesDev = current !== null ? current._debugHookTypes : null; hookTypesUpdateIndexDev = -1; + // Used for hot reloading: + ignorePreviousDependencies = + current !== null && current.type !== workInProgress.type; } // The following should have already been reset @@ -10614,6 +10699,11 @@ function renderWithHooks( do { didScheduleRenderPhaseUpdate = false; numberOfReRenders += 1; + { + // Even when hot reloading, allow dependencies to stabilize + // after first render to prevent infinite render phase updates. + ignorePreviousDependencies = false; + } // Start over from the beginning of the list nextCurrentHook = current !== null ? current.memoizedState : null; @@ -10683,7 +10773,9 @@ function renderWithHooks( (function() { if (!!didRenderTooFewHooks) { throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); } })(); @@ -10771,7 +10863,7 @@ function updateWorkInProgressHook() { (function() { if (!(nextCurrentHook !== null)) { throw ReactError( - "Rendered more hooks than during the previous render." + Error("Rendered more hooks than during the previous render.") ); } })(); @@ -10839,7 +10931,9 @@ function updateReducer(reducer, initialArg, init) { (function() { if (!(queue !== null)) { throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); } })(); @@ -10872,7 +10966,7 @@ function updateReducer(reducer, initialArg, init) { } hook.memoizedState = newState; - // Don't persist the state accumlated from the render phase updates to + // Don't persist the state accumulated from the render phase updates to // the base state unless the queue is empty. // TODO: Not sure if this is the desired semantics, but it's what we // do for gDSFP. I can't remember why. @@ -10938,7 +11032,10 @@ function updateReducer(reducer, initialArg, init) { // TODO: We should skip this update if it was already committed but currently // we have no way of detecting the difference between a committed and suspended // update here. - markRenderEventTime(updateExpirationTime); + markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ); // Process this update. if (_update.eagerReducer === reducer) { @@ -11071,6 +11168,12 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { } function mountEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } return mountEffectImpl( Update | Passive, UnmountPassive | MountPassive, @@ -11080,6 +11183,12 @@ function mountEffect(create, deps) { } function updateEffect(create, deps) { + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + } + } return updateEffectImpl( Update | Passive, UnmountPassive | MountPassive, @@ -11233,7 +11342,9 @@ function dispatchAction(fiber, queue, action) { (function() { if (!(numberOfReRenders < RE_RENDER_LIMIT)) { throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); } })(); @@ -11260,11 +11371,15 @@ function dispatchAction(fiber, queue, action) { didScheduleRenderPhaseUpdate = true; var update = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, next: null }; + { + update.priority = getCurrentPriorityLevel(); + } if (renderPhaseUpdates === null) { renderPhaseUpdates = new Map(); } @@ -11280,19 +11395,31 @@ function dispatchAction(fiber, queue, action) { lastRenderPhaseUpdate.next = update; } } else { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } var currentTime = requestCurrentTime(); - var _expirationTime = computeExpirationForFiber(currentTime, fiber); + var _suspenseConfig = requestCurrentSuspenseConfig(); + var _expirationTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); var _update2 = { expirationTime: _expirationTime, + suspenseConfig: _suspenseConfig, action: action, eagerReducer: null, eagerState: null, next: null }; + { + _update2.priority = getCurrentPriorityLevel(); + } + // Append the update to the end of the list. var _last = queue.last; if (_last === null) { @@ -11348,10 +11475,9 @@ function dispatchAction(fiber, queue, action) { } } { - // jest isn't a 'global', it's just exposed to tests via a wrapped function - // further, this isn't a test file, so flow doesn't recognize the symbol. So... - // $FlowExpectedError - because requirements don't give a damn about your type sigs. + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests if ("undefined" !== typeof jest) { + warnIfNotScopedWithMatchingAct(fiber); warnIfNotCurrentlyActingUpdatesInDev(fiber); } } @@ -11371,7 +11497,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }; var HooksDispatcherOnMountInDEV = null; @@ -11477,6 +11604,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; mountHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + mountHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11551,6 +11683,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11625,6 +11762,11 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; currentHookNameInDev = "useDebugValue"; updateHookTypesDev(); return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + updateHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11710,6 +11852,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; warnInvalidHookAccess(); mountHookTypesDev(); return mountDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return createResponderListener(responder, props); } }; @@ -11795,6 +11943,12 @@ var InvalidNestedHooksDispatcherOnUpdateInDEV = null; warnInvalidHookAccess(); updateHookTypesDev(); return updateDebugValue(value, formatterFn); + }, + useResponder: function(responder, props) { + currentHookNameInDev = "useResponder"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return createResponderListener(responder, props); } }; } @@ -11857,6 +12011,17 @@ var hydrationParentFiber = null; var nextHydratableInstance = null; var isHydrating = false; +function warnIfHydrating() { + { + !!isHydrating + ? warning$1( + false, + "We should not be hydrating here. This is a bug in React. Please file a bug." + ) + : void 0; + } +} + function enterHydrationState(fiber) { if (!supportsHydration) { return false; @@ -12064,7 +12229,9 @@ function prepareToHydrateHostInstance( (function() { { throw ReactError( - "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -12094,7 +12261,9 @@ function prepareToHydrateHostTextInstance(fiber) { (function() { { throw ReactError( - "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -12144,7 +12313,9 @@ function skipPastDehydratedSuspenseInstance(fiber) { (function() { { throw ReactError( - "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -12153,7 +12324,9 @@ function skipPastDehydratedSuspenseInstance(fiber) { (function() { if (!suspenseInstance) { throw ReactError( - "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -12241,6 +12414,9 @@ var didWarnAboutGetDerivedStateOnFunctionComponent = void 0; var didWarnAboutFunctionRefs = void 0; var didWarnAboutReassigningProps = void 0; var didWarnAboutMaxDuration = void 0; +var didWarnAboutRevealOrder = void 0; +var didWarnAboutTailOptions = void 0; +var didWarnAboutDefaultPropsOnFunctionComponent = void 0; { didWarnAboutBadClass = {}; @@ -12250,6 +12426,9 @@ var didWarnAboutMaxDuration = void 0; didWarnAboutFunctionRefs = {}; didWarnAboutReassigningProps = false; didWarnAboutMaxDuration = false; + didWarnAboutRevealOrder = {}; + didWarnAboutTailOptions = {}; + didWarnAboutDefaultPropsOnFunctionComponent = {}; } function reconcileChildren( @@ -12418,18 +12597,22 @@ function updateMemoComponent( // SimpleMemoComponent codepath doesn't resolve outer props either. Component.defaultProps === undefined ) { + var resolvedType = type; + { + resolvedType = resolveFunctionForHotReloading(type); + } // If this is a plain function component without default props, // and with only the default shallow comparison, we upgrade it // to a SimpleMemoComponent to allow fast path updates. workInProgress.tag = SimpleMemoComponent; - workInProgress.type = type; + workInProgress.type = resolvedType; { validateFunctionComponentInDev(workInProgress, type); } return updateSimpleMemoComponent( current$$1, workInProgress, - type, + resolvedType, nextProps, updateExpirationTime, renderExpirationTime @@ -12549,7 +12732,9 @@ function updateSimpleMemoComponent( var prevProps = current$$1.memoizedProps; if ( shallowEqual(prevProps, nextProps) && - current$$1.ref === workInProgress.ref + current$$1.ref === workInProgress.ref && + // Prevent bailout if the implementation changed due to hot reload: + workInProgress.type === current$$1.type ) { didReceiveUpdate = false; if (updateExpirationTime < renderExpirationTime) { @@ -12642,8 +12827,11 @@ function updateFunctionComponent( } } - var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); - var context = getMaskedContext(workInProgress, unmaskedContext); + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); + context = getMaskedContext(workInProgress, unmaskedContext); + } var nextChildren = void 0; prepareToReadContext(workInProgress, renderExpirationTime); @@ -12918,7 +13106,9 @@ function updateHostRoot(current$$1, workInProgress, renderExpirationTime) { (function() { if (!(updateQueue !== null)) { throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -13016,10 +13206,13 @@ function updateHostComponent(current$$1, workInProgress, renderExpirationTime) { // Check the host config to see if the children are offscreen/hidden. if ( - renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps) ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } // Schedule this fiber to re-render at offscreen priority. Then bailout. workInProgress.expirationTime = workInProgress.childExpirationTime = Never; return null; @@ -13076,6 +13269,9 @@ function mountLazyComponent( case FunctionComponent: { { validateFunctionComponentInDev(workInProgress, Component); + workInProgress.type = Component = resolveFunctionForHotReloading( + Component + ); } child = updateFunctionComponent( null, @@ -13087,6 +13283,11 @@ function mountLazyComponent( break; } case ClassComponent: { + { + workInProgress.type = Component = resolveClassForHotReloading( + Component + ); + } child = updateClassComponent( null, workInProgress, @@ -13097,6 +13298,11 @@ function mountLazyComponent( break; } case ForwardRef: { + { + workInProgress.type = Component = resolveForwardRefForHotReloading( + Component + ); + } child = updateForwardRef( null, workInProgress, @@ -13148,10 +13354,12 @@ function mountLazyComponent( (function() { { throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." + - hint + Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." + + hint + ) ); } })(); @@ -13236,11 +13444,13 @@ function mountIndeterminateComponent( } var props = workInProgress.pendingProps; - var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); - var context = getMaskedContext(workInProgress, unmaskedContext); + var context = void 0; + if (!disableLegacyContext) { + var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); + context = getMaskedContext(workInProgress, unmaskedContext); + } prepareToReadContext(workInProgress, renderExpirationTime); - var value = void 0; { @@ -13347,6 +13557,15 @@ function mountIndeterminateComponent( // Proceed under the assumption that this is a function component workInProgress.tag = FunctionComponent; { + if (disableLegacyContext && Component.contextTypes) { + warningWithoutStack$1( + false, + "%s uses the legacy contextTypes API which is no longer supported. " + + "Use React.createContext() with React.useContext() instead.", + getComponentName(Component) || "Unknown" + ); + } + if ( debugRenderPhaseSideEffects || (debugRenderPhaseSideEffectsForStrictMode && @@ -13407,16 +13626,33 @@ function validateFunctionComponentInDev(workInProgress, Component) { } } - if (typeof Component.getDerivedStateFromProps === "function") { + if ( + warnAboutDefaultPropsOnFunctionComponents && + Component.defaultProps !== undefined + ) { var componentName = getComponentName(Component) || "Unknown"; - if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { warningWithoutStack$1( false, - "%s: Function components do not support getDerivedStateFromProps.", + "%s: Support for defaultProps will be removed from function components " + + "in a future major release. Use JavaScript default parameters instead.", componentName ); - didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; + } + } + + if (typeof Component.getDerivedStateFromProps === "function") { + var _componentName2 = getComponentName(Component) || "Unknown"; + + if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) { + warningWithoutStack$1( + false, + "%s: Function components do not support getDerivedStateFromProps.", + _componentName2 + ); + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true; } } @@ -13424,19 +13660,31 @@ function validateFunctionComponentInDev(workInProgress, Component) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName2 = getComponentName(Component) || "Unknown"; + var _componentName3 = getComponentName(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { warningWithoutStack$1( false, "%s: Function components do not support contextType.", - _componentName2 + _componentName3 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; } } } +// TODO: This is now an empty object. Should we just make it a boolean? +var SUSPENDED_MARKER = {}; + +function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) { + // If the context is telling us that we should show a fallback, and we're not + // already showing content, then we should show the fallback instead. + return ( + hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && + (current$$1 === null || current$$1.memoizedState !== null) + ); +} + function updateSuspenseComponent( current$$1, workInProgress, @@ -13445,32 +13693,51 @@ function updateSuspenseComponent( var mode = workInProgress.mode; var nextProps = workInProgress.pendingProps; + // This is used by DevTools to force a boundary to suspend. { if (shouldSuspend(workInProgress)) { workInProgress.effectTag |= DidCapture; } } - // We should attempt to render the primary children unless this boundary - // already suspended during this render (`alreadyCaptured` is true). - var nextState = workInProgress.memoizedState; + var suspenseContext = suspenseStackCursor.current; - var nextDidTimeout = void 0; - if ((workInProgress.effectTag & DidCapture) === NoEffect) { - // This is the first attempt. - nextState = null; - nextDidTimeout = false; - } else { + var nextState = null; + var nextDidTimeout = false; + + if ( + (workInProgress.effectTag & DidCapture) !== NoEffect || + shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) + ) { // Something in this boundary's subtree already suspended. Switch to // rendering the fallback children. - nextState = { - fallbackExpirationTime: - nextState !== null ? nextState.fallbackExpirationTime : NoWork - }; + nextState = SUSPENDED_MARKER; nextDidTimeout = true; workInProgress.effectTag &= ~DidCapture; + } else { + // Attempting the main content + if (current$$1 === null || current$$1.memoizedState !== null) { + // This is a new mount or this boundary is already showing a fallback state. + // Mark this subtree context as having at least one invisible parent that could + // handle the fallback state. + // Boundaries without fallbacks or should be avoided are not considered since + // they cannot handle preferred fallback states. + if ( + nextProps.fallback !== undefined && + nextProps.unstable_avoidThisFallback !== true + ) { + suspenseContext = addSubtreeSuspenseContext( + suspenseContext, + InvisibleParentSuspenseContext + ); + } + } } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + + pushSuspenseContext(workInProgress, suspenseContext); + { if ("maxDuration" in nextProps) { if (!didWarnAboutMaxDuration) { @@ -13523,6 +13790,7 @@ function updateSuspenseComponent( tryToClaimNextHydratableInstance(workInProgress); // This could've changed the tag if this was a dehydrated suspense component. if (workInProgress.tag === DehydratedSuspenseComponent) { + popSuspenseContext(workInProgress); return updateDehydratedSuspenseComponent( null, workInProgress, @@ -13543,15 +13811,21 @@ function updateSuspenseComponent( NoWork, null ); + primaryChildFragment.return = workInProgress; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var progressedState = workInProgress.memoizedState; var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child; primaryChildFragment.child = progressedPrimaryChild; + var progressedChild = progressedPrimaryChild; + while (progressedChild !== null) { + progressedChild.return = primaryChildFragment; + progressedChild = progressedChild.sibling; + } } var fallbackChildFragment = createFiberFromFragment( @@ -13560,12 +13834,12 @@ function updateSuspenseComponent( renderExpirationTime, null ); + fallbackChildFragment.return = workInProgress; primaryChildFragment.sibling = fallbackChildFragment; child = primaryChildFragment; // Skip the primary children, and continue working on the // fallback children. next = fallbackChildFragment; - child.return = next.return = workInProgress; } else { // Mount the primary children without an intermediate fragment fiber. var nextPrimaryChildren = nextProps.children; @@ -13594,9 +13868,10 @@ function updateSuspenseComponent( currentPrimaryChildFragment.pendingProps, NoWork ); + _primaryChildFragment.return = workInProgress; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var _progressedState = workInProgress.memoizedState; var _progressedPrimaryChild = _progressedState !== null @@ -13604,6 +13879,11 @@ function updateSuspenseComponent( : workInProgress.child; if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) { _primaryChildFragment.child = _progressedPrimaryChild; + var _progressedChild = _progressedPrimaryChild; + while (_progressedChild !== null) { + _progressedChild.return = _primaryChildFragment; + _progressedChild = _progressedChild.sibling; + } } } @@ -13622,17 +13902,18 @@ function updateSuspenseComponent( // Clone the fallback child fragment, too. These we'll continue // working on. - var _fallbackChildFragment = (_primaryChildFragment.sibling = createWorkInProgress( + var _fallbackChildFragment = createWorkInProgress( currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime - )); + ); + _fallbackChildFragment.return = workInProgress; + _primaryChildFragment.sibling = _fallbackChildFragment; child = _primaryChildFragment; _primaryChildFragment.childExpirationTime = NoWork; // Skip the primary children, and continue working on the // fallback children. next = _fallbackChildFragment; - child.return = next.return = workInProgress; } else { // No longer suspended. Switch back to showing the primary children, // and remove the intermediate fragment fiber. @@ -13670,21 +13951,30 @@ function updateSuspenseComponent( NoWork, null ); + _primaryChildFragment2.return = workInProgress; _primaryChildFragment2.child = _currentPrimaryChild; + if (_currentPrimaryChild !== null) { + _currentPrimaryChild.return = _primaryChildFragment2; + } // Even though we're creating a new fiber, there are no new children, // because we're reusing an already mounted tree. So we don't need to // schedule a placement. // primaryChildFragment.effectTag |= Placement; - if ((workInProgress.mode & ConcurrentMode) === NoContext) { - // Outside of concurrent mode, we commit the effects from the + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, we commit the effects from the var _progressedState2 = workInProgress.memoizedState; var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child; _primaryChildFragment2.child = _progressedPrimaryChild2; + var _progressedChild2 = _progressedPrimaryChild2; + while (_progressedChild2 !== null) { + _progressedChild2.return = _primaryChildFragment2; + _progressedChild2 = _progressedChild2.sibling; + } } // Because primaryChildFragment is a new fiber that we're inserting as the @@ -13701,19 +13991,20 @@ function updateSuspenseComponent( } // Create a fragment from the fallback children, too. - var _fallbackChildFragment2 = (_primaryChildFragment2.sibling = createFiberFromFragment( + var _fallbackChildFragment2 = createFiberFromFragment( _nextFallbackChildren2, mode, renderExpirationTime, null - )); + ); + _fallbackChildFragment2.return = workInProgress; + _primaryChildFragment2.sibling = _fallbackChildFragment2; _fallbackChildFragment2.effectTag |= Placement; child = _primaryChildFragment2; _primaryChildFragment2.childExpirationTime = NoWork; // Skip the primary children, and continue working on the // fallback children. next = _fallbackChildFragment2; - child.return = next.return = workInProgress; } else { // Still haven't timed out. Continue rendering the children, like we // normally do. @@ -13748,7 +14039,9 @@ function retrySuspenseComponentWithoutHydrating( (function() { if (!(returnFiber !== null)) { throw ReactError( - "Suspense boundaries are never on the root. This is probably a bug in React." + Error( + "Suspense boundaries are never on the root. This is probably a bug in React." + ) ); } })(); @@ -13762,6 +14055,8 @@ function retrySuspenseComponentWithoutHydrating( current$$1.nextEffect = null; current$$1.effectTag = Deletion; + popSuspenseContext(workInProgress); + // Upgrade this work in progress to a real Suspense component. workInProgress.tag = SuspenseComponent; workInProgress.stateNode = null; @@ -13777,6 +14072,10 @@ function updateDehydratedSuspenseComponent( workInProgress, renderExpirationTime ) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); var suspenseInstance = workInProgress.stateNode; if (current$$1 === null) { // During the first pass, we'll bail out and not drill into the children. @@ -13803,12 +14102,18 @@ function updateDehydratedSuspenseComponent( } return null; } + if ((workInProgress.effectTag & DidCapture) !== NoEffect) { // Something suspended. Leave the existing children in place. // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far? workInProgress.child = null; return null; } + + // We should never be hydrating at this point because it is the first pass, + // but after we've already committed once. + warnIfHydrating(); + if (isSuspenseInstanceFallback(suspenseInstance)) { // This boundary is in a permanent fallback state. In this case, we'll never // get an update and we'll never be able to hydrate the final content. Let's just try the @@ -13869,41 +14174,417 @@ function updateDehydratedSuspenseComponent( } } -function updatePortalComponent( - current$$1, +function propagateSuspenseContextChange( workInProgress, + firstChild, renderExpirationTime ) { - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - var nextChildren = workInProgress.pendingProps; - if (current$$1 === null) { - // Portals are special because we don't append the children during mount - // but at commit. Therefore we need to track insertions which the normal - // flow doesn't do during mount. This doesn't happen at the root because - // the root always starts with a "current" with a null child. - // TODO: Consider unifying this with how the root works. - workInProgress.child = reconcileChildFibers( - workInProgress, - null, - nextChildren, - renderExpirationTime - ); - } else { - reconcileChildren( - current$$1, - workInProgress, - nextChildren, - renderExpirationTime - ); + // Mark any Suspense boundaries with fallbacks as having work to do. + // If they were previously forced into fallbacks, they may now be able + // to unblock. + var node = firstChild; + while (node !== null) { + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + if (node.expirationTime < renderExpirationTime) { + node.expirationTime = renderExpirationTime; + } + var alternate = node.alternate; + if ( + alternate !== null && + alternate.expirationTime < renderExpirationTime + ) { + alternate.expirationTime = renderExpirationTime; + } + scheduleWorkOnParentPath(node.return, renderExpirationTime); + } + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) { + return; + } + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { + return; + } + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; } - return workInProgress.child; } -function updateContextProvider( - current$$1, - workInProgress, - renderExpirationTime -) { +function findLastContentRow(firstChild) { + // This is going to find the last row among these children that is already + // showing content on the screen, as opposed to being in fallback state or + // new. If a row has multiple Suspense boundaries, any of them being in the + // fallback state, counts as the whole row being in a fallback state. + // Note that the "rows" will be workInProgress, but any nested children + // will still be current since we haven't rendered them yet. The mounted + // order may not be the same as the new order. We use the new order. + var row = firstChild; + var lastContentRow = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + lastContentRow = row; + } + row = row.sibling; + } + return lastContentRow; +} + +function validateRevealOrder(revealOrder) { + { + if ( + revealOrder !== undefined && + revealOrder !== "forwards" && + revealOrder !== "backwards" && + revealOrder !== "together" && + !didWarnAboutRevealOrder[revealOrder] + ) { + didWarnAboutRevealOrder[revealOrder] = true; + if (typeof revealOrder === "string") { + switch (revealOrder.toLowerCase()) { + case "together": + case "forwards": + case "backwards": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'Use lowercase "%s" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + case "forward": + case "backward": { + warning$1( + false, + '"%s" is not a valid value for revealOrder on . ' + + 'React uses the -s suffix in the spelling. Use "%ss" instead.', + revealOrder, + revealOrder.toLowerCase() + ); + break; + } + default: + warning$1( + false, + '"%s" is not a supported revealOrder on . ' + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + break; + } + } else { + warning$1( + false, + "%s is not a supported value for revealOrder on . " + + 'Did you mean "together", "forwards" or "backwards"?', + revealOrder + ); + } + } + } +} + +function validateTailOptions(tailMode, revealOrder) { + { + if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { + if (tailMode !== "collapsed" && tailMode !== "hidden") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + '"%s" is not a supported value for tail on . ' + + 'Did you mean "collapsed" or "hidden"?', + tailMode + ); + } else if (revealOrder !== "forwards" && revealOrder !== "backwards") { + didWarnAboutTailOptions[tailMode] = true; + warning$1( + false, + ' is only valid if revealOrder is ' + + '"forwards" or "backwards". ' + + 'Did you mean to specify revealOrder="forwards"?', + tailMode + ); + } + } + } +} + +function validateSuspenseListNestedChild(childSlot, index) { + { + var isArray = Array.isArray(childSlot); + var isIterable = !isArray && typeof getIteratorFn(childSlot) === "function"; + if (isArray || isIterable) { + var type = isArray ? "array" : "iterable"; + warning$1( + false, + "A nested %s was passed to row #%s in . Wrap it in " + + "an additional SuspenseList to configure its revealOrder: " + + " ... " + + "{%s} ... " + + "", + type, + index, + type + ); + return false; + } + } + return true; +} + +function validateSuspenseListChildren(children, revealOrder) { + { + if ( + (revealOrder === "forwards" || revealOrder === "backwards") && + children !== undefined && + children !== null && + children !== false + ) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + if (!validateSuspenseListNestedChild(children[i], i)) { + return; + } + } + } else { + var iteratorFn = getIteratorFn(children); + if (typeof iteratorFn === "function") { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) { + var step = childrenIterator.next(); + var _i = 0; + for (; !step.done; step = childrenIterator.next()) { + if (!validateSuspenseListNestedChild(step.value, _i)) { + return; + } + _i++; + } + } + } else { + warning$1( + false, + 'A single row was passed to a . ' + + "This is not useful since it needs multiple rows. " + + "Did you mean to pass multiple children or an array?", + revealOrder + ); + } + } + } + } +} + +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + if (renderState === null) { + workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }; + } else { + // We can reuse the existing object from previous renders. + renderState.isBackwards = isBackwards; + renderState.rendering = null; + renderState.last = lastContentRow; + renderState.tail = tail; + renderState.tailExpiration = 0; + renderState.tailMode = tailMode; + } +} + +// This can end up rendering this component multiple passes. +// The first pass splits the children fibers into two sets. A head and tail. +// We first render the head. If anything is in fallback state, we do another +// pass through beginWork to rerender all children (including the tail) with +// the force suspend context. If the first render didn't have anything in +// in fallback state. Then we render each row in the tail one-by-one. +// That happens in the completeWork phase without going back to beginWork. +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps; + var revealOrder = nextProps.revealOrder; + var tailMode = nextProps.tail; + var newChildren = nextProps.children; + + validateRevealOrder(revealOrder); + validateTailOptions(tailMode, revealOrder); + validateSuspenseListChildren(newChildren, revealOrder); + + reconcileChildren( + current$$1, + workInProgress, + newChildren, + renderExpirationTime + ); + + var suspenseContext = suspenseStackCursor.current; + + var shouldForceFallback = hasSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + if (shouldForceFallback) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + workInProgress.effectTag |= DidCapture; + } else { + var didSuspendBefore = + current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect; + if (didSuspendBefore) { + // If we previously forced a fallback, we need to schedule work + // on any nested boundaries to let them know to try to render + // again. This is the same as context updating. + propagateSuspenseContextChange( + workInProgress, + workInProgress.child, + renderExpirationTime + ); + } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + + if ((workInProgress.mode & BatchedMode) === NoMode) { + // Outside of batched mode, SuspenseList doesn't work so we just + // use make it a noop by treating it as the default revealOrder. + workInProgress.memoizedState = null; + } else { + switch (revealOrder) { + case "forwards": { + var lastContentRow = findLastContentRow(workInProgress.child); + var tail = void 0; + if (lastContentRow === null) { + // The whole list is part of the tail. + // TODO: We could fast path by just rendering the tail now. + tail = workInProgress.child; + workInProgress.child = null; + } else { + // Disconnect the tail rows after the content row. + // We're going to render them separately later. + tail = lastContentRow.sibling; + lastContentRow.sibling = null; + } + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + tail, + lastContentRow, + tailMode + ); + break; + } + case "backwards": { + // We're going to find the first row that has existing content. + // At the same time we're going to reverse the list of everything + // we pass in the meantime. That's going to be our tail in reverse + // order. + var _tail = null; + var row = workInProgress.child; + workInProgress.child = null; + while (row !== null) { + var currentRow = row.alternate; + // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + // This is the beginning of the main content. + workInProgress.child = row; + break; + } + var nextRow = row.sibling; + row.sibling = _tail; + _tail = row; + row = nextRow; + } + // TODO: If workInProgress.child is null, we can continue on the tail immediately. + initSuspenseListRenderState( + workInProgress, + true, // isBackwards + _tail, + null, // last + tailMode + ); + break; + } + case "together": { + initSuspenseListRenderState( + workInProgress, + false, // isBackwards + null, // tail + null, // last + undefined + ); + break; + } + default: { + // The default reveal order is the same as not having + // a boundary. + workInProgress.memoizedState = null; + } + } + } + return workInProgress.child; +} + +function updatePortalComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + var nextChildren = workInProgress.pendingProps; + if (current$$1 === null) { + // Portals are special because we don't append the children during mount + // but at commit. Therefore we need to track insertions which the normal + // flow doesn't do during mount. This doesn't happen at the root because + // the root always starts with a "current" with a null child. + // TODO: Consider unifying this with how the root works. + workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ); + } else { + reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + } + return workInProgress.child; +} + +function updateContextProvider( + current$$1, + workInProgress, + renderExpirationTime +) { var providerType = workInProgress.type; var context = providerType._context; @@ -14032,11 +14713,15 @@ function updateContextConsumer( return workInProgress.child; } -function updateEventComponent$1( +function updateFundamentalComponent$1( current$$1, workInProgress, renderExpirationTime ) { + var fundamentalImpl = workInProgress.type.impl; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } var nextProps = workInProgress.pendingProps; var nextChildren = nextProps.children; @@ -14046,38 +14731,6 @@ function updateEventComponent$1( nextChildren, renderExpirationTime ); - pushHostContextForEventComponent(workInProgress); - return workInProgress.child; -} - -function updateEventTarget(current$$1, workInProgress, renderExpirationTime) { - var type = workInProgress.type.type; - var nextProps = workInProgress.pendingProps; - var eventTargetChild = getEventTargetChildElement(type, nextProps); - - { - !(nextProps.children == null) - ? warning$1(false, "Event targets should not have children.") - : void 0; - } - if (eventTargetChild !== null) { - var child = (workInProgress.child = createFiberFromTypeAndProps( - eventTargetChild.type, - null, - eventTargetChild.props, - null, - workInProgress.mode, - renderExpirationTime - )); - child.return = workInProgress; - - if (current$$1 === null || current$$1.child === null) { - child.effectTag = Placement; - } - } else { - reconcileChildren(current$$1, workInProgress, null, renderExpirationTime); - } - pushHostContextForEventTarget(workInProgress); return workInProgress.child; } @@ -14093,8 +14746,8 @@ function bailoutOnAlreadyFinishedWork( cancelWorkTimer(workInProgress); if (current$$1 !== null) { - // Reuse previous context list - workInProgress.contextDependencies = current$$1.contextDependencies; + // Reuse previous dependencies + workInProgress.dependencies = current$$1.dependencies; } if (enableProfilerTimer) { @@ -14117,14 +14770,91 @@ function bailoutOnAlreadyFinishedWork( } } +function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) { + { + var returnFiber = oldWorkInProgress.return; + if (returnFiber === null) { + throw new Error("Cannot swap the root fiber."); + } + + // Disconnect from the old current. + // It will get deleted. + current$$1.alternate = null; + oldWorkInProgress.alternate = null; + + // Connect to the new tree. + newWorkInProgress.index = oldWorkInProgress.index; + newWorkInProgress.sibling = oldWorkInProgress.sibling; + newWorkInProgress.return = oldWorkInProgress.return; + newWorkInProgress.ref = oldWorkInProgress.ref; + + // Replace the child/sibling pointers above it. + if (oldWorkInProgress === returnFiber.child) { + returnFiber.child = newWorkInProgress; + } else { + var prevSibling = returnFiber.child; + if (prevSibling === null) { + throw new Error("Expected parent to have a child."); + } + while (prevSibling.sibling !== oldWorkInProgress) { + prevSibling = prevSibling.sibling; + if (prevSibling === null) { + throw new Error("Expected to find the previous sibling."); + } + } + prevSibling.sibling = newWorkInProgress; + } + + // Delete the old fiber and place the new one. + // Since the old fiber is disconnected, we have to schedule it manually. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current$$1; + returnFiber.lastEffect = current$$1; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = current$$1; + } + current$$1.nextEffect = null; + current$$1.effectTag = Deletion; + + newWorkInProgress.effectTag |= Placement; + + // Restart work from the new fiber. + return newWorkInProgress; + } +} + function beginWork$1(current$$1, workInProgress, renderExpirationTime) { var updateExpirationTime = workInProgress.expirationTime; + { + if (workInProgress._debugNeedsRemount && current$$1 !== null) { + // This will restart the begin phase with a new fiber. + return remountFiber( + current$$1, + workInProgress, + createFiberFromTypeAndProps( + workInProgress.type, + workInProgress.key, + workInProgress.pendingProps, + workInProgress._debugOwner || null, + workInProgress.mode, + workInProgress.expirationTime + ) + ); + } + } + if (current$$1 !== null) { var oldProps = current$$1.memoizedProps; var newProps = workInProgress.pendingProps; - if (oldProps !== newProps || hasContextChanged()) { + if ( + oldProps !== newProps || + hasContextChanged() || + // Force a re-render if the implementation changed due to hot reload: + workInProgress.type !== current$$1.type + ) { // If props or context changed, mark the fiber as having performed work. // This may be unset if the props are determined to be equal later (memo). didReceiveUpdate = true; @@ -14140,6 +14870,18 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { break; case HostComponent: pushHostContext(workInProgress); + if ( + workInProgress.mode & ConcurrentMode && + renderExpirationTime !== Never && + shouldDeprioritizeSubtree(workInProgress.type, newProps) + ) { + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } + // Schedule this fiber to re-render at offscreen priority. Then bailout. + workInProgress.expirationTime = workInProgress.childExpirationTime = Never; + return null; + } break; case ClassComponent: { var Component = workInProgress.type; @@ -14186,6 +14928,10 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); // The primary children do not have pending work with sufficient // priority. Bailout. var child = bailoutOnAlreadyFinishedWork( @@ -14201,11 +14947,20 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { return null; } } + } else { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); } break; } case DehydratedSuspenseComponent: { if (enableSuspenseServerRenderer) { + pushSuspenseContext( + workInProgress, + setDefaultShallowSuspenseContext(suspenseStackCursor.current) + ); // We know that this component will suspend again because if it has // been unsuspended it has committed as a regular Suspense component. // If it needs to be retried, it should have work scheduled on it. @@ -14213,16 +14968,52 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { } break; } - case EventComponent: - if (enableEventAPI) { - pushHostContextForEventComponent(workInProgress); + case SuspenseListComponent: { + var didSuspendBefore = + (current$$1.effectTag & DidCapture) !== NoEffect; + + var hasChildWork = + workInProgress.childExpirationTime >= renderExpirationTime; + + if (didSuspendBefore) { + if (hasChildWork) { + // If something was in fallback state last time, and we have all the + // same children then we're still in progressive loading state. + // Something might get unblocked by state updates or retries in the + // tree which will affect the tail. So we need to use the normal + // path to compute the correct tail. + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + workInProgress.effectTag |= DidCapture; } - break; - case EventTarget: { - if (enableEventAPI) { - pushHostContextForEventTarget(workInProgress); + + // If nothing suspended before and we're rendering the same children, + // then the tail doesn't matter. Anything new that suspends will work + // in the "together" mode, so we can continue from the state we had. + var renderState = workInProgress.memoizedState; + if (renderState !== null) { + // Reset to the "together" mode in case we've started a different + // update in the past but didn't complete it. + renderState.rendering = null; + renderState.tail = null; + } + pushSuspenseContext(workInProgress, suspenseStackCursor.current); + + if (hasChildWork) { + break; + } else { + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + return null; } - break; } } return bailoutOnAlreadyFinishedWork( @@ -14240,20 +15031,19 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { switch (workInProgress.tag) { case IndeterminateComponent: { - var elementType = workInProgress.elementType; return mountIndeterminateComponent( current$$1, workInProgress, - elementType, + workInProgress.type, renderExpirationTime ); } case LazyComponent: { - var _elementType = workInProgress.elementType; + var elementType = workInProgress.elementType; return mountLazyComponent( current$$1, workInProgress, - _elementType, + elementType, updateExpirationTime, renderExpirationTime ); @@ -14407,19 +15197,16 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { } break; } - case EventComponent: { - if (enableEventAPI) { - return updateEventComponent$1( - current$$1, - workInProgress, - renderExpirationTime - ); - } - break; + case SuspenseListComponent: { + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } - case EventTarget: { - if (enableEventAPI) { - return updateEventTarget( + case FundamentalComponent: { + if (enableFundamentalAPI) { + return updateFundamentalComponent$1( current$$1, workInProgress, renderExpirationTime @@ -14431,12 +15218,28 @@ function beginWork$1(current$$1, workInProgress, renderExpirationTime) { (function() { { throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); } +function createFundamentalStateInstance(currentFiber, props, impl, state) { + return { + currentFiber: currentFiber, + impl: impl, + instance: null, + prevProps: null, + props: props, + state: state + }; +} + +var emptyObject$1 = {}; +var isArray$2 = Array.isArray; + function markUpdate(workInProgress) { // Tag the fiber with an update effect. This turns a Placement into // a PlacementAndUpdate. @@ -14466,6 +15269,8 @@ if (supportsMutation) { while (node !== null) { if (node.tag === HostComponent || node.tag === HostText) { appendInitialChild(parent, node.stateNode); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + appendInitialChild(parent, node.stateNode.instance); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14570,6 +15375,15 @@ if (supportsMutation) { _instance = cloneHiddenTextInstance(_instance, text, node); } appendInitialChild(parent, _instance); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance2 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props = node.memoizedProps; + var _type = node.type; + _instance2 = cloneHiddenInstance(_instance2, _type, _props, node); + } + appendInitialChild(parent, _instance2); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14648,13 +15462,22 @@ if (supportsMutation) { } appendChildToContainerChildSet(containerChildSet, instance); } else if (node.tag === HostText) { - var _instance2 = node.stateNode; + var _instance3 = node.stateNode; if (needsVisibilityToggle && isHidden) { // This child is inside a timed out tree. Hide it. var text = node.memoizedProps; - _instance2 = cloneHiddenTextInstance(_instance2, text, node); + _instance3 = cloneHiddenTextInstance(_instance3, text, node); + } + appendChildToContainerChildSet(containerChildSet, _instance3); + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var _instance4 = node.stateNode.instance; + if (needsVisibilityToggle && isHidden) { + // This child is inside a timed out tree. Hide it. + var _props2 = node.memoizedProps; + var _type2 = node.type; + _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node); } - appendChildToContainerChildSet(containerChildSet, _instance2); + appendChildToContainerChildSet(containerChildSet, _instance4); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in @@ -14830,6 +15653,69 @@ if (supportsMutation) { }; } +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var tailNode = renderState.tail; + var lastTailNode = null; + while (tailNode !== null) { + if (tailNode.alternate !== null) { + lastTailNode = tailNode; + } + tailNode = tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (lastTailNode === null) { + // All remaining items in the tail are insertions. + renderState.tail = null; + } else { + // Detach the insertion after the last node that was already + // inserted. + lastTailNode.sibling = null; + } + break; + } + case "collapsed": { + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var _tailNode = renderState.tail; + var _lastTailNode = null; + while (_tailNode !== null) { + if (_tailNode.alternate !== null) { + _lastTailNode = _tailNode; + } + _tailNode = _tailNode.sibling; + } + // Next we're simply going to delete all insertions after the + // last rendered item. + if (_lastTailNode === null) { + // All remaining items in the tail are insertions. + if (!hasRenderedATailFallback && renderState.tail !== null) { + // We suspended during the head. We want to show at least one + // row at the tail. So we'll keep on and cut off the rest. + renderState.tail.sibling = null; + } else { + renderState.tail = null; + } + } else { + // Detach the insertion after the last node that was already + // inserted. + _lastTailNode.sibling = null; + } + break; + } + } +} + function completeWork(current, workInProgress, renderExpirationTime) { var newProps = workInProgress.pendingProps; @@ -14880,6 +15766,20 @@ function completeWork(current, workInProgress, renderExpirationTime) { rootContainerInstance ); + if (enableFlareAPI) { + var prevListeners = current.memoizedProps.listeners; + var nextListeners = newProps.listeners; + var instance = workInProgress.stateNode; + if (prevListeners !== nextListeners) { + updateEventListeners( + nextListeners, + instance, + rootContainerInstance, + workInProgress + ); + } + } + if (current.ref !== workInProgress.ref) { markRef$1(workInProgress); } @@ -14888,7 +15788,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { if (!(workInProgress.stateNode !== null)) { throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -14916,8 +15818,20 @@ function completeWork(current, workInProgress, renderExpirationTime) { // commit-phase we mark this as such. markUpdate(workInProgress); } + if (enableFlareAPI) { + var _instance5 = workInProgress.stateNode; + var listeners = newProps.listeners; + if (listeners != null) { + updateEventListeners( + listeners, + _instance5, + rootContainerInstance, + workInProgress + ); + } + } } else { - var instance = createInstance( + var _instance6 = createInstance( type, newProps, rootContainerInstance, @@ -14925,14 +15839,26 @@ function completeWork(current, workInProgress, renderExpirationTime) { workInProgress ); - appendAllChildren(instance, workInProgress, false, false); + appendAllChildren(_instance6, workInProgress, false, false); + + if (enableFlareAPI) { + var _listeners = newProps.listeners; + if (_listeners != null) { + updateEventListeners( + _listeners, + _instance6, + rootContainerInstance, + workInProgress + ); + } + } // Certain renderers require commit-time effects for initial mount. // (eg DOM renderer supports auto-focus for certain elements). // Make sure such renderers get scheduled for later work. if ( finalizeInitialChildren( - instance, + _instance6, type, newProps, rootContainerInstance, @@ -14941,7 +15867,7 @@ function completeWork(current, workInProgress, renderExpirationTime) { ) { markUpdate(workInProgress); } - workInProgress.stateNode = instance; + workInProgress.stateNode = _instance6; } if (workInProgress.ref !== null) { @@ -14963,7 +15889,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { if (!(workInProgress.stateNode !== null)) { throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -14990,6 +15918,7 @@ function completeWork(current, workInProgress, renderExpirationTime) { case ForwardRef: break; case SuspenseComponent: { + popSuspenseContext(workInProgress); var nextState = workInProgress.memoizedState; if ((workInProgress.effectTag & DidCapture) !== NoEffect) { // Something suspended. Re-render with the fallback children. @@ -15010,15 +15939,8 @@ function completeWork(current, workInProgress, renderExpirationTime) { prevDidTimeout = prevState !== null; if (!nextDidTimeout && prevState !== null) { // We just switched from the fallback to the normal children. - - // Mark the event time of the switching from fallback to normal children, - // based on the start of when we first showed the fallback. This time - var fallbackExpirationTime = prevState.fallbackExpirationTime; - markRenderEventTime(fallbackExpirationTime); - // Delete the fallback. // TODO: Would it be better to store the fallback fragment on - // the stateNode during the begin phase? var currentFallbackChild = current.child.sibling; if (currentFallbackChild !== null) { // Deletions go at the beginning of the return fiber's effect list @@ -15036,13 +15958,37 @@ function completeWork(current, workInProgress, renderExpirationTime) { } if (nextDidTimeout && !prevDidTimeout) { - // If this subtreee is running in concurrent mode we can suspend, + // If this subtreee is running in batched mode we can suspend, // otherwise we won't suspend. // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. - if ((workInProgress.mode & ConcurrentMode) !== NoContext) { - renderDidSuspend(); + if ((workInProgress.mode & BatchedMode) !== NoMode) { + // TODO: Move this back to throwException because this is too late + // if this is a large tree which is common for initial loads. We + // don't know if we should restart a render or not until we get + // this marker, and this is too late. + // If this render already had a ping or lower pri updates, + // and this is the first time we know we're going to suspend we + // should be able to immediately restart from within throwException. + var hasInvisibleChildContext = + current === null && + workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + if ( + hasInvisibleChildContext || + hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ) + ) { + // If this was in an invisible tree or a new render, then showing + // this boundary is ok. + renderDidSuspend(); + } else { + // Otherwise, we're going to have to hide content so we should + // suspend for longer if possible. + renderDidSuspendDelayIfPossible(); + } } } @@ -15066,6 +16012,14 @@ function completeWork(current, workInProgress, renderExpirationTime) { workInProgress.effectTag |= Update; } } + if ( + enableSuspenseCallback && + workInProgress.updateQueue !== null && + workInProgress.memoizedProps.suspenseCallback != null + ) { + // Always notify the callback + workInProgress.effectTag |= Update; + } break; } case Fragment: @@ -15097,78 +16051,275 @@ function completeWork(current, workInProgress, renderExpirationTime) { } case DehydratedSuspenseComponent: { if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); if (current === null) { var _wasHydrated2 = popHydrationState(workInProgress); (function() { if (!_wasHydrated2) { throw ReactError( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ) ); } })(); + if (enableSchedulerTracing) { + markSpawnedWork(Never); + } skipPastDehydratedSuspenseInstance(workInProgress); - } else if ((workInProgress.effectTag & DidCapture) === NoEffect) { - // This boundary did not suspend so it's now hydrated. - // To handle any future suspense cases, we're going to now upgrade it - // to a Suspense component. We detach it from the existing current fiber. - current.alternate = null; - workInProgress.alternate = null; - workInProgress.tag = SuspenseComponent; - workInProgress.memoizedState = null; - workInProgress.stateNode = null; + } else { + // We should never have been in a hydration state if we didn't have a current. + // However, in some of those paths, we might have reentered a hydration state + // and then we might be inside a hydration state. In that case, we'll need to + // exit out of it. + resetHydrationState(); + if ((workInProgress.effectTag & DidCapture) === NoEffect) { + // This boundary did not suspend so it's now hydrated. + // To handle any future suspense cases, we're going to now upgrade it + // to a Suspense component. We detach it from the existing current fiber. + current.alternate = null; + workInProgress.alternate = null; + workInProgress.tag = SuspenseComponent; + workInProgress.memoizedState = null; + workInProgress.stateNode = null; + } } } break; } - case EventComponent: { - if (enableEventAPI) { - popHostContext(workInProgress); - var _rootContainerInstance2 = getRootHostContainer(); - var responder = workInProgress.type.responder; - var eventComponentInstance = workInProgress.stateNode; - - if (eventComponentInstance === null) { - var responderState = null; - if (responder.createInitialState !== undefined) { - responderState = responder.createInitialState(newProps); + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + + var renderState = workInProgress.memoizedState; + + if (renderState === null) { + // We're running in the default, "independent" mode. We don't do anything + // in this mode. + break; + } + + var didSuspendAlready = + (workInProgress.effectTag & DidCapture) !== NoEffect; + + var renderedTail = renderState.rendering; + if (renderedTail === null) { + // We just rendered the head. + if (!didSuspendAlready) { + // This is the first pass. We need to figure out if anything is still + // suspended in the rendered set. + + // If new content unsuspended, but there's still some content that + // didn't. Then we need to do a second pass that forces everything + // to keep showing their fallbacks. + + // We might be suspended if something in this render pass suspended, or + // something in the previous committed pass suspended. Otherwise, + // there's no chance so we can skip the expensive call to + // findFirstSuspended. + var cannotBeSuspended = + renderHasNotSuspendedYet() && + (current === null || (current.effectTag & DidCapture) === NoEffect); + if (!cannotBeSuspended) { + var row = workInProgress.child; + while (row !== null) { + var suspended = findFirstSuspended(row); + if (suspended !== null) { + didSuspendAlready = true; + workInProgress.effectTag |= DidCapture; + cutOffTailIfNeeded(renderState, false); + + // If this is a newly suspended tree, it might not get committed as + // part of the second pass. In that case nothing will subscribe to + // its thennables. Instead, we'll transfer its thennables to the + // SuspenseList so that it can retry if they resolve. + // There might be multiple of these in the list but since we're + // going to wait for all of them anyway, it doesn't really matter + // which ones gets to ping. In theory we could get clever and keep + // track of how many dependencies remain but it gets tricky because + // in the meantime, we can add/remove/change items and dependencies. + // We might bail out of the loop before finding any but that + // doesn't matter since that means that the other boundaries that + // we did find already has their listeners attached. + var newThennables = suspended.updateQueue; + if (newThennables !== null) { + workInProgress.updateQueue = newThennables; + workInProgress.effectTag |= Update; + } + + // Rerender the whole list, but this time, we'll force fallbacks + // to stay in place. + // Reset the effect list before doing the second pass since that's now invalid. + workInProgress.firstEffect = workInProgress.lastEffect = null; + // Reset the child fibers to their original state. + resetChildFibers(workInProgress, renderExpirationTime); + + // Set up the Suspense Context to force suspense and immediately + // rerender the children. + pushSuspenseContext( + workInProgress, + setShallowSuspenseContext( + suspenseStackCursor.current, + ForceSuspenseFallback + ) + ); + return workInProgress.child; + } + row = row.sibling; + } } - eventComponentInstance = workInProgress.stateNode = { - currentFiber: workInProgress, - props: newProps, - responder: responder, - rootEventTypes: null, - rootInstance: _rootContainerInstance2, - state: responderState - }; - markUpdate(workInProgress); } else { - // Update the props on the event component state node - eventComponentInstance.props = newProps; - // Update the root container, so we can properly unmount events at some point - eventComponentInstance.rootInstance = _rootContainerInstance2; - // Update the current fiber - eventComponentInstance.currentFiber = workInProgress; - updateEventComponent(eventComponentInstance); + cutOffTailIfNeeded(renderState, false); + } + // Next we're going to render the tail. + } else { + // Append the rendered row to the child list. + if (!didSuspendAlready) { + var _suspended = findFirstSuspended(renderedTail); + if (_suspended !== null) { + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, true); + // This might have been modified. + if ( + renderState.tail === null && + renderState.tailMode === "hidden" + ) { + // We need to delete the row we just rendered. + // Ensure we transfer the update queue to the parent. + var _newThennables = _suspended.updateQueue; + if (_newThennables !== null) { + workInProgress.updateQueue = _newThennables; + workInProgress.effectTag |= Update; + } + // Reset the effect list to what it w as before we rendered this + // child. The nested children have already appended themselves. + var lastEffect = (workInProgress.lastEffect = + renderState.lastEffect); + // Remove any effects that were appended after this point. + if (lastEffect !== null) { + lastEffect.nextEffect = null; + } + // We're done. + return null; + } + } else if ( + now() > renderState.tailExpiration && + renderExpirationTime > Never + ) { + // We have now passed our CPU deadline and we'll just give up further + // attempts to render the main content and only render fallbacks. + // The assumption is that this is usually faster. + workInProgress.effectTag |= DidCapture; + didSuspendAlready = true; + + cutOffTailIfNeeded(renderState, false); + + // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. If we can show + // them, then they really have the same priority as this render. + // So we'll pick it back up the very next render pass once we've had + // an opportunity to yield for paint. + + var nextPriority = renderExpirationTime - 1; + workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority; + if (enableSchedulerTracing) { + markSpawnedWork(nextPriority); + } + } + } + if (renderState.isBackwards) { + // The effect list of the backwards tail will have been added + // to the end. This breaks the guarantee that life-cycles fire in + // sibling order but that isn't a strong guarantee promised by React. + // Especially since these might also just pop in during future commits. + // Append to the beginning of the list. + renderedTail.sibling = workInProgress.child; + workInProgress.child = renderedTail; + } else { + var previousSibling = renderState.last; + if (previousSibling !== null) { + previousSibling.sibling = renderedTail; + } else { + workInProgress.child = renderedTail; + } + renderState.last = renderedTail; + } + } + + if (renderState.tail !== null) { + // We still have tail rows to render. + if (renderState.tailExpiration === 0) { + // Heuristic for how long we're willing to spend rendering rows + // until we just give up and show what we have so far. + var TAIL_EXPIRATION_TIMEOUT_MS = 500; + renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; + } + // Pop a row. + var next = renderState.tail; + renderState.rendering = next; + renderState.tail = next.sibling; + renderState.lastEffect = workInProgress.lastEffect; + next.sibling = null; + + // Restore the context. + // TODO: We can probably just avoid popping it instead and only + // setting it the first time we go from not suspended to suspended. + var suspenseContext = suspenseStackCursor.current; + if (didSuspendAlready) { + suspenseContext = setShallowSuspenseContext( + suspenseContext, + ForceSuspenseFallback + ); + } else { + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); } + pushSuspenseContext(workInProgress, suspenseContext); + // Do a pass over the next row. + return next; } break; } - case EventTarget: { - if (enableEventAPI) { - popHostContext(workInProgress); - var _type = workInProgress.type.type; - var _rootContainerInstance3 = getRootHostContainer(); - var shouldUpdate = handleEventTarget( - _type, - newProps, - _rootContainerInstance3, - workInProgress - ); - // Update the latest props on the stateNode. This is used - // during the event phase to find the most current props. - workInProgress.stateNode.props = newProps; - if (shouldUpdate) { - markUpdate(workInProgress); + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalImpl = workInProgress.type.impl; + var fundamentalInstance = workInProgress.stateNode; + + if (fundamentalInstance === null) { + var getInitialState = fundamentalImpl.getInitialState; + var fundamentalState = void 0; + if (getInitialState !== undefined) { + fundamentalState = getInitialState(newProps); + } + fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance( + workInProgress, + newProps, + fundamentalImpl, + fundamentalState || {} + ); + var _instance7 = getFundamentalComponentInstance(fundamentalInstance); + fundamentalInstance.instance = _instance7; + if (fundamentalImpl.reconcileChildren === false) { + return null; + } + appendAllChildren(_instance7, workInProgress, false, false); + mountFundamentalComponent(fundamentalInstance); + } else { + // We fire update in commit phase + var prevProps = fundamentalInstance.props; + fundamentalInstance.prevProps = prevProps; + fundamentalInstance.props = newProps; + fundamentalInstance.currentFiber = workInProgress; + if (supportsPersistence) { + var _instance8 = cloneFundamentalInstance(fundamentalInstance); + fundamentalInstance.instance = _instance8; + appendAllChildren(_instance8, workInProgress, false, false); + } + var shouldUpdate = shouldUpdateFundamentalComponent( + fundamentalInstance + ); + if (shouldUpdate) { + markUpdate(workInProgress); + } } } break; @@ -15177,7 +16328,9 @@ function completeWork(current, workInProgress, renderExpirationTime) { (function() { { throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15186,154 +16339,390 @@ function completeWork(current, workInProgress, renderExpirationTime) { return null; } -function shouldCaptureSuspense(workInProgress) { - // In order to capture, the Suspense component must have a fallback prop. - if (workInProgress.memoizedProps.fallback === undefined) { - return false; - } - // If it was the primary children that just suspended, capture and render the - // fallback. Otherwise, don't capture and bubble to the next boundary. - var nextState = workInProgress.memoizedState; - return nextState === null; -} - -function createCapturedValue(value, source) { - // If the value is an error, call this function immediately after it is thrown - // so the stack is accurate. - return { - value: value, - source: source, - stack: getStackByFiberInDevAndProd(source) - }; +function mountEventResponder( + responder, + responderProps, + instance, + rootContainerInstance, + fiber, + respondersMap +) { + var responderState = emptyObject$1; + var getInitialState = responder.getInitialState; + if (getInitialState !== null) { + responderState = getInitialState(responderProps); + } + var responderInstance = createResponderInstance( + responder, + responderProps, + responderState, + instance, + fiber + ); + mountResponderInstance( + responder, + responderInstance, + responderProps, + responderState, + instance, + rootContainerInstance + ); + respondersMap.set(responder, responderInstance); } -// Module provided by RN: -/** - * Intercept lifecycle errors and ensure they are shown with the correct stack - * trace within the native redbox component. - */ -function showErrorDialog(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - - var errorToHandle = void 0; - - // Typically Errors are thrown but eg strings or null can be thrown as well. - if (error instanceof Error) { - var message = error.message, - name = error.name; - - var summary = message ? name + ": " + message : name; +function updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance +) { + var responder = void 0; + var props = void 0; - errorToHandle = error; + if (listener) { + responder = listener.responder; + props = listener.props; + } + (function() { + if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) { + throw ReactError( + Error( + "An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer()." + ) + ); + } + })(); + var listenerProps = props; + if (visistedResponders.has(responder)) { + // show warning + { + warning$1( + false, + 'Duplicate event responder "%s" found in event listeners. ' + + "Event listeners passed to elements cannot use the same event responder more than once.", + responder.displayName + ); + } + return; + } + visistedResponders.add(responder); + var responderInstance = respondersMap.get(responder); - try { - errorToHandle.message = - summary + "\n\nThis error is located at:" + componentStack; - } catch (e) {} - } else if (typeof error === "string") { - errorToHandle = new Error( - error + "\n\nThis error is located at:" + componentStack + if (responderInstance === undefined) { + // Mount + mountEventResponder( + responder, + listenerProps, + instance, + rootContainerInstance, + fiber, + respondersMap ); } else { - errorToHandle = new Error("Unspecified error at:" + componentStack); + // Update + responderInstance.props = listenerProps; + responderInstance.fiber = fiber; } - - ExceptionsManager.handleException(errorToHandle, false); - - // Return false here to prevent ReactFiberErrorLogger default behavior of - // logging error details to console.error. Calls to console.error are - // automatically routed to the native redbox controller, which we've already - // done above by calling ExceptionsManager. - return false; } -function logCapturedError(capturedError) { - var logError = showErrorDialog(capturedError); - - // Allow injected showErrorDialog() to prevent default console.error logging. - // This enables renderers like ReactNative to better manage redbox behavior. - if (logError === false) { - return; - } - - var error = capturedError.error; - { - var componentName = capturedError.componentName, - componentStack = capturedError.componentStack, - errorBoundaryName = capturedError.errorBoundaryName, - errorBoundaryFound = capturedError.errorBoundaryFound, - willRetry = capturedError.willRetry; - - // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (errorBoundaryFound && willRetry) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } - // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - console.error(error); - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 +function updateEventListeners( + listeners, + instance, + rootContainerInstance, + fiber +) { + var visistedResponders = new Set(); + var dependencies = fiber.dependencies; + if (listeners != null) { + if (dependencies === null) { + dependencies = fiber.dependencies = { + expirationTime: NoWork, + firstContext: null, + responders: new Map() + }; } - - var componentNameMessage = componentName - ? "The above error occurred in the <" + componentName + "> component:" - : "The above error occurred in one of your React components:"; - - var errorBoundaryMessage = void 0; - // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. - if (errorBoundaryFound && errorBoundaryName) { - if (willRetry) { - errorBoundaryMessage = - "React will try to recreate this component tree from scratch " + - ("using the error boundary you provided, " + errorBoundaryName + "."); - } else { - errorBoundaryMessage = - "This error was initially handled by the error boundary " + - errorBoundaryName + - ".\n" + - "Recreating the tree from scratch failed so React will unmount the tree."; + var respondersMap = dependencies.responders; + if (respondersMap === null) { + respondersMap = new Map(); + } + if (isArray$2(listeners)) { + for (var i = 0, length = listeners.length; i < length; i++) { + var listener = listeners[i]; + updateEventListener( + listener, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); } } else { - errorBoundaryMessage = - "Consider adding an error boundary to your tree to customize error handling behavior.\n" + - "Visit https://fb.me/react-error-boundaries to learn more about error boundaries."; + updateEventListener( + listeners, + fiber, + visistedResponders, + respondersMap, + instance, + rootContainerInstance + ); + } + } + if (dependencies !== null) { + var _respondersMap = dependencies.responders; + if (_respondersMap !== null) { + // Unmount + var mountedResponders = Array.from(_respondersMap.keys()); + for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) { + var mountedResponder = mountedResponders[_i]; + if (!visistedResponders.has(mountedResponder)) { + var responderInstance = _respondersMap.get(mountedResponder); + unmountResponderInstance(responderInstance); + _respondersMap.delete(mountedResponder); + } + } } - var combinedMessage = - "" + - componentNameMessage + - componentStack + - "\n\n" + - ("" + errorBoundaryMessage); - - // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - console.error(combinedMessage); } } -var didWarnAboutUndefinedSnapshotBeforeUpdate = null; -{ - didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); -} - -var PossiblyWeakSet$1 = typeof WeakSet === "function" ? WeakSet : Set; - -function logError(boundary, errorInfo) { - var source = errorInfo.source; - var stack = errorInfo.stack; - if (stack === null && source !== null) { +function unwindWork(workInProgress, renderExpirationTime) { + switch (workInProgress.tag) { + case ClassComponent: { + var Component = workInProgress.type; + if (isContextProvider(Component)) { + popContext(workInProgress); + } + var effectTag = workInProgress.effectTag; + if (effectTag & ShouldCapture) { + workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + return null; + } + case HostRoot: { + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + var _effectTag = workInProgress.effectTag; + (function() { + if (!((_effectTag & DidCapture) === NoEffect)) { + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + } + })(); + workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; + return workInProgress; + } + case HostComponent: { + // TODO: popHydrationState + popHostContext(workInProgress); + return null; + } + case SuspenseComponent: { + popSuspenseContext(workInProgress); + var _effectTag2 = workInProgress.effectTag; + if (_effectTag2 & ShouldCapture) { + workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + return null; + } + case DehydratedSuspenseComponent: { + if (enableSuspenseServerRenderer) { + popSuspenseContext(workInProgress); + if (workInProgress.alternate === null) { + // TODO: popHydrationState + } else { + resetHydrationState(); + } + var _effectTag3 = workInProgress.effectTag; + if (_effectTag3 & ShouldCapture) { + workInProgress.effectTag = + (_effectTag3 & ~ShouldCapture) | DidCapture; + // Captured a suspense effect. Re-render the boundary. + return workInProgress; + } + } + return null; + } + case SuspenseListComponent: { + popSuspenseContext(workInProgress); + // SuspenseList doesn't actually catch anything. It should've been + // caught by a nested boundary. If not, it should bubble through. + return null; + } + case HostPortal: + popHostContainer(workInProgress); + return null; + case ContextProvider: + popProvider(workInProgress); + return null; + default: + return null; + } +} + +function unwindInterruptedWork(interruptedWork) { + switch (interruptedWork.tag) { + case ClassComponent: { + var childContextTypes = interruptedWork.type.childContextTypes; + if (childContextTypes !== null && childContextTypes !== undefined) { + popContext(interruptedWork); + } + break; + } + case HostRoot: { + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + } + case HostComponent: { + popHostContext(interruptedWork); + break; + } + case HostPortal: + popHostContainer(interruptedWork); + break; + case SuspenseComponent: + popSuspenseContext(interruptedWork); + break; + case DehydratedSuspenseComponent: + if (enableSuspenseServerRenderer) { + popSuspenseContext(interruptedWork); + } + break; + case SuspenseListComponent: + popSuspenseContext(interruptedWork); + break; + case ContextProvider: + popProvider(interruptedWork); + break; + default: + break; + } +} + +function createCapturedValue(value, source) { + // If the value is an error, call this function immediately after it is thrown + // so the stack is accurate. + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} + +// Module provided by RN: +(function() { + if ( + !( + typeof ReactNativePrivateInterface.ReactFiberErrorDialog + .showErrorDialog === "function" + ) + ) { + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); + } +})(); + +function showErrorDialog(capturedError) { + return ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ); +} + +function logCapturedError(capturedError) { + var logError = showErrorDialog(capturedError); + + // Allow injected showErrorDialog() to prevent default console.error logging. + // This enables renderers like ReactNative to better manage redbox behavior. + if (logError === false) { + return; + } + + var error = capturedError.error; + { + var componentName = capturedError.componentName, + componentStack = capturedError.componentStack, + errorBoundaryName = capturedError.errorBoundaryName, + errorBoundaryFound = capturedError.errorBoundaryFound, + willRetry = capturedError.willRetry; + + // Browsers support silencing uncaught errors by calling + // `preventDefault()` in window `error` handler. + // We record this information as an expando on the error. + + if (error != null && error._suppressLogging) { + if (errorBoundaryFound && willRetry) { + // The error is recoverable and was silenced. + // Ignore it and don't print the stack addendum. + // This is handy for testing error boundaries without noise. + return; + } + // The error is fatal. Since the silencing might have + // been accidental, we'll surface it anyway. + // However, the browser would have silenced the original error + // so we'll print it first, and then print the stack addendum. + console.error(error); + // For a more detailed description of this block, see: + // https://github.com/facebook/react/pull/13384 + } + + var componentNameMessage = componentName + ? "The above error occurred in the <" + componentName + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryMessage = void 0; + // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. + if (errorBoundaryFound && errorBoundaryName) { + if (willRetry) { + errorBoundaryMessage = + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + errorBoundaryName + "."); + } else { + errorBoundaryMessage = + "This error was initially handled by the error boundary " + + errorBoundaryName + + ".\n" + + "Recreating the tree from scratch failed so React will unmount the tree."; + } + } else { + errorBoundaryMessage = + "Consider adding an error boundary to your tree to customize error handling behavior.\n" + + "Visit https://fb.me/react-error-boundaries to learn more about error boundaries."; + } + var combinedMessage = + "" + + componentNameMessage + + componentStack + + "\n\n" + + ("" + errorBoundaryMessage); + + // In development, we provide our own message with just the component stack. + // We don't include the original error message and JS stack because the browser + // has already printed it. Even if the application swallows the error, it is still + // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. + console.error(combinedMessage); + } +} + +var didWarnAboutUndefinedSnapshotBeforeUpdate = null; +{ + didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); +} + +var PossiblyWeakSet$1 = typeof WeakSet === "function" ? WeakSet : Set; + +function logError(boundary, errorInfo) { + var source = errorInfo.source; + var stack = errorInfo.stack; + if (stack === null && source !== null) { stack = getStackByFiberInDevAndProd(source); } @@ -15495,14 +16884,15 @@ function commitBeforeMutationLifeCycles(current$$1, finishedWork) { case HostText: case HostPortal: case IncompleteClassComponent: - case EventTarget: // Nothing to do for these component types return; default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15571,8 +16961,19 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } function commitPassiveHookEffects(finishedWork) { - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if ((finishedWork.effectTag & Passive) !== NoEffect) { + switch (finishedWork.tag) { + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: { + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + break; + } + default: + break; + } + } } function commitLifeCycles( @@ -15769,73 +17170,43 @@ function commitLifeCycles( if (enableProfilerTimer) { var onRender = finishedWork.memoizedProps.onRender; - if (enableSchedulerTracing) { - onRender( - finishedWork.memoizedProps.id, - current$$1 === null ? "mount" : "update", - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - getCommitTime(), - finishedRoot.memoizedInteractions - ); - } else { - onRender( - finishedWork.memoizedProps.id, - current$$1 === null ? "mount" : "update", - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - getCommitTime() - ); + if (typeof onRender === "function") { + if (enableSchedulerTracing) { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime(), + finishedRoot.memoizedInteractions + ); + } else { + onRender( + finishedWork.memoizedProps.id, + current$$1 === null ? "mount" : "update", + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + getCommitTime() + ); + } } } return; } case SuspenseComponent: + case SuspenseListComponent: case IncompleteClassComponent: + case FundamentalComponent: return; - case EventTarget: { - if (enableEventAPI) { - var _type = finishedWork.type.type; - var _props = finishedWork.memoizedProps; - var _instance3 = finishedWork.stateNode; - var parentInstance = null; - - var node = finishedWork.return; - // Traverse up the fiber tree until we find the parent host node. - while (node !== null) { - if (node.tag === HostComponent) { - parentInstance = node.stateNode; - break; - } else if (node.tag === HostRoot) { - parentInstance = node.stateNode.containerInfo; - break; - } - node = node.return; - } - (function() { - if (!(parentInstance !== null)) { - throw ReactError( - "This should have a parent host component initialized. This error is likely caused by a bug in React. Please file an issue." - ); - } - })(); - commitEventTarget(_type, _props, _instance3, parentInstance); - } - return; - } - case EventComponent: { - if (enableEventAPI) { - mountEventComponent(finishedWork.stateNode); - } - return; - } default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -15856,11 +17227,11 @@ function hideOrUnhideAllChildren(finishedWork, isHidden) { unhideInstance(node.stateNode, node.memoizedProps); } } else if (node.tag === HostText) { - var _instance4 = node.stateNode; + var _instance3 = node.stateNode; if (isHidden) { - hideTextInstance(_instance4); + hideTextInstance(_instance3); } else { - unhideTextInstance(_instance4, node.memoizedProps); + unhideTextInstance(_instance3, node.memoizedProps); } } else if ( node.tag === SuspenseComponent && @@ -15937,7 +17308,7 @@ function commitDetachRef(current$$1) { // User-originating errors (lifecycles and refs) should not interrupt // deletion, so don't let them throw. Host-originating errors should // interrupt deletion, so it's okay -function commitUnmount(current$$1) { +function commitUnmount(current$$1, renderPriorityLevel) { onCommitUnmount(current$$1); switch (current$$1.tag) { @@ -15950,14 +17321,33 @@ function commitUnmount(current$$1) { var lastEffect = updateQueue.lastEffect; if (lastEffect !== null) { var firstEffect = lastEffect.next; - var effect = firstEffect; - do { - var destroy = effect.destroy; - if (destroy !== undefined) { - safelyCallDestroy(current$$1, destroy); - } - effect = effect.next; - } while (effect !== firstEffect); + + // When the owner fiber is deleted, the destroy function of a passive + // effect hook is called during the synchronous commit phase. This is + // a concession to implementation complexity. Calling it in the + // passive effect phase (like they usually are, when dependencies + // change during an update) would require either traversing the + // children of the deleted fiber again, or including unmount effects + // as part of the fiber effect list. + // + // Because this is during the sync commit phase, we need to change + // the priority. + // + // TODO: Reconsider this implementation trade off. + var priorityLevel = + renderPriorityLevel > NormalPriority + ? NormalPriority + : renderPriorityLevel; + runWithPriority(priorityLevel, function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (destroy !== undefined) { + safelyCallDestroy(current$$1, destroy); + } + effect = effect.next; + } while (effect !== firstEffect); + }); } } break; @@ -15971,38 +17361,59 @@ function commitUnmount(current$$1) { return; } case HostComponent: { - safelyDetachRef(current$$1); - return; + if (enableFlareAPI) { + var dependencies = current$$1.dependencies; + + if (dependencies !== null) { + var respondersMap = dependencies.responders; + if (respondersMap !== null) { + var responderInstances = Array.from(respondersMap.values()); + for ( + var i = 0, length = responderInstances.length; + i < length; + i++ + ) { + var responderInstance = responderInstances[i]; + unmountResponderInstance(responderInstance); + } + dependencies.responders = null; + } + } + } + safelyDetachRef(current$$1); + return; } case HostPortal: { // TODO: this is recursive. // We are also not using this parent because // the portal will get pushed immediately. if (supportsMutation) { - unmountHostComponents(current$$1); + unmountHostComponents(current$$1, renderPriorityLevel); } else if (supportsPersistence) { emptyPortalContainer(current$$1); } return; } - case EventComponent: { - if (enableEventAPI) { - var eventComponentInstance = current$$1.stateNode; - unmountEventComponent(eventComponentInstance); - current$$1.stateNode = null; + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = current$$1.stateNode; + if (fundamentalInstance !== null) { + unmountFundamentalComponent(fundamentalInstance); + current$$1.stateNode = null; + } } } } } -function commitNestedUnmounts(root) { +function commitNestedUnmounts(root, renderPriorityLevel) { // While we're inside a removed host node we don't want to call // removeChild on the inner nodes because they're removed by the top // call anyway. We also want to call componentWillUnmount on all // composites before this host node is removed from the tree. Therefore var node = root; while (true) { - commitUnmount(node); + commitUnmount(node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes. // Skip portals because commitUnmount() currently visits them recursively. if ( @@ -16030,6 +17441,7 @@ function commitNestedUnmounts(root) { } function detachFiber(current$$1) { + var alternate = current$$1.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we // should clear the child pointer of the parent alternate to let this // get GC:ed but we don't know which for sure which parent is the current @@ -16039,12 +17451,14 @@ function detachFiber(current$$1) { current$$1.child = null; current$$1.memoizedState = null; current$$1.updateQueue = null; - var alternate = current$$1.alternate; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; if (alternate !== null) { - alternate.return = null; - alternate.child = null; - alternate.memoizedState = null; - alternate.updateQueue = null; + detachFiber(alternate); } } @@ -16069,8 +17483,7 @@ function commitContainer(finishedWork) { case ClassComponent: case HostComponent: case HostText: - case EventTarget: - case EventComponent: { + case FundamentalComponent: { return; } case HostRoot: @@ -16086,7 +17499,9 @@ function commitContainer(finishedWork) { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16105,7 +17520,9 @@ function getHostParentFiber(fiber) { (function() { { throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16175,25 +17592,33 @@ function commitPlacement(finishedWork) { // Note: these two variables *must* always be updated together. var parent = void 0; var isContainer = void 0; - + var parentStateNode = parentFiber.stateNode; switch (parentFiber.tag) { case HostComponent: - parent = parentFiber.stateNode; + parent = parentStateNode; isContainer = false; break; case HostRoot: - parent = parentFiber.stateNode.containerInfo; + parent = parentStateNode.containerInfo; isContainer = true; break; case HostPortal: - parent = parentFiber.stateNode.containerInfo; + parent = parentStateNode.containerInfo; isContainer = true; break; + case FundamentalComponent: + if (enableFundamentalAPI) { + parent = parentStateNode.instance; + isContainer = false; + } + // eslint-disable-next-line-no-fallthrough default: (function() { { throw ReactError( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16208,8 +17633,9 @@ function commitPlacement(finishedWork) { // children to find all the terminal nodes. var node = finishedWork; while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - var stateNode = node.stateNode; + var isHost = node.tag === HostComponent || node.tag === HostText; + if (isHost || (enableFundamentalAPI && node.tag === FundamentalComponent)) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; if (before) { if (isContainer) { insertInContainerBefore(parent, stateNode, before); @@ -16246,7 +17672,7 @@ function commitPlacement(finishedWork) { } } -function unmountHostComponents(current$$1) { +function unmountHostComponents(current$$1, renderPriorityLevel) { // We only have the top Fiber that was deleted but we need to recurse down its var node = current$$1; @@ -16265,23 +17691,31 @@ function unmountHostComponents(current$$1) { (function() { if (!(parent !== null)) { throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); + var parentStateNode = parent.stateNode; switch (parent.tag) { case HostComponent: - currentParent = parent.stateNode; + currentParent = parentStateNode; currentParentIsContainer = false; break findParent; case HostRoot: - currentParent = parent.stateNode.containerInfo; + currentParent = parentStateNode.containerInfo; currentParentIsContainer = true; break findParent; case HostPortal: - currentParent = parent.stateNode.containerInfo; + currentParent = parentStateNode.containerInfo; currentParentIsContainer = true; break findParent; + case FundamentalComponent: + if (enableFundamentalAPI) { + currentParent = parentStateNode.instance; + currentParentIsContainer = false; + } } parent = parent.return; } @@ -16289,7 +17723,7 @@ function unmountHostComponents(current$$1) { } if (node.tag === HostComponent || node.tag === HostText) { - commitNestedUnmounts(node); + commitNestedUnmounts(node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the // node from the tree. if (currentParentIsContainer) { @@ -16298,6 +17732,16 @@ function unmountHostComponents(current$$1) { removeChild(currentParent, node.stateNode); } // Don't visit children because we already visited them. + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { + var fundamentalNode = node.stateNode.instance; + commitNestedUnmounts(node, renderPriorityLevel); + // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) { + removeChildFromContainer(currentParent, fundamentalNode); + } else { + removeChild(currentParent, fundamentalNode); + } } else if ( enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent @@ -16320,7 +17764,7 @@ function unmountHostComponents(current$$1) { continue; } } else { - commitUnmount(node); + commitUnmount(node, renderPriorityLevel); // Visit children because we may find more host components below. if (node.child !== null) { node.child.return = node; @@ -16347,14 +17791,14 @@ function unmountHostComponents(current$$1) { } } -function commitDeletion(current$$1) { +function commitDeletion(current$$1, renderPriorityLevel) { if (supportsMutation) { // Recursively delete all host nodes from the parent. // Detach refs and call componentWillUnmount() on the whole subtree. - unmountHostComponents(current$$1); + unmountHostComponents(current$$1, renderPriorityLevel); } else { // Detach refs and call componentWillUnmount() on the whole subtree. - commitNestedUnmounts(current$$1); + commitNestedUnmounts(current$$1, renderPriorityLevel); } detachFiber(current$$1); } @@ -16376,6 +17820,11 @@ function commitWork(current$$1, finishedWork) { } case SuspenseComponent: { commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); return; } } @@ -16428,7 +17877,9 @@ function commitWork(current$$1, finishedWork) { (function() { if (!(finishedWork.stateNode !== null)) { throw ReactError( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16441,9 +17892,6 @@ function commitWork(current$$1, finishedWork) { commitTextUpdate(textInstance, oldText, newText); return; } - case EventTarget: { - return; - } case HostRoot: { return; } @@ -16452,19 +17900,30 @@ function commitWork(current$$1, finishedWork) { } case SuspenseComponent: { commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + } + case SuspenseListComponent: { + attachSuspenseRetryListeners(finishedWork); return; } case IncompleteClassComponent: { return; } - case EventComponent: { + case FundamentalComponent: { + if (enableFundamentalAPI) { + var fundamentalInstance = finishedWork.stateNode; + updateFundamentalComponent(fundamentalInstance); + } return; } default: { (function() { { throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } })(); @@ -16482,25 +17941,31 @@ function commitSuspenseComponent(finishedWork) { } else { newDidTimeout = true; primaryChildParent = finishedWork.child; - if (newState.fallbackExpirationTime === NoWork) { - // If the children had not already timed out, record the time. - // This is used to compute the elapsed time during subsequent - // attempts to render the children. - // We model this as a normal pri expiration time since that's - // how we infer start time for updates. - newState.fallbackExpirationTime = computeAsyncExpirationNoBucket( - requestCurrentTime() - ); - } + markCommitTimeOfFallback(); } if (supportsMutation && primaryChildParent !== null) { hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); } + if (enableSuspenseCallback && newState !== null) { + var suspenseCallback = finishedWork.memoizedProps.suspenseCallback; + if (typeof suspenseCallback === "function") { + var thenables = finishedWork.updateQueue; + if (thenables !== null) { + suspenseCallback(new Set(thenables)); + } + } else { + if (suspenseCallback !== undefined) { + warning$1(false, "Unexpected type for suspenseCallback."); + } + } + } +} + +function attachSuspenseRetryListeners(finishedWork) { // If this boundary just timed out, then it will have a set of thenables. // For each thenable, attach a listener so that when it resolves, React - // attempts to re-render the boundary in the primary (pre-timeout) state. var thenables = finishedWork.updateQueue; if (thenables !== null) { finishedWork.updateQueue = null; @@ -16533,7 +17998,7 @@ var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, null); // Unmount the root by rendering null. update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property @@ -16548,12 +18013,13 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, null); update.tag = CaptureUpdate; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if (typeof getDerivedStateFromError === "function") { var error = errorInfo.value; update.payload = function() { + logError(fiber, errorInfo); return getDerivedStateFromError(error); }; } @@ -16561,6 +18027,9 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { var inst = fiber.stateNode; if (inst !== null && typeof inst.componentDidCatch === "function") { update.callback = function callback() { + { + markFailedErrorBoundaryForHotReloading(fiber); + } if (typeof getDerivedStateFromError !== "function") { // To preserve the preexisting retry behavior of error boundaries, // we keep track of which ones already failed during this batch. @@ -16568,10 +18037,12 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { // TODO: Warn in strict mode if getDerivedStateFromError is // not defined. markLegacyErrorBoundaryAsFailed(this); + + // Only log here if componentDidCatch is the only error boundary method defined + logError(fiber, errorInfo); } var error = errorInfo.value; var stack = errorInfo.stack; - logError(fiber, errorInfo); this.componentDidCatch(error, { componentStack: stack !== null ? stack : "" }); @@ -16591,6 +18062,10 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { } } }; + } else { + update.callback = function() { + markFailedErrorBoundaryForHotReloading(fiber); + }; } return update; } @@ -16648,12 +18123,19 @@ function throwException( // This is a thenable. var thenable = value; + checkForWrongSuspensePriorityInDEV(sourceFiber); + + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + // Schedule the nearest Suspense to re-render the timed out view. var _workInProgress = returnFiber; do { if ( _workInProgress.tag === SuspenseComponent && - shouldCaptureSuspense(_workInProgress) + shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) ) { // Found the nearest boundary. @@ -16667,15 +18149,15 @@ function throwException( thenables.add(thenable); } - // If the boundary is outside of concurrent mode, we should *not* + // If the boundary is outside of batched mode, we should *not* // suspend the commit. Pretend as if the suspended component rendered // null and keep rendering. In the commit phase, we'll schedule a // subsequent synchronous update to re-render the Suspense. // // Note: It doesn't matter whether the component that suspended was - // inside a concurrent mode tree. If the Suspense is outside of it, we + // inside a batched mode tree. If the Suspense is outside of it, we // should *not* suspend the commit. - if ((_workInProgress.mode & ConcurrentMode) === NoContext) { + if ((_workInProgress.mode & BatchedMode) === NoMode) { _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete. @@ -16692,9 +18174,9 @@ function throwException( sourceFiber.tag = IncompleteClassComponent; } else { // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force updte to + // since it's known to be in an inconsistent state. Use a force update to // prevent a bail out. - var update = createUpdate(Sync); + var update = createUpdate(Sync, null); update.tag = ForceUpdate; enqueueUpdate(sourceFiber, update); } @@ -16710,11 +18192,51 @@ function throwException( // Confirmed that the boundary is in a concurrent mode tree. Continue // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. SuspenseConfig applies to + // this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. attachPingListener(root, renderExpirationTime, thenable); _workInProgress.effectTag |= ShouldCapture; _workInProgress.expirationTime = renderExpirationTime; + return; } else if ( enableSuspenseServerRenderer && @@ -16730,7 +18252,9 @@ function throwException( (function() { if (!current$$1) { throw ReactError( - "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + Error( + "A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React." + ) ); } })(); @@ -16752,40 +18276,6 @@ function throwException( _workInProgress.effectTag |= ShouldCapture; _workInProgress.expirationTime = renderExpirationTime; return; - } else if ( - enableSuspenseServerRenderer && - _workInProgress.tag === DehydratedSuspenseComponent - ) { - attachPingListener(root, renderExpirationTime, thenable); - - // Since we already have a current fiber, we can eagerly add a retry listener. - var retryCache = _workInProgress.memoizedState; - if (retryCache === null) { - retryCache = _workInProgress.memoizedState = new PossiblyWeakSet(); - var _current = _workInProgress.alternate; - invariant( - _current, - "A dehydrated suspense boundary must commit before trying to render. " + - "This is probably a bug in React." - ); - _current.memoizedState = retryCache; - } - // Memoize using the boundary fiber to prevent redundant listeners. - if (!retryCache.has(thenable)) { - retryCache.add(thenable); - var retry = resolveRetryThenable.bind( - null, - _workInProgress, - thenable - ); - if (enableSchedulerTracing) { - retry = tracing.unstable_wrap(retry); - } - thenable.then(retry, retry); - } - _workInProgress.effectTag |= ShouldCapture; - _workInProgress.expirationTime = renderExpirationTime; - return; } // This boundary already captured during this render. Continue to the next // boundary. @@ -16854,129 +18344,30 @@ function throwException( } while (workInProgress !== null); } -function unwindWork(workInProgress, renderExpirationTime) { - switch (workInProgress.tag) { - case ClassComponent: { - var Component = workInProgress.type; - if (isContextProvider(Component)) { - popContext(workInProgress); - } - var effectTag = workInProgress.effectTag; - if (effectTag & ShouldCapture) { - workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture; - return workInProgress; - } - return null; - } - case HostRoot: { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - var _effectTag = workInProgress.effectTag; - (function() { - if (!((_effectTag & DidCapture) === NoEffect)) { - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - } - })(); - workInProgress.effectTag = (_effectTag & ~ShouldCapture) | DidCapture; - return workInProgress; - } - case HostComponent: { - // TODO: popHydrationState - popHostContext(workInProgress); - return null; - } - case SuspenseComponent: { - var _effectTag2 = workInProgress.effectTag; - if (_effectTag2 & ShouldCapture) { - workInProgress.effectTag = (_effectTag2 & ~ShouldCapture) | DidCapture; - // Captured a suspense effect. Re-render the boundary. - return workInProgress; - } - return null; - } - case DehydratedSuspenseComponent: { - if (enableSuspenseServerRenderer) { - // TODO: popHydrationState - var _effectTag3 = workInProgress.effectTag; - if (_effectTag3 & ShouldCapture) { - workInProgress.effectTag = - (_effectTag3 & ~ShouldCapture) | DidCapture; - // Captured a suspense effect. Re-render the boundary. - return workInProgress; - } - } - return null; - } - case HostPortal: - popHostContainer(workInProgress); - return null; - case ContextProvider: - popProvider(workInProgress); - return null; - case EventComponent: - case EventTarget: - if (enableEventAPI) { - popHostContext(workInProgress); - } - return null; - default: - return null; - } -} - -function unwindInterruptedWork(interruptedWork) { - switch (interruptedWork.tag) { - case ClassComponent: { - var childContextTypes = interruptedWork.type.childContextTypes; - if (childContextTypes !== null && childContextTypes !== undefined) { - popContext(interruptedWork); - } - break; - } - case HostRoot: { - popHostContainer(interruptedWork); - popTopLevelContextObject(interruptedWork); - break; - } - case HostComponent: { - popHostContext(interruptedWork); - break; - } - case HostPortal: - popHostContainer(interruptedWork); - break; - case ContextProvider: - popProvider(interruptedWork); - break; - default: - break; - } -} - -// TODO: Ahaha Andrew is bad at spellling +// The scheduler is imported here *only* to detect whether it's been mocked // DEV stuff var ceil = Math.ceil; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; -var ReactShouldWarnActingUpdates = - ReactSharedInternals.ReactShouldWarnActingUpdates; +var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; -var NotWorking = 0; -var BatchedPhase = 1; -var LegacyUnbatchedPhase = 2; -var RenderPhase = 4; -var CommitPhase = 5; +var NoContext = /* */ 0; +var BatchedContext = /* */ 1; +var EventContext = /* */ 2; +var DiscreteEventContext = /* */ 4; +var LegacyUnbatchedContext = /* */ 8; +var RenderContext = /* */ 16; +var CommitContext = /* */ 32; var RootIncomplete = 0; var RootErrored = 1; var RootSuspended = 2; -var RootCompleted = 3; +var RootSuspendedWithDelay = 3; +var RootCompleted = 4; -// The phase of work we're currently in -var workPhase = NotWorking; +// Describes where we are in the React execution stack +var executionContext = NoContext; // The root we're working on var workInProgressRoot = null; // The fiber we're working on @@ -16989,7 +18380,17 @@ var workInProgressRootExitStatus = RootIncomplete; // This is conceptually a time stamp but expressed in terms of an ExpirationTime // because we deal mostly with expiration times in the hot path, so this avoids // the conversion happening in the hot path. -var workInProgressRootMostRecentEventTime = Sync; +var workInProgressRootLatestProcessedExpirationTime = Sync; +var workInProgressRootLatestSuspenseTimeout = Sync; +var workInProgressRootCanSuspendUsingConfig = null; +// If we're pinged while rendering we don't always restart immediately. +// This flag determines if it might be worthwhile to restart if an opportunity +// happens latere. +var workInProgressRootHasPendingPing = false; +// The most recent time we committed a fallback. This lets us ensure a train +// model where we don't commit new loading states in too quick succession. +var globalMostRecentFallbackTime = 0; +var FALLBACK_THROTTLE_MS = 500; var nextEffect = null; var hasUncaughtError = false; @@ -16998,6 +18399,7 @@ var legacyErrorBoundariesThatAlreadyFailed = null; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; +var pendingPassiveEffectsRenderPriority = NoPriority; var pendingPassiveEffectsExpirationTime = NoWork; var rootsWithPendingDiscreteUpdates = null; @@ -17012,6 +18414,12 @@ var nestedPassiveUpdateCount = 0; var interruptedBy = null; +// Marks the need to reschedule pending interactions at these expiration times +// during the commit phase. This enables them to be traced across components +// that spawn new work during render. E.g. hidden boundaries, suspended SSR +// hydration or SuspenseList. +var spawnedWorkDuringRender = null; + // Expiration times are computed by adding to the current time (the start // time). However, if two updates are scheduled within the same event, we // should treat their start times as simultaneous, even if the actual clock @@ -17023,7 +18431,7 @@ var interruptedBy = null; var currentEventTime = NoWork; function requestCurrentTime() { - if (workPhase === RenderPhase || workPhase === CommitPhase) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { // We're inside React, so it's fine to read the actual time. return msToExpirationTime(now()); } @@ -17037,46 +18445,62 @@ function requestCurrentTime() { return currentEventTime; } -function computeExpirationForFiber(currentTime, fiber) { - if ((fiber.mode & ConcurrentMode) === NoContext) { +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + var mode = fiber.mode; + if ((mode & BatchedMode) === NoMode) { return Sync; } - if (workPhase === RenderPhase) { + var priorityLevel = getCurrentPriorityLevel(); + if ((mode & ConcurrentMode) === NoMode) { + return priorityLevel === ImmediatePriority ? Sync : Batched; + } + + if ((executionContext & RenderContext) !== NoContext) { // Use whatever time we're already rendering return renderExpirationTime; } - // Compute an expiration time based on the Scheduler priority. var expirationTime = void 0; - var priorityLevel = getCurrentPriorityLevel(); - switch (priorityLevel) { - case ImmediatePriority: - expirationTime = Sync; - break; - case UserBlockingPriority: - // TODO: Rename this to computeUserBlockingExpiration - expirationTime = computeInteractiveExpiration(currentTime); - break; - case NormalPriority: - case LowPriority: - // TODO: Handle LowPriority - // TODO: Rename this to... something better. - expirationTime = computeAsyncExpiration(currentTime); - break; - case IdlePriority: - expirationTime = Never; - break; - default: - (function() { - { - throw ReactError("Expected a valid priority level"); - } - })(); + if (suspenseConfig !== null) { + // Compute an expiration time based on the Suspense timeout. + expirationTime = computeSuspenseExpiration( + currentTime, + suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION + ); + } else { + // Compute an expiration time based on the Scheduler priority. + switch (priorityLevel) { + case ImmediatePriority: + expirationTime = Sync; + break; + case UserBlockingPriority: + // TODO: Rename this to computeUserBlockingExpiration + expirationTime = computeInteractiveExpiration(currentTime); + break; + case NormalPriority: + case LowPriority: + // TODO: Handle LowPriority + // TODO: Rename this to... something better. + expirationTime = computeAsyncExpiration(currentTime); + break; + case IdlePriority: + expirationTime = Never; + break; + default: + (function() { + { + throw ReactError(Error("Expected a valid priority level")); + } + })(); + } } // If we're in the middle of rendering a tree, do not update at the same // expiration time that is already rendering. + // TODO: We shouldn't have to do this if the update is on a different root. + // Refactor computeExpirationForFiber + scheduleUpdate so we have access to + // the root when we check for this condition. if (workInProgressRoot !== null && expirationTime === renderExpirationTime) { // This is a trick to move this update into a separate batch expirationTime -= 1; @@ -17100,8 +18524,20 @@ function scheduleUpdateOnFiber(fiber, expirationTime) { checkForInterruption(fiber, expirationTime); recordScheduleUpdate(); + // TODO: computeExpirationForFiber also reads the priority. Pass the + // priority as an argument to that function and this one. + var priorityLevel = getCurrentPriorityLevel(); + if (expirationTime === Sync) { - if (workPhase === LegacyUnbatchedPhase) { + if ( + // Check if we're inside unbatchedUpdates + (executionContext & LegacyUnbatchedContext) !== NoContext && + // Check if we're not already rendering + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Register pending interactions on the root to avoid losing traced interaction data. + schedulePendingInteractions(root, expirationTime); + // This is a legacy edge case. The initial mount of a ReactDOM.render-ed // root inside of batchedUpdates should be synchronous, but layout updates // should be deferred until the end of the batch. @@ -17111,35 +18547,36 @@ function scheduleUpdateOnFiber(fiber, expirationTime) { } } else { scheduleCallbackForRoot(root, ImmediatePriority, Sync); - if (workPhase === NotWorking) { + if (executionContext === NoContext) { // Flush the synchronous work now, wnless we're already working or inside // a batch. This is intentionally inside scheduleUpdateOnFiber instead of // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initated + // without immediately flushing it. We only do this for user-initiated // updates, to preserve historical behavior of sync mode. - flushImmediateQueue(); + flushSyncCallbackQueue(); } } } else { - // TODO: computeExpirationForFiber also reads the priority. Pass the - // priority as an argument to that function and this one. - var priorityLevel = getCurrentPriorityLevel(); - if (priorityLevel === UserBlockingPriority) { - // This is the result of a discrete event. Track the lowest priority - // discrete update per root so we can flush them early, if needed. - if (rootsWithPendingDiscreteUpdates === null) { - rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); - } else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); - if ( - lastDiscreteTime === undefined || - lastDiscreteTime > expirationTime - ) { - rootsWithPendingDiscreteUpdates.set(root, expirationTime); - } + scheduleCallbackForRoot(root, priorityLevel, expirationTime); + } + + if ( + (executionContext & DiscreteEventContext) !== NoContext && + // Only updates at user-blocking priority or greater are considered + // discrete, even inside a discrete event. + (priorityLevel === UserBlockingPriority || + priorityLevel === ImmediatePriority) + ) { + // This is the result of a discrete event. Track the lowest priority + // discrete update per root so we can flush them early, if needed. + if (rootsWithPendingDiscreteUpdates === null) { + rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); + } else { + var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); + if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) { + rootsWithPendingDiscreteUpdates.set(root, expirationTime); } } - scheduleCallbackForRoot(root, priorityLevel, expirationTime); } } var scheduleWork = scheduleUpdateOnFiber; @@ -17220,42 +18657,49 @@ function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { } root.callbackExpirationTime = expirationTime; - var options = null; - if (expirationTime !== Sync && expirationTime !== Never) { - var timeout = expirationTimeToMs(expirationTime) - now(); - if (timeout > 5000) { - // Sanity check. Should never take longer than 5 seconds. - // TODO: Add internal warning? - timeout = 5000; + if (expirationTime === Sync) { + // Sync React callbacks are scheduled on a special internal queue + root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + ); + } else { + var options = null; + if ( + !disableSchedulerTimeoutBasedOnReactExpirationTime && + expirationTime !== Never + ) { + var timeout = expirationTimeToMs(expirationTime) - now(); + options = { timeout: timeout }; } - options = { timeout: timeout }; - } - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - options - ); - if ( - enableUserTimingAPI && - expirationTime !== Sync && - workPhase !== RenderPhase && - workPhase !== CommitPhase - ) { - // Scheduled an async callback, and we're not already working. Add an - // entry to the flamegraph that shows we're waiting for a callback - // to fire. - startRequestCallbackTimer(); + root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + options + ); + if ( + enableUserTimingAPI && + expirationTime !== Sync && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + // Scheduled an async callback, and we're not already working. Add an + // entry to the flamegraph that shows we're waiting for a callback + // to fire. + startRequestCallbackTimer(); + } } } - // Add the current set of interactions to the pending set associated with - // this root. - schedulePendingInteraction(root, expirationTime); + // Associate the current interactions with this new root+priority. + schedulePendingInteractions(root, expirationTime); } function runRootCallback(root, callback, isSync) { @@ -17278,21 +18722,35 @@ function runRootCallback(root, callback, isSync) { root.callbackExpirationTime = NoWork; } } - // Flush any sync work that was scheduled by effects - if (!isBatchingUpdates && !isRendering) { - performSyncWork(); - } } -function flushInteractiveUpdates$1() { - if (workPhase === RenderPhase || workPhase === CommitPhase) { - // Can't synchronously flush interactive updates if React is already - // working. This is currently a no-op. - // TODO: Should we fire a warning? This happens if you synchronously invoke - // an input event inside an effect, like with `element.click()`. +function flushDiscreteUpdates() { + // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. + // However, `act` uses `batchedUpdates`, so there's no way to distinguish + // those two cases. Need to fix this before exposing flushDiscreteUpdates + // as a public API. + if ( + (executionContext & (BatchedContext | RenderContext | CommitContext)) !== + NoContext + ) { + if (true && (executionContext & RenderContext) !== NoContext) { + warning$1( + false, + "unstable_flushDiscreteUpdates: Cannot flush updates when React is " + + "already rendering." + ); + } + // We're already rendering, so we can't synchronously flush pending work. + // This is probably a nested event dispatch triggered by a lifecycle/effect, + // like `el.focus()`. Exit. return; } flushPendingDiscreteUpdates(); + if (!revertPassiveEffectsChange) { + // If the discrete updates scheduled passive effects, flush them now so that + // they fire before the next serial event. + flushPassiveEffects(); + } } function resolveLocksOnRoot(root, expirationTime) { @@ -17302,8 +18760,6 @@ function resolveLocksOnRoot(root, expirationTime) { firstBatch._defer && firstBatch._expirationTime >= expirationTime ) { - root.finishedWork = root.current.alternate; - root.pendingCommitExpirationTime = expirationTime; scheduleCallback(NormalPriority, function() { firstBatch._onComplete(); return null; @@ -17314,15 +18770,6 @@ function resolveLocksOnRoot(root, expirationTime) { } } -function interactiveUpdates$1(fn, a, b, c) { - if (workPhase === NotWorking) { - // TODO: Remove this call. Instead of doing this automatically, the caller - // should explicitly call flushInteractiveUpdates. - flushPendingDiscreteUpdates(); - } - return runWithPriority(UserBlockingPriority, fn.bind(null, a, b, c)); -} - function flushPendingDiscreteUpdates() { if (rootsWithPendingDiscreteUpdates !== null) { // For each root with pending discrete updates, schedule a callback to @@ -17330,33 +18777,84 @@ function flushPendingDiscreteUpdates() { var roots = rootsWithPendingDiscreteUpdates; rootsWithPendingDiscreteUpdates = null; roots.forEach(function(expirationTime, root) { - scheduleCallback( - ImmediatePriority, - renderRoot.bind(null, root, expirationTime) - ); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); }); // Now flush the immediate queue. - flushImmediateQueue(); + flushSyncCallbackQueue(); } } function batchedUpdates$1(fn, a) { - if (workPhase !== NotWorking) { - // We're already working, or inside a batch, so batchedUpdates is a no-op. + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { return fn(a); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } } - workPhase = BatchedPhase; +} + +function batchedEventUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= EventContext; try { return fn(a); } finally { - workPhase = NotWorking; - // Flush the immediate callbacks that were scheduled during this batch - flushImmediateQueue(); + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function discreteUpdates$1(fn, a, b, c) { + var prevExecutionContext = executionContext; + executionContext |= DiscreteEventContext; + try { + // Should this + return runWithPriority(UserBlockingPriority, fn.bind(null, a, b, c)); + } finally { + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + flushSyncCallbackQueue(); + } + } +} + +function flushSync(fn, a) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { + (function() { + { + throw ReactError( + Error( + "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." + ) + ); + } + })(); + } + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return runWithPriority(ImmediatePriority, fn.bind(null, a)); + } finally { + executionContext = prevExecutionContext; + // Flush the immediate callbacks that were scheduled during this batch. + // Note that this will happen even if batchedUpdates is higher up + // the stack. + flushSyncCallbackQueue(); } } function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = NoWork; + root.finishedWork = null; + root.finishedExpirationTime = NoWork; var timeoutHandle = root.timeoutHandle; if (timeoutHandle !== noTimeout) { @@ -17378,17 +18876,25 @@ function prepareFreshStack(root, expirationTime) { workInProgress = createWorkInProgress(root.current, null, expirationTime); renderExpirationTime = expirationTime; workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = Sync; + workInProgressRootLatestProcessedExpirationTime = Sync; + workInProgressRootLatestSuspenseTimeout = Sync; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = false; + + if (enableSchedulerTracing) { + spawnedWorkDuringRender = null; + } { ReactStrictModeWarnings.discardPendingWarnings(); + componentsThatTriggeredHighPriSuspend = null; } } function renderRoot(root, expirationTime, isSync) { (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Should not already be working."); + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); } })(); @@ -17404,10 +18910,11 @@ function renderRoot(root, expirationTime, isSync) { return null; } - if (root.pendingCommitExpirationTime === expirationTime) { + if (isSync && root.finishedExpirationTime === expirationTime) { // There's already a pending commit at this expiration time. - root.pendingCommitExpirationTime = NoWork; - return commitRoot.bind(null, root, expirationTime); + // TODO: This is poorly factored. This case only exists for the + // batch.commit() API. + return commitRoot.bind(null, root); } flushPassiveEffects(); @@ -17416,14 +18923,34 @@ function renderRoot(root, expirationTime, isSync) { // and prepare a fresh one. Otherwise we'll continue where we left off. if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { prepareFreshStack(root, expirationTime); - startWorkOnPendingInteraction(root, expirationTime); + startWorkOnPendingInteractions(root, expirationTime); + } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // We could've received an update at a lower priority while we yielded. + // We're suspended in a delayed state. Once we complete this render we're + // just going to try to recover at the last pending time anyway so we might + // as well start doing that eagerly. + // Ideally we should be able to do this even for retries but we don't yet + // know if we're going to process an update which wants to commit earlier, + // and this path happens very early so it would happen too often. Instead, + // for that case, we'll wait until we complete. + if (workInProgressRootHasPendingPing) { + // We have a ping at this expiration. Let's restart to see if we get unblocked. + prepareFreshStack(root, expirationTime); + } else { + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level immediately, while preserving the position in the queue. + return renderRoot.bind(null, root, lastPendingTime); + } + } } // If we have a work-in-progress fiber, it means there's still work to do // in this root. if (workInProgress !== null) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; + var prevExecutionContext = executionContext; + executionContext |= RenderContext; var prevDispatcher = ReactCurrentDispatcher.current; if (prevDispatcher === null) { // The React isomorphic package does not include a default dispatcher. @@ -17449,8 +18976,8 @@ function renderRoot(root, expirationTime, isSync) { var currentTime = requestCurrentTime(); if (currentTime < expirationTime) { // Restart at the current time. - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = prevExecutionContext; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; if (enableSchedulerTracing) { tracing.__interactionsRef.current = prevInteractions; @@ -17474,7 +19001,7 @@ function renderRoot(root, expirationTime, isSync) { break; } catch (thrownValue) { // Reset module-level state that was set during the render phase. - resetContextDependences(); + resetContextDependencies(); resetHooks(); var sourceFiber = workInProgress; @@ -17484,7 +19011,7 @@ function renderRoot(root, expirationTime, isSync) { // supposed to capture all errors that weren't caught by an error // boundary. prepareFreshStack(root, expirationTime); - workPhase = prevWorkPhase; + executionContext = prevExecutionContext; throw thrownValue; } @@ -17507,8 +19034,8 @@ function renderRoot(root, expirationTime, isSync) { } } while (true); - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = prevExecutionContext; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; if (enableSchedulerTracing) { tracing.__interactionsRef.current = prevInteractions; @@ -17528,6 +19055,9 @@ function renderRoot(root, expirationTime, isSync) { // something suspended, wait to commit it after a timeout. stopFinishedWorkLoopTimer(); + root.finishedWork = root.current.alternate; + root.finishedExpirationTime = expirationTime; + var isLocked = resolveLocksOnRoot(root, expirationTime); if (isLocked) { // This root has a lock that prevents it from committing. Exit. If we begin @@ -17543,87 +19073,221 @@ function renderRoot(root, expirationTime, isSync) { case RootIncomplete: { (function() { { - throw ReactError("Should have a work-in-progress."); + throw ReactError(Error("Should have a work-in-progress.")); } })(); } - // Flow knows about invariant, so it compains if I add a break statement, + // Flow knows about invariant, so it complains if I add a break statement, // but eslint doesn't know about invariant, so it complains if I do. // eslint-disable-next-line no-fallthrough case RootErrored: { // An error was thrown. First check if there is lower priority work // scheduled on this root. - var lastPendingTime = root.lastPendingTime; - if (root.lastPendingTime < expirationTime) { + var _lastPendingTime = root.lastPendingTime; + if (_lastPendingTime < expirationTime) { // There's lower priority work. Before raising the error, try rendering // at the lower priority to see if it fixes it. Use a continuation to // maintain the existing priority and position in the queue. - return renderRoot.bind(null, root, lastPendingTime); + return renderRoot.bind(null, root, _lastPendingTime); } if (!isSync) { // If we're rendering asynchronously, it's possible the error was // caused by tearing due to a mutation during an event. Try rendering // one more time without yiedling to events. prepareFreshStack(root, expirationTime); - scheduleCallback( - ImmediatePriority, - renderRoot.bind(null, root, expirationTime) - ); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); return null; } // If we're already rendering synchronously, commit the root in its // errored state. - return commitRoot.bind(null, root, expirationTime); + return commitRoot.bind(null, root); } case RootSuspended: { - if (!isSync) { - var _lastPendingTime = root.lastPendingTime; - if (root.lastPendingTime < expirationTime) { + flushSuspensePriorityWarningInDEV(); + + // We have an acceptable loading state. We need to figure out if we should + // immediately commit it or wait a bit. + + // If we have processed new updates during this render, we may now have a + // new loading state ready. We want to ensure that we commit that as soon as + // possible. + var hasNotProcessedNewUpdates = + workInProgressRootLatestProcessedExpirationTime === Sync; + if ( + hasNotProcessedNewUpdates && + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // If we have not processed any new updates during this pass, then this is + // either a retry of an existing fallback state or a hidden tree. + // Hidden trees shouldn't be batched with other work and after that's + // fixed it can only be a retry. + // We're going to throttle committing retries so that we don't show too + // many loading states too quickly. + var msUntilTimeout = + globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); + // Don't bother with a very short suspense time. + if (msUntilTimeout > 10) { + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime2 = root.lastPendingTime; + if (_lastPendingTime2 < expirationTime) { + // There's lower priority work. It might be unsuspended. Try rendering + // at that level. + return renderRoot.bind(null, root, _lastPendingTime2); + } + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + msUntilTimeout + ); + return null; + } + } + // The work expired. Commit immediately. + return commitRoot.bind(null, root); + } + case RootSuspendedWithDelay: { + flushSuspensePriorityWarningInDEV(); + + if ( + !isSync && + // do not delay if we're inside an act() scope + !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) + ) { + // We're suspended in a state that should be avoided. We'll try to avoid committing + // it for as long as the timeouts let us. + if (workInProgressRootHasPendingPing) { + // This render was pinged but we didn't get to restart earlier so try + // restarting now instead. + prepareFreshStack(root, expirationTime); + return renderRoot.bind(null, root, expirationTime); + } + var _lastPendingTime3 = root.lastPendingTime; + if (_lastPendingTime3 < expirationTime) { // There's lower priority work. It might be unsuspended. Try rendering - // at that level. - return renderRoot.bind(null, root, _lastPendingTime); + // at that level immediately. + return renderRoot.bind(null, root, _lastPendingTime3); } - // If workInProgressRootMostRecentEventTime is Sync, that means we didn't - // track any event times. That can happen if we retried but nothing switched - // from fallback to content. There's no reason to delay doing no work. - if (workInProgressRootMostRecentEventTime !== Sync) { - var msUntilTimeout = computeMsUntilTimeout( - workInProgressRootMostRecentEventTime, - expirationTime + + var _msUntilTimeout = void 0; + if (workInProgressRootLatestSuspenseTimeout !== Sync) { + // We have processed a suspense config whose expiration time we can use as + // the timeout. + _msUntilTimeout = + expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now(); + } else if (workInProgressRootLatestProcessedExpirationTime === Sync) { + // This should never normally happen because only new updates cause + // delayed states, so we should have processed something. However, + // this could also happen in an offscreen tree. + _msUntilTimeout = 0; + } else { + // If we don't have a suspense config, we're going to use a heuristic to + var eventTimeMs = inferTimeFromExpirationTime( + workInProgressRootLatestProcessedExpirationTime ); - // Don't bother with a very short suspense time. - if (msUntilTimeout > 10) { - // The render is suspended, it hasn't timed out, and there's no lower - // priority work to do. Instead of committing the fallback - // immediately, wait for more data to arrive. - root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root, expirationTime), - msUntilTimeout - ); - return null; + var currentTimeMs = now(); + var timeUntilExpirationMs = + expirationTimeToMs(expirationTime) - currentTimeMs; + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed < 0) { + // We get this wrong some time since we estimate the time. + timeElapsed = 0; + } + + _msUntilTimeout = jnd(timeElapsed) - timeElapsed; + + // Clamp the timeout to the expiration time. + // TODO: Once the event time is exact instead of inferred from expiration time + // we don't need this. + if (timeUntilExpirationMs < _msUntilTimeout) { + _msUntilTimeout = timeUntilExpirationMs; } } + + // Don't bother with a very short suspense time. + if (_msUntilTimeout > 10) { + // The render is suspended, it hasn't timed out, and there's no lower + // priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout + ); + return null; + } } // The work expired. Commit immediately. - return commitRoot.bind(null, root, expirationTime); + return commitRoot.bind(null, root); } case RootCompleted: { // The work completed. Ready to commit. - return commitRoot.bind(null, root, expirationTime); + if ( + !isSync && + // do not delay if we're inside an act() scope + !( + true && + flushSuspenseFallbacksInTests && + IsThisRendererActing.current + ) && + workInProgressRootLatestProcessedExpirationTime !== Sync && + workInProgressRootCanSuspendUsingConfig !== null + ) { + // If we have exceeded the minimum loading delay, which probably + // means we have shown a spinner already, we might have to suspend + // a bit longer to ensure that the spinner is shown for enough time. + var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay( + workInProgressRootLatestProcessedExpirationTime, + expirationTime, + workInProgressRootCanSuspendUsingConfig + ); + if (_msUntilTimeout2 > 10) { + root.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root), + _msUntilTimeout2 + ); + return null; + } + } + return commitRoot.bind(null, root); } default: { (function() { { - throw ReactError("Unknown root exit status."); + throw ReactError(Error("Unknown root exit status.")); } })(); } } } -function markRenderEventTime(expirationTime) { - if (expirationTime < workInProgressRootMostRecentEventTime) { - workInProgressRootMostRecentEventTime = expirationTime; +function markCommitTimeOfFallback() { + globalMostRecentFallbackTime = now(); +} + +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + if ( + expirationTime < workInProgressRootLatestProcessedExpirationTime && + expirationTime > Never + ) { + workInProgressRootLatestProcessedExpirationTime = expirationTime; + } + if (suspenseConfig !== null) { + if ( + expirationTime < workInProgressRootLatestSuspenseTimeout && + expirationTime > Never + ) { + workInProgressRootLatestSuspenseTimeout = expirationTime; + // Most of the time we only have one config and getting wrong is not bad. + workInProgressRootCanSuspendUsingConfig = suspenseConfig; + } } } @@ -17633,15 +19297,29 @@ function renderDidSuspend() { } } -function renderDidError() { +function renderDidSuspendDelayIfPossible() { if ( workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended ) { + workInProgressRootExitStatus = RootSuspendedWithDelay; + } +} + +function renderDidError() { + if (workInProgressRootExitStatus !== RootCompleted) { workInProgressRootExitStatus = RootErrored; } } +// Called during render to determine if anything has suspended. +// Returns false if we're not sure. +function renderHasNotSuspendedYet() { + // If something errored or completed, we can't really be sure, + // so those are false. + return workInProgressRootExitStatus === RootIncomplete; +} + function inferTimeFromExpirationTime(expirationTime) { // We don't know exactly when the update was scheduled, but we can infer an // approximate start time from the expiration time. @@ -17649,6 +19327,20 @@ function inferTimeFromExpirationTime(expirationTime) { return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; } +function inferTimeFromExpirationTimeWithSuspenseConfig( + expirationTime, + suspenseConfig +) { + // We don't know exactly when the update was scheduled, but we can infer an + // approximate start time from the expiration time by subtracting the timeout + // that was added to the event time. + var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); + return ( + earliestExpirationTimeMs - + (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION) + ); +} + function workLoopSync() { // Already timed out, so perform work without checking if we need to yield. while (workInProgress !== null) { @@ -17673,7 +19365,7 @@ function performUnitOfWork(unitOfWork) { setCurrentFiber(unitOfWork); var next = void 0; - if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoContext) { + if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) { startProfilerTimer(unitOfWork); next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime); stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); @@ -17709,7 +19401,7 @@ function completeUnitOfWork(unitOfWork) { var next = void 0; if ( !enableProfilerTimer || - (workInProgress.mode & ProfileMode) === NoContext + (workInProgress.mode & ProfileMode) === NoMode ) { next = completeWork(current$$1, workInProgress, renderExpirationTime); } else { @@ -17775,7 +19467,7 @@ function completeUnitOfWork(unitOfWork) { if ( enableProfilerTimer && - (workInProgress.mode & ProfileMode) !== NoContext + (workInProgress.mode & ProfileMode) !== NoMode ) { // Record the render duration for the fiber that errored. stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); @@ -17839,7 +19531,7 @@ function resetChildExpirationTime(completedWork) { var newChildExpirationTime = NoWork; // Bubble up the earliest expiration time. - if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoContext) { + if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) { // In profiling mode, resetChildExpirationTime is also used to reset // profiler durations. var actualDuration = completedWork.actualDuration; @@ -17892,16 +19584,16 @@ function resetChildExpirationTime(completedWork) { completedWork.childExpirationTime = newChildExpirationTime; } -function commitRoot(root, expirationTime) { +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); runWithPriority( ImmediatePriority, - commitRootImpl.bind(null, root, expirationTime) + commitRootImpl.bind(null, root, renderPriorityLevel) ); // If there are passive effects, schedule a callback to flush them. This goes // outside commitRootImpl so that it inherits the priority of the render. if (rootWithPendingPassiveEffects !== null) { - var priorityLevel = getCurrentPriorityLevel(); - scheduleCallback(priorityLevel, function() { + scheduleCallback(NormalPriority, function() { flushPassiveEffects(); return null; }); @@ -17909,19 +19601,31 @@ function commitRoot(root, expirationTime) { return null; } -function commitRootImpl(root, expirationTime) { +function commitRootImpl(root, renderPriorityLevel) { flushPassiveEffects(); flushRenderPhaseStrictModeWarningsInDEV(); (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Should not already be working."); + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError(Error("Should not already be working.")); } })(); - var finishedWork = root.current.alternate; + + var finishedWork = root.finishedWork; + var expirationTime = root.finishedExpirationTime; + if (finishedWork === null) { + return null; + } + root.finishedWork = null; + root.finishedExpirationTime = NoWork; + (function() { - if (!(finishedWork !== null)) { - throw ReactError("Should have a work-in-progress root."); + if (!(finishedWork !== root.current)) { + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); } })(); @@ -17971,947 +19675,2068 @@ function commitRootImpl(root, expirationTime) { } else { firstEffect = finishedWork; } - } else { - // There is no effect on the root. - firstEffect = finishedWork.firstEffect; + } else { + // There is no effect on the root. + firstEffect = finishedWork.firstEffect; + } + + if (firstEffect !== null) { + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + // Reset this to null before calling lifecycles + ReactCurrentOwner$2.current = null; + + // The commit phase is broken into several sub-phases. We do a separate pass + // of the effect list for each phase: all mutation effects come before all + // layout effects, and so on. + + // The first phase a "before mutation" phase. We use this phase to read the + // state of the host tree right before we mutate it. This is where + // getSnapshotBeforeUpdate is called. + startCommitSnapshotEffectsTimer(); + prepareForCommit(root.containerInfo); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback(null, commitBeforeMutationEffects, null); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitSnapshotEffectsTimer(); + + if (enableProfilerTimer) { + // Mark the current commit time to be shared by all Profilers in this + // batch. This enables them to be grouped later. + recordCommitTime(); + } + + // The next phase is the mutation phase, where we mutate the host tree. + startCommitHostEffectsTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitMutationEffects, + null, + renderPriorityLevel + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitHostEffectsTimer(); + resetAfterCommit(root.containerInfo); + + // The work-in-progress tree is now the current tree. This must come after + // the mutation phase, so that the previous tree is still current during + // componentWillUnmount, but before the layout phase, so that the finished + // work is current during componentDidMount/Update. + root.current = finishedWork; + + // The next phase is the layout phase, where we call effects that read + // the host tree after it's been mutated. The idiomatic use case for this is + // layout, but class component lifecycles also fire here for legacy reasons. + startCommitLifeCyclesTimer(); + nextEffect = firstEffect; + do { + { + invokeGuardedCallback( + null, + commitLayoutEffects, + null, + root, + expirationTime + ); + if (hasCaughtError()) { + (function() { + if (!(nextEffect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var _error2 = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error2); + nextEffect = nextEffect.nextEffect; + } + } + } while (nextEffect !== null); + stopCommitLifeCyclesTimer(); + + nextEffect = null; + + // Tell Scheduler to yield at the end of the frame, so the browser has an + // opportunity to paint. + requestPaint(); + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + } + executionContext = prevExecutionContext; + } else { + // No effects. + root.current = finishedWork; + // Measure these anyway so the flamegraph explicitly shows that there were + // no effects. + // TODO: Maybe there's a better way to report this. + startCommitSnapshotEffectsTimer(); + stopCommitSnapshotEffectsTimer(); + if (enableProfilerTimer) { + recordCommitTime(); + } + startCommitHostEffectsTimer(); + stopCommitHostEffectsTimer(); + startCommitLifeCyclesTimer(); + stopCommitLifeCyclesTimer(); + } + + stopCommitTimer(); + + var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; + + if (rootDoesHavePassiveEffects) { + // This commit has passive effects. Stash a reference to them. But don't + // schedule a callback until after flushing layout work. + rootDoesHavePassiveEffects = false; + rootWithPendingPassiveEffects = root; + pendingPassiveEffectsExpirationTime = expirationTime; + pendingPassiveEffectsRenderPriority = renderPriorityLevel; + } else { + // We are done with the effect chain at this point so let's clear the + // nextEffect pointers to assist with GC. If we have passive effects, we'll + // clear this in flushPassiveEffects. + nextEffect = firstEffect; + while (nextEffect !== null) { + var nextNextEffect = nextEffect.nextEffect; + nextEffect.nextEffect = null; + nextEffect = nextNextEffect; + } + } + + // Check if there's remaining work on this root + var remainingExpirationTime = root.firstPendingTime; + if (remainingExpirationTime !== NoWork) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + remainingExpirationTime + ); + + if (enableSchedulerTracing) { + if (spawnedWorkDuringRender !== null) { + var expirationTimes = spawnedWorkDuringRender; + spawnedWorkDuringRender = null; + for (var i = 0; i < expirationTimes.length; i++) { + scheduleInteractions( + root, + expirationTimes[i], + root.memoizedInteractions + ); + } + } + } + + scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); + } else { + // If there's no remaining work, we can clear the set of already failed + // error boundaries. + legacyErrorBoundariesThatAlreadyFailed = null; + } + + if (enableSchedulerTracing) { + if (!rootDidHavePassiveEffects) { + // If there are no passive effects, then we can complete the pending interactions. + // Otherwise, we'll wait until after the passive effects are flushed. + // Wait to do this until after remaining work has been scheduled, + // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. + finishPendingInteractions(root, expirationTime); + } + } + + onCommitRoot(finishedWork.stateNode, expirationTime); + + if (remainingExpirationTime === Sync) { + // Count the number of times the root synchronously re-renders without + // finishing. If there are too many, it indicates an infinite update loop. + if (root === rootWithNestedUpdates) { + nestedUpdateCount++; + } else { + nestedUpdateCount = 0; + rootWithNestedUpdates = root; + } + } else { + nestedUpdateCount = 0; + } + + if (hasUncaughtError) { + hasUncaughtError = false; + var _error3 = firstUncaughtError; + firstUncaughtError = null; + throw _error3; + } + + if ((executionContext & LegacyUnbatchedContext) !== NoContext) { + // This is a legacy edge case. We just committed the initial mount of + // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired + // synchronously, but layout updates should be deferred until the end + // of the batch. + return null; + } + + // If layout work was scheduled, flush it now. + flushSyncCallbackQueue(); + return null; +} + +function commitBeforeMutationEffects() { + while (nextEffect !== null) { + if ((nextEffect.effectTag & Snapshot) !== NoEffect) { + setCurrentFiber(nextEffect); + recordEffect(); + + var current$$1 = nextEffect.alternate; + commitBeforeMutationLifeCycles(current$$1, nextEffect); + + resetCurrentFiber(); + } + nextEffect = nextEffect.nextEffect; + } +} + +function commitMutationEffects(renderPriorityLevel) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & ContentReset) { + commitResetTextContent(nextEffect); + } + + if (effectTag & Ref) { + var current$$1 = nextEffect.alternate; + if (current$$1 !== null) { + commitDetachRef(current$$1); + } + } + + // The following switch statement is only concerned about placement, + // updates, and deletions. To avoid needing to add a case for every possible + // bitmap value, we remove the secondary effects from the effect tag and + // switch on that value. + var primaryEffectTag = effectTag & (Placement | Update | Deletion); + switch (primaryEffectTag) { + case Placement: { + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + // TODO: findDOMNode doesn't rely on this any more but isMounted does + // and isMounted is deprecated anyway so we should be able to kill this. + nextEffect.effectTag &= ~Placement; + break; + } + case PlacementAndUpdate: { + // Placement + commitPlacement(nextEffect); + // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + nextEffect.effectTag &= ~Placement; + + // Update + var _current = nextEffect.alternate; + commitWork(_current, nextEffect); + break; + } + case Update: { + var _current2 = nextEffect.alternate; + commitWork(_current2, nextEffect); + break; + } + case Deletion: { + commitDeletion(nextEffect, renderPriorityLevel); + break; + } + } + + // TODO: Only record a mutation effect if primaryEffectTag is non-zero. + recordEffect(); + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function commitLayoutEffects(root, committedExpirationTime) { + // TODO: Should probably move the bulk of this function to commitWork. + while (nextEffect !== null) { + setCurrentFiber(nextEffect); + + var effectTag = nextEffect.effectTag; + + if (effectTag & (Update | Callback)) { + recordEffect(); + var current$$1 = nextEffect.alternate; + commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); + } + + if (effectTag & Ref) { + recordEffect(); + commitAttachRef(nextEffect); + } + + if (effectTag & Passive) { + rootDoesHavePassiveEffects = true; + } + + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } +} + +function flushPassiveEffects() { + if (rootWithPendingPassiveEffects === null) { + return false; + } + var root = rootWithPendingPassiveEffects; + var expirationTime = pendingPassiveEffectsExpirationTime; + var renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = NoWork; + pendingPassiveEffectsRenderPriority = NoPriority; + var priorityLevel = + renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; + return runWithPriority( + priorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} + +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = null; + if (enableSchedulerTracing) { + prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + } + + (function() { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + } + })(); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + + // Note: This currently assumes there are no passive effects on the root + // fiber, because the root is not part of its own effect list. This could + // change in the future. + var effect = root.current.firstEffect; + while (effect !== null) { + { + setCurrentFiber(effect); + invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); + if (hasCaughtError()) { + (function() { + if (!(effect !== null)) { + throw ReactError(Error("Should be working on an effect.")); + } + })(); + var error = clearCaughtError(); + captureCommitPhaseError(effect, error); + } + resetCurrentFiber(); + } + var nextNextEffect = effect.nextEffect; + // Remove nextEffect pointer to assist GC + effect.nextEffect = null; + effect = nextNextEffect; + } + + if (enableSchedulerTracing) { + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); + } + + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + + // If additional passive effects were scheduled, increment a counter. If this + // exceeds the limit, we'll fire a warning. + nestedPassiveUpdateCount = + rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + + return true; +} + +function isAlreadyFailedLegacyErrorBoundary(instance) { + return ( + legacyErrorBoundariesThatAlreadyFailed !== null && + legacyErrorBoundariesThatAlreadyFailed.has(instance) + ); +} + +function markLegacyErrorBoundaryAsFailed(instance) { + if (legacyErrorBoundariesThatAlreadyFailed === null) { + legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); + } else { + legacyErrorBoundariesThatAlreadyFailed.add(instance); + } +} + +function prepareToThrowUncaughtError(error) { + if (!hasUncaughtError) { + hasUncaughtError = true; + firstUncaughtError = error; + } +} +var onUncaughtError = prepareToThrowUncaughtError; + +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); + enqueueUpdate(rootFiber, update); + var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } +} + +function captureCommitPhaseError(sourceFiber, error) { + if (sourceFiber.tag === HostRoot) { + // Error was thrown at the root. There is no parent, so the root + // itself should capture it. + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } + + var fiber = sourceFiber.return; + while (fiber !== null) { + if (fiber.tag === HostRoot) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } else if (fiber.tag === ClassComponent) { + var ctor = fiber.type; + var instance = fiber.stateNode; + if ( + typeof ctor.getDerivedStateFromError === "function" || + (typeof instance.componentDidCatch === "function" && + !isAlreadyFailedLegacyErrorBoundary(instance)) + ) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createClassErrorUpdate( + fiber, + errorInfo, + // TODO: This is always sync + Sync + ); + enqueueUpdate(fiber, update); + var root = markUpdateTimeFromFiberToRoot(fiber, Sync); + if (root !== null) { + scheduleCallbackForRoot(root, ImmediatePriority, Sync); + } + return; + } + } + fiber = fiber.return; + } +} + +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + if (pingCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + pingCache.delete(thenable); + } + + if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { + // Received a ping at the same priority level at which we're currently + // rendering. We might want to restart this render. This should mirror + // the logic of whether or not a root suspends once it completes. + + // TODO: If we're rendering sync either due to Sync, Batched or expired, + // we should probably never restart. + + // If we're suspended with delay, we'll always suspend so we can always + // restart. If we're suspended without any updates, it might be a retry. + // If it's early in the retry we can restart. We can't know for sure + // whether we'll eventually process an update during this render pass, + // but it's somewhat unlikely that we get to a ping before that, since + // getting to the root most update is usually very fast. + if ( + workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + workInProgressRootLatestProcessedExpirationTime === Sync && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ) { + // Restart from the root. Don't need to schedule a ping because + // we're already working on this tree. + prepareFreshStack(root, renderExpirationTime); + } else { + // Even though we can't restart right now, we might get an + // opportunity later. So we mark this render as having a ping. + workInProgressRootHasPendingPing = true; + } + return; + } + + var lastPendingTime = root.lastPendingTime; + if (lastPendingTime < suspendedTime) { + // The root is no longer suspended at this time. + return; + } + + var pingTime = root.pingTime; + if (pingTime !== NoWork && pingTime < suspendedTime) { + // There's already a lower priority ping scheduled. + return; + } + + // Mark the time at which this ping was scheduled. + root.pingTime = suspendedTime; + + if (root.finishedExpirationTime === suspendedTime) { + // If there's a pending fallback waiting to commit, throw it away. + root.finishedExpirationTime = NoWork; + root.finishedWork = null; + } + + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + suspendedTime + ); + scheduleCallbackForRoot(root, priorityLevel, suspendedTime); +} + +function retryTimedOutBoundary(boundaryFiber) { + // The boundary fiber (a Suspense component or SuspenseList component) + // previously was rendered in its fallback state. One of the promises that + // suspended it has resolved, which means at least part of the tree was + // likely unblocked. Try rendering again, at a new expiration time. + var currentTime = requestCurrentTime(); + var suspenseConfig = null; // Retries don't carry over the already committed update. + var retryTime = computeExpirationForFiber( + currentTime, + boundaryFiber, + suspenseConfig + ); + // TODO: Special case idle priority? + var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); + var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); + if (root !== null) { + scheduleCallbackForRoot(root, priorityLevel, retryTime); + } +} + +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = void 0; + if (enableSuspenseServerRenderer) { + switch (boundaryFiber.tag) { + case SuspenseComponent: + retryCache = boundaryFiber.stateNode; + break; + case DehydratedSuspenseComponent: + retryCache = boundaryFiber.memoizedState; + break; + default: + (function() { + { + throw ReactError( + Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." + ) + ); + } + })(); + } + } else { + retryCache = boundaryFiber.stateNode; + } + + if (retryCache !== null) { + // The thenable resolved, so we no longer need to memoize, because it will + // never be thrown again. + retryCache.delete(thenable); + } + + retryTimedOutBoundary(boundaryFiber); +} + +// Computes the next Just Noticeable Difference (JND) boundary. +// The theory is that a person can't tell the difference between small differences in time. +// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable +// difference in the experience. However, waiting for longer might mean that we can avoid +// showing an intermediate loading state. The longer we have already waited, the harder it +// is to tell small differences in time. Therefore, the longer we've already waited, +// the longer we can wait additionally. At some point we have to give up though. +// We pick a train model where the next boundary commits at a consistent schedule. +// These particular numbers are vague estimates. We expect to adjust them based on research. +function jnd(timeElapsed) { + return timeElapsed < 120 + ? 120 + : timeElapsed < 480 + ? 480 + : timeElapsed < 1080 + ? 1080 + : timeElapsed < 1920 + ? 1920 + : timeElapsed < 3000 + ? 3000 + : timeElapsed < 4320 + ? 4320 + : ceil(timeElapsed / 1960) * 1960; +} + +function computeMsUntilSuspenseLoadingDelay( + mostRecentEventTime, + committedExpirationTime, + suspenseConfig +) { + var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0; + if (busyMinDurationMs <= 0) { + return 0; + } + var busyDelayMs = suspenseConfig.busyDelayMs | 0; + + // Compute the time until this render pass would expire. + var currentTimeMs = now(); + var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig( + mostRecentEventTime, + suspenseConfig + ); + var timeElapsed = currentTimeMs - eventTimeMs; + if (timeElapsed <= busyDelayMs) { + // If we haven't yet waited longer than the initial delay, we don't + // have to wait any additional time. + return 0; + } + var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; + // This is the value that is passed to `setTimeout`. + return msUntilTimeout; +} + +function checkForNestedUpdates() { + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { + nestedUpdateCount = 0; + rootWithNestedUpdates = null; + (function() { + { + throw ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + ); + } + })(); + } + + { + if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { + nestedPassiveUpdateCount = 0; + warning$1( + false, + "Maximum update depth exceeded. This can happen when a component " + + "calls setState inside useEffect, but useEffect either doesn't " + + "have a dependency array, or one of the dependencies changes on " + + "every render." + ); + } + } +} + +function flushRenderPhaseStrictModeWarningsInDEV() { + { + ReactStrictModeWarnings.flushLegacyContextWarning(); + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); + } + } +} + +function stopFinishedWorkLoopTimer() { + var didCompleteRoot = true; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function stopInterruptedWorkLoopTimer() { + // TODO: Track which fiber caused the interruption. + var didCompleteRoot = false; + stopWorkLoopTimer(interruptedBy, didCompleteRoot); + interruptedBy = null; +} + +function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { + if ( + enableUserTimingAPI && + workInProgressRoot !== null && + updateExpirationTime > renderExpirationTime + ) { + interruptedBy = fiberThatReceivedUpdate; + } +} + +var didWarnStateUpdateForUnmountedComponent = null; +function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + { + var tag = fiber.tag; + if ( + tag !== HostRoot && + tag !== ClassComponent && + tag !== FunctionComponent && + tag !== ForwardRef && + tag !== MemoComponent && + tag !== SimpleMemoComponent + ) { + // Only warn for user-defined components, not internal ones like Suspense. + return; + } + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForUnmountedComponent !== null) { + if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { + return; + } + didWarnStateUpdateForUnmountedComponent.add(componentName); + } else { + didWarnStateUpdateForUnmountedComponent = new Set([componentName]); + } + warningWithoutStack$1( + false, + "Can't perform a React state update on an unmounted component. This " + + "is a no-op, but it indicates a memory leak in your application. To " + + "fix, cancel all subscriptions and asynchronous tasks in %s.%s", + tag === ClassComponent + ? "the componentWillUnmount method" + : "a useEffect cleanup function", + getStackByFiberInDevAndProd(fiber) + ); + } +} + +var beginWork$$1 = void 0; +if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { + var dummyFiber = null; + beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { + // If a component throws an error, we replay it again in a synchronously + // dispatched event, so that the debugger will treat it as an uncaught + // error See ReactErrorUtils for more information. + + // Before entering the begin phase, copy the work-in-progress onto a dummy + // fiber. If beginWork throws, we'll use this to reset the state. + var originalWorkInProgressCopy = assignFiberPropertiesInDEV( + dummyFiber, + unitOfWork + ); + try { + return beginWork$1(current$$1, unitOfWork, expirationTime); + } catch (originalError) { + if ( + originalError !== null && + typeof originalError === "object" && + typeof originalError.then === "function" + ) { + // Don't replay promises. Treat everything else like an error. + throw originalError; + } + + // Keep this code in sync with renderRoot; any changes here must have + // corresponding changes there. + resetContextDependencies(); + resetHooks(); + + // Unwind the failed stack frame + unwindInterruptedWork(unitOfWork); + + // Restore the original properties of the fiber. + assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + + if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { + // Reset the profiler timer. + startProfilerTimer(unitOfWork); + } + + // Run beginWork again. + invokeGuardedCallback( + null, + beginWork$1, + null, + current$$1, + unitOfWork, + expirationTime + ); + + if (hasCaughtError()) { + var replayError = clearCaughtError(); + // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. + // Rethrow this error instead of the original one. + throw replayError; + } else { + // This branch is reachable if the render phase is impure. + throw originalError; + } + } + }; +} else { + beginWork$$1 = beginWork$1; +} + +var didWarnAboutUpdateInRender = false; +var didWarnAboutUpdateInGetChildContext = false; +function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { + { + if (fiber.tag === ClassComponent) { + switch (phase) { + case "getChildContext": + if (didWarnAboutUpdateInGetChildContext) { + return; + } + warningWithoutStack$1( + false, + "setState(...): Cannot call setState() inside getChildContext()" + ); + didWarnAboutUpdateInGetChildContext = true; + break; + case "render": + if (didWarnAboutUpdateInRender) { + return; + } + warningWithoutStack$1( + false, + "Cannot update during an existing state transition (such as " + + "within `render`). Render methods should be a pure function of " + + "props and state." + ); + didWarnAboutUpdateInRender = true; + break; + } + } + } +} + +// a 'shared' variable that changes when act() opens/closes in tests. +var IsThisRendererActing = { current: false }; + +function warnIfNotScopedWithMatchingAct(fiber) { + { + if ( + warnsIfNotActing === true && + IsSomeRendererActing.current === true && + IsThisRendererActing.current !== true + ) { + warningWithoutStack$1( + false, + "It looks like you're using the wrong act() around your test interactions.\n" + + "Be sure to use the matching version of act() corresponding to your renderer:\n\n" + + "// for react-dom:\n" + + "import {act} from 'react-dom/test-utils';\n" + + "// ...\n" + + "act(() => ...);\n\n" + + "// for react-test-renderer:\n" + + "import TestRenderer from 'react-test-renderer';\n" + + "const {act} = TestRenderer;\n" + + "// ...\n" + + "act(() => ...);" + + "%s", + getStackByFiberInDevAndProd(fiber) + ); + } + } +} + +function warnIfNotCurrentlyActingEffectsInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + (fiber.mode & StrictMode) !== NoMode && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s ran an effect, but was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); + } } +} - if (firstEffect !== null) { - var prevWorkPhase = workPhase; - workPhase = CommitPhase; - var prevInteractions = null; - if (enableSchedulerTracing) { - prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; +function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { + { + if ( + warnsIfNotActing === true && + executionContext === NoContext && + IsSomeRendererActing.current === false && + IsThisRendererActing.current === false + ) { + warningWithoutStack$1( + false, + "An update to %s inside a test was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://fb.me/react-wrap-tests-with-act" + + "%s", + getComponentName(fiber.type), + getStackByFiberInDevAndProd(fiber) + ); } + } +} - // Reset this to null before calling lifecycles - ReactCurrentOwner$2.current = null; +var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; - // The commit phase is broken into several sub-phases. We do a separate pass - // of the effect list for each phase: all mutation effects come before all - // layout effects, and so on. +// In tests, we want to enforce a mocked scheduler. +var didWarnAboutUnmockedScheduler = false; +// TODO Before we release concurrent mode, revisit this and decide whether a mocked +// scheduler is the actual recommendation. The alternative could be a testing build, +// a new lib, or whatever; we dunno just yet. This message is for early adopters +// to get their tests right. - // The first phase a "before mutation" phase. We use this phase to read the - // state of the host tree right before we mutate it. This is where - // getSnapshotBeforeUpdate is called. - startCommitSnapshotEffectsTimer(); - prepareForCommit(root.containerInfo); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback(null, commitBeforeMutationEffects, null); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var error = clearCaughtError(); - captureCommitPhaseError(nextEffect, error); - nextEffect = nextEffect.nextEffect; - } +function warnIfUnmockedScheduler(fiber) { + { + if ( + didWarnAboutUnmockedScheduler === false && + Scheduler.unstable_flushAllWithoutAsserting === undefined + ) { + if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); + } else if (warnAboutUnmockedScheduler === true) { + didWarnAboutUnmockedScheduler = true; + warningWithoutStack$1( + false, + 'Starting from React v17, the "scheduler" module will need to be mocked ' + + "to guarantee consistent behaviour across tests and browsers. " + + "For example, with jest: \n" + + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + + "For more info, visit https://fb.me/react-mock-scheduler" + ); } - } while (nextEffect !== null); - stopCommitSnapshotEffectsTimer(); - - if (enableProfilerTimer) { - // Mark the current commit time to be shared by all Profilers in this - // batch. This enables them to be grouped later. - recordCommitTime(); } + } +} - // The next phase is the mutation phase, where we mutate the host tree. - startCommitHostEffectsTimer(); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback(null, commitMutationEffects, null); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var _error = clearCaughtError(); - captureCommitPhaseError(nextEffect, _error); - nextEffect = nextEffect.nextEffect; +var componentsThatTriggeredHighPriSuspend = null; +function checkForWrongSuspensePriorityInDEV(sourceFiber) { + { + var currentPriorityLevel = getCurrentPriorityLevel(); + if ( + (sourceFiber.mode & ConcurrentMode) !== NoEffect && + (currentPriorityLevel === UserBlockingPriority || + currentPriorityLevel === ImmediatePriority) + ) { + var workInProgressNode = sourceFiber; + while (workInProgressNode !== null) { + // Add the component that triggered the suspense + var current$$1 = workInProgressNode.alternate; + if (current$$1 !== null) { + // TODO: warn component that triggers the high priority + // suspend is the HostRoot + switch (workInProgressNode.tag) { + case ClassComponent: + // Loop through the component's update queue and see whether the component + // has triggered any high priority updates + var updateQueue = current$$1.updateQueue; + if (updateQueue !== null) { + var update = updateQueue.firstUpdate; + while (update !== null) { + var priorityLevel = update.priority; + if ( + priorityLevel === UserBlockingPriority || + priorityLevel === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + update = update.next; + } + } + break; + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + if ( + workInProgressNode.memoizedState !== null && + workInProgressNode.memoizedState.baseUpdate !== null + ) { + var _update = workInProgressNode.memoizedState.baseUpdate; + // Loop through the functional component's memoized state to see whether + // the component has triggered any high pri updates + while (_update !== null) { + var priority = _update.priority; + if ( + priority === UserBlockingPriority || + priority === ImmediatePriority + ) { + if (componentsThatTriggeredHighPriSuspend === null) { + componentsThatTriggeredHighPriSuspend = new Set([ + getComponentName(workInProgressNode.type) + ]); + } else { + componentsThatTriggeredHighPriSuspend.add( + getComponentName(workInProgressNode.type) + ); + } + break; + } + if ( + _update.next === workInProgressNode.memoizedState.baseUpdate + ) { + break; + } + _update = _update.next; + } + } + break; + default: + break; + } } + workInProgressNode = workInProgressNode.return; } - } while (nextEffect !== null); - stopCommitHostEffectsTimer(); - resetAfterCommit(root.containerInfo); + } + } +} - // The work-in-progress tree is now the current tree. This must come after - // the mutation phase, so that the previous tree is still current during - // componentWillUnmount, but before the layout phase, so that the finished - // work is current during componentDidMount/Update. - root.current = finishedWork; +function flushSuspensePriorityWarningInDEV() { + { + if (componentsThatTriggeredHighPriSuspend !== null) { + var componentNames = []; + componentsThatTriggeredHighPriSuspend.forEach(function(name) { + return componentNames.push(name); + }); + componentsThatTriggeredHighPriSuspend = null; - // The next phase is the layout phase, where we call effects that read - // the host tree after it's been mutated. The idiomatic use case for this is - // layout, but class component lifecycles also fire here for legacy reasons. - startCommitLifeCyclesTimer(); - nextEffect = firstEffect; - do { - { - invokeGuardedCallback( - null, - commitLayoutEffects, - null, - root, - expirationTime + if (componentNames.length > 0) { + warningWithoutStack$1( + false, + "%s triggered a user-blocking update that suspended." + + "\n\n" + + "The fix is to split the update into multiple parts: a user-blocking " + + "update to provide immediate feedback, and another update that " + + "triggers the bulk of the changes." + + "\n\n" + + "Refer to the documentation for useSuspenseTransition to learn how " + + "to implement this pattern.", + // TODO: Add link to React docs with more information, once it exists + componentNames.sort().join(", ") ); - if (hasCaughtError()) { - (function() { - if (!(nextEffect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var _error2 = clearCaughtError(); - captureCommitPhaseError(nextEffect, _error2); - nextEffect = nextEffect.nextEffect; - } } - } while (nextEffect !== null); - stopCommitLifeCyclesTimer(); + } + } +} - nextEffect = null; +function computeThreadID(root, expirationTime) { + // Interaction threads are unique per root and expiration time. + return expirationTime * 1000 + root.interactionThreadID; +} - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - } - workPhase = prevWorkPhase; +function markSpawnedWork(expirationTime) { + if (!enableSchedulerTracing) { + return; + } + if (spawnedWorkDuringRender === null) { + spawnedWorkDuringRender = [expirationTime]; } else { - // No effects. - root.current = finishedWork; - // Measure these anyway so the flamegraph explicitly shows that there were - // no effects. - // TODO: Maybe there's a better way to report this. - startCommitSnapshotEffectsTimer(); - stopCommitSnapshotEffectsTimer(); - if (enableProfilerTimer) { - recordCommitTime(); - } - startCommitHostEffectsTimer(); - stopCommitHostEffectsTimer(); - startCommitLifeCyclesTimer(); - stopCommitLifeCyclesTimer(); + spawnedWorkDuringRender.push(expirationTime); } +} - stopCommitTimer(); +function scheduleInteractions(root, expirationTime, interactions) { + if (!enableSchedulerTracing) { + return; + } - if (rootDoesHavePassiveEffects) { - // This commit has passive effects. Stash a reference to them. But don't - // schedule a callback until after flushing layout work. - rootDoesHavePassiveEffects = false; - rootWithPendingPassiveEffects = root; - pendingPassiveEffectsExpirationTime = expirationTime; - } else { - if (enableSchedulerTracing) { - // If there are no passive effects, then we can complete the pending - // interactions. Otherwise, we'll wait until after the passive effects - // are flushed. - finishPendingInteractions(root, expirationTime); + if (interactions.size > 0) { + var pendingInteractionMap = root.pendingInteractionMap; + var pendingInteractions = pendingInteractionMap.get(expirationTime); + if (pendingInteractions != null) { + interactions.forEach(function(interaction) { + if (!pendingInteractions.has(interaction)) { + // Update the pending async work count for previously unscheduled interaction. + interaction.__count++; + } + + pendingInteractions.add(interaction); + }); + } else { + pendingInteractionMap.set(expirationTime, new Set(interactions)); + + // Update the pending async work count for the current interactions. + interactions.forEach(function(interaction) { + interaction.__count++; + }); + } + + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + subscriber.onWorkScheduled(interactions, threadID); } } +} - // Check if there's remaining work on this root - var remainingExpirationTime = root.firstPendingTime; - if (remainingExpirationTime !== NoWork) { - var currentTime = requestCurrentTime(); - var priorityLevel = inferPriorityFromExpirationTime( - currentTime, - remainingExpirationTime - ); - scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime); - } else { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; +function schedulePendingInteractions(root, expirationTime) { + // This is called when work is scheduled on a root. + // It associates the current interactions with the newly-scheduled expiration. + // They will be restored when that expiration is later committed. + if (!enableSchedulerTracing) { + return; + } + + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); +} + +function startWorkOnPendingInteractions(root, expirationTime) { + // This is called when new work is started on a root. + if (!enableSchedulerTracing) { + return; } - onCommitRoot(finishedWork.stateNode); + // Determine which interactions this batch of work currently includes, So that + // we can accurately attribute time spent working on it, And so that cascading + // work triggered during the render phase will be associated with it. + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + if (scheduledExpirationTime >= expirationTime) { + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + } + }); + + // Store the current set of interactions on the FiberRoot for a few reasons: + // We can re-use it in hot functions like renderRoot() without having to + // recalculate it. We will also use it in commitWork() to pass to any Profiler + // onRender() hooks. This also provides DevTools with a way to access it when + // the onCommitRoot() hook is called. + root.memoizedInteractions = interactions; - if (remainingExpirationTime === Sync) { - // Count the number of times the root synchronously re-renders without - // finishing. If there are too many, it indicates an infinite update loop. - if (root === rootWithNestedUpdates) { - nestedUpdateCount++; - } else { - nestedUpdateCount = 0; - rootWithNestedUpdates = root; + if (interactions.size > 0) { + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, expirationTime); + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } } - } else { - nestedUpdateCount = 0; } +} - if (hasUncaughtError) { - hasUncaughtError = false; - var _error3 = firstUncaughtError; - firstUncaughtError = null; - throw _error3; +function finishPendingInteractions(root, committedExpirationTime) { + if (!enableSchedulerTracing) { + return; } - if (workPhase === LegacyUnbatchedPhase) { - // This is a legacy edge case. We just committed the initial mount of - // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired - // synchronously, but layout updates should be deferred until the end - // of the batch. - return null; - } + var earliestRemainingTimeAfterCommit = root.firstPendingTime; - // If layout work was scheduled, flush it now. - flushImmediateQueue(); - return null; -} + var subscriber = void 0; -function commitBeforeMutationEffects() { - while (nextEffect !== null) { - if ((nextEffect.effectTag & Snapshot) !== NoEffect) { - setCurrentFiber(nextEffect); - recordEffect(); + try { + subscriber = tracing.__subscriberRef.current; + if (subscriber !== null && root.memoizedInteractions.size > 0) { + var threadID = computeThreadID(root, committedExpirationTime); + subscriber.onWorkStopped(root.memoizedInteractions, threadID); + } + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } finally { + // Clear completed interactions from the pending Map. + // Unless the render was suspended or cascading work was scheduled, + // In which case– leave pending interactions until the subsequent render. + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + // Only decrement the pending interaction count if we're done. + // If there's still work at the current priority, + // That indicates that we are waiting for suspense data. + if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { + pendingInteractionMap.delete(scheduledExpirationTime); - var current$$1 = nextEffect.alternate; - commitBeforeMutationLifeCycles(current$$1, nextEffect); + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; - resetCurrentFiber(); - } - nextEffect = nextEffect.nextEffect; + if (subscriber !== null && interaction.__count === 0) { + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority, function() { + throw error; + }); + } + } + }); + } + }); } } -function commitMutationEffects() { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); +var onCommitFiberRoot = null; +var onCommitFiberUnmount = null; +var hasLoggedError = false; - var effectTag = nextEffect.effectTag; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; - if (effectTag & ContentReset) { - commitResetTextContent(nextEffect); +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") { + // No DevTools + return false; + } + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } + if (!hook.supportsFiber) { + { + warningWithoutStack$1( + false, + "The installed version of React DevTools is too old and will not work " + + "with the current version of React. Please update React DevTools. " + + "https://fb.me/react-devtools" + ); } - - if (effectTag & Ref) { - var current$$1 = nextEffect.alternate; - if (current$$1 !== null) { - commitDetachRef(current$$1); + // DevTools exists, even though it doesn't support Fiber. + return true; + } + try { + var rendererID = hook.inject(internals); + // We have successfully injected, so now it is safe to set up hooks. + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = (root.current.effectTag & DidCapture) === DidCapture; + if (enableProfilerTimer) { + var currentTime = requestCurrentTime(); + var priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } else { + hook.onCommitFiberRoot(rendererID, root, undefined, didError); + } + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } + } + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s", + err + ); + } } + }; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + warningWithoutStack$1( + false, + "React DevTools encountered an error: %s.", + err + ); } + } + // DevTools exists + return true; +} - // The following switch statement is only concerned about placement, - // updates, and deletions. To avoid needing to add a case for every possible - // bitmap value, we remove the secondary effects from the effect tag and - // switch on that value. - var primaryEffectTag = effectTag & (Placement | Update | Deletion); - switch (primaryEffectTag) { - case Placement: { - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - // TODO: findDOMNode doesn't rely on this any more but isMounted does - // and isMounted is deprecated anyway so we should be able to kill this. - nextEffect.effectTag &= ~Placement; - break; - } - case PlacementAndUpdate: { - // Placement - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - nextEffect.effectTag &= ~Placement; +function onCommitRoot(root, expirationTime) { + if (typeof onCommitFiberRoot === "function") { + onCommitFiberRoot(root, expirationTime); + } +} - // Update - var _current = nextEffect.alternate; - commitWork(_current, nextEffect); - break; - } - case Update: { - var _current2 = nextEffect.alternate; - commitWork(_current2, nextEffect); - break; - } - case Deletion: { - commitDeletion(nextEffect); - break; - } - } +function onCommitUnmount(fiber) { + if (typeof onCommitFiberUnmount === "function") { + onCommitFiberUnmount(fiber); + } +} - // TODO: Only record a mutation effect if primaryEffectTag is non-zero. - recordEffect(); +var hasBadMapPolyfill = void 0; - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; +{ + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + var testMap = new Map([[nonExtensibleObject, null]]); + var testSet = new Set([nonExtensibleObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; } } -function commitLayoutEffects(root, committedExpirationTime) { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); +// A Fiber is work on a Component that needs to be done or was done. There can +// be more than one per component. + +var debugCounter = void 0; + +{ + debugCounter = 1; +} + +function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.elementType = null; + this.type = null; + this.stateNode = null; + + // Fiber + this.return = null; + this.child = null; + this.sibling = null; + this.index = 0; + + this.ref = null; + + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + this.dependencies = null; - var effectTag = nextEffect.effectTag; + this.mode = mode; - if (effectTag & (Update | Callback)) { - recordEffect(); - var current$$1 = nextEffect.alternate; - commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime); - } + // Effects + this.effectTag = NoEffect; + this.nextEffect = null; - if (effectTag & Ref) { - recordEffect(); - commitAttachRef(nextEffect); - } + this.firstEffect = null; + this.lastEffect = null; - if (effectTag & Passive) { - rootDoesHavePassiveEffects = true; - } + this.expirationTime = NoWork; + this.childExpirationTime = NoWork; - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; - } -} + this.alternate = null; -function flushPassiveEffects() { - if (rootWithPendingPassiveEffects === null) { - return false; - } - var root = rootWithPendingPassiveEffects; - var expirationTime = pendingPassiveEffectsExpirationTime; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsExpirationTime = NoWork; + if (enableProfilerTimer) { + // Note: The following is done to avoid a v8 performance cliff. + // + // Initializing the fields below to smis and later updating them with + // double values will cause Fibers to end up having separate shapes. + // This behavior/bug has something to do with Object.preventExtension(). + // Fortunately this only impacts DEV builds. + // Unfortunately it makes React unusably slow for some applications. + // To work around this, initialize the fields below with doubles. + // + // Learn more about this here: + // https://github.com/facebook/react/issues/14365 + // https://bugs.chromium.org/p/v8/issues/detail?id=8538 + this.actualDuration = Number.NaN; + this.actualStartTime = Number.NaN; + this.selfBaseDuration = Number.NaN; + this.treeBaseDuration = Number.NaN; - var prevInteractions = null; - if (enableSchedulerTracing) { - prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; + // It's okay to replace the initial doubles with smis after initialization. + // This won't trigger the performance cliff mentioned above, + // and it simplifies other profiler code (including DevTools). + this.actualDuration = 0; + this.actualStartTime = -1; + this.selfBaseDuration = 0; + this.treeBaseDuration = 0; } - (function() { - if (!(workPhase !== RenderPhase && workPhase !== CommitPhase)) { - throw ReactError("Cannot flush passive effects while already rendering."); - } - })(); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; - - // Note: This currently assumes there are no passive effects on the root - // fiber, because the root is not part of its own effect list. This could - // change in the future. - var effect = root.current.firstEffect; - while (effect !== null) { - { - setCurrentFiber(effect); - invokeGuardedCallback(null, commitPassiveHookEffects, null, effect); - if (hasCaughtError()) { - (function() { - if (!(effect !== null)) { - throw ReactError("Should be working on an effect."); - } - })(); - var error = clearCaughtError(); - captureCommitPhaseError(effect, error); - } - resetCurrentFiber(); + { + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugIsCurrentlyTiming = false; + this._debugNeedsRemount = false; + this._debugHookTypes = null; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") { + Object.preventExtensions(this); } - effect = effect.nextEffect; - } - - if (enableSchedulerTracing) { - tracing.__interactionsRef.current = prevInteractions; - finishPendingInteractions(root, expirationTime); } +} - workPhase = prevWorkPhase; - flushImmediateQueue(); - - // If additional passive effects were scheduled, increment a counter. If this - // exceeds the limit, we'll fire a warning. - nestedPassiveUpdateCount = - rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; +// This is a constructor function, rather than a POJO constructor, still +// please ensure we do the following: +// 1) Nobody should add any instance methods on this. Instance methods can be +// more difficult to predict when they get optimized and they are almost +// never inlined properly in static compilers. +// 2) Nobody should rely on `instanceof Fiber` for type testing. We should +// always know when it is a fiber. +// 3) We might want to experiment with using numeric keys since they are easier +// to optimize in a non-JIT environment. +// 4) We can easily go from a constructor to a createFiber object literal if that +// is faster. +// 5) It should be easy to port this to a C struct and keep a C implementation +// compatible. +var createFiber = function(tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); +}; - return true; +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); } -function isAlreadyFailedLegacyErrorBoundary(instance) { +function isSimpleFunctionComponent(type) { return ( - legacyErrorBoundariesThatAlreadyFailed !== null && - legacyErrorBoundariesThatAlreadyFailed.has(instance) + typeof type === "function" && + !shouldConstruct(type) && + type.defaultProps === undefined ); } -function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); +function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } } + return IndeterminateComponent; } -function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } -} -var onUncaughtError = prepareToThrowUncaughtError; +// This is used to create an alternate fiber to do work on. +function createWorkInProgress(current, pendingProps, expirationTime) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + ); + workInProgress.elementType = current.elementType; + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); - enqueueUpdate(rootFiber, update); - var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); - if (root !== null) { - scheduleCallbackForRoot(root, ImmediatePriority, Sync); - } -} + { + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; + workInProgress._debugHookTypes = current._debugHookTypes; + } -function captureCommitPhaseError(sourceFiber, error) { - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - return; - } + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; - var fiber = sourceFiber.return; - while (fiber !== null) { - if (fiber.tag === HostRoot) { - captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); - return; - } else if (fiber.tag === ClassComponent) { - var ctor = fiber.type; - var instance = fiber.stateNode; - if ( - typeof ctor.getDerivedStateFromError === "function" || - (typeof instance.componentDidCatch === "function" && - !isAlreadyFailedLegacyErrorBoundary(instance)) - ) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createClassErrorUpdate( - fiber, - errorInfo, - // TODO: This is always sync - Sync - ); - enqueueUpdate(fiber, update); - var root = markUpdateTimeFromFiberToRoot(fiber, Sync); - if (root !== null) { - scheduleCallbackForRoot(root, ImmediatePriority, Sync); - } - return; - } - } - fiber = fiber.return; - } -} + // We already have an alternate. + // Reset the effect tag. + workInProgress.effectTag = NoEffect; -function pingSuspendedRoot(root, thenable, suspendedTime) { - var pingCache = root.pingCache; - if (pingCache !== null) { - // The thenable resolved, so we no longer need to memoize, because it will - // never be thrown again. - pingCache.delete(thenable); - } + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; - if (workInProgressRoot === root && renderExpirationTime === suspendedTime) { - // Received a ping at the same priority level at which we're currently - // rendering. Restart from the root. Don't need to schedule a ping because - // we're already working on this tree. - prepareFreshStack(root, renderExpirationTime); - return; + if (enableProfilerTimer) { + // We intentionally reset, rather than copy, actualDuration & actualStartTime. + // This prevents time from endlessly accumulating in new commits. + // This has the downside of resetting values for different priority renders, + // But works for yielding (the common case) and should support resuming. + workInProgress.actualDuration = 0; + workInProgress.actualStartTime = -1; + } } - var lastPendingTime = root.lastPendingTime; - if (lastPendingTime < suspendedTime) { - // The root is no longer suspended at this time. - return; - } + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; - var pingTime = root.pingTime; - if (pingTime !== NoWork && pingTime < suspendedTime) { - // There's already a lower priority ping scheduled. - return; - } + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; - // Mark the time at which this ping was scheduled. - root.pingTime = suspendedTime; + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; - var currentTime = requestCurrentTime(); - var priorityLevel = inferPriorityFromExpirationTime( - currentTime, - suspendedTime - ); - scheduleCallbackForRoot(root, priorityLevel, suspendedTime); -} + // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; -function retryTimedOutBoundary(boundaryFiber) { - // The boundary fiber (a Suspense component) previously timed out and was - // rendered in its fallback state. One of the promises that suspended it has - // resolved, which means at least part of the tree was likely unblocked. Try - // rendering again, at a new expiration time. - var currentTime = requestCurrentTime(); - var retryTime = computeExpirationForFiber(currentTime, boundaryFiber); - // TODO: Special case idle priority? - var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime); - var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); - if (root !== null) { - scheduleCallbackForRoot(root, priorityLevel, retryTime); + if (enableProfilerTimer) { + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; } -} -function resolveRetryThenable(boundaryFiber, thenable) { - var retryCache = void 0; - if (enableSuspenseServerRenderer) { - switch (boundaryFiber.tag) { - case SuspenseComponent: - retryCache = boundaryFiber.stateNode; + { + workInProgress._debugNeedsRemount = current._debugNeedsRemount; + switch (workInProgress.tag) { + case IndeterminateComponent: + case FunctionComponent: + case SimpleMemoComponent: + workInProgress.type = resolveFunctionForHotReloading(current.type); break; - case DehydratedSuspenseComponent: - retryCache = boundaryFiber.memoizedState; + case ClassComponent: + workInProgress.type = resolveClassForHotReloading(current.type); + break; + case ForwardRef: + workInProgress.type = resolveForwardRefForHotReloading(current.type); break; default: - (function() { - { - throw ReactError( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); - } - })(); + break; } - } else { - retryCache = boundaryFiber.stateNode; } - if (retryCache !== null) { - // The thenable resolved, so we no longer need to memoize, because it will - // never be thrown again. - retryCache.delete(thenable); - } - - retryTimedOutBoundary(boundaryFiber); + return workInProgress; } -// Computes the next Just Noticeable Difference (JND) boundary. -// The theory is that a person can't tell the difference between small differences in time. -// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable -// difference in the experience. However, waiting for longer might mean that we can avoid -// showing an intermediate loading state. The longer we have already waited, the harder it -// is to tell small differences in time. Therefore, the longer we've already waited, -// the longer we can wait additionally. At some point we have to give up though. -// We pick a train model where the next boundary commits at a consistent schedule. -// These particular numbers are vague estimates. We expect to adjust them based on research. -function jnd(timeElapsed) { - return timeElapsed < 120 - ? 120 - : timeElapsed < 480 - ? 480 - : timeElapsed < 1080 - ? 1080 - : timeElapsed < 1920 - ? 1920 - : timeElapsed < 3000 - ? 3000 - : timeElapsed < 4320 - ? 4320 - : ceil(timeElapsed / 1960) * 1960; -} +// Used to reuse a Fiber for a second pass. +function resetWorkInProgress(workInProgress, renderExpirationTime) { + // This resets the Fiber to what createFiber or createWorkInProgress would + // have set the values to before during the first pass. Ideally this wouldn't + // be necessary but unfortunately many code paths reads from the workInProgress + // when they should be reading from current and writing to workInProgress. -function computeMsUntilTimeout(mostRecentEventTime, committedExpirationTime) { - if (disableYielding) { - // Timeout immediately when yielding is disabled. - return 0; - } + // We assume pendingProps, index, key, ref, return are still untouched to + // avoid doing another reconciliation. - var eventTimeMs = inferTimeFromExpirationTime(mostRecentEventTime); - var currentTimeMs = now(); - var timeElapsed = currentTimeMs - eventTimeMs; + // Reset the effect tag but keep any Placement tags, since that's something + // that child fiber is setting, not the reconciliation. + workInProgress.effectTag &= Placement; - var msUntilTimeout = jnd(timeElapsed) - timeElapsed; + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; - // Compute the time until this render pass would expire. - var timeUntilExpirationMs = - expirationTimeToMs(committedExpirationTime) - currentTimeMs; + var current = workInProgress.alternate; + if (current === null) { + // Reset to createFiber's initial values. + workInProgress.childExpirationTime = NoWork; + workInProgress.expirationTime = renderExpirationTime; + + workInProgress.child = null; + workInProgress.memoizedProps = null; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; - // Clamp the timeout to the expiration time. - // TODO: Once the event time is exact instead of inferred from expiration time - // we don't need this. - if (timeUntilExpirationMs < msUntilTimeout) { - msUntilTimeout = timeUntilExpirationMs; + workInProgress.dependencies = null; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = 0; + workInProgress.treeBaseDuration = 0; + } + } else { + // Reset to the cloned values that createWorkInProgress would've. + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = + currentDependencies === null + ? null + : { + expirationTime: currentDependencies.expirationTime, + firstContext: currentDependencies.firstContext, + responders: currentDependencies.responders + }; + + if (enableProfilerTimer) { + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } } - // This is the value that is passed to `setTimeout`. - return msUntilTimeout; + return workInProgress; } -function checkForNestedUpdates() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - nestedUpdateCount = 0; - rootWithNestedUpdates = null; - (function() { - { - throw ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - ); - } - })(); +function createHostRootFiber(tag) { + var mode = void 0; + if (tag === ConcurrentRoot) { + mode = ConcurrentMode | BatchedMode | StrictMode; + } else if (tag === BatchedRoot) { + mode = BatchedMode | StrictMode; + } else { + mode = NoMode; } - { - if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { - nestedPassiveUpdateCount = 0; - warning$1( - false, - "Maximum update depth exceeded. This can happen when a component " + - "calls setState inside useEffect, but useEffect either doesn't " + - "have a dependency array, or one of the dependencies changes on " + - "every render." - ); - } + if (enableProfilerTimer && isDevToolsPresent) { + // Always collect profile timings when DevTools are present. + // This enables DevTools to start capturing timing at any point– + // Without some nodes in the tree having empty base times. + mode |= ProfileMode; } + + return createFiber(HostRoot, null, null, mode); } -function flushRenderPhaseStrictModeWarningsInDEV() { - { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - ReactStrictModeWarnings.flushLegacyContextWarning(); +function createFiberFromTypeAndProps( + type, // React$ElementType + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiber = void 0; - if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.flushPendingDeprecationWarnings(); + var fiberTag = IndeterminateComponent; + // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var resolvedType = type; + if (typeof type === "function") { + if (shouldConstruct(type)) { + fiberTag = ClassComponent; + { + resolvedType = resolveClassForHotReloading(resolvedType); + } + } else { + { + resolvedType = resolveFunctionForHotReloading(resolvedType); + } + } + } else if (typeof type === "string") { + fiberTag = HostComponent; + } else { + getTag: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = Mode; + mode |= ConcurrentMode | BatchedMode | StrictMode; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; + break; + case REACT_PROFILER_TYPE: + return createFiberFromProfiler(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_TYPE: + return createFiberFromSuspense(pendingProps, mode, expirationTime, key); + case REACT_SUSPENSE_LIST_TYPE: + return createFiberFromSuspenseList( + pendingProps, + mode, + expirationTime, + key + ); + default: { + if (typeof type === "object" && type !== null) { + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break getTag; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break getTag; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + { + resolvedType = resolveForwardRefForHotReloading(resolvedType); + } + break getTag; + case REACT_MEMO_TYPE: + fiberTag = MemoComponent; + break getTag; + case REACT_LAZY_TYPE: + fiberTag = LazyComponent; + resolvedType = null; + break getTag; + case REACT_FUNDAMENTAL_TYPE: + if (enableFundamentalAPI) { + return createFiberFromFundamental( + type, + pendingProps, + mode, + expirationTime, + key + ); + } + break; + } + } + var info = ""; + { + if ( + type === undefined || + (typeof type === "object" && + type !== null && + Object.keys(type).length === 0) + ) { + info += + " You likely forgot to export your component from the file " + + "it's defined in, or you might have mixed up default and " + + "named imports."; + } + var ownerName = owner ? getComponentName(owner.type) : null; + if (ownerName) { + info += "\n\nCheck the render method of `" + ownerName + "`."; + } + } + (function() { + { + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (type == null ? type : typeof type) + + "." + + info + ) + ); + } + })(); + } } } -} -function stopFinishedWorkLoopTimer() { - var didCompleteRoot = true; - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; -} + fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.elementType = type; + fiber.type = resolvedType; + fiber.expirationTime = expirationTime; -function stopInterruptedWorkLoopTimer() { - // TODO: Track which fiber caused the interruption. - var didCompleteRoot = false; - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; + return fiber; } -function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { - if ( - enableUserTimingAPI && - workInProgressRoot !== null && - updateExpirationTime > renderExpirationTime - ) { - interruptedBy = fiberThatReceivedUpdate; +function createFiberFromElement(element, mode, expirationTime) { + var owner = null; + { + owner = element._owner; } -} - -var didWarnStateUpdateForUnmountedComponent = null; -function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + var type = element.type; + var key = element.key; + var pendingProps = element.props; + var fiber = createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime + ); { - var tag = fiber.tag; - if ( - tag !== HostRoot && - tag !== ClassComponent && - tag !== FunctionComponent && - tag !== ForwardRef && - tag !== MemoComponent && - tag !== SimpleMemoComponent - ) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } - // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - var componentName = getComponentName(fiber.type) || "ReactComponent"; - if (didWarnStateUpdateForUnmountedComponent !== null) { - if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { - return; - } - didWarnStateUpdateForUnmountedComponent.add(componentName); - } else { - didWarnStateUpdateForUnmountedComponent = new Set([componentName]); - } - warningWithoutStack$1( - false, - "Can't perform a React state update on an unmounted component. This " + - "is a no-op, but it indicates a memory leak in your application. To " + - "fix, cancel all subscriptions and asynchronous tasks in %s.%s", - tag === ClassComponent - ? "the componentWillUnmount method" - : "a useEffect cleanup function", - getStackByFiberInDevAndProd(fiber) - ); + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; } + return fiber; } -var beginWork$$1 = void 0; -if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { - var dummyFiber = null; - beginWork$$1 = function(current$$1, unitOfWork, expirationTime) { - // If a component throws an error, we replay it again in a synchronously - // dispatched event, so that the debugger will treat it as an uncaught - // error See ReactErrorUtils for more information. - - // Before entering the begin phase, copy the work-in-progress onto a dummy - // fiber. If beginWork throws, we'll use this to reset the state. - var originalWorkInProgressCopy = assignFiberPropertiesInDEV( - dummyFiber, - unitOfWork - ); - try { - return beginWork$1(current$$1, unitOfWork, expirationTime); - } catch (originalError) { - if ( - originalError !== null && - typeof originalError === "object" && - typeof originalError.then === "function" - ) { - // Don't replay promises. Treat everything else like an error. - throw originalError; - } - - // Keep this code in sync with renderRoot; any changes here must have - // corresponding changes there. - resetContextDependences(); - resetHooks(); - - // Unwind the failed stack frame - unwindInterruptedWork(unitOfWork); - - // Restore the original properties of the fiber. - assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); - - if (enableProfilerTimer && unitOfWork.mode & ProfileMode) { - // Reset the profiler timer. - startProfilerTimer(unitOfWork); - } - - // Run beginWork again. - invokeGuardedCallback( - null, - beginWork$1, - null, - current$$1, - unitOfWork, - expirationTime - ); - - if (hasCaughtError()) { - var replayError = clearCaughtError(); - // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. - // Rethrow this error instead of the original one. - throw replayError; - } else { - // This branch is reachable if the render phase is impure. - throw originalError; - } - } - }; -} else { - beginWork$$1 = beginWork$1; +function createFiberFromFragment(elements, mode, expirationTime, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.expirationTime = expirationTime; + return fiber; } -var didWarnAboutUpdateInRender = false; -var didWarnAboutUpdateInGetChildContext = false; -function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { - { - if (fiber.tag === ClassComponent) { - switch (phase) { - case "getChildContext": - if (didWarnAboutUpdateInGetChildContext) { - return; - } - warningWithoutStack$1( - false, - "setState(...): Cannot call setState() inside getChildContext()" - ); - didWarnAboutUpdateInGetChildContext = true; - break; - case "render": - if (didWarnAboutUpdateInRender) { - return; - } - warningWithoutStack$1( - false, - "Cannot update during an existing state transition (such as " + - "within `render`). Render methods should be a pure function of " + - "props and state." - ); - didWarnAboutUpdateInRender = true; - break; - } - } - } +function createFiberFromFundamental( + fundamentalComponent, + pendingProps, + mode, + expirationTime, + key +) { + var fiber = createFiber(FundamentalComponent, pendingProps, key, mode); + fiber.elementType = fundamentalComponent; + fiber.type = fundamentalComponent; + fiber.expirationTime = expirationTime; + return fiber; } -function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { +function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { { if ( - workPhase === NotWorking && - ReactShouldWarnActingUpdates.current === false + typeof pendingProps.id !== "string" || + typeof pendingProps.onRender !== "function" ) { warningWithoutStack$1( false, - "An update to %s inside a test was not wrapped in act(...).\n\n" + - "When testing, code that causes React state updates should be " + - "wrapped into act(...):\n\n" + - "act(() => {\n" + - " /* fire events that update state */\n" + - "});\n" + - "/* assert on the output */\n\n" + - "This ensures that you're testing the behavior the user would see " + - "in the browser." + - " Learn more at https://fb.me/react-wrap-tests-with-act" + - "%s", - getComponentName(fiber.type), - getStackByFiberInDevAndProd(fiber) + 'Profiler must specify an "id" string and "onRender" function as props' ); } } -} -var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; + var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); + // TODO: The Profiler fiber shouldn't have a type. It has a tag. + fiber.elementType = REACT_PROFILER_TYPE; + fiber.type = REACT_PROFILER_TYPE; + fiber.expirationTime = expirationTime; -function computeThreadID(root, expirationTime) { - // Interaction threads are unique per root and expiration time. - return expirationTime * 1000 + root.interactionThreadID; + return fiber; } -function schedulePendingInteraction(root, expirationTime) { - // This is called when work is scheduled on a root. It sets up a pending - // interaction, which is completed once the work commits. - if (!enableSchedulerTracing) { - return; - } - - var interactions = tracing.__interactionsRef.current; - if (interactions.size > 0) { - var pendingInteractionMap = root.pendingInteractionMap; - var pendingInteractions = pendingInteractionMap.get(expirationTime); - if (pendingInteractions != null) { - interactions.forEach(function(interaction) { - if (!pendingInteractions.has(interaction)) { - // Update the pending async work count for previously unscheduled interaction. - interaction.__count++; - } +function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); - pendingInteractions.add(interaction); - }); - } else { - pendingInteractionMap.set(expirationTime, new Set(interactions)); + // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_TYPE; + fiber.elementType = REACT_SUSPENSE_TYPE; - // Update the pending async work count for the current interactions. - interactions.forEach(function(interaction) { - interaction.__count++; - }); - } + fiber.expirationTime = expirationTime; + return fiber; +} - var subscriber = tracing.__subscriberRef.current; - if (subscriber !== null) { - var threadID = computeThreadID(root, expirationTime); - subscriber.onWorkScheduled(interactions, threadID); - } +function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) { + var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); + { + // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_LIST_TYPE; } + fiber.elementType = REACT_SUSPENSE_LIST_TYPE; + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromText(content, mode, expirationTime) { + var fiber = createFiber(HostText, content, null, mode); + fiber.expirationTime = expirationTime; + return fiber; +} + +function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoMode); + // TODO: These should not need a type. + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + return fiber; } -function startWorkOnPendingInteraction(root, expirationTime) { - // This is called when new work is started on a root. - if (!enableSchedulerTracing) { - return; - } +function createFiberFromPortal(portal, mode, expirationTime) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.expirationTime = expirationTime; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, // Used by persistent updates + implementation: portal.implementation + }; + return fiber; +} - // Determine which interactions this batch of work currently includes, So that - // we can accurately attribute time spent working on it, And so that cascading - // work triggered during the render phase will be associated with it. - var interactions = new Set(); - root.pendingInteractionMap.forEach(function( - scheduledInteractions, - scheduledExpirationTime - ) { - if (scheduledExpirationTime >= expirationTime) { - scheduledInteractions.forEach(function(interaction) { - return interactions.add(interaction); - }); - } - }); +// Used for stashing WIP properties to replay failed work in DEV. +function assignFiberPropertiesInDEV(target, source) { + if (target === null) { + // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoMode); + } - // Store the current set of interactions on the FiberRoot for a few reasons: - // We can re-use it in hot functions like renderRoot() without having to - // recalculate it. We will also use it in commitWork() to pass to any Profiler - // onRender() hooks. This also provides DevTools with a way to access it when - // the onCommitRoot() hook is called. - root.memoizedInteractions = interactions; + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. - if (interactions.size > 0) { - var subscriber = tracing.__subscriberRef.current; - if (subscriber !== null) { - var threadID = computeThreadID(root, expirationTime); - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } - } + target.tag = source.tag; + target.key = source.key; + target.elementType = source.elementType; + target.type = source.type; + target.stateNode = source.stateNode; + target.return = source.return; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.dependencies = source.dependencies; + target.mode = source.mode; + target.effectTag = source.effectTag; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.expirationTime = source.expirationTime; + target.childExpirationTime = source.childExpirationTime; + target.alternate = source.alternate; + if (enableProfilerTimer) { + target.actualDuration = source.actualDuration; + target.actualStartTime = source.actualStartTime; + target.selfBaseDuration = source.selfBaseDuration; + target.treeBaseDuration = source.treeBaseDuration; } + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; + target._debugNeedsRemount = source._debugNeedsRemount; + target._debugHookTypes = source._debugHookTypes; + return target; } -function finishPendingInteractions(root, committedExpirationTime) { - if (!enableSchedulerTracing) { - return; - } - - var earliestRemainingTimeAfterCommit = root.firstPendingTime; +// TODO: This should be lifted into the renderer. - var subscriber = void 0; +// The following attributes are only used by interaction tracing builds. +// They enable interactions to be associated with their async work, +// And expose interaction metadata to the React DevTools Profiler plugin. +// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled. - try { - subscriber = tracing.__subscriberRef.current; - if (subscriber !== null && root.memoizedInteractions.size > 0) { - var threadID = computeThreadID(root, committedExpirationTime); - subscriber.onWorkStopped(root.memoizedInteractions, threadID); - } - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } finally { - // Clear completed interactions from the pending Map. - // Unless the render was suspended or cascading work was scheduled, - // In which case– leave pending interactions until the subsequent render. - var pendingInteractionMap = root.pendingInteractionMap; - pendingInteractionMap.forEach(function( - scheduledInteractions, - scheduledExpirationTime - ) { - // Only decrement the pending interaction count if we're done. - // If there's still work at the current priority, - // That indicates that we are waiting for suspense data. - if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { - pendingInteractionMap.delete(scheduledExpirationTime); +// Exported FiberRoot type includes all properties, +// To avoid requiring potentially error-prone :any casts throughout the project. +// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true). +// The types are defined separately within this file to ensure they stay in sync. +// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.) - scheduledInteractions.forEach(function(interaction) { - interaction.__count--; +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pendingChildren = null; + this.pingCache = null; + this.finishedExpirationTime = NoWork; + this.finishedWork = null; + this.timeoutHandle = noTimeout; + this.context = null; + this.pendingContext = null; + this.hydrate = hydrate; + this.firstBatch = null; + this.callbackNode = null; + this.callbackExpirationTime = NoWork; + this.firstPendingTime = NoWork; + this.lastPendingTime = NoWork; + this.pingTime = NoWork; - if (subscriber !== null && interaction.__count === 0) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority, function() { - throw error; - }); - } - } - }); - } - }); + if (enableSchedulerTracing) { + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); } } +function createFiberRoot(containerInfo, tag, hydrate) { + var root = new FiberRootNode(containerInfo, tag, hydrate); + + // Cyclic construction. This cheats the type system right now because + // stateNode is any. + var uninitializedFiber = createHostRootFiber(tag); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + + return root; +} + // This lets us hook into Fiber to debug what it's doing. // See https://github.com/facebook/react/pull/8033. // This is not part of the public API, not even for React DevTools. @@ -18938,7 +21763,7 @@ function getContextForSubtree(parentComponent) { return emptyContextObject; } - var fiber = get$1(parentComponent); + var fiber = get(parentComponent); var parentContext = findCurrentUnmaskedContext(fiber); if (fiber.tag === ClassComponent) { @@ -18951,7 +21776,13 @@ function getContextForSubtree(parentComponent) { return parentContext; } -function scheduleRootUpdate(current$$1, element, expirationTime, callback) { +function scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback +) { { if (phase === "render" && current !== null && !didWarnAboutNestedUpdates) { didWarnAboutNestedUpdates = true; @@ -18966,7 +21797,7 @@ function scheduleRootUpdate(current$$1, element, expirationTime, callback) { } } - var update = createUpdate(expirationTime); + var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property // being called "element". update.payload = { element: element }; @@ -18984,7 +21815,9 @@ function scheduleRootUpdate(current$$1, element, expirationTime, callback) { update.callback = callback; } - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } enqueueUpdate(current$$1, update); scheduleWork(current$$1, expirationTime); @@ -18996,6 +21829,7 @@ function updateContainerAtExpirationTime( container, parentComponent, expirationTime, + suspenseConfig, callback ) { // TODO: If this is a nested container, this won't be the root. @@ -19020,24 +21854,34 @@ function updateContainerAtExpirationTime( container.pendingContext = context; } - return scheduleRootUpdate(current$$1, element, expirationTime, callback); + return scheduleRootUpdate( + current$$1, + element, + expirationTime, + suspenseConfig, + callback + ); } function findHostInstance(component) { - var fiber = get$1(component); + var fiber = get(component); if (fiber === undefined) { if (typeof component.render === "function") { (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } else { (function() { { throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } })(); @@ -19052,20 +21896,24 @@ function findHostInstance(component) { function findHostInstanceWithWarning(component, methodName) { { - var fiber = get$1(component); + var fiber = get(component); if (fiber === undefined) { if (typeof component.render === "function") { (function() { { - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError( + Error("Unable to find node on an unmounted component.") + ); } })(); } else { (function() { { throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } })(); @@ -19115,19 +21963,32 @@ function findHostInstanceWithWarning(component, methodName) { return findHostInstance(component); } -function createContainer(containerInfo, isConcurrent, hydrate) { - return createFiberRoot(containerInfo, isConcurrent, hydrate); +function createContainer(containerInfo, tag, hydrate) { + return createFiberRoot(containerInfo, tag, hydrate); } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current; var currentTime = requestCurrentTime(); - var expirationTime = computeExpirationForFiber(currentTime, current$$1); + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfUnmockedScheduler(current$$1); + warnIfNotScopedWithMatchingAct(current$$1); + } + } + var suspenseConfig = requestCurrentSuspenseConfig(); + var expirationTime = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); return updateContainerAtExpirationTime( element, container, parentComponent, expirationTime, + suspenseConfig, callback ); } @@ -19184,7 +22045,9 @@ var setSuspenseHandler = null; id--; } if (currentHook !== null) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } var newState = copyWithSet(currentHook.memoizedState, path, value); currentHook.memoizedState = newState; @@ -19203,7 +22066,9 @@ var setSuspenseHandler = null; // Support DevTools props for function components, forwardRef, memo, host components, etc. overrideProps = function(fiber, path, value) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); if (fiber.alternate) { fiber.alternate.pendingProps = fiber.pendingProps; @@ -19212,7 +22077,9 @@ var setSuspenseHandler = null; }; scheduleUpdate = function(fiber) { - flushPassiveEffects(); + if (revertPassiveEffectsChange) { + flushPassiveEffects(); + } scheduleWork(fiber, Sync); }; @@ -19245,6 +22112,16 @@ function injectIntoDevTools(devToolsConfig) { return null; } return findFiberByHostInstance(instance); + }, + + // React Refresh + findHostInstancesForRefresh: findHostInstancesForRefresh, + scheduleRefresh: scheduleRefresh, + scheduleRoot: scheduleRoot, + setRefreshHandler: setRefreshHandler, + // Enables DevTools to append owner stacks to error messages in DEV mode. + getCurrentFiber: function() { + return current; } }) ); @@ -19337,7 +22214,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19385,7 +22262,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19448,7 +22325,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { return; } - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -19464,17 +22341,6 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { * Manipulation](docs/direct-manipulation.html)). */ setNativeProps: function(nativeProps) { - { - if (warnAboutDeprecatedSetNativeProps) { - warningWithoutStack$1( - false, - "Warning: Calling ref.setNativeProps(nativeProps) " + - "is deprecated and will be removed in a future release. " + - "Use the setNativeProps export from the react-native package instead." + - "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" - ); - } - } // Class components don't have viewConfig -> validateAttributes. // Nor does it make sense to set native props on a non-native component. // Instead, find the nearest host component and set props on it. @@ -19531,7 +22397,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, viewConfig.uiViewClassName, updatePayload @@ -19544,14 +22410,18 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { * will depend on the platform and type of view. */ focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, /** * Removes focus from an input or view. This is the opposite of `focus()`. */ blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; @@ -19569,7 +22439,7 @@ var NativeMethodsMixin = function(findNodeHandle, findHostInstance) { !NativeMethodsMixin_DEV.UNSAFE_componentWillReceiveProps ) ) { - throw ReactError("Do not override existing functions."); + throw ReactError(Error("Do not override existing functions.")); } })(); // TODO (bvaughn) Remove cWM and cWRP in a future version of React Native, @@ -19671,7 +22541,9 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { * declared in the base class need to be redeclared below. */ ReactNativeComponent.prototype.blur = function blur() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; /** @@ -19679,7 +22551,9 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { */ ReactNativeComponent.prototype.focus = function focus() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; /** @@ -19724,7 +22598,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19773,7 +22647,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); } else { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -19835,7 +22709,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { return; } - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -19854,18 +22728,6 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { ReactNativeComponent.prototype.setNativeProps = function setNativeProps( nativeProps ) { - { - if (warnAboutDeprecatedSetNativeProps) { - warningWithoutStack$1( - false, - "Warning: Calling ref.setNativeProps(nativeProps) " + - "is deprecated and will be removed in a future release. " + - "Use the setNativeProps export from the react-native package instead." + - "\n\timport {setNativeProps} from 'react-native';\n\tsetNativeProps(ref, nativeProps);\n" - ); - } - } - // Class components don't have viewConfig -> validateAttributes. // Nor does it make sense to set native props on a non-native component. // Instead, find the nearest host component and set props on it. @@ -19918,7 +22780,7 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, viewConfig.uiViewClassName, updatePayload @@ -19935,9 +22797,9 @@ var ReactNativeComponent = function(findNodeHandle, findHostInstance) { }; // Module provided by RN: -var emptyObject$1 = {}; +var emptyObject$2 = {}; { - Object.freeze(emptyObject$1); + Object.freeze(emptyObject$2); } var getInspectorDataForViewTag = void 0; @@ -19970,9 +22832,9 @@ var getInspectorDataForViewTag = void 0; var getHostProps = function(fiber) { var host = findCurrentHostFiber(fiber); if (host) { - return host.memoizedProps || emptyObject$1; + return host.memoizedProps || emptyObject$2; } - return emptyObject$1; + return emptyObject$2; }; var getHostNode = function(fiber, findNodeHandle) { @@ -19998,7 +22860,7 @@ var getInspectorDataForViewTag = void 0; getInspectorData: function(findNodeHandle) { return { measure: function(callback) { - return UIManager.measure( + return ReactNativePrivateInterface.UIManager.measure( getHostNode(fiber, findNodeHandle), callback ); @@ -20018,7 +22880,7 @@ var getInspectorDataForViewTag = void 0; if (!closestInstance) { return { hierarchy: [], - props: emptyObject$1, + props: emptyObject$2, selection: null, source: null }; @@ -20063,7 +22925,7 @@ function setNativeProps(handle, nativeProps) { // This is an expensive no-op for Android, and causes an unnecessary // view invalidation for certain components (eg RCTTextInput) on iOS. if (updatePayload != null) { - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( handle._nativeTag, handle.viewConfig.uiViewClassName, updatePayload @@ -20127,8 +22989,9 @@ function findNodeHandle(componentOrHandle) { setBatchingImplementation( batchedUpdates$1, - interactiveUpdates$1, - flushInteractiveUpdates$1 + discreteUpdates$1, + flushDiscreteUpdates, + batchedEventUpdates$1 ); function computeComponentStackForErrorReporting(reactTag) { @@ -20146,6 +23009,25 @@ var ReactNativeRenderer = { findNodeHandle: findNodeHandle, + dispatchCommand: function(handle, command, args) { + if (handle._nativeTag == null) { + !(handle._nativeTag != null) + ? warningWithoutStack$1( + false, + "dispatchCommand was called with a ref that isn't a " + + "native component. Use React.forwardRef to get access to the underlying native component" + ) + : void 0; + return; + } + + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, + setNativeProps: setNativeProps, render: function(element, containerTag, callback) { @@ -20154,7 +23036,7 @@ var ReactNativeRenderer = { if (!root) { // TODO (bvaughn): If we decide to keep the wrapper component, // We could create a wrapper for containerTag as well to reduce special casing. - root = createContainer(containerTag, false, false); + root = createContainer(containerTag, LegacyRoot, false); roots.set(containerTag, root); } updateContainer(element, root, null, callback); @@ -20174,7 +23056,7 @@ var ReactNativeRenderer = { ReactNativeRenderer.unmountComponentAtNode(containerTag); // Call back into native to remove all of the subviews from this container - UIManager.removeRootView(containerTag); + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); }, createPortal: function(children, containerTag) { var key = diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js new file mode 100644 index 00000000000000..bbf5d650790402 --- /dev/null +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -0,0 +1,7975 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +"use strict"; +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), + React = require("react"), + Scheduler = require("scheduler"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} +var eventPluginOrder = null, + namesToPlugins = {}; +function recomputePluginOrdering() { + if (eventPluginOrder) + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName], + pluginIndex = eventPluginOrder.indexOf(pluginName); + if (!(-1 < pluginIndex)) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + if (!plugins[pluginIndex]) { + if (!pluginModule.extractEvents) + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + plugins[pluginIndex] = pluginModule; + pluginIndex = pluginModule.eventTypes; + for (var eventName in pluginIndex) { + var JSCompiler_inline_result = void 0; + var dispatchConfig = pluginIndex[eventName], + pluginModule$jscomp$0 = pluginModule, + eventName$jscomp$0 = eventName; + if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) + ); + eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (JSCompiler_inline_result in phasedRegistrationNames) + phasedRegistrationNames.hasOwnProperty( + JSCompiler_inline_result + ) && + publishRegistrationName( + phasedRegistrationNames[JSCompiler_inline_result], + pluginModule$jscomp$0, + eventName$jscomp$0 + ); + JSCompiler_inline_result = !0; + } else + dispatchConfig.registrationName + ? (publishRegistrationName( + dispatchConfig.registrationName, + pluginModule$jscomp$0, + eventName$jscomp$0 + ), + (JSCompiler_inline_result = !0)) + : (JSCompiler_inline_result = !1); + if (!JSCompiler_inline_result) + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + } + } +} +function publishRegistrationName(registrationName, pluginModule) { + if (registrationNameModules[registrationName]) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + registrationNameModules[registrationName] = pluginModule; +} +var plugins = [], + eventNameDispatchConfigs = {}, + registrationNameModules = {}; +function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +} +var hasError = !1, + caughtError = null, + hasRethrowError = !1, + rethrowError = null, + reporter = { + onError: function(error) { + hasError = !0; + caughtError = error; + } + }; +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = !1; + caughtError = null; + invokeGuardedCallbackImpl.apply(reporter, arguments); +} +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + if (hasError) { + var error = caughtError; + hasError = !1; + caughtError = null; + } else + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); + } +} +var getFiberCurrentPropsFromNode = null, + getInstanceFromNode = null, + getNodeFromInstance = null; +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + event.currentTarget = null; +} +function executeDirectDispatch(event) { + var dispatchListener = event._dispatchListeners, + dispatchInstance = event._dispatchInstances; + if (Array.isArray(dispatchListener)) + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + dispatchListener = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return dispatchListener; +} +function accumulateInto(current, next) { + if (null == next) + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + if (null == current) return next; + if (Array.isArray(current)) { + if (Array.isArray(next)) return current.push.apply(current, next), current; + current.push(next); + return current; + } + return Array.isArray(next) ? [current].concat(next) : [current, next]; +} +function forEachAccumulated(arr, cb, scope) { + Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr); +} +var eventQueue = null; +function executeDispatchesAndReleaseTopLevel(e) { + if (e) { + var dispatchListeners = e._dispatchListeners, + dispatchInstances = e._dispatchInstances; + if (Array.isArray(dispatchListeners)) + for ( + var i = 0; + i < dispatchListeners.length && !e.isPropagationStopped(); + i++ + ) + executeDispatch(e, dispatchListeners[i], dispatchInstances[i]); + else + dispatchListeners && + executeDispatch(e, dispatchListeners, dispatchInstances); + e._dispatchListeners = null; + e._dispatchInstances = null; + e.isPersistent() || e.constructor.release(e); + } +} +var injection = { + injectEventPluginOrder: function(injectedEventPluginOrder) { + if (eventPluginOrder) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); + }, + injectEventPluginsByName: function(injectedNamesToPlugins) { + var isOrderingDirty = !1, + pluginName; + for (pluginName in injectedNamesToPlugins) + if (injectedNamesToPlugins.hasOwnProperty(pluginName)) { + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + if (namesToPlugins[pluginName]) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = !0; + } + } + isOrderingDirty && recomputePluginOrdering(); + } +}; +function getListener(inst, registrationName) { + var listener = inst.stateNode; + if (!listener) return null; + var props = getFiberCurrentPropsFromNode(listener); + if (!props) return null; + listener = props[registrationName]; + a: switch (registrationName) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + (props = !props.disabled) || + ((inst = inst.type), + (props = !( + "button" === inst || + "input" === inst || + "select" === inst || + "textarea" === inst + ))); + inst = !props; + break a; + default: + inst = !1; + } + if (inst) return null; + if (listener && "function" !== typeof listener) + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + return listener; +} +function getParent(inst) { + do inst = inst.return; + while (inst && 5 !== inst.tag); + return inst ? inst : null; +} +function traverseTwoPhase(inst, fn, arg) { + for (var path = []; inst; ) path.push(inst), (inst = getParent(inst)); + for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg); + for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg); +} +function accumulateDirectionalDispatches(inst, phase, event) { + if ( + (phase = getListener( + inst, + event.dispatchConfig.phasedRegistrationNames[phase] + )) + ) + (event._dispatchListeners = accumulateInto( + event._dispatchListeners, + phase + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + )); +} +function accumulateTwoPhaseDispatchesSingle(event) { + event && + event.dispatchConfig.phasedRegistrationNames && + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); +} +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + targetInst = targetInst ? getParent(targetInst) : null; + traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event); + } +} +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + var inst = event._targetInst; + if (inst && event && event.dispatchConfig.registrationName) { + var listener = getListener(inst, event.dispatchConfig.registrationName); + listener && + ((event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + ))); + } + } +} +function functionThatReturnsTrue() { + return !0; +} +function functionThatReturnsFalse() { + return !1; +} +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + dispatchConfig = this.constructor.Interface; + for (var propName in dispatchConfig) + dispatchConfig.hasOwnProperty(propName) && + ((targetInst = dispatchConfig[propName]) + ? (this[propName] = targetInst(nativeEvent)) + : "target" === propName + ? (this.target = nativeEventTarget) + : (this[propName] = nativeEvent[propName])); + this.isDefaultPrevented = (null != nativeEvent.defaultPrevented + ? nativeEvent.defaultPrevented + : !1 === nativeEvent.returnValue) + ? functionThatReturnsTrue + : functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = !0; + var event = this.nativeEvent; + event && + (event.preventDefault + ? event.preventDefault() + : "unknown" !== typeof event.returnValue && (event.returnValue = !1), + (this.isDefaultPrevented = functionThatReturnsTrue)); + }, + stopPropagation: function() { + var event = this.nativeEvent; + event && + (event.stopPropagation + ? event.stopPropagation() + : "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0), + (this.isPropagationStopped = functionThatReturnsTrue)); + }, + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + isPersistent: functionThatReturnsFalse, + destructor: function() { + var Interface = this.constructor.Interface, + propName; + for (propName in Interface) this[propName] = null; + this.nativeEvent = this._targetInst = this.dispatchConfig = null; + this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse; + this._dispatchInstances = this._dispatchListeners = null; + } +}); +SyntheticEvent.Interface = { + type: null, + target: null, + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; +SyntheticEvent.extend = function(Interface) { + function E() {} + function Class() { + return Super.apply(this, arguments); + } + var Super = this; + E.prototype = Super.prototype; + var prototype = new E(); + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + return Class; +}; +addEventPoolingTo(SyntheticEvent); +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + if (this.eventPool.length) { + var instance = this.eventPool.pop(); + this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; + } + return new this(dispatchConfig, targetInst, nativeEvent, nativeInst); +} +function releasePooledEvent(event) { + if (!(event instanceof this)) + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + event.destructor(); + 10 > this.eventPool.length && this.eventPool.push(event); +} +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} +var ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function() { + return null; + } +}); +function isStartish(topLevelType) { + return "topTouchStart" === topLevelType; +} +function isMoveish(topLevelType) { + return "topTouchMove" === topLevelType; +} +var startDependencies = ["topTouchStart"], + moveDependencies = ["topTouchMove"], + endDependencies = ["topTouchCancel", "topTouchEnd"], + touchBank = [], + touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 + }; +function timestampForTouch(touch) { + return touch.timeStamp || touch.timestamp; +} +function getTouchIdentifier(_ref) { + _ref = _ref.identifier; + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); + return _ref; +} +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch), + touchRecord = touchBank[identifier]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.startPageX = touch.pageX), + (touchRecord.startPageY = touch.pageY), + (touchRecord.startTimeStamp = timestampForTouch(touch)), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchRecord.previousPageX = touch.pageX), + (touchRecord.previousPageY = touch.pageY), + (touchRecord.previousTimeStamp = timestampForTouch(touch))) + : ((touchRecord = { + touchActive: !0, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }), + (touchBank[identifier] = touchRecord)); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch move without a touch start.\nTouch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !1), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch end without a touch start.\nTouch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, 20)); + 20 < touchBank.length && + (printed += " (original size: " + touchBank.length + ")"); + return printed; +} +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchMove); + else if (isStartish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchStart), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches && + (touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier); + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if ( + (nativeEvent.changedTouches.forEach(recordTouchEnd), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches) + ) + for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) + if ( + ((nativeEvent = touchBank[topLevelType]), + null != nativeEvent && nativeEvent.touchActive) + ) { + touchHistory.indexOfSingleActiveTouch = topLevelType; + break; + } + }, + touchHistory: touchHistory +}; +function accumulate(current, next) { + if (null == next) + throw ReactError( + Error("accumulate(...): Accumulated items must not be null or undefined.") + ); + return null == current + ? next + : Array.isArray(current) + ? current.concat(next) + : Array.isArray(next) + ? [current].concat(next) + : [current, next]; +} +var responderInst = null, + trackedTouchCount = 0; +function changeResponder(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (null !== ResponderEventPlugin.GlobalResponderHandler) + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); +} +var eventTypes = { + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: ["topScroll"] + }, + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: ["topSelectionChange"] + }, + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } + }, + ResponderEventPlugin = { + _getResponder: function() { + return responderInst; + }, + eventTypes: eventTypes, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) trackedTouchCount += 1; + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if (0 <= trackedTouchCount) --trackedTouchCount; + else + return ( + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ), + null + ); + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + if ( + targetInst && + (("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) || + (0 < trackedTouchCount && "topSelectionChange" === topLevelType) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ) { + var JSCompiler_temp = isStartish(topLevelType) + ? eventTypes.startShouldSetResponder + : isMoveish(topLevelType) + ? eventTypes.moveShouldSetResponder + : "topSelectionChange" === topLevelType + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; + if (responderInst) + b: { + var JSCompiler_temp$jscomp$0 = responderInst; + for ( + var depthA = 0, tempA = JSCompiler_temp$jscomp$0; + tempA; + tempA = getParent(tempA) + ) + depthA++; + tempA = 0; + for (var tempB = targetInst; tempB; tempB = getParent(tempB)) + tempA++; + for (; 0 < depthA - tempA; ) + (JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0)), + depthA--; + for (; 0 < tempA - depthA; ) + (targetInst = getParent(targetInst)), tempA--; + for (; depthA--; ) { + if ( + JSCompiler_temp$jscomp$0 === targetInst || + JSCompiler_temp$jscomp$0 === targetInst.alternate + ) + break b; + JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0); + targetInst = getParent(targetInst); + } + JSCompiler_temp$jscomp$0 = null; + } + else JSCompiler_temp$jscomp$0 = targetInst; + targetInst = JSCompiler_temp$jscomp$0 === responderInst; + JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp, + JSCompiler_temp$jscomp$0, + nativeEvent, + nativeEventTarget + ); + JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory; + targetInst + ? forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingleSkipTarget + ) + : forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingle + ); + b: { + JSCompiler_temp = JSCompiler_temp$jscomp$0._dispatchListeners; + targetInst = JSCompiler_temp$jscomp$0._dispatchInstances; + if (Array.isArray(JSCompiler_temp)) + for ( + depthA = 0; + depthA < JSCompiler_temp.length && + !JSCompiler_temp$jscomp$0.isPropagationStopped(); + depthA++ + ) { + if ( + JSCompiler_temp[depthA]( + JSCompiler_temp$jscomp$0, + targetInst[depthA] + ) + ) { + JSCompiler_temp = targetInst[depthA]; + break b; + } + } + else if ( + JSCompiler_temp && + JSCompiler_temp(JSCompiler_temp$jscomp$0, targetInst) + ) { + JSCompiler_temp = targetInst; + break b; + } + JSCompiler_temp = null; + } + JSCompiler_temp$jscomp$0._dispatchInstances = null; + JSCompiler_temp$jscomp$0._dispatchListeners = null; + JSCompiler_temp$jscomp$0.isPersistent() || + JSCompiler_temp$jscomp$0.constructor.release( + JSCompiler_temp$jscomp$0 + ); + JSCompiler_temp && JSCompiler_temp !== responderInst + ? ((JSCompiler_temp$jscomp$0 = void 0), + (targetInst = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (targetInst.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(targetInst, accumulateDirectDispatchesSingle), + (depthA = !0 === executeDirectDispatch(targetInst)), + responderInst + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (tempB = + !tempA._dispatchListeners || executeDirectDispatch(tempA)), + tempA.isPersistent() || tempA.constructor.release(tempA), + tempB + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + [targetInst, tempA] + )), + changeResponder(JSCompiler_temp, depthA)) + : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + JSCompiler_temp + )))) + : ((JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + targetInst + )), + changeResponder(JSCompiler_temp, depthA)), + (JSCompiler_temp = JSCompiler_temp$jscomp$0)) + : (JSCompiler_temp = null); + } else JSCompiler_temp = null; + JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); + targetInst = responderInst && isMoveish(topLevelType); + depthA = + responderInst && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); + if ( + (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 + ? eventTypes.responderStart + : targetInst + ? eventTypes.responderMove + : depthA + ? eventTypes.responderEnd + : null) + ) + (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp$jscomp$0, + responderInst, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp = accumulate( + JSCompiler_temp, + JSCompiler_temp$jscomp$0 + )); + JSCompiler_temp$jscomp$0 = + responderInst && "topTouchCancel" === topLevelType; + if ( + (topLevelType = + responderInst && + !JSCompiler_temp$jscomp$0 && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType)) + ) + a: { + if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) + for (targetInst = 0; targetInst < topLevelType.length; targetInst++) + if ( + ((depthA = topLevelType[targetInst].target), + null !== depthA && void 0 !== depthA && 0 !== depthA) + ) { + tempA = getInstanceFromNode(depthA); + b: { + for (depthA = responderInst; tempA; ) { + if (depthA === tempA || depthA === tempA.alternate) { + depthA = !0; + break b; + } + tempA = getParent(tempA); + } + depthA = !1; + } + if (depthA) { + topLevelType = !1; + break a; + } + } + topLevelType = !0; + } + if ( + (topLevelType = JSCompiler_temp$jscomp$0 + ? eventTypes.responderTerminate + : topLevelType + ? eventTypes.responderRelease + : null) + ) + (nativeEvent = ResponderSyntheticEvent.getPooled( + topLevelType, + responderInst, + nativeEvent, + nativeEventTarget + )), + (nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), + (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), + changeResponder(null); + return JSCompiler_temp; + }, + GlobalResponderHandler: null, + injection: { + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } + }, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (null == targetInst) return null; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; + if (!bubbleDispatchConfig && !directDispatchConfig) + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + topLevelType = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) + forEachAccumulated(topLevelType, accumulateTwoPhaseDispatchesSingle); + else if (directDispatchConfig) + forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle); + else return null; + return topLevelType; + } + } +}); +var instanceCache = new Map(), + instanceProps = new Map(); +function getInstanceFromTag(tag) { + return instanceCache.get(tag) || null; +} +var restoreTarget = null, + restoreQueue = null; +function restoreStateOfTarget(target) { + if (getInstanceFromNode(target)) + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +require("../shims/ReactFeatureFlags"); +function batchedUpdatesImpl(fn, bookkeeping) { + return fn(bookkeeping); +} +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) + if ( + (flushDiscreteUpdatesImpl(), + restoreTarget && + ((bookkeeping = restoreTarget), + (fn = restoreQueue), + (restoreQueue = restoreTarget = null), + restoreStateOfTarget(bookkeeping), + fn)) + ) + for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++) + restoreStateOfTarget(fn[bookkeeping]); + } +} +var EMPTY_NATIVE_EVENT = {}; +function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { + var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT, + inst = getInstanceFromTag(rootNodeID); + batchedUpdates(function() { + var events = nativeEvent.target; + for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { + var possiblePlugin = plugins[i]; + possiblePlugin && + (possiblePlugin = possiblePlugin.extractEvents( + topLevelType, + inst, + nativeEvent, + events + )) && + (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); + } + events = events$jscomp$0; + null !== events && (eventQueue = accumulateInto(eventQueue, events)); + events = eventQueue; + eventQueue = null; + if (events) { + forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); + if (eventQueue) + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + if (hasRethrowError) + throw ((events = rethrowError), + (hasRethrowError = !1), + (rethrowError = null), + events); + } + }); +} +ReactNativePrivateInterface.RCTEventEmitter.register({ + receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) { + _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); + }, + receiveTouches: function(eventTopLevelType, touches, changedIndices) { + if ( + "topTouchEnd" === eventTopLevelType || + "topTouchCancel" === eventTopLevelType + ) { + var JSCompiler_temp = []; + for (var i = 0; i < changedIndices.length; i++) { + var index = changedIndices[i]; + JSCompiler_temp.push(touches[index]); + touches[index] = null; + } + for (i = changedIndices = 0; i < touches.length; i++) + (index = touches[i]), + null !== index && (touches[changedIndices++] = index); + touches.length = changedIndices; + } else + for (JSCompiler_temp = [], i = 0; i < changedIndices.length; i++) + JSCompiler_temp.push(touches[changedIndices[i]]); + for ( + changedIndices = 0; + changedIndices < JSCompiler_temp.length; + changedIndices++ + ) { + i = JSCompiler_temp[changedIndices]; + i.changedTouches = JSCompiler_temp; + i.touches = touches; + index = null; + var target = i.target; + null === target || void 0 === target || 1 > target || (index = target); + _receiveRootNodeIDEvent(index, eventTopLevelType, i); + } + } +}); +getFiberCurrentPropsFromNode = function(stateNode) { + return instanceProps.get(stateNode._nativeTag) || null; +}; +getInstanceFromNode = getInstanceFromTag; +getNodeFromInstance = function(inst) { + var tag = inst.stateNode._nativeTag; + void 0 === tag && (tag = inst.stateNode.canonical._nativeTag); + if (!tag) throw ReactError(Error("All native instances should have a tag.")); + return tag; +}; +ResponderEventPlugin.injection.injectGlobalResponderHandler({ + onChange: function(from, to, blockNativeResponder) { + null !== to + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); + } +}); +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || + (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); +var hasSymbol = "function" === typeof Symbol && Symbol.for, + REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, + REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, + REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, + REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, + REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114, + REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109, + REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, + REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 60111, + REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, + REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, + REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, + REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); +var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +function getComponentName(type) { + if (null == type) return null; + if ("function" === typeof type) return type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + innerType = innerType.displayName || innerType.name || ""; + return ( + type.displayName || + ("" !== innerType ? "ForwardRef(" + innerType + ")" : "ForwardRef") + ); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: + if ((type = 1 === type._status ? type._result : null)) + return getComponentName(type); + } + return null; +} +function isFiberMountedImpl(fiber) { + var node = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + if (0 !== (node.effectTag & 2)) return 1; + for (; node.return; ) + if (((node = node.return), 0 !== (node.effectTag & 2))) return 1; + } + return 3 === node.tag ? 2 : 3; +} +function assertIsMounted(fiber) { + if (2 !== isFiberMountedImpl(fiber)) + throw ReactError(Error("Unable to find node on an unmounted component.")); +} +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = isFiberMountedImpl(fiber); + if (3 === alternate) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return 1 === alternate ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + } + if (a.alternate !== b) + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (3 !== a.tag) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return a.stateNode.current === a ? fiber : alternate; +} +function findCurrentHostFiber(parent) { + parent = findCurrentFiberUsingSlowPath(parent); + if (!parent) return null; + for (var node = parent; ; ) { + if (5 === node.tag || 6 === node.tag) return node; + if (node.child) (node.child.return = node), (node = node.child); + else { + if (node === parent) break; + for (; !node.sibling; ) { + if (!node.return || node.return === parent) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return null; +} +var emptyObject = {}, + removedKeys = null, + removedKeyCount = 0; +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) + for (var i = node.length; i-- && 0 < removedKeyCount; ) + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + else if (node && 0 < removedKeyCount) + for (i in removedKeys) + if (removedKeys[i]) { + var nextProp = node[i]; + if (void 0 !== nextProp) { + var attributeConfig = validAttributes[i]; + if (attributeConfig) { + "function" === typeof nextProp && (nextProp = !0); + "undefined" === typeof nextProp && (nextProp = null); + if ("object" !== typeof attributeConfig) + updatePayload[i] = nextProp; + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (nextProp = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[i] = nextProp); + removedKeys[i] = !1; + removedKeyCount--; + } + } + } +} +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) return updatePayload; + if (!prevProp || !nextProp) + return nextProp + ? addNestedProperty(updatePayload, nextProp, validAttributes) + : prevProp + ? clearNestedProperty(updatePayload, prevProp, validAttributes) + : updatePayload; + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + var minLength = + prevProp.length < nextProp.length ? prevProp.length : nextProp.length, + i; + for (i = 0; i < minLength; i++) + updatePayload = diffNestedProperty( + updatePayload, + prevProp[i], + nextProp[i], + validAttributes + ); + for (; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + for (; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; + } + return Array.isArray(prevProp) + ? diffProperties( + updatePayload, + ReactNativePrivateInterface.flattenStyle(prevProp), + nextProp, + validAttributes + ) + : diffProperties( + updatePayload, + prevProp, + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) return updatePayload; + if (!Array.isArray(nextProp)) + return diffProperties( + updatePayload, + emptyObject, + nextProp, + validAttributes + ); + for (var i = 0; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; +} +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) return updatePayload; + if (!Array.isArray(prevProp)) + return diffProperties( + updatePayload, + prevProp, + emptyObject, + validAttributes + ); + for (var i = 0; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + return updatePayload; +} +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig, propKey; + for (propKey in nextProps) + if ((attributeConfig = validAttributes[propKey])) { + var prevProp = prevProps[propKey]; + var nextProp = nextProps[propKey]; + "function" === typeof nextProp && + ((nextProp = !0), "function" === typeof prevProp && (prevProp = !0)); + "undefined" === typeof nextProp && + ((nextProp = null), + "undefined" === typeof prevProp && (prevProp = null)); + removedKeys && (removedKeys[propKey] = !1); + if (updatePayload && void 0 !== updatePayload[propKey]) + if ("object" !== typeof attributeConfig) + updatePayload[propKey] = nextProp; + else { + if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[propKey] = attributeConfig); + } + else if (prevProp !== nextProp) + if ("object" !== typeof attributeConfig) + ("object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && + ((updatePayload || (updatePayload = {}))[propKey] = nextProp); + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) { + if ( + void 0 === prevProp || + ("function" === typeof attributeConfig.diff + ? attributeConfig.diff(prevProp, nextProp) + : "object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + ((updatePayload || (updatePayload = {}))[ + propKey + ] = attributeConfig); + } else + (removedKeys = null), + (removedKeyCount = 0), + (updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + )), + 0 < removedKeyCount && + updatePayload && + (restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ), + (removedKeys = null)); + } + for (var _propKey in prevProps) + void 0 === nextProps[_propKey] && + (!(attributeConfig = validAttributes[_propKey]) || + (updatePayload && void 0 !== updatePayload[_propKey]) || + ((prevProp = prevProps[_propKey]), + void 0 !== prevProp && + ("object" !== typeof attributeConfig || + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ? (((updatePayload || (updatePayload = {}))[_propKey] = null), + removedKeys || (removedKeys = {}), + removedKeys[_propKey] || + ((removedKeys[_propKey] = !0), removedKeyCount++)) + : (updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ))))); + return updatePayload; +} +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if ( + callback && + ("boolean" !== typeof context.__isMounted || context.__isMounted) + ) + return callback.apply(context, arguments); + }; +} +var ReactNativeFiberHostComponent = (function() { + function ReactNativeFiberHostComponent(tag, viewConfig) { + if (!(this instanceof ReactNativeFiberHostComponent)) + throw new TypeError("Cannot call a class as a function"); + this._nativeTag = tag; + this._children = []; + this.viewConfig = viewConfig; + } + ReactNativeFiberHostComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + ReactNativeFiberHostComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + ReactNativeFiberHostComponent.prototype.measure = function(callback) { + ReactNativePrivateInterface.UIManager.measure( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactNativeFiberHostComponent.prototype.measureInWindow = function(callback) { + ReactNativePrivateInterface.UIManager.measureInWindow( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactNativeFiberHostComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var relativeNode = void 0; + "number" === typeof relativeToNativeNode + ? (relativeNode = relativeToNativeNode) + : relativeToNativeNode._nativeTag + ? (relativeNode = relativeToNativeNode._nativeTag) + : relativeToNativeNode.canonical && + relativeToNativeNode.canonical._nativeTag && + (relativeNode = relativeToNativeNode.canonical._nativeTag); + null != relativeNode && + ReactNativePrivateInterface.UIManager.measureLayout( + this._nativeTag, + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + ReactNativeFiberHostComponent.prototype.setNativeProps = function( + nativeProps + ) { + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + this.viewConfig.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + this._nativeTag, + this.viewConfig.uiViewClassName, + nativeProps + ); + }; + return ReactNativeFiberHostComponent; +})(); +function shim$1() { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + UPDATE_SIGNAL = {}, + nextReactTag = 3; +function allocateTag() { + var tag = nextReactTag; + 1 === tag % 10 && (tag += 2); + nextReactTag = tag + 2; + return tag; +} +function recursivelyUncacheFiberNode(node) { + if ("number" === typeof node) + instanceCache.delete(node), instanceProps.delete(node); + else { + var tag = node._nativeTag; + instanceCache.delete(tag); + instanceProps.delete(tag); + node._children.forEach(recursivelyUncacheFiberNode); + } +} +function finalizeInitialChildren(parentInstance) { + if (0 === parentInstance._children.length) return !1; + var nativeTags = parentInstance._children.map(function(child) { + return "number" === typeof child ? child : child._nativeTag; + }); + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance._nativeTag, + nativeTags + ); + return !1; +} +var scheduleTimeout = setTimeout, + cancelTimeout = clearTimeout, + BEFORE_SLASH_RE = /^(.*)[\\\/]/; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + do { + a: switch (workInProgress.tag) { + case 3: + case 4: + case 6: + case 7: + case 10: + case 9: + var JSCompiler_inline_result = ""; + break a; + default: + var owner = workInProgress._debugOwner, + source = workInProgress._debugSource, + name = getComponentName(workInProgress.type); + JSCompiler_inline_result = null; + owner && (JSCompiler_inline_result = getComponentName(owner.type)); + owner = name; + name = ""; + source + ? (name = + " (at " + + source.fileName.replace(BEFORE_SLASH_RE, "") + + ":" + + source.lineNumber + + ")") + : JSCompiler_inline_result && + (name = " (created by " + JSCompiler_inline_result + ")"); + JSCompiler_inline_result = "\n in " + (owner || "Unknown") + name; + } + info += JSCompiler_inline_result; + workInProgress = workInProgress.return; + } while (workInProgress); + return info; +} +new Set(); +var valueStack = [], + index = -1; +function pop(cursor) { + 0 > index || + ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); +} +function push(cursor, value) { + index++; + valueStack[index] = cursor.current; + cursor.current = value; +} +var emptyContextObject = {}, + contextStackCursor = { current: emptyContextObject }, + didPerformWorkStackCursor = { current: !1 }, + previousContext = emptyContextObject; +function getMaskedContext(workInProgress, unmaskedContext) { + var contextTypes = workInProgress.type.contextTypes; + if (!contextTypes) return emptyContextObject; + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) + return instance.__reactInternalMemoizedMaskedChildContext; + var context = {}, + key; + for (key in contextTypes) context[key] = unmaskedContext[key]; + instance && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return context; +} +function isContextProvider(type) { + type = type.childContextTypes; + return null !== type && void 0 !== type; +} +function popContext(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function popTopLevelContextObject(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function pushTopLevelContextObject(fiber, context, didChange) { + if (contextStackCursor.current !== emptyContextObject) + throw ReactError( + Error( + "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(fiber, type, parentContext) { + var instance = fiber.stateNode; + fiber = type.childContextTypes; + if ("function" !== typeof instance.getChildContext) return parentContext; + instance = instance.getChildContext(); + for (var contextKey in instance) + if (!(contextKey in fiber)) + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + return Object.assign({}, parentContext, instance); +} +function pushContextProvider(workInProgress) { + var instance = workInProgress.stateNode; + instance = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + previousContext = contextStackCursor.current; + push(contextStackCursor, instance, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + return !0; +} +function invalidateContextProvider(workInProgress, type, didChange) { + var instance = workInProgress.stateNode; + if (!instance) + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + didChange + ? ((type = processChildContext(workInProgress, type, previousContext)), + (instance.__reactInternalMemoizedMergedChildContext = type), + pop(didPerformWorkStackCursor, workInProgress), + pop(contextStackCursor, workInProgress), + push(contextStackCursor, type, workInProgress)) + : pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); +} +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, + Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, + Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, + Scheduler_now = Scheduler.unstable_now, + Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel, + Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, + Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, + Scheduler_LowPriority = Scheduler.unstable_LowPriority, + Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, + fakeCallbackNode = {}, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, + immediateQueueCallbackNode = null, + isFlushingSyncQueue = !1, + initialTimeMs = Scheduler_now(), + now = + 1e4 > initialTimeMs + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return 99; + case Scheduler_UserBlockingPriority: + return 98; + case Scheduler_NormalPriority: + return 97; + case Scheduler_LowPriority: + return 96; + case Scheduler_IdlePriority: + return 95; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case 99: + return Scheduler_ImmediatePriority; + case 98: + return Scheduler_UserBlockingPriority; + case 97: + return Scheduler_NormalPriority; + case 96: + return Scheduler_LowPriority; + case 95: + return Scheduler_IdlePriority; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function runWithPriority(reactPriorityLevel, fn) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(reactPriorityLevel, fn); +} +function scheduleCallback(reactPriorityLevel, callback, options) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); +} +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { + null !== immediateQueueCallbackNode && + Scheduler_cancelCallback(immediateQueueCallbackNode); + flushSyncCallbackQueueImpl(); +} +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0; + try { + var queue = syncQueue; + runWithPriority(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ), + error); + } finally { + isFlushingSyncQueue = !1; + } + } +} +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (1073741823 === expirationTime) return 99; + if (1 === expirationTime) return 95; + currentTime = + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); + return 0 >= currentTime + ? 99 + : 250 >= currentTime + ? 98 + : 5250 >= currentTime + ? 97 + : 95; +} +function is(x, y) { + return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function shallowEqual(objA, objB) { + if (is(objA, objB)) return !0; + if ( + "object" !== typeof objA || + null === objA || + "object" !== typeof objB || + null === objB + ) + return !1; + var keysA = Object.keys(objA), + keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) + if ( + !hasOwnProperty.call(objB, keysA[keysB]) || + !is(objA[keysA[keysB]], objB[keysA[keysB]]) + ) + return !1; + return !0; +} +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + baseProps = Object.assign({}, baseProps); + Component = Component.defaultProps; + for (var propName in Component) + void 0 === baseProps[propName] && + (baseProps[propName] = Component[propName]); + } + return baseProps; +} +function readLazyComponentType(lazyComponent) { + var result = lazyComponent._result; + switch (lazyComponent._status) { + case 1: + return result; + case 2: + throw result; + case 0: + throw result; + default: + lazyComponent._status = 0; + result = lazyComponent._ctor; + result = result(); + result.then( + function(moduleObject) { + 0 === lazyComponent._status && + ((moduleObject = moduleObject.default), + (lazyComponent._status = 1), + (lazyComponent._result = moduleObject)); + }, + function(error) { + 0 === lazyComponent._status && + ((lazyComponent._status = 2), (lazyComponent._result = error)); + } + ); + switch (lazyComponent._status) { + case 1: + return lazyComponent._result; + case 2: + throw lazyComponent._result; + } + lazyComponent._result = result; + throw result; + } +} +var valueCursor = { current: null }, + currentlyRenderingFiber = null, + lastContextDependency = null, + lastContextWithAllBitsObserved = null; +function resetContextDependencies() { + lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; +} +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; +} +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + providerFiber.type._context._currentValue = currentValue; +} +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextWithAllBitsObserved = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context, observedBits) { + if ( + lastContextWithAllBitsObserved !== context && + !1 !== observedBits && + 0 !== observedBits + ) { + if ("number" !== typeof observedBits || 1073741823 === observedBits) + (lastContextWithAllBitsObserved = context), (observedBits = 1073741823); + observedBits = { context: context, observedBits: observedBits, next: null }; + if (null === lastContextDependency) { + if (null === currentlyRenderingFiber) + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + lastContextDependency = observedBits; + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null + }; + } else lastContextDependency = lastContextDependency.next = observedBits; + } + return context._currentValue; +} +var hasForceUpdate = !1; +function createUpdateQueue(baseState) { + return { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function cloneUpdateQueue(currentQueue) { + return { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function createUpdate(expirationTime, suspenseConfig) { + return { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + tag: 0, + payload: null, + callback: null, + next: null, + nextEffect: null + }; +} +function appendUpdateToQueue(queue, update) { + null === queue.lastUpdate + ? (queue.firstUpdate = queue.lastUpdate = update) + : ((queue.lastUpdate.next = update), (queue.lastUpdate = update)); +} +function enqueueUpdate(fiber, update) { + var alternate = fiber.alternate; + if (null === alternate) { + var queue1 = fiber.updateQueue; + var queue2 = null; + null === queue1 && + (queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState)); + } else + (queue1 = fiber.updateQueue), + (queue2 = alternate.updateQueue), + null === queue1 + ? null === queue2 + ? ((queue1 = fiber.updateQueue = createUpdateQueue( + fiber.memoizedState + )), + (queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ))) + : (queue1 = fiber.updateQueue = cloneUpdateQueue(queue2)) + : null === queue2 && + (queue2 = alternate.updateQueue = cloneUpdateQueue(queue1)); + null === queue2 || queue1 === queue2 + ? appendUpdateToQueue(queue1, update) + : null === queue1.lastUpdate || null === queue2.lastUpdate + ? (appendUpdateToQueue(queue1, update), + appendUpdateToQueue(queue2, update)) + : (appendUpdateToQueue(queue1, update), (queue2.lastUpdate = update)); +} +function enqueueCapturedUpdate(workInProgress, update) { + var workInProgressQueue = workInProgress.updateQueue; + workInProgressQueue = + null === workInProgressQueue + ? (workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + )) + : ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue); + null === workInProgressQueue.lastCapturedUpdate + ? (workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update) + : ((workInProgressQueue.lastCapturedUpdate.next = update), + (workInProgressQueue.lastCapturedUpdate = update)); +} +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + null !== current && + queue === current.updateQueue && + (queue = workInProgress.updateQueue = cloneUpdateQueue(queue)); + return queue; +} +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case 1: + return ( + (workInProgress = update.payload), + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress + ); + case 3: + workInProgress.effectTag = (workInProgress.effectTag & -2049) | 64; + case 0: + workInProgress = update.payload; + nextProps = + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress; + if (null === nextProps || void 0 === nextProps) break; + return Object.assign({}, prevState, nextProps); + case 2: + hasForceUpdate = !0; + } + return prevState; +} +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = !1; + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + for ( + var newBaseState = queue.baseState, + newFirstUpdate = null, + newExpirationTime = 0, + update = queue.firstUpdate, + resultState = newBaseState; + null !== update; + + ) { + var updateExpirationTime = update.expirationTime; + updateExpirationTime < renderExpirationTime + ? (null === newFirstUpdate && + ((newFirstUpdate = update), (newBaseState = resultState)), + newExpirationTime < updateExpirationTime && + (newExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), + (resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastEffect + ? (queue.firstEffect = queue.lastEffect = update) + : ((queue.lastEffect.nextEffect = update), + (queue.lastEffect = update)))); + update = update.next; + } + updateExpirationTime = null; + for (update = queue.firstCapturedUpdate; null !== update; ) { + var _updateExpirationTime = update.expirationTime; + _updateExpirationTime < renderExpirationTime + ? (null === updateExpirationTime && + ((updateExpirationTime = update), + null === newFirstUpdate && (newBaseState = resultState)), + newExpirationTime < _updateExpirationTime && + (newExpirationTime = _updateExpirationTime)) + : ((resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastCapturedEffect + ? (queue.firstCapturedEffect = queue.lastCapturedEffect = update) + : ((queue.lastCapturedEffect.nextEffect = update), + (queue.lastCapturedEffect = update)))); + update = update.next; + } + null === newFirstUpdate && (queue.lastUpdate = null); + null === updateExpirationTime + ? (queue.lastCapturedUpdate = null) + : (workInProgress.effectTag |= 32); + null === newFirstUpdate && + null === updateExpirationTime && + (newBaseState = resultState); + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = updateExpirationTime; + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; +} +function commitUpdateQueue(finishedWork, finishedQueue, instance) { + null !== finishedQueue.firstCapturedUpdate && + (null !== finishedQueue.lastUpdate && + ((finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate), + (finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate)), + (finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null)); + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} +function commitUpdateEffects(effect, instance) { + for (; null !== effect; ) { + var _callback3 = effect.callback; + if (null !== _callback3) { + effect.callback = null; + var context = instance; + if ("function" !== typeof _callback3) + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) + ); + _callback3.call(context); + } + effect = effect.nextEffect; + } +} +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + ctor = workInProgress.memoizedState; + getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor); + getDerivedStateFromProps = + null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps + ? ctor + : Object.assign({}, ctor, getDerivedStateFromProps); + workInProgress.memoizedState = getDerivedStateFromProps; + nextProps = workInProgress.updateQueue; + null !== nextProps && + 0 === workInProgress.expirationTime && + (nextProps.baseState = getDerivedStateFromProps); +} +var classComponentUpdater = { + isMounted: function(component) { + return (component = component._reactInternalFiber) + ? 2 === isFiberMountedImpl(component) + : !1; + }, + enqueueSetState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueForceUpdate: function(inst, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + } +}; +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + workInProgress = workInProgress.stateNode; + return "function" === typeof workInProgress.shouldComponentUpdate + ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext) + : ctor.prototype && ctor.prototype.isPureReactComponent + ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + : !0; +} +function constructClassInstance(workInProgress, ctor, props) { + var isLegacyContextConsumer = !1, + unmaskedContext = emptyContextObject; + var context = ctor.contextType; + "object" === typeof context && null !== context + ? (context = readContext(context)) + : ((unmaskedContext = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (isLegacyContextConsumer = ctor.contextTypes), + (context = (isLegacyContextConsumer = + null !== isLegacyContextConsumer && void 0 !== isLegacyContextConsumer) + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject)); + ctor = new ctor(props, context); + workInProgress.memoizedState = + null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; + ctor.updater = classComponentUpdater; + workInProgress.stateNode = ctor; + ctor._reactInternalFiber = workInProgress; + isLegacyContextConsumer && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return ctor; +} +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + workInProgress = instance.state; + "function" === typeof instance.componentWillReceiveProps && + instance.componentWillReceiveProps(newProps, nextContext); + "function" === typeof instance.UNSAFE_componentWillReceiveProps && + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + instance.state !== workInProgress && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); +} +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + var contextType = ctor.contextType; + "object" === typeof contextType && null !== contextType + ? (instance.context = readContext(contextType)) + : ((contextType = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (instance.context = getMaskedContext(workInProgress, contextType))); + contextType = workInProgress.updateQueue; + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState)); + contextType = ctor.getDerivedStateFromProps; + "function" === typeof contextType && + (applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps), + (instance.state = workInProgress.memoizedState)); + "function" === typeof ctor.getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ((ctor = instance.state), + "function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount(), + ctor !== instance.state && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null), + (contextType = workInProgress.updateQueue), + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState))); + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4); +} +var isArray = Array.isArray; +function coerceRef(returnFiber, current$$1, element) { + returnFiber = element.ref; + if ( + null !== returnFiber && + "function" !== typeof returnFiber && + "object" !== typeof returnFiber + ) { + if (element._owner) { + element = element._owner; + var inst = void 0; + if (element) { + if (1 !== element.tag) + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + inst = element.stateNode; + } + if (!inst) + throw ReactError( + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + var stringRef = "" + returnFiber; + if ( + null !== current$$1 && + null !== current$$1.ref && + "function" === typeof current$$1.ref && + current$$1.ref._stringRef === stringRef + ) + return current$$1.ref; + current$$1 = function(value) { + var refs = inst.refs; + refs === emptyRefsObject && (refs = inst.refs = {}); + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + }; + current$$1._stringRef = stringRef; + return current$$1; + } + if ("string" !== typeof returnFiber) + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + if (!element._owner) + throw ReactError( + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + return returnFiber; +} +function throwOnInvalidObjectType(returnFiber, newChild) { + if ("textarea" !== returnFiber.type) + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) + ); +} +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (shouldTrackSideEffects) { + var last = returnFiber.lastEffect; + null !== last + ? ((last.nextEffect = childToDelete), + (returnFiber.lastEffect = childToDelete)) + : (returnFiber.firstEffect = returnFiber.lastEffect = childToDelete); + childToDelete.nextEffect = null; + childToDelete.effectTag = 8; + } + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) return null; + for (; null !== currentFirstChild; ) + deleteChild(returnFiber, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return null; + } + function mapRemainingChildren(returnFiber, currentFirstChild) { + for (returnFiber = new Map(); null !== currentFirstChild; ) + null !== currentFirstChild.key + ? returnFiber.set(currentFirstChild.key, currentFirstChild) + : returnFiber.set(currentFirstChild.index, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return returnFiber; + } + function useFiber(fiber, pendingProps, expirationTime) { + fiber = createWorkInProgress(fiber, pendingProps, expirationTime); + fiber.index = 0; + fiber.sibling = null; + return fiber; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) return lastPlacedIndex; + newIndex = newFiber.alternate; + if (null !== newIndex) + return ( + (newIndex = newIndex.index), + newIndex < lastPlacedIndex + ? ((newFiber.effectTag = 2), lastPlacedIndex) + : newIndex + ); + newFiber.effectTag = 2; + return lastPlacedIndex; + } + function placeSingleChild(newFiber) { + shouldTrackSideEffects && + null === newFiber.alternate && + (newFiber.effectTag = 2); + return newFiber; + } + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (null === current$$1 || 6 !== current$$1.tag) + return ( + (current$$1 = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, textContent, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateElement(returnFiber, current$$1, element, expirationTime) { + if (null !== current$$1 && current$$1.elementType === element.type) + return ( + (expirationTime = useFiber(current$$1, element.props, expirationTime)), + (expirationTime.ref = coerceRef(returnFiber, current$$1, element)), + (expirationTime.return = returnFiber), + expirationTime + ); + expirationTime = createFiberFromTypeAndProps( + element.type, + element.key, + element.props, + null, + returnFiber.mode, + expirationTime + ); + expirationTime.ref = coerceRef(returnFiber, current$$1, element); + expirationTime.return = returnFiber; + return expirationTime; + } + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + null === current$$1 || + 4 !== current$$1.tag || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) + return ( + (current$$1 = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, portal.children || [], expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (null === current$$1 || 7 !== current$$1.tag) + return ( + (current$$1 = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, fragment, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function createChild(returnFiber, newChild, expirationTime) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef(returnFiber, null, newChild)), + (expirationTime.return = returnFiber), + expirationTime + ); + case REACT_PORTAL_TYPE: + return ( + (newChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (newChild = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + )), + (newChild.return = returnFiber), + newChild + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + var key = null !== oldFiber ? oldFiber.key : null; + if ("string" === typeof newChild || "number" === typeof newChild) + return null !== key + ? null + : updateTextNode(returnFiber, oldFiber, "" + newChild, expirationTime); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return newChild.key === key + ? newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ) + : updateElement(returnFiber, oldFiber, newChild, expirationTime) + : null; + case REACT_PORTAL_TYPE: + return newChild.key === key + ? updatePortal(returnFiber, oldFiber, newChild, expirationTime) + : null; + } + if (isArray(newChild) || getIteratorFn(newChild)) + return null !== key + ? null + : updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateTextNode( + returnFiber, + existingChildren, + "" + newChild, + expirationTime + ) + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + existingChildren, + newChild.props.children, + expirationTime, + newChild.key + ) + : updateElement( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + updatePortal( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateFragment( + returnFiber, + existingChildren, + newChild, + expirationTime, + null + ) + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + for ( + var resultingFirstChild = null, + previousNewFiber = null, + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null; + null !== oldFiber && newIdx < newChildren.length; + newIdx++ + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (resultingFirstChild = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) + return ( + deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild + ); + if (null === oldFiber) { + for (; newIdx < newChildren.length; newIdx++) + (oldFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + )), + null !== oldFiber && + ((currentFirstChild = placeChild( + oldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = oldFiber) + : (previousNewFiber.sibling = oldFiber), + (previousNewFiber = oldFiber)); + return resultingFirstChild; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + newIdx < newChildren.length; + newIdx++ + ) + (nextOldFiber = updateFromMap( + oldFiber, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + )), + null !== nextOldFiber && + (shouldTrackSideEffects && + null !== nextOldFiber.alternate && + oldFiber.delete( + null === nextOldFiber.key ? newIdx : nextOldFiber.key + ), + (currentFirstChild = placeChild( + nextOldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = nextOldFiber) + : (previousNewFiber.sibling = nextOldFiber), + (previousNewFiber = nextOldFiber)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + var iteratorFn = getIteratorFn(newChildrenIterable); + if ("function" !== typeof iteratorFn) + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + newChildrenIterable = iteratorFn.call(newChildrenIterable); + if (null == newChildrenIterable) + throw ReactError(Error("An iterable object provided no iterator.")); + for ( + var previousNewFiber = (iteratorFn = null), + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null, + step = newChildrenIterable.next(); + null !== oldFiber && !step.done; + newIdx++, step = newChildrenIterable.next() + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (iteratorFn = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) + return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn; + if (null === oldFiber) { + for (; !step.done; newIdx++, step = newChildrenIterable.next()) + (step = createChild(returnFiber, step.value, expirationTime)), + null !== step && + ((currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + return iteratorFn; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + !step.done; + newIdx++, step = newChildrenIterable.next() + ) + (step = updateFromMap( + oldFiber, + returnFiber, + newIdx, + step.value, + expirationTime + )), + null !== step && + (shouldTrackSideEffects && + null !== step.alternate && + oldFiber.delete(null === step.key ? newIdx : step.key), + (currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return iteratorFn; + } + return function(returnFiber, currentFirstChild, newChild, expirationTime) { + var isUnkeyedTopLevelFragment = + "object" === typeof newChild && + null !== newChild && + newChild.type === REACT_FRAGMENT_TYPE && + null === newChild.key; + isUnkeyedTopLevelFragment && (newChild = newChild.props.children); + var isObject = "object" === typeof newChild && null !== newChild; + if (isObject) + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + a: { + isObject = newChild.key; + for ( + isUnkeyedTopLevelFragment = currentFirstChild; + null !== isUnkeyedTopLevelFragment; + + ) { + if (isUnkeyedTopLevelFragment.key === isObject) { + if ( + 7 === isUnkeyedTopLevelFragment.tag + ? newChild.type === REACT_FRAGMENT_TYPE + : isUnkeyedTopLevelFragment.elementType === newChild.type + ) { + deleteRemainingChildren( + returnFiber, + isUnkeyedTopLevelFragment.sibling + ); + currentFirstChild = useFiber( + isUnkeyedTopLevelFragment, + newChild.type === REACT_FRAGMENT_TYPE + ? newChild.props.children + : newChild.props, + expirationTime + ); + currentFirstChild.ref = coerceRef( + returnFiber, + isUnkeyedTopLevelFragment, + newChild + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, isUnkeyedTopLevelFragment); + break; + } else deleteChild(returnFiber, isUnkeyedTopLevelFragment); + isUnkeyedTopLevelFragment = isUnkeyedTopLevelFragment.sibling; + } + newChild.type === REACT_FRAGMENT_TYPE + ? ((currentFirstChild = createFiberFromFragment( + newChild.props.children, + returnFiber.mode, + expirationTime, + newChild.key + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : ((expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef( + returnFiber, + currentFirstChild, + newChild + )), + (expirationTime.return = returnFiber), + (returnFiber = expirationTime)); + } + return placeSingleChild(returnFiber); + case REACT_PORTAL_TYPE: + a: { + for ( + isUnkeyedTopLevelFragment = newChild.key; + null !== currentFirstChild; + + ) { + if (currentFirstChild.key === isUnkeyedTopLevelFragment) { + if ( + 4 === currentFirstChild.tag && + currentFirstChild.stateNode.containerInfo === + newChild.containerInfo && + currentFirstChild.stateNode.implementation === + newChild.implementation + ) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + currentFirstChild = useFiber( + currentFirstChild, + newChild.children || [], + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + currentFirstChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + } + return placeSingleChild(returnFiber); + } + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = "" + newChild), + null !== currentFirstChild && 6 === currentFirstChild.tag + ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), + (currentFirstChild = useFiber( + currentFirstChild, + newChild, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : (deleteRemainingChildren(returnFiber, currentFirstChild), + (currentFirstChild = createFiberFromText( + newChild, + returnFiber.mode, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)), + placeSingleChild(returnFiber) + ); + if (isArray(newChild)) + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + if (getIteratorFn(newChild)) + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + isObject && throwOnInvalidObjectType(returnFiber, newChild); + if ("undefined" === typeof newChild && !isUnkeyedTopLevelFragment) + switch (returnFiber.tag) { + case 1: + case 0: + throw ((returnFiber = returnFiber.type), + ReactError( + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + )); + } + return deleteRemainingChildren(returnFiber, currentFirstChild); + }; +} +var reconcileChildFibers = ChildReconciler(!0), + mountChildFibers = ChildReconciler(!1), + NO_CONTEXT = {}, + contextStackCursor$1 = { current: NO_CONTEXT }, + contextFiberStackCursor = { current: NO_CONTEXT }, + rootInstanceStackCursor = { current: NO_CONTEXT }; +function requiredContext(c) { + if (c === NO_CONTEXT) + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + return c; +} +function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, NO_CONTEXT, fiber); + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, { isInAParentText: !1 }, fiber); +} +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} +function pushHostContext(fiber) { + requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = fiber.type; + nextContext = + "AndroidTextInput" === nextContext || + "RCTMultilineTextInputView" === nextContext || + "RCTSinglelineTextInputView" === nextContext || + "RCTText" === nextContext || + "RCTVirtualText" === nextContext; + nextContext = + context.isInAParentText !== nextContext + ? { isInAParentText: nextContext } + : context; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor$1, nextContext, fiber)); +} +function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); +} +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} +var NoEffect$1 = 0, + UnmountSnapshot = 2, + UnmountMutation = 4, + MountMutation = 8, + UnmountLayout = 16, + MountLayout = 32, + MountPassive = 64, + UnmountPassive = 128, + ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, + renderExpirationTime$1 = 0, + currentlyRenderingFiber$1 = null, + currentHook = null, + nextCurrentHook = null, + firstWorkInProgressHook = null, + workInProgressHook = null, + nextWorkInProgressHook = null, + remainingExpirationTime = 0, + componentUpdateQueue = null, + sideEffectTag = 0, + didScheduleRenderPhaseUpdate = !1, + renderPhaseUpdates = null, + numberOfReRenders = 0; +function throwInvalidHookError() { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); +} +function areHookInputsEqual(nextDeps, prevDeps) { + if (null === prevDeps) return !1; + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) + if (!is(nextDeps[i], prevDeps[i])) return !1; + return !0; +} +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = null !== current ? current.memoizedState : null; + ReactCurrentDispatcher$1.current = + null === nextCurrentHook ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; + workInProgress = Component(props, refOrContext); + if (didScheduleRenderPhaseUpdate) { + do + (didScheduleRenderPhaseUpdate = !1), + (numberOfReRenders += 1), + (nextCurrentHook = null !== current ? current.memoizedState : null), + (nextWorkInProgressHook = firstWorkInProgressHook), + (componentUpdateQueue = workInProgressHook = currentHook = null), + (ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate), + (workInProgress = Component(props, refOrContext)); + while (didScheduleRenderPhaseUpdate); + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + current = currentlyRenderingFiber$1; + current.memoizedState = firstWorkInProgressHook; + current.expirationTime = remainingExpirationTime; + current.updateQueue = componentUpdateQueue; + current.effectTag |= sideEffectTag; + current = null !== currentHook && null !== currentHook.next; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + if (current) + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + return workInProgress; +} +function resetHooks() { + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + didScheduleRenderPhaseUpdate = !1; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + queue: null, + baseUpdate: null, + next: null + }; + null === workInProgressHook + ? (firstWorkInProgressHook = workInProgressHook = hook) + : (workInProgressHook = workInProgressHook.next = hook); + return workInProgressHook; +} +function updateWorkInProgressHook() { + if (null !== nextWorkInProgressHook) + (workInProgressHook = nextWorkInProgressHook), + (nextWorkInProgressHook = workInProgressHook.next), + (currentHook = nextCurrentHook), + (nextCurrentHook = null !== currentHook ? currentHook.next : null); + else { + if (null === nextCurrentHook) + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + currentHook = nextCurrentHook; + var newHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + next: null + }; + workInProgressHook = + null === workInProgressHook + ? (firstWorkInProgressHook = newHook) + : (workInProgressHook.next = newHook); + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} +function basicStateReducer(state, action) { + return "function" === typeof action ? action(state) : action; +} +function updateReducer(reducer) { + var hook = updateWorkInProgressHook(), + queue = hook.queue; + if (null === queue) + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + queue.lastRenderedReducer = reducer; + if (0 < numberOfReRenders) { + var _dispatch = queue.dispatch; + if (null !== renderPhaseUpdates) { + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (void 0 !== firstRenderPhaseUpdate) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + do + (newState = reducer(newState, firstRenderPhaseUpdate.action)), + (firstRenderPhaseUpdate = firstRenderPhaseUpdate.next); + while (null !== firstRenderPhaseUpdate); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate === queue.last && (hook.baseState = newState); + queue.lastRenderedState = newState; + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + _dispatch = queue.last; + var baseUpdate = hook.baseUpdate; + newState = hook.baseState; + null !== baseUpdate + ? (null !== _dispatch && (_dispatch.next = null), + (_dispatch = baseUpdate.next)) + : (_dispatch = null !== _dispatch ? _dispatch.next : null); + if (null !== _dispatch) { + var newBaseUpdate = (firstRenderPhaseUpdate = null), + _update = _dispatch, + didSkip = !1; + do { + var updateExpirationTime = _update.expirationTime; + updateExpirationTime < renderExpirationTime$1 + ? (didSkip || + ((didSkip = !0), + (newBaseUpdate = baseUpdate), + (firstRenderPhaseUpdate = newState)), + updateExpirationTime > remainingExpirationTime && + (remainingExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), + (newState = + _update.eagerReducer === reducer + ? _update.eagerState + : reducer(newState, _update.action))); + baseUpdate = _update; + _update = _update.next; + } while (null !== _update && _update !== _dispatch); + didSkip || + ((newBaseUpdate = baseUpdate), (firstRenderPhaseUpdate = newState)); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = firstRenderPhaseUpdate; + queue.lastRenderedState = newState; + } + return [hook.memoizedState, queue.dispatch]; +} +function pushEffect(tag, create, destroy, deps) { + tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; + null === componentUpdateQueue + ? ((componentUpdateQueue = { lastEffect: null }), + (componentUpdateQueue.lastEffect = tag.next = tag)) + : ((create = componentUpdateQueue.lastEffect), + null === create + ? (componentUpdateQueue.lastEffect = tag.next = tag) + : ((destroy = create.next), + (create.next = tag), + (tag.next = destroy), + (componentUpdateQueue.lastEffect = tag))); + return tag; +} +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect( + hookEffectTag, + create, + void 0, + void 0 === deps ? null : deps + ); +} +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var destroy = void 0; + if (null !== currentHook) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (null !== deps && areHookInputsEqual(deps, prevEffect.deps)) { + pushEffect(NoEffect$1, create, destroy, deps); + return; + } + } + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, deps); +} +function imperativeHandleEffect(create, ref) { + if ("function" === typeof ref) + return ( + (create = create()), + ref(create), + function() { + ref(null); + } + ); + if (null !== ref && void 0 !== ref) + return ( + (create = create()), + (ref.current = create), + function() { + ref.current = null; + } + ); +} +function mountDebugValue() {} +function dispatchAction(fiber, queue, action) { + if (!(25 > numberOfReRenders)) + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ) + if ( + ((didScheduleRenderPhaseUpdate = !0), + (fiber = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }), + null === renderPhaseUpdates && (renderPhaseUpdates = new Map()), + (action = renderPhaseUpdates.get(queue)), + void 0 === action) + ) + renderPhaseUpdates.set(queue, fiber); + else { + for (queue = action; null !== queue.next; ) queue = queue.next; + queue.next = fiber; + } + else { + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; + else { + var first = _last.next; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; + } + queue.last = _suspenseConfig; + if ( + 0 === fiber.expirationTime && + (null === alternate || 0 === alternate.expirationTime) && + ((alternate = queue.lastRenderedReducer), null !== alternate) + ) + try { + var currentState = queue.lastRenderedState, + _eagerState = alternate(currentState, action); + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; + if (is(_eagerState, currentState)) return; + } catch (error) { + } finally { + } + scheduleUpdateOnFiber(fiber, currentTime); + } +} +var ContextOnlyDispatcher = { + readContext: readContext, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError + }, + HooksDispatcherOnMount = { + readContext: readContext, + useCallback: function(callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return mountEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return mountEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return mountEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + reducer = reducer.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function(initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function(initialState) { + var hook = mountWorkInProgressHook(); + "function" === typeof initialState && (initialState = initialState()); + hook.memoizedState = hook.baseState = initialState; + initialState = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + initialState = initialState.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + initialState + ); + return [hook.memoizedState, initialState]; + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + HooksDispatcherOnUpdate = { + readContext: readContext, + useCallback: function(callback, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + hook.memoizedState = [callback, deps]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return updateEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return updateEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return updateEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: updateReducer, + useRef: function() { + return updateWorkInProgressHook().memoizedState; + }, + useState: function(initialState) { + return updateReducer(basicStateReducer, initialState); + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + hydrationParentFiber = null, + nextHydratableInstance = null, + isHydrating = !1; +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case 5: + return ( + (nextInstance = shim$1(nextInstance, fiber.type, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 6: + return ( + (nextInstance = shim$1(nextInstance, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 13: + return !1; + default: + return !1; + } +} +function tryToClaimNextHydratableInstance(fiber$jscomp$0) { + if (isHydrating) { + var nextInstance = nextHydratableInstance; + if (nextInstance) { + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber$jscomp$0, nextInstance)) { + nextInstance = shim$1(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber$jscomp$0, nextInstance)) { + fiber$jscomp$0.effectTag |= 2; + isHydrating = !1; + hydrationParentFiber = fiber$jscomp$0; + return; + } + var returnFiber = hydrationParentFiber, + fiber = createFiber(5, null, null, 0); + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + fiber.stateNode = firstAttemptedInstance; + fiber.return = returnFiber; + fiber.effectTag = 8; + null !== returnFiber.lastEffect + ? ((returnFiber.lastEffect.nextEffect = fiber), + (returnFiber.lastEffect = fiber)) + : (returnFiber.firstEffect = returnFiber.lastEffect = fiber); + } + hydrationParentFiber = fiber$jscomp$0; + nextHydratableInstance = shim$1(nextInstance); + } else + (fiber$jscomp$0.effectTag |= 2), + (isHydrating = !1), + (hydrationParentFiber = fiber$jscomp$0); + } +} +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner, + didReceiveUpdate = !1; +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + workInProgress.child = + null === current$$1 + ? mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ) + : reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); +} +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + Component = Component.render; + var ref = workInProgress.ref; + prepareToReadContext(workInProgress, renderExpirationTime); + nextProps = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + ref, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + nextProps, + renderExpirationTime + ); + return workInProgress.child; +} +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (null === current$$1) { + var type = Component.type; + if ( + "function" === typeof type && + !shouldConstruct(type) && + void 0 === type.defaultProps && + null === Component.compare && + void 0 === Component.defaultProps + ) + return ( + (workInProgress.tag = 15), + (workInProgress.type = type), + updateSimpleMemoComponent( + current$$1, + workInProgress, + type, + nextProps, + updateExpirationTime, + renderExpirationTime + ) + ); + current$$1 = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); + } + type = current$$1.child; + if ( + updateExpirationTime < renderExpirationTime && + ((updateExpirationTime = type.memoizedProps), + (Component = Component.compare), + (Component = null !== Component ? Component : shallowEqual), + Component(updateExpirationTime, nextProps) && + current$$1.ref === workInProgress.ref) + ) + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + current$$1 = createWorkInProgress(type, nextProps, renderExpirationTime); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); +} +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + return null !== current$$1 && + shallowEqual(current$$1.memoizedProps, nextProps) && + current$$1.ref === workInProgress.ref && + ((didReceiveUpdate = !1), updateExpirationTime < renderExpirationTime) + ? bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + : updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (null === current$$1 && null !== ref) || + (null !== current$$1 && current$$1.ref !== ref) + ) + workInProgress.effectTag |= 128; +} +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor.current; + context = getMaskedContext(workInProgress, context); + prepareToReadContext(workInProgress, renderExpirationTime); + Component = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + Component, + renderExpirationTime + ); + return workInProgress.child; +} +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (isContextProvider(Component)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + prepareToReadContext(workInProgress, renderExpirationTime); + if (null === workInProgress.stateNode) + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + (nextProps = !0); + else if (null === current$$1) { + var instance = workInProgress.stateNode, + oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + var oldContext = instance.context, + contextType = Component.contextType; + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))); + var getDerivedStateFromProps = Component.getDerivedStateFromProps, + hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate; + hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )); + hasForceUpdate = !1; + var oldState = workInProgress.memoizedState; + oldContext = instance.state = oldState; + var updateQueue = workInProgress.updateQueue; + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldContext = workInProgress.memoizedState)); + oldProps !== nextProps || + oldState !== oldContext || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldContext = workInProgress.memoizedState)), + (oldProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldState, + oldContext, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ("function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount()), + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldContext)), + (instance.props = nextProps), + (instance.state = oldContext), + (instance.context = contextType), + (nextProps = oldProps)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (nextProps = !1)); + } else + (instance = workInProgress.stateNode), + (oldProps = workInProgress.memoizedProps), + (instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps)), + (oldContext = instance.context), + (contextType = Component.contextType), + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))), + (getDerivedStateFromProps = Component.getDerivedStateFromProps), + (hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate) || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )), + (hasForceUpdate = !1), + (oldContext = workInProgress.memoizedState), + (oldState = instance.state = oldContext), + (updateQueue = workInProgress.updateQueue), + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldState = workInProgress.memoizedState)), + oldProps !== nextProps || + oldContext !== oldState || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldState = workInProgress.memoizedState)), + (getDerivedStateFromProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldContext, + oldState, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillUpdate && + "function" !== typeof instance.componentWillUpdate) || + ("function" === typeof instance.componentWillUpdate && + instance.componentWillUpdate( + nextProps, + oldState, + contextType + ), + "function" === typeof instance.UNSAFE_componentWillUpdate && + instance.UNSAFE_componentWillUpdate( + nextProps, + oldState, + contextType + )), + "function" === typeof instance.componentDidUpdate && + (workInProgress.effectTag |= 4), + "function" === typeof instance.getSnapshotBeforeUpdate && + (workInProgress.effectTag |= 256)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldState)), + (instance.props = nextProps), + (instance.state = oldState), + (instance.context = contextType), + (nextProps = getDerivedStateFromProps)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (nextProps = !1)); + return finishClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + hasContext, + renderExpirationTime + ); +} +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + markRef(current$$1, workInProgress); + var didCaptureError = 0 !== (workInProgress.effectTag & 64); + if (!shouldUpdate && !didCaptureError) + return ( + hasContext && invalidateContextProvider(workInProgress, Component, !1), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + shouldUpdate = workInProgress.stateNode; + ReactCurrentOwner$3.current = workInProgress; + var nextChildren = + didCaptureError && "function" !== typeof Component.getDerivedStateFromError + ? null + : shouldUpdate.render(); + workInProgress.effectTag |= 1; + null !== current$$1 && didCaptureError + ? ((workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + )), + (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ))) + : reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + workInProgress.memoizedState = shouldUpdate.state; + hasContext && invalidateContextProvider(workInProgress, Component, !0); + return workInProgress.child; +} +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + root.pendingContext + ? pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ) + : root.context && + pushTopLevelContextObject(workInProgress, root.context, !1); + pushHostContainer(workInProgress, root.containerInfo); +} +var SUSPENDED_MARKER = {}; +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode, + nextProps = workInProgress.pendingProps, + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), + (nextDidTimeout = !0), + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); + if (null === current$$1) + if (nextDidTimeout) { + nextProps = nextProps.fallback; + current$$1 = createFiberFromFragment(null, mode, 0, null); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; + } else + mode = renderExpirationTime = mountChildFibers( + workInProgress, + null, + nextProps.children, + renderExpirationTime + ); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } + workInProgress.memoizedState = nextState; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; +} +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + null !== current$$1 && + (workInProgress.dependencies = current$$1.dependencies); + if (workInProgress.childExpirationTime < renderExpirationTime) return null; + if (null !== current$$1 && workInProgress.child !== current$$1.child) + throw ReactError(Error("Resuming work not yet implemented.")); + if (null !== workInProgress.child) { + current$$1 = workInProgress.child; + renderExpirationTime = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + ); + workInProgress.child = renderExpirationTime; + for ( + renderExpirationTime.return = workInProgress; + null !== current$$1.sibling; + + ) + (current$$1 = current$$1.sibling), + (renderExpirationTime = renderExpirationTime.sibling = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + )), + (renderExpirationTime.return = workInProgress); + renderExpirationTime.sibling = null; + } + return workInProgress.child; +} +var appendAllChildren = void 0, + updateHostContainer = void 0, + updateHostComponent$1 = void 0, + updateHostText$1 = void 0; +appendAllChildren = function(parent, workInProgress) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag || 6 === node.tag) parent._children.push(node.stateNode); + else if (4 !== node.tag && null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +}; +updateHostContainer = function() {}; +updateHostComponent$1 = function(current, workInProgress, type, newProps) { + current.memoizedProps !== newProps && + (requiredContext(contextStackCursor$1.current), + (workInProgress.updateQueue = UPDATE_SIGNAL)) && + (workInProgress.effectTag |= 4); +}; +updateHostText$1 = function(current, workInProgress, oldText, newText) { + oldText !== newText && (workInProgress.effectTag |= 4); +}; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} +function createCapturedValue(value, source) { + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); +function logCapturedError(capturedError) { + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); +} +var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; +function logError(boundary, errorInfo) { + var source = errorInfo.source, + stack = errorInfo.stack; + null === stack && + null !== source && + (stack = getStackByFiberInDevAndProd(source)); + errorInfo = { + componentName: null !== source ? getComponentName(source.type) : null, + componentStack: null !== stack ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: !1, + willRetry: !1 + }; + null !== boundary && + 1 === boundary.tag && + ((errorInfo.errorBoundary = boundary.stateNode), + (errorInfo.errorBoundaryName = getComponentName(boundary.type)), + (errorInfo.errorBoundaryFound = !0), + (errorInfo.willRetry = !0)); + try { + logCapturedError(errorInfo); + } catch (e) { + setTimeout(function() { + throw e; + }); + } +} +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (null !== ref) + if ("function" === typeof ref) + try { + ref(null); + } catch (refError) { + captureCommitPhaseError(current$$1, refError); + } + else ref.current = null; +} +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + var destroy = effect.destroy; + effect.destroy = void 0; + void 0 !== destroy && destroy(); + } + (effect.tag & mountTag) !== NoEffect$1 && + ((destroy = effect.create), (effect.destroy = destroy())); + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; +} +function commitPlacement(finishedWork) { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var parentFiber = parent; + break a; + } + parent = parent.return; + } + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + parent = parentFiber.stateNode; + switch (parentFiber.tag) { + case 5: + var isContainer = !1; + break; + case 3: + parent = parent.containerInfo; + isContainer = !0; + break; + case 4: + parent = parent.containerInfo; + isContainer = !0; + break; + default: + throw ReactError( + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + parentFiber.effectTag & 16 && (parentFiber.effectTag &= -17); + a: b: for (parentFiber = finishedWork; ; ) { + for (; null === parentFiber.sibling; ) { + if (null === parentFiber.return || isHostParent(parentFiber.return)) { + parentFiber = null; + break a; + } + parentFiber = parentFiber.return; + } + parentFiber.sibling.return = parentFiber.return; + for ( + parentFiber = parentFiber.sibling; + 5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag; + + ) { + if (parentFiber.effectTag & 2) continue b; + if (null === parentFiber.child || 4 === parentFiber.tag) continue b; + else + (parentFiber.child.return = parentFiber), + (parentFiber = parentFiber.child); + } + if (!(parentFiber.effectTag & 2)) { + parentFiber = parentFiber.stateNode; + break a; + } + } + for (var node = finishedWork; ; ) { + var isHost = 5 === node.tag || 6 === node.tag; + if (isHost) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (parentFiber) + if (isContainer) { + if ("number" === typeof parent) + throw ReactError( + Error("Container does not support insertBefore operation") + ); + } else { + isHost = parent; + var beforeChild = parentFiber, + children = isHost._children, + index = children.indexOf(stateNode); + 0 <= index + ? (children.splice(index, 1), + (beforeChild = children.indexOf(beforeChild)), + children.splice(beforeChild, 0, stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [index], + [beforeChild], + [], + [], + [] + )) + : ((index = children.indexOf(beforeChild)), + children.splice(index, 0, stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [], + [], + [ + "number" === typeof stateNode + ? stateNode + : stateNode._nativeTag + ], + [index], + [] + )); + } + else + isContainer + ? ReactNativePrivateInterface.UIManager.setChildren(parent, [ + "number" === typeof stateNode ? stateNode : stateNode._nativeTag + ]) + : ((isHost = parent), + (children = + "number" === typeof stateNode ? stateNode : stateNode._nativeTag), + (index = isHost._children), + (beforeChild = index.indexOf(stateNode)), + 0 <= beforeChild + ? (index.splice(beforeChild, 1), + index.push(stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [beforeChild], + [index.length - 1], + [], + [], + [] + )) + : (index.push(stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [], + [], + [children], + [index.length - 1], + [] + ))); + } else if (4 !== node.tag && null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} +function unmountHostComponents(current$$1, renderPriorityLevel$jscomp$0) { + for ( + var node = current$$1, + currentParentIsValid = !1, + currentParent = void 0, + currentParentIsContainer = void 0; + ; + + ) { + if (!currentParentIsValid) { + currentParentIsValid = node.return; + a: for (;;) { + if (null === currentParentIsValid) + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + currentParent = currentParentIsValid.stateNode; + switch (currentParentIsValid.tag) { + case 5: + currentParentIsContainer = !1; + break a; + case 3: + currentParent = currentParent.containerInfo; + currentParentIsContainer = !0; + break a; + case 4: + currentParent = currentParent.containerInfo; + currentParentIsContainer = !0; + break a; + } + currentParentIsValid = currentParentIsValid.return; + } + currentParentIsValid = !0; + } + if (5 === node.tag || 6 === node.tag) { + a: for ( + var root = node, + renderPriorityLevel = renderPriorityLevel$jscomp$0, + node$jscomp$0 = root; + ; + + ) + if ( + (commitUnmount(node$jscomp$0, renderPriorityLevel), + null !== node$jscomp$0.child && 4 !== node$jscomp$0.tag) + ) + (node$jscomp$0.child.return = node$jscomp$0), + (node$jscomp$0 = node$jscomp$0.child); + else { + if (node$jscomp$0 === root) break; + for (; null === node$jscomp$0.sibling; ) { + if (null === node$jscomp$0.return || node$jscomp$0.return === root) + break a; + node$jscomp$0 = node$jscomp$0.return; + } + node$jscomp$0.sibling.return = node$jscomp$0.return; + node$jscomp$0 = node$jscomp$0.sibling; + } + currentParentIsContainer + ? ((root = currentParent), + recursivelyUncacheFiberNode(node.stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + root, + [], + [], + [], + [], + [0] + )) + : ((root = currentParent), + (node$jscomp$0 = node.stateNode), + recursivelyUncacheFiberNode(node$jscomp$0), + (renderPriorityLevel = root._children), + (node$jscomp$0 = renderPriorityLevel.indexOf(node$jscomp$0)), + renderPriorityLevel.splice(node$jscomp$0, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + root._nativeTag, + [], + [], + [], + [], + [node$jscomp$0] + )); + } else if (4 === node.tag) { + if (null !== node.child) { + currentParent = node.stateNode.containerInfo; + currentParentIsContainer = !0; + node.child.return = node; + node = node.child; + continue; + } + } else if ( + (commitUnmount(node, renderPriorityLevel$jscomp$0), null !== node.child) + ) { + node.child.return = node; + node = node.child; + continue; + } + if (node === current$$1) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === current$$1) return; + node = node.return; + 4 === node.tag && (currentParentIsValid = !1); + } + node.sibling.return = node.return; + node = node.sibling; + } +} +function commitWork(current$$1, finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + break; + case 1: + break; + case 5: + var instance = finishedWork.stateNode; + if (null != instance) { + var newProps = finishedWork.memoizedProps; + current$$1 = null !== current$$1 ? current$$1.memoizedProps : newProps; + var updatePayload = finishedWork.updateQueue; + finishedWork.updateQueue = null; + null !== updatePayload && + ((finishedWork = instance.viewConfig), + instanceProps.set(instance._nativeTag, newProps), + (newProps = diffProperties( + null, + current$$1, + newProps, + finishedWork.validAttributes + )), + null != newProps && + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + finishedWork.uiViewClassName, + newProps + )); + } + break; + case 6: + if (null === finishedWork.stateNode) + throw ReactError( + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) + ); + ReactNativePrivateInterface.UIManager.updateView( + finishedWork.stateNode, + "RCTRawText", + { text: finishedWork.memoizedProps } + ); + break; + case 3: + break; + case 12: + break; + case 13: + instance = finishedWork; + null === finishedWork.memoizedState + ? (newProps = !1) + : ((newProps = !0), + (instance = finishedWork.child), + (globalMostRecentFallbackTime = now())); + if (null !== instance) + a: for (current$$1 = instance; ; ) { + if (5 === current$$1.tag) + if (((updatePayload = current$$1.stateNode), newProps)) { + var viewConfig = updatePayload.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + updatePayload = current$$1.stateNode; + updatePayload$jscomp$0 = current$$1.memoizedProps; + viewConfig = updatePayload.viewConfig; + var prevProps = Object.assign({}, updatePayload$jscomp$0, { + style: [updatePayload$jscomp$0.style, { display: "none" }] + }); + updatePayload$jscomp$0 = diffProperties( + null, + prevProps, + updatePayload$jscomp$0, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } + else { + if (6 === current$$1.tag) throw Error("Not yet implemented."); + if (13 === current$$1.tag && null !== current$$1.memoizedState) { + updatePayload = current$$1.child.sibling; + updatePayload.return = current$$1; + current$$1 = updatePayload; + continue; + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + } + if (current$$1 === instance) break a; + for (; null === current$$1.sibling; ) { + if (null === current$$1.return || current$$1.return === instance) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + attachSuspenseRetryListeners(finishedWork); + break; + case 19: + attachSuspenseRetryListeners(finishedWork); + break; + case 17: + break; + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } +} +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); + thenables.forEach(function(thenable) { + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + retryCache.has(thenable) || + (retryCache.add(thenable), thenable.then(retry, retry)); + }); + } +} +var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + expirationTime.payload = { element: null }; + var error = errorInfo.value; + expirationTime.callback = function() { + hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); + logError(fiber, errorInfo); + }; + return expirationTime; +} +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if ("function" === typeof getDerivedStateFromError) { + var error = errorInfo.value; + expirationTime.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + var inst = fiber.stateNode; + null !== inst && + "function" === typeof inst.componentDidCatch && + (expirationTime.callback = function() { + "function" !== typeof getDerivedStateFromError && + (null === legacyErrorBoundariesThatAlreadyFailed + ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { + componentStack: null !== stack ? stack : "" + }); + }); + return expirationTime; +} +var ceil = Math.ceil, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, + RootIncomplete = 0, + RootErrored = 1, + RootSuspended = 2, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, + workInProgressRoot = null, + workInProgress = null, + renderExpirationTime = 0, + workInProgressRootExitStatus = RootIncomplete, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, + nextEffect = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, + rootsWithPendingDiscreteUpdates = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null, + currentEventTime = 0; +function requestCurrentTime() { + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) + : 0 !== currentEventTime + ? currentEventTime + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } + null !== workInProgressRoot && + currentTime === renderExpirationTime && + --currentTime; + return currentTime; +} +function scheduleUpdateOnFiber(fiber, expirationTime) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + )); + fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) + for ( + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; + + ) + callback = callback(!0); + else + scheduleCallbackForRoot(fiber, 99, 1073741823), + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } +} +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + fiber.expirationTime < expirationTime && + (fiber.expirationTime = expirationTime); + var alternate = fiber.alternate; + null !== alternate && + alternate.expirationTime < expirationTime && + (alternate.expirationTime = expirationTime); + var node = fiber.return, + root = null; + if (null === node && 3 === fiber.tag) root = fiber.stateNode; + else + for (; null !== node; ) { + alternate = node.alternate; + node.childExpirationTime < expirationTime && + (node.childExpirationTime = expirationTime); + null !== alternate && + alternate.childExpirationTime < expirationTime && + (alternate.childExpirationTime = expirationTime); + if (null === node.return && 3 === node.tag) { + root = node.stateNode; + break; + } + node = node.return; + } + null !== root && + (expirationTime > root.firstPendingTime && + (root.firstPendingTime = expirationTime), + (fiber = root.lastPendingTime), + 0 === fiber || expirationTime < fiber) && + (root.lastPendingTime = expirationTime); + return root; +} +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + if (root.callbackExpirationTime < expirationTime) { + var existingCallbackNode = root.callbackNode; + null !== existingCallbackNode && + existingCallbackNode !== fakeCallbackNode && + Scheduler_cancelCallback(existingCallbackNode); + root.callbackExpirationTime = expirationTime; + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); + } +} +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode, + continuation = null; + try { + return ( + (continuation = callback(isSync)), + null !== continuation + ? runRootCallback.bind(null, root, continuation) + : null + ); + } finally { + null === continuation && + prevCallbackNode === root.callbackNode && + ((root.callbackNode = null), (root.callbackExpirationTime = 0)); + } +} +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + return null !== firstBatch && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ? (scheduleCallback(97, function() { + firstBatch._onComplete(); + return null; + }), + !0) + : !1; +} +function flushPendingDiscreteUpdates() { + if (null !== rootsWithPendingDiscreteUpdates) { + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + flushSyncCallbackQueue(); + } +} +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + if (null !== workInProgress) + for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { + var interruptedWork = timeoutHandle; + switch (interruptedWork.tag) { + case 1: + var childContextTypes = interruptedWork.type.childContextTypes; + null !== childContextTypes && + void 0 !== childContextTypes && + popContext(interruptedWork); + break; + case 3: + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(interruptedWork); + break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; + case 10: + popProvider(interruptedWork); + } + timeoutHandle = timeoutHandle.return; + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; +} +function renderRoot(root$jscomp$0, expirationTime, isSync) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + if (root$jscomp$0.firstPendingTime < expirationTime) return null; + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); + flushPassiveEffects(); + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) + prepareFreshStack(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } + if (null !== workInProgress) { + lastPendingTime = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + if (isSync) { + if (1073741823 !== expirationTime) { + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) + return ( + (executionContext = lastPendingTime), + resetContextDependencies(), + (ReactCurrentDispatcher.current = prevDispatcher), + renderRoot.bind(null, root$jscomp$0, currentTime) + ); + } + } else currentEventTime = 0; + do + try { + if (isSync) + for (; null !== workInProgress; ) + workInProgress = performUnitOfWork(workInProgress); + else + for (; null !== workInProgress && !Scheduler_shouldYield(); ) + workInProgress = performUnitOfWork(workInProgress); + break; + } catch (thrownValue) { + resetContextDependencies(); + resetHooks(); + currentTime = workInProgress; + if (null === currentTime || null === currentTime.return) + throw (prepareFreshStack(root$jscomp$0, expirationTime), + (executionContext = lastPendingTime), + thrownValue); + a: { + var root = root$jscomp$0, + returnFiber = currentTime.return, + sourceFiber = currentTime, + value = thrownValue, + renderExpirationTime$jscomp$0 = renderExpirationTime; + sourceFiber.effectTag |= 1024; + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + if ( + null !== value && + "object" === typeof value && + "function" === typeof value.then + ) { + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); + value = returnFiber; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { + returnFiber = value.updateQueue; + null === returnFiber + ? ((returnFiber = new Set()), + returnFiber.add(thenable), + (value.updateQueue = returnFiber)) + : returnFiber.add(thenable); + if (0 === (value.mode & 2)) { + value.effectTag |= 64; + sourceFiber.effectTag &= -1957; + 1 === sourceFiber.tag && + (null === sourceFiber.alternate + ? (sourceFiber.tag = 17) + : ((renderExpirationTime$jscomp$0 = createUpdate( + 1073741823, + null + )), + (renderExpirationTime$jscomp$0.tag = 2), + enqueueUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ))); + sourceFiber.expirationTime = 1073741823; + break a; + } + sourceFiber = root; + root = renderExpirationTime$jscomp$0; + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), + (returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), + void 0 === returnFiber && + ((returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber))); + returnFiber.has(root) || + (returnFiber.add(root), + (sourceFiber = pingSuspendedRoot.bind( + null, + sourceFiber, + thenable, + root + )), + thenable.then(sourceFiber, sourceFiber)); + value.effectTag |= 2048; + value.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + value = value.return; + } while (null !== value); + value = Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); + value = createCapturedValue(value, sourceFiber); + sourceFiber = returnFiber; + do { + switch (sourceFiber.tag) { + case 3: + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createRootErrorUpdate( + sourceFiber, + value, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + case 1: + if ( + ((thenable = value), + (root = sourceFiber.type), + (returnFiber = sourceFiber.stateNode), + 0 === (sourceFiber.effectTag & 64) && + ("function" === typeof root.getDerivedStateFromError || + (null !== returnFiber && + "function" === typeof returnFiber.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has( + returnFiber + ))))) + ) { + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createClassErrorUpdate( + sourceFiber, + thenable, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + } + } + sourceFiber = sourceFiber.return; + } while (null !== sourceFiber); + } + workInProgress = completeUnitOfWork(currentTime); + } + while (1); + executionContext = lastPendingTime; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + if (null !== workInProgress) + return renderRoot.bind(null, root$jscomp$0, expirationTime); + } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; + if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; + workInProgressRoot = null; + switch (workInProgressRootExitStatus) { + case RootIncomplete: + throw ReactError(Error("Should have a work-in-progress.")); + case RootErrored: + return ( + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) + : isSync + ? commitRoot.bind(null, root$jscomp$0) + : (prepareFreshStack(root$jscomp$0, expirationTime), + scheduleSyncCallback( + renderRoot.bind(null, root$jscomp$0, expirationTime) + ), + null) + ); + case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: + if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + isSync = root$jscomp$0.lastPendingTime; + if (isSync < expirationTime) + return renderRoot.bind(null, root$jscomp$0, isSync); + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) + return ( + (root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + )), + null + ); + } + return commitRoot.bind(null, root$jscomp$0); + case RootCompleted: + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); + default: + throw ReactError(Error("Unknown root exit status.")); + } +} +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} +function performUnitOfWork(unitOfWork) { + var next = beginWork$$1( + unitOfWork.alternate, + unitOfWork, + renderExpirationTime + ); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === next && (next = completeUnitOfWork(unitOfWork)); + ReactCurrentOwner$2.current = null; + return next; +} +function completeUnitOfWork(unitOfWork) { + workInProgress = unitOfWork; + do { + var current$$1 = workInProgress.alternate; + unitOfWork = workInProgress.return; + if (0 === (workInProgress.effectTag & 1024)) { + a: { + var current = current$$1; + current$$1 = workInProgress; + var renderExpirationTime$jscomp$0 = renderExpirationTime, + newProps = current$$1.pendingProps; + switch (current$$1.tag) { + case 2: + break; + case 16: + break; + case 15: + case 0: + break; + case 1: + isContextProvider(current$$1.type) && popContext(current$$1); + break; + case 3: + popHostContainer(current$$1); + popTopLevelContextObject(current$$1); + newProps = current$$1.stateNode; + newProps.pendingContext && + ((newProps.context = newProps.pendingContext), + (newProps.pendingContext = null)); + if (null === current || null === current.child) + current$$1.effectTag &= -3; + updateHostContainer(current$$1); + break; + case 5: + popHostContext(current$$1); + renderExpirationTime$jscomp$0 = requiredContext( + rootInstanceStackCursor.current + ); + var type = current$$1.type; + if (null !== current && null != current$$1.stateNode) + updateHostComponent$1( + current, + current$$1, + type, + newProps, + renderExpirationTime$jscomp$0 + ), + current.ref !== current$$1.ref && (current$$1.effectTag |= 128); + else if (newProps) { + current = requiredContext(contextStackCursor$1.current); + var type$jscomp$0 = type; + var _instance6 = newProps; + var rootContainerInstance = renderExpirationTime$jscomp$0, + internalInstanceHandle = current$$1, + tag = allocateTag(); + type$jscomp$0 = getViewConfigForType(type$jscomp$0); + var updatePayload = diffProperties( + null, + emptyObject, + _instance6, + type$jscomp$0.validAttributes + ); + ReactNativePrivateInterface.UIManager.createView( + tag, + type$jscomp$0.uiViewClassName, + rootContainerInstance, + updatePayload + ); + rootContainerInstance = new ReactNativeFiberHostComponent( + tag, + type$jscomp$0 + ); + instanceCache.set(tag, internalInstanceHandle); + instanceProps.set(tag, _instance6); + _instance6 = rootContainerInstance; + appendAllChildren(_instance6, current$$1, !1, !1); + finalizeInitialChildren( + _instance6, + type, + newProps, + renderExpirationTime$jscomp$0, + current + ) && (current$$1.effectTag |= 4); + current$$1.stateNode = _instance6; + null !== current$$1.ref && (current$$1.effectTag |= 128); + } else if (null === current$$1.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + if (current && null != current$$1.stateNode) + updateHostText$1( + current, + current$$1, + current.memoizedProps, + newProps + ); + else { + if ("string" !== typeof newProps && null === current$$1.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + type = requiredContext(rootInstanceStackCursor.current); + renderExpirationTime$jscomp$0 = requiredContext( + contextStackCursor$1.current + ); + current = current$$1; + if (!renderExpirationTime$jscomp$0.isInAParentText) + throw ReactError( + Error( + "Text strings must be rendered within a component." + ) + ); + renderExpirationTime$jscomp$0 = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + renderExpirationTime$jscomp$0, + "RCTRawText", + type, + { text: newProps } + ); + instanceCache.set(renderExpirationTime$jscomp$0, current$$1); + current.stateNode = renderExpirationTime$jscomp$0; + } + break; + case 11: + break; + case 13: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (0 !== (current$$1.effectTag & 64)) { + current$$1.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + newProps = null !== newProps; + renderExpirationTime$jscomp$0 = !1; + null !== current && + ((type = current.memoizedState), + (renderExpirationTime$jscomp$0 = null !== type), + newProps || + null === type || + ((type = current.child.sibling), + null !== type && + ((_instance6 = current$$1.firstEffect), + null !== _instance6 + ? ((current$$1.firstEffect = type), + (type.nextEffect = _instance6)) + : ((current$$1.firstEffect = current$$1.lastEffect = type), + (type.nextEffect = null)), + (type.effectTag = 8)))); + if ( + newProps && + !renderExpirationTime$jscomp$0 && + 0 !== (current$$1.mode & 2) + ) + if ( + (null === current && + !0 !== current$$1.memoizedProps.unstable_avoidThisFallback) || + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + if (newProps || renderExpirationTime$jscomp$0) + current$$1.effectTag |= 4; + break; + case 7: + break; + case 8: + break; + case 12: + break; + case 4: + popHostContainer(current$$1); + updateHostContainer(current$$1); + break; + case 10: + popProvider(current$$1); + break; + case 9: + break; + case 14: + break; + case 17: + isContextProvider(current$$1.type) && popContext(current$$1); + break; + case 18: + break; + case 19: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (null === newProps) break; + type = 0 !== (current$$1.effectTag & 64); + _instance6 = newProps.rendering; + if (null === _instance6) + if (type) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = current$$1.child; null !== current; ) { + _instance6 = findFirstSuspended(current); + if (null !== _instance6) { + current$$1.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + newProps = _instance6.updateQueue; + null !== newProps && + ((current$$1.updateQueue = newProps), + (current$$1.effectTag |= 4)); + current$$1.firstEffect = current$$1.lastEffect = null; + newProps = renderExpirationTime$jscomp$0; + for (current = current$$1.child; null !== current; ) + (renderExpirationTime$jscomp$0 = current), + (type = newProps), + (renderExpirationTime$jscomp$0.effectTag &= 2), + (renderExpirationTime$jscomp$0.nextEffect = null), + (renderExpirationTime$jscomp$0.firstEffect = null), + (renderExpirationTime$jscomp$0.lastEffect = null), + (_instance6 = + renderExpirationTime$jscomp$0.alternate), + null === _instance6 + ? ((renderExpirationTime$jscomp$0.childExpirationTime = 0), + (renderExpirationTime$jscomp$0.expirationTime = type), + (renderExpirationTime$jscomp$0.child = null), + (renderExpirationTime$jscomp$0.memoizedProps = null), + (renderExpirationTime$jscomp$0.memoizedState = null), + (renderExpirationTime$jscomp$0.updateQueue = null), + (renderExpirationTime$jscomp$0.dependencies = null)) + : ((renderExpirationTime$jscomp$0.childExpirationTime = + _instance6.childExpirationTime), + (renderExpirationTime$jscomp$0.expirationTime = + _instance6.expirationTime), + (renderExpirationTime$jscomp$0.child = + _instance6.child), + (renderExpirationTime$jscomp$0.memoizedProps = + _instance6.memoizedProps), + (renderExpirationTime$jscomp$0.memoizedState = + _instance6.memoizedState), + (renderExpirationTime$jscomp$0.updateQueue = + _instance6.updateQueue), + (type = _instance6.dependencies), + (renderExpirationTime$jscomp$0.dependencies = + null === type + ? null + : { + expirationTime: type.expirationTime, + firstContext: type.firstContext, + responders: type.responders + })), + (current = current.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & + SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + current$$1 + ); + current$$1 = current$$1.child; + break a; + } + current = current.sibling; + } + } + else { + if (!type) + if ( + ((current = findFirstSuspended(_instance6)), null !== current) + ) { + if ( + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1 = current$$1.lastEffect = newProps.lastEffect; + null !== current$$1 && (current$$1.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime$jscomp$0 && + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !1), + (current$$1.expirationTime = current$$1.childExpirationTime = + renderExpirationTime$jscomp$0 - 1)); + newProps.isBackwards + ? ((_instance6.sibling = current$$1.child), + (current$$1.child = _instance6)) + : ((current = newProps.last), + null !== current + ? (current.sibling = _instance6) + : (current$$1.child = _instance6), + (newProps.last = _instance6)); + } + if (null !== newProps.tail) { + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500); + current = newProps.tail; + newProps.rendering = current; + newProps.tail = current.sibling; + newProps.lastEffect = current$$1.lastEffect; + current.sibling = null; + newProps = suspenseStackCursor.current; + newProps = type + ? (newProps & SubtreeSuspenseContextMask) | + ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask; + push(suspenseStackCursor, newProps, current$$1); + current$$1 = current; + break a; + } + break; + case 20: + break; + default: + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + current$$1 = null; + } + newProps = workInProgress; + if (1 === renderExpirationTime || 1 !== newProps.childExpirationTime) { + current = 0; + for ( + renderExpirationTime$jscomp$0 = newProps.child; + null !== renderExpirationTime$jscomp$0; + + ) + (type = renderExpirationTime$jscomp$0.expirationTime), + (_instance6 = renderExpirationTime$jscomp$0.childExpirationTime), + type > current && (current = type), + _instance6 > current && (current = _instance6), + (renderExpirationTime$jscomp$0 = + renderExpirationTime$jscomp$0.sibling); + newProps.childExpirationTime = current; + } + if (null !== current$$1) return current$$1; + null !== unitOfWork && + 0 === (unitOfWork.effectTag & 1024) && + (null === unitOfWork.firstEffect && + (unitOfWork.firstEffect = workInProgress.firstEffect), + null !== workInProgress.lastEffect && + (null !== unitOfWork.lastEffect && + (unitOfWork.lastEffect.nextEffect = workInProgress.firstEffect), + (unitOfWork.lastEffect = workInProgress.lastEffect)), + 1 < workInProgress.effectTag && + (null !== unitOfWork.lastEffect + ? (unitOfWork.lastEffect.nextEffect = workInProgress) + : (unitOfWork.firstEffect = workInProgress), + (unitOfWork.lastEffect = workInProgress))); + } else { + current$$1 = unwindWork(workInProgress, renderExpirationTime); + if (null !== current$$1) + return (current$$1.effectTag &= 1023), current$$1; + null !== unitOfWork && + ((unitOfWork.firstEffect = unitOfWork.lastEffect = null), + (unitOfWork.effectTag |= 1024)); + } + current$$1 = workInProgress.sibling; + if (null !== current$$1) return current$$1; + workInProgress = unitOfWork; + } while (null !== workInProgress); + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootCompleted); + return null; +} +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority(99, commitRootImpl.bind(null, root, renderPriorityLevel)); + null !== rootWithPendingPassiveEffects && + scheduleCallback(97, function() { + flushPassiveEffects(); + return null; + }); + return null; +} +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + root.callbackNode = null; + root.callbackExpirationTime = 0; + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, + childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + updateExpirationTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = updateExpirationTimeBeforeCommit; + updateExpirationTimeBeforeCommit < root.lastPendingTime && + (root.lastPendingTime = updateExpirationTimeBeforeCommit); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + ReactCurrentOwner$2.current = null; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (; null !== nextEffect; ) { + if (0 !== (nextEffect.effectTag & 256)) { + var current$$1 = nextEffect.alternate, + finishedWork$jscomp$0 = nextEffect; + switch (finishedWork$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountSnapshot, + NoEffect$1, + finishedWork$jscomp$0 + ); + break; + case 1: + if ( + finishedWork$jscomp$0.effectTag & 256 && + null !== current$$1 + ) { + var prevProps = current$$1.memoizedProps, + prevState = current$$1.memoizedState, + instance = finishedWork$jscomp$0.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + finishedWork$jscomp$0.elementType === + finishedWork$jscomp$0.type + ? prevProps + : resolveDefaultProps( + finishedWork$jscomp$0.type, + prevProps + ), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + case 5: + case 6: + case 4: + case 17: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { + var effectTag = nextEffect.effectTag; + if (effectTag & 128) { + var current$$1$jscomp$0 = nextEffect.alternate; + if (null !== current$$1$jscomp$0) { + var currentRef = current$$1$jscomp$0.ref; + null !== currentRef && + ("function" === typeof currentRef + ? currentRef(null) + : (currentRef.current = null)); + } + } + switch (effectTag & 14) { + case 2: + commitPlacement(nextEffect); + nextEffect.effectTag &= -3; + break; + case 6: + commitPlacement(nextEffect); + nextEffect.effectTag &= -3; + commitWork(nextEffect.alternate, nextEffect); + break; + case 4: + commitWork(nextEffect.alternate, nextEffect); + break; + case 8: + (prevProps = nextEffect), + unmountHostComponents(prevProps, current$$1), + detachFiber(prevProps); + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + root.current = finishedWork; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (effectTag = expirationTime; null !== nextEffect; ) { + var effectTag$jscomp$0 = nextEffect.effectTag; + if (effectTag$jscomp$0 & 36) { + var current$$1$jscomp$1 = nextEffect.alternate; + current$$1$jscomp$0 = nextEffect; + currentRef = effectTag; + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountLayout, + MountLayout, + current$$1$jscomp$0 + ); + break; + case 1: + var instance$jscomp$0 = current$$1$jscomp$0.stateNode; + if (current$$1$jscomp$0.effectTag & 4) + if (null === current$$1$jscomp$1) + instance$jscomp$0.componentDidMount(); + else { + var prevProps$jscomp$0 = + current$$1$jscomp$0.elementType === + current$$1$jscomp$0.type + ? current$$1$jscomp$1.memoizedProps + : resolveDefaultProps( + current$$1$jscomp$0.type, + current$$1$jscomp$1.memoizedProps + ); + instance$jscomp$0.componentDidUpdate( + prevProps$jscomp$0, + current$$1$jscomp$1.memoizedState, + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate + ); + } + var updateQueue = current$$1$jscomp$0.updateQueue; + null !== updateQueue && + commitUpdateQueue( + current$$1$jscomp$0, + updateQueue, + instance$jscomp$0, + currentRef + ); + break; + case 3: + var _updateQueue = current$$1$jscomp$0.updateQueue; + if (null !== _updateQueue) { + current$$1 = null; + if (null !== current$$1$jscomp$0.child) + switch (current$$1$jscomp$0.child.tag) { + case 5: + current$$1 = current$$1$jscomp$0.child.stateNode; + break; + case 1: + current$$1 = current$$1$jscomp$0.child.stateNode; + } + commitUpdateQueue( + current$$1$jscomp$0, + _updateQueue, + current$$1, + currentRef + ); + } + break; + case 5: + break; + case 6: + break; + case 4: + break; + case 12: + break; + case 13: + case 19: + case 17: + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + if (effectTag$jscomp$0 & 128) { + var ref = nextEffect.ref; + if (null !== ref) { + var instance$jscomp$1 = nextEffect.stateNode; + switch (nextEffect.tag) { + case 5: + var instanceToUse = instance$jscomp$1; + break; + default: + instanceToUse = instance$jscomp$1; + } + "function" === typeof ref + ? ref(instanceToUse) + : (ref.current = instanceToUse); + } + } + effectTag$jscomp$0 & 512 && (rootDoesHavePassiveEffects = !0); + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = null; + requestPaint(); + executionContext = childExpirationTimeBeforeCommit; + } else root.current = finishedWork; + if (rootDoesHavePassiveEffects) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + 0 !== renderPriorityLevel + ? ((effectTag$jscomp$0 = requestCurrentTime()), + (effectTag$jscomp$0 = inferPriorityFromExpirationTime( + effectTag$jscomp$0, + renderPriorityLevel + )), + scheduleCallbackForRoot(root, effectTag$jscomp$0, renderPriorityLevel)) + : (legacyErrorBoundariesThatAlreadyFailed = null); + "function" === typeof onCommitFiberRoot && + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + if (hasUncaughtError) + throw ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); + return null; +} +function flushPassiveEffects() { + if (null === rootWithPendingPassiveEffects) return !1; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + for (root = root.current.firstEffect; null !== root; ) { + try { + var finishedWork = root; + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } + } catch (error) { + if (null === root) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(root, error); + } + finishedWork = root.nextEffect; + root.nextEffect = null; + root = finishedWork; + } + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + return !0; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1073741823); + enqueueUpdate(rootFiber, sourceFiber); + rootFiber = markUpdateTimeFromFiberToRoot(rootFiber, 1073741823); + null !== rootFiber && scheduleCallbackForRoot(rootFiber, 99, 1073741823); +} +function captureCommitPhaseError(sourceFiber, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (var fiber = sourceFiber.return; null !== fiber; ) { + if (3 === fiber.tag) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + break; + } else if (1 === fiber.tag) { + var instance = fiber.stateNode; + if ( + "function" === typeof fiber.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createClassErrorUpdate(fiber, sourceFiber, 1073741823); + enqueueUpdate(fiber, sourceFiber); + fiber = markUpdateTimeFromFiberToRoot(fiber, 1073741823); + null !== fiber && scheduleCallbackForRoot(fiber, 99, 1073741823); + break; + } + } + fiber = fiber.return; + } +} +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(thenable); + workInProgressRoot === root && renderExpirationTime === suspendedTime + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) + : root.lastPendingTime < suspendedTime || + ((thenable = root.pingTime), + (0 !== thenable && thenable < suspendedTime) || + ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), + (thenable = requestCurrentTime()), + (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), + scheduleCallbackForRoot(root, thenable, suspendedTime))); +} +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = boundaryFiber.stateNode; + null !== retryCache && retryCache.delete(thenable); + retryCache = requestCurrentTime(); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); + retryCache = inferPriorityFromExpirationTime(retryCache, thenable); + boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); + null !== boundaryFiber && + scheduleCallbackForRoot(boundaryFiber, retryCache, thenable); +} +var beginWork$$1 = void 0; +beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + if (null !== current$$1) + if ( + current$$1.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = !1; + switch (workInProgress.tag) { + case 3: + pushHostRootContext(workInProgress); + break; + case 5: + pushHostContext(workInProgress); + break; + case 1: + isContextProvider(workInProgress.type) && + pushContextProvider(workInProgress); + break; + case 4: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case 10: + pushProvider(workInProgress, workInProgress.memoizedProps.value); + break; + case 13: + if (null !== workInProgress.memoizedState) { + updateExpirationTime = workInProgress.child.childExpirationTime; + if ( + 0 !== updateExpirationTime && + updateExpirationTime >= renderExpirationTime + ) + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + return null !== workInProgress ? workInProgress.sibling : null; + } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + else didReceiveUpdate = !1; + workInProgress.expirationTime = 0; + switch (workInProgress.tag) { + case 2: + updateExpirationTime = workInProgress.type; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderExpirationTime); + renderState = renderWithHooks( + null, + workInProgress, + updateExpirationTime, + current$$1, + renderState, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + if ( + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof + ) { + workInProgress.tag = 1; + resetHooks(); + if (isContextProvider(updateExpirationTime)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + workInProgress.memoizedState = + null !== renderState.state && void 0 !== renderState.state + ? renderState.state + : null; + var getDerivedStateFromProps = + updateExpirationTime.getDerivedStateFromProps; + "function" === typeof getDerivedStateFromProps && + applyDerivedStateFromProps( + workInProgress, + updateExpirationTime, + getDerivedStateFromProps, + current$$1 + ); + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; + mountClassInstance( + workInProgress, + updateExpirationTime, + current$$1, + renderExpirationTime + ); + workInProgress = finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + hasContext, + renderExpirationTime + ); + } else + (workInProgress.tag = 0), + reconcileChildren( + null, + workInProgress, + renderState, + renderExpirationTime + ), + (workInProgress = workInProgress.child); + return workInProgress; + case 16: + renderState = workInProgress.elementType; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); + switch (hasContext) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + renderState, + resolveDefaultProps(renderState.type, current$$1), + updateExpirationTime, + renderExpirationTime + ); + break; + default: + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) + ); + } + return workInProgress; + case 0: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateFunctionComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 1: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateClassComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 3: + pushHostRootContext(workInProgress); + updateExpirationTime = workInProgress.updateQueue; + if (null === updateExpirationTime) + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; + processUpdateQueue( + workInProgress, + updateExpirationTime, + workInProgress.pendingProps, + null, + renderExpirationTime + ); + updateExpirationTime = workInProgress.memoizedState.element; + updateExpirationTime === renderState + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + )) + : (reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + (workInProgress = workInProgress.child)); + return workInProgress; + case 5: + return ( + pushHostContext(workInProgress), + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + (updateExpirationTime = workInProgress.pendingProps.children), + markRef(current$$1, workInProgress), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 6: + return ( + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + null + ); + case 13: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case 4: + return ( + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (updateExpirationTime = workInProgress.pendingProps), + null === current$$1 + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + updateExpirationTime, + renderExpirationTime + )) + : reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 11: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateForwardRef( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 7: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps, + renderExpirationTime + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 12: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 10: + a: { + updateExpirationTime = workInProgress.type._context; + renderState = workInProgress.pendingProps; + getDerivedStateFromProps = workInProgress.memoizedProps; + hasContext = renderState.value; + pushProvider(workInProgress, hasContext); + if (null !== getDerivedStateFromProps) { + var oldValue = getDerivedStateFromProps.value; + hasContext = is(oldValue, hasContext) + ? 0 + : ("function" === typeof updateExpirationTime._calculateChangedBits + ? updateExpirationTime._calculateChangedBits( + oldValue, + hasContext + ) + : 1073741823) | 0; + if (0 === hasContext) { + if ( + getDerivedStateFromProps.children === renderState.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + break a; + } + } else + for ( + oldValue = workInProgress.child, + null !== oldValue && (oldValue.return = workInProgress); + null !== oldValue; + + ) { + var list = oldValue.dependencies; + if (null !== list) { + getDerivedStateFromProps = oldValue.child; + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { + if ( + dependency.context === updateExpirationTime && + 0 !== (dependency.observedBits & hasContext) + ) { + 1 === oldValue.tag && + ((dependency = createUpdate(renderExpirationTime, null)), + (dependency.tag = 2), + enqueueUpdate(oldValue, dependency)); + oldValue.expirationTime < renderExpirationTime && + (oldValue.expirationTime = renderExpirationTime); + dependency = oldValue.alternate; + null !== dependency && + dependency.expirationTime < renderExpirationTime && + (dependency.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); + list.expirationTime < renderExpirationTime && + (list.expirationTime = renderExpirationTime); + break; + } + dependency = dependency.next; + } + } else + getDerivedStateFromProps = + 10 === oldValue.tag + ? oldValue.type === workInProgress.type + ? null + : oldValue.child + : oldValue.child; + if (null !== getDerivedStateFromProps) + getDerivedStateFromProps.return = oldValue; + else + for ( + getDerivedStateFromProps = oldValue; + null !== getDerivedStateFromProps; + + ) { + if (getDerivedStateFromProps === workInProgress) { + getDerivedStateFromProps = null; + break; + } + oldValue = getDerivedStateFromProps.sibling; + if (null !== oldValue) { + oldValue.return = getDerivedStateFromProps.return; + getDerivedStateFromProps = oldValue; + break; + } + getDerivedStateFromProps = getDerivedStateFromProps.return; + } + oldValue = getDerivedStateFromProps; + } + } + reconcileChildren( + current$$1, + workInProgress, + renderState.children, + renderExpirationTime + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: + return ( + (renderState = workInProgress.type), + (hasContext = workInProgress.pendingProps), + (updateExpirationTime = hasContext.children), + prepareToReadContext(workInProgress, renderExpirationTime), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), + (workInProgress.effectTag |= 1), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 14: + return ( + (renderState = workInProgress.type), + (hasContext = resolveDefaultProps( + renderState, + workInProgress.pendingProps + )), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), + updateMemoComponent( + current$$1, + workInProgress, + renderState, + hasContext, + updateExpirationTime, + renderExpirationTime + ) + ); + case 15: + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + case 17: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + (workInProgress.tag = 1), + isContextProvider(updateExpirationTime) + ? ((current$$1 = !0), pushContextProvider(workInProgress)) + : (current$$1 = !1), + prepareToReadContext(workInProgress, renderExpirationTime), + constructClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + current$$1, + renderExpirationTime + ) + ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); +}; +var onCommitFiberRoot = null, + onCommitFiberUnmount = null; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root) { + try { + hook.onCommitFiberRoot( + rendererID, + root, + void 0, + 64 === (root.current.effectTag & 64) + ); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; +} +function findHostInstance(component) { + var fiber = component._reactInternalFiber; + if (void 0 === fiber) { + if ("function" === typeof component.render) + throw ReactError(Error("Unable to find node on an unmounted component.")); + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + component = findCurrentHostFiber(fiber); + return null === component ? null : component.stateNode; +} +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current, + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + currentTime = container.current; + a: if (parentComponent) { + parentComponent = parentComponent._reactInternalFiber; + b: { + if ( + 2 !== isFiberMountedImpl(parentComponent) || + 1 !== parentComponent.tag + ) + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + var parentContext = parentComponent; + do { + switch (parentContext.tag) { + case 3: + parentContext = parentContext.stateNode.context; + break b; + case 1: + if (isContextProvider(parentContext.type)) { + parentContext = + parentContext.stateNode + .__reactInternalMemoizedMergedChildContext; + break b; + } + } + parentContext = parentContext.return; + } while (null !== parentContext); + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (1 === parentComponent.tag) { + var Component = parentComponent.type; + if (isContextProvider(Component)) { + parentComponent = processChildContext( + parentComponent, + Component, + parentContext + ); + break a; + } + } + parentComponent = parentContext; + } else parentComponent = emptyContextObject; + null === container.context + ? (container.context = parentComponent) + : (container.pendingContext = parentComponent); + container = callback; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; + container = void 0 === container ? null : container; + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); + scheduleUpdateOnFiber(currentTime, current$$1); + return current$$1; +} +function createPortal(children, containerInfo, implementation) { + var key = + 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: REACT_PORTAL_TYPE, + key: null == key ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +var getInspectorDataForViewTag = void 0; +getInspectorDataForViewTag = function() { + throw ReactError( + Error("getInspectorDataForViewTag() is not available in production") + ); +}; +function findNodeHandle(componentOrHandle) { + if (null == componentOrHandle) return null; + if ("number" === typeof componentOrHandle) return componentOrHandle; + if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag; + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) + return componentOrHandle.canonical._nativeTag; + componentOrHandle = findHostInstance(componentOrHandle); + return null == componentOrHandle + ? componentOrHandle + : componentOrHandle.canonical + ? componentOrHandle.canonical._nativeTag + : componentOrHandle._nativeTag; +} +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; + try { + return fn(a); + } finally { + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); + } +}; +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); +}; +var roots = new Map(), + ReactNativeRenderer = { + NativeComponent: (function(findNodeHandle, findHostInstance) { + return (function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || + ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.measure = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureInWindow = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }; + ReactNativeComponent.prototype.setNativeProps = function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }; + return ReactNativeComponent; + })(React.Component); + })(findNodeHandle, findHostInstance), + findNodeHandle: findNodeHandle, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, + setNativeProps: function(handle, nativeProps) { + null != handle._nativeTag && + ((nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + handle.viewConfig.validAttributes + )), + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + handle._nativeTag, + handle.viewConfig.uiViewClassName, + nativeProps + )); + }, + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + if (!root) { + root = new FiberRootNode(containerTag, 0, !1); + var uninitializedFiber = createFiber(3, null, null, 0); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + a: if (((element = root.current), element.child)) + switch (element.child.tag) { + case 5: + element = element.child.stateNode; + break a; + default: + element = element.child.stateNode; + } + else element = null; + return element; + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + root && + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + }, + unmountComponentAtNodeAndRemoveContainer: function(containerTag) { + ReactNativeRenderer.unmountComponentAtNode(containerTag); + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); + }, + createPortal: function(children, containerTag) { + return createPortal( + children, + containerTag, + null, + 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null + ); + }, + unstable_batchedUpdates: batchedUpdates, + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + NativeMethodsMixin: (function(findNodeHandle, findHostInstance) { + return { + measure: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureInWindow: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureLayout: function(relativeToNativeNode, onSuccess, onFail) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }, + setNativeProps: function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }, + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + })(findNodeHandle, findHostInstance), + computeComponentStackForErrorReporting: function(reactTag) { + return (reactTag = getInstanceFromTag(reactTag)) + ? getStackByFiberInDevAndProd(reactTag) + : ""; + } + } + }; +(function(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: null, + overrideProps: null, + setSuspenseHandler: null, + scheduleUpdate: null, + currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + fiber = findCurrentHostFiber(fiber); + return null === fiber ? null : fiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + return findFiberByHostInstance + ? findFiberByHostInstance(instance) + : null; + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null + }) + ); +})({ + findFiberByHostInstance: getInstanceFromTag, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 0, + version: "16.8.6", + rendererPackageName: "react-native-renderer" +}); +var ReactNativeRenderer$2 = { default: ReactNativeRenderer }, + ReactNativeRenderer$3 = + (ReactNativeRenderer$2 && ReactNativeRenderer) || ReactNativeRenderer$2; +module.exports = ReactNativeRenderer$3.default || ReactNativeRenderer$3; diff --git a/Libraries/Renderer/oss/ReactNativeRenderer-prod.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js similarity index 74% rename from Libraries/Renderer/oss/ReactNativeRenderer-prod.js rename to Libraries/Renderer/implementations/ReactNativeRenderer-prod.js index 5fbb834c706292..ab86d1df931694 100644 --- a/Libraries/Renderer/oss/ReactNativeRenderer-prod.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js @@ -11,20 +11,13 @@ */ "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), - UIManager = require("UIManager"), - RCTEventEmitter = require("RCTEventEmitter"), +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), - deepDiffer = require("deepDiffer"), - flattenStyle = require("flattenStyle"), - TextInputState = require("TextInputState"), Scheduler = require("scheduler"); -var ExceptionsManager = require("ExceptionsManager"); -function ReactError(message) { - message = Error(message); - message.name = "Invariant Violation"; - return message; +function ReactError(error) { + error.name = "Invariant Violation"; + return error; } var eventPluginOrder = null, namesToPlugins = {}; @@ -35,16 +28,20 @@ function recomputePluginOrdering() { pluginIndex = eventPluginOrder.indexOf(pluginName); if (!(-1 < pluginIndex)) throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -55,9 +52,11 @@ function recomputePluginOrdering() { eventName$jscomp$0 = eventName; if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -83,11 +82,13 @@ function recomputePluginOrdering() { : (JSCompiler_inline_result = !1); if (!JSCompiler_inline_result) throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } } @@ -96,9 +97,11 @@ function recomputePluginOrdering() { function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); registrationNameModules[registrationName] = pluginModule; } @@ -147,7 +150,9 @@ function invokeGuardedCallbackAndCatchFirstError( caughtError = null; } else throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); } @@ -165,7 +170,7 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; if (Array.isArray(dispatchListener)) - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null; @@ -178,7 +183,9 @@ function executeDirectDispatch(event) { function accumulateInto(current, next) { if (null == next) throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); if (null == current) return next; if (Array.isArray(current)) { @@ -215,7 +222,9 @@ var injection = { injectEventPluginOrder: function(injectedEventPluginOrder) { if (eventPluginOrder) throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); recomputePluginOrdering(); @@ -232,9 +241,11 @@ var injection = { ) { if (namesToPlugins[pluginName]) throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); namesToPlugins[pluginName] = pluginModule; isOrderingDirty = !0; @@ -276,11 +287,13 @@ function getListener(inst, registrationName) { if (inst) return null; if (listener && "function" !== typeof listener) throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); return listener; } @@ -444,7 +457,9 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { function releasePooledEvent(event) { if (!(event instanceof this)) throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); event.destructor(); 10 > this.eventPool.length && this.eventPool.push(event); @@ -480,7 +495,8 @@ function timestampForTouch(touch) { } function getTouchIdentifier(_ref) { _ref = _ref.identifier; - if (null == _ref) throw ReactError("Touch object is missing identifier."); + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); return _ref; } function recordTouchStart(touch) { @@ -523,7 +539,7 @@ function recordTouchMove(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch move without a touch start.\nTouch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -541,7 +557,7 @@ function recordTouchEnd(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch end without a touch start.\nTouch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -595,7 +611,7 @@ var ResponderTouchHistoryStore = { function accumulate(current, next) { if (null == next) throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error("accumulate(...): Accumulated items must not be null or undefined.") ); return null == current ? next @@ -617,7 +633,7 @@ function changeResponder(nextResponderInst, blockHostResponder) { blockHostResponder ); } -var eventTypes$1 = { +var eventTypes = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", @@ -680,7 +696,7 @@ var eventTypes$1 = { _getResponder: function() { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, extractEvents: function( topLevelType, targetInst, @@ -709,12 +725,12 @@ var eventTypes$1 = { isMoveish(topLevelType)) ) { var JSCompiler_temp = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : "topSelectionChange" === topLevelType - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; if (responderInst) b: { var JSCompiler_temp$jscomp$0 = responderInst; @@ -800,7 +816,7 @@ var eventTypes$1 = { JSCompiler_temp && JSCompiler_temp !== responderInst ? ((JSCompiler_temp$jscomp$0 = void 0), (targetInst = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -810,7 +826,7 @@ var eventTypes$1 = { (depthA = !0 === executeDirectDispatch(targetInst)), responderInst ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -822,7 +838,7 @@ var eventTypes$1 = { tempA.isPersistent() || tempA.constructor.release(tempA), tempB ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -836,7 +852,7 @@ var eventTypes$1 = { )), changeResponder(JSCompiler_temp, depthA)) : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -866,11 +882,11 @@ var eventTypes$1 = { ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); if ( (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderStart + ? eventTypes.responderStart : targetInst - ? eventTypes$1.responderMove + ? eventTypes.responderMove : depthA - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null) ) (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( @@ -924,9 +940,9 @@ var eventTypes$1 = { } if ( (topLevelType = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : topLevelType - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null) ) (nativeEvent = ResponderSyntheticEvent.getPooled( @@ -948,8 +964,20 @@ var eventTypes$1 = { } } }, - ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, extractEvents: function( topLevelType, targetInst, @@ -957,13 +985,13 @@ var eventTypes$1 = { nativeEventTarget ) { if (null == targetInst) return null; - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType], - directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; if (!bubbleDispatchConfig && !directDispatchConfig) throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); topLevelType = SyntheticEvent.getPooled( bubbleDispatchConfig || directDispatchConfig, @@ -978,42 +1006,40 @@ var eventTypes$1 = { else return null; return topLevelType; } - }; -injection.injectEventPluginOrder([ - "ResponderEventPlugin", - "ReactNativeBridgeEventPlugin" -]); -injection.injectEventPluginsByName({ - ResponderEventPlugin: ResponderEventPlugin, - ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin + } }); -var instanceCache = {}, - instanceProps = {}; +var instanceCache = new Map(), + instanceProps = new Map(); function getInstanceFromTag(tag) { - return instanceCache[tag] || null; + return instanceCache.get(tag) || null; } var restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { if (getInstanceFromNode(target)) throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } -function _batchedUpdatesImpl(fn, bookkeeping) { +function batchedUpdatesImpl(fn, bookkeeping) { return fn(bookkeeping); } -function _flushInteractiveUpdatesImpl() {} -var isBatching = !1; +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; function batchedUpdates(fn, bookkeeping) { - if (isBatching) return fn(bookkeeping); - isBatching = !0; + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue)) + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) if ( - (_flushInteractiveUpdatesImpl(), + (flushDiscreteUpdatesImpl(), restoreTarget && ((bookkeeping = restoreTarget), (fn = restoreQueue), @@ -1050,7 +1076,9 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); if (hasRethrowError) throw ((events = rethrowError), @@ -1060,7 +1088,7 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { } }); } -RCTEventEmitter.register({ +ReactNativePrivateInterface.RCTEventEmitter.register({ receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) { _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); }, @@ -1098,26 +1126,31 @@ RCTEventEmitter.register({ } }); getFiberCurrentPropsFromNode = function(stateNode) { - return instanceProps[stateNode._nativeTag] || null; + return instanceProps.get(stateNode._nativeTag) || null; }; getInstanceFromNode = getInstanceFromTag; getNodeFromInstance = function(inst) { var tag = inst.stateNode._nativeTag; void 0 === tag && (tag = inst.stateNode.canonical._nativeTag); - if (!tag) throw ReactError("All native instances should have a tag."); + if (!tag) throw ReactError(Error("All native instances should have a tag.")); return tag; }; ResponderEventPlugin.injection.injectGlobalResponderHandler({ onChange: function(from, to, blockNativeResponder) { null !== to - ? UIManager.setJSResponder(to.stateNode._nativeTag, blockNativeResponder) - : UIManager.clearJSResponder(); + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); } }); var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); var hasSymbol = "function" === typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, @@ -1131,11 +1164,13 @@ var hasSymbol = "function" === typeof Symbol && Symbol.for, : 60111, REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; -hasSymbol && Symbol.for("react.event_component"); -hasSymbol && Symbol.for("react.event_target"); -hasSymbol && Symbol.for("react.event_target.touch_hit"); +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; @@ -1149,8 +1184,6 @@ function getComponentName(type) { if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -1161,6 +1194,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { @@ -1195,14 +1230,14 @@ function isFiberMountedImpl(fiber) { } function assertIsMounted(fiber) { if (2 !== isFiberMountedImpl(fiber)) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = isFiberMountedImpl(fiber); if (3 === alternate) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return 1 === alternate ? null : fiber; } for (var a = fiber, b = alternate; ; ) { @@ -1223,7 +1258,7 @@ function findCurrentFiberUsingSlowPath(fiber) { if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } if (a.return !== b.return) (a = parentA), (b = parentB); else { @@ -1260,17 +1295,21 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (!didFindChild) throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } } if (a.alternate !== b) throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (3 !== a.tag) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiber(parent) { @@ -1375,14 +1414,14 @@ function diffNestedProperty( return Array.isArray(prevProp) ? diffProperties( updatePayload, - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), nextProp, validAttributes ) : diffProperties( updatePayload, prevProp, - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -1450,7 +1489,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { if ("object" !== typeof attributeConfig) ("object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) && + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && ((updatePayload || (updatePayload = {}))[propKey] = nextProp); else if ( "function" === typeof attributeConfig.diff || @@ -1462,7 +1501,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { ? attributeConfig.diff(prevProp, nextProp) : "object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) ) (attributeConfig = "function" === typeof attributeConfig.process @@ -1527,19 +1566,19 @@ var ReactNativeFiberHostComponent = (function() { this.viewConfig = viewConfig; } ReactNativeFiberHostComponent.prototype.blur = function() { - TextInputState.blurTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.focus = function() { - TextInputState.focusTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.measure = function(callback) { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); }; ReactNativeFiberHostComponent.prototype.measureInWindow = function(callback) { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -1558,7 +1597,7 @@ var ReactNativeFiberHostComponent = (function() { relativeToNativeNode.canonical._nativeTag && (relativeNode = relativeToNativeNode.canonical._nativeTag); null != relativeNode && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( this._nativeTag, relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -1575,7 +1614,7 @@ var ReactNativeFiberHostComponent = (function() { this.viewConfig.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( this._nativeTag, this.viewConfig.uiViewClassName, nativeProps @@ -1585,10 +1624,14 @@ var ReactNativeFiberHostComponent = (function() { })(); function shim$1() { throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) ); } -var UPDATE_SIGNAL = {}, +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + UPDATE_SIGNAL = {}, nextReactTag = 3; function allocateTag() { var tag = nextReactTag; @@ -1598,11 +1641,11 @@ function allocateTag() { } function recursivelyUncacheFiberNode(node) { if ("number" === typeof node) - delete instanceCache[node], delete instanceProps[node]; + instanceCache.delete(node), instanceProps.delete(node); else { var tag = node._nativeTag; - delete instanceCache[tag]; - delete instanceProps[tag]; + instanceCache.delete(tag); + instanceProps.delete(tag); node._children.forEach(recursivelyUncacheFiberNode); } } @@ -1611,7 +1654,10 @@ function finalizeInitialChildren(parentInstance) { var nativeTags = parentInstance._children.map(function(child) { return "number" === typeof child ? child : child._nativeTag; }); - UIManager.setChildren(parentInstance._nativeTag, nativeTags); + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance._nativeTag, + nativeTags + ); return !1; } var scheduleTimeout = setTimeout, @@ -1702,7 +1748,9 @@ function popTopLevelContextObject(fiber) { function pushTopLevelContextObject(fiber, context, didChange) { if (contextStackCursor.current !== emptyContextObject) throw ReactError( - "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." + Error( + "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); @@ -1715,10 +1763,12 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in instance) if (!(contextKey in fiber)) throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) ); return Object.assign({}, parentContext, instance); } @@ -1740,7 +1790,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.stateNode; if (!instance) throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) ); didChange ? ((type = processChildContext(workInProgress, type, previousContext)), @@ -1751,33 +1803,11 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } -var onCommitFiberRoot = null, - onCommitFiberUnmount = null; -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) {} - }; -} -function injectInternals(internals) { - if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled || !hook.supportsFiber) return !0; - try { - var rendererID = hook.inject(internals); - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) {} - return !0; -} var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, @@ -1787,10 +1817,11 @@ var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_LowPriority = Scheduler.unstable_LowPriority, Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, fakeCallbackNode = {}, - shouldYield = Scheduler.unstable_shouldYield, - immediateQueue = null, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, immediateQueueCallbackNode = null, - isFlushingImmediate = !1, + isFlushingSyncQueue = !1, initialTimeMs = Scheduler_now(), now = 1e4 > initialTimeMs @@ -1811,7 +1842,7 @@ function getCurrentPriorityLevel() { case Scheduler_IdlePriority: return 95; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function reactPriorityToSchedulerPriority(reactPriorityLevel) { @@ -1827,7 +1858,7 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) { case 95: return Scheduler_IdlePriority; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function runWithPriority(reactPriorityLevel, fn) { @@ -1835,46 +1866,47 @@ function runWithPriority(reactPriorityLevel, fn) { return Scheduler_runWithPriority(reactPriorityLevel, fn); } function scheduleCallback(reactPriorityLevel, callback, options) { - if (99 === reactPriorityLevel) - return ( - null === immediateQueue - ? ((immediateQueue = [callback]), - (immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ))) - : immediateQueue.push(callback), - fakeCallbackNode - ); reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); } -function flushImmediateQueue() { +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { null !== immediateQueueCallbackNode && Scheduler_cancelCallback(immediateQueueCallbackNode); - flushImmediateQueueImpl(); + flushSyncCallbackQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && null !== immediateQueue) { - isFlushingImmediate = !0; +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; var i = 0; try { - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do callback = callback(!0); - while (null !== callback); - } - immediateQueue = null; + var queue = syncQueue; + runWithPriority(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; } catch (error) { - throw (null !== immediateQueue && - (immediateQueue = immediateQueue.slice(i + 1)), + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), Scheduler_scheduleCallback( Scheduler_ImmediatePriority, - flushImmediateQueue + flushSyncCallbackQueue ), error); } finally { - isFlushingImmediate = !1; + isFlushingSyncQueue = !1; } } } @@ -1882,7 +1914,7 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { if (1073741823 === expirationTime) return 99; if (1 === expirationTime) return 95; currentTime = - 10 * (1073741822 - expirationTime) - 10 * (1073741822 - currentTime); + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); return 0 >= currentTime ? 99 : 250 >= currentTime @@ -1891,186 +1923,6 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { ? 97 : 95; } -function FiberNode(tag, pendingProps, key, mode) { - this.tag = tag; - this.key = key; - this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.contextDependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; - this.mode = mode; - this.effectTag = 0; - this.lastEffect = this.firstEffect = this.nextEffect = null; - this.childExpirationTime = this.expirationTime = 0; - this.alternate = null; -} -function createFiber(tag, pendingProps, key, mode) { - return new FiberNode(tag, pendingProps, key, mode); -} -function shouldConstruct(Component) { - Component = Component.prototype; - return !(!Component || !Component.isReactComponent); -} -function resolveLazyComponentTag(Component) { - if ("function" === typeof Component) - return shouldConstruct(Component) ? 1 : 0; - if (void 0 !== Component && null !== Component) { - Component = Component.$$typeof; - if (Component === REACT_FORWARD_REF_TYPE) return 11; - if (Component === REACT_MEMO_TYPE) return 14; - } - return 2; -} -function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - null === workInProgress - ? ((workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - )), - (workInProgress.elementType = current.elementType), - (workInProgress.type = current.type), - (workInProgress.stateNode = current.stateNode), - (workInProgress.alternate = current), - (current.alternate = workInProgress)) - : ((workInProgress.pendingProps = pendingProps), - (workInProgress.effectTag = 0), - (workInProgress.nextEffect = null), - (workInProgress.firstEffect = null), - (workInProgress.lastEffect = null)); - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - return workInProgress; -} -function createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiberTag = 2; - owner = type; - if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); - else if ("string" === typeof type) fiberTag = 5; - else - a: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 3, expirationTime, key); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 2, expirationTime, key); - case REACT_PROFILER_TYPE: - return ( - (type = createFiber(12, pendingProps, key, mode | 4)), - (type.elementType = REACT_PROFILER_TYPE), - (type.type = REACT_PROFILER_TYPE), - (type.expirationTime = expirationTime), - type - ); - case REACT_SUSPENSE_TYPE: - return ( - (type = createFiber(13, pendingProps, key, mode)), - (type.elementType = REACT_SUSPENSE_TYPE), - (type.type = REACT_SUSPENSE_TYPE), - (type.expirationTime = expirationTime), - type - ); - default: - if ("object" === typeof type && null !== type) - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = 10; - break a; - case REACT_CONTEXT_TYPE: - fiberTag = 9; - break a; - case REACT_FORWARD_REF_TYPE: - fiberTag = 11; - break a; - case REACT_MEMO_TYPE: - fiberTag = 14; - break a; - case REACT_LAZY_TYPE: - fiberTag = 16; - owner = null; - break a; - } - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." - ); - } - key = createFiber(fiberTag, pendingProps, key, mode); - key.elementType = type; - key.type = owner; - key.expirationTime = expirationTime; - return key; -} -function createFiberFromFragment(elements, mode, expirationTime, key) { - elements = createFiber(7, elements, key, mode); - elements.expirationTime = expirationTime; - return elements; -} -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - pendingProps = createFiber(8, pendingProps, key, mode); - mode = 0 === (mode & 1) ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE; - pendingProps.elementType = mode; - pendingProps.type = mode; - pendingProps.expirationTime = expirationTime; - return pendingProps; -} -function createFiberFromText(content, mode, expirationTime) { - content = createFiber(6, content, null, mode); - content.expirationTime = expirationTime; - return content; -} -function createFiberFromPortal(portal, mode, expirationTime) { - mode = createFiber( - 4, - null !== portal.children ? portal.children : [], - portal.key, - mode - ); - mode.expirationTime = expirationTime; - mode.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - implementation: portal.implementation - }; - return mode; -} -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pingCache = this.pendingChildren = null; - this.pendingCommitExpirationTime = 0; - this.finishedWork = null; - this.timeoutHandle = -1; - this.pendingContext = this.context = null; - this.hydrate = hydrate; - this.callbackNode = this.firstBatch = null; - this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; -} function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } @@ -2144,7 +1996,7 @@ var valueCursor = { current: null }, currentlyRenderingFiber = null, lastContextDependency = null, lastContextWithAllBitsObserved = null; -function resetContextDependences() { +function resetContextDependencies() { lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; } function pushProvider(providerFiber, nextValue) { @@ -2157,14 +2009,32 @@ function popProvider(providerFiber) { pop(valueCursor, providerFiber); providerFiber.type._context._currentValue = currentValue; } +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} function prepareToReadContext(workInProgress, renderExpirationTime) { currentlyRenderingFiber = workInProgress; lastContextWithAllBitsObserved = lastContextDependency = null; - var currentDependencies = workInProgress.contextDependencies; - null !== currentDependencies && - currentDependencies.expirationTime >= renderExpirationTime && - (didReceiveUpdate = !0); - workInProgress.contextDependencies = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } function readContext(context, observedBits) { if ( @@ -2178,12 +2048,15 @@ function readContext(context, observedBits) { if (null === lastContextDependency) { if (null === currentlyRenderingFiber) throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); lastContextDependency = observedBits; - currentlyRenderingFiber.contextDependencies = { - first: observedBits, - expirationTime: 0 + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null }; } else lastContextDependency = lastContextDependency.next = observedBits; } @@ -2216,9 +2089,10 @@ function cloneUpdateQueue(currentQueue) { lastCapturedEffect: null }; } -function createUpdate(expirationTime) { +function createUpdate(expirationTime, suspenseConfig) { return { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: 0, payload: null, callback: null, @@ -2334,8 +2208,10 @@ function processUpdateQueue( ((newFirstUpdate = update), (newBaseState = resultState)), newExpirationTime < updateExpirationTime && (newExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), (resultState = getStateFromUpdate( workInProgress, queue, @@ -2411,15 +2287,18 @@ function commitUpdateEffects(effect, instance) { var context = instance; if ("function" !== typeof _callback3) throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - _callback3 + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) ); _callback3.call(context); } effect = effect.nextEffect; } } -var emptyRefsObject = new React.Component().refs; +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; function applyDerivedStateFromProps( workInProgress, ctor, @@ -2446,36 +2325,42 @@ var classComponentUpdater = { }, enqueueSetState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 1; - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 2; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); } }; @@ -2604,15 +2489,19 @@ function coerceRef(returnFiber, current$$1, element) { if (element) { if (1 !== element.tag) throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); inst = element.stateNode; } if (!inst) throw ReactError( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); var stringRef = "" + returnFiber; if ( @@ -2632,13 +2521,17 @@ function coerceRef(returnFiber, current$$1, element) { } if ("string" !== typeof returnFiber) throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); if (!element._owner) throw ReactError( - "Element ref was specified as a string (" + - returnFiber + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } return returnFiber; @@ -2646,11 +2539,13 @@ function coerceRef(returnFiber, current$$1, element) { function throwOnInvalidObjectType(returnFiber, newChild) { if ("textarea" !== returnFiber.type) throw ReactError( - "Objects are not valid as a React child (found: " + - ("[object Object]" === Object.prototype.toString.call(newChild) - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) ); } function ChildReconciler(shouldTrackSideEffects) { @@ -3053,11 +2948,13 @@ function ChildReconciler(shouldTrackSideEffects) { var iteratorFn = getIteratorFn(newChildrenIterable); if ("function" !== typeof iteratorFn) throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); newChildrenIterable = iteratorFn.call(newChildrenIterable); if (null == newChildrenIterable) - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); for ( var previousNewFiber = (iteratorFn = null), oldFiber = currentFirstChild, @@ -3292,8 +3189,10 @@ function ChildReconciler(shouldTrackSideEffects) { case 0: throw ((returnFiber = returnFiber.type), ReactError( - (returnFiber.displayName || returnFiber.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) )); } return deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3308,7 +3207,9 @@ var reconcileChildFibers = ChildReconciler(!0), function requiredContext(c) { if (c === NO_CONTEXT) throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); return c; } @@ -3346,13 +3247,41 @@ function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); } -var NoEffect$1 = 0, - UnmountSnapshot = 2, - UnmountMutation = 4, - MountMutation = 8, - UnmountLayout = 16, - MountLayout = 32, - MountPassive = 64, +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} +var NoEffect$1 = 0, + UnmountSnapshot = 2, + UnmountMutation = 4, + MountMutation = 8, + UnmountLayout = 16, + MountLayout = 32, + MountPassive = 64, UnmountPassive = 128, ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, renderExpirationTime$1 = 0, @@ -3370,7 +3299,9 @@ var NoEffect$1 = 0, numberOfReRenders = 0; function throwInvalidHookError() { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -3420,7 +3351,9 @@ function renderWithHooks( sideEffectTag = 0; if (current) throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); return workInProgress; } @@ -3456,7 +3389,9 @@ function updateWorkInProgressHook() { (nextCurrentHook = null !== currentHook ? currentHook.next : null); else { if (null === nextCurrentHook) - throw ReactError("Rendered more hooks than during the previous render."); + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); currentHook = nextCurrentHook; var newHook = { memoizedState: currentHook.memoizedState, @@ -3481,7 +3416,9 @@ function updateReducer(reducer) { queue = hook.queue; if (null === queue) throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); queue.lastRenderedReducer = reducer; if (0 < numberOfReRenders) { @@ -3524,8 +3461,10 @@ function updateReducer(reducer) { (firstRenderPhaseUpdate = newState)), updateExpirationTime > remainingExpirationTime && (remainingExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), (newState = _update.eagerReducer === reducer ? _update.eagerState @@ -3604,7 +3543,9 @@ function mountDebugValue() {} function dispatchAction(fiber, queue, action) { if (!(25 > numberOfReRenders)) throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); var alternate = fiber.alternate; if ( @@ -3615,6 +3556,7 @@ function dispatchAction(fiber, queue, action) { ((didScheduleRenderPhaseUpdate = !0), (fiber = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, @@ -3630,24 +3572,29 @@ function dispatchAction(fiber, queue, action) { queue.next = fiber; } else { - flushPassiveEffects(); - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, fiber); - var _update2 = { - expirationTime: currentTime, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }, - _last = queue.last; - if (null === _last) _update2.next = _update2; + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; else { var first = _last.next; - null !== first && (_update2.next = first); - _last.next = _update2; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; } - queue.last = _update2; + queue.last = _suspenseConfig; if ( 0 === fiber.expirationTime && (null === alternate || 0 === alternate.expirationTime) && @@ -3656,8 +3603,8 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, _eagerState = alternate(currentState, action); - _update2.eagerReducer = alternate; - _update2.eagerState = _eagerState; + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; if (is(_eagerState, currentState)) return; } catch (error) { } finally { @@ -3676,7 +3623,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }, HooksDispatcherOnMount = { readContext: readContext, @@ -3749,7 +3697,8 @@ var ContextOnlyDispatcher = { ); return [hook.memoizedState, initialState]; }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, HooksDispatcherOnUpdate = { readContext: readContext, @@ -3803,7 +3752,8 @@ var ContextOnlyDispatcher = { useState: function(initialState) { return updateReducer(basicStateReducer, initialState); }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, hydrationParentFiber = null, nextHydratableInstance = null, @@ -4022,17 +3972,17 @@ function updateFunctionComponent( nextProps, renderExpirationTime ) { - var unmaskedContext = isContextProvider(Component) + var context = isContextProvider(Component) ? previousContext : contextStackCursor.current; - unmaskedContext = getMaskedContext(workInProgress, unmaskedContext); + context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderExpirationTime); Component = renderWithHooks( current$$1, workInProgress, Component, nextProps, - unmaskedContext, + context, renderExpirationTime ); if (null !== current$$1 && !didReceiveUpdate) @@ -4344,6 +4294,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } +var SUSPENDED_MARKER = {}; function updateSuspenseComponent( current$$1, workInProgress, @@ -4351,100 +4302,271 @@ function updateSuspenseComponent( ) { var mode = workInProgress.mode, nextProps = workInProgress.pendingProps, - nextState = workInProgress.memoizedState; - if (0 === (workInProgress.effectTag & 64)) { - nextState = null; - var nextDidTimeout = !1; - } else - (nextState = { - fallbackExpirationTime: - null !== nextState ? nextState.fallbackExpirationTime : 0 - }), + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), (nextDidTimeout = !0), - (workInProgress.effectTag &= -65); + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); if (null === current$$1) if (nextDidTimeout) { - var nextFallbackChildren = nextProps.fallback; + nextProps = nextProps.fallback; current$$1 = createFiberFromFragment(null, mode, 0, null); - 0 === (workInProgress.mode & 1) && - (current$$1.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child); - mode = createFiberFromFragment( - nextFallbackChildren, + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, mode, renderExpirationTime, null ); - current$$1.sibling = mode; - renderExpirationTime = current$$1; - renderExpirationTime.return = mode.return = workInProgress; + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; } else - renderExpirationTime = mode = mountChildFibers( + mode = renderExpirationTime = mountChildFibers( workInProgress, null, nextProps.children, renderExpirationTime ); - else - null !== current$$1.memoizedState - ? ((mode = current$$1.child), - (nextFallbackChildren = mode.sibling), - nextDidTimeout - ? ((renderExpirationTime = nextProps.fallback), - (nextProps = createWorkInProgress(mode, mode.pendingProps, 0)), - 0 === (workInProgress.mode & 1) && - ((nextDidTimeout = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child), - nextDidTimeout !== mode.child && - (nextProps.child = nextDidTimeout)), - (mode = nextProps.sibling = createWorkInProgress( - nextFallbackChildren, - renderExpirationTime, - nextFallbackChildren.expirationTime - )), - (renderExpirationTime = nextProps), - (nextProps.childExpirationTime = 0), - (renderExpirationTime.return = mode.return = workInProgress)) - : (renderExpirationTime = mode = reconcileChildFibers( - workInProgress, - mode.child, - nextProps.children, - renderExpirationTime - ))) - : ((nextFallbackChildren = current$$1.child), - nextDidTimeout - ? ((nextDidTimeout = nextProps.fallback), - (nextProps = createFiberFromFragment(null, mode, 0, null)), - (nextProps.child = nextFallbackChildren), - 0 === (workInProgress.mode & 1) && - (nextProps.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child), - (mode = nextProps.sibling = createFiberFromFragment( - nextDidTimeout, - mode, - renderExpirationTime, - null - )), - (mode.effectTag |= 2), - (renderExpirationTime = nextProps), - (nextProps.childExpirationTime = 0), - (renderExpirationTime.return = mode.return = workInProgress)) - : (mode = renderExpirationTime = reconcileChildFibers( - workInProgress, - nextFallbackChildren, - nextProps.children, - renderExpirationTime - ))), - (workInProgress.stateNode = current$$1.stateNode); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } workInProgress.memoizedState = nextState; - workInProgress.child = renderExpirationTime; - return mode; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; } function bailoutOnAlreadyFinishedWork( current$$1, @@ -4452,10 +4574,10 @@ function bailoutOnAlreadyFinishedWork( renderExpirationTime ) { null !== current$$1 && - (workInProgress.contextDependencies = current$$1.contextDependencies); + (workInProgress.dependencies = current$$1.dependencies); if (workInProgress.childExpirationTime < renderExpirationTime) return null; if (null !== current$$1 && workInProgress.child !== current$$1.child) - throw ReactError("Resuming work not yet implemented."); + throw ReactError(Error("Resuming work not yet implemented.")); if (null !== workInProgress.child) { current$$1 = workInProgress.child; renderExpirationTime = createWorkInProgress( @@ -4511,6 +4633,74 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) { updateHostText$1 = function(current, workInProgress, oldText, newText) { oldText !== newText && (workInProgress.effectTag |= 4); }; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} function createCapturedValue(value, source) { return { value: value, @@ -4518,24 +4708,18 @@ function createCapturedValue(value, source) { stack: getStackByFiberInDevAndProd(source) }; } +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); function logCapturedError(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - if (error instanceof Error) { - capturedError = error.message; - var name = error.name; - try { - error.message = - (capturedError ? name + ": " + capturedError : name) + - "\n\nThis error is located at:" + - componentStack; - } catch (e) {} - } else - error = - "string" === typeof error - ? Error(error + "\n\nThis error is located at:" + componentStack) - : Error("Unspecified error at:" + componentStack); - ExceptionsManager.handleException(error, !1); + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); } var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; function logError(boundary, errorInfo) { @@ -4567,6 +4751,15 @@ function logError(boundary, errorInfo) { }); } } +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} function safelyDetachRef(current$$1) { var ref = current$$1.ref; if (null !== ref) @@ -4595,65 +4788,7 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } while (effect !== finishedWork); } } -function hideOrUnhideAllChildren(finishedWork, isHidden) { - for (var node = finishedWork; ; ) { - if (5 === node.tag) { - var instance = node.stateNode; - if (isHidden) { - var viewConfig = instance.viewConfig; - var updatePayload = diffProperties( - null, - emptyObject, - { style: { display: "none" } }, - viewConfig.validAttributes - ); - UIManager.updateView( - instance._nativeTag, - viewConfig.uiViewClassName, - updatePayload - ); - } else { - instance = node.stateNode; - updatePayload = node.memoizedProps; - viewConfig = instance.viewConfig; - var prevProps = Object.assign({}, updatePayload, { - style: [updatePayload.style, { display: "none" }] - }); - updatePayload = diffProperties( - null, - prevProps, - updatePayload, - viewConfig.validAttributes - ); - UIManager.updateView( - instance._nativeTag, - viewConfig.uiViewClassName, - updatePayload - ); - } - } else { - if (6 === node.tag) throw Error("Not yet implemented."); - if (13 === node.tag && null !== node.memoizedState) { - instance = node.child.sibling; - instance.return = node; - node = instance; - continue; - } else if (null !== node.child) { - node.child.return = node; - node = node.child; - continue; - } - } - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } -} -function commitUnmount(current$$1$jscomp$0) { +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { "function" === typeof onCommitFiberUnmount && onCommitFiberUnmount(current$$1$jscomp$0); switch (current$$1$jscomp$0.tag) { @@ -4666,40 +4801,57 @@ function commitUnmount(current$$1$jscomp$0) { null !== updateQueue && ((updateQueue = updateQueue.lastEffect), null !== updateQueue) ) { - var effect = (updateQueue = updateQueue.next); - do { - var destroy = effect.destroy; - if (void 0 !== destroy) { - var current$$1 = current$$1$jscomp$0; - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current$$1, error); - } + var firstEffect = updateQueue.next; + runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); } - effect = effect.next; - } while (effect !== updateQueue); + ); } break; case 1: safelyDetachRef(current$$1$jscomp$0); - updateQueue = current$$1$jscomp$0.stateNode; - if ("function" === typeof updateQueue.componentWillUnmount) - try { - (updateQueue.props = current$$1$jscomp$0.memoizedProps), - (updateQueue.state = current$$1$jscomp$0.memoizedState), - updateQueue.componentWillUnmount(); - } catch (unmountError) { - captureCommitPhaseError(current$$1$jscomp$0, unmountError); - } + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); break; case 5: safelyDetachRef(current$$1$jscomp$0); break; case 4: - unmountHostComponents(current$$1$jscomp$0); + unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); } } +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} function isHostParent(fiber) { return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } @@ -4713,25 +4865,29 @@ function commitPlacement(finishedWork) { parent = parent.return; } throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } + parent = parentFiber.stateNode; switch (parentFiber.tag) { case 5: - parent = parentFiber.stateNode; var isContainer = !1; break; case 3: - parent = parentFiber.stateNode.containerInfo; + parent = parent.containerInfo; isContainer = !0; break; case 4: - parent = parentFiber.stateNode.containerInfo; + parent = parent.containerInfo; isContainer = !0; break; default: throw ReactError( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) ); } parentFiber.effectTag & 16 && (parentFiber.effectTag &= -17); @@ -4761,25 +4917,26 @@ function commitPlacement(finishedWork) { } } for (var node = finishedWork; ; ) { - if (5 === node.tag || 6 === node.tag) { - var stateNode = node.stateNode; + var isHost = 5 === node.tag || 6 === node.tag; + if (isHost) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; if (parentFiber) if (isContainer) { if ("number" === typeof parent) throw ReactError( - "Container does not support insertBefore operation" + Error("Container does not support insertBefore operation") ); } else { - var parentInstance = parent, - beforeChild = parentFiber, - children = parentInstance._children, + isHost = parent; + var beforeChild = parentFiber, + children = isHost._children, index = children.indexOf(stateNode); 0 <= index ? (children.splice(index, 1), (beforeChild = children.indexOf(beforeChild)), children.splice(beforeChild, 0, stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [index], [beforeChild], [], @@ -4788,8 +4945,8 @@ function commitPlacement(finishedWork) { )) : ((index = children.indexOf(beforeChild)), children.splice(index, 0, stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [], [], [ @@ -4803,19 +4960,19 @@ function commitPlacement(finishedWork) { } else isContainer - ? UIManager.setChildren(parent, [ + ? ReactNativePrivateInterface.UIManager.setChildren(parent, [ "number" === typeof stateNode ? stateNode : stateNode._nativeTag ]) - : ((parentInstance = parent), + : ((isHost = parent), (children = "number" === typeof stateNode ? stateNode : stateNode._nativeTag), - (index = parentInstance._children), + (index = isHost._children), (beforeChild = index.indexOf(stateNode)), 0 <= beforeChild ? (index.splice(beforeChild, 1), index.push(stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [beforeChild], [index.length - 1], [], @@ -4823,8 +4980,8 @@ function commitPlacement(finishedWork) { [] )) : (index.push(stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [], [], [children], @@ -4845,7 +5002,7 @@ function commitPlacement(finishedWork) { node = node.sibling; } } -function unmountHostComponents(current$$1) { +function unmountHostComponents(current$$1, renderPriorityLevel$jscomp$0) { for ( var node = current$$1, currentParentIsValid = !1, @@ -4859,19 +5016,21 @@ function unmountHostComponents(current$$1) { a: for (;;) { if (null === currentParentIsValid) throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); + currentParent = currentParentIsValid.stateNode; switch (currentParentIsValid.tag) { case 5: - currentParent = currentParentIsValid.stateNode; currentParentIsContainer = !1; break a; case 3: - currentParent = currentParentIsValid.stateNode.containerInfo; + currentParent = currentParent.containerInfo; currentParentIsContainer = !0; break a; case 4: - currentParent = currentParentIsValid.stateNode.containerInfo; + currentParent = currentParent.containerInfo; currentParentIsContainer = !0; break a; } @@ -4880,9 +5039,15 @@ function unmountHostComponents(current$$1) { currentParentIsValid = !0; } if (5 === node.tag || 6 === node.tag) { - a: for (var root = node, node$jscomp$0 = root; ; ) + a: for ( + var root = node, + renderPriorityLevel = renderPriorityLevel$jscomp$0, + node$jscomp$0 = root; + ; + + ) if ( - (commitUnmount(node$jscomp$0), + (commitUnmount(node$jscomp$0, renderPriorityLevel), null !== node$jscomp$0.child && 4 !== node$jscomp$0.tag) ) (node$jscomp$0.child.return = node$jscomp$0), @@ -4897,19 +5062,31 @@ function unmountHostComponents(current$$1) { node$jscomp$0.sibling.return = node$jscomp$0.return; node$jscomp$0 = node$jscomp$0.sibling; } - if (currentParentIsContainer) - (root = currentParent), + currentParentIsContainer + ? ((root = currentParent), recursivelyUncacheFiberNode(node.stateNode), - UIManager.manageChildren(root, [], [], [], [], [0]); - else { - root = currentParent; - var child = node.stateNode; - recursivelyUncacheFiberNode(child); - node$jscomp$0 = root._children; - child = node$jscomp$0.indexOf(child); - node$jscomp$0.splice(child, 1); - UIManager.manageChildren(root._nativeTag, [], [], [], [], [child]); - } + ReactNativePrivateInterface.UIManager.manageChildren( + root, + [], + [], + [], + [], + [0] + )) + : ((root = currentParent), + (node$jscomp$0 = node.stateNode), + recursivelyUncacheFiberNode(node$jscomp$0), + (renderPriorityLevel = root._children), + (node$jscomp$0 = renderPriorityLevel.indexOf(node$jscomp$0)), + renderPriorityLevel.splice(node$jscomp$0, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + root._nativeTag, + [], + [], + [], + [], + [node$jscomp$0] + )); } else if (4 === node.tag) { if (null !== node.child) { currentParent = node.stateNode.containerInfo; @@ -4918,7 +5095,9 @@ function unmountHostComponents(current$$1) { node = node.child; continue; } - } else if ((commitUnmount(node), null !== node.child)) { + } else if ( + (commitUnmount(node, renderPriorityLevel$jscomp$0), null !== node.child) + ) { node.child.return = node; node = node.child; continue; @@ -4952,7 +5131,7 @@ function commitWork(current$$1, finishedWork) { finishedWork.updateQueue = null; null !== updatePayload && ((finishedWork = instance.viewConfig), - (instanceProps[instance._nativeTag] = newProps), + instanceProps.set(instance._nativeTag, newProps), (newProps = diffProperties( null, current$$1, @@ -4960,7 +5139,7 @@ function commitWork(current$$1, finishedWork) { finishedWork.validAttributes )), null != newProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( instance._nativeTag, finishedWork.uiViewClassName, newProps @@ -4970,50 +5149,109 @@ function commitWork(current$$1, finishedWork) { case 6: if (null === finishedWork.stateNode) throw ReactError( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) ); - UIManager.updateView(finishedWork.stateNode, "RCTRawText", { - text: finishedWork.memoizedProps - }); - break; - case 20: + ReactNativePrivateInterface.UIManager.updateView( + finishedWork.stateNode, + "RCTRawText", + { text: finishedWork.memoizedProps } + ); break; case 3: break; case 12: break; case 13: - commitSuspenseComponent(finishedWork); + instance = finishedWork; + null === finishedWork.memoizedState + ? (newProps = !1) + : ((newProps = !0), + (instance = finishedWork.child), + (globalMostRecentFallbackTime = now())); + if (null !== instance) + a: for (current$$1 = instance; ; ) { + if (5 === current$$1.tag) + if (((updatePayload = current$$1.stateNode), newProps)) { + var viewConfig = updatePayload.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + updatePayload = current$$1.stateNode; + updatePayload$jscomp$0 = current$$1.memoizedProps; + viewConfig = updatePayload.viewConfig; + var prevProps = Object.assign({}, updatePayload$jscomp$0, { + style: [updatePayload$jscomp$0.style, { display: "none" }] + }); + updatePayload$jscomp$0 = diffProperties( + null, + prevProps, + updatePayload$jscomp$0, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } + else { + if (6 === current$$1.tag) throw Error("Not yet implemented."); + if (13 === current$$1.tag && null !== current$$1.memoizedState) { + updatePayload = current$$1.child.sibling; + updatePayload.return = current$$1; + current$$1 = updatePayload; + continue; + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + } + if (current$$1 === instance) break a; + for (; null === current$$1.sibling; ) { + if (null === current$$1.return || current$$1.return === instance) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + attachSuspenseRetryListeners(finishedWork); + break; + case 19: + attachSuspenseRetryListeners(finishedWork); break; case 17: break; - case 19: + case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } -function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState, - newDidTimeout = void 0, - primaryChildParent = finishedWork; - null === newState - ? (newDidTimeout = !1) - : ((newDidTimeout = !0), - (primaryChildParent = finishedWork.child), - 0 === newState.fallbackExpirationTime && - (newState.fallbackExpirationTime = requestCurrentTime() - 500)); - null !== primaryChildParent && - hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); - newState = finishedWork.updateQueue; - if (null !== newState) { +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; null === retryCache && (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); - newState.forEach(function(thenable) { + thenables.forEach(function(thenable) { var retry = resolveRetryThenable.bind(null, finishedWork, thenable); retryCache.has(thenable) || (retryCache.add(thenable), thenable.then(retry, retry)); @@ -5022,7 +5260,7 @@ function commitSuspenseComponent(finishedWork) { } var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; expirationTime.payload = { element: null }; var error = errorInfo.value; @@ -5033,13 +5271,14 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { return expirationTime; } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if ("function" === typeof getDerivedStateFromError) { - var error$jscomp$0 = errorInfo.value; + var error = errorInfo.value; expirationTime.payload = function() { - return getDerivedStateFromError(error$jscomp$0); + logError(fiber, errorInfo); + return getDerivedStateFromError(error); }; } var inst = fiber.stateNode; @@ -5049,113 +5288,94 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) - : legacyErrorBoundariesThatAlreadyFailed.add(this)); - var error = errorInfo.value, - stack = errorInfo.stack; - logError(fiber, errorInfo); - this.componentDidCatch(error, { + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); }); return expirationTime; } -function unwindWork(workInProgress) { - switch (workInProgress.tag) { - case 1: - isContextProvider(workInProgress.type) && popContext(workInProgress); - var effectTag = workInProgress.effectTag; - return effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null; - case 3: - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - effectTag = workInProgress.effectTag; - if (0 !== (effectTag & 64)) - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - workInProgress.effectTag = (effectTag & -2049) | 64; - return workInProgress; - case 5: - return popHostContext(workInProgress), null; - case 13: - return ( - (effectTag = workInProgress.effectTag), - effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null - ); - case 18: - return null; - case 4: - return popHostContainer(workInProgress), null; - case 10: - return popProvider(workInProgress), null; - case 19: - case 20: - return null; - default: - return null; - } -} var ceil = Math.ceil, ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - LegacyUnbatchedPhase = 2, - RenderPhase = 4, - CommitPhase = 5, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, RootIncomplete = 0, RootErrored = 1, RootSuspended = 2, - RootCompleted = 3, - workPhase = 0, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, workInProgressRoot = null, workInProgress = null, renderExpirationTime = 0, workInProgressRootExitStatus = RootIncomplete, - workInProgressRootMostRecentEventTime = 1073741823, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, currentEventTime = 0; function requestCurrentTime() { - return workPhase === RenderPhase || workPhase === CommitPhase - ? 1073741822 - ((now() / 10) | 0) + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) : 0 !== currentEventTime ? currentEventTime - : (currentEventTime = 1073741822 - ((now() / 10) | 0)); -} -function computeExpirationForFiber(currentTime, fiber) { - if (0 === (fiber.mode & 1)) return 1073741823; - if (workPhase === RenderPhase) return renderExpirationTime; - switch (getCurrentPriorityLevel()) { - case 99: - currentTime = 1073741823; - break; - case 98: - currentTime = - 1073741822 - 10 * ((((1073741822 - currentTime + 15) / 10) | 0) + 1); - break; - case 97: - case 96: - currentTime = - 1073741822 - 25 * ((((1073741822 - currentTime + 500) / 25) | 0) + 1); - break; - case 95: - currentTime = 1; - break; - default: - throw ReactError("Expected a valid priority level"); - } + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } null !== workInProgressRoot && currentTime === renderExpirationTime && --currentTime; @@ -5166,33 +5386,37 @@ function scheduleUpdateOnFiber(fiber, expirationTime) { throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) )); fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); - if (null !== fiber) - if (((fiber.pingTime = 0), 1073741823 === expirationTime)) - if (workPhase === LegacyUnbatchedPhase) + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) for ( - expirationTime = renderRoot(fiber, 1073741823, !0); - null !== expirationTime; + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; ) - expirationTime = expirationTime(!0); + callback = callback(!0); else scheduleCallbackForRoot(fiber, 99, 1073741823), - 0 === workPhase && flushImmediateQueue(); - else { - var priorityLevel = getCurrentPriorityLevel(); - if (98 === priorityLevel) - if (null === rootsWithPendingDiscreteUpdates) - rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]]); - else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(fiber); - (void 0 === lastDiscreteTime || lastDiscreteTime > expirationTime) && - rootsWithPendingDiscreteUpdates.set(fiber, expirationTime); - } - scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); - } + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } } function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { fiber.expirationTime < expirationTime && @@ -5233,21 +5457,28 @@ function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { existingCallbackNode !== fakeCallbackNode && Scheduler_cancelCallback(existingCallbackNode); root.callbackExpirationTime = expirationTime; - existingCallbackNode = null; - 1073741823 !== expirationTime && - 1 !== expirationTime && - ((existingCallbackNode = 10 * (1073741822 - expirationTime) - now()), - 5e3 < existingCallbackNode && (existingCallbackNode = 5e3), - (existingCallbackNode = { timeout: existingCallbackNode })); - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - existingCallbackNode - ); + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); } } function runRootCallback(root, callback, isSync) { @@ -5271,9 +5502,7 @@ function resolveLocksOnRoot(root, expirationTime) { return null !== firstBatch && firstBatch._defer && firstBatch._expirationTime >= expirationTime - ? ((root.finishedWork = root.current.alternate), - (root.pendingCommitExpirationTime = expirationTime), - scheduleCallback(97, function() { + ? (scheduleCallback(97, function() { firstBatch._onComplete(); return null; }), @@ -5285,13 +5514,14 @@ function flushPendingDiscreteUpdates() { var roots = rootsWithPendingDiscreteUpdates; rootsWithPendingDiscreteUpdates = null; roots.forEach(function(expirationTime, root) { - scheduleCallback(99, renderRoot.bind(null, root, expirationTime)); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); }); - flushImmediateQueue(); + flushSyncCallbackQueue(); } } function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = 0; + root.finishedWork = null; + root.finishedExpirationTime = 0; var timeoutHandle = root.timeoutHandle; -1 !== timeoutHandle && ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); @@ -5315,6 +5545,12 @@ function prepareFreshStack(root, expirationTime) { case 4: popHostContainer(interruptedWork); break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; case 10: popProvider(interruptedWork); } @@ -5324,24 +5560,33 @@ function prepareFreshStack(root, expirationTime) { workInProgress = createWorkInProgress(root.current, null, expirationTime); renderExpirationTime = expirationTime; workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = 1073741823; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; } function renderRoot(root$jscomp$0, expirationTime, isSync) { - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); if (root$jscomp$0.firstPendingTime < expirationTime) return null; - if (root$jscomp$0.pendingCommitExpirationTime === expirationTime) - return ( - (root$jscomp$0.pendingCommitExpirationTime = 0), - commitRoot.bind(null, root$jscomp$0, expirationTime) - ); + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); flushPassiveEffects(); - (root$jscomp$0 === workInProgressRoot && - expirationTime === renderExpirationTime) || + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) prepareFreshStack(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } if (null !== workInProgress) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; + lastPendingTime = executionContext; + executionContext |= RenderContext; var prevDispatcher = ReactCurrentDispatcher.current; null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); ReactCurrentDispatcher.current = ContextOnlyDispatcher; @@ -5350,8 +5595,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { var currentTime = requestCurrentTime(); if (currentTime < expirationTime) return ( - (workPhase = prevWorkPhase), - resetContextDependences(), + (executionContext = lastPendingTime), + resetContextDependencies(), (ReactCurrentDispatcher.current = prevDispatcher), renderRoot.bind(null, root$jscomp$0, currentTime) ); @@ -5363,16 +5608,16 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { for (; null !== workInProgress; ) workInProgress = performUnitOfWork(workInProgress); else - for (; null !== workInProgress && !shouldYield(); ) + for (; null !== workInProgress && !Scheduler_shouldYield(); ) workInProgress = performUnitOfWork(workInProgress); break; } catch (thrownValue) { - resetContextDependences(); + resetContextDependencies(); resetHooks(); currentTime = workInProgress; if (null === currentTime || null === currentTime.return) throw (prepareFreshStack(root$jscomp$0, expirationTime), - (workPhase = prevWorkPhase), + (executionContext = lastPendingTime), thrownValue); a: { var root = root$jscomp$0, @@ -5387,29 +5632,41 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { "object" === typeof value && "function" === typeof value.then ) { - var thenable = value; + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); value = returnFiber; do { - if ( - 13 === value.tag && - (void 0 === value.memoizedProps.fallback - ? 0 - : null === value.memoizedState) - ) { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { returnFiber = value.updateQueue; null === returnFiber ? ((returnFiber = new Set()), returnFiber.add(thenable), (value.updateQueue = returnFiber)) : returnFiber.add(thenable); - if (0 === (value.mode & 1)) { + if (0 === (value.mode & 2)) { value.effectTag |= 64; sourceFiber.effectTag &= -1957; 1 === sourceFiber.tag && (null === sourceFiber.alternate ? (sourceFiber.tag = 17) : ((renderExpirationTime$jscomp$0 = createUpdate( - 1073741823 + 1073741823, + null )), (renderExpirationTime$jscomp$0.tag = 2), enqueueUpdate( @@ -5421,15 +5678,15 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { } sourceFiber = root; root = renderExpirationTime$jscomp$0; - var pingCache = sourceFiber.pingCache; - null === pingCache - ? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()), + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), (returnFiber = new Set()), - pingCache.set(thenable, returnFiber)) - : ((returnFiber = pingCache.get(thenable)), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), void 0 === returnFiber && ((returnFiber = new Set()), - pingCache.set(thenable, returnFiber))); + hasInvisibleParentBoundary.set(thenable, returnFiber))); returnFiber.has(root) || (returnFiber.add(root), (sourceFiber = pingSuspendedRoot.bind( @@ -5451,11 +5708,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { getStackByFiberInDevAndProd(sourceFiber) ); } - if ( - workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended - ) - workInProgressRootExitStatus = RootErrored; + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); value = createCapturedValue(value, sourceFiber); sourceFiber = returnFiber; do { @@ -5507,76 +5761,144 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = completeUnitOfWork(currentTime); } while (1); - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = lastPendingTime; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; if (null !== workInProgress) return renderRoot.bind(null, root$jscomp$0, expirationTime); } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; workInProgressRoot = null; switch (workInProgressRootExitStatus) { case RootIncomplete: - throw ReactError("Should have a work-in-progress."); + throw ReactError(Error("Should have a work-in-progress.")); case RootErrored: return ( - (prevWorkPhase = root$jscomp$0.lastPendingTime), - root$jscomp$0.lastPendingTime < expirationTime - ? renderRoot.bind(null, root$jscomp$0, prevWorkPhase) + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) : isSync - ? commitRoot.bind(null, root$jscomp$0, expirationTime) + ? commitRoot.bind(null, root$jscomp$0) : (prepareFreshStack(root$jscomp$0, expirationTime), - scheduleCallback( - 99, + scheduleSyncCallback( renderRoot.bind(null, root$jscomp$0, expirationTime) ), null) ); case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); isSync = root$jscomp$0.lastPendingTime; - if (root$jscomp$0.lastPendingTime < expirationTime) + if (isSync < expirationTime) return renderRoot.bind(null, root$jscomp$0, isSync); - if ( - 1073741823 !== workInProgressRootMostRecentEventTime && - ((prevWorkPhase = - 10 * (1073741822 - workInProgressRootMostRecentEventTime) - 5e3), - (isSync = now()), - (prevWorkPhase = isSync - prevWorkPhase), - (prevWorkPhase = - (120 > prevWorkPhase - ? 120 - : 480 > prevWorkPhase - ? 480 - : 1080 > prevWorkPhase - ? 1080 - : 1920 > prevWorkPhase - ? 1920 - : 3e3 > prevWorkPhase - ? 3e3 - : 4320 > prevWorkPhase - ? 4320 - : 1960 * ceil(prevWorkPhase / 1960)) - prevWorkPhase), - (isSync = 10 * (1073741822 - expirationTime) - isSync), - isSync < prevWorkPhase && (prevWorkPhase = isSync), - (isSync = prevWorkPhase), - 10 < isSync) - ) + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) return ( (root$jscomp$0.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root$jscomp$0, expirationTime), + commitRoot.bind(null, root$jscomp$0), isSync )), null ); } - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return commitRoot.bind(null, root$jscomp$0); case RootCompleted: - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); default: - throw ReactError("Unknown root exit status."); + throw ReactError(Error("Unknown root exit status.")); } } +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} function performUnitOfWork(unitOfWork) { var next = beginWork$$1( unitOfWork.alternate, @@ -5639,18 +5961,18 @@ function completeUnitOfWork(unitOfWork) { else if (newProps) { current = requiredContext(contextStackCursor$1.current); var type$jscomp$0 = type; - var instance = newProps; + var _instance6 = newProps; var rootContainerInstance = renderExpirationTime$jscomp$0, internalInstanceHandle = current$$1, tag = allocateTag(); - type$jscomp$0 = ReactNativeViewConfigRegistry.get(type$jscomp$0); + type$jscomp$0 = getViewConfigForType(type$jscomp$0); var updatePayload = diffProperties( null, emptyObject, - instance, + _instance6, type$jscomp$0.validAttributes ); - UIManager.createView( + ReactNativePrivateInterface.UIManager.createView( tag, type$jscomp$0.uiViewClassName, rootContainerInstance, @@ -5660,22 +5982,24 @@ function completeUnitOfWork(unitOfWork) { tag, type$jscomp$0 ); - instanceCache[tag] = internalInstanceHandle; - instanceProps[tag] = instance; - instance = rootContainerInstance; - appendAllChildren(instance, current$$1, !1, !1); + instanceCache.set(tag, internalInstanceHandle); + instanceProps.set(tag, _instance6); + _instance6 = rootContainerInstance; + appendAllChildren(_instance6, current$$1, !1, !1); finalizeInitialChildren( - instance, + _instance6, type, newProps, renderExpirationTime$jscomp$0, current ) && (current$$1.effectTag |= 4); - current$$1.stateNode = instance; + current$$1.stateNode = _instance6; null !== current$$1.ref && (current$$1.effectTag |= 128); } else if (null === current$$1.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -5689,26 +6013,36 @@ function completeUnitOfWork(unitOfWork) { else { if ("string" !== typeof newProps && null === current$$1.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); - current = requiredContext(rootInstanceStackCursor.current); - type = requiredContext(contextStackCursor$1.current); - renderExpirationTime$jscomp$0 = current$$1; - if (!type.isInAParentText) + type = requiredContext(rootInstanceStackCursor.current); + renderExpirationTime$jscomp$0 = requiredContext( + contextStackCursor$1.current + ); + current = current$$1; + if (!renderExpirationTime$jscomp$0.isInAParentText) throw ReactError( - "Text strings must be rendered within a component." + Error( + "Text strings must be rendered within a component." + ) ); - type = allocateTag(); - UIManager.createView(type, "RCTRawText", current, { - text: newProps - }); - instanceCache[type] = current$$1; - renderExpirationTime$jscomp$0.stateNode = type; + renderExpirationTime$jscomp$0 = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + renderExpirationTime$jscomp$0, + "RCTRawText", + type, + { text: newProps } + ); + instanceCache.set(renderExpirationTime$jscomp$0, current$$1); + current.stateNode = renderExpirationTime$jscomp$0; } break; case 11: break; case 13: + pop(suspenseStackCursor, current$$1); newProps = current$$1.memoizedState; if (0 !== (current$$1.effectTag & 64)) { current$$1.expirationTime = renderExpirationTime$jscomp$0; @@ -5721,23 +6055,33 @@ function completeUnitOfWork(unitOfWork) { (renderExpirationTime$jscomp$0 = null !== type), newProps || null === type || - ((type = type.fallbackExpirationTime), - type < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = type), - (type = current.child.sibling), + ((type = current.child.sibling), null !== type && - ((current = current$$1.firstEffect), - null !== current + ((_instance6 = current$$1.firstEffect), + null !== _instance6 ? ((current$$1.firstEffect = type), - (type.nextEffect = current)) + (type.nextEffect = _instance6)) : ((current$$1.firstEffect = current$$1.lastEffect = type), (type.nextEffect = null)), (type.effectTag = 8)))); - newProps && + if ( + newProps && !renderExpirationTime$jscomp$0 && - 0 !== (current$$1.mode & 1) && - workInProgressRootExitStatus === RootIncomplete && - (workInProgressRootExitStatus = RootSuspended); + 0 !== (current$$1.mode & 2) + ) + if ( + (null === current && + !0 !== current$$1.memoizedProps.unstable_avoidThisFallback) || + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; if (newProps || renderExpirationTime$jscomp$0) current$$1.effectTag |= 4; break; @@ -5764,28 +6108,161 @@ function completeUnitOfWork(unitOfWork) { case 18: break; case 19: + pop(suspenseStackCursor, current$$1); + newProps = current$$1.memoizedState; + if (null === newProps) break; + type = 0 !== (current$$1.effectTag & 64); + _instance6 = newProps.rendering; + if (null === _instance6) + if (type) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = current$$1.child; null !== current; ) { + _instance6 = findFirstSuspended(current); + if (null !== _instance6) { + current$$1.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + newProps = _instance6.updateQueue; + null !== newProps && + ((current$$1.updateQueue = newProps), + (current$$1.effectTag |= 4)); + current$$1.firstEffect = current$$1.lastEffect = null; + newProps = renderExpirationTime$jscomp$0; + for (current = current$$1.child; null !== current; ) + (renderExpirationTime$jscomp$0 = current), + (type = newProps), + (renderExpirationTime$jscomp$0.effectTag &= 2), + (renderExpirationTime$jscomp$0.nextEffect = null), + (renderExpirationTime$jscomp$0.firstEffect = null), + (renderExpirationTime$jscomp$0.lastEffect = null), + (_instance6 = + renderExpirationTime$jscomp$0.alternate), + null === _instance6 + ? ((renderExpirationTime$jscomp$0.childExpirationTime = 0), + (renderExpirationTime$jscomp$0.expirationTime = type), + (renderExpirationTime$jscomp$0.child = null), + (renderExpirationTime$jscomp$0.memoizedProps = null), + (renderExpirationTime$jscomp$0.memoizedState = null), + (renderExpirationTime$jscomp$0.updateQueue = null), + (renderExpirationTime$jscomp$0.dependencies = null)) + : ((renderExpirationTime$jscomp$0.childExpirationTime = + _instance6.childExpirationTime), + (renderExpirationTime$jscomp$0.expirationTime = + _instance6.expirationTime), + (renderExpirationTime$jscomp$0.child = + _instance6.child), + (renderExpirationTime$jscomp$0.memoizedProps = + _instance6.memoizedProps), + (renderExpirationTime$jscomp$0.memoizedState = + _instance6.memoizedState), + (renderExpirationTime$jscomp$0.updateQueue = + _instance6.updateQueue), + (type = _instance6.dependencies), + (renderExpirationTime$jscomp$0.dependencies = + null === type + ? null + : { + expirationTime: type.expirationTime, + firstContext: type.firstContext, + responders: type.responders + })), + (current = current.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & + SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + current$$1 + ); + current$$1 = current$$1.child; + break a; + } + current = current.sibling; + } + } + else { + if (!type) + if ( + ((current = findFirstSuspended(_instance6)), null !== current) + ) { + if ( + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((current$$1.updateQueue = current), + (current$$1.effectTag |= 4)); + current$$1 = current$$1.lastEffect = newProps.lastEffect; + null !== current$$1 && (current$$1.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime$jscomp$0 && + ((current$$1.effectTag |= 64), + (type = !0), + cutOffTailIfNeeded(newProps, !1), + (current$$1.expirationTime = current$$1.childExpirationTime = + renderExpirationTime$jscomp$0 - 1)); + newProps.isBackwards + ? ((_instance6.sibling = current$$1.child), + (current$$1.child = _instance6)) + : ((current = newProps.last), + null !== current + ? (current.sibling = _instance6) + : (current$$1.child = _instance6), + (newProps.last = _instance6)); + } + if (null !== newProps.tail) { + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500); + current = newProps.tail; + newProps.rendering = current; + newProps.tail = current.sibling; + newProps.lastEffect = current$$1.lastEffect; + current.sibling = null; + newProps = suspenseStackCursor.current; + newProps = type + ? (newProps & SubtreeSuspenseContextMask) | + ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask; + push(suspenseStackCursor, newProps, current$$1); + current$$1 = current; + break a; + } break; case 20: break; default: throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } current$$1 = null; } newProps = workInProgress; if (1 === renderExpirationTime || 1 !== newProps.childExpirationTime) { - renderExpirationTime$jscomp$0 = 0; - for (type = newProps.child; null !== type; ) - (current = type.expirationTime), - (instance = type.childExpirationTime), - current > renderExpirationTime$jscomp$0 && - (renderExpirationTime$jscomp$0 = current), - instance > renderExpirationTime$jscomp$0 && - (renderExpirationTime$jscomp$0 = instance), - (type = type.sibling); - newProps.childExpirationTime = renderExpirationTime$jscomp$0; + current = 0; + for ( + renderExpirationTime$jscomp$0 = newProps.child; + null !== renderExpirationTime$jscomp$0; + + ) + (type = renderExpirationTime$jscomp$0.expirationTime), + (_instance6 = renderExpirationTime$jscomp$0.childExpirationTime), + type > current && (current = type), + _instance6 > current && (current = _instance6), + (renderExpirationTime$jscomp$0 = + renderExpirationTime$jscomp$0.sibling); + newProps.childExpirationTime = current; } if (null !== current$$1) return current$$1; null !== unitOfWork && @@ -5817,23 +6294,31 @@ function completeUnitOfWork(unitOfWork) { (workInProgressRootExitStatus = RootCompleted); return null; } -function commitRoot(root, expirationTime) { - runWithPriority(99, commitRootImpl.bind(null, root, expirationTime)); +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority(99, commitRootImpl.bind(null, root, renderPriorityLevel)); null !== rootWithPendingPassiveEffects && - ((root = getCurrentPriorityLevel()), - scheduleCallback(root, function() { + scheduleCallback(97, function() { flushPassiveEffects(); return null; - })); + }); return null; } -function commitRootImpl(root, expirationTime) { +function commitRootImpl(root, renderPriorityLevel) { flushPassiveEffects(); - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); - var finishedWork = root.current.alternate; - if (null === finishedWork) - throw ReactError("Should have a work-in-progress root."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); root.callbackNode = null; root.callbackExpirationTime = 0; var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, @@ -5850,14 +6335,14 @@ function commitRootImpl(root, expirationTime) { 1 < finishedWork.effectTag ? null !== finishedWork.lastEffect ? ((finishedWork.lastEffect.nextEffect = finishedWork), - (childExpirationTimeBeforeCommit = finishedWork.firstEffect)) - : (childExpirationTimeBeforeCommit = finishedWork) - : (childExpirationTimeBeforeCommit = finishedWork.firstEffect); - if (null !== childExpirationTimeBeforeCommit) { - updateExpirationTimeBeforeCommit = workPhase; - workPhase = CommitPhase; + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; ReactCurrentOwner$2.current = null; - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (; null !== nextEffect; ) { @@ -5900,11 +6385,12 @@ function commitRootImpl(root, expirationTime) { case 6: case 4: case 17: - case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -5912,15 +6398,15 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { - for (; null !== nextEffect; ) { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { var effectTag = nextEffect.effectTag; if (effectTag & 128) { var current$$1$jscomp$0 = nextEffect.alternate; @@ -5946,30 +6432,21 @@ function commitRootImpl(root, expirationTime) { commitWork(nextEffect.alternate, nextEffect); break; case 8: - current$$1 = nextEffect; - unmountHostComponents(current$$1); - current$$1.return = null; - current$$1.child = null; - current$$1.memoizedState = null; - current$$1.updateQueue = null; - var alternate = current$$1.alternate; - null !== alternate && - ((alternate.return = null), - (alternate.child = null), - (alternate.memoizedState = null), - (alternate.updateQueue = null)); + (prevProps = nextEffect), + unmountHostComponents(prevProps, current$$1), + detachFiber(prevProps); } nextEffect = nextEffect.nextEffect; } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); root.current = finishedWork; - nextEffect = childExpirationTimeBeforeCommit; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (effectTag = expirationTime; null !== nextEffect; ) { @@ -6020,19 +6497,19 @@ function commitRootImpl(root, expirationTime) { case 3: var _updateQueue = current$$1$jscomp$0.updateQueue; if (null !== _updateQueue) { - alternate = null; + current$$1 = null; if (null !== current$$1$jscomp$0.child) switch (current$$1$jscomp$0.child.tag) { case 5: - alternate = current$$1$jscomp$0.child.stateNode; + current$$1 = current$$1$jscomp$0.child.stateNode; break; case 1: - alternate = current$$1$jscomp$0.child.stateNode; + current$$1 = current$$1$jscomp$0.child.stateNode; } commitUpdateQueue( current$$1$jscomp$0, _updateQueue, - alternate, + current$$1, currentRef ); } @@ -6046,15 +6523,15 @@ function commitRootImpl(root, expirationTime) { case 12: break; case 13: + case 19: case 17: - break; case 20: break; - case 19: - break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -6079,28 +6556,37 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); nextEffect = null; - workPhase = updateExpirationTimeBeforeCommit; + requestPaint(); + executionContext = childExpirationTimeBeforeCommit; } else root.current = finishedWork; - rootDoesHavePassiveEffects && - ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root)); - expirationTime = root.firstPendingTime; - 0 !== expirationTime + if (rootDoesHavePassiveEffects) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + 0 !== renderPriorityLevel ? ((effectTag$jscomp$0 = requestCurrentTime()), (effectTag$jscomp$0 = inferPriorityFromExpirationTime( effectTag$jscomp$0, - expirationTime + renderPriorityLevel )), - scheduleCallbackForRoot(root, effectTag$jscomp$0, expirationTime)) + scheduleCallbackForRoot(root, effectTag$jscomp$0, renderPriorityLevel)) : (legacyErrorBoundariesThatAlreadyFailed = null); "function" === typeof onCommitFiberRoot && - onCommitFiberRoot(finishedWork.stateNode); - 1073741823 === expirationTime + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -6110,31 +6596,52 @@ function commitRootImpl(root, expirationTime) { (root = firstUncaughtError), (firstUncaughtError = null), root); - if (workPhase === LegacyUnbatchedPhase) return null; - flushImmediateQueue(); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); return null; } function flushPassiveEffects() { if (null === rootWithPendingPassiveEffects) return !1; - var root = rootWithPendingPassiveEffects; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; rootWithPendingPassiveEffects = null; - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Cannot flush passive effects while already rendering."); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; for (root = root.current.firstEffect; null !== root; ) { try { var finishedWork = root; - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } } catch (error) { - if (null === root) throw ReactError("Should be working on an effect."); + if (null === root) + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(root, error); } - root = root.nextEffect; + finishedWork = root.nextEffect; + root.nextEffect = null; + root = finishedWork; } - workPhase = prevWorkPhase; - flushImmediateQueue(); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); return !0; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { @@ -6175,11 +6682,18 @@ function pingSuspendedRoot(root, thenable, suspendedTime) { var pingCache = root.pingCache; null !== pingCache && pingCache.delete(thenable); workInProgressRoot === root && renderExpirationTime === suspendedTime - ? prepareFreshStack(root, renderExpirationTime) + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) : root.lastPendingTime < suspendedTime || ((thenable = root.pingTime), (0 !== thenable && thenable < suspendedTime) || ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), (thenable = requestCurrentTime()), (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), scheduleCallbackForRoot(root, thenable, suspendedTime))); @@ -6188,7 +6702,7 @@ function resolveRetryThenable(boundaryFiber, thenable) { var retryCache = boundaryFiber.stateNode; null !== retryCache && retryCache.delete(thenable); retryCache = requestCurrentTime(); - thenable = computeExpirationForFiber(retryCache, boundaryFiber); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); retryCache = inferPriorityFromExpirationTime(retryCache, thenable); boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); null !== boundaryFiber && @@ -6238,6 +6752,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress, renderExpirationTime ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6245,6 +6764,33 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); return null !== workInProgress ? workInProgress.sibling : null; } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; } return bailoutOnAlreadyFinishedWork( current$$1, @@ -6257,31 +6803,31 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress.expirationTime = 0; switch (workInProgress.tag) { case 2: - updateExpirationTime = workInProgress.elementType; + updateExpirationTime = workInProgress.type; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - var context = getMaskedContext( + renderState = getMaskedContext( workInProgress, contextStackCursor.current ); prepareToReadContext(workInProgress, renderExpirationTime); - context = renderWithHooks( + renderState = renderWithHooks( null, workInProgress, updateExpirationTime, current$$1, - context, + renderState, renderExpirationTime ); workInProgress.effectTag |= 1; if ( - "object" === typeof context && - null !== context && - "function" === typeof context.render && - void 0 === context.$$typeof + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof ) { workInProgress.tag = 1; resetHooks(); @@ -6290,8 +6836,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { pushContextProvider(workInProgress); } else hasContext = !1; workInProgress.memoizedState = - null !== context.state && void 0 !== context.state - ? context.state + null !== renderState.state && void 0 !== renderState.state + ? renderState.state : null; var getDerivedStateFromProps = updateExpirationTime.getDerivedStateFromProps; @@ -6302,9 +6848,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { getDerivedStateFromProps, current$$1 ); - context.updater = classComponentUpdater; - workInProgress.stateNode = context; - context._reactInternalFiber = workInProgress; + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; mountClassInstance( workInProgress, updateExpirationTime, @@ -6324,28 +6870,28 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( null, workInProgress, - context, + renderState, renderExpirationTime ), (workInProgress = workInProgress.child); return workInProgress; case 16: - context = workInProgress.elementType; + renderState = workInProgress.elementType; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - context = readLazyComponentType(context); - workInProgress.type = context; - hasContext = workInProgress.tag = resolveLazyComponentTag(context); - current$$1 = resolveDefaultProps(context, current$$1); + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); switch (hasContext) { case 0: workInProgress = updateFunctionComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6354,7 +6900,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateClassComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6363,7 +6909,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateForwardRef( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6372,49 +6918,51 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateMemoComponent( null, workInProgress, - context, - resolveDefaultProps(context.type, current$$1), + renderState, + resolveDefaultProps(renderState.type, current$$1), updateExpirationTime, renderExpirationTime ); break; default: throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - context + - ". Lazy element type must resolve to a class or function." + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) ); } return workInProgress; case 0: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateFunctionComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); case 1: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateClassComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6423,10 +6971,12 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { updateExpirationTime = workInProgress.updateQueue; if (null === updateExpirationTime) throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); - context = workInProgress.memoizedState; - context = null !== context ? context.element : null; + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; processUpdateQueue( workInProgress, updateExpirationTime, @@ -6435,7 +6985,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); updateExpirationTime = workInProgress.memoizedState.element; - updateExpirationTime === context + updateExpirationTime === renderState ? (workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6499,16 +7049,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 11: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateForwardRef( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6545,9 +7095,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 10: a: { updateExpirationTime = workInProgress.type._context; - context = workInProgress.pendingProps; + renderState = workInProgress.pendingProps; getDerivedStateFromProps = workInProgress.memoizedProps; - hasContext = context.value; + hasContext = renderState.value; pushProvider(workInProgress, hasContext); if (null !== getDerivedStateFromProps) { var oldValue = getDerivedStateFromProps.value; @@ -6561,7 +7111,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { : 1073741823) | 0; if (0 === hasContext) { if ( - getDerivedStateFromProps.children === context.children && + getDerivedStateFromProps.children === renderState.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -6578,16 +7128,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== oldValue; ) { - var list = oldValue.contextDependencies; + var list = oldValue.dependencies; if (null !== list) { getDerivedStateFromProps = oldValue.child; - for (var dependency = list.first; null !== dependency; ) { + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { if ( dependency.context === updateExpirationTime && 0 !== (dependency.observedBits & hasContext) ) { 1 === oldValue.tag && - ((dependency = createUpdate(renderExpirationTime)), + ((dependency = createUpdate(renderExpirationTime, null)), (dependency.tag = 2), enqueueUpdate(oldValue, dependency)); oldValue.expirationTime < renderExpirationTime && @@ -6596,22 +7150,10 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== dependency && dependency.expirationTime < renderExpirationTime && (dependency.expirationTime = renderExpirationTime); - dependency = renderExpirationTime; - for (var node = oldValue.return; null !== node; ) { - var alternate = node.alternate; - if (node.childExpirationTime < dependency) - (node.childExpirationTime = dependency), - null !== alternate && - alternate.childExpirationTime < dependency && - (alternate.childExpirationTime = dependency); - else if ( - null !== alternate && - alternate.childExpirationTime < dependency - ) - alternate.childExpirationTime = dependency; - else break; - node = node.return; - } + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); list.expirationTime < renderExpirationTime && (list.expirationTime = renderExpirationTime); break; @@ -6651,7 +7193,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( current$$1, workInProgress, - context.children, + renderState.children, renderExpirationTime ); workInProgress = workInProgress.child; @@ -6659,12 +7201,15 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { return workInProgress; case 9: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = workInProgress.pendingProps), (updateExpirationTime = hasContext.children), prepareToReadContext(workInProgress, renderExpirationTime), - (context = readContext(context, hasContext.unstable_observedBits)), - (updateExpirationTime = updateExpirationTime(context)), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), (workInProgress.effectTag |= 1), reconcileChildren( current$$1, @@ -6676,16 +7221,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); case 14: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = resolveDefaultProps( - context, + renderState, workInProgress.pendingProps )), - (hasContext = resolveDefaultProps(context.type, hasContext)), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), updateMemoComponent( current$$1, workInProgress, - context, + renderState, hasContext, updateExpirationTime, renderExpirationTime @@ -6703,11 +7248,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 17: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), @@ -6720,13 +7265,13 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { constructClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), mountClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), finishClassComponent( @@ -6738,19 +7283,249 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ) ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); }; +var onCommitFiberRoot = null, + onCommitFiberUnmount = null; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root) { + try { + hook.onCommitFiberRoot( + rendererID, + root, + void 0, + 64 === (root.current.effectTag & 64) + ); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; +} function findHostInstance(component) { var fiber = component._reactInternalFiber; if (void 0 === fiber) { if ("function" === typeof component.render) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } component = findCurrentHostFiber(fiber); @@ -6758,8 +7533,13 @@ function findHostInstance(component) { } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current, - currentTime = requestCurrentTime(); - current$$1 = computeExpirationForFiber(currentTime, current$$1); + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); currentTime = container.current; a: if (parentComponent) { parentComponent = parentComponent._reactInternalFiber; @@ -6769,7 +7549,9 @@ function updateContainer(element, container, parentComponent, callback) { 1 !== parentComponent.tag ) throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) ); var parentContext = parentComponent; do { @@ -6788,7 +7570,9 @@ function updateContainer(element, container, parentComponent, callback) { parentContext = parentContext.return; } while (null !== parentContext); throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (1 === parentComponent.tag) { @@ -6808,12 +7592,11 @@ function updateContainer(element, container, parentComponent, callback) { ? (container.context = parentComponent) : (container.pendingContext = parentComponent); container = callback; - callback = createUpdate(current$$1); - callback.payload = { element: element }; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; container = void 0 === container ? null : container; - null !== container && (callback.callback = container); - flushPassiveEffects(); - enqueueUpdate(currentTime, callback); + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); scheduleUpdateOnFiber(currentTime, current$$1); return current$$1; } @@ -6850,7 +7633,7 @@ function _inherits(subClass, superClass) { var getInspectorDataForViewTag = void 0; getInspectorDataForViewTag = function() { throw ReactError( - "getInspectorDataForViewTag() is not available in production" + Error("getInspectorDataForViewTag() is not available in production") ); }; function findNodeHandle(componentOrHandle) { @@ -6866,19 +7649,19 @@ function findNodeHandle(componentOrHandle) { ? componentOrHandle.canonical._nativeTag : componentOrHandle._nativeTag; } -_batchedUpdatesImpl = function(fn, a) { - if (0 !== workPhase) return fn(a); - workPhase = 1; +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; try { return fn(a); } finally { - (workPhase = 0), flushImmediateQueue(); + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); } }; -_flushInteractiveUpdatesImpl = function() { - workPhase !== RenderPhase && - workPhase !== CommitPhase && - flushPendingDiscreteUpdates(); +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); }; var roots = new Map(), ReactNativeRenderer = { @@ -6899,10 +7682,14 @@ var roots = new Map(), } _inherits(ReactNativeComponent, _React$Component); ReactNativeComponent.prototype.blur = function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.focus = function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.measure = function(callback) { var maybeInstance = void 0; @@ -6915,7 +7702,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6931,7 +7718,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -6953,7 +7740,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -6977,7 +7764,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -6988,6 +7775,14 @@ var roots = new Map(), })(React.Component); })(findNodeHandle, findHostInstance), findNodeHandle: findNodeHandle, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, setNativeProps: function(handle, nativeProps) { null != handle._nativeTag && ((nativeProps = diffProperties( @@ -6997,7 +7792,7 @@ var roots = new Map(), handle.viewConfig.validAttributes )), null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( handle._nativeTag, handle.viewConfig.uiViewClassName, nativeProps @@ -7006,7 +7801,7 @@ var roots = new Map(), render: function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, !1); + root = new FiberRootNode(containerTag, 0, !1); var uninitializedFiber = createFiber(3, null, null, 0); root.current = uninitializedFiber; uninitializedFiber.stateNode = root; @@ -7033,7 +7828,7 @@ var roots = new Map(), }, unmountComponentAtNodeAndRemoveContainer: function(containerTag) { ReactNativeRenderer.unmountComponentAtNode(containerTag); - UIManager.removeRootView(containerTag); + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); }, createPortal: function(children, containerTag) { return createPortal( @@ -7058,7 +7853,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7074,7 +7869,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7092,7 +7887,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -7116,7 +7911,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -7124,10 +7919,14 @@ var roots = new Map(), } }, focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; })(findNodeHandle, findHostInstance), @@ -7155,7 +7954,12 @@ var roots = new Map(), return findFiberByHostInstance ? findFiberByHostInstance(instance) : null; - } + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null }) ); })({ diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js new file mode 100644 index 00000000000000..f80a94c7434a75 --- /dev/null +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -0,0 +1,8207 @@ +/** + * 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. + * + * @noflow + * @preventMunge + * @generated + */ + +"use strict"; +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), + React = require("react"), + Scheduler = require("scheduler"), + tracing = require("scheduler/tracing"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; +} +var eventPluginOrder = null, + namesToPlugins = {}; +function recomputePluginOrdering() { + if (eventPluginOrder) + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName], + pluginIndex = eventPluginOrder.indexOf(pluginName); + if (!(-1 < pluginIndex)) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) + ); + if (!plugins[pluginIndex]) { + if (!pluginModule.extractEvents) + throw ReactError( + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) + ); + plugins[pluginIndex] = pluginModule; + pluginIndex = pluginModule.eventTypes; + for (var eventName in pluginIndex) { + var JSCompiler_inline_result = void 0; + var dispatchConfig = pluginIndex[eventName], + pluginModule$jscomp$0 = pluginModule, + eventName$jscomp$0 = eventName; + if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) + ); + eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (JSCompiler_inline_result in phasedRegistrationNames) + phasedRegistrationNames.hasOwnProperty( + JSCompiler_inline_result + ) && + publishRegistrationName( + phasedRegistrationNames[JSCompiler_inline_result], + pluginModule$jscomp$0, + eventName$jscomp$0 + ); + JSCompiler_inline_result = !0; + } else + dispatchConfig.registrationName + ? (publishRegistrationName( + dispatchConfig.registrationName, + pluginModule$jscomp$0, + eventName$jscomp$0 + ), + (JSCompiler_inline_result = !0)) + : (JSCompiler_inline_result = !1); + if (!JSCompiler_inline_result) + throw ReactError( + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) + ); + } + } + } +} +function publishRegistrationName(registrationName, pluginModule) { + if (registrationNameModules[registrationName]) + throw ReactError( + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) + ); + registrationNameModules[registrationName] = pluginModule; +} +var plugins = [], + eventNameDispatchConfigs = {}, + registrationNameModules = {}; +function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +} +var hasError = !1, + caughtError = null, + hasRethrowError = !1, + rethrowError = null, + reporter = { + onError: function(error) { + hasError = !0; + caughtError = error; + } + }; +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = !1; + caughtError = null; + invokeGuardedCallbackImpl.apply(reporter, arguments); +} +function invokeGuardedCallbackAndCatchFirstError( + name, + func, + context, + a, + b, + c, + d, + e, + f +) { + invokeGuardedCallback.apply(this, arguments); + if (hasError) { + if (hasError) { + var error = caughtError; + hasError = !1; + caughtError = null; + } else + throw ReactError( + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) + ); + hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); + } +} +var getFiberCurrentPropsFromNode = null, + getInstanceFromNode = null, + getNodeFromInstance = null; +function executeDispatch(event, listener, inst) { + var type = event.type || "unknown-event"; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + event.currentTarget = null; +} +function executeDirectDispatch(event) { + var dispatchListener = event._dispatchListeners, + dispatchInstance = event._dispatchInstances; + if (Array.isArray(dispatchListener)) + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); + event.currentTarget = dispatchListener + ? getNodeFromInstance(dispatchInstance) + : null; + dispatchListener = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return dispatchListener; +} +function accumulateInto(current, next) { + if (null == next) + throw ReactError( + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) + ); + if (null == current) return next; + if (Array.isArray(current)) { + if (Array.isArray(next)) return current.push.apply(current, next), current; + current.push(next); + return current; + } + return Array.isArray(next) ? [current].concat(next) : [current, next]; +} +function forEachAccumulated(arr, cb, scope) { + Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr); +} +var eventQueue = null; +function executeDispatchesAndReleaseTopLevel(e) { + if (e) { + var dispatchListeners = e._dispatchListeners, + dispatchInstances = e._dispatchInstances; + if (Array.isArray(dispatchListeners)) + for ( + var i = 0; + i < dispatchListeners.length && !e.isPropagationStopped(); + i++ + ) + executeDispatch(e, dispatchListeners[i], dispatchInstances[i]); + else + dispatchListeners && + executeDispatch(e, dispatchListeners, dispatchInstances); + e._dispatchListeners = null; + e._dispatchInstances = null; + e.isPersistent() || e.constructor.release(e); + } +} +var injection = { + injectEventPluginOrder: function(injectedEventPluginOrder) { + if (eventPluginOrder) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) + ); + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); + }, + injectEventPluginsByName: function(injectedNamesToPlugins) { + var isOrderingDirty = !1, + pluginName; + for (pluginName in injectedNamesToPlugins) + if (injectedNamesToPlugins.hasOwnProperty(pluginName)) { + var pluginModule = injectedNamesToPlugins[pluginName]; + if ( + !namesToPlugins.hasOwnProperty(pluginName) || + namesToPlugins[pluginName] !== pluginModule + ) { + if (namesToPlugins[pluginName]) + throw ReactError( + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) + ); + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = !0; + } + } + isOrderingDirty && recomputePluginOrdering(); + } +}; +function getListener(inst, registrationName) { + var listener = inst.stateNode; + if (!listener) return null; + var props = getFiberCurrentPropsFromNode(listener); + if (!props) return null; + listener = props[registrationName]; + a: switch (registrationName) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + (props = !props.disabled) || + ((inst = inst.type), + (props = !( + "button" === inst || + "input" === inst || + "select" === inst || + "textarea" === inst + ))); + inst = !props; + break a; + default: + inst = !1; + } + if (inst) return null; + if (listener && "function" !== typeof listener) + throw ReactError( + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) + ); + return listener; +} +function getParent(inst) { + do inst = inst.return; + while (inst && 5 !== inst.tag); + return inst ? inst : null; +} +function traverseTwoPhase(inst, fn, arg) { + for (var path = []; inst; ) path.push(inst), (inst = getParent(inst)); + for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg); + for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg); +} +function accumulateDirectionalDispatches(inst, phase, event) { + if ( + (phase = getListener( + inst, + event.dispatchConfig.phasedRegistrationNames[phase] + )) + ) + (event._dispatchListeners = accumulateInto( + event._dispatchListeners, + phase + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + )); +} +function accumulateTwoPhaseDispatchesSingle(event) { + event && + event.dispatchConfig.phasedRegistrationNames && + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); +} +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + targetInst = targetInst ? getParent(targetInst) : null; + traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event); + } +} +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + var inst = event._targetInst; + if (inst && event && event.dispatchConfig.registrationName) { + var listener = getListener(inst, event.dispatchConfig.registrationName); + listener && + ((event._dispatchListeners = accumulateInto( + event._dispatchListeners, + listener + )), + (event._dispatchInstances = accumulateInto( + event._dispatchInstances, + inst + ))); + } + } +} +function functionThatReturnsTrue() { + return !0; +} +function functionThatReturnsFalse() { + return !1; +} +function SyntheticEvent( + dispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget +) { + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + dispatchConfig = this.constructor.Interface; + for (var propName in dispatchConfig) + dispatchConfig.hasOwnProperty(propName) && + ((targetInst = dispatchConfig[propName]) + ? (this[propName] = targetInst(nativeEvent)) + : "target" === propName + ? (this.target = nativeEventTarget) + : (this[propName] = nativeEvent[propName])); + this.isDefaultPrevented = (null != nativeEvent.defaultPrevented + ? nativeEvent.defaultPrevented + : !1 === nativeEvent.returnValue) + ? functionThatReturnsTrue + : functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + return this; +} +Object.assign(SyntheticEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = !0; + var event = this.nativeEvent; + event && + (event.preventDefault + ? event.preventDefault() + : "unknown" !== typeof event.returnValue && (event.returnValue = !1), + (this.isDefaultPrevented = functionThatReturnsTrue)); + }, + stopPropagation: function() { + var event = this.nativeEvent; + event && + (event.stopPropagation + ? event.stopPropagation() + : "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0), + (this.isPropagationStopped = functionThatReturnsTrue)); + }, + persist: function() { + this.isPersistent = functionThatReturnsTrue; + }, + isPersistent: functionThatReturnsFalse, + destructor: function() { + var Interface = this.constructor.Interface, + propName; + for (propName in Interface) this[propName] = null; + this.nativeEvent = this._targetInst = this.dispatchConfig = null; + this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse; + this._dispatchInstances = this._dispatchListeners = null; + } +}); +SyntheticEvent.Interface = { + type: null, + target: null, + currentTarget: function() { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; +SyntheticEvent.extend = function(Interface) { + function E() {} + function Class() { + return Super.apply(this, arguments); + } + var Super = this; + E.prototype = Super.prototype; + var prototype = new E(); + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); + return Class; +}; +addEventPoolingTo(SyntheticEvent); +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + if (this.eventPool.length) { + var instance = this.eventPool.pop(); + this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; + } + return new this(dispatchConfig, targetInst, nativeEvent, nativeInst); +} +function releasePooledEvent(event) { + if (!(event instanceof this)) + throw ReactError( + Error( + "Trying to release an event instance into a pool of a different type." + ) + ); + event.destructor(); + 10 > this.eventPool.length && this.eventPool.push(event); +} +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} +var ResponderSyntheticEvent = SyntheticEvent.extend({ + touchHistory: function() { + return null; + } +}); +function isStartish(topLevelType) { + return "topTouchStart" === topLevelType; +} +function isMoveish(topLevelType) { + return "topTouchMove" === topLevelType; +} +var startDependencies = ["topTouchStart"], + moveDependencies = ["topTouchMove"], + endDependencies = ["topTouchCancel", "topTouchEnd"], + touchBank = [], + touchHistory = { + touchBank: touchBank, + numberActiveTouches: 0, + indexOfSingleActiveTouch: -1, + mostRecentTimeStamp: 0 + }; +function timestampForTouch(touch) { + return touch.timeStamp || touch.timestamp; +} +function getTouchIdentifier(_ref) { + _ref = _ref.identifier; + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); + return _ref; +} +function recordTouchStart(touch) { + var identifier = getTouchIdentifier(touch), + touchRecord = touchBank[identifier]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.startPageX = touch.pageX), + (touchRecord.startPageY = touch.pageY), + (touchRecord.startTimeStamp = timestampForTouch(touch)), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchRecord.previousPageX = touch.pageX), + (touchRecord.previousPageY = touch.pageY), + (touchRecord.previousTimeStamp = timestampForTouch(touch))) + : ((touchRecord = { + touchActive: !0, + startPageX: touch.pageX, + startPageY: touch.pageY, + startTimeStamp: timestampForTouch(touch), + currentPageX: touch.pageX, + currentPageY: touch.pageY, + currentTimeStamp: timestampForTouch(touch), + previousPageX: touch.pageX, + previousPageY: touch.pageY, + previousTimeStamp: timestampForTouch(touch) + }), + (touchBank[identifier] = touchRecord)); + touchHistory.mostRecentTimeStamp = timestampForTouch(touch); +} +function recordTouchMove(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !0), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch move without a touch start.\nTouch Move: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function recordTouchEnd(touch) { + var touchRecord = touchBank[getTouchIdentifier(touch)]; + touchRecord + ? ((touchRecord.touchActive = !1), + (touchRecord.previousPageX = touchRecord.currentPageX), + (touchRecord.previousPageY = touchRecord.currentPageY), + (touchRecord.previousTimeStamp = touchRecord.currentTimeStamp), + (touchRecord.currentPageX = touch.pageX), + (touchRecord.currentPageY = touch.pageY), + (touchRecord.currentTimeStamp = timestampForTouch(touch)), + (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) + : console.warn( + "Cannot record touch end without a touch start.\nTouch End: %s\n", + "Touch Bank: %s", + printTouch(touch), + printTouchBank() + ); +} +function printTouch(touch) { + return JSON.stringify({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY, + timestamp: timestampForTouch(touch) + }); +} +function printTouchBank() { + var printed = JSON.stringify(touchBank.slice(0, 20)); + 20 < touchBank.length && + (printed += " (original size: " + touchBank.length + ")"); + return printed; +} +var ResponderTouchHistoryStore = { + recordTouchTrack: function(topLevelType, nativeEvent) { + if (isMoveish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchMove); + else if (isStartish(topLevelType)) + nativeEvent.changedTouches.forEach(recordTouchStart), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches && + (touchHistory.indexOfSingleActiveTouch = + nativeEvent.touches[0].identifier); + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if ( + (nativeEvent.changedTouches.forEach(recordTouchEnd), + (touchHistory.numberActiveTouches = nativeEvent.touches.length), + 1 === touchHistory.numberActiveTouches) + ) + for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) + if ( + ((nativeEvent = touchBank[topLevelType]), + null != nativeEvent && nativeEvent.touchActive) + ) { + touchHistory.indexOfSingleActiveTouch = topLevelType; + break; + } + }, + touchHistory: touchHistory +}; +function accumulate(current, next) { + if (null == next) + throw ReactError( + Error("accumulate(...): Accumulated items must not be null or undefined.") + ); + return null == current + ? next + : Array.isArray(current) + ? current.concat(next) + : Array.isArray(next) + ? [current].concat(next) + : [current, next]; +} +var responderInst = null, + trackedTouchCount = 0; +function changeResponder(nextResponderInst, blockHostResponder) { + var oldResponderInst = responderInst; + responderInst = nextResponderInst; + if (null !== ResponderEventPlugin.GlobalResponderHandler) + ResponderEventPlugin.GlobalResponderHandler.onChange( + oldResponderInst, + nextResponderInst, + blockHostResponder + ); +} +var eventTypes = { + startShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onStartShouldSetResponder", + captured: "onStartShouldSetResponderCapture" + }, + dependencies: startDependencies + }, + scrollShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onScrollShouldSetResponder", + captured: "onScrollShouldSetResponderCapture" + }, + dependencies: ["topScroll"] + }, + selectionChangeShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onSelectionChangeShouldSetResponder", + captured: "onSelectionChangeShouldSetResponderCapture" + }, + dependencies: ["topSelectionChange"] + }, + moveShouldSetResponder: { + phasedRegistrationNames: { + bubbled: "onMoveShouldSetResponder", + captured: "onMoveShouldSetResponderCapture" + }, + dependencies: moveDependencies + }, + responderStart: { + registrationName: "onResponderStart", + dependencies: startDependencies + }, + responderMove: { + registrationName: "onResponderMove", + dependencies: moveDependencies + }, + responderEnd: { + registrationName: "onResponderEnd", + dependencies: endDependencies + }, + responderRelease: { + registrationName: "onResponderRelease", + dependencies: endDependencies + }, + responderTerminationRequest: { + registrationName: "onResponderTerminationRequest", + dependencies: [] + }, + responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, + responderReject: { + registrationName: "onResponderReject", + dependencies: [] + }, + responderTerminate: { + registrationName: "onResponderTerminate", + dependencies: [] + } + }, + ResponderEventPlugin = { + _getResponder: function() { + return responderInst; + }, + eventTypes: eventTypes, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (isStartish(topLevelType)) trackedTouchCount += 1; + else if ( + "topTouchEnd" === topLevelType || + "topTouchCancel" === topLevelType + ) + if (0 <= trackedTouchCount) --trackedTouchCount; + else + return ( + console.error( + "Ended a touch event which was not counted in `trackedTouchCount`." + ), + null + ); + ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent); + if ( + targetInst && + (("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) || + (0 < trackedTouchCount && "topSelectionChange" === topLevelType) || + isStartish(topLevelType) || + isMoveish(topLevelType)) + ) { + var JSCompiler_temp = isStartish(topLevelType) + ? eventTypes.startShouldSetResponder + : isMoveish(topLevelType) + ? eventTypes.moveShouldSetResponder + : "topSelectionChange" === topLevelType + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; + if (responderInst) + b: { + var JSCompiler_temp$jscomp$0 = responderInst; + for ( + var depthA = 0, tempA = JSCompiler_temp$jscomp$0; + tempA; + tempA = getParent(tempA) + ) + depthA++; + tempA = 0; + for (var tempB = targetInst; tempB; tempB = getParent(tempB)) + tempA++; + for (; 0 < depthA - tempA; ) + (JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0)), + depthA--; + for (; 0 < tempA - depthA; ) + (targetInst = getParent(targetInst)), tempA--; + for (; depthA--; ) { + if ( + JSCompiler_temp$jscomp$0 === targetInst || + JSCompiler_temp$jscomp$0 === targetInst.alternate + ) + break b; + JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0); + targetInst = getParent(targetInst); + } + JSCompiler_temp$jscomp$0 = null; + } + else JSCompiler_temp$jscomp$0 = targetInst; + targetInst = JSCompiler_temp$jscomp$0 === responderInst; + JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp, + JSCompiler_temp$jscomp$0, + nativeEvent, + nativeEventTarget + ); + JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory; + targetInst + ? forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingleSkipTarget + ) + : forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateTwoPhaseDispatchesSingle + ); + b: { + JSCompiler_temp = JSCompiler_temp$jscomp$0._dispatchListeners; + targetInst = JSCompiler_temp$jscomp$0._dispatchInstances; + if (Array.isArray(JSCompiler_temp)) + for ( + depthA = 0; + depthA < JSCompiler_temp.length && + !JSCompiler_temp$jscomp$0.isPropagationStopped(); + depthA++ + ) { + if ( + JSCompiler_temp[depthA]( + JSCompiler_temp$jscomp$0, + targetInst[depthA] + ) + ) { + JSCompiler_temp = targetInst[depthA]; + break b; + } + } + else if ( + JSCompiler_temp && + JSCompiler_temp(JSCompiler_temp$jscomp$0, targetInst) + ) { + JSCompiler_temp = targetInst; + break b; + } + JSCompiler_temp = null; + } + JSCompiler_temp$jscomp$0._dispatchInstances = null; + JSCompiler_temp$jscomp$0._dispatchListeners = null; + JSCompiler_temp$jscomp$0.isPersistent() || + JSCompiler_temp$jscomp$0.constructor.release( + JSCompiler_temp$jscomp$0 + ); + JSCompiler_temp && JSCompiler_temp !== responderInst + ? ((JSCompiler_temp$jscomp$0 = void 0), + (targetInst = ResponderSyntheticEvent.getPooled( + eventTypes.responderGrant, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (targetInst.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(targetInst, accumulateDirectDispatchesSingle), + (depthA = !0 === executeDirectDispatch(targetInst)), + responderInst + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminationRequest, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (tempB = + !tempA._dispatchListeners || executeDirectDispatch(tempA)), + tempA.isPersistent() || tempA.constructor.release(tempA), + tempB + ? ((tempA = ResponderSyntheticEvent.getPooled( + eventTypes.responderTerminate, + responderInst, + nativeEvent, + nativeEventTarget + )), + (tempA.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(tempA, accumulateDirectDispatchesSingle), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + [targetInst, tempA] + )), + changeResponder(JSCompiler_temp, depthA)) + : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( + eventTypes.responderReject, + JSCompiler_temp, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + JSCompiler_temp + )))) + : ((JSCompiler_temp$jscomp$0 = accumulate( + JSCompiler_temp$jscomp$0, + targetInst + )), + changeResponder(JSCompiler_temp, depthA)), + (JSCompiler_temp = JSCompiler_temp$jscomp$0)) + : (JSCompiler_temp = null); + } else JSCompiler_temp = null; + JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); + targetInst = responderInst && isMoveish(topLevelType); + depthA = + responderInst && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); + if ( + (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 + ? eventTypes.responderStart + : targetInst + ? eventTypes.responderMove + : depthA + ? eventTypes.responderEnd + : null) + ) + (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( + JSCompiler_temp$jscomp$0, + responderInst, + nativeEvent, + nativeEventTarget + )), + (JSCompiler_temp$jscomp$0.touchHistory = + ResponderTouchHistoryStore.touchHistory), + forEachAccumulated( + JSCompiler_temp$jscomp$0, + accumulateDirectDispatchesSingle + ), + (JSCompiler_temp = accumulate( + JSCompiler_temp, + JSCompiler_temp$jscomp$0 + )); + JSCompiler_temp$jscomp$0 = + responderInst && "topTouchCancel" === topLevelType; + if ( + (topLevelType = + responderInst && + !JSCompiler_temp$jscomp$0 && + ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType)) + ) + a: { + if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) + for (targetInst = 0; targetInst < topLevelType.length; targetInst++) + if ( + ((depthA = topLevelType[targetInst].target), + null !== depthA && void 0 !== depthA && 0 !== depthA) + ) { + tempA = getInstanceFromNode(depthA); + b: { + for (depthA = responderInst; tempA; ) { + if (depthA === tempA || depthA === tempA.alternate) { + depthA = !0; + break b; + } + tempA = getParent(tempA); + } + depthA = !1; + } + if (depthA) { + topLevelType = !1; + break a; + } + } + topLevelType = !0; + } + if ( + (topLevelType = JSCompiler_temp$jscomp$0 + ? eventTypes.responderTerminate + : topLevelType + ? eventTypes.responderRelease + : null) + ) + (nativeEvent = ResponderSyntheticEvent.getPooled( + topLevelType, + responderInst, + nativeEvent, + nativeEventTarget + )), + (nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory), + forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), + (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), + changeResponder(null); + return JSCompiler_temp; + }, + GlobalResponderHandler: null, + injection: { + injectGlobalResponderHandler: function(GlobalResponderHandler) { + ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; + } + } + }, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, + extractEvents: function( + topLevelType, + targetInst, + nativeEvent, + nativeEventTarget + ) { + if (null == targetInst) return null; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; + if (!bubbleDispatchConfig && !directDispatchConfig) + throw ReactError( + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) + ); + topLevelType = SyntheticEvent.getPooled( + bubbleDispatchConfig || directDispatchConfig, + targetInst, + nativeEvent, + nativeEventTarget + ); + if (bubbleDispatchConfig) + forEachAccumulated(topLevelType, accumulateTwoPhaseDispatchesSingle); + else if (directDispatchConfig) + forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle); + else return null; + return topLevelType; + } + } +}); +var instanceCache = new Map(), + instanceProps = new Map(); +function getInstanceFromTag(tag) { + return instanceCache.get(tag) || null; +} +var restoreTarget = null, + restoreQueue = null; +function restoreStateOfTarget(target) { + if (getInstanceFromNode(target)) + throw ReactError( + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +require("../shims/ReactFeatureFlags"); +function batchedUpdatesImpl(fn, bookkeeping) { + return fn(bookkeeping); +} +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) + if ( + (flushDiscreteUpdatesImpl(), + restoreTarget && + ((bookkeeping = restoreTarget), + (fn = restoreQueue), + (restoreQueue = restoreTarget = null), + restoreStateOfTarget(bookkeeping), + fn)) + ) + for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++) + restoreStateOfTarget(fn[bookkeeping]); + } +} +var EMPTY_NATIVE_EVENT = {}; +function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { + var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT, + inst = getInstanceFromTag(rootNodeID); + batchedUpdates(function() { + var events = nativeEvent.target; + for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { + var possiblePlugin = plugins[i]; + possiblePlugin && + (possiblePlugin = possiblePlugin.extractEvents( + topLevelType, + inst, + nativeEvent, + events + )) && + (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); + } + events = events$jscomp$0; + null !== events && (eventQueue = accumulateInto(eventQueue, events)); + events = eventQueue; + eventQueue = null; + if (events) { + forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); + if (eventQueue) + throw ReactError( + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) + ); + if (hasRethrowError) + throw ((events = rethrowError), + (hasRethrowError = !1), + (rethrowError = null), + events); + } + }); +} +ReactNativePrivateInterface.RCTEventEmitter.register({ + receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) { + _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); + }, + receiveTouches: function(eventTopLevelType, touches, changedIndices) { + if ( + "topTouchEnd" === eventTopLevelType || + "topTouchCancel" === eventTopLevelType + ) { + var JSCompiler_temp = []; + for (var i = 0; i < changedIndices.length; i++) { + var index = changedIndices[i]; + JSCompiler_temp.push(touches[index]); + touches[index] = null; + } + for (i = changedIndices = 0; i < touches.length; i++) + (index = touches[i]), + null !== index && (touches[changedIndices++] = index); + touches.length = changedIndices; + } else + for (JSCompiler_temp = [], i = 0; i < changedIndices.length; i++) + JSCompiler_temp.push(touches[changedIndices[i]]); + for ( + changedIndices = 0; + changedIndices < JSCompiler_temp.length; + changedIndices++ + ) { + i = JSCompiler_temp[changedIndices]; + i.changedTouches = JSCompiler_temp; + i.touches = touches; + index = null; + var target = i.target; + null === target || void 0 === target || 1 > target || (index = target); + _receiveRootNodeIDEvent(index, eventTopLevelType, i); + } + } +}); +getFiberCurrentPropsFromNode = function(stateNode) { + return instanceProps.get(stateNode._nativeTag) || null; +}; +getInstanceFromNode = getInstanceFromTag; +getNodeFromInstance = function(inst) { + var tag = inst.stateNode._nativeTag; + void 0 === tag && (tag = inst.stateNode.canonical._nativeTag); + if (!tag) throw ReactError(Error("All native instances should have a tag.")); + return tag; +}; +ResponderEventPlugin.injection.injectGlobalResponderHandler({ + onChange: function(from, to, blockNativeResponder) { + null !== to + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); + } +}); +var ReactSharedInternals = + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || + (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); +var hasSymbol = "function" === typeof Symbol && Symbol.for, + REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, + REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, + REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, + REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, + REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114, + REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109, + REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, + REACT_CONCURRENT_MODE_TYPE = hasSymbol + ? Symbol.for("react.concurrent_mode") + : 60111, + REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, + REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, + REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, + REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); +var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; +function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; +} +function getComponentName(type) { + if (null == type) return null; + if ("function" === typeof type) return type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return "Context.Consumer"; + case REACT_PROVIDER_TYPE: + return "Context.Provider"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + innerType = innerType.displayName || innerType.name || ""; + return ( + type.displayName || + ("" !== innerType ? "ForwardRef(" + innerType + ")" : "ForwardRef") + ); + case REACT_MEMO_TYPE: + return getComponentName(type.type); + case REACT_LAZY_TYPE: + if ((type = 1 === type._status ? type._result : null)) + return getComponentName(type); + } + return null; +} +function isFiberMountedImpl(fiber) { + var node = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + if (0 !== (node.effectTag & 2)) return 1; + for (; node.return; ) + if (((node = node.return), 0 !== (node.effectTag & 2))) return 1; + } + return 3 === node.tag ? 2 : 3; +} +function assertIsMounted(fiber) { + if (2 !== isFiberMountedImpl(fiber)) + throw ReactError(Error("Unable to find node on an unmounted component.")); +} +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = isFiberMountedImpl(fiber); + if (3 === alternate) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return 1 === alternate ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw ReactError(Error("Unable to find node on an unmounted component.")); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw ReactError( + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) + ); + } + } + if (a.alternate !== b) + throw ReactError( + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (3 !== a.tag) + throw ReactError(Error("Unable to find node on an unmounted component.")); + return a.stateNode.current === a ? fiber : alternate; +} +function findCurrentHostFiber(parent) { + parent = findCurrentFiberUsingSlowPath(parent); + if (!parent) return null; + for (var node = parent; ; ) { + if (5 === node.tag || 6 === node.tag) return node; + if (node.child) (node.child.return = node), (node = node.child); + else { + if (node === parent) break; + for (; !node.sibling; ) { + if (!node.return || node.return === parent) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return null; +} +var emptyObject = {}, + removedKeys = null, + removedKeyCount = 0; +function restoreDeletedValuesInNestedArray( + updatePayload, + node, + validAttributes +) { + if (Array.isArray(node)) + for (var i = node.length; i-- && 0 < removedKeyCount; ) + restoreDeletedValuesInNestedArray( + updatePayload, + node[i], + validAttributes + ); + else if (node && 0 < removedKeyCount) + for (i in removedKeys) + if (removedKeys[i]) { + var nextProp = node[i]; + if (void 0 !== nextProp) { + var attributeConfig = validAttributes[i]; + if (attributeConfig) { + "function" === typeof nextProp && (nextProp = !0); + "undefined" === typeof nextProp && (nextProp = null); + if ("object" !== typeof attributeConfig) + updatePayload[i] = nextProp; + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (nextProp = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[i] = nextProp); + removedKeys[i] = !1; + removedKeyCount--; + } + } + } +} +function diffNestedProperty( + updatePayload, + prevProp, + nextProp, + validAttributes +) { + if (!updatePayload && prevProp === nextProp) return updatePayload; + if (!prevProp || !nextProp) + return nextProp + ? addNestedProperty(updatePayload, nextProp, validAttributes) + : prevProp + ? clearNestedProperty(updatePayload, prevProp, validAttributes) + : updatePayload; + if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) + return diffProperties(updatePayload, prevProp, nextProp, validAttributes); + if (Array.isArray(prevProp) && Array.isArray(nextProp)) { + var minLength = + prevProp.length < nextProp.length ? prevProp.length : nextProp.length, + i; + for (i = 0; i < minLength; i++) + updatePayload = diffNestedProperty( + updatePayload, + prevProp[i], + nextProp[i], + validAttributes + ); + for (; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + for (; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; + } + return Array.isArray(prevProp) + ? diffProperties( + updatePayload, + ReactNativePrivateInterface.flattenStyle(prevProp), + nextProp, + validAttributes + ) + : diffProperties( + updatePayload, + prevProp, + ReactNativePrivateInterface.flattenStyle(nextProp), + validAttributes + ); +} +function addNestedProperty(updatePayload, nextProp, validAttributes) { + if (!nextProp) return updatePayload; + if (!Array.isArray(nextProp)) + return diffProperties( + updatePayload, + emptyObject, + nextProp, + validAttributes + ); + for (var i = 0; i < nextProp.length; i++) + updatePayload = addNestedProperty( + updatePayload, + nextProp[i], + validAttributes + ); + return updatePayload; +} +function clearNestedProperty(updatePayload, prevProp, validAttributes) { + if (!prevProp) return updatePayload; + if (!Array.isArray(prevProp)) + return diffProperties( + updatePayload, + prevProp, + emptyObject, + validAttributes + ); + for (var i = 0; i < prevProp.length; i++) + updatePayload = clearNestedProperty( + updatePayload, + prevProp[i], + validAttributes + ); + return updatePayload; +} +function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { + var attributeConfig, propKey; + for (propKey in nextProps) + if ((attributeConfig = validAttributes[propKey])) { + var prevProp = prevProps[propKey]; + var nextProp = nextProps[propKey]; + "function" === typeof nextProp && + ((nextProp = !0), "function" === typeof prevProp && (prevProp = !0)); + "undefined" === typeof nextProp && + ((nextProp = null), + "undefined" === typeof prevProp && (prevProp = null)); + removedKeys && (removedKeys[propKey] = !1); + if (updatePayload && void 0 !== updatePayload[propKey]) + if ("object" !== typeof attributeConfig) + updatePayload[propKey] = nextProp; + else { + if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + (updatePayload[propKey] = attributeConfig); + } + else if (prevProp !== nextProp) + if ("object" !== typeof attributeConfig) + ("object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && + ((updatePayload || (updatePayload = {}))[propKey] = nextProp); + else if ( + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ) { + if ( + void 0 === prevProp || + ("function" === typeof attributeConfig.diff + ? attributeConfig.diff(prevProp, nextProp) + : "object" !== typeof nextProp || + null === nextProp || + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) + ) + (attributeConfig = + "function" === typeof attributeConfig.process + ? attributeConfig.process(nextProp) + : nextProp), + ((updatePayload || (updatePayload = {}))[ + propKey + ] = attributeConfig); + } else + (removedKeys = null), + (removedKeyCount = 0), + (updatePayload = diffNestedProperty( + updatePayload, + prevProp, + nextProp, + attributeConfig + )), + 0 < removedKeyCount && + updatePayload && + (restoreDeletedValuesInNestedArray( + updatePayload, + nextProp, + attributeConfig + ), + (removedKeys = null)); + } + for (var _propKey in prevProps) + void 0 === nextProps[_propKey] && + (!(attributeConfig = validAttributes[_propKey]) || + (updatePayload && void 0 !== updatePayload[_propKey]) || + ((prevProp = prevProps[_propKey]), + void 0 !== prevProp && + ("object" !== typeof attributeConfig || + "function" === typeof attributeConfig.diff || + "function" === typeof attributeConfig.process + ? (((updatePayload || (updatePayload = {}))[_propKey] = null), + removedKeys || (removedKeys = {}), + removedKeys[_propKey] || + ((removedKeys[_propKey] = !0), removedKeyCount++)) + : (updatePayload = clearNestedProperty( + updatePayload, + prevProp, + attributeConfig + ))))); + return updatePayload; +} +function mountSafeCallback_NOT_REALLY_SAFE(context, callback) { + return function() { + if ( + callback && + ("boolean" !== typeof context.__isMounted || context.__isMounted) + ) + return callback.apply(context, arguments); + }; +} +var ReactNativeFiberHostComponent = (function() { + function ReactNativeFiberHostComponent(tag, viewConfig) { + if (!(this instanceof ReactNativeFiberHostComponent)) + throw new TypeError("Cannot call a class as a function"); + this._nativeTag = tag; + this._children = []; + this.viewConfig = viewConfig; + } + ReactNativeFiberHostComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); + }; + ReactNativeFiberHostComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); + }; + ReactNativeFiberHostComponent.prototype.measure = function(callback) { + ReactNativePrivateInterface.UIManager.measure( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactNativeFiberHostComponent.prototype.measureInWindow = function(callback) { + ReactNativePrivateInterface.UIManager.measureInWindow( + this._nativeTag, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ); + }; + ReactNativeFiberHostComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var relativeNode = void 0; + "number" === typeof relativeToNativeNode + ? (relativeNode = relativeToNativeNode) + : relativeToNativeNode._nativeTag + ? (relativeNode = relativeToNativeNode._nativeTag) + : relativeToNativeNode.canonical && + relativeToNativeNode.canonical._nativeTag && + (relativeNode = relativeToNativeNode.canonical._nativeTag); + null != relativeNode && + ReactNativePrivateInterface.UIManager.measureLayout( + this._nativeTag, + relativeNode, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + ); + }; + ReactNativeFiberHostComponent.prototype.setNativeProps = function( + nativeProps + ) { + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + this.viewConfig.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + this._nativeTag, + this.viewConfig.uiViewClassName, + nativeProps + ); + }; + return ReactNativeFiberHostComponent; +})(); +function shim$1() { + throw ReactError( + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) + ); +} +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + UPDATE_SIGNAL = {}, + nextReactTag = 3; +function allocateTag() { + var tag = nextReactTag; + 1 === tag % 10 && (tag += 2); + nextReactTag = tag + 2; + return tag; +} +function recursivelyUncacheFiberNode(node) { + if ("number" === typeof node) + instanceCache.delete(node), instanceProps.delete(node); + else { + var tag = node._nativeTag; + instanceCache.delete(tag); + instanceProps.delete(tag); + node._children.forEach(recursivelyUncacheFiberNode); + } +} +function finalizeInitialChildren(parentInstance) { + if (0 === parentInstance._children.length) return !1; + var nativeTags = parentInstance._children.map(function(child) { + return "number" === typeof child ? child : child._nativeTag; + }); + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance._nativeTag, + nativeTags + ); + return !1; +} +var scheduleTimeout = setTimeout, + cancelTimeout = clearTimeout, + BEFORE_SLASH_RE = /^(.*)[\\\/]/; +function getStackByFiberInDevAndProd(workInProgress) { + var info = ""; + do { + a: switch (workInProgress.tag) { + case 3: + case 4: + case 6: + case 7: + case 10: + case 9: + var JSCompiler_inline_result = ""; + break a; + default: + var owner = workInProgress._debugOwner, + source = workInProgress._debugSource, + name = getComponentName(workInProgress.type); + JSCompiler_inline_result = null; + owner && (JSCompiler_inline_result = getComponentName(owner.type)); + owner = name; + name = ""; + source + ? (name = + " (at " + + source.fileName.replace(BEFORE_SLASH_RE, "") + + ":" + + source.lineNumber + + ")") + : JSCompiler_inline_result && + (name = " (created by " + JSCompiler_inline_result + ")"); + JSCompiler_inline_result = "\n in " + (owner || "Unknown") + name; + } + info += JSCompiler_inline_result; + workInProgress = workInProgress.return; + } while (workInProgress); + return info; +} +new Set(); +var valueStack = [], + index = -1; +function pop(cursor) { + 0 > index || + ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); +} +function push(cursor, value) { + index++; + valueStack[index] = cursor.current; + cursor.current = value; +} +var emptyContextObject = {}, + contextStackCursor = { current: emptyContextObject }, + didPerformWorkStackCursor = { current: !1 }, + previousContext = emptyContextObject; +function getMaskedContext(workInProgress, unmaskedContext) { + var contextTypes = workInProgress.type.contextTypes; + if (!contextTypes) return emptyContextObject; + var instance = workInProgress.stateNode; + if ( + instance && + instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext + ) + return instance.__reactInternalMemoizedMaskedChildContext; + var context = {}, + key; + for (key in contextTypes) context[key] = unmaskedContext[key]; + instance && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return context; +} +function isContextProvider(type) { + type = type.childContextTypes; + return null !== type && void 0 !== type; +} +function popContext(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function popTopLevelContextObject(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); +} +function pushTopLevelContextObject(fiber, context, didChange) { + if (contextStackCursor.current !== emptyContextObject) + throw ReactError( + Error( + "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(fiber, type, parentContext) { + var instance = fiber.stateNode; + fiber = type.childContextTypes; + if ("function" !== typeof instance.getChildContext) return parentContext; + instance = instance.getChildContext(); + for (var contextKey in instance) + if (!(contextKey in fiber)) + throw ReactError( + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) + ); + return Object.assign({}, parentContext, instance); +} +function pushContextProvider(workInProgress) { + var instance = workInProgress.stateNode; + instance = + (instance && instance.__reactInternalMemoizedMergedChildContext) || + emptyContextObject; + previousContext = contextStackCursor.current; + push(contextStackCursor, instance, workInProgress); + push( + didPerformWorkStackCursor, + didPerformWorkStackCursor.current, + workInProgress + ); + return !0; +} +function invalidateContextProvider(workInProgress, type, didChange) { + var instance = workInProgress.stateNode; + if (!instance) + throw ReactError( + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) + ); + didChange + ? ((type = processChildContext(workInProgress, type, previousContext)), + (instance.__reactInternalMemoizedMergedChildContext = type), + pop(didPerformWorkStackCursor, workInProgress), + pop(contextStackCursor, workInProgress), + push(contextStackCursor, type, workInProgress)) + : pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); +} +var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, + Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, + Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, + Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, + Scheduler_now = Scheduler.unstable_now, + Scheduler_getCurrentPriorityLevel = + Scheduler.unstable_getCurrentPriorityLevel, + Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, + Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, + Scheduler_LowPriority = Scheduler.unstable_LowPriority, + Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; +if ( + null == tracing.__interactionsRef || + null == tracing.__interactionsRef.current +) + throw ReactError( + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) + ); +var fakeCallbackNode = {}, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, + immediateQueueCallbackNode = null, + isFlushingSyncQueue = !1, + initialTimeMs = Scheduler_now(), + now = + 1e4 > initialTimeMs + ? Scheduler_now + : function() { + return Scheduler_now() - initialTimeMs; + }; +function getCurrentPriorityLevel() { + switch (Scheduler_getCurrentPriorityLevel()) { + case Scheduler_ImmediatePriority: + return 99; + case Scheduler_UserBlockingPriority: + return 98; + case Scheduler_NormalPriority: + return 97; + case Scheduler_LowPriority: + return 96; + case Scheduler_IdlePriority: + return 95; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch (reactPriorityLevel) { + case 99: + return Scheduler_ImmediatePriority; + case 98: + return Scheduler_UserBlockingPriority; + case 97: + return Scheduler_NormalPriority; + case 96: + return Scheduler_LowPriority; + case 95: + return Scheduler_IdlePriority; + default: + throw ReactError(Error("Unknown priority level.")); + } +} +function runWithPriority(reactPriorityLevel, fn) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(reactPriorityLevel, fn); +} +function scheduleCallback(reactPriorityLevel, callback, options) { + reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); +} +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { + null !== immediateQueueCallbackNode && + Scheduler_cancelCallback(immediateQueueCallbackNode); + flushSyncCallbackQueueImpl(); +} +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0; + try { + var queue = syncQueue; + runWithPriority(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueue + ), + error); + } finally { + isFlushingSyncQueue = !1; + } + } +} +function inferPriorityFromExpirationTime(currentTime, expirationTime) { + if (1073741823 === expirationTime) return 99; + if (1 === expirationTime) return 95; + currentTime = + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); + return 0 >= currentTime + ? 99 + : 250 >= currentTime + ? 98 + : 5250 >= currentTime + ? 97 + : 95; +} +function is(x, y) { + return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function shallowEqual(objA, objB) { + if (is(objA, objB)) return !0; + if ( + "object" !== typeof objA || + null === objA || + "object" !== typeof objB || + null === objB + ) + return !1; + var keysA = Object.keys(objA), + keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) + if ( + !hasOwnProperty.call(objB, keysA[keysB]) || + !is(objA[keysA[keysB]], objB[keysA[keysB]]) + ) + return !1; + return !0; +} +function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + baseProps = Object.assign({}, baseProps); + Component = Component.defaultProps; + for (var propName in Component) + void 0 === baseProps[propName] && + (baseProps[propName] = Component[propName]); + } + return baseProps; +} +function readLazyComponentType(lazyComponent) { + var result = lazyComponent._result; + switch (lazyComponent._status) { + case 1: + return result; + case 2: + throw result; + case 0: + throw result; + default: + lazyComponent._status = 0; + result = lazyComponent._ctor; + result = result(); + result.then( + function(moduleObject) { + 0 === lazyComponent._status && + ((moduleObject = moduleObject.default), + (lazyComponent._status = 1), + (lazyComponent._result = moduleObject)); + }, + function(error) { + 0 === lazyComponent._status && + ((lazyComponent._status = 2), (lazyComponent._result = error)); + } + ); + switch (lazyComponent._status) { + case 1: + return lazyComponent._result; + case 2: + throw lazyComponent._result; + } + lazyComponent._result = result; + throw result; + } +} +var valueCursor = { current: null }, + currentlyRenderingFiber = null, + lastContextDependency = null, + lastContextWithAllBitsObserved = null; +function resetContextDependencies() { + lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; +} +function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; +} +function popProvider(providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + providerFiber.type._context._currentValue = currentValue; +} +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} +function prepareToReadContext(workInProgress, renderExpirationTime) { + currentlyRenderingFiber = workInProgress; + lastContextWithAllBitsObserved = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context, observedBits) { + if ( + lastContextWithAllBitsObserved !== context && + !1 !== observedBits && + 0 !== observedBits + ) { + if ("number" !== typeof observedBits || 1073741823 === observedBits) + (lastContextWithAllBitsObserved = context), (observedBits = 1073741823); + observedBits = { context: context, observedBits: observedBits, next: null }; + if (null === lastContextDependency) { + if (null === currentlyRenderingFiber) + throw ReactError( + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) + ); + lastContextDependency = observedBits; + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null + }; + } else lastContextDependency = lastContextDependency.next = observedBits; + } + return context._currentValue; +} +var hasForceUpdate = !1; +function createUpdateQueue(baseState) { + return { + baseState: baseState, + firstUpdate: null, + lastUpdate: null, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function cloneUpdateQueue(currentQueue) { + return { + baseState: currentQueue.baseState, + firstUpdate: currentQueue.firstUpdate, + lastUpdate: currentQueue.lastUpdate, + firstCapturedUpdate: null, + lastCapturedUpdate: null, + firstEffect: null, + lastEffect: null, + firstCapturedEffect: null, + lastCapturedEffect: null + }; +} +function createUpdate(expirationTime, suspenseConfig) { + return { + expirationTime: expirationTime, + suspenseConfig: suspenseConfig, + tag: 0, + payload: null, + callback: null, + next: null, + nextEffect: null + }; +} +function appendUpdateToQueue(queue, update) { + null === queue.lastUpdate + ? (queue.firstUpdate = queue.lastUpdate = update) + : ((queue.lastUpdate.next = update), (queue.lastUpdate = update)); +} +function enqueueUpdate(fiber, update) { + var alternate = fiber.alternate; + if (null === alternate) { + var queue1 = fiber.updateQueue; + var queue2 = null; + null === queue1 && + (queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState)); + } else + (queue1 = fiber.updateQueue), + (queue2 = alternate.updateQueue), + null === queue1 + ? null === queue2 + ? ((queue1 = fiber.updateQueue = createUpdateQueue( + fiber.memoizedState + )), + (queue2 = alternate.updateQueue = createUpdateQueue( + alternate.memoizedState + ))) + : (queue1 = fiber.updateQueue = cloneUpdateQueue(queue2)) + : null === queue2 && + (queue2 = alternate.updateQueue = cloneUpdateQueue(queue1)); + null === queue2 || queue1 === queue2 + ? appendUpdateToQueue(queue1, update) + : null === queue1.lastUpdate || null === queue2.lastUpdate + ? (appendUpdateToQueue(queue1, update), + appendUpdateToQueue(queue2, update)) + : (appendUpdateToQueue(queue1, update), (queue2.lastUpdate = update)); +} +function enqueueCapturedUpdate(workInProgress, update) { + var workInProgressQueue = workInProgress.updateQueue; + workInProgressQueue = + null === workInProgressQueue + ? (workInProgress.updateQueue = createUpdateQueue( + workInProgress.memoizedState + )) + : ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue); + null === workInProgressQueue.lastCapturedUpdate + ? (workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update) + : ((workInProgressQueue.lastCapturedUpdate.next = update), + (workInProgressQueue.lastCapturedUpdate = update)); +} +function ensureWorkInProgressQueueIsAClone(workInProgress, queue) { + var current = workInProgress.alternate; + null !== current && + queue === current.updateQueue && + (queue = workInProgress.updateQueue = cloneUpdateQueue(queue)); + return queue; +} +function getStateFromUpdate( + workInProgress, + queue, + update, + prevState, + nextProps, + instance +) { + switch (update.tag) { + case 1: + return ( + (workInProgress = update.payload), + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress + ); + case 3: + workInProgress.effectTag = (workInProgress.effectTag & -2049) | 64; + case 0: + workInProgress = update.payload; + nextProps = + "function" === typeof workInProgress + ? workInProgress.call(instance, prevState, nextProps) + : workInProgress; + if (null === nextProps || void 0 === nextProps) break; + return Object.assign({}, prevState, nextProps); + case 2: + hasForceUpdate = !0; + } + return prevState; +} +function processUpdateQueue( + workInProgress, + queue, + props, + instance, + renderExpirationTime +) { + hasForceUpdate = !1; + queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue); + for ( + var newBaseState = queue.baseState, + newFirstUpdate = null, + newExpirationTime = 0, + update = queue.firstUpdate, + resultState = newBaseState; + null !== update; + + ) { + var updateExpirationTime = update.expirationTime; + updateExpirationTime < renderExpirationTime + ? (null === newFirstUpdate && + ((newFirstUpdate = update), (newBaseState = resultState)), + newExpirationTime < updateExpirationTime && + (newExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), + (resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastEffect + ? (queue.firstEffect = queue.lastEffect = update) + : ((queue.lastEffect.nextEffect = update), + (queue.lastEffect = update)))); + update = update.next; + } + updateExpirationTime = null; + for (update = queue.firstCapturedUpdate; null !== update; ) { + var _updateExpirationTime = update.expirationTime; + _updateExpirationTime < renderExpirationTime + ? (null === updateExpirationTime && + ((updateExpirationTime = update), + null === newFirstUpdate && (newBaseState = resultState)), + newExpirationTime < _updateExpirationTime && + (newExpirationTime = _updateExpirationTime)) + : ((resultState = getStateFromUpdate( + workInProgress, + queue, + update, + resultState, + props, + instance + )), + null !== update.callback && + ((workInProgress.effectTag |= 32), + (update.nextEffect = null), + null === queue.lastCapturedEffect + ? (queue.firstCapturedEffect = queue.lastCapturedEffect = update) + : ((queue.lastCapturedEffect.nextEffect = update), + (queue.lastCapturedEffect = update)))); + update = update.next; + } + null === newFirstUpdate && (queue.lastUpdate = null); + null === updateExpirationTime + ? (queue.lastCapturedUpdate = null) + : (workInProgress.effectTag |= 32); + null === newFirstUpdate && + null === updateExpirationTime && + (newBaseState = resultState); + queue.baseState = newBaseState; + queue.firstUpdate = newFirstUpdate; + queue.firstCapturedUpdate = updateExpirationTime; + workInProgress.expirationTime = newExpirationTime; + workInProgress.memoizedState = resultState; +} +function commitUpdateQueue(finishedWork, finishedQueue, instance) { + null !== finishedQueue.firstCapturedUpdate && + (null !== finishedQueue.lastUpdate && + ((finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate), + (finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate)), + (finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null)); + commitUpdateEffects(finishedQueue.firstEffect, instance); + finishedQueue.firstEffect = finishedQueue.lastEffect = null; + commitUpdateEffects(finishedQueue.firstCapturedEffect, instance); + finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null; +} +function commitUpdateEffects(effect, instance) { + for (; null !== effect; ) { + var _callback3 = effect.callback; + if (null !== _callback3) { + effect.callback = null; + var context = instance; + if ("function" !== typeof _callback3) + throw ReactError( + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) + ); + _callback3.call(context); + } + effect = effect.nextEffect; + } +} +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; +function applyDerivedStateFromProps( + workInProgress, + ctor, + getDerivedStateFromProps, + nextProps +) { + ctor = workInProgress.memoizedState; + getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor); + getDerivedStateFromProps = + null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps + ? ctor + : Object.assign({}, ctor, getDerivedStateFromProps); + workInProgress.memoizedState = getDerivedStateFromProps; + nextProps = workInProgress.updateQueue; + null !== nextProps && + 0 === workInProgress.expirationTime && + (nextProps.baseState = getDerivedStateFromProps); +} +var classComponentUpdater = { + isMounted: function(component) { + return (component = component._reactInternalFiber) + ? 2 === isFiberMountedImpl(component) + : !1; + }, + enqueueSetState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + }, + enqueueForceUpdate: function(inst, callback) { + inst = inst._reactInternalFiber; + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); + scheduleUpdateOnFiber(inst, currentTime); + } +}; +function checkShouldComponentUpdate( + workInProgress, + ctor, + oldProps, + newProps, + oldState, + newState, + nextContext +) { + workInProgress = workInProgress.stateNode; + return "function" === typeof workInProgress.shouldComponentUpdate + ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext) + : ctor.prototype && ctor.prototype.isPureReactComponent + ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) + : !0; +} +function constructClassInstance(workInProgress, ctor, props) { + var isLegacyContextConsumer = !1, + unmaskedContext = emptyContextObject; + var context = ctor.contextType; + "object" === typeof context && null !== context + ? (context = readContext(context)) + : ((unmaskedContext = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (isLegacyContextConsumer = ctor.contextTypes), + (context = (isLegacyContextConsumer = + null !== isLegacyContextConsumer && void 0 !== isLegacyContextConsumer) + ? getMaskedContext(workInProgress, unmaskedContext) + : emptyContextObject)); + ctor = new ctor(props, context); + workInProgress.memoizedState = + null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; + ctor.updater = classComponentUpdater; + workInProgress.stateNode = ctor; + ctor._reactInternalFiber = workInProgress; + isLegacyContextConsumer && + ((workInProgress = workInProgress.stateNode), + (workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), + (workInProgress.__reactInternalMemoizedMaskedChildContext = context)); + return ctor; +} +function callComponentWillReceiveProps( + workInProgress, + instance, + newProps, + nextContext +) { + workInProgress = instance.state; + "function" === typeof instance.componentWillReceiveProps && + instance.componentWillReceiveProps(newProps, nextContext); + "function" === typeof instance.UNSAFE_componentWillReceiveProps && + instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + instance.state !== workInProgress && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); +} +function mountClassInstance( + workInProgress, + ctor, + newProps, + renderExpirationTime +) { + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + var contextType = ctor.contextType; + "object" === typeof contextType && null !== contextType + ? (instance.context = readContext(contextType)) + : ((contextType = isContextProvider(ctor) + ? previousContext + : contextStackCursor.current), + (instance.context = getMaskedContext(workInProgress, contextType))); + contextType = workInProgress.updateQueue; + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState)); + contextType = ctor.getDerivedStateFromProps; + "function" === typeof contextType && + (applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps), + (instance.state = workInProgress.memoizedState)); + "function" === typeof ctor.getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ((ctor = instance.state), + "function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount(), + ctor !== instance.state && + classComponentUpdater.enqueueReplaceState(instance, instance.state, null), + (contextType = workInProgress.updateQueue), + null !== contextType && + (processUpdateQueue( + workInProgress, + contextType, + newProps, + instance, + renderExpirationTime + ), + (instance.state = workInProgress.memoizedState))); + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4); +} +var isArray = Array.isArray; +function coerceRef(returnFiber, current$$1, element) { + returnFiber = element.ref; + if ( + null !== returnFiber && + "function" !== typeof returnFiber && + "object" !== typeof returnFiber + ) { + if (element._owner) { + element = element._owner; + var inst = void 0; + if (element) { + if (1 !== element.tag) + throw ReactError( + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) + ); + inst = element.stateNode; + } + if (!inst) + throw ReactError( + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) + ); + var stringRef = "" + returnFiber; + if ( + null !== current$$1 && + null !== current$$1.ref && + "function" === typeof current$$1.ref && + current$$1.ref._stringRef === stringRef + ) + return current$$1.ref; + current$$1 = function(value) { + var refs = inst.refs; + refs === emptyRefsObject && (refs = inst.refs = {}); + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + }; + current$$1._stringRef = stringRef; + return current$$1; + } + if ("string" !== typeof returnFiber) + throw ReactError( + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) + ); + if (!element._owner) + throw ReactError( + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) + ); + } + return returnFiber; +} +function throwOnInvalidObjectType(returnFiber, newChild) { + if ("textarea" !== returnFiber.type) + throw ReactError( + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) + ); +} +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (shouldTrackSideEffects) { + var last = returnFiber.lastEffect; + null !== last + ? ((last.nextEffect = childToDelete), + (returnFiber.lastEffect = childToDelete)) + : (returnFiber.firstEffect = returnFiber.lastEffect = childToDelete); + childToDelete.nextEffect = null; + childToDelete.effectTag = 8; + } + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) return null; + for (; null !== currentFirstChild; ) + deleteChild(returnFiber, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return null; + } + function mapRemainingChildren(returnFiber, currentFirstChild) { + for (returnFiber = new Map(); null !== currentFirstChild; ) + null !== currentFirstChild.key + ? returnFiber.set(currentFirstChild.key, currentFirstChild) + : returnFiber.set(currentFirstChild.index, currentFirstChild), + (currentFirstChild = currentFirstChild.sibling); + return returnFiber; + } + function useFiber(fiber, pendingProps, expirationTime) { + fiber = createWorkInProgress(fiber, pendingProps, expirationTime); + fiber.index = 0; + fiber.sibling = null; + return fiber; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) return lastPlacedIndex; + newIndex = newFiber.alternate; + if (null !== newIndex) + return ( + (newIndex = newIndex.index), + newIndex < lastPlacedIndex + ? ((newFiber.effectTag = 2), lastPlacedIndex) + : newIndex + ); + newFiber.effectTag = 2; + return lastPlacedIndex; + } + function placeSingleChild(newFiber) { + shouldTrackSideEffects && + null === newFiber.alternate && + (newFiber.effectTag = 2); + return newFiber; + } + function updateTextNode( + returnFiber, + current$$1, + textContent, + expirationTime + ) { + if (null === current$$1 || 6 !== current$$1.tag) + return ( + (current$$1 = createFiberFromText( + textContent, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, textContent, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateElement(returnFiber, current$$1, element, expirationTime) { + if (null !== current$$1 && current$$1.elementType === element.type) + return ( + (expirationTime = useFiber(current$$1, element.props, expirationTime)), + (expirationTime.ref = coerceRef(returnFiber, current$$1, element)), + (expirationTime.return = returnFiber), + expirationTime + ); + expirationTime = createFiberFromTypeAndProps( + element.type, + element.key, + element.props, + null, + returnFiber.mode, + expirationTime + ); + expirationTime.ref = coerceRef(returnFiber, current$$1, element); + expirationTime.return = returnFiber; + return expirationTime; + } + function updatePortal(returnFiber, current$$1, portal, expirationTime) { + if ( + null === current$$1 || + 4 !== current$$1.tag || + current$$1.stateNode.containerInfo !== portal.containerInfo || + current$$1.stateNode.implementation !== portal.implementation + ) + return ( + (current$$1 = createFiberFromPortal( + portal, + returnFiber.mode, + expirationTime + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, portal.children || [], expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function updateFragment( + returnFiber, + current$$1, + fragment, + expirationTime, + key + ) { + if (null === current$$1 || 7 !== current$$1.tag) + return ( + (current$$1 = createFiberFromFragment( + fragment, + returnFiber.mode, + expirationTime, + key + )), + (current$$1.return = returnFiber), + current$$1 + ); + current$$1 = useFiber(current$$1, fragment, expirationTime); + current$$1.return = returnFiber; + return current$$1; + } + function createChild(returnFiber, newChild, expirationTime) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = createFiberFromText( + "" + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef(returnFiber, null, newChild)), + (expirationTime.return = returnFiber), + expirationTime + ); + case REACT_PORTAL_TYPE: + return ( + (newChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + )), + (newChild.return = returnFiber), + newChild + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (newChild = createFiberFromFragment( + newChild, + returnFiber.mode, + expirationTime, + null + )), + (newChild.return = returnFiber), + newChild + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + var key = null !== oldFiber ? oldFiber.key : null; + if ("string" === typeof newChild || "number" === typeof newChild) + return null !== key + ? null + : updateTextNode(returnFiber, oldFiber, "" + newChild, expirationTime); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return newChild.key === key + ? newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + oldFiber, + newChild.props.children, + expirationTime, + key + ) + : updateElement(returnFiber, oldFiber, newChild, expirationTime) + : null; + case REACT_PORTAL_TYPE: + return newChild.key === key + ? updatePortal(returnFiber, oldFiber, newChild, expirationTime) + : null; + } + if (isArray(newChild) || getIteratorFn(newChild)) + return null !== key + ? null + : updateFragment( + returnFiber, + oldFiber, + newChild, + expirationTime, + null + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function updateFromMap( + existingChildren, + returnFiber, + newIdx, + newChild, + expirationTime + ) { + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateTextNode( + returnFiber, + existingChildren, + "" + newChild, + expirationTime + ) + ); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + newChild.type === REACT_FRAGMENT_TYPE + ? updateFragment( + returnFiber, + existingChildren, + newChild.props.children, + expirationTime, + newChild.key + ) + : updateElement( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + case REACT_PORTAL_TYPE: + return ( + (existingChildren = + existingChildren.get( + null === newChild.key ? newIdx : newChild.key + ) || null), + updatePortal( + returnFiber, + existingChildren, + newChild, + expirationTime + ) + ); + } + if (isArray(newChild) || getIteratorFn(newChild)) + return ( + (existingChildren = existingChildren.get(newIdx) || null), + updateFragment( + returnFiber, + existingChildren, + newChild, + expirationTime, + null + ) + ); + throwOnInvalidObjectType(returnFiber, newChild); + } + return null; + } + function reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChildren, + expirationTime + ) { + for ( + var resultingFirstChild = null, + previousNewFiber = null, + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null; + null !== oldFiber && newIdx < newChildren.length; + newIdx++ + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + newChildren[newIdx], + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (resultingFirstChild = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) + return ( + deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild + ); + if (null === oldFiber) { + for (; newIdx < newChildren.length; newIdx++) + (oldFiber = createChild( + returnFiber, + newChildren[newIdx], + expirationTime + )), + null !== oldFiber && + ((currentFirstChild = placeChild( + oldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = oldFiber) + : (previousNewFiber.sibling = oldFiber), + (previousNewFiber = oldFiber)); + return resultingFirstChild; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + newIdx < newChildren.length; + newIdx++ + ) + (nextOldFiber = updateFromMap( + oldFiber, + returnFiber, + newIdx, + newChildren[newIdx], + expirationTime + )), + null !== nextOldFiber && + (shouldTrackSideEffects && + null !== nextOldFiber.alternate && + oldFiber.delete( + null === nextOldFiber.key ? newIdx : nextOldFiber.key + ), + (currentFirstChild = placeChild( + nextOldFiber, + currentFirstChild, + newIdx + )), + null === previousNewFiber + ? (resultingFirstChild = nextOldFiber) + : (previousNewFiber.sibling = nextOldFiber), + (previousNewFiber = nextOldFiber)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChildrenIterable, + expirationTime + ) { + var iteratorFn = getIteratorFn(newChildrenIterable); + if ("function" !== typeof iteratorFn) + throw ReactError( + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) + ); + newChildrenIterable = iteratorFn.call(newChildrenIterable); + if (null == newChildrenIterable) + throw ReactError(Error("An iterable object provided no iterator.")); + for ( + var previousNewFiber = (iteratorFn = null), + oldFiber = currentFirstChild, + newIdx = (currentFirstChild = 0), + nextOldFiber = null, + step = newChildrenIterable.next(); + null !== oldFiber && !step.done; + newIdx++, step = newChildrenIterable.next() + ) { + oldFiber.index > newIdx + ? ((nextOldFiber = oldFiber), (oldFiber = null)) + : (nextOldFiber = oldFiber.sibling); + var newFiber = updateSlot( + returnFiber, + oldFiber, + step.value, + expirationTime + ); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && + oldFiber && + null === newFiber.alternate && + deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber + ? (iteratorFn = newFiber) + : (previousNewFiber.sibling = newFiber); + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) + return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn; + if (null === oldFiber) { + for (; !step.done; newIdx++, step = newChildrenIterable.next()) + (step = createChild(returnFiber, step.value, expirationTime)), + null !== step && + ((currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + return iteratorFn; + } + for ( + oldFiber = mapRemainingChildren(returnFiber, oldFiber); + !step.done; + newIdx++, step = newChildrenIterable.next() + ) + (step = updateFromMap( + oldFiber, + returnFiber, + newIdx, + step.value, + expirationTime + )), + null !== step && + (shouldTrackSideEffects && + null !== step.alternate && + oldFiber.delete(null === step.key ? newIdx : step.key), + (currentFirstChild = placeChild(step, currentFirstChild, newIdx)), + null === previousNewFiber + ? (iteratorFn = step) + : (previousNewFiber.sibling = step), + (previousNewFiber = step)); + shouldTrackSideEffects && + oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return iteratorFn; + } + return function(returnFiber, currentFirstChild, newChild, expirationTime) { + var isUnkeyedTopLevelFragment = + "object" === typeof newChild && + null !== newChild && + newChild.type === REACT_FRAGMENT_TYPE && + null === newChild.key; + isUnkeyedTopLevelFragment && (newChild = newChild.props.children); + var isObject = "object" === typeof newChild && null !== newChild; + if (isObject) + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + a: { + isObject = newChild.key; + for ( + isUnkeyedTopLevelFragment = currentFirstChild; + null !== isUnkeyedTopLevelFragment; + + ) { + if (isUnkeyedTopLevelFragment.key === isObject) { + if ( + 7 === isUnkeyedTopLevelFragment.tag + ? newChild.type === REACT_FRAGMENT_TYPE + : isUnkeyedTopLevelFragment.elementType === newChild.type + ) { + deleteRemainingChildren( + returnFiber, + isUnkeyedTopLevelFragment.sibling + ); + currentFirstChild = useFiber( + isUnkeyedTopLevelFragment, + newChild.type === REACT_FRAGMENT_TYPE + ? newChild.props.children + : newChild.props, + expirationTime + ); + currentFirstChild.ref = coerceRef( + returnFiber, + isUnkeyedTopLevelFragment, + newChild + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, isUnkeyedTopLevelFragment); + break; + } else deleteChild(returnFiber, isUnkeyedTopLevelFragment); + isUnkeyedTopLevelFragment = isUnkeyedTopLevelFragment.sibling; + } + newChild.type === REACT_FRAGMENT_TYPE + ? ((currentFirstChild = createFiberFromFragment( + newChild.props.children, + returnFiber.mode, + expirationTime, + newChild.key + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : ((expirationTime = createFiberFromTypeAndProps( + newChild.type, + newChild.key, + newChild.props, + null, + returnFiber.mode, + expirationTime + )), + (expirationTime.ref = coerceRef( + returnFiber, + currentFirstChild, + newChild + )), + (expirationTime.return = returnFiber), + (returnFiber = expirationTime)); + } + return placeSingleChild(returnFiber); + case REACT_PORTAL_TYPE: + a: { + for ( + isUnkeyedTopLevelFragment = newChild.key; + null !== currentFirstChild; + + ) { + if (currentFirstChild.key === isUnkeyedTopLevelFragment) { + if ( + 4 === currentFirstChild.tag && + currentFirstChild.stateNode.containerInfo === + newChild.containerInfo && + currentFirstChild.stateNode.implementation === + newChild.implementation + ) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + currentFirstChild = useFiber( + currentFirstChild, + newChild.children || [], + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + break a; + } + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + currentFirstChild = createFiberFromPortal( + newChild, + returnFiber.mode, + expirationTime + ); + currentFirstChild.return = returnFiber; + returnFiber = currentFirstChild; + } + return placeSingleChild(returnFiber); + } + if ("string" === typeof newChild || "number" === typeof newChild) + return ( + (newChild = "" + newChild), + null !== currentFirstChild && 6 === currentFirstChild.tag + ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), + (currentFirstChild = useFiber( + currentFirstChild, + newChild, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)) + : (deleteRemainingChildren(returnFiber, currentFirstChild), + (currentFirstChild = createFiberFromText( + newChild, + returnFiber.mode, + expirationTime + )), + (currentFirstChild.return = returnFiber), + (returnFiber = currentFirstChild)), + placeSingleChild(returnFiber) + ); + if (isArray(newChild)) + return reconcileChildrenArray( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + if (getIteratorFn(newChild)) + return reconcileChildrenIterator( + returnFiber, + currentFirstChild, + newChild, + expirationTime + ); + isObject && throwOnInvalidObjectType(returnFiber, newChild); + if ("undefined" === typeof newChild && !isUnkeyedTopLevelFragment) + switch (returnFiber.tag) { + case 1: + case 0: + throw ((returnFiber = returnFiber.type), + ReactError( + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) + )); + } + return deleteRemainingChildren(returnFiber, currentFirstChild); + }; +} +var reconcileChildFibers = ChildReconciler(!0), + mountChildFibers = ChildReconciler(!1), + NO_CONTEXT = {}, + contextStackCursor$1 = { current: NO_CONTEXT }, + contextFiberStackCursor = { current: NO_CONTEXT }, + rootInstanceStackCursor = { current: NO_CONTEXT }; +function requiredContext(c) { + if (c === NO_CONTEXT) + throw ReactError( + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) + ); + return c; +} +function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, NO_CONTEXT, fiber); + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, { isInAParentText: !1 }, fiber); +} +function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); +} +function pushHostContext(fiber) { + requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = fiber.type; + nextContext = + "AndroidTextInput" === nextContext || + "RCTMultilineTextInputView" === nextContext || + "RCTSinglelineTextInputView" === nextContext || + "RCTText" === nextContext || + "RCTVirtualText" === nextContext; + nextContext = + context.isInAParentText !== nextContext + ? { isInAParentText: nextContext } + : context; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor$1, nextContext, fiber)); +} +function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); +} +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} +var NoEffect$1 = 0, + UnmountSnapshot = 2, + UnmountMutation = 4, + MountMutation = 8, + UnmountLayout = 16, + MountLayout = 32, + MountPassive = 64, + UnmountPassive = 128, + ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, + renderExpirationTime$1 = 0, + currentlyRenderingFiber$1 = null, + currentHook = null, + nextCurrentHook = null, + firstWorkInProgressHook = null, + workInProgressHook = null, + nextWorkInProgressHook = null, + remainingExpirationTime = 0, + componentUpdateQueue = null, + sideEffectTag = 0, + didScheduleRenderPhaseUpdate = !1, + renderPhaseUpdates = null, + numberOfReRenders = 0; +function throwInvalidHookError() { + throw ReactError( + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) + ); +} +function areHookInputsEqual(nextDeps, prevDeps) { + if (null === prevDeps) return !1; + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) + if (!is(nextDeps[i], prevDeps[i])) return !1; + return !0; +} +function renderWithHooks( + current, + workInProgress, + Component, + props, + refOrContext, + nextRenderExpirationTime +) { + renderExpirationTime$1 = nextRenderExpirationTime; + currentlyRenderingFiber$1 = workInProgress; + nextCurrentHook = null !== current ? current.memoizedState : null; + ReactCurrentDispatcher$1.current = + null === nextCurrentHook ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; + workInProgress = Component(props, refOrContext); + if (didScheduleRenderPhaseUpdate) { + do + (didScheduleRenderPhaseUpdate = !1), + (numberOfReRenders += 1), + (nextCurrentHook = null !== current ? current.memoizedState : null), + (nextWorkInProgressHook = firstWorkInProgressHook), + (componentUpdateQueue = workInProgressHook = currentHook = null), + (ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate), + (workInProgress = Component(props, refOrContext)); + while (didScheduleRenderPhaseUpdate); + renderPhaseUpdates = null; + numberOfReRenders = 0; + } + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + current = currentlyRenderingFiber$1; + current.memoizedState = firstWorkInProgressHook; + current.expirationTime = remainingExpirationTime; + current.updateQueue = componentUpdateQueue; + current.effectTag |= sideEffectTag; + current = null !== currentHook && null !== currentHook.next; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + if (current) + throw ReactError( + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) + ); + return workInProgress; +} +function resetHooks() { + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + renderExpirationTime$1 = 0; + nextWorkInProgressHook = workInProgressHook = firstWorkInProgressHook = nextCurrentHook = currentHook = currentlyRenderingFiber$1 = null; + remainingExpirationTime = 0; + componentUpdateQueue = null; + sideEffectTag = 0; + didScheduleRenderPhaseUpdate = !1; + renderPhaseUpdates = null; + numberOfReRenders = 0; +} +function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + queue: null, + baseUpdate: null, + next: null + }; + null === workInProgressHook + ? (firstWorkInProgressHook = workInProgressHook = hook) + : (workInProgressHook = workInProgressHook.next = hook); + return workInProgressHook; +} +function updateWorkInProgressHook() { + if (null !== nextWorkInProgressHook) + (workInProgressHook = nextWorkInProgressHook), + (nextWorkInProgressHook = workInProgressHook.next), + (currentHook = nextCurrentHook), + (nextCurrentHook = null !== currentHook ? currentHook.next : null); + else { + if (null === nextCurrentHook) + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); + currentHook = nextCurrentHook; + var newHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + queue: currentHook.queue, + baseUpdate: currentHook.baseUpdate, + next: null + }; + workInProgressHook = + null === workInProgressHook + ? (firstWorkInProgressHook = newHook) + : (workInProgressHook.next = newHook); + nextCurrentHook = currentHook.next; + } + return workInProgressHook; +} +function basicStateReducer(state, action) { + return "function" === typeof action ? action(state) : action; +} +function updateReducer(reducer) { + var hook = updateWorkInProgressHook(), + queue = hook.queue; + if (null === queue) + throw ReactError( + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) + ); + queue.lastRenderedReducer = reducer; + if (0 < numberOfReRenders) { + var _dispatch = queue.dispatch; + if (null !== renderPhaseUpdates) { + var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); + if (void 0 !== firstRenderPhaseUpdate) { + renderPhaseUpdates.delete(queue); + var newState = hook.memoizedState; + do + (newState = reducer(newState, firstRenderPhaseUpdate.action)), + (firstRenderPhaseUpdate = firstRenderPhaseUpdate.next); + while (null !== firstRenderPhaseUpdate); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate === queue.last && (hook.baseState = newState); + queue.lastRenderedState = newState; + return [newState, _dispatch]; + } + } + return [hook.memoizedState, _dispatch]; + } + _dispatch = queue.last; + var baseUpdate = hook.baseUpdate; + newState = hook.baseState; + null !== baseUpdate + ? (null !== _dispatch && (_dispatch.next = null), + (_dispatch = baseUpdate.next)) + : (_dispatch = null !== _dispatch ? _dispatch.next : null); + if (null !== _dispatch) { + var newBaseUpdate = (firstRenderPhaseUpdate = null), + _update = _dispatch, + didSkip = !1; + do { + var updateExpirationTime = _update.expirationTime; + updateExpirationTime < renderExpirationTime$1 + ? (didSkip || + ((didSkip = !0), + (newBaseUpdate = baseUpdate), + (firstRenderPhaseUpdate = newState)), + updateExpirationTime > remainingExpirationTime && + (remainingExpirationTime = updateExpirationTime)) + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), + (newState = + _update.eagerReducer === reducer + ? _update.eagerState + : reducer(newState, _update.action))); + baseUpdate = _update; + _update = _update.next; + } while (null !== _update && _update !== _dispatch); + didSkip || + ((newBaseUpdate = baseUpdate), (firstRenderPhaseUpdate = newState)); + is(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + hook.baseUpdate = newBaseUpdate; + hook.baseState = firstRenderPhaseUpdate; + queue.lastRenderedState = newState; + } + return [hook.memoizedState, queue.dispatch]; +} +function pushEffect(tag, create, destroy, deps) { + tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null }; + null === componentUpdateQueue + ? ((componentUpdateQueue = { lastEffect: null }), + (componentUpdateQueue.lastEffect = tag.next = tag)) + : ((create = componentUpdateQueue.lastEffect), + null === create + ? (componentUpdateQueue.lastEffect = tag.next = tag) + : ((destroy = create.next), + (create.next = tag), + (tag.next = destroy), + (componentUpdateQueue.lastEffect = tag))); + return tag; +} +function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = mountWorkInProgressHook(); + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect( + hookEffectTag, + create, + void 0, + void 0 === deps ? null : deps + ); +} +function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var destroy = void 0; + if (null !== currentHook) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (null !== deps && areHookInputsEqual(deps, prevEffect.deps)) { + pushEffect(NoEffect$1, create, destroy, deps); + return; + } + } + sideEffectTag |= fiberEffectTag; + hook.memoizedState = pushEffect(hookEffectTag, create, destroy, deps); +} +function imperativeHandleEffect(create, ref) { + if ("function" === typeof ref) + return ( + (create = create()), + ref(create), + function() { + ref(null); + } + ); + if (null !== ref && void 0 !== ref) + return ( + (create = create()), + (ref.current = create), + function() { + ref.current = null; + } + ); +} +function mountDebugValue() {} +function dispatchAction(fiber, queue, action) { + if (!(25 > numberOfReRenders)) + throw ReactError( + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) + ); + var alternate = fiber.alternate; + if ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ) + if ( + ((didScheduleRenderPhaseUpdate = !0), + (fiber = { + expirationTime: renderExpirationTime$1, + suspenseConfig: null, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }), + null === renderPhaseUpdates && (renderPhaseUpdates = new Map()), + (action = renderPhaseUpdates.get(queue)), + void 0 === action) + ) + renderPhaseUpdates.set(queue, fiber); + else { + for (queue = action; null !== queue.next; ) queue = queue.next; + queue.next = fiber; + } + else { + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; + else { + var first = _last.next; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; + } + queue.last = _suspenseConfig; + if ( + 0 === fiber.expirationTime && + (null === alternate || 0 === alternate.expirationTime) && + ((alternate = queue.lastRenderedReducer), null !== alternate) + ) + try { + var currentState = queue.lastRenderedState, + _eagerState = alternate(currentState, action); + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; + if (is(_eagerState, currentState)) return; + } catch (error) { + } finally { + } + scheduleUpdateOnFiber(fiber, currentTime); + } +} +var ContextOnlyDispatcher = { + readContext: readContext, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError + }, + HooksDispatcherOnMount = { + readContext: readContext, + useCallback: function(callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return mountEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return mountEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return mountEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + reducer = reducer.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function(initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function(initialState) { + var hook = mountWorkInProgressHook(); + "function" === typeof initialState && (initialState = initialState()); + hook.memoizedState = hook.baseState = initialState; + initialState = hook.queue = { + last: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + initialState = initialState.dispatch = dispatchAction.bind( + null, + currentlyRenderingFiber$1, + initialState + ); + return [hook.memoizedState, initialState]; + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + HooksDispatcherOnUpdate = { + readContext: readContext, + useCallback: function(callback, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + hook.memoizedState = [callback, deps]; + return callback; + }, + useContext: readContext, + useEffect: function(create, deps) { + return updateEffectImpl(516, UnmountPassive | MountPassive, create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + return updateEffectImpl( + 4, + UnmountMutation | MountLayout, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function(create, deps) { + return updateEffectImpl(4, UnmountMutation | MountLayout, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if ( + null !== prevState && + null !== deps && + areHookInputsEqual(deps, prevState[1]) + ) + return prevState[0]; + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: updateReducer, + useRef: function() { + return updateWorkInProgressHook().memoizedState; + }, + useState: function(initialState) { + return updateReducer(basicStateReducer, initialState); + }, + useDebugValue: mountDebugValue, + useResponder: createResponderListener + }, + now$1 = Scheduler.unstable_now, + commitTime = 0, + profilerStartTime = -1; +function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { + if (0 <= profilerStartTime) { + var elapsedTime = now$1() - profilerStartTime; + fiber.actualDuration += elapsedTime; + overrideBaseTime && (fiber.selfBaseDuration = elapsedTime); + profilerStartTime = -1; + } +} +var hydrationParentFiber = null, + nextHydratableInstance = null, + isHydrating = !1; +function tryHydrate(fiber, nextInstance) { + switch (fiber.tag) { + case 5: + return ( + (nextInstance = shim$1(nextInstance, fiber.type, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 6: + return ( + (nextInstance = shim$1(nextInstance, fiber.pendingProps)), + null !== nextInstance ? ((fiber.stateNode = nextInstance), !0) : !1 + ); + case 13: + return !1; + default: + return !1; + } +} +function tryToClaimNextHydratableInstance(fiber$jscomp$0) { + if (isHydrating) { + var nextInstance = nextHydratableInstance; + if (nextInstance) { + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber$jscomp$0, nextInstance)) { + nextInstance = shim$1(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber$jscomp$0, nextInstance)) { + fiber$jscomp$0.effectTag |= 2; + isHydrating = !1; + hydrationParentFiber = fiber$jscomp$0; + return; + } + var returnFiber = hydrationParentFiber, + fiber = createFiber(5, null, null, 0); + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + fiber.stateNode = firstAttemptedInstance; + fiber.return = returnFiber; + fiber.effectTag = 8; + null !== returnFiber.lastEffect + ? ((returnFiber.lastEffect.nextEffect = fiber), + (returnFiber.lastEffect = fiber)) + : (returnFiber.firstEffect = returnFiber.lastEffect = fiber); + } + hydrationParentFiber = fiber$jscomp$0; + nextHydratableInstance = shim$1(nextInstance); + } else + (fiber$jscomp$0.effectTag |= 2), + (isHydrating = !1), + (hydrationParentFiber = fiber$jscomp$0); + } +} +var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner, + didReceiveUpdate = !1; +function reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime +) { + workInProgress.child = + null === current$$1 + ? mountChildFibers( + workInProgress, + null, + nextChildren, + renderExpirationTime + ) + : reconcileChildFibers( + workInProgress, + current$$1.child, + nextChildren, + renderExpirationTime + ); +} +function updateForwardRef( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + Component = Component.render; + var ref = workInProgress.ref; + prepareToReadContext(workInProgress, renderExpirationTime); + nextProps = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + ref, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + nextProps, + renderExpirationTime + ); + return workInProgress.child; +} +function updateMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + if (null === current$$1) { + var type = Component.type; + if ( + "function" === typeof type && + !shouldConstruct(type) && + void 0 === type.defaultProps && + null === Component.compare && + void 0 === Component.defaultProps + ) + return ( + (workInProgress.tag = 15), + (workInProgress.type = type), + updateSimpleMemoComponent( + current$$1, + workInProgress, + type, + nextProps, + updateExpirationTime, + renderExpirationTime + ) + ); + current$$1 = createFiberFromTypeAndProps( + Component.type, + null, + nextProps, + null, + workInProgress.mode, + renderExpirationTime + ); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); + } + type = current$$1.child; + if ( + updateExpirationTime < renderExpirationTime && + ((updateExpirationTime = type.memoizedProps), + (Component = Component.compare), + (Component = null !== Component ? Component : shallowEqual), + Component(updateExpirationTime, nextProps) && + current$$1.ref === workInProgress.ref) + ) + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + current$$1 = createWorkInProgress(type, nextProps, renderExpirationTime); + current$$1.ref = workInProgress.ref; + current$$1.return = workInProgress; + return (workInProgress.child = current$$1); +} +function updateSimpleMemoComponent( + current$$1, + workInProgress, + Component, + nextProps, + updateExpirationTime, + renderExpirationTime +) { + return null !== current$$1 && + shallowEqual(current$$1.memoizedProps, nextProps) && + current$$1.ref === workInProgress.ref && + ((didReceiveUpdate = !1), updateExpirationTime < renderExpirationTime) + ? bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + : updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime + ); +} +function markRef(current$$1, workInProgress) { + var ref = workInProgress.ref; + if ( + (null === current$$1 && null !== ref) || + (null !== current$$1 && current$$1.ref !== ref) + ) + workInProgress.effectTag |= 128; +} +function updateFunctionComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor.current; + context = getMaskedContext(workInProgress, context); + prepareToReadContext(workInProgress, renderExpirationTime); + Component = renderWithHooks( + current$$1, + workInProgress, + Component, + nextProps, + context, + renderExpirationTime + ); + if (null !== current$$1 && !didReceiveUpdate) + return ( + (workInProgress.updateQueue = current$$1.updateQueue), + (workInProgress.effectTag &= -517), + current$$1.expirationTime <= renderExpirationTime && + (current$$1.expirationTime = 0), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + workInProgress.effectTag |= 1; + reconcileChildren( + current$$1, + workInProgress, + Component, + renderExpirationTime + ); + return workInProgress.child; +} +function updateClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + renderExpirationTime +) { + if (isContextProvider(Component)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + prepareToReadContext(workInProgress, renderExpirationTime); + if (null === workInProgress.stateNode) + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + constructClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + Component, + nextProps, + renderExpirationTime + ), + (nextProps = !0); + else if (null === current$$1) { + var instance = workInProgress.stateNode, + oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + var oldContext = instance.context, + contextType = Component.contextType; + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))); + var getDerivedStateFromProps = Component.getDerivedStateFromProps, + hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate; + hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )); + hasForceUpdate = !1; + var oldState = workInProgress.memoizedState; + oldContext = instance.state = oldState; + var updateQueue = workInProgress.updateQueue; + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldContext = workInProgress.memoizedState)); + oldProps !== nextProps || + oldState !== oldContext || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldContext = workInProgress.memoizedState)), + (oldProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldState, + oldContext, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillMount && + "function" !== typeof instance.componentWillMount) || + ("function" === typeof instance.componentWillMount && + instance.componentWillMount(), + "function" === typeof instance.UNSAFE_componentWillMount && + instance.UNSAFE_componentWillMount()), + "function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldContext)), + (instance.props = nextProps), + (instance.state = oldContext), + (instance.context = contextType), + (nextProps = oldProps)) + : ("function" === typeof instance.componentDidMount && + (workInProgress.effectTag |= 4), + (nextProps = !1)); + } else + (instance = workInProgress.stateNode), + (oldProps = workInProgress.memoizedProps), + (instance.props = + workInProgress.type === workInProgress.elementType + ? oldProps + : resolveDefaultProps(workInProgress.type, oldProps)), + (oldContext = instance.context), + (contextType = Component.contextType), + "object" === typeof contextType && null !== contextType + ? (contextType = readContext(contextType)) + : ((contextType = isContextProvider(Component) + ? previousContext + : contextStackCursor.current), + (contextType = getMaskedContext(workInProgress, contextType))), + (getDerivedStateFromProps = Component.getDerivedStateFromProps), + (hasNewLifecycles = + "function" === typeof getDerivedStateFromProps || + "function" === typeof instance.getSnapshotBeforeUpdate) || + ("function" !== typeof instance.UNSAFE_componentWillReceiveProps && + "function" !== typeof instance.componentWillReceiveProps) || + ((oldProps !== nextProps || oldContext !== contextType) && + callComponentWillReceiveProps( + workInProgress, + instance, + nextProps, + contextType + )), + (hasForceUpdate = !1), + (oldContext = workInProgress.memoizedState), + (oldState = instance.state = oldContext), + (updateQueue = workInProgress.updateQueue), + null !== updateQueue && + (processUpdateQueue( + workInProgress, + updateQueue, + nextProps, + instance, + renderExpirationTime + ), + (oldState = workInProgress.memoizedState)), + oldProps !== nextProps || + oldContext !== oldState || + didPerformWorkStackCursor.current || + hasForceUpdate + ? ("function" === typeof getDerivedStateFromProps && + (applyDerivedStateFromProps( + workInProgress, + Component, + getDerivedStateFromProps, + nextProps + ), + (oldState = workInProgress.memoizedState)), + (getDerivedStateFromProps = + hasForceUpdate || + checkShouldComponentUpdate( + workInProgress, + Component, + oldProps, + nextProps, + oldContext, + oldState, + contextType + )) + ? (hasNewLifecycles || + ("function" !== typeof instance.UNSAFE_componentWillUpdate && + "function" !== typeof instance.componentWillUpdate) || + ("function" === typeof instance.componentWillUpdate && + instance.componentWillUpdate( + nextProps, + oldState, + contextType + ), + "function" === typeof instance.UNSAFE_componentWillUpdate && + instance.UNSAFE_componentWillUpdate( + nextProps, + oldState, + contextType + )), + "function" === typeof instance.componentDidUpdate && + (workInProgress.effectTag |= 4), + "function" === typeof instance.getSnapshotBeforeUpdate && + (workInProgress.effectTag |= 256)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (workInProgress.memoizedProps = nextProps), + (workInProgress.memoizedState = oldState)), + (instance.props = nextProps), + (instance.state = oldState), + (instance.context = contextType), + (nextProps = getDerivedStateFromProps)) + : ("function" !== typeof instance.componentDidUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 4), + "function" !== typeof instance.getSnapshotBeforeUpdate || + (oldProps === current$$1.memoizedProps && + oldContext === current$$1.memoizedState) || + (workInProgress.effectTag |= 256), + (nextProps = !1)); + return finishClassComponent( + current$$1, + workInProgress, + Component, + nextProps, + hasContext, + renderExpirationTime + ); +} +function finishClassComponent( + current$$1, + workInProgress, + Component, + shouldUpdate, + hasContext, + renderExpirationTime +) { + markRef(current$$1, workInProgress); + var didCaptureError = 0 !== (workInProgress.effectTag & 64); + if (!shouldUpdate && !didCaptureError) + return ( + hasContext && invalidateContextProvider(workInProgress, Component, !1), + bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ) + ); + shouldUpdate = workInProgress.stateNode; + ReactCurrentOwner$3.current = workInProgress; + if ( + didCaptureError && + "function" !== typeof Component.getDerivedStateFromError + ) { + var nextChildren = null; + profilerStartTime = -1; + } else nextChildren = shouldUpdate.render(); + workInProgress.effectTag |= 1; + null !== current$$1 && didCaptureError + ? ((didCaptureError = nextChildren), + (workInProgress.child = reconcileChildFibers( + workInProgress, + current$$1.child, + null, + renderExpirationTime + )), + (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + didCaptureError, + renderExpirationTime + ))) + : reconcileChildren( + current$$1, + workInProgress, + nextChildren, + renderExpirationTime + ); + workInProgress.memoizedState = shouldUpdate.state; + hasContext && invalidateContextProvider(workInProgress, Component, !0); + return workInProgress.child; +} +function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + root.pendingContext + ? pushTopLevelContextObject( + workInProgress, + root.pendingContext, + root.pendingContext !== root.context + ) + : root.context && + pushTopLevelContextObject(workInProgress, root.context, !1); + pushHostContainer(workInProgress, root.containerInfo); +} +var SUSPENDED_MARKER = {}; +function updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var mode = workInProgress.mode, + nextProps = workInProgress.pendingProps, + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), + (nextDidTimeout = !0), + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); + if (null === current$$1) + if (nextDidTimeout) { + nextProps = nextProps.fallback; + current$$1 = createFiberFromFragment(null, mode, 0, null); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); + renderExpirationTime = createFiberFromFragment( + nextProps, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + current$$1.sibling = renderExpirationTime; + mode = current$$1; + } else + mode = renderExpirationTime = mountChildFibers( + workInProgress, + null, + nextProps.children, + renderExpirationTime + ); + else { + if (null !== current$$1.memoizedState) + if ( + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), + nextDidTimeout) + ) { + nextProps = nextProps.fallback; + renderExpirationTime = createWorkInProgress( + suspenseContext, + suspenseContext.pendingProps, + 0 + ); + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && + ((nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child), + nextDidTimeout !== suspenseContext.child) + ) + for ( + renderExpirationTime.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = renderExpirationTime), + (nextDidTimeout = nextDidTimeout.sibling); + if (workInProgress.mode & 8) { + nextDidTimeout = 0; + for ( + suspenseContext = renderExpirationTime.child; + null !== suspenseContext; + + ) + (nextDidTimeout += suspenseContext.treeBaseDuration), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime.treeBaseDuration = nextDidTimeout; + } + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; + mode = renderExpirationTime; + renderExpirationTime.childExpirationTime = 0; + renderExpirationTime = nextProps; + } else + mode = renderExpirationTime = reconcileChildFibers( + workInProgress, + suspenseContext.child, + nextProps.children, + renderExpirationTime + ); + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + if (workInProgress.mode & 8) { + suspenseContext = 0; + for (JSCompiler_temp = nextProps.child; null !== JSCompiler_temp; ) + (suspenseContext += JSCompiler_temp.treeBaseDuration), + (JSCompiler_temp = JSCompiler_temp.sibling); + nextProps.treeBaseDuration = suspenseContext; + } + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } + workInProgress.memoizedState = nextState; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress + ) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, + renderExpirationTime, + tailMode + ); + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( + workInProgress, + !0, + renderExpirationTime, + null, + tailMode + ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; + } + return workInProgress.child; +} +function bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime +) { + null !== current$$1 && + (workInProgress.dependencies = current$$1.dependencies); + profilerStartTime = -1; + if (workInProgress.childExpirationTime < renderExpirationTime) return null; + if (null !== current$$1 && workInProgress.child !== current$$1.child) + throw ReactError(Error("Resuming work not yet implemented.")); + if (null !== workInProgress.child) { + current$$1 = workInProgress.child; + renderExpirationTime = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + ); + workInProgress.child = renderExpirationTime; + for ( + renderExpirationTime.return = workInProgress; + null !== current$$1.sibling; + + ) + (current$$1 = current$$1.sibling), + (renderExpirationTime = renderExpirationTime.sibling = createWorkInProgress( + current$$1, + current$$1.pendingProps, + current$$1.expirationTime + )), + (renderExpirationTime.return = workInProgress); + renderExpirationTime.sibling = null; + } + return workInProgress.child; +} +var appendAllChildren = void 0, + updateHostContainer = void 0, + updateHostComponent$1 = void 0, + updateHostText$1 = void 0; +appendAllChildren = function(parent, workInProgress) { + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag || 6 === node.tag) parent._children.push(node.stateNode); + else if (4 !== node.tag && null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +}; +updateHostContainer = function() {}; +updateHostComponent$1 = function(current, workInProgress, type, newProps) { + current.memoizedProps !== newProps && + (requiredContext(contextStackCursor$1.current), + (workInProgress.updateQueue = UPDATE_SIGNAL)) && + (workInProgress.effectTag |= 4); +}; +updateHostText$1 = function(current, workInProgress, oldText, newText) { + oldText !== newText && (workInProgress.effectTag |= 4); +}; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} +function completeWork(current, workInProgress, renderExpirationTime) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + break; + case 16: + break; + case 15: + case 0: + break; + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + break; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + newProps = workInProgress.stateNode; + newProps.pendingContext && + ((newProps.context = newProps.pendingContext), + (newProps.pendingContext = null)); + if (null === current || null === current.child) + workInProgress.effectTag &= -3; + updateHostContainer(workInProgress); + break; + case 5: + popHostContext(workInProgress); + var rootContainerInstance = requiredContext( + rootInstanceStackCursor.current + ); + renderExpirationTime = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + updateHostComponent$1( + current, + workInProgress, + renderExpirationTime, + newProps, + rootContainerInstance + ), + current.ref !== workInProgress.ref && + (workInProgress.effectTag |= 128); + else if (newProps) { + current = requiredContext(contextStackCursor$1.current); + var tag = allocateTag(), + viewConfig = getViewConfigForType(renderExpirationTime), + updatePayload = diffProperties( + null, + emptyObject, + newProps, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.createView( + tag, + viewConfig.uiViewClassName, + rootContainerInstance, + updatePayload + ); + viewConfig = new ReactNativeFiberHostComponent(tag, viewConfig); + instanceCache.set(tag, workInProgress); + instanceProps.set(tag, newProps); + appendAllChildren(viewConfig, workInProgress, !1, !1); + finalizeInitialChildren( + viewConfig, + renderExpirationTime, + newProps, + rootContainerInstance, + current + ) && (workInProgress.effectTag |= 4); + workInProgress.stateNode = viewConfig; + null !== workInProgress.ref && (workInProgress.effectTag |= 128); + } else if (null === workInProgress.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + break; + case 6: + if (current && null != workInProgress.stateNode) + updateHostText$1( + current, + workInProgress, + current.memoizedProps, + newProps + ); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw ReactError( + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) + ); + current = requiredContext(rootInstanceStackCursor.current); + if (!requiredContext(contextStackCursor$1.current).isInAParentText) + throw ReactError( + Error("Text strings must be rendered within a component.") + ); + rootContainerInstance = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + rootContainerInstance, + "RCTRawText", + current, + { text: newProps } + ); + instanceCache.set(rootContainerInstance, workInProgress); + workInProgress.stateNode = rootContainerInstance; + } + break; + case 11: + break; + case 13: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (0 !== (workInProgress.effectTag & 64)) + return ( + (workInProgress.expirationTime = renderExpirationTime), workInProgress + ); + newProps = null !== newProps; + rootContainerInstance = !1; + null !== current && + ((renderExpirationTime = current.memoizedState), + (rootContainerInstance = null !== renderExpirationTime), + newProps || + null === renderExpirationTime || + ((renderExpirationTime = current.child.sibling), + null !== renderExpirationTime && + ((tag = workInProgress.firstEffect), + null !== tag + ? ((workInProgress.firstEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = tag)) + : ((workInProgress.firstEffect = workInProgress.lastEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = null)), + (renderExpirationTime.effectTag = 8)))); + if (newProps && !rootContainerInstance && 0 !== (workInProgress.mode & 2)) + if ( + (null === current && + !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || + 0 !== (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + if (newProps || rootContainerInstance) workInProgress.effectTag |= 4; + break; + case 7: + break; + case 8: + break; + case 12: + break; + case 4: + popHostContainer(workInProgress); + updateHostContainer(workInProgress); + break; + case 10: + popProvider(workInProgress); + break; + case 9: + break; + case 14: + break; + case 17: + isContextProvider(workInProgress.type) && popContext(workInProgress); + break; + case 18: + break; + case 19: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (null === newProps) break; + rootContainerInstance = 0 !== (workInProgress.effectTag & 64); + tag = newProps.rendering; + if (null === tag) + if (rootContainerInstance) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = workInProgress.child; null !== current; ) { + tag = findFirstSuspended(current); + if (null !== tag) { + workInProgress.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = tag.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress.firstEffect = workInProgress.lastEffect = null; + current = renderExpirationTime; + for (newProps = workInProgress.child; null !== newProps; ) + (rootContainerInstance = newProps), + (tag = current), + (rootContainerInstance.effectTag &= 2), + (rootContainerInstance.nextEffect = null), + (rootContainerInstance.firstEffect = null), + (rootContainerInstance.lastEffect = null), + (renderExpirationTime = rootContainerInstance.alternate), + null === renderExpirationTime + ? ((rootContainerInstance.childExpirationTime = 0), + (rootContainerInstance.expirationTime = tag), + (rootContainerInstance.child = null), + (rootContainerInstance.memoizedProps = null), + (rootContainerInstance.memoizedState = null), + (rootContainerInstance.updateQueue = null), + (rootContainerInstance.dependencies = null), + (rootContainerInstance.selfBaseDuration = 0), + (rootContainerInstance.treeBaseDuration = 0)) + : ((rootContainerInstance.childExpirationTime = + renderExpirationTime.childExpirationTime), + (rootContainerInstance.expirationTime = + renderExpirationTime.expirationTime), + (rootContainerInstance.child = + renderExpirationTime.child), + (rootContainerInstance.memoizedProps = + renderExpirationTime.memoizedProps), + (rootContainerInstance.memoizedState = + renderExpirationTime.memoizedState), + (rootContainerInstance.updateQueue = + renderExpirationTime.updateQueue), + (tag = renderExpirationTime.dependencies), + (rootContainerInstance.dependencies = + null === tag + ? null + : { + expirationTime: tag.expirationTime, + firstContext: tag.firstContext, + responders: tag.responders + }), + (rootContainerInstance.selfBaseDuration = + renderExpirationTime.selfBaseDuration), + (rootContainerInstance.treeBaseDuration = + renderExpirationTime.treeBaseDuration)), + (newProps = newProps.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + workInProgress + ); + return workInProgress.child; + } + current = current.sibling; + } + } + else { + if (!rootContainerInstance) + if (((current = findFirstSuspended(tag)), null !== current)) { + if ( + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress = workInProgress.lastEffect = newProps.lastEffect; + null !== workInProgress && (workInProgress.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime && + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !1), + (current = renderExpirationTime - 1), + (workInProgress.expirationTime = workInProgress.childExpirationTime = current), + null === spawnedWorkDuringRender + ? (spawnedWorkDuringRender = [current]) + : spawnedWorkDuringRender.push(current)); + newProps.isBackwards + ? ((tag.sibling = workInProgress.child), (workInProgress.child = tag)) + : ((current = newProps.last), + null !== current + ? (current.sibling = tag) + : (workInProgress.child = tag), + (newProps.last = tag)); + } + if (null !== newProps.tail) + return ( + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500), + (current = newProps.tail), + (newProps.rendering = current), + (newProps.tail = current.sibling), + (newProps.lastEffect = workInProgress.lastEffect), + (current.sibling = null), + (newProps = suspenseStackCursor.current), + (newProps = rootContainerInstance + ? (newProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask), + push(suspenseStackCursor, newProps, workInProgress), + current + ); + break; + case 20: + break; + default: + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + return null; +} +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} +function createCapturedValue(value, source) { + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; +} +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); +function logCapturedError(capturedError) { + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); +} +var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; +function logError(boundary, errorInfo) { + var source = errorInfo.source, + stack = errorInfo.stack; + null === stack && + null !== source && + (stack = getStackByFiberInDevAndProd(source)); + errorInfo = { + componentName: null !== source ? getComponentName(source.type) : null, + componentStack: null !== stack ? stack : "", + error: errorInfo.value, + errorBoundary: null, + errorBoundaryName: null, + errorBoundaryFound: !1, + willRetry: !1 + }; + null !== boundary && + 1 === boundary.tag && + ((errorInfo.errorBoundary = boundary.stateNode), + (errorInfo.errorBoundaryName = getComponentName(boundary.type)), + (errorInfo.errorBoundaryFound = !0), + (errorInfo.willRetry = !0)); + try { + logCapturedError(errorInfo); + } catch (e) { + setTimeout(function() { + throw e; + }); + } +} +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} +function safelyDetachRef(current$$1) { + var ref = current$$1.ref; + if (null !== ref) + if ("function" === typeof ref) + try { + ref(null); + } catch (refError) { + captureCommitPhaseError(current$$1, refError); + } + else ref.current = null; +} +function commitHookEffectList(unmountTag, mountTag, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & unmountTag) !== NoEffect$1) { + var destroy = effect.destroy; + effect.destroy = void 0; + void 0 !== destroy && destroy(); + } + (effect.tag & mountTag) !== NoEffect$1 && + ((destroy = effect.create), (effect.destroy = destroy())); + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { + "function" === typeof onCommitFiberUnmount && + onCommitFiberUnmount(current$$1$jscomp$0); + switch (current$$1$jscomp$0.tag) { + case 0: + case 11: + case 14: + case 15: + var updateQueue = current$$1$jscomp$0.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var firstEffect = updateQueue.next; + runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); + } + ); + } + break; + case 1: + safelyDetachRef(current$$1$jscomp$0); + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); + break; + case 5: + safelyDetachRef(current$$1$jscomp$0); + break; + case 4: + unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); + } +} +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; +} +function commitPlacement(finishedWork) { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var parentFiber = parent; + break a; + } + parent = parent.return; + } + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + parent = parentFiber.stateNode; + switch (parentFiber.tag) { + case 5: + var isContainer = !1; + break; + case 3: + parent = parent.containerInfo; + isContainer = !0; + break; + case 4: + parent = parent.containerInfo; + isContainer = !0; + break; + default: + throw ReactError( + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + parentFiber.effectTag & 16 && (parentFiber.effectTag &= -17); + a: b: for (parentFiber = finishedWork; ; ) { + for (; null === parentFiber.sibling; ) { + if (null === parentFiber.return || isHostParent(parentFiber.return)) { + parentFiber = null; + break a; + } + parentFiber = parentFiber.return; + } + parentFiber.sibling.return = parentFiber.return; + for ( + parentFiber = parentFiber.sibling; + 5 !== parentFiber.tag && 6 !== parentFiber.tag && 18 !== parentFiber.tag; + + ) { + if (parentFiber.effectTag & 2) continue b; + if (null === parentFiber.child || 4 === parentFiber.tag) continue b; + else + (parentFiber.child.return = parentFiber), + (parentFiber = parentFiber.child); + } + if (!(parentFiber.effectTag & 2)) { + parentFiber = parentFiber.stateNode; + break a; + } + } + for (var node = finishedWork; ; ) { + var isHost = 5 === node.tag || 6 === node.tag; + if (isHost) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (parentFiber) + if (isContainer) { + if ("number" === typeof parent) + throw ReactError( + Error("Container does not support insertBefore operation") + ); + } else { + isHost = parent; + var beforeChild = parentFiber, + children = isHost._children, + index = children.indexOf(stateNode); + 0 <= index + ? (children.splice(index, 1), + (beforeChild = children.indexOf(beforeChild)), + children.splice(beforeChild, 0, stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [index], + [beforeChild], + [], + [], + [] + )) + : ((index = children.indexOf(beforeChild)), + children.splice(index, 0, stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [], + [], + [ + "number" === typeof stateNode + ? stateNode + : stateNode._nativeTag + ], + [index], + [] + )); + } + else + isContainer + ? ReactNativePrivateInterface.UIManager.setChildren(parent, [ + "number" === typeof stateNode ? stateNode : stateNode._nativeTag + ]) + : ((isHost = parent), + (children = + "number" === typeof stateNode ? stateNode : stateNode._nativeTag), + (index = isHost._children), + (beforeChild = index.indexOf(stateNode)), + 0 <= beforeChild + ? (index.splice(beforeChild, 1), + index.push(stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [beforeChild], + [index.length - 1], + [], + [], + [] + )) + : (index.push(stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, + [], + [], + [children], + [index.length - 1], + [] + ))); + } else if (4 !== node.tag && null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } +} +function unmountHostComponents(current$$1, renderPriorityLevel$jscomp$0) { + for ( + var node = current$$1, + currentParentIsValid = !1, + currentParent = void 0, + currentParentIsContainer = void 0; + ; + + ) { + if (!currentParentIsValid) { + currentParentIsValid = node.return; + a: for (;;) { + if (null === currentParentIsValid) + throw ReactError( + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + currentParent = currentParentIsValid.stateNode; + switch (currentParentIsValid.tag) { + case 5: + currentParentIsContainer = !1; + break a; + case 3: + currentParent = currentParent.containerInfo; + currentParentIsContainer = !0; + break a; + case 4: + currentParent = currentParent.containerInfo; + currentParentIsContainer = !0; + break a; + } + currentParentIsValid = currentParentIsValid.return; + } + currentParentIsValid = !0; + } + if (5 === node.tag || 6 === node.tag) { + a: for ( + var root = node, + renderPriorityLevel = renderPriorityLevel$jscomp$0, + node$jscomp$0 = root; + ; + + ) + if ( + (commitUnmount(node$jscomp$0, renderPriorityLevel), + null !== node$jscomp$0.child && 4 !== node$jscomp$0.tag) + ) + (node$jscomp$0.child.return = node$jscomp$0), + (node$jscomp$0 = node$jscomp$0.child); + else { + if (node$jscomp$0 === root) break; + for (; null === node$jscomp$0.sibling; ) { + if (null === node$jscomp$0.return || node$jscomp$0.return === root) + break a; + node$jscomp$0 = node$jscomp$0.return; + } + node$jscomp$0.sibling.return = node$jscomp$0.return; + node$jscomp$0 = node$jscomp$0.sibling; + } + currentParentIsContainer + ? ((root = currentParent), + recursivelyUncacheFiberNode(node.stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + root, + [], + [], + [], + [], + [0] + )) + : ((root = currentParent), + (node$jscomp$0 = node.stateNode), + recursivelyUncacheFiberNode(node$jscomp$0), + (renderPriorityLevel = root._children), + (node$jscomp$0 = renderPriorityLevel.indexOf(node$jscomp$0)), + renderPriorityLevel.splice(node$jscomp$0, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + root._nativeTag, + [], + [], + [], + [], + [node$jscomp$0] + )); + } else if (4 === node.tag) { + if (null !== node.child) { + currentParent = node.stateNode.containerInfo; + currentParentIsContainer = !0; + node.child.return = node; + node = node.child; + continue; + } + } else if ( + (commitUnmount(node, renderPriorityLevel$jscomp$0), null !== node.child) + ) { + node.child.return = node; + node = node.child; + continue; + } + if (node === current$$1) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === current$$1) return; + node = node.return; + 4 === node.tag && (currentParentIsValid = !1); + } + node.sibling.return = node.return; + node = node.sibling; + } +} +function commitWork(current$$1, finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + commitHookEffectList(UnmountMutation, MountMutation, finishedWork); + break; + case 1: + break; + case 5: + var instance = finishedWork.stateNode; + if (null != instance) { + var newProps = finishedWork.memoizedProps; + current$$1 = null !== current$$1 ? current$$1.memoizedProps : newProps; + var updatePayload = finishedWork.updateQueue; + finishedWork.updateQueue = null; + null !== updatePayload && + ((finishedWork = instance.viewConfig), + instanceProps.set(instance._nativeTag, newProps), + (newProps = diffProperties( + null, + current$$1, + newProps, + finishedWork.validAttributes + )), + null != newProps && + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + finishedWork.uiViewClassName, + newProps + )); + } + break; + case 6: + if (null === finishedWork.stateNode) + throw ReactError( + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) + ); + ReactNativePrivateInterface.UIManager.updateView( + finishedWork.stateNode, + "RCTRawText", + { text: finishedWork.memoizedProps } + ); + break; + case 3: + break; + case 12: + break; + case 13: + instance = finishedWork; + null === finishedWork.memoizedState + ? (newProps = !1) + : ((newProps = !0), + (instance = finishedWork.child), + (globalMostRecentFallbackTime = now())); + if (null !== instance) + a: for (current$$1 = instance; ; ) { + if (5 === current$$1.tag) + if (((updatePayload = current$$1.stateNode), newProps)) { + var viewConfig = updatePayload.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + updatePayload = current$$1.stateNode; + updatePayload$jscomp$0 = current$$1.memoizedProps; + viewConfig = updatePayload.viewConfig; + var prevProps = Object.assign({}, updatePayload$jscomp$0, { + style: [updatePayload$jscomp$0.style, { display: "none" }] + }); + updatePayload$jscomp$0 = diffProperties( + null, + prevProps, + updatePayload$jscomp$0, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } + else { + if (6 === current$$1.tag) throw Error("Not yet implemented."); + if (13 === current$$1.tag && null !== current$$1.memoizedState) { + updatePayload = current$$1.child.sibling; + updatePayload.return = current$$1; + current$$1 = updatePayload; + continue; + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + } + if (current$$1 === instance) break a; + for (; null === current$$1.sibling; ) { + if (null === current$$1.return || current$$1.return === instance) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + attachSuspenseRetryListeners(finishedWork); + break; + case 19: + attachSuspenseRetryListeners(finishedWork); + break; + case 17: + break; + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } +} +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); + thenables.forEach(function(thenable) { + var retry = resolveRetryThenable.bind(null, finishedWork, thenable); + retryCache.has(thenable) || + ((retry = tracing.unstable_wrap(retry)), + retryCache.add(thenable), + thenable.then(retry, retry)); + }); + } +} +var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; +function createRootErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + expirationTime.payload = { element: null }; + var error = errorInfo.value; + expirationTime.callback = function() { + hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); + logError(fiber, errorInfo); + }; + return expirationTime; +} +function createClassErrorUpdate(fiber, errorInfo, expirationTime) { + expirationTime = createUpdate(expirationTime, null); + expirationTime.tag = 3; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if ("function" === typeof getDerivedStateFromError) { + var error = errorInfo.value; + expirationTime.payload = function() { + logError(fiber, errorInfo); + return getDerivedStateFromError(error); + }; + } + var inst = fiber.stateNode; + null !== inst && + "function" === typeof inst.componentDidCatch && + (expirationTime.callback = function() { + "function" !== typeof getDerivedStateFromError && + (null === legacyErrorBoundariesThatAlreadyFailed + ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { + componentStack: null !== stack ? stack : "" + }); + }); + return expirationTime; +} +var ceil = Math.ceil, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, + RootIncomplete = 0, + RootErrored = 1, + RootSuspended = 2, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, + workInProgressRoot = null, + workInProgress = null, + renderExpirationTime = 0, + workInProgressRootExitStatus = RootIncomplete, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, + nextEffect = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, + pendingPassiveEffectsExpirationTime = 0, + rootsWithPendingDiscreteUpdates = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null, + spawnedWorkDuringRender = null, + currentEventTime = 0; +function requestCurrentTime() { + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) + : 0 !== currentEventTime + ? currentEventTime + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } + null !== workInProgressRoot && + currentTime === renderExpirationTime && + --currentTime; + return currentTime; +} +function scheduleUpdateOnFiber(fiber, expirationTime) { + if (50 < nestedUpdateCount) + throw ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + ReactError( + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) + )); + fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + scheduleInteractions( + fiber, + expirationTime, + tracing.__interactionsRef.current + ); + for ( + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; + + ) + callback = callback(!0); + } else + scheduleCallbackForRoot(fiber, 99, 1073741823), + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } +} +function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { + fiber.expirationTime < expirationTime && + (fiber.expirationTime = expirationTime); + var alternate = fiber.alternate; + null !== alternate && + alternate.expirationTime < expirationTime && + (alternate.expirationTime = expirationTime); + var node = fiber.return, + root = null; + if (null === node && 3 === fiber.tag) root = fiber.stateNode; + else + for (; null !== node; ) { + alternate = node.alternate; + node.childExpirationTime < expirationTime && + (node.childExpirationTime = expirationTime); + null !== alternate && + alternate.childExpirationTime < expirationTime && + (alternate.childExpirationTime = expirationTime); + if (null === node.return && 3 === node.tag) { + root = node.stateNode; + break; + } + node = node.return; + } + null !== root && + (expirationTime > root.firstPendingTime && + (root.firstPendingTime = expirationTime), + (fiber = root.lastPendingTime), + 0 === fiber || expirationTime < fiber) && + (root.lastPendingTime = expirationTime); + return root; +} +function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { + if (root.callbackExpirationTime < expirationTime) { + var existingCallbackNode = root.callbackNode; + null !== existingCallbackNode && + existingCallbackNode !== fakeCallbackNode && + Scheduler_cancelCallback(existingCallbackNode); + root.callbackExpirationTime = expirationTime; + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); + } + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); +} +function runRootCallback(root, callback, isSync) { + var prevCallbackNode = root.callbackNode, + continuation = null; + try { + return ( + (continuation = callback(isSync)), + null !== continuation + ? runRootCallback.bind(null, root, continuation) + : null + ); + } finally { + null === continuation && + prevCallbackNode === root.callbackNode && + ((root.callbackNode = null), (root.callbackExpirationTime = 0)); + } +} +function resolveLocksOnRoot(root, expirationTime) { + var firstBatch = root.firstBatch; + return null !== firstBatch && + firstBatch._defer && + firstBatch._expirationTime >= expirationTime + ? (scheduleCallback(97, function() { + firstBatch._onComplete(); + return null; + }), + !0) + : !1; +} +function flushPendingDiscreteUpdates() { + if (null !== rootsWithPendingDiscreteUpdates) { + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(expirationTime, root) { + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); + }); + flushSyncCallbackQueue(); + } +} +function prepareFreshStack(root, expirationTime) { + root.finishedWork = null; + root.finishedExpirationTime = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + if (null !== workInProgress) + for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { + var interruptedWork = timeoutHandle; + switch (interruptedWork.tag) { + case 1: + var childContextTypes = interruptedWork.type.childContextTypes; + null !== childContextTypes && + void 0 !== childContextTypes && + popContext(interruptedWork); + break; + case 3: + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + break; + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(interruptedWork); + break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; + case 10: + popProvider(interruptedWork); + } + timeoutHandle = timeoutHandle.return; + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null, expirationTime); + renderExpirationTime = expirationTime; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; + spawnedWorkDuringRender = null; +} +function renderRoot(root$jscomp$0, expirationTime, isSync) { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + if (root$jscomp$0.firstPendingTime < expirationTime) return null; + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); + flushPassiveEffects(); + if ( + root$jscomp$0 !== workInProgressRoot || + expirationTime !== renderExpirationTime + ) + prepareFreshStack(root$jscomp$0, expirationTime), + startWorkOnPendingInteractions(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } + if (null !== workInProgress) { + lastPendingTime = executionContext; + executionContext |= RenderContext; + var prevDispatcher = ReactCurrentDispatcher.current; + null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root$jscomp$0.memoizedInteractions; + if (isSync) { + if (1073741823 !== expirationTime) { + var currentTime = requestCurrentTime(); + if (currentTime < expirationTime) + return ( + (executionContext = lastPendingTime), + resetContextDependencies(), + (ReactCurrentDispatcher.current = prevDispatcher), + (tracing.__interactionsRef.current = prevInteractions), + renderRoot.bind(null, root$jscomp$0, currentTime) + ); + } + } else currentEventTime = 0; + do + try { + if (isSync) + for (; null !== workInProgress; ) + workInProgress = performUnitOfWork(workInProgress); + else + for (; null !== workInProgress && !Scheduler_shouldYield(); ) + workInProgress = performUnitOfWork(workInProgress); + break; + } catch (thrownValue) { + resetContextDependencies(); + resetHooks(); + currentTime = workInProgress; + if (null === currentTime || null === currentTime.return) + throw (prepareFreshStack(root$jscomp$0, expirationTime), + (executionContext = lastPendingTime), + thrownValue); + currentTime.mode & 8 && + stopProfilerTimerIfRunningAndRecordDelta(currentTime, !0); + a: { + var root = root$jscomp$0, + returnFiber = currentTime.return, + sourceFiber = currentTime, + value = thrownValue, + renderExpirationTime$jscomp$0 = renderExpirationTime; + sourceFiber.effectTag |= 1024; + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + if ( + null !== value && + "object" === typeof value && + "function" === typeof value.then + ) { + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); + value = returnFiber; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { + returnFiber = value.updateQueue; + null === returnFiber + ? ((returnFiber = new Set()), + returnFiber.add(thenable), + (value.updateQueue = returnFiber)) + : returnFiber.add(thenable); + if (0 === (value.mode & 2)) { + value.effectTag |= 64; + sourceFiber.effectTag &= -1957; + 1 === sourceFiber.tag && + (null === sourceFiber.alternate + ? (sourceFiber.tag = 17) + : ((renderExpirationTime$jscomp$0 = createUpdate( + 1073741823, + null + )), + (renderExpirationTime$jscomp$0.tag = 2), + enqueueUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ))); + sourceFiber.expirationTime = 1073741823; + break a; + } + sourceFiber = root; + root = renderExpirationTime$jscomp$0; + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), + (returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), + void 0 === returnFiber && + ((returnFiber = new Set()), + hasInvisibleParentBoundary.set(thenable, returnFiber))); + returnFiber.has(root) || + (returnFiber.add(root), + (sourceFiber = pingSuspendedRoot.bind( + null, + sourceFiber, + thenable, + root + )), + (sourceFiber = tracing.unstable_wrap(sourceFiber)), + thenable.then(sourceFiber, sourceFiber)); + value.effectTag |= 2048; + value.expirationTime = renderExpirationTime$jscomp$0; + break a; + } + value = value.return; + } while (null !== value); + value = Error( + (getComponentName(sourceFiber.type) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + + getStackByFiberInDevAndProd(sourceFiber) + ); + } + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); + value = createCapturedValue(value, sourceFiber); + sourceFiber = returnFiber; + do { + switch (sourceFiber.tag) { + case 3: + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createRootErrorUpdate( + sourceFiber, + value, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + case 1: + if ( + ((thenable = value), + (root = sourceFiber.type), + (returnFiber = sourceFiber.stateNode), + 0 === (sourceFiber.effectTag & 64) && + ("function" === typeof root.getDerivedStateFromError || + (null !== returnFiber && + "function" === typeof returnFiber.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has( + returnFiber + ))))) + ) { + sourceFiber.effectTag |= 2048; + sourceFiber.expirationTime = renderExpirationTime$jscomp$0; + renderExpirationTime$jscomp$0 = createClassErrorUpdate( + sourceFiber, + thenable, + renderExpirationTime$jscomp$0 + ); + enqueueCapturedUpdate( + sourceFiber, + renderExpirationTime$jscomp$0 + ); + break a; + } + } + sourceFiber = sourceFiber.return; + } while (null !== sourceFiber); + } + workInProgress = completeUnitOfWork(currentTime); + } + while (1); + executionContext = lastPendingTime; + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + tracing.__interactionsRef.current = prevInteractions; + if (null !== workInProgress) + return renderRoot.bind(null, root$jscomp$0, expirationTime); + } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; + if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; + workInProgressRoot = null; + switch (workInProgressRootExitStatus) { + case RootIncomplete: + throw ReactError(Error("Should have a work-in-progress.")); + case RootErrored: + return ( + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) + : isSync + ? commitRoot.bind(null, root$jscomp$0) + : (prepareFreshStack(root$jscomp$0, expirationTime), + scheduleSyncCallback( + renderRoot.bind(null, root$jscomp$0, expirationTime) + ), + null) + ); + case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: + if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + isSync = root$jscomp$0.lastPendingTime; + if (isSync < expirationTime) + return renderRoot.bind(null, root$jscomp$0, isSync); + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) + return ( + (root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + )), + null + ); + } + return commitRoot.bind(null, root$jscomp$0); + case RootCompleted: + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); + default: + throw ReactError(Error("Unknown root exit status.")); + } +} +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} +function performUnitOfWork(unitOfWork) { + var current$$1 = unitOfWork.alternate; + 0 !== (unitOfWork.mode & 8) + ? ((profilerStartTime = now$1()), + 0 > unitOfWork.actualStartTime && (unitOfWork.actualStartTime = now$1()), + (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)), + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) + : (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current$$1 && (current$$1 = completeUnitOfWork(unitOfWork)); + ReactCurrentOwner$2.current = null; + return current$$1; +} +function completeUnitOfWork(unitOfWork) { + workInProgress = unitOfWork; + do { + var current$$1 = workInProgress.alternate; + unitOfWork = workInProgress.return; + if (0 === (workInProgress.effectTag & 1024)) { + if (0 === (workInProgress.mode & 8)) + current$$1 = completeWork( + current$$1, + workInProgress, + renderExpirationTime + ); + else { + var fiber = workInProgress; + profilerStartTime = now$1(); + 0 > fiber.actualStartTime && (fiber.actualStartTime = now$1()); + current$$1 = completeWork( + current$$1, + workInProgress, + renderExpirationTime + ); + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); + } + fiber = workInProgress; + if (1 === renderExpirationTime || 1 !== fiber.childExpirationTime) { + var newChildExpirationTime = 0; + if (0 !== (fiber.mode & 8)) { + for ( + var actualDuration = fiber.actualDuration, + treeBaseDuration = fiber.selfBaseDuration, + shouldBubbleActualDurations = + null === fiber.alternate || + fiber.child !== fiber.alternate.child, + child = fiber.child; + null !== child; + + ) { + var childUpdateExpirationTime = child.expirationTime, + childChildExpirationTime = child.childExpirationTime; + childUpdateExpirationTime > newChildExpirationTime && + (newChildExpirationTime = childUpdateExpirationTime); + childChildExpirationTime > newChildExpirationTime && + (newChildExpirationTime = childChildExpirationTime); + shouldBubbleActualDurations && + (actualDuration += child.actualDuration); + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + fiber.actualDuration = actualDuration; + fiber.treeBaseDuration = treeBaseDuration; + } else + for (actualDuration = fiber.child; null !== actualDuration; ) + (treeBaseDuration = actualDuration.expirationTime), + (shouldBubbleActualDurations = + actualDuration.childExpirationTime), + treeBaseDuration > newChildExpirationTime && + (newChildExpirationTime = treeBaseDuration), + shouldBubbleActualDurations > newChildExpirationTime && + (newChildExpirationTime = shouldBubbleActualDurations), + (actualDuration = actualDuration.sibling); + fiber.childExpirationTime = newChildExpirationTime; + } + if (null !== current$$1) return current$$1; + null !== unitOfWork && + 0 === (unitOfWork.effectTag & 1024) && + (null === unitOfWork.firstEffect && + (unitOfWork.firstEffect = workInProgress.firstEffect), + null !== workInProgress.lastEffect && + (null !== unitOfWork.lastEffect && + (unitOfWork.lastEffect.nextEffect = workInProgress.firstEffect), + (unitOfWork.lastEffect = workInProgress.lastEffect)), + 1 < workInProgress.effectTag && + (null !== unitOfWork.lastEffect + ? (unitOfWork.lastEffect.nextEffect = workInProgress) + : (unitOfWork.firstEffect = workInProgress), + (unitOfWork.lastEffect = workInProgress))); + } else { + current$$1 = unwindWork(workInProgress, renderExpirationTime); + if (0 !== (workInProgress.mode & 8)) { + stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); + fiber = workInProgress.actualDuration; + for ( + newChildExpirationTime = workInProgress.child; + null !== newChildExpirationTime; + + ) + (fiber += newChildExpirationTime.actualDuration), + (newChildExpirationTime = newChildExpirationTime.sibling); + workInProgress.actualDuration = fiber; + } + if (null !== current$$1) + return (current$$1.effectTag &= 1023), current$$1; + null !== unitOfWork && + ((unitOfWork.firstEffect = unitOfWork.lastEffect = null), + (unitOfWork.effectTag |= 1024)); + } + current$$1 = workInProgress.sibling; + if (null !== current$$1) return current$$1; + workInProgress = unitOfWork; + } while (null !== workInProgress); + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootCompleted); + return null; +} +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority(99, commitRootImpl.bind(null, root, renderPriorityLevel)); + null !== rootWithPendingPassiveEffects && + scheduleCallback(97, function() { + flushPassiveEffects(); + return null; + }); + return null; +} +function commitRootImpl(root, renderPriorityLevel) { + flushPassiveEffects(); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); + root.callbackNode = null; + root.callbackExpirationTime = 0; + var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, + childExpirationTimeBeforeCommit = finishedWork.childExpirationTime; + updateExpirationTimeBeforeCommit = + childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit + ? childExpirationTimeBeforeCommit + : updateExpirationTimeBeforeCommit; + root.firstPendingTime = updateExpirationTimeBeforeCommit; + updateExpirationTimeBeforeCommit < root.lastPendingTime && + (root.lastPendingTime = updateExpirationTimeBeforeCommit); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + ReactCurrentOwner$2.current = null; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (; null !== nextEffect; ) { + if (0 !== (nextEffect.effectTag & 256)) { + var current$$1 = nextEffect.alternate, + finishedWork$jscomp$0 = nextEffect; + switch (finishedWork$jscomp$0.tag) { + case 0: + case 11: + case 15: + commitHookEffectList( + UnmountSnapshot, + NoEffect$1, + finishedWork$jscomp$0 + ); + break; + case 1: + if ( + finishedWork$jscomp$0.effectTag & 256 && + null !== current$$1 + ) { + var prevProps = current$$1.memoizedProps, + prevState = current$$1.memoizedState, + instance = finishedWork$jscomp$0.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + finishedWork$jscomp$0.elementType === + finishedWork$jscomp$0.type + ? prevProps + : resolveDefaultProps( + finishedWork$jscomp$0.type, + prevProps + ), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + case 5: + case 6: + case 4: + case 17: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + commitTime = now$1(); + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { + var effectTag = nextEffect.effectTag; + if (effectTag & 128) { + var current$$1$jscomp$0 = nextEffect.alternate; + if (null !== current$$1$jscomp$0) { + var currentRef = current$$1$jscomp$0.ref; + null !== currentRef && + ("function" === typeof currentRef + ? currentRef(null) + : (currentRef.current = null)); + } + } + switch (effectTag & 14) { + case 2: + commitPlacement(nextEffect); + nextEffect.effectTag &= -3; + break; + case 6: + commitPlacement(nextEffect); + nextEffect.effectTag &= -3; + commitWork(nextEffect.alternate, nextEffect); + break; + case 4: + commitWork(nextEffect.alternate, nextEffect); + break; + case 8: + (prevProps = nextEffect), + unmountHostComponents(prevProps, current$$1), + detachFiber(prevProps); + } + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + root.current = finishedWork; + nextEffect = updateExpirationTimeBeforeCommit; + do + try { + for ( + effectTag = root, current$$1$jscomp$0 = expirationTime; + null !== nextEffect; + + ) { + var effectTag$jscomp$0 = nextEffect.effectTag; + if (effectTag$jscomp$0 & 36) { + prevProps = effectTag; + var current$$1$jscomp$1 = nextEffect.alternate; + currentRef = nextEffect; + current$$1 = current$$1$jscomp$0; + switch (currentRef.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountLayout, MountLayout, currentRef); + break; + case 1: + var instance$jscomp$0 = currentRef.stateNode; + if (currentRef.effectTag & 4) + if (null === current$$1$jscomp$1) + instance$jscomp$0.componentDidMount(); + else { + var prevProps$jscomp$0 = + currentRef.elementType === currentRef.type + ? current$$1$jscomp$1.memoizedProps + : resolveDefaultProps( + currentRef.type, + current$$1$jscomp$1.memoizedProps + ); + instance$jscomp$0.componentDidUpdate( + prevProps$jscomp$0, + current$$1$jscomp$1.memoizedState, + instance$jscomp$0.__reactInternalSnapshotBeforeUpdate + ); + } + var updateQueue = currentRef.updateQueue; + null !== updateQueue && + commitUpdateQueue( + currentRef, + updateQueue, + instance$jscomp$0, + current$$1 + ); + break; + case 3: + var _updateQueue = currentRef.updateQueue; + if (null !== _updateQueue) { + prevProps = null; + if (null !== currentRef.child) + switch (currentRef.child.tag) { + case 5: + prevProps = currentRef.child.stateNode; + break; + case 1: + prevProps = currentRef.child.stateNode; + } + commitUpdateQueue( + currentRef, + _updateQueue, + prevProps, + current$$1 + ); + } + break; + case 5: + break; + case 6: + break; + case 4: + break; + case 12: + var onRender = currentRef.memoizedProps.onRender; + "function" === typeof onRender && + onRender( + currentRef.memoizedProps.id, + null === current$$1$jscomp$1 ? "mount" : "update", + currentRef.actualDuration, + currentRef.treeBaseDuration, + currentRef.actualStartTime, + commitTime, + prevProps.memoizedInteractions + ); + break; + case 13: + case 19: + case 17: + case 20: + break; + default: + throw ReactError( + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + } + if (effectTag$jscomp$0 & 128) { + var ref = nextEffect.ref; + if (null !== ref) { + var instance$jscomp$1 = nextEffect.stateNode; + switch (nextEffect.tag) { + case 5: + var instanceToUse = instance$jscomp$1; + break; + default: + instanceToUse = instance$jscomp$1; + } + "function" === typeof ref + ? ref(instanceToUse) + : (ref.current = instanceToUse); + } + } + effectTag$jscomp$0 & 512 && (rootDoesHavePassiveEffects = !0); + nextEffect = nextEffect.nextEffect; + } + } catch (error) { + if (null === nextEffect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + while (null !== nextEffect); + nextEffect = null; + requestPaint(); + tracing.__interactionsRef.current = prevInteractions; + executionContext = childExpirationTimeBeforeCommit; + } else (root.current = finishedWork), (commitTime = now$1()); + if ((effectTag$jscomp$0 = rootDoesHavePassiveEffects)) + (rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + if (0 !== renderPriorityLevel) { + current$$1$jscomp$1 = requestCurrentTime(); + current$$1$jscomp$1 = inferPriorityFromExpirationTime( + current$$1$jscomp$1, + renderPriorityLevel + ); + if (null !== spawnedWorkDuringRender) + for ( + instance$jscomp$0 = spawnedWorkDuringRender, + spawnedWorkDuringRender = null, + prevProps$jscomp$0 = 0; + prevProps$jscomp$0 < instance$jscomp$0.length; + prevProps$jscomp$0++ + ) + scheduleInteractions( + root, + instance$jscomp$0[prevProps$jscomp$0], + root.memoizedInteractions + ); + scheduleCallbackForRoot(root, current$$1$jscomp$1, renderPriorityLevel); + } else legacyErrorBoundariesThatAlreadyFailed = null; + effectTag$jscomp$0 || finishPendingInteractions(root, expirationTime); + "function" === typeof onCommitFiberRoot && + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + if (hasUncaughtError) + throw ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); + return null; +} +function flushPassiveEffects() { + if (null === rootWithPendingPassiveEffects) return !1; + var root = rootWithPendingPassiveEffects, + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root, expirationTime) { + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + for (var effect = root.current.firstEffect; null !== effect; ) { + try { + var finishedWork = effect; + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } + } catch (error) { + if (null === effect) + throw ReactError(Error("Should be working on an effect.")); + captureCommitPhaseError(effect, error); + } + finishedWork = effect.nextEffect; + effect.nextEffect = null; + effect = finishedWork; + } + tracing.__interactionsRef.current = prevInteractions; + finishPendingInteractions(root, expirationTime); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); + return !0; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1073741823); + enqueueUpdate(rootFiber, sourceFiber); + rootFiber = markUpdateTimeFromFiberToRoot(rootFiber, 1073741823); + null !== rootFiber && scheduleCallbackForRoot(rootFiber, 99, 1073741823); +} +function captureCommitPhaseError(sourceFiber, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (var fiber = sourceFiber.return; null !== fiber; ) { + if (3 === fiber.tag) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + break; + } else if (1 === fiber.tag) { + var instance = fiber.stateNode; + if ( + "function" === typeof fiber.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createClassErrorUpdate(fiber, sourceFiber, 1073741823); + enqueueUpdate(fiber, sourceFiber); + fiber = markUpdateTimeFromFiberToRoot(fiber, 1073741823); + null !== fiber && scheduleCallbackForRoot(fiber, 99, 1073741823); + break; + } + } + fiber = fiber.return; + } +} +function pingSuspendedRoot(root, thenable, suspendedTime) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(thenable); + workInProgressRoot === root && renderExpirationTime === suspendedTime + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) + : root.lastPendingTime < suspendedTime || + ((thenable = root.pingTime), + (0 !== thenable && thenable < suspendedTime) || + ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), + (thenable = requestCurrentTime()), + (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), + scheduleCallbackForRoot(root, thenable, suspendedTime))); +} +function resolveRetryThenable(boundaryFiber, thenable) { + var retryCache = boundaryFiber.stateNode; + null !== retryCache && retryCache.delete(thenable); + retryCache = requestCurrentTime(); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); + retryCache = inferPriorityFromExpirationTime(retryCache, thenable); + boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); + null !== boundaryFiber && + scheduleCallbackForRoot(boundaryFiber, retryCache, thenable); +} +var beginWork$$1 = void 0; +beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { + var updateExpirationTime = workInProgress.expirationTime; + if (null !== current$$1) + if ( + current$$1.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if (updateExpirationTime < renderExpirationTime) { + didReceiveUpdate = !1; + switch (workInProgress.tag) { + case 3: + pushHostRootContext(workInProgress); + break; + case 5: + pushHostContext(workInProgress); + break; + case 1: + isContextProvider(workInProgress.type) && + pushContextProvider(workInProgress); + break; + case 4: + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ); + break; + case 10: + pushProvider(workInProgress, workInProgress.memoizedProps.value); + break; + case 12: + workInProgress.effectTag |= 4; + break; + case 13: + if (null !== workInProgress.memoizedState) { + updateExpirationTime = workInProgress.child.childExpirationTime; + if ( + 0 !== updateExpirationTime && + updateExpirationTime >= renderExpirationTime + ) + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + return null !== workInProgress ? workInProgress.sibling : null; + } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; + } + return bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + } + } + else didReceiveUpdate = !1; + workInProgress.expirationTime = 0; + switch (workInProgress.tag) { + case 2: + updateExpirationTime = workInProgress.type; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderExpirationTime); + renderState = renderWithHooks( + null, + workInProgress, + updateExpirationTime, + current$$1, + renderState, + renderExpirationTime + ); + workInProgress.effectTag |= 1; + if ( + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof + ) { + workInProgress.tag = 1; + resetHooks(); + if (isContextProvider(updateExpirationTime)) { + var hasContext = !0; + pushContextProvider(workInProgress); + } else hasContext = !1; + workInProgress.memoizedState = + null !== renderState.state && void 0 !== renderState.state + ? renderState.state + : null; + var getDerivedStateFromProps = + updateExpirationTime.getDerivedStateFromProps; + "function" === typeof getDerivedStateFromProps && + applyDerivedStateFromProps( + workInProgress, + updateExpirationTime, + getDerivedStateFromProps, + current$$1 + ); + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; + mountClassInstance( + workInProgress, + updateExpirationTime, + current$$1, + renderExpirationTime + ); + workInProgress = finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + hasContext, + renderExpirationTime + ); + } else + (workInProgress.tag = 0), + reconcileChildren( + null, + workInProgress, + renderState, + renderExpirationTime + ), + (workInProgress = workInProgress.child); + return workInProgress; + case 16: + renderState = workInProgress.elementType; + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)); + current$$1 = workInProgress.pendingProps; + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); + switch (hasContext) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + renderState, + current$$1, + renderExpirationTime + ); + break; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + renderState, + resolveDefaultProps(renderState.type, current$$1), + updateExpirationTime, + renderExpirationTime + ); + break; + default: + throw ReactError( + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) + ); + } + return workInProgress; + case 0: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateFunctionComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 1: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateClassComponent( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 3: + pushHostRootContext(workInProgress); + updateExpirationTime = workInProgress.updateQueue; + if (null === updateExpirationTime) + throw ReactError( + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) + ); + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; + processUpdateQueue( + workInProgress, + updateExpirationTime, + workInProgress.pendingProps, + null, + renderExpirationTime + ); + updateExpirationTime = workInProgress.memoizedState.element; + updateExpirationTime === renderState + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + )) + : (reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + (workInProgress = workInProgress.child)); + return workInProgress; + case 5: + return ( + pushHostContext(workInProgress), + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + (updateExpirationTime = workInProgress.pendingProps.children), + markRef(current$$1, workInProgress), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 6: + return ( + null === current$$1 && tryToClaimNextHydratableInstance(workInProgress), + null + ); + case 13: + return updateSuspenseComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + case 4: + return ( + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (updateExpirationTime = workInProgress.pendingProps), + null === current$$1 + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + updateExpirationTime, + renderExpirationTime + )) + : reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 11: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + updateForwardRef( + current$$1, + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ) + ); + case 7: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps, + renderExpirationTime + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 12: + return ( + (workInProgress.effectTag |= 4), + reconcileChildren( + current$$1, + workInProgress, + workInProgress.pendingProps.children, + renderExpirationTime + ), + workInProgress.child + ); + case 10: + a: { + updateExpirationTime = workInProgress.type._context; + renderState = workInProgress.pendingProps; + getDerivedStateFromProps = workInProgress.memoizedProps; + hasContext = renderState.value; + pushProvider(workInProgress, hasContext); + if (null !== getDerivedStateFromProps) { + var oldValue = getDerivedStateFromProps.value; + hasContext = is(oldValue, hasContext) + ? 0 + : ("function" === typeof updateExpirationTime._calculateChangedBits + ? updateExpirationTime._calculateChangedBits( + oldValue, + hasContext + ) + : 1073741823) | 0; + if (0 === hasContext) { + if ( + getDerivedStateFromProps.children === renderState.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current$$1, + workInProgress, + renderExpirationTime + ); + break a; + } + } else + for ( + oldValue = workInProgress.child, + null !== oldValue && (oldValue.return = workInProgress); + null !== oldValue; + + ) { + var list = oldValue.dependencies; + if (null !== list) { + getDerivedStateFromProps = oldValue.child; + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { + if ( + dependency.context === updateExpirationTime && + 0 !== (dependency.observedBits & hasContext) + ) { + 1 === oldValue.tag && + ((dependency = createUpdate(renderExpirationTime, null)), + (dependency.tag = 2), + enqueueUpdate(oldValue, dependency)); + oldValue.expirationTime < renderExpirationTime && + (oldValue.expirationTime = renderExpirationTime); + dependency = oldValue.alternate; + null !== dependency && + dependency.expirationTime < renderExpirationTime && + (dependency.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); + list.expirationTime < renderExpirationTime && + (list.expirationTime = renderExpirationTime); + break; + } + dependency = dependency.next; + } + } else + getDerivedStateFromProps = + 10 === oldValue.tag + ? oldValue.type === workInProgress.type + ? null + : oldValue.child + : oldValue.child; + if (null !== getDerivedStateFromProps) + getDerivedStateFromProps.return = oldValue; + else + for ( + getDerivedStateFromProps = oldValue; + null !== getDerivedStateFromProps; + + ) { + if (getDerivedStateFromProps === workInProgress) { + getDerivedStateFromProps = null; + break; + } + oldValue = getDerivedStateFromProps.sibling; + if (null !== oldValue) { + oldValue.return = getDerivedStateFromProps.return; + getDerivedStateFromProps = oldValue; + break; + } + getDerivedStateFromProps = getDerivedStateFromProps.return; + } + oldValue = getDerivedStateFromProps; + } + } + reconcileChildren( + current$$1, + workInProgress, + renderState.children, + renderExpirationTime + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: + return ( + (renderState = workInProgress.type), + (hasContext = workInProgress.pendingProps), + (updateExpirationTime = hasContext.children), + prepareToReadContext(workInProgress, renderExpirationTime), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), + (workInProgress.effectTag |= 1), + reconcileChildren( + current$$1, + workInProgress, + updateExpirationTime, + renderExpirationTime + ), + workInProgress.child + ); + case 14: + return ( + (renderState = workInProgress.type), + (hasContext = resolveDefaultProps( + renderState, + workInProgress.pendingProps + )), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), + updateMemoComponent( + current$$1, + workInProgress, + renderState, + hasContext, + updateExpirationTime, + renderExpirationTime + ) + ); + case 15: + return updateSimpleMemoComponent( + current$$1, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + updateExpirationTime, + renderExpirationTime + ); + case 17: + return ( + (updateExpirationTime = workInProgress.type), + (renderState = workInProgress.pendingProps), + (renderState = + workInProgress.elementType === updateExpirationTime + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), + null !== current$$1 && + ((current$$1.alternate = null), + (workInProgress.alternate = null), + (workInProgress.effectTag |= 2)), + (workInProgress.tag = 1), + isContextProvider(updateExpirationTime) + ? ((current$$1 = !0), pushContextProvider(workInProgress)) + : (current$$1 = !1), + prepareToReadContext(workInProgress, renderExpirationTime), + constructClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + mountClassInstance( + workInProgress, + updateExpirationTime, + renderState, + renderExpirationTime + ), + finishClassComponent( + null, + workInProgress, + updateExpirationTime, + !0, + current$$1, + renderExpirationTime + ) + ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + } + throw ReactError( + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) + ); +}; +function scheduleInteractions(root, expirationTime, interactions) { + if (0 < interactions.size) { + var pendingInteractionMap = root.pendingInteractionMap, + pendingInteractions = pendingInteractionMap.get(expirationTime); + null != pendingInteractions + ? interactions.forEach(function(interaction) { + pendingInteractions.has(interaction) || interaction.__count++; + pendingInteractions.add(interaction); + }) + : (pendingInteractionMap.set(expirationTime, new Set(interactions)), + interactions.forEach(function(interaction) { + interaction.__count++; + })); + pendingInteractionMap = tracing.__subscriberRef.current; + if (null !== pendingInteractionMap) + pendingInteractionMap.onWorkScheduled( + interactions, + 1e3 * expirationTime + root.interactionThreadID + ); + } +} +function startWorkOnPendingInteractions(root, expirationTime) { + var interactions = new Set(); + root.pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + scheduledExpirationTime >= expirationTime && + scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + }); + root.memoizedInteractions = interactions; + if (0 < interactions.size) { + var subscriber = tracing.__subscriberRef.current; + if (null !== subscriber) { + root = 1e3 * expirationTime + root.interactionThreadID; + try { + subscriber.onWorkStarted(interactions, root); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } + } + } +} +function finishPendingInteractions(root, committedExpirationTime) { + var earliestRemainingTimeAfterCommit = root.firstPendingTime, + subscriber = void 0; + try { + if ( + ((subscriber = tracing.__subscriberRef.current), + null !== subscriber && 0 < root.memoizedInteractions.size) + ) + subscriber.onWorkStopped( + root.memoizedInteractions, + 1e3 * committedExpirationTime + root.interactionThreadID + ); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } finally { + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function( + scheduledInteractions, + scheduledExpirationTime + ) { + scheduledExpirationTime > earliestRemainingTimeAfterCommit && + (pendingInteractionMap.delete(scheduledExpirationTime), + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; + if (null !== subscriber && 0 === interaction.__count) + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + scheduleCallback(99, function() { + throw error; + }); + } + })); + }); + } +} +var onCommitFiberRoot = null, + onCommitFiberUnmount = null, + isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = 64 === (root.current.effectTag & 64), + currentTime = requestCurrentTime(), + priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; + this.actualDuration = 0; + this.actualStartTime = -1; + this.treeBaseDuration = this.selfBaseDuration = 0; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null), + (workInProgress.actualDuration = 0), + (workInProgress.actualStartTime = -1)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); +} +function findHostInstance(component) { + var fiber = component._reactInternalFiber; + if (void 0 === fiber) { + if ("function" === typeof component.render) + throw ReactError(Error("Unable to find node on an unmounted component.")); + throw ReactError( + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) + ); + } + component = findCurrentHostFiber(fiber); + return null === component ? null : component.stateNode; +} +function updateContainer(element, container, parentComponent, callback) { + var current$$1 = container.current, + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); + currentTime = container.current; + a: if (parentComponent) { + parentComponent = parentComponent._reactInternalFiber; + b: { + if ( + 2 !== isFiberMountedImpl(parentComponent) || + 1 !== parentComponent.tag + ) + throw ReactError( + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) + ); + var parentContext = parentComponent; + do { + switch (parentContext.tag) { + case 3: + parentContext = parentContext.stateNode.context; + break b; + case 1: + if (isContextProvider(parentContext.type)) { + parentContext = + parentContext.stateNode + .__reactInternalMemoizedMergedChildContext; + break b; + } + } + parentContext = parentContext.return; + } while (null !== parentContext); + throw ReactError( + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) + ); + } + if (1 === parentComponent.tag) { + var Component = parentComponent.type; + if (isContextProvider(Component)) { + parentComponent = processChildContext( + parentComponent, + Component, + parentContext + ); + break a; + } + } + parentComponent = parentContext; + } else parentComponent = emptyContextObject; + null === container.context + ? (container.context = parentComponent) + : (container.pendingContext = parentComponent); + container = callback; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; + container = void 0 === container ? null : container; + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); + scheduleUpdateOnFiber(currentTime, current$$1); + return current$$1; +} +function createPortal(children, containerInfo, implementation) { + var key = + 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: REACT_PORTAL_TYPE, + key: null == key ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; +} +function _inherits(subClass, superClass) { + if ("function" !== typeof superClass && null !== superClass) + throw new TypeError( + "Super expression must either be null or a function, not " + + typeof superClass + ); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); + superClass && + (Object.setPrototypeOf + ? Object.setPrototypeOf(subClass, superClass) + : (subClass.__proto__ = superClass)); +} +var getInspectorDataForViewTag = void 0; +getInspectorDataForViewTag = function() { + throw ReactError( + Error("getInspectorDataForViewTag() is not available in production") + ); +}; +function findNodeHandle(componentOrHandle) { + if (null == componentOrHandle) return null; + if ("number" === typeof componentOrHandle) return componentOrHandle; + if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag; + if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) + return componentOrHandle.canonical._nativeTag; + componentOrHandle = findHostInstance(componentOrHandle); + return null == componentOrHandle + ? componentOrHandle + : componentOrHandle.canonical + ? componentOrHandle.canonical._nativeTag + : componentOrHandle._nativeTag; +} +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; + try { + return fn(a); + } finally { + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); + } +}; +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); +}; +var roots = new Map(), + ReactNativeRenderer = { + NativeComponent: (function(findNodeHandle, findHostInstance) { + return (function(_React$Component) { + function ReactNativeComponent() { + if (!(this instanceof ReactNativeComponent)) + throw new TypeError("Cannot call a class as a function"); + var call = _React$Component.apply(this, arguments); + if (!this) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called" + ); + return !call || + ("object" !== typeof call && "function" !== typeof call) + ? this + : call; + } + _inherits(ReactNativeComponent, _React$Component); + ReactNativeComponent.prototype.blur = function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.focus = function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }; + ReactNativeComponent.prototype.measure = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureInWindow = function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }; + ReactNativeComponent.prototype.measureLayout = function( + relativeToNativeNode, + onSuccess, + onFail + ) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }; + ReactNativeComponent.prototype.setNativeProps = function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }; + return ReactNativeComponent; + })(React.Component); + })(findNodeHandle, findHostInstance), + findNodeHandle: findNodeHandle, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, + setNativeProps: function(handle, nativeProps) { + null != handle._nativeTag && + ((nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + handle.viewConfig.validAttributes + )), + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + handle._nativeTag, + handle.viewConfig.uiViewClassName, + nativeProps + )); + }, + render: function(element, containerTag, callback) { + var root = roots.get(containerTag); + if (!root) { + root = new FiberRootNode(containerTag, 0, !1); + var uninitializedFiber = 0; + isDevToolsPresent && (uninitializedFiber |= 8); + uninitializedFiber = createFiber(3, null, null, uninitializedFiber); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + roots.set(containerTag, root); + } + updateContainer(element, root, null, callback); + a: if (((element = root.current), element.child)) + switch (element.child.tag) { + case 5: + element = element.child.stateNode; + break a; + default: + element = element.child.stateNode; + } + else element = null; + return element; + }, + unmountComponentAtNode: function(containerTag) { + var root = roots.get(containerTag); + root && + updateContainer(null, root, null, function() { + roots.delete(containerTag); + }); + }, + unmountComponentAtNodeAndRemoveContainer: function(containerTag) { + ReactNativeRenderer.unmountComponentAtNode(containerTag); + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); + }, + createPortal: function(children, containerTag) { + return createPortal( + children, + containerTag, + null, + 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null + ); + }, + unstable_batchedUpdates: batchedUpdates, + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + NativeMethodsMixin: (function(findNodeHandle, findHostInstance) { + return { + measure: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measure( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measure( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureInWindow: function(callback) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null != maybeInstance && + (maybeInstance.canonical + ? nativeFabricUIManager.measureInWindow( + maybeInstance.node, + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + ) + : ReactNativePrivateInterface.UIManager.measureInWindow( + findNodeHandle(this), + mountSafeCallback_NOT_REALLY_SAFE(this, callback) + )); + }, + measureLayout: function(relativeToNativeNode, onSuccess, onFail) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + null == maybeInstance || + maybeInstance.canonical || + ((maybeInstance = void 0), + "number" === typeof relativeToNativeNode + ? (maybeInstance = relativeToNativeNode) + : relativeToNativeNode._nativeTag && + (maybeInstance = relativeToNativeNode._nativeTag), + null != maybeInstance && + ReactNativePrivateInterface.UIManager.measureLayout( + findNodeHandle(this), + maybeInstance, + mountSafeCallback_NOT_REALLY_SAFE(this, onFail), + mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess) + )); + }, + setNativeProps: function(nativeProps) { + var maybeInstance = void 0; + try { + maybeInstance = findHostInstance(this); + } catch (error) {} + if (null != maybeInstance && !maybeInstance.canonical) { + var nativeTag = + maybeInstance._nativeTag || maybeInstance.canonical._nativeTag; + maybeInstance = + maybeInstance.viewConfig || maybeInstance.canonical.viewConfig; + nativeProps = diffProperties( + null, + emptyObject, + nativeProps, + maybeInstance.validAttributes + ); + null != nativeProps && + ReactNativePrivateInterface.UIManager.updateView( + nativeTag, + maybeInstance.uiViewClassName, + nativeProps + ); + } + }, + focus: function() { + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); + }, + blur: function() { + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); + } + }; + })(findNodeHandle, findHostInstance), + computeComponentStackForErrorReporting: function(reactTag) { + return (reactTag = getInstanceFromTag(reactTag)) + ? getStackByFiberInDevAndProd(reactTag) + : ""; + } + } + }; +(function(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + return injectInternals( + Object.assign({}, devToolsConfig, { + overrideHookState: null, + overrideProps: null, + setSuspenseHandler: null, + scheduleUpdate: null, + currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + findHostInstanceByFiber: function(fiber) { + fiber = findCurrentHostFiber(fiber); + return null === fiber ? null : fiber.stateNode; + }, + findFiberByHostInstance: function(instance) { + return findFiberByHostInstance + ? findFiberByHostInstance(instance) + : null; + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null + }) + ); +})({ + findFiberByHostInstance: getInstanceFromTag, + getInspectorDataForViewTag: getInspectorDataForViewTag, + bundleType: 0, + version: "16.8.6", + rendererPackageName: "react-native-renderer" +}); +var ReactNativeRenderer$2 = { default: ReactNativeRenderer }, + ReactNativeRenderer$3 = + (ReactNativeRenderer$2 && ReactNativeRenderer) || ReactNativeRenderer$2; +module.exports = ReactNativeRenderer$3.default || ReactNativeRenderer$3; diff --git a/Libraries/Renderer/oss/ReactNativeRenderer-profiling.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js similarity index 75% rename from Libraries/Renderer/oss/ReactNativeRenderer-profiling.js rename to Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js index 6d94114ddfde56..0216ce66ab7493 100644 --- a/Libraries/Renderer/oss/ReactNativeRenderer-profiling.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js @@ -11,21 +11,14 @@ */ "use strict"; -require("InitializeCore"); -var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), - UIManager = require("UIManager"), - RCTEventEmitter = require("RCTEventEmitter"), +require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); +var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), - deepDiffer = require("deepDiffer"), - flattenStyle = require("flattenStyle"), - TextInputState = require("TextInputState"), Scheduler = require("scheduler"), - tracing = require("scheduler/tracing"), - ExceptionsManager = require("ExceptionsManager"); -function ReactError(message) { - message = Error(message); - message.name = "Invariant Violation"; - return message; + tracing = require("scheduler/tracing"); +function ReactError(error) { + error.name = "Invariant Violation"; + return error; } var eventPluginOrder = null, namesToPlugins = {}; @@ -36,16 +29,20 @@ function recomputePluginOrdering() { pluginIndex = eventPluginOrder.indexOf(pluginName); if (!(-1 < pluginIndex)) throw ReactError( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + + pluginName + + "`." + ) ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw ReactError( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + + pluginName + + "` does not." + ) ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -56,9 +53,11 @@ function recomputePluginOrdering() { eventName$jscomp$0 = eventName; if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same event name, `" + + eventName$jscomp$0 + + "`." + ) ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -84,11 +83,13 @@ function recomputePluginOrdering() { : (JSCompiler_inline_result = !1); if (!JSCompiler_inline_result) throw ReactError( - "EventPluginRegistry: Failed to publish event `" + - eventName + - "` for plugin `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Failed to publish event `" + + eventName + + "` for plugin `" + + pluginName + + "`." + ) ); } } @@ -97,9 +98,11 @@ function recomputePluginOrdering() { function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw ReactError( - "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + Error( + "EventPluginHub: More than one plugin attempted to publish the same registration name, `" + + registrationName + + "`." + ) ); registrationNameModules[registrationName] = pluginModule; } @@ -148,7 +151,9 @@ function invokeGuardedCallbackAndCatchFirstError( caughtError = null; } else throw ReactError( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + Error( + "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." + ) ); hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); } @@ -166,7 +171,7 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; if (Array.isArray(dispatchListener)) - throw ReactError("executeDirectDispatch(...): Invalid `event`."); + throw ReactError(Error("executeDirectDispatch(...): Invalid `event`.")); event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null; @@ -179,7 +184,9 @@ function executeDirectDispatch(event) { function accumulateInto(current, next) { if (null == next) throw ReactError( - "accumulateInto(...): Accumulated items must not be null or undefined." + Error( + "accumulateInto(...): Accumulated items must not be null or undefined." + ) ); if (null == current) return next; if (Array.isArray(current)) { @@ -216,7 +223,9 @@ var injection = { injectEventPluginOrder: function(injectedEventPluginOrder) { if (eventPluginOrder) throw ReactError( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + ) ); eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); recomputePluginOrdering(); @@ -233,9 +242,11 @@ var injection = { ) { if (namesToPlugins[pluginName]) throw ReactError( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + Error( + "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + + pluginName + + "`." + ) ); namesToPlugins[pluginName] = pluginModule; isOrderingDirty = !0; @@ -277,11 +288,13 @@ function getListener(inst, registrationName) { if (inst) return null; if (listener && "function" !== typeof listener) throw ReactError( - "Expected `" + - registrationName + - "` listener to be a function, instead got a value of `" + - typeof listener + - "` type." + Error( + "Expected `" + + registrationName + + "` listener to be a function, instead got a value of `" + + typeof listener + + "` type." + ) ); return listener; } @@ -445,7 +458,9 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { function releasePooledEvent(event) { if (!(event instanceof this)) throw ReactError( - "Trying to release an event instance into a pool of a different type." + Error( + "Trying to release an event instance into a pool of a different type." + ) ); event.destructor(); 10 > this.eventPool.length && this.eventPool.push(event); @@ -481,7 +496,8 @@ function timestampForTouch(touch) { } function getTouchIdentifier(_ref) { _ref = _ref.identifier; - if (null == _ref) throw ReactError("Touch object is missing identifier."); + if (null == _ref) + throw ReactError(Error("Touch object is missing identifier.")); return _ref; } function recordTouchStart(touch) { @@ -524,7 +540,7 @@ function recordTouchMove(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch move without a touch start.\nTouch Move: %s\n", "Touch Bank: %s", printTouch(touch), @@ -542,7 +558,7 @@ function recordTouchEnd(touch) { (touchRecord.currentPageY = touch.pageY), (touchRecord.currentTimeStamp = timestampForTouch(touch)), (touchHistory.mostRecentTimeStamp = timestampForTouch(touch))) - : console.error( + : console.warn( "Cannot record touch end without a touch start.\nTouch End: %s\n", "Touch Bank: %s", printTouch(touch), @@ -596,7 +612,7 @@ var ResponderTouchHistoryStore = { function accumulate(current, next) { if (null == next) throw ReactError( - "accumulate(...): Accumulated items must not be null or undefined." + Error("accumulate(...): Accumulated items must not be null or undefined.") ); return null == current ? next @@ -618,7 +634,7 @@ function changeResponder(nextResponderInst, blockHostResponder) { blockHostResponder ); } -var eventTypes$1 = { +var eventTypes = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", @@ -681,7 +697,7 @@ var eventTypes$1 = { _getResponder: function() { return responderInst; }, - eventTypes: eventTypes$1, + eventTypes: eventTypes, extractEvents: function( topLevelType, targetInst, @@ -710,12 +726,12 @@ var eventTypes$1 = { isMoveish(topLevelType)) ) { var JSCompiler_temp = isStartish(topLevelType) - ? eventTypes$1.startShouldSetResponder + ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) - ? eventTypes$1.moveShouldSetResponder + ? eventTypes.moveShouldSetResponder : "topSelectionChange" === topLevelType - ? eventTypes$1.selectionChangeShouldSetResponder - : eventTypes$1.scrollShouldSetResponder; + ? eventTypes.selectionChangeShouldSetResponder + : eventTypes.scrollShouldSetResponder; if (responderInst) b: { var JSCompiler_temp$jscomp$0 = responderInst; @@ -801,7 +817,7 @@ var eventTypes$1 = { JSCompiler_temp && JSCompiler_temp !== responderInst ? ((JSCompiler_temp$jscomp$0 = void 0), (targetInst = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderGrant, + eventTypes.responderGrant, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -811,7 +827,7 @@ var eventTypes$1 = { (depthA = !0 === executeDirectDispatch(targetInst)), responderInst ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminationRequest, + eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget @@ -823,7 +839,7 @@ var eventTypes$1 = { tempA.isPersistent() || tempA.constructor.release(tempA), tempB ? ((tempA = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderTerminate, + eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget @@ -837,7 +853,7 @@ var eventTypes$1 = { )), changeResponder(JSCompiler_temp, depthA)) : ((JSCompiler_temp = ResponderSyntheticEvent.getPooled( - eventTypes$1.responderReject, + eventTypes.responderReject, JSCompiler_temp, nativeEvent, nativeEventTarget @@ -867,11 +883,11 @@ var eventTypes$1 = { ("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType); if ( (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderStart + ? eventTypes.responderStart : targetInst - ? eventTypes$1.responderMove + ? eventTypes.responderMove : depthA - ? eventTypes$1.responderEnd + ? eventTypes.responderEnd : null) ) (JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled( @@ -925,9 +941,9 @@ var eventTypes$1 = { } if ( (topLevelType = JSCompiler_temp$jscomp$0 - ? eventTypes$1.responderTerminate + ? eventTypes.responderTerminate : topLevelType - ? eventTypes$1.responderRelease + ? eventTypes.responderRelease : null) ) (nativeEvent = ResponderSyntheticEvent.getPooled( @@ -949,8 +965,20 @@ var eventTypes$1 = { } } }, - ReactNativeBridgeEventPlugin = { - eventTypes: ReactNativeViewConfigRegistry.eventTypes, + customBubblingEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customBubblingEventTypes, + customDirectEventTypes = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry + .customDirectEventTypes; +injection.injectEventPluginOrder([ + "ResponderEventPlugin", + "ReactNativeBridgeEventPlugin" +]); +injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: { + eventTypes: {}, extractEvents: function( topLevelType, targetInst, @@ -958,13 +986,13 @@ var eventTypes$1 = { nativeEventTarget ) { if (null == targetInst) return null; - var bubbleDispatchConfig = - ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType], - directDispatchConfig = - ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType]; + var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], + directDispatchConfig = customDirectEventTypes[topLevelType]; if (!bubbleDispatchConfig && !directDispatchConfig) throw ReactError( - 'Unsupported top level event type "' + topLevelType + '" dispatched' + Error( + 'Unsupported top level event type "' + topLevelType + '" dispatched' + ) ); topLevelType = SyntheticEvent.getPooled( bubbleDispatchConfig || directDispatchConfig, @@ -979,42 +1007,40 @@ var eventTypes$1 = { else return null; return topLevelType; } - }; -injection.injectEventPluginOrder([ - "ResponderEventPlugin", - "ReactNativeBridgeEventPlugin" -]); -injection.injectEventPluginsByName({ - ResponderEventPlugin: ResponderEventPlugin, - ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin + } }); -var instanceCache = {}, - instanceProps = {}; +var instanceCache = new Map(), + instanceProps = new Map(); function getInstanceFromTag(tag) { - return instanceCache[tag] || null; + return instanceCache.get(tag) || null; } var restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { if (getInstanceFromNode(target)) throw ReactError( - "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + Error( + "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." + ) ); } -function _batchedUpdatesImpl(fn, bookkeeping) { +function batchedUpdatesImpl(fn, bookkeeping) { return fn(bookkeeping); } -function _flushInteractiveUpdatesImpl() {} -var isBatching = !1; +function flushDiscreteUpdatesImpl() {} +var isInsideEventHandler = !1; function batchedUpdates(fn, bookkeeping) { - if (isBatching) return fn(bookkeeping); - isBatching = !0; + if (isInsideEventHandler) return fn(bookkeeping); + isInsideEventHandler = !0; try { - return _batchedUpdatesImpl(fn, bookkeeping); + return batchedUpdatesImpl(fn, bookkeeping); } finally { - if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue)) + if ( + ((isInsideEventHandler = !1), + null !== restoreTarget || null !== restoreQueue) + ) if ( - (_flushInteractiveUpdatesImpl(), + (flushDiscreteUpdatesImpl(), restoreTarget && ((bookkeeping = restoreTarget), (fn = restoreQueue), @@ -1051,7 +1077,9 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { forEachAccumulated(events, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw ReactError( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + Error( + "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + ) ); if (hasRethrowError) throw ((events = rethrowError), @@ -1061,7 +1089,7 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { } }); } -RCTEventEmitter.register({ +ReactNativePrivateInterface.RCTEventEmitter.register({ receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) { _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); }, @@ -1099,26 +1127,31 @@ RCTEventEmitter.register({ } }); getFiberCurrentPropsFromNode = function(stateNode) { - return instanceProps[stateNode._nativeTag] || null; + return instanceProps.get(stateNode._nativeTag) || null; }; getInstanceFromNode = getInstanceFromTag; getNodeFromInstance = function(inst) { var tag = inst.stateNode._nativeTag; void 0 === tag && (tag = inst.stateNode.canonical._nativeTag); - if (!tag) throw ReactError("All native instances should have a tag."); + if (!tag) throw ReactError(Error("All native instances should have a tag.")); return tag; }; ResponderEventPlugin.injection.injectGlobalResponderHandler({ onChange: function(from, to, blockNativeResponder) { null !== to - ? UIManager.setJSResponder(to.stateNode._nativeTag, blockNativeResponder) - : UIManager.clearJSResponder(); + ? ReactNativePrivateInterface.UIManager.setJSResponder( + to.stateNode._nativeTag, + blockNativeResponder + ) + : ReactNativePrivateInterface.UIManager.clearJSResponder(); } }); var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") || (ReactSharedInternals.ReactCurrentDispatcher = { current: null }); +ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig") || + (ReactSharedInternals.ReactCurrentBatchConfig = { suspense: null }); var hasSymbol = "function" === typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, @@ -1132,11 +1165,13 @@ var hasSymbol = "function" === typeof Symbol && Symbol.for, : 60111, REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, + REACT_SUSPENSE_LIST_TYPE = hasSymbol + ? Symbol.for("react.suspense_list") + : 60120, REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116; -hasSymbol && Symbol.for("react.event_component"); -hasSymbol && Symbol.for("react.event_target"); -hasSymbol && Symbol.for("react.event_target.touch_hit"); +hasSymbol && Symbol.for("react.fundamental"); +hasSymbol && Symbol.for("react.responder"); var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; @@ -1150,8 +1185,6 @@ function getComponentName(type) { if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return "ConcurrentMode"; case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: @@ -1162,6 +1195,8 @@ function getComponentName(type) { return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { @@ -1196,14 +1231,14 @@ function isFiberMountedImpl(fiber) { } function assertIsMounted(fiber) { if (2 !== isFiberMountedImpl(fiber)) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = isFiberMountedImpl(fiber); if (3 === alternate) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return 1 === alternate ? null : fiber; } for (var a = fiber, b = alternate; ; ) { @@ -1224,7 +1259,7 @@ function findCurrentFiberUsingSlowPath(fiber) { if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); } if (a.return !== b.return) (a = parentA), (b = parentB); else { @@ -1261,17 +1296,21 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (!didFindChild) throw ReactError( - "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ) ); } } if (a.alternate !== b) throw ReactError( - "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (3 !== a.tag) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiber(parent) { @@ -1376,14 +1415,14 @@ function diffNestedProperty( return Array.isArray(prevProp) ? diffProperties( updatePayload, - flattenStyle(prevProp), + ReactNativePrivateInterface.flattenStyle(prevProp), nextProp, validAttributes ) : diffProperties( updatePayload, prevProp, - flattenStyle(nextProp), + ReactNativePrivateInterface.flattenStyle(nextProp), validAttributes ); } @@ -1451,7 +1490,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { if ("object" !== typeof attributeConfig) ("object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) && + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) && ((updatePayload || (updatePayload = {}))[propKey] = nextProp); else if ( "function" === typeof attributeConfig.diff || @@ -1463,7 +1502,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { ? attributeConfig.diff(prevProp, nextProp) : "object" !== typeof nextProp || null === nextProp || - deepDiffer(prevProp, nextProp)) + ReactNativePrivateInterface.deepDiffer(prevProp, nextProp)) ) (attributeConfig = "function" === typeof attributeConfig.process @@ -1528,19 +1567,19 @@ var ReactNativeFiberHostComponent = (function() { this.viewConfig = viewConfig; } ReactNativeFiberHostComponent.prototype.blur = function() { - TextInputState.blurTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.blurTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.focus = function() { - TextInputState.focusTextInput(this._nativeTag); + ReactNativePrivateInterface.TextInputState.focusTextInput(this._nativeTag); }; ReactNativeFiberHostComponent.prototype.measure = function(callback) { - UIManager.measure( + ReactNativePrivateInterface.UIManager.measure( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); }; ReactNativeFiberHostComponent.prototype.measureInWindow = function(callback) { - UIManager.measureInWindow( + ReactNativePrivateInterface.UIManager.measureInWindow( this._nativeTag, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ); @@ -1559,7 +1598,7 @@ var ReactNativeFiberHostComponent = (function() { relativeToNativeNode.canonical._nativeTag && (relativeNode = relativeToNativeNode.canonical._nativeTag); null != relativeNode && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( this._nativeTag, relativeNode, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -1576,7 +1615,7 @@ var ReactNativeFiberHostComponent = (function() { this.viewConfig.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( this._nativeTag, this.viewConfig.uiViewClassName, nativeProps @@ -1586,10 +1625,14 @@ var ReactNativeFiberHostComponent = (function() { })(); function shim$1() { throw ReactError( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + Error( + "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." + ) ); } -var UPDATE_SIGNAL = {}, +var getViewConfigForType = + ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get, + UPDATE_SIGNAL = {}, nextReactTag = 3; function allocateTag() { var tag = nextReactTag; @@ -1599,11 +1642,11 @@ function allocateTag() { } function recursivelyUncacheFiberNode(node) { if ("number" === typeof node) - delete instanceCache[node], delete instanceProps[node]; + instanceCache.delete(node), instanceProps.delete(node); else { var tag = node._nativeTag; - delete instanceCache[tag]; - delete instanceProps[tag]; + instanceCache.delete(tag); + instanceProps.delete(tag); node._children.forEach(recursivelyUncacheFiberNode); } } @@ -1612,7 +1655,10 @@ function finalizeInitialChildren(parentInstance) { var nativeTags = parentInstance._children.map(function(child) { return "number" === typeof child ? child : child._nativeTag; }); - UIManager.setChildren(parentInstance._nativeTag, nativeTags); + ReactNativePrivateInterface.UIManager.setChildren( + parentInstance._nativeTag, + nativeTags + ); return !1; } var scheduleTimeout = setTimeout, @@ -1703,7 +1749,9 @@ function popTopLevelContextObject(fiber) { function pushTopLevelContextObject(fiber, context, didChange) { if (contextStackCursor.current !== emptyContextObject) throw ReactError( - "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." + Error( + "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); @@ -1716,10 +1764,12 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in instance) if (!(contextKey in fiber)) throw ReactError( - (getComponentName(type) || "Unknown") + - '.getChildContext(): key "' + - contextKey + - '" is not defined in childContextTypes.' + Error( + (getComponentName(type) || "Unknown") + + '.getChildContext(): key "' + + contextKey + + '" is not defined in childContextTypes.' + ) ); return Object.assign({}, parentContext, instance); } @@ -1741,7 +1791,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.stateNode; if (!instance) throw ReactError( - "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." + ) ); didChange ? ((type = processChildContext(workInProgress, type, previousContext)), @@ -1752,35 +1804,11 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } -var onCommitFiberRoot = null, - onCommitFiberUnmount = null; -function catchErrors(fn) { - return function(arg) { - try { - return fn(arg); - } catch (err) {} - }; -} -var isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; -function injectInternals(internals) { - if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled || !hook.supportsFiber) return !0; - try { - var rendererID = hook.inject(internals); - onCommitFiberRoot = catchErrors(function(root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function(fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) {} - return !0; -} var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, Scheduler_shouldYield = Scheduler.unstable_shouldYield, + Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, @@ -1794,12 +1822,16 @@ if ( null == tracing.__interactionsRef.current ) throw ReactError( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" + ) ); var fakeCallbackNode = {}, - immediateQueue = null, + requestPaint = + void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, + syncQueue = null, immediateQueueCallbackNode = null, - isFlushingImmediate = !1, + isFlushingSyncQueue = !1, initialTimeMs = Scheduler_now(), now = 1e4 > initialTimeMs @@ -1820,7 +1852,7 @@ function getCurrentPriorityLevel() { case Scheduler_IdlePriority: return 95; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function reactPriorityToSchedulerPriority(reactPriorityLevel) { @@ -1836,7 +1868,7 @@ function reactPriorityToSchedulerPriority(reactPriorityLevel) { case 95: return Scheduler_IdlePriority; default: - throw ReactError("Unknown priority level."); + throw ReactError(Error("Unknown priority level.")); } } function runWithPriority(reactPriorityLevel, fn) { @@ -1844,46 +1876,47 @@ function runWithPriority(reactPriorityLevel, fn) { return Scheduler_runWithPriority(reactPriorityLevel, fn); } function scheduleCallback(reactPriorityLevel, callback, options) { - if (99 === reactPriorityLevel) - return ( - null === immediateQueue - ? ((immediateQueue = [callback]), - (immediateQueueCallbackNode = Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushImmediateQueueImpl - ))) - : immediateQueue.push(callback), - fakeCallbackNode - ); reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); } -function flushImmediateQueue() { +function scheduleSyncCallback(callback) { + null === syncQueue + ? ((syncQueue = [callback]), + (immediateQueueCallbackNode = Scheduler_scheduleCallback( + Scheduler_ImmediatePriority, + flushSyncCallbackQueueImpl + ))) + : syncQueue.push(callback); + return fakeCallbackNode; +} +function flushSyncCallbackQueue() { null !== immediateQueueCallbackNode && Scheduler_cancelCallback(immediateQueueCallbackNode); - flushImmediateQueueImpl(); + flushSyncCallbackQueueImpl(); } -function flushImmediateQueueImpl() { - if (!isFlushingImmediate && null !== immediateQueue) { - isFlushingImmediate = !0; +function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; var i = 0; try { - for (; i < immediateQueue.length; i++) { - var callback = immediateQueue[i]; - do callback = callback(!0); - while (null !== callback); - } - immediateQueue = null; + var queue = syncQueue; + runWithPriority(99, function() { + for (; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + }); + syncQueue = null; } catch (error) { - throw (null !== immediateQueue && - (immediateQueue = immediateQueue.slice(i + 1)), + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), Scheduler_scheduleCallback( Scheduler_ImmediatePriority, - flushImmediateQueue + flushSyncCallbackQueue ), error); } finally { - isFlushingImmediate = !1; + isFlushingSyncQueue = !1; } } } @@ -1891,7 +1924,7 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { if (1073741823 === expirationTime) return 99; if (1 === expirationTime) return 95; currentTime = - 10 * (1073741822 - expirationTime) - 10 * (1073741822 - currentTime); + 10 * (1073741821 - expirationTime) - 10 * (1073741821 - currentTime); return 0 >= currentTime ? 99 : 250 >= currentTime @@ -1900,196 +1933,6 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) { ? 97 : 95; } -function FiberNode(tag, pendingProps, key, mode) { - this.tag = tag; - this.key = key; - this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.contextDependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; - this.mode = mode; - this.effectTag = 0; - this.lastEffect = this.firstEffect = this.nextEffect = null; - this.childExpirationTime = this.expirationTime = 0; - this.alternate = null; - this.actualDuration = 0; - this.actualStartTime = -1; - this.treeBaseDuration = this.selfBaseDuration = 0; -} -function createFiber(tag, pendingProps, key, mode) { - return new FiberNode(tag, pendingProps, key, mode); -} -function shouldConstruct(Component) { - Component = Component.prototype; - return !(!Component || !Component.isReactComponent); -} -function resolveLazyComponentTag(Component) { - if ("function" === typeof Component) - return shouldConstruct(Component) ? 1 : 0; - if (void 0 !== Component && null !== Component) { - Component = Component.$$typeof; - if (Component === REACT_FORWARD_REF_TYPE) return 11; - if (Component === REACT_MEMO_TYPE) return 14; - } - return 2; -} -function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - null === workInProgress - ? ((workInProgress = createFiber( - current.tag, - pendingProps, - current.key, - current.mode - )), - (workInProgress.elementType = current.elementType), - (workInProgress.type = current.type), - (workInProgress.stateNode = current.stateNode), - (workInProgress.alternate = current), - (current.alternate = workInProgress)) - : ((workInProgress.pendingProps = pendingProps), - (workInProgress.effectTag = 0), - (workInProgress.nextEffect = null), - (workInProgress.firstEffect = null), - (workInProgress.lastEffect = null), - (workInProgress.actualDuration = 0), - (workInProgress.actualStartTime = -1)); - workInProgress.childExpirationTime = current.childExpirationTime; - workInProgress.expirationTime = current.expirationTime; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; - workInProgress.contextDependencies = current.contextDependencies; - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - return workInProgress; -} -function createFiberFromTypeAndProps( - type, - key, - pendingProps, - owner, - mode, - expirationTime -) { - var fiberTag = 2; - owner = type; - if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); - else if ("string" === typeof type) fiberTag = 5; - else - a: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment( - pendingProps.children, - mode, - expirationTime, - key - ); - case REACT_CONCURRENT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 3, expirationTime, key); - case REACT_STRICT_MODE_TYPE: - return createFiberFromMode(pendingProps, mode | 2, expirationTime, key); - case REACT_PROFILER_TYPE: - return ( - (type = createFiber(12, pendingProps, key, mode | 4)), - (type.elementType = REACT_PROFILER_TYPE), - (type.type = REACT_PROFILER_TYPE), - (type.expirationTime = expirationTime), - type - ); - case REACT_SUSPENSE_TYPE: - return ( - (type = createFiber(13, pendingProps, key, mode)), - (type.elementType = REACT_SUSPENSE_TYPE), - (type.type = REACT_SUSPENSE_TYPE), - (type.expirationTime = expirationTime), - type - ); - default: - if ("object" === typeof type && null !== type) - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = 10; - break a; - case REACT_CONTEXT_TYPE: - fiberTag = 9; - break a; - case REACT_FORWARD_REF_TYPE: - fiberTag = 11; - break a; - case REACT_MEMO_TYPE: - fiberTag = 14; - break a; - case REACT_LAZY_TYPE: - fiberTag = 16; - owner = null; - break a; - } - throw ReactError( - "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." - ); - } - key = createFiber(fiberTag, pendingProps, key, mode); - key.elementType = type; - key.type = owner; - key.expirationTime = expirationTime; - return key; -} -function createFiberFromFragment(elements, mode, expirationTime, key) { - elements = createFiber(7, elements, key, mode); - elements.expirationTime = expirationTime; - return elements; -} -function createFiberFromMode(pendingProps, mode, expirationTime, key) { - pendingProps = createFiber(8, pendingProps, key, mode); - mode = 0 === (mode & 1) ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE; - pendingProps.elementType = mode; - pendingProps.type = mode; - pendingProps.expirationTime = expirationTime; - return pendingProps; -} -function createFiberFromText(content, mode, expirationTime) { - content = createFiber(6, content, null, mode); - content.expirationTime = expirationTime; - return content; -} -function createFiberFromPortal(portal, mode, expirationTime) { - mode = createFiber( - 4, - null !== portal.children ? portal.children : [], - portal.key, - mode - ); - mode.expirationTime = expirationTime; - mode.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - implementation: portal.implementation - }; - return mode; -} -function FiberRootNode(containerInfo, hydrate) { - this.current = null; - this.containerInfo = containerInfo; - this.pingCache = this.pendingChildren = null; - this.pendingCommitExpirationTime = 0; - this.finishedWork = null; - this.timeoutHandle = -1; - this.pendingContext = this.context = null; - this.hydrate = hydrate; - this.callbackNode = this.firstBatch = null; - this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; - this.interactionThreadID = tracing.unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); -} function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } @@ -2163,7 +2006,7 @@ var valueCursor = { current: null }, currentlyRenderingFiber = null, lastContextDependency = null, lastContextWithAllBitsObserved = null; -function resetContextDependences() { +function resetContextDependencies() { lastContextWithAllBitsObserved = lastContextDependency = currentlyRenderingFiber = null; } function pushProvider(providerFiber, nextValue) { @@ -2176,14 +2019,32 @@ function popProvider(providerFiber) { pop(valueCursor, providerFiber); providerFiber.type._context._currentValue = currentValue; } +function scheduleWorkOnParentPath(parent, renderExpirationTime) { + for (; null !== parent; ) { + var alternate = parent.alternate; + if (parent.childExpirationTime < renderExpirationTime) + (parent.childExpirationTime = renderExpirationTime), + null !== alternate && + alternate.childExpirationTime < renderExpirationTime && + (alternate.childExpirationTime = renderExpirationTime); + else if ( + null !== alternate && + alternate.childExpirationTime < renderExpirationTime + ) + alternate.childExpirationTime = renderExpirationTime; + else break; + parent = parent.return; + } +} function prepareToReadContext(workInProgress, renderExpirationTime) { currentlyRenderingFiber = workInProgress; lastContextWithAllBitsObserved = lastContextDependency = null; - var currentDependencies = workInProgress.contextDependencies; - null !== currentDependencies && - currentDependencies.expirationTime >= renderExpirationTime && - (didReceiveUpdate = !0); - workInProgress.contextDependencies = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (workInProgress.expirationTime >= renderExpirationTime && + (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } function readContext(context, observedBits) { if ( @@ -2197,12 +2058,15 @@ function readContext(context, observedBits) { if (null === lastContextDependency) { if (null === currentlyRenderingFiber) throw ReactError( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ) ); lastContextDependency = observedBits; - currentlyRenderingFiber.contextDependencies = { - first: observedBits, - expirationTime: 0 + currentlyRenderingFiber.dependencies = { + expirationTime: 0, + firstContext: observedBits, + responders: null }; } else lastContextDependency = lastContextDependency.next = observedBits; } @@ -2235,9 +2099,10 @@ function cloneUpdateQueue(currentQueue) { lastCapturedEffect: null }; } -function createUpdate(expirationTime) { +function createUpdate(expirationTime, suspenseConfig) { return { expirationTime: expirationTime, + suspenseConfig: suspenseConfig, tag: 0, payload: null, callback: null, @@ -2353,8 +2218,10 @@ function processUpdateQueue( ((newFirstUpdate = update), (newBaseState = resultState)), newExpirationTime < updateExpirationTime && (newExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + update.suspenseConfig + ), (resultState = getStateFromUpdate( workInProgress, queue, @@ -2430,15 +2297,18 @@ function commitUpdateEffects(effect, instance) { var context = instance; if ("function" !== typeof _callback3) throw ReactError( - "Invalid argument passed as callback. Expected a function. Instead received: " + - _callback3 + Error( + "Invalid argument passed as callback. Expected a function. Instead received: " + + _callback3 + ) ); _callback3.call(context); } effect = effect.nextEffect; } } -var emptyRefsObject = new React.Component().refs; +var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + emptyRefsObject = new React.Component().refs; function applyDerivedStateFromProps( workInProgress, ctor, @@ -2465,36 +2335,42 @@ var classComponentUpdater = { }, enqueueSetState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 1; - update.payload = payload; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 1; + suspenseConfig.payload = payload; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternalFiber; - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, inst); - var update = createUpdate(currentTime); - update.tag = 2; - void 0 !== callback && null !== callback && (update.callback = callback); - flushPassiveEffects(); - enqueueUpdate(inst, update); + var currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber(currentTime, inst, suspenseConfig); + suspenseConfig = createUpdate(currentTime, suspenseConfig); + suspenseConfig.tag = 2; + void 0 !== callback && + null !== callback && + (suspenseConfig.callback = callback); + enqueueUpdate(inst, suspenseConfig); scheduleUpdateOnFiber(inst, currentTime); } }; @@ -2623,15 +2499,19 @@ function coerceRef(returnFiber, current$$1, element) { if (element) { if (1 !== element.tag) throw ReactError( - "Function components cannot have refs. Did you mean to use React.forwardRef()?" + Error( + "Function components cannot have refs. Did you mean to use React.forwardRef()?" + ) ); inst = element.stateNode; } if (!inst) throw ReactError( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." + Error( + "Missing owner for string ref " + + returnFiber + + ". This error is likely caused by a bug in React. Please file an issue." + ) ); var stringRef = "" + returnFiber; if ( @@ -2651,13 +2531,17 @@ function coerceRef(returnFiber, current$$1, element) { } if ("string" !== typeof returnFiber) throw ReactError( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ) ); if (!element._owner) throw ReactError( - "Element ref was specified as a string (" + - returnFiber + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + Error( + "Element ref was specified as a string (" + + returnFiber + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." + ) ); } return returnFiber; @@ -2665,11 +2549,13 @@ function coerceRef(returnFiber, current$$1, element) { function throwOnInvalidObjectType(returnFiber, newChild) { if ("textarea" !== returnFiber.type) throw ReactError( - "Objects are not valid as a React child (found: " + - ("[object Object]" === Object.prototype.toString.call(newChild) - ? "object with keys {" + Object.keys(newChild).join(", ") + "}" - : newChild) + - ")." + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === Object.prototype.toString.call(newChild) + ? "object with keys {" + Object.keys(newChild).join(", ") + "}" + : newChild) + + ")." + ) ); } function ChildReconciler(shouldTrackSideEffects) { @@ -3072,11 +2958,13 @@ function ChildReconciler(shouldTrackSideEffects) { var iteratorFn = getIteratorFn(newChildrenIterable); if ("function" !== typeof iteratorFn) throw ReactError( - "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + Error( + "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." + ) ); newChildrenIterable = iteratorFn.call(newChildrenIterable); if (null == newChildrenIterable) - throw ReactError("An iterable object provided no iterator."); + throw ReactError(Error("An iterable object provided no iterator.")); for ( var previousNewFiber = (iteratorFn = null), oldFiber = currentFirstChild, @@ -3311,8 +3199,10 @@ function ChildReconciler(shouldTrackSideEffects) { case 0: throw ((returnFiber = returnFiber.type), ReactError( - (returnFiber.displayName || returnFiber.name || "Component") + - "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + Error( + (returnFiber.displayName || returnFiber.name || "Component") + + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." + ) )); } return deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3327,7 +3217,9 @@ var reconcileChildFibers = ChildReconciler(!0), function requiredContext(c) { if (c === NO_CONTEXT) throw ReactError( - "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ) ); return c; } @@ -3365,6 +3257,34 @@ function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor$1, fiber), pop(contextFiberStackCursor, fiber)); } +var SubtreeSuspenseContextMask = 1, + InvisibleParentSuspenseContext = 1, + ForceSuspenseFallback = 2, + suspenseStackCursor = { current: 0 }; +function findFirstSuspended(row) { + for (var node = row; null !== node; ) { + if (13 === node.tag) { + if (null !== node.memoizedState) return node; + } else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) { + if (0 !== (node.effectTag & 64)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; +} +function createResponderListener(responder, props) { + return { responder: responder, props: props }; +} var NoEffect$1 = 0, UnmountSnapshot = 2, UnmountMutation = 4, @@ -3389,7 +3309,9 @@ var NoEffect$1 = 0, numberOfReRenders = 0; function throwInvalidHookError() { throw ReactError( - "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + Error( + "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." + ) ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -3439,7 +3361,9 @@ function renderWithHooks( sideEffectTag = 0; if (current) throw ReactError( - "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + Error( + "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." + ) ); return workInProgress; } @@ -3475,7 +3399,9 @@ function updateWorkInProgressHook() { (nextCurrentHook = null !== currentHook ? currentHook.next : null); else { if (null === nextCurrentHook) - throw ReactError("Rendered more hooks than during the previous render."); + throw ReactError( + Error("Rendered more hooks than during the previous render.") + ); currentHook = nextCurrentHook; var newHook = { memoizedState: currentHook.memoizedState, @@ -3500,7 +3426,9 @@ function updateReducer(reducer) { queue = hook.queue; if (null === queue) throw ReactError( - "Should have a queue. This is likely a bug in React. Please file an issue." + Error( + "Should have a queue. This is likely a bug in React. Please file an issue." + ) ); queue.lastRenderedReducer = reducer; if (0 < numberOfReRenders) { @@ -3543,8 +3471,10 @@ function updateReducer(reducer) { (firstRenderPhaseUpdate = newState)), updateExpirationTime > remainingExpirationTime && (remainingExpirationTime = updateExpirationTime)) - : (updateExpirationTime < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = updateExpirationTime), + : (markRenderEventTimeAndConfig( + updateExpirationTime, + _update.suspenseConfig + ), (newState = _update.eagerReducer === reducer ? _update.eagerState @@ -3623,7 +3553,9 @@ function mountDebugValue() {} function dispatchAction(fiber, queue, action) { if (!(25 > numberOfReRenders)) throw ReactError( - "Too many re-renders. React limits the number of renders to prevent an infinite loop." + Error( + "Too many re-renders. React limits the number of renders to prevent an infinite loop." + ) ); var alternate = fiber.alternate; if ( @@ -3634,6 +3566,7 @@ function dispatchAction(fiber, queue, action) { ((didScheduleRenderPhaseUpdate = !0), (fiber = { expirationTime: renderExpirationTime$1, + suspenseConfig: null, action: action, eagerReducer: null, eagerState: null, @@ -3649,24 +3582,29 @@ function dispatchAction(fiber, queue, action) { queue.next = fiber; } else { - flushPassiveEffects(); - var currentTime = requestCurrentTime(); - currentTime = computeExpirationForFiber(currentTime, fiber); - var _update2 = { - expirationTime: currentTime, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }, - _last = queue.last; - if (null === _last) _update2.next = _update2; + var currentTime = requestCurrentTime(), + _suspenseConfig = ReactCurrentBatchConfig.suspense; + currentTime = computeExpirationForFiber( + currentTime, + fiber, + _suspenseConfig + ); + _suspenseConfig = { + expirationTime: currentTime, + suspenseConfig: _suspenseConfig, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; + var _last = queue.last; + if (null === _last) _suspenseConfig.next = _suspenseConfig; else { var first = _last.next; - null !== first && (_update2.next = first); - _last.next = _update2; + null !== first && (_suspenseConfig.next = first); + _last.next = _suspenseConfig; } - queue.last = _update2; + queue.last = _suspenseConfig; if ( 0 === fiber.expirationTime && (null === alternate || 0 === alternate.expirationTime) && @@ -3675,8 +3613,8 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, _eagerState = alternate(currentState, action); - _update2.eagerReducer = alternate; - _update2.eagerState = _eagerState; + _suspenseConfig.eagerReducer = alternate; + _suspenseConfig.eagerState = _eagerState; if (is(_eagerState, currentState)) return; } catch (error) { } finally { @@ -3695,7 +3633,8 @@ var ContextOnlyDispatcher = { useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError + useDebugValue: throwInvalidHookError, + useResponder: throwInvalidHookError }, HooksDispatcherOnMount = { readContext: readContext, @@ -3768,7 +3707,8 @@ var ContextOnlyDispatcher = { ); return [hook.memoizedState, initialState]; }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, HooksDispatcherOnUpdate = { readContext: readContext, @@ -3822,7 +3762,8 @@ var ContextOnlyDispatcher = { useState: function(initialState) { return updateReducer(basicStateReducer, initialState); }, - useDebugValue: mountDebugValue + useDebugValue: mountDebugValue, + useResponder: createResponderListener }, now$1 = Scheduler.unstable_now, commitTime = 0, @@ -4052,17 +3993,17 @@ function updateFunctionComponent( nextProps, renderExpirationTime ) { - var unmaskedContext = isContextProvider(Component) + var context = isContextProvider(Component) ? previousContext : contextStackCursor.current; - unmaskedContext = getMaskedContext(workInProgress, unmaskedContext); + context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderExpirationTime); Component = renderWithHooks( current$$1, workInProgress, Component, nextProps, - unmaskedContext, + context, renderExpirationTime ); if (null !== current$$1 && !didReceiveUpdate) @@ -4378,6 +4319,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } +var SUSPENDED_MARKER = {}; function updateSuspenseComponent( current$$1, workInProgress, @@ -4385,35 +4327,50 @@ function updateSuspenseComponent( ) { var mode = workInProgress.mode, nextProps = workInProgress.pendingProps, - nextState = workInProgress.memoizedState; - if (0 === (workInProgress.effectTag & 64)) { - nextState = null; - var nextDidTimeout = !1; - } else - (nextState = { - fallbackExpirationTime: - null !== nextState ? nextState.fallbackExpirationTime : 0 - }), + suspenseContext = suspenseStackCursor.current, + nextState = null, + nextDidTimeout = !1, + JSCompiler_temp; + (JSCompiler_temp = 0 !== (workInProgress.effectTag & 64)) || + (JSCompiler_temp = + 0 !== (suspenseContext & ForceSuspenseFallback) && + (null === current$$1 || null !== current$$1.memoizedState)); + JSCompiler_temp + ? ((nextState = SUSPENDED_MARKER), (nextDidTimeout = !0), - (workInProgress.effectTag &= -65); + (workInProgress.effectTag &= -65)) + : (null !== current$$1 && null === current$$1.memoizedState) || + void 0 === nextProps.fallback || + !0 === nextProps.unstable_avoidThisFallback || + (suspenseContext |= InvisibleParentSuspenseContext); + suspenseContext &= SubtreeSuspenseContextMask; + push(suspenseStackCursor, suspenseContext, workInProgress); if (null === current$$1) if (nextDidTimeout) { - var nextFallbackChildren = nextProps.fallback; + nextProps = nextProps.fallback; current$$1 = createFiberFromFragment(null, mode, 0, null); - 0 === (workInProgress.mode & 1) && - (current$$1.child = - null !== workInProgress.memoizedState - ? workInProgress.child.child - : workInProgress.child); + current$$1.return = workInProgress; + if (0 === (workInProgress.mode & 2)) + for ( + nextDidTimeout = + null !== workInProgress.memoizedState + ? workInProgress.child.child + : workInProgress.child, + current$$1.child = nextDidTimeout; + null !== nextDidTimeout; + + ) + (nextDidTimeout.return = current$$1), + (nextDidTimeout = nextDidTimeout.sibling); renderExpirationTime = createFiberFromFragment( - nextFallbackChildren, + nextProps, mode, renderExpirationTime, null ); + renderExpirationTime.return = workInProgress; current$$1.sibling = renderExpirationTime; mode = current$$1; - mode.return = renderExpirationTime.return = workInProgress; } else mode = renderExpirationTime = mountChildFibers( workInProgress, @@ -4424,95 +4381,235 @@ function updateSuspenseComponent( else { if (null !== current$$1.memoizedState) if ( - ((nextFallbackChildren = current$$1.child), - (mode = nextFallbackChildren.sibling), + ((suspenseContext = current$$1.child), + (mode = suspenseContext.sibling), nextDidTimeout) ) { nextProps = nextProps.fallback; renderExpirationTime = createWorkInProgress( - nextFallbackChildren, - nextFallbackChildren.pendingProps, + suspenseContext, + suspenseContext.pendingProps, 0 ); - 0 === (workInProgress.mode & 1) && + renderExpirationTime.return = workInProgress; + if ( + 0 === (workInProgress.mode & 2) && ((nextDidTimeout = null !== workInProgress.memoizedState ? workInProgress.child.child : workInProgress.child), - nextDidTimeout !== nextFallbackChildren.child && - (renderExpirationTime.child = nextDidTimeout)); - if (workInProgress.mode & 4) { - nextFallbackChildren = 0; + nextDidTimeout !== suspenseContext.child) + ) for ( - nextDidTimeout = renderExpirationTime.child; + renderExpirationTime.child = nextDidTimeout; null !== nextDidTimeout; ) - (nextFallbackChildren += nextDidTimeout.treeBaseDuration), + (nextDidTimeout.return = renderExpirationTime), (nextDidTimeout = nextDidTimeout.sibling); - renderExpirationTime.treeBaseDuration = nextFallbackChildren; + if (workInProgress.mode & 8) { + nextDidTimeout = 0; + for ( + suspenseContext = renderExpirationTime.child; + null !== suspenseContext; + + ) + (nextDidTimeout += suspenseContext.treeBaseDuration), + (suspenseContext = suspenseContext.sibling); + renderExpirationTime.treeBaseDuration = nextDidTimeout; } - nextFallbackChildren = renderExpirationTime.sibling = createWorkInProgress( - mode, - nextProps, - mode.expirationTime - ); + nextProps = createWorkInProgress(mode, nextProps, mode.expirationTime); + nextProps.return = workInProgress; + renderExpirationTime.sibling = nextProps; mode = renderExpirationTime; renderExpirationTime.childExpirationTime = 0; - renderExpirationTime = nextFallbackChildren; - mode.return = renderExpirationTime.return = workInProgress; + renderExpirationTime = nextProps; } else mode = renderExpirationTime = reconcileChildFibers( workInProgress, - nextFallbackChildren.child, + suspenseContext.child, nextProps.children, renderExpirationTime ); - else { - var _currentPrimaryChild = current$$1.child; - if (nextDidTimeout) { - nextProps = nextProps.fallback; - nextFallbackChildren = createFiberFromFragment(null, mode, 0, null); - nextFallbackChildren.child = _currentPrimaryChild; - 0 === (workInProgress.mode & 1) && - (nextFallbackChildren.child = + else if (((suspenseContext = current$$1.child), nextDidTimeout)) { + nextDidTimeout = nextProps.fallback; + nextProps = createFiberFromFragment(null, mode, 0, null); + nextProps.return = workInProgress; + nextProps.child = suspenseContext; + null !== suspenseContext && (suspenseContext.return = nextProps); + if (0 === (workInProgress.mode & 2)) + for ( + suspenseContext = null !== workInProgress.memoizedState ? workInProgress.child.child - : workInProgress.child); - if (workInProgress.mode & 4) { - nextDidTimeout = 0; - for ( - _currentPrimaryChild = nextFallbackChildren.child; - null !== _currentPrimaryChild; + : workInProgress.child, + nextProps.child = suspenseContext; + null !== suspenseContext; + ) + (suspenseContext.return = nextProps), + (suspenseContext = suspenseContext.sibling); + if (workInProgress.mode & 8) { + suspenseContext = 0; + for (JSCompiler_temp = nextProps.child; null !== JSCompiler_temp; ) + (suspenseContext += JSCompiler_temp.treeBaseDuration), + (JSCompiler_temp = JSCompiler_temp.sibling); + nextProps.treeBaseDuration = suspenseContext; + } + renderExpirationTime = createFiberFromFragment( + nextDidTimeout, + mode, + renderExpirationTime, + null + ); + renderExpirationTime.return = workInProgress; + nextProps.sibling = renderExpirationTime; + renderExpirationTime.effectTag |= 2; + mode = nextProps; + nextProps.childExpirationTime = 0; + } else + renderExpirationTime = mode = reconcileChildFibers( + workInProgress, + suspenseContext, + nextProps.children, + renderExpirationTime + ); + workInProgress.stateNode = current$$1.stateNode; + } + workInProgress.memoizedState = nextState; + workInProgress.child = mode; + return renderExpirationTime; +} +function initSuspenseListRenderState( + workInProgress, + isBackwards, + tail, + lastContentRow, + tailMode +) { + var renderState = workInProgress.memoizedState; + null === renderState + ? (workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + last: lastContentRow, + tail: tail, + tailExpiration: 0, + tailMode: tailMode + }) + : ((renderState.isBackwards = isBackwards), + (renderState.rendering = null), + (renderState.last = lastContentRow), + (renderState.tail = tail), + (renderState.tailExpiration = 0), + (renderState.tailMode = tailMode)); +} +function updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime +) { + var nextProps = workInProgress.pendingProps, + revealOrder = nextProps.revealOrder, + tailMode = nextProps.tail; + reconcileChildren( + current$$1, + workInProgress, + nextProps.children, + renderExpirationTime + ); + nextProps = suspenseStackCursor.current; + if (0 !== (nextProps & ForceSuspenseFallback)) + (nextProps = + (nextProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback), + (workInProgress.effectTag |= 64); + else { + if (null !== current$$1 && 0 !== (current$$1.effectTag & 64)) + a: for (current$$1 = workInProgress.child; null !== current$$1; ) { + if (13 === current$$1.tag) { + if (null !== current$$1.memoizedState) { + current$$1.expirationTime < renderExpirationTime && + (current$$1.expirationTime = renderExpirationTime); + var alternate = current$$1.alternate; + null !== alternate && + alternate.expirationTime < renderExpirationTime && + (alternate.expirationTime = renderExpirationTime); + scheduleWorkOnParentPath(current$$1.return, renderExpirationTime); + } + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + if (current$$1 === workInProgress) break a; + for (; null === current$$1.sibling; ) { + if ( + null === current$$1.return || + current$$1.return === workInProgress ) - (nextDidTimeout += _currentPrimaryChild.treeBaseDuration), - (_currentPrimaryChild = _currentPrimaryChild.sibling); - nextFallbackChildren.treeBaseDuration = nextDidTimeout; + break a; + current$$1 = current$$1.return; } - renderExpirationTime = nextFallbackChildren.sibling = createFiberFromFragment( - nextProps, - mode, + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + nextProps &= SubtreeSuspenseContextMask; + } + push(suspenseStackCursor, nextProps, workInProgress); + if (0 === (workInProgress.mode & 2)) workInProgress.memoizedState = null; + else + switch (revealOrder) { + case "forwards": + renderExpirationTime = workInProgress.child; + for (revealOrder = null; null !== renderExpirationTime; ) + (nextProps = renderExpirationTime.alternate), + null !== nextProps && + null === findFirstSuspended(nextProps) && + (revealOrder = renderExpirationTime), + (renderExpirationTime = renderExpirationTime.sibling); + renderExpirationTime = revealOrder; + null === renderExpirationTime + ? ((revealOrder = workInProgress.child), + (workInProgress.child = null)) + : ((revealOrder = renderExpirationTime.sibling), + (renderExpirationTime.sibling = null)); + initSuspenseListRenderState( + workInProgress, + !1, + revealOrder, renderExpirationTime, - null + tailMode ); - renderExpirationTime.effectTag |= 2; - mode = nextFallbackChildren; - nextFallbackChildren.childExpirationTime = 0; - mode.return = renderExpirationTime.return = workInProgress; - } else - renderExpirationTime = mode = reconcileChildFibers( + break; + case "backwards": + renderExpirationTime = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder; ) { + nextProps = revealOrder.alternate; + if (null !== nextProps && null === findFirstSuspended(nextProps)) { + workInProgress.child = revealOrder; + break; + } + nextProps = revealOrder.sibling; + revealOrder.sibling = renderExpirationTime; + renderExpirationTime = revealOrder; + revealOrder = nextProps; + } + initSuspenseListRenderState( workInProgress, - _currentPrimaryChild, - nextProps.children, - renderExpirationTime + !0, + renderExpirationTime, + null, + tailMode ); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0); + break; + default: + workInProgress.memoizedState = null; } - workInProgress.stateNode = current$$1.stateNode; - } - workInProgress.memoizedState = nextState; - workInProgress.child = mode; - return renderExpirationTime; + return workInProgress.child; } function bailoutOnAlreadyFinishedWork( current$$1, @@ -4520,11 +4617,11 @@ function bailoutOnAlreadyFinishedWork( renderExpirationTime ) { null !== current$$1 && - (workInProgress.contextDependencies = current$$1.contextDependencies); + (workInProgress.dependencies = current$$1.dependencies); profilerStartTime = -1; if (workInProgress.childExpirationTime < renderExpirationTime) return null; if (null !== current$$1 && workInProgress.child !== current$$1.child) - throw ReactError("Resuming work not yet implemented."); + throw ReactError(Error("Resuming work not yet implemented.")); if (null !== workInProgress.child) { current$$1 = workInProgress.child; renderExpirationTime = createWorkInProgress( @@ -4580,6 +4677,30 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) { updateHostText$1 = function(current, workInProgress, oldText, newText) { oldText !== newText && (workInProgress.effectTag |= 4); }; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var _lastTailNode = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (_lastTailNode = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === _lastTailNode + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (_lastTailNode.sibling = null); + } +} function completeWork(current, workInProgress, renderExpirationTime) { var newProps = workInProgress.pendingProps; switch (workInProgress.tag) { @@ -4606,50 +4727,54 @@ function completeWork(current, workInProgress, renderExpirationTime) { break; case 5: popHostContext(workInProgress); - renderExpirationTime = requiredContext(rootInstanceStackCursor.current); - var type = workInProgress.type; + var rootContainerInstance = requiredContext( + rootInstanceStackCursor.current + ); + renderExpirationTime = workInProgress.type; if (null !== current && null != workInProgress.stateNode) updateHostComponent$1( current, workInProgress, - type, + renderExpirationTime, newProps, - renderExpirationTime + rootContainerInstance ), current.ref !== workInProgress.ref && (workInProgress.effectTag |= 128); else if (newProps) { current = requiredContext(contextStackCursor$1.current); var tag = allocateTag(), - viewConfig = ReactNativeViewConfigRegistry.get(type), + viewConfig = getViewConfigForType(renderExpirationTime), updatePayload = diffProperties( null, emptyObject, newProps, viewConfig.validAttributes ); - UIManager.createView( + ReactNativePrivateInterface.UIManager.createView( tag, viewConfig.uiViewClassName, - renderExpirationTime, + rootContainerInstance, updatePayload ); viewConfig = new ReactNativeFiberHostComponent(tag, viewConfig); - instanceCache[tag] = workInProgress; - instanceProps[tag] = newProps; + instanceCache.set(tag, workInProgress); + instanceProps.set(tag, newProps); appendAllChildren(viewConfig, workInProgress, !1, !1); finalizeInitialChildren( viewConfig, - type, - newProps, renderExpirationTime, + newProps, + rootContainerInstance, current ) && (workInProgress.effectTag |= 4); workInProgress.stateNode = viewConfig; null !== workInProgress.ref && (workInProgress.effectTag |= 128); } else if (null === workInProgress.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); break; case 6: @@ -4663,54 +4788,65 @@ function completeWork(current, workInProgress, renderExpirationTime) { else { if ("string" !== typeof newProps && null === workInProgress.stateNode) throw ReactError( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ) ); current = requiredContext(rootInstanceStackCursor.current); if (!requiredContext(contextStackCursor$1.current).isInAParentText) throw ReactError( - "Text strings must be rendered within a component." + Error("Text strings must be rendered within a component.") ); - renderExpirationTime = allocateTag(); - UIManager.createView(renderExpirationTime, "RCTRawText", current, { - text: newProps - }); - instanceCache[renderExpirationTime] = workInProgress; - workInProgress.stateNode = renderExpirationTime; + rootContainerInstance = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + rootContainerInstance, + "RCTRawText", + current, + { text: newProps } + ); + instanceCache.set(rootContainerInstance, workInProgress); + workInProgress.stateNode = rootContainerInstance; } break; case 11: break; case 13: + pop(suspenseStackCursor, workInProgress); newProps = workInProgress.memoizedState; if (0 !== (workInProgress.effectTag & 64)) return ( (workInProgress.expirationTime = renderExpirationTime), workInProgress ); newProps = null !== newProps; - renderExpirationTime = !1; + rootContainerInstance = !1; null !== current && - ((type = current.memoizedState), - (renderExpirationTime = null !== type), + ((renderExpirationTime = current.memoizedState), + (rootContainerInstance = null !== renderExpirationTime), newProps || - null === type || - ((type = type.fallbackExpirationTime), - type < workInProgressRootMostRecentEventTime && - (workInProgressRootMostRecentEventTime = type), - (current = current.child.sibling), - null !== current && - ((type = workInProgress.firstEffect), - null !== type - ? ((workInProgress.firstEffect = current), - (current.nextEffect = type)) - : ((workInProgress.firstEffect = workInProgress.lastEffect = current), - (current.nextEffect = null)), - (current.effectTag = 8)))); - newProps && - !renderExpirationTime && - 0 !== (workInProgress.mode & 1) && - workInProgressRootExitStatus === RootIncomplete && - (workInProgressRootExitStatus = RootSuspended); - if (newProps || renderExpirationTime) workInProgress.effectTag |= 4; + null === renderExpirationTime || + ((renderExpirationTime = current.child.sibling), + null !== renderExpirationTime && + ((tag = workInProgress.firstEffect), + null !== tag + ? ((workInProgress.firstEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = tag)) + : ((workInProgress.firstEffect = workInProgress.lastEffect = renderExpirationTime), + (renderExpirationTime.nextEffect = null)), + (renderExpirationTime.effectTag = 8)))); + if (newProps && !rootContainerInstance && 0 !== (workInProgress.mode & 2)) + if ( + (null === current && + !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || + 0 !== (suspenseStackCursor.current & InvisibleParentSuspenseContext) + ) + workInProgressRootExitStatus === RootIncomplete && + (workInProgressRootExitStatus = RootSuspended); + else if ( + workInProgressRootExitStatus === RootIncomplete || + workInProgressRootExitStatus === RootSuspended + ) + workInProgressRootExitStatus = RootSuspendedWithDelay; + if (newProps || rootContainerInstance) workInProgress.effectTag |= 4; break; case 7: break; @@ -4735,16 +4871,192 @@ function completeWork(current, workInProgress, renderExpirationTime) { case 18: break; case 19: + pop(suspenseStackCursor, workInProgress); + newProps = workInProgress.memoizedState; + if (null === newProps) break; + rootContainerInstance = 0 !== (workInProgress.effectTag & 64); + tag = newProps.rendering; + if (null === tag) + if (rootContainerInstance) cutOffTailIfNeeded(newProps, !1); + else { + if ( + workInProgressRootExitStatus !== RootIncomplete || + (null !== current && 0 !== (current.effectTag & 64)) + ) + for (current = workInProgress.child; null !== current; ) { + tag = findFirstSuspended(current); + if (null !== tag) { + workInProgress.effectTag |= 64; + cutOffTailIfNeeded(newProps, !1); + current = tag.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress.firstEffect = workInProgress.lastEffect = null; + current = renderExpirationTime; + for (newProps = workInProgress.child; null !== newProps; ) + (rootContainerInstance = newProps), + (tag = current), + (rootContainerInstance.effectTag &= 2), + (rootContainerInstance.nextEffect = null), + (rootContainerInstance.firstEffect = null), + (rootContainerInstance.lastEffect = null), + (renderExpirationTime = rootContainerInstance.alternate), + null === renderExpirationTime + ? ((rootContainerInstance.childExpirationTime = 0), + (rootContainerInstance.expirationTime = tag), + (rootContainerInstance.child = null), + (rootContainerInstance.memoizedProps = null), + (rootContainerInstance.memoizedState = null), + (rootContainerInstance.updateQueue = null), + (rootContainerInstance.dependencies = null), + (rootContainerInstance.selfBaseDuration = 0), + (rootContainerInstance.treeBaseDuration = 0)) + : ((rootContainerInstance.childExpirationTime = + renderExpirationTime.childExpirationTime), + (rootContainerInstance.expirationTime = + renderExpirationTime.expirationTime), + (rootContainerInstance.child = + renderExpirationTime.child), + (rootContainerInstance.memoizedProps = + renderExpirationTime.memoizedProps), + (rootContainerInstance.memoizedState = + renderExpirationTime.memoizedState), + (rootContainerInstance.updateQueue = + renderExpirationTime.updateQueue), + (tag = renderExpirationTime.dependencies), + (rootContainerInstance.dependencies = + null === tag + ? null + : { + expirationTime: tag.expirationTime, + firstContext: tag.firstContext, + responders: tag.responders + }), + (rootContainerInstance.selfBaseDuration = + renderExpirationTime.selfBaseDuration), + (rootContainerInstance.treeBaseDuration = + renderExpirationTime.treeBaseDuration)), + (newProps = newProps.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & SubtreeSuspenseContextMask) | + ForceSuspenseFallback, + workInProgress + ); + return workInProgress.child; + } + current = current.sibling; + } + } + else { + if (!rootContainerInstance) + if (((current = findFirstSuspended(tag)), null !== current)) { + if ( + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !0), + null === newProps.tail && "hidden" === newProps.tailMode) + ) { + current = current.updateQueue; + null !== current && + ((workInProgress.updateQueue = current), + (workInProgress.effectTag |= 4)); + workInProgress = workInProgress.lastEffect = newProps.lastEffect; + null !== workInProgress && (workInProgress.nextEffect = null); + break; + } + } else + now() > newProps.tailExpiration && + 1 < renderExpirationTime && + ((workInProgress.effectTag |= 64), + (rootContainerInstance = !0), + cutOffTailIfNeeded(newProps, !1), + (current = renderExpirationTime - 1), + (workInProgress.expirationTime = workInProgress.childExpirationTime = current), + null === spawnedWorkDuringRender + ? (spawnedWorkDuringRender = [current]) + : spawnedWorkDuringRender.push(current)); + newProps.isBackwards + ? ((tag.sibling = workInProgress.child), (workInProgress.child = tag)) + : ((current = newProps.last), + null !== current + ? (current.sibling = tag) + : (workInProgress.child = tag), + (newProps.last = tag)); + } + if (null !== newProps.tail) + return ( + 0 === newProps.tailExpiration && + (newProps.tailExpiration = now() + 500), + (current = newProps.tail), + (newProps.rendering = current), + (newProps.tail = current.sibling), + (newProps.lastEffect = workInProgress.lastEffect), + (current.sibling = null), + (newProps = suspenseStackCursor.current), + (newProps = rootContainerInstance + ? (newProps & SubtreeSuspenseContextMask) | ForceSuspenseFallback + : newProps & SubtreeSuspenseContextMask), + push(suspenseStackCursor, newProps, workInProgress), + current + ); break; case 20: break; default: throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); } return null; } +function unwindWork(workInProgress) { + switch (workInProgress.tag) { + case 1: + isContextProvider(workInProgress.type) && popContext(workInProgress); + var effectTag = workInProgress.effectTag; + return effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null; + case 3: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + effectTag = workInProgress.effectTag; + if (0 !== (effectTag & 64)) + throw ReactError( + Error( + "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." + ) + ); + workInProgress.effectTag = (effectTag & -2049) | 64; + return workInProgress; + case 5: + return popHostContext(workInProgress), null; + case 13: + return ( + pop(suspenseStackCursor, workInProgress), + (effectTag = workInProgress.effectTag), + effectTag & 2048 + ? ((workInProgress.effectTag = (effectTag & -2049) | 64), + workInProgress) + : null + ); + case 18: + return null; + case 19: + return pop(suspenseStackCursor, workInProgress), null; + case 4: + return popHostContainer(workInProgress), null; + case 10: + return popProvider(workInProgress), null; + default: + return null; + } +} function createCapturedValue(value, source) { return { value: value, @@ -4752,24 +5064,18 @@ function createCapturedValue(value, source) { stack: getStackByFiberInDevAndProd(source) }; } +if ( + "function" !== + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog +) + throw ReactError( + Error("Expected ReactFiberErrorDialog.showErrorDialog to be a function.") + ); function logCapturedError(capturedError) { - var componentStack = capturedError.componentStack, - error = capturedError.error; - if (error instanceof Error) { - capturedError = error.message; - var name = error.name; - try { - error.message = - (capturedError ? name + ": " + capturedError : name) + - "\n\nThis error is located at:" + - componentStack; - } catch (e) {} - } else - error = - "string" === typeof error - ? Error(error + "\n\nThis error is located at:" + componentStack) - : Error("Unspecified error at:" + componentStack); - ExceptionsManager.handleException(error, !1); + !1 !== + ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog( + capturedError + ) && console.error(capturedError.error); } var PossiblyWeakSet$1 = "function" === typeof WeakSet ? WeakSet : Set; function logError(boundary, errorInfo) { @@ -4801,6 +5107,15 @@ function logError(boundary, errorInfo) { }); } } +function safelyCallComponentWillUnmount(current$$1, instance) { + try { + (instance.props = current$$1.memoizedProps), + (instance.state = current$$1.memoizedState), + instance.componentWillUnmount(); + } catch (unmountError) { + captureCommitPhaseError(current$$1, unmountError); + } +} function safelyDetachRef(current$$1) { var ref = current$$1.ref; if (null !== ref) @@ -4829,65 +5144,7 @@ function commitHookEffectList(unmountTag, mountTag, finishedWork) { } while (effect !== finishedWork); } } -function hideOrUnhideAllChildren(finishedWork, isHidden) { - for (var node = finishedWork; ; ) { - if (5 === node.tag) { - var instance = node.stateNode; - if (isHidden) { - var viewConfig = instance.viewConfig; - var updatePayload = diffProperties( - null, - emptyObject, - { style: { display: "none" } }, - viewConfig.validAttributes - ); - UIManager.updateView( - instance._nativeTag, - viewConfig.uiViewClassName, - updatePayload - ); - } else { - instance = node.stateNode; - updatePayload = node.memoizedProps; - viewConfig = instance.viewConfig; - var prevProps = Object.assign({}, updatePayload, { - style: [updatePayload.style, { display: "none" }] - }); - updatePayload = diffProperties( - null, - prevProps, - updatePayload, - viewConfig.validAttributes - ); - UIManager.updateView( - instance._nativeTag, - viewConfig.uiViewClassName, - updatePayload - ); - } - } else { - if (6 === node.tag) throw Error("Not yet implemented."); - if (13 === node.tag && null !== node.memoizedState) { - instance = node.child.sibling; - instance.return = node; - node = instance; - continue; - } else if (null !== node.child) { - node.child.return = node; - node = node.child; - continue; - } - } - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } -} -function commitUnmount(current$$1$jscomp$0) { +function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { "function" === typeof onCommitFiberUnmount && onCommitFiberUnmount(current$$1$jscomp$0); switch (current$$1$jscomp$0.tag) { @@ -4900,40 +5157,57 @@ function commitUnmount(current$$1$jscomp$0) { null !== updateQueue && ((updateQueue = updateQueue.lastEffect), null !== updateQueue) ) { - var effect = (updateQueue = updateQueue.next); - do { - var destroy = effect.destroy; - if (void 0 !== destroy) { - var current$$1 = current$$1$jscomp$0; - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current$$1, error); - } + var firstEffect = updateQueue.next; + runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + function() { + var effect = firstEffect; + do { + var destroy = effect.destroy; + if (void 0 !== destroy) { + var current$$1 = current$$1$jscomp$0; + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current$$1, error); + } + } + effect = effect.next; + } while (effect !== firstEffect); } - effect = effect.next; - } while (effect !== updateQueue); + ); } break; case 1: safelyDetachRef(current$$1$jscomp$0); - updateQueue = current$$1$jscomp$0.stateNode; - if ("function" === typeof updateQueue.componentWillUnmount) - try { - (updateQueue.props = current$$1$jscomp$0.memoizedProps), - (updateQueue.state = current$$1$jscomp$0.memoizedState), - updateQueue.componentWillUnmount(); - } catch (unmountError) { - captureCommitPhaseError(current$$1$jscomp$0, unmountError); - } + renderPriorityLevel = current$$1$jscomp$0.stateNode; + "function" === typeof renderPriorityLevel.componentWillUnmount && + safelyCallComponentWillUnmount( + current$$1$jscomp$0, + renderPriorityLevel + ); break; case 5: safelyDetachRef(current$$1$jscomp$0); break; case 4: - unmountHostComponents(current$$1$jscomp$0); + unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); } } +function detachFiber(current$$1) { + var alternate = current$$1.alternate; + current$$1.return = null; + current$$1.child = null; + current$$1.memoizedState = null; + current$$1.updateQueue = null; + current$$1.dependencies = null; + current$$1.alternate = null; + current$$1.firstEffect = null; + current$$1.lastEffect = null; + current$$1.pendingProps = null; + current$$1.memoizedProps = null; + null !== alternate && detachFiber(alternate); +} function isHostParent(fiber) { return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } @@ -4947,25 +5221,29 @@ function commitPlacement(finishedWork) { parent = parent.return; } throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } + parent = parentFiber.stateNode; switch (parentFiber.tag) { case 5: - parent = parentFiber.stateNode; var isContainer = !1; break; case 3: - parent = parentFiber.stateNode.containerInfo; + parent = parent.containerInfo; isContainer = !0; break; case 4: - parent = parentFiber.stateNode.containerInfo; + parent = parent.containerInfo; isContainer = !0; break; default: throw ReactError( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ) ); } parentFiber.effectTag & 16 && (parentFiber.effectTag &= -17); @@ -4995,25 +5273,26 @@ function commitPlacement(finishedWork) { } } for (var node = finishedWork; ; ) { - if (5 === node.tag || 6 === node.tag) { - var stateNode = node.stateNode; + var isHost = 5 === node.tag || 6 === node.tag; + if (isHost) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; if (parentFiber) if (isContainer) { if ("number" === typeof parent) throw ReactError( - "Container does not support insertBefore operation" + Error("Container does not support insertBefore operation") ); } else { - var parentInstance = parent, - beforeChild = parentFiber, - children = parentInstance._children, + isHost = parent; + var beforeChild = parentFiber, + children = isHost._children, index = children.indexOf(stateNode); 0 <= index ? (children.splice(index, 1), (beforeChild = children.indexOf(beforeChild)), children.splice(beforeChild, 0, stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [index], [beforeChild], [], @@ -5022,8 +5301,8 @@ function commitPlacement(finishedWork) { )) : ((index = children.indexOf(beforeChild)), children.splice(index, 0, stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [], [], [ @@ -5037,19 +5316,19 @@ function commitPlacement(finishedWork) { } else isContainer - ? UIManager.setChildren(parent, [ + ? ReactNativePrivateInterface.UIManager.setChildren(parent, [ "number" === typeof stateNode ? stateNode : stateNode._nativeTag ]) - : ((parentInstance = parent), + : ((isHost = parent), (children = "number" === typeof stateNode ? stateNode : stateNode._nativeTag), - (index = parentInstance._children), + (index = isHost._children), (beforeChild = index.indexOf(stateNode)), 0 <= beforeChild ? (index.splice(beforeChild, 1), index.push(stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [beforeChild], [index.length - 1], [], @@ -5057,8 +5336,8 @@ function commitPlacement(finishedWork) { [] )) : (index.push(stateNode), - UIManager.manageChildren( - parentInstance._nativeTag, + ReactNativePrivateInterface.UIManager.manageChildren( + isHost._nativeTag, [], [], [children], @@ -5079,7 +5358,7 @@ function commitPlacement(finishedWork) { node = node.sibling; } } -function unmountHostComponents(current$$1) { +function unmountHostComponents(current$$1, renderPriorityLevel$jscomp$0) { for ( var node = current$$1, currentParentIsValid = !1, @@ -5093,19 +5372,21 @@ function unmountHostComponents(current$$1) { a: for (;;) { if (null === currentParentIsValid) throw ReactError( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ) ); + currentParent = currentParentIsValid.stateNode; switch (currentParentIsValid.tag) { case 5: - currentParent = currentParentIsValid.stateNode; currentParentIsContainer = !1; break a; case 3: - currentParent = currentParentIsValid.stateNode.containerInfo; + currentParent = currentParent.containerInfo; currentParentIsContainer = !0; break a; case 4: - currentParent = currentParentIsValid.stateNode.containerInfo; + currentParent = currentParent.containerInfo; currentParentIsContainer = !0; break a; } @@ -5114,9 +5395,15 @@ function unmountHostComponents(current$$1) { currentParentIsValid = !0; } if (5 === node.tag || 6 === node.tag) { - a: for (var root = node, node$jscomp$0 = root; ; ) + a: for ( + var root = node, + renderPriorityLevel = renderPriorityLevel$jscomp$0, + node$jscomp$0 = root; + ; + + ) if ( - (commitUnmount(node$jscomp$0), + (commitUnmount(node$jscomp$0, renderPriorityLevel), null !== node$jscomp$0.child && 4 !== node$jscomp$0.tag) ) (node$jscomp$0.child.return = node$jscomp$0), @@ -5131,19 +5418,31 @@ function unmountHostComponents(current$$1) { node$jscomp$0.sibling.return = node$jscomp$0.return; node$jscomp$0 = node$jscomp$0.sibling; } - if (currentParentIsContainer) - (root = currentParent), + currentParentIsContainer + ? ((root = currentParent), recursivelyUncacheFiberNode(node.stateNode), - UIManager.manageChildren(root, [], [], [], [], [0]); - else { - root = currentParent; - var child = node.stateNode; - recursivelyUncacheFiberNode(child); - node$jscomp$0 = root._children; - child = node$jscomp$0.indexOf(child); - node$jscomp$0.splice(child, 1); - UIManager.manageChildren(root._nativeTag, [], [], [], [], [child]); - } + ReactNativePrivateInterface.UIManager.manageChildren( + root, + [], + [], + [], + [], + [0] + )) + : ((root = currentParent), + (node$jscomp$0 = node.stateNode), + recursivelyUncacheFiberNode(node$jscomp$0), + (renderPriorityLevel = root._children), + (node$jscomp$0 = renderPriorityLevel.indexOf(node$jscomp$0)), + renderPriorityLevel.splice(node$jscomp$0, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + root._nativeTag, + [], + [], + [], + [], + [node$jscomp$0] + )); } else if (4 === node.tag) { if (null !== node.child) { currentParent = node.stateNode.containerInfo; @@ -5152,7 +5451,9 @@ function unmountHostComponents(current$$1) { node = node.child; continue; } - } else if ((commitUnmount(node), null !== node.child)) { + } else if ( + (commitUnmount(node, renderPriorityLevel$jscomp$0), null !== node.child) + ) { node.child.return = node; node = node.child; continue; @@ -5186,7 +5487,7 @@ function commitWork(current$$1, finishedWork) { finishedWork.updateQueue = null; null !== updatePayload && ((finishedWork = instance.viewConfig), - (instanceProps[instance._nativeTag] = newProps), + instanceProps.set(instance._nativeTag, newProps), (newProps = diffProperties( null, current$$1, @@ -5194,7 +5495,7 @@ function commitWork(current$$1, finishedWork) { finishedWork.validAttributes )), null != newProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( instance._nativeTag, finishedWork.uiViewClassName, newProps @@ -5204,50 +5505,109 @@ function commitWork(current$$1, finishedWork) { case 6: if (null === finishedWork.stateNode) throw ReactError( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ) ); - UIManager.updateView(finishedWork.stateNode, "RCTRawText", { - text: finishedWork.memoizedProps - }); - break; - case 20: + ReactNativePrivateInterface.UIManager.updateView( + finishedWork.stateNode, + "RCTRawText", + { text: finishedWork.memoizedProps } + ); break; case 3: break; case 12: break; case 13: - commitSuspenseComponent(finishedWork); + instance = finishedWork; + null === finishedWork.memoizedState + ? (newProps = !1) + : ((newProps = !0), + (instance = finishedWork.child), + (globalMostRecentFallbackTime = now())); + if (null !== instance) + a: for (current$$1 = instance; ; ) { + if (5 === current$$1.tag) + if (((updatePayload = current$$1.stateNode), newProps)) { + var viewConfig = updatePayload.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject, + { style: { display: "none" } }, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + updatePayload = current$$1.stateNode; + updatePayload$jscomp$0 = current$$1.memoizedProps; + viewConfig = updatePayload.viewConfig; + var prevProps = Object.assign({}, updatePayload$jscomp$0, { + style: [updatePayload$jscomp$0.style, { display: "none" }] + }); + updatePayload$jscomp$0 = diffProperties( + null, + prevProps, + updatePayload$jscomp$0, + viewConfig.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + updatePayload._nativeTag, + viewConfig.uiViewClassName, + updatePayload$jscomp$0 + ); + } + else { + if (6 === current$$1.tag) throw Error("Not yet implemented."); + if (13 === current$$1.tag && null !== current$$1.memoizedState) { + updatePayload = current$$1.child.sibling; + updatePayload.return = current$$1; + current$$1 = updatePayload; + continue; + } else if (null !== current$$1.child) { + current$$1.child.return = current$$1; + current$$1 = current$$1.child; + continue; + } + } + if (current$$1 === instance) break a; + for (; null === current$$1.sibling; ) { + if (null === current$$1.return || current$$1.return === instance) + break a; + current$$1 = current$$1.return; + } + current$$1.sibling.return = current$$1.return; + current$$1 = current$$1.sibling; + } + attachSuspenseRetryListeners(finishedWork); + break; + case 19: + attachSuspenseRetryListeners(finishedWork); break; case 17: break; - case 19: + case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } -function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState, - newDidTimeout = void 0, - primaryChildParent = finishedWork; - null === newState - ? (newDidTimeout = !1) - : ((newDidTimeout = !0), - (primaryChildParent = finishedWork.child), - 0 === newState.fallbackExpirationTime && - (newState.fallbackExpirationTime = requestCurrentTime() - 500)); - null !== primaryChildParent && - hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); - newState = finishedWork.updateQueue; - if (null !== newState) { +function attachSuspenseRetryListeners(finishedWork) { + var thenables = finishedWork.updateQueue; + if (null !== thenables) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; null === retryCache && (retryCache = finishedWork.stateNode = new PossiblyWeakSet$1()); - newState.forEach(function(thenable) { + thenables.forEach(function(thenable) { var retry = resolveRetryThenable.bind(null, finishedWork, thenable); retryCache.has(thenable) || ((retry = tracing.unstable_wrap(retry)), @@ -5258,7 +5618,7 @@ function commitSuspenseComponent(finishedWork) { } var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; expirationTime.payload = { element: null }; var error = errorInfo.value; @@ -5269,13 +5629,14 @@ function createRootErrorUpdate(fiber, errorInfo, expirationTime) { return expirationTime; } function createClassErrorUpdate(fiber, errorInfo, expirationTime) { - expirationTime = createUpdate(expirationTime); + expirationTime = createUpdate(expirationTime, null); expirationTime.tag = 3; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if ("function" === typeof getDerivedStateFromError) { - var error$jscomp$0 = errorInfo.value; + var error = errorInfo.value; expirationTime.payload = function() { - return getDerivedStateFromError(error$jscomp$0); + logError(fiber, errorInfo); + return getDerivedStateFromError(error); }; } var inst = fiber.stateNode; @@ -5285,114 +5646,95 @@ function createClassErrorUpdate(fiber, errorInfo, expirationTime) { "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this])) - : legacyErrorBoundariesThatAlreadyFailed.add(this)); - var error = errorInfo.value, - stack = errorInfo.stack; - logError(fiber, errorInfo); - this.componentDidCatch(error, { + : legacyErrorBoundariesThatAlreadyFailed.add(this), + logError(fiber, errorInfo)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); }); return expirationTime; } -function unwindWork(workInProgress) { - switch (workInProgress.tag) { - case 1: - isContextProvider(workInProgress.type) && popContext(workInProgress); - var effectTag = workInProgress.effectTag; - return effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null; - case 3: - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - effectTag = workInProgress.effectTag; - if (0 !== (effectTag & 64)) - throw ReactError( - "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." - ); - workInProgress.effectTag = (effectTag & -2049) | 64; - return workInProgress; - case 5: - return popHostContext(workInProgress), null; - case 13: - return ( - (effectTag = workInProgress.effectTag), - effectTag & 2048 - ? ((workInProgress.effectTag = (effectTag & -2049) | 64), - workInProgress) - : null - ); - case 18: - return null; - case 4: - return popHostContainer(workInProgress), null; - case 10: - return popProvider(workInProgress), null; - case 19: - case 20: - return null; - default: - return null; - } -} var ceil = Math.ceil, ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - LegacyUnbatchedPhase = 2, - RenderPhase = 4, - CommitPhase = 5, + NoContext = 0, + LegacyUnbatchedContext = 8, + RenderContext = 16, + CommitContext = 32, RootIncomplete = 0, RootErrored = 1, RootSuspended = 2, - RootCompleted = 3, - workPhase = 0, + RootSuspendedWithDelay = 3, + RootCompleted = 4, + executionContext = NoContext, workInProgressRoot = null, workInProgress = null, renderExpirationTime = 0, workInProgressRootExitStatus = RootIncomplete, - workInProgressRootMostRecentEventTime = 1073741823, + workInProgressRootLatestProcessedExpirationTime = 1073741823, + workInProgressRootLatestSuspenseTimeout = 1073741823, + workInProgressRootCanSuspendUsingConfig = null, + workInProgressRootHasPendingPing = !1, + globalMostRecentFallbackTime = 0, + FALLBACK_THROTTLE_MS = 500, nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, + pendingPassiveEffectsRenderPriority = 90, pendingPassiveEffectsExpirationTime = 0, rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, + spawnedWorkDuringRender = null, currentEventTime = 0; function requestCurrentTime() { - return workPhase === RenderPhase || workPhase === CommitPhase - ? 1073741822 - ((now() / 10) | 0) + return (executionContext & (RenderContext | CommitContext)) !== NoContext + ? 1073741821 - ((now() / 10) | 0) : 0 !== currentEventTime ? currentEventTime - : (currentEventTime = 1073741822 - ((now() / 10) | 0)); -} -function computeExpirationForFiber(currentTime, fiber) { - if (0 === (fiber.mode & 1)) return 1073741823; - if (workPhase === RenderPhase) return renderExpirationTime; - switch (getCurrentPriorityLevel()) { - case 99: - currentTime = 1073741823; - break; - case 98: - currentTime = - 1073741822 - 10 * ((((1073741822 - currentTime + 15) / 10) | 0) + 1); - break; - case 97: - case 96: - currentTime = - 1073741822 - 25 * ((((1073741822 - currentTime + 500) / 25) | 0) + 1); - break; - case 95: - currentTime = 1; - break; - default: - throw ReactError("Expected a valid priority level"); - } + : (currentEventTime = 1073741821 - ((now() / 10) | 0)); +} +function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { + fiber = fiber.mode; + if (0 === (fiber & 2)) return 1073741823; + var priorityLevel = getCurrentPriorityLevel(); + if (0 === (fiber & 4)) return 99 === priorityLevel ? 1073741823 : 1073741822; + if ((executionContext & RenderContext) !== NoContext) + return renderExpirationTime; + if (null !== suspenseConfig) + currentTime = + 1073741821 - + 25 * + ((((1073741821 - + currentTime + + (suspenseConfig.timeoutMs | 0 || 5e3) / 10) / + 25) | + 0) + + 1); + else + switch (priorityLevel) { + case 99: + currentTime = 1073741823; + break; + case 98: + currentTime = + 1073741821 - 10 * ((((1073741821 - currentTime + 15) / 10) | 0) + 1); + break; + case 97: + case 96: + currentTime = + 1073741821 - 25 * ((((1073741821 - currentTime + 500) / 25) | 0) + 1); + break; + case 95: + currentTime = 1; + break; + default: + throw ReactError(Error("Expected a valid priority level")); + } null !== workInProgressRoot && currentTime === renderExpirationTime && --currentTime; @@ -5403,33 +5745,42 @@ function scheduleUpdateOnFiber(fiber, expirationTime) { throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), ReactError( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + ) )); fiber = markUpdateTimeFromFiberToRoot(fiber, expirationTime); - if (null !== fiber) - if (((fiber.pingTime = 0), 1073741823 === expirationTime)) - if (workPhase === LegacyUnbatchedPhase) + if (null !== fiber) { + fiber.pingTime = 0; + var priorityLevel = getCurrentPriorityLevel(); + if (1073741823 === expirationTime) + if ( + (executionContext & LegacyUnbatchedContext) !== NoContext && + (executionContext & (RenderContext | CommitContext)) === NoContext + ) { + scheduleInteractions( + fiber, + expirationTime, + tracing.__interactionsRef.current + ); for ( - expirationTime = renderRoot(fiber, 1073741823, !0); - null !== expirationTime; + var callback = renderRoot(fiber, 1073741823, !0); + null !== callback; ) - expirationTime = expirationTime(!0); - else + callback = callback(!0); + } else scheduleCallbackForRoot(fiber, 99, 1073741823), - 0 === workPhase && flushImmediateQueue(); - else { - var priorityLevel = getCurrentPriorityLevel(); - if (98 === priorityLevel) - if (null === rootsWithPendingDiscreteUpdates) - rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]]); - else { - var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(fiber); - (void 0 === lastDiscreteTime || lastDiscreteTime > expirationTime) && - rootsWithPendingDiscreteUpdates.set(fiber, expirationTime); - } - scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); - } + executionContext === NoContext && flushSyncCallbackQueue(); + else scheduleCallbackForRoot(fiber, priorityLevel, expirationTime); + (executionContext & 4) === NoContext || + (98 !== priorityLevel && 99 !== priorityLevel) || + (null === rootsWithPendingDiscreteUpdates + ? (rootsWithPendingDiscreteUpdates = new Map([[fiber, expirationTime]])) + : ((priorityLevel = rootsWithPendingDiscreteUpdates.get(fiber)), + (void 0 === priorityLevel || priorityLevel > expirationTime) && + rootsWithPendingDiscreteUpdates.set(fiber, expirationTime))); + } } function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { fiber.expirationTime < expirationTime && @@ -5470,23 +5821,30 @@ function scheduleCallbackForRoot(root, priorityLevel, expirationTime) { existingCallbackNode !== fakeCallbackNode && Scheduler_cancelCallback(existingCallbackNode); root.callbackExpirationTime = expirationTime; - existingCallbackNode = null; - 1073741823 !== expirationTime && - 1 !== expirationTime && - ((existingCallbackNode = 10 * (1073741822 - expirationTime) - now()), - 5e3 < existingCallbackNode && (existingCallbackNode = 5e3), - (existingCallbackNode = { timeout: existingCallbackNode })); - root.callbackNode = scheduleCallback( - priorityLevel, - runRootCallback.bind( - null, - root, - renderRoot.bind(null, root, expirationTime) - ), - existingCallbackNode - ); + 1073741823 === expirationTime + ? (root.callbackNode = scheduleSyncCallback( + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ) + )) + : ((existingCallbackNode = null), + 1 !== expirationTime && + (existingCallbackNode = { + timeout: 10 * (1073741821 - expirationTime) - now() + }), + (root.callbackNode = scheduleCallback( + priorityLevel, + runRootCallback.bind( + null, + root, + renderRoot.bind(null, root, expirationTime) + ), + existingCallbackNode + ))); } - schedulePendingInteraction(root, expirationTime); + scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); } function runRootCallback(root, callback, isSync) { var prevCallbackNode = root.callbackNode, @@ -5509,9 +5867,7 @@ function resolveLocksOnRoot(root, expirationTime) { return null !== firstBatch && firstBatch._defer && firstBatch._expirationTime >= expirationTime - ? ((root.finishedWork = root.current.alternate), - (root.pendingCommitExpirationTime = expirationTime), - scheduleCallback(97, function() { + ? (scheduleCallback(97, function() { firstBatch._onComplete(); return null; }), @@ -5523,13 +5879,14 @@ function flushPendingDiscreteUpdates() { var roots = rootsWithPendingDiscreteUpdates; rootsWithPendingDiscreteUpdates = null; roots.forEach(function(expirationTime, root) { - scheduleCallback(99, renderRoot.bind(null, root, expirationTime)); + scheduleSyncCallback(renderRoot.bind(null, root, expirationTime)); }); - flushImmediateQueue(); + flushSyncCallbackQueue(); } } function prepareFreshStack(root, expirationTime) { - root.pendingCommitExpirationTime = 0; + root.finishedWork = null; + root.finishedExpirationTime = 0; var timeoutHandle = root.timeoutHandle; -1 !== timeoutHandle && ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); @@ -5553,6 +5910,12 @@ function prepareFreshStack(root, expirationTime) { case 4: popHostContainer(interruptedWork); break; + case 13: + pop(suspenseStackCursor, interruptedWork); + break; + case 19: + pop(suspenseStackCursor, interruptedWork); + break; case 10: popProvider(interruptedWork); } @@ -5562,27 +5925,35 @@ function prepareFreshStack(root, expirationTime) { workInProgress = createWorkInProgress(root.current, null, expirationTime); renderExpirationTime = expirationTime; workInProgressRootExitStatus = RootIncomplete; - workInProgressRootMostRecentEventTime = 1073741823; + workInProgressRootLatestSuspenseTimeout = workInProgressRootLatestProcessedExpirationTime = 1073741823; + workInProgressRootCanSuspendUsingConfig = null; + workInProgressRootHasPendingPing = !1; + spawnedWorkDuringRender = null; } function renderRoot(root$jscomp$0, expirationTime, isSync) { - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); if (root$jscomp$0.firstPendingTime < expirationTime) return null; - if (root$jscomp$0.pendingCommitExpirationTime === expirationTime) - return ( - (root$jscomp$0.pendingCommitExpirationTime = 0), - commitRoot.bind(null, root$jscomp$0, expirationTime) - ); + if (isSync && root$jscomp$0.finishedExpirationTime === expirationTime) + return commitRoot.bind(null, root$jscomp$0); flushPassiveEffects(); if ( root$jscomp$0 !== workInProgressRoot || expirationTime !== renderExpirationTime ) prepareFreshStack(root$jscomp$0, expirationTime), - startWorkOnPendingInteraction(root$jscomp$0, expirationTime); + startWorkOnPendingInteractions(root$jscomp$0, expirationTime); + else if (workInProgressRootExitStatus === RootSuspendedWithDelay) + if (workInProgressRootHasPendingPing) + prepareFreshStack(root$jscomp$0, expirationTime); + else { + var lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + } if (null !== workInProgress) { - var prevWorkPhase = workPhase; - workPhase = RenderPhase; + lastPendingTime = executionContext; + executionContext |= RenderContext; var prevDispatcher = ReactCurrentDispatcher.current; null === prevDispatcher && (prevDispatcher = ContextOnlyDispatcher); ReactCurrentDispatcher.current = ContextOnlyDispatcher; @@ -5593,8 +5964,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { var currentTime = requestCurrentTime(); if (currentTime < expirationTime) return ( - (workPhase = prevWorkPhase), - resetContextDependences(), + (executionContext = lastPendingTime), + resetContextDependencies(), (ReactCurrentDispatcher.current = prevDispatcher), (tracing.__interactionsRef.current = prevInteractions), renderRoot.bind(null, root$jscomp$0, currentTime) @@ -5611,14 +5982,14 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = performUnitOfWork(workInProgress); break; } catch (thrownValue) { - resetContextDependences(); + resetContextDependencies(); resetHooks(); currentTime = workInProgress; if (null === currentTime || null === currentTime.return) throw (prepareFreshStack(root$jscomp$0, expirationTime), - (workPhase = prevWorkPhase), + (executionContext = lastPendingTime), thrownValue); - currentTime.mode & 4 && + currentTime.mode & 8 && stopProfilerTimerIfRunningAndRecordDelta(currentTime, !0); a: { var root = root$jscomp$0, @@ -5633,29 +6004,41 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { "object" === typeof value && "function" === typeof value.then ) { - var thenable = value; + var thenable = value, + hasInvisibleParentBoundary = + 0 !== + (suspenseStackCursor.current & InvisibleParentSuspenseContext); value = returnFiber; do { - if ( - 13 === value.tag && - (void 0 === value.memoizedProps.fallback - ? 0 - : null === value.memoizedState) - ) { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === value.tag)) + null !== value.memoizedState + ? (JSCompiler_temp = !1) + : ((JSCompiler_temp = value.memoizedProps), + (JSCompiler_temp = + void 0 === JSCompiler_temp.fallback + ? !1 + : !0 !== JSCompiler_temp.unstable_avoidThisFallback + ? !0 + : hasInvisibleParentBoundary + ? !1 + : !0)); + if (JSCompiler_temp) { returnFiber = value.updateQueue; null === returnFiber ? ((returnFiber = new Set()), returnFiber.add(thenable), (value.updateQueue = returnFiber)) : returnFiber.add(thenable); - if (0 === (value.mode & 1)) { + if (0 === (value.mode & 2)) { value.effectTag |= 64; sourceFiber.effectTag &= -1957; 1 === sourceFiber.tag && (null === sourceFiber.alternate ? (sourceFiber.tag = 17) : ((renderExpirationTime$jscomp$0 = createUpdate( - 1073741823 + 1073741823, + null )), (renderExpirationTime$jscomp$0.tag = 2), enqueueUpdate( @@ -5667,15 +6050,15 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { } sourceFiber = root; root = renderExpirationTime$jscomp$0; - var pingCache = sourceFiber.pingCache; - null === pingCache - ? ((pingCache = sourceFiber.pingCache = new PossiblyWeakMap()), + hasInvisibleParentBoundary = sourceFiber.pingCache; + null === hasInvisibleParentBoundary + ? ((hasInvisibleParentBoundary = sourceFiber.pingCache = new PossiblyWeakMap()), (returnFiber = new Set()), - pingCache.set(thenable, returnFiber)) - : ((returnFiber = pingCache.get(thenable)), + hasInvisibleParentBoundary.set(thenable, returnFiber)) + : ((returnFiber = hasInvisibleParentBoundary.get(thenable)), void 0 === returnFiber && ((returnFiber = new Set()), - pingCache.set(thenable, returnFiber))); + hasInvisibleParentBoundary.set(thenable, returnFiber))); returnFiber.has(root) || (returnFiber.add(root), (sourceFiber = pingSuspendedRoot.bind( @@ -5698,11 +6081,8 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { getStackByFiberInDevAndProd(sourceFiber) ); } - if ( - workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended - ) - workInProgressRootExitStatus = RootErrored; + workInProgressRootExitStatus !== RootCompleted && + (workInProgressRootExitStatus = RootErrored); value = createCapturedValue(value, sourceFiber); sourceFiber = returnFiber; do { @@ -5754,80 +6134,148 @@ function renderRoot(root$jscomp$0, expirationTime, isSync) { workInProgress = completeUnitOfWork(currentTime); } while (1); - workPhase = prevWorkPhase; - resetContextDependences(); + executionContext = lastPendingTime; + resetContextDependencies(); ReactCurrentDispatcher.current = prevDispatcher; tracing.__interactionsRef.current = prevInteractions; if (null !== workInProgress) return renderRoot.bind(null, root$jscomp$0, expirationTime); } + root$jscomp$0.finishedWork = root$jscomp$0.current.alternate; + root$jscomp$0.finishedExpirationTime = expirationTime; if (resolveLocksOnRoot(root$jscomp$0, expirationTime)) return null; workInProgressRoot = null; switch (workInProgressRootExitStatus) { case RootIncomplete: - throw ReactError("Should have a work-in-progress."); + throw ReactError(Error("Should have a work-in-progress.")); case RootErrored: return ( - (prevWorkPhase = root$jscomp$0.lastPendingTime), - root$jscomp$0.lastPendingTime < expirationTime - ? renderRoot.bind(null, root$jscomp$0, prevWorkPhase) + (lastPendingTime = root$jscomp$0.lastPendingTime), + lastPendingTime < expirationTime + ? renderRoot.bind(null, root$jscomp$0, lastPendingTime) : isSync - ? commitRoot.bind(null, root$jscomp$0, expirationTime) + ? commitRoot.bind(null, root$jscomp$0) : (prepareFreshStack(root$jscomp$0, expirationTime), - scheduleCallback( - 99, + scheduleSyncCallback( renderRoot.bind(null, root$jscomp$0, expirationTime) ), null) ); case RootSuspended: + if ( + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + !isSync && + ((isSync = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now()), + 10 < isSync) + ) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); + lastPendingTime = root$jscomp$0.lastPendingTime; + if (lastPendingTime < expirationTime) + return renderRoot.bind(null, root$jscomp$0, lastPendingTime); + root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + isSync + ); + return null; + } + return commitRoot.bind(null, root$jscomp$0); + case RootSuspendedWithDelay: if (!isSync) { + if (workInProgressRootHasPendingPing) + return ( + prepareFreshStack(root$jscomp$0, expirationTime), + renderRoot.bind(null, root$jscomp$0, expirationTime) + ); isSync = root$jscomp$0.lastPendingTime; - if (root$jscomp$0.lastPendingTime < expirationTime) + if (isSync < expirationTime) return renderRoot.bind(null, root$jscomp$0, isSync); - if ( - 1073741823 !== workInProgressRootMostRecentEventTime && - ((prevWorkPhase = - 10 * (1073741822 - workInProgressRootMostRecentEventTime) - 5e3), - (isSync = now()), - (prevWorkPhase = isSync - prevWorkPhase), - (prevWorkPhase = - (120 > prevWorkPhase - ? 120 - : 480 > prevWorkPhase - ? 480 - : 1080 > prevWorkPhase - ? 1080 - : 1920 > prevWorkPhase - ? 1920 - : 3e3 > prevWorkPhase - ? 3e3 - : 4320 > prevWorkPhase - ? 4320 - : 1960 * ceil(prevWorkPhase / 1960)) - prevWorkPhase), - (isSync = 10 * (1073741822 - expirationTime) - isSync), - isSync < prevWorkPhase && (prevWorkPhase = isSync), - (isSync = prevWorkPhase), - 10 < isSync) - ) + 1073741823 !== workInProgressRootLatestSuspenseTimeout + ? (isSync = + 10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) - + now()) + : 1073741823 === workInProgressRootLatestProcessedExpirationTime + ? (isSync = 0) + : ((isSync = + 10 * + (1073741821 - + workInProgressRootLatestProcessedExpirationTime) - + 5e3), + (lastPendingTime = now()), + (expirationTime = + 10 * (1073741821 - expirationTime) - lastPendingTime), + (isSync = lastPendingTime - isSync), + 0 > isSync && (isSync = 0), + (isSync = + (120 > isSync + ? 120 + : 480 > isSync + ? 480 + : 1080 > isSync + ? 1080 + : 1920 > isSync + ? 1920 + : 3e3 > isSync + ? 3e3 + : 4320 > isSync + ? 4320 + : 1960 * ceil(isSync / 1960)) - isSync), + expirationTime < isSync && (isSync = expirationTime)); + if (10 < isSync) return ( (root$jscomp$0.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root$jscomp$0, expirationTime), + commitRoot.bind(null, root$jscomp$0), isSync )), null ); } - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return commitRoot.bind(null, root$jscomp$0); case RootCompleted: - return commitRoot.bind(null, root$jscomp$0, expirationTime); + return !isSync && + 1073741823 !== workInProgressRootLatestProcessedExpirationTime && + null !== workInProgressRootCanSuspendUsingConfig && + ((lastPendingTime = workInProgressRootLatestProcessedExpirationTime), + (prevDispatcher = workInProgressRootCanSuspendUsingConfig), + (expirationTime = prevDispatcher.busyMinDurationMs | 0), + 0 >= expirationTime + ? (expirationTime = 0) + : ((isSync = prevDispatcher.busyDelayMs | 0), + (lastPendingTime = + now() - + (10 * (1073741821 - lastPendingTime) - + (prevDispatcher.timeoutMs | 0 || 5e3))), + (expirationTime = + lastPendingTime <= isSync + ? 0 + : isSync + expirationTime - lastPendingTime)), + 10 < expirationTime) + ? ((root$jscomp$0.timeoutHandle = scheduleTimeout( + commitRoot.bind(null, root$jscomp$0), + expirationTime + )), + null) + : commitRoot.bind(null, root$jscomp$0); default: - throw ReactError("Unknown root exit status."); + throw ReactError(Error("Unknown root exit status.")); } } +function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { + expirationTime < workInProgressRootLatestProcessedExpirationTime && + 1 < expirationTime && + (workInProgressRootLatestProcessedExpirationTime = expirationTime); + null !== suspenseConfig && + expirationTime < workInProgressRootLatestSuspenseTimeout && + 1 < expirationTime && + ((workInProgressRootLatestSuspenseTimeout = expirationTime), + (workInProgressRootCanSuspendUsingConfig = suspenseConfig)); +} function performUnitOfWork(unitOfWork) { var current$$1 = unitOfWork.alternate; - 0 !== (unitOfWork.mode & 4) + 0 !== (unitOfWork.mode & 8) ? ((profilerStartTime = now$1()), 0 > unitOfWork.actualStartTime && (unitOfWork.actualStartTime = now$1()), (current$$1 = beginWork$$1(current$$1, unitOfWork, renderExpirationTime)), @@ -5844,7 +6292,7 @@ function completeUnitOfWork(unitOfWork) { var current$$1 = workInProgress.alternate; unitOfWork = workInProgress.return; if (0 === (workInProgress.effectTag & 1024)) { - if (0 === (workInProgress.mode & 4)) + if (0 === (workInProgress.mode & 8)) current$$1 = completeWork( current$$1, workInProgress, @@ -5864,7 +6312,7 @@ function completeUnitOfWork(unitOfWork) { fiber = workInProgress; if (1 === renderExpirationTime || 1 !== fiber.childExpirationTime) { var newChildExpirationTime = 0; - if (0 !== (fiber.mode & 4)) { + if (0 !== (fiber.mode & 8)) { for ( var actualDuration = fiber.actualDuration, treeBaseDuration = fiber.selfBaseDuration, @@ -5916,7 +6364,7 @@ function completeUnitOfWork(unitOfWork) { (unitOfWork.lastEffect = workInProgress))); } else { current$$1 = unwindWork(workInProgress, renderExpirationTime); - if (0 !== (workInProgress.mode & 4)) { + if (0 !== (workInProgress.mode & 8)) { stopProfilerTimerIfRunningAndRecordDelta(workInProgress, !1); fiber = workInProgress.actualDuration; for ( @@ -5942,23 +6390,31 @@ function completeUnitOfWork(unitOfWork) { (workInProgressRootExitStatus = RootCompleted); return null; } -function commitRoot(root, expirationTime) { - runWithPriority(99, commitRootImpl.bind(null, root, expirationTime)); +function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority(99, commitRootImpl.bind(null, root, renderPriorityLevel)); null !== rootWithPendingPassiveEffects && - ((root = getCurrentPriorityLevel()), - scheduleCallback(root, function() { + scheduleCallback(97, function() { flushPassiveEffects(); return null; - })); + }); return null; } -function commitRootImpl(root, expirationTime) { +function commitRootImpl(root, renderPriorityLevel) { flushPassiveEffects(); - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Should not already be working."); - var finishedWork = root.current.alternate; - if (null === finishedWork) - throw ReactError("Should have a work-in-progress root."); + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError(Error("Should not already be working.")); + var finishedWork = root.finishedWork, + expirationTime = root.finishedExpirationTime; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedExpirationTime = 0; + if (finishedWork === root.current) + throw ReactError( + Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ) + ); root.callbackNode = null; root.callbackExpirationTime = 0; var updateExpirationTimeBeforeCommit = finishedWork.expirationTime, @@ -5972,19 +6428,19 @@ function commitRootImpl(root, expirationTime) { (root.lastPendingTime = updateExpirationTimeBeforeCommit); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (renderExpirationTime = 0)); - if (1 < finishedWork.effectTag) - if (null !== finishedWork.lastEffect) { - finishedWork.lastEffect.nextEffect = finishedWork; - var firstEffect = finishedWork.firstEffect; - } else firstEffect = finishedWork; - else firstEffect = finishedWork.firstEffect; - if (null !== firstEffect) { - updateExpirationTimeBeforeCommit = workPhase; - workPhase = CommitPhase; - childExpirationTimeBeforeCommit = tracing.__interactionsRef.current; + 1 < finishedWork.effectTag + ? null !== finishedWork.lastEffect + ? ((finishedWork.lastEffect.nextEffect = finishedWork), + (updateExpirationTimeBeforeCommit = finishedWork.firstEffect)) + : (updateExpirationTimeBeforeCommit = finishedWork) + : (updateExpirationTimeBeforeCommit = finishedWork.firstEffect); + if (null !== updateExpirationTimeBeforeCommit) { + childExpirationTimeBeforeCommit = executionContext; + executionContext |= CommitContext; + var prevInteractions = tracing.__interactionsRef.current; tracing.__interactionsRef.current = root.memoizedInteractions; ReactCurrentOwner$2.current = null; - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { for (; null !== nextEffect; ) { @@ -6027,11 +6483,12 @@ function commitRootImpl(root, expirationTime) { case 6: case 4: case 17: - case 20: break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -6039,16 +6496,16 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); commitTime = now$1(); - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { - for (; null !== nextEffect; ) { + for (current$$1 = renderPriorityLevel; null !== nextEffect; ) { var effectTag = nextEffect.effectTag; if (effectTag & 128) { var current$$1$jscomp$0 = nextEffect.alternate; @@ -6074,30 +6531,21 @@ function commitRootImpl(root, expirationTime) { commitWork(nextEffect.alternate, nextEffect); break; case 8: - current$$1 = nextEffect; - unmountHostComponents(current$$1); - current$$1.return = null; - current$$1.child = null; - current$$1.memoizedState = null; - current$$1.updateQueue = null; - var alternate = current$$1.alternate; - null !== alternate && - ((alternate.return = null), - (alternate.child = null), - (alternate.memoizedState = null), - (alternate.updateQueue = null)); + (prevProps = nextEffect), + unmountHostComponents(prevProps, current$$1), + detachFiber(prevProps); } nextEffect = nextEffect.nextEffect; } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); root.current = finishedWork; - nextEffect = firstEffect; + nextEffect = updateExpirationTimeBeforeCommit; do try { for ( @@ -6107,10 +6555,10 @@ function commitRootImpl(root, expirationTime) { ) { var effectTag$jscomp$0 = nextEffect.effectTag; if (effectTag$jscomp$0 & 36) { - current$$1 = effectTag; + prevProps = effectTag; var current$$1$jscomp$1 = nextEffect.alternate; currentRef = nextEffect; - alternate = current$$1$jscomp$0; + current$$1 = current$$1$jscomp$0; switch (currentRef.tag) { case 0: case 11: @@ -6142,26 +6590,26 @@ function commitRootImpl(root, expirationTime) { currentRef, updateQueue, instance$jscomp$0, - alternate + current$$1 ); break; case 3: var _updateQueue = currentRef.updateQueue; if (null !== _updateQueue) { - current$$1 = null; + prevProps = null; if (null !== currentRef.child) switch (currentRef.child.tag) { case 5: - current$$1 = currentRef.child.stateNode; + prevProps = currentRef.child.stateNode; break; case 1: - current$$1 = currentRef.child.stateNode; + prevProps = currentRef.child.stateNode; } commitUpdateQueue( currentRef, _updateQueue, - current$$1, - alternate + prevProps, + current$$1 ); } break; @@ -6173,26 +6621,27 @@ function commitRootImpl(root, expirationTime) { break; case 12: var onRender = currentRef.memoizedProps.onRender; - onRender( - currentRef.memoizedProps.id, - null === current$$1$jscomp$1 ? "mount" : "update", - currentRef.actualDuration, - currentRef.treeBaseDuration, - currentRef.actualStartTime, - commitTime, - current$$1.memoizedInteractions - ); + "function" === typeof onRender && + onRender( + currentRef.memoizedProps.id, + null === current$$1$jscomp$1 ? "mount" : "update", + currentRef.actualDuration, + currentRef.treeBaseDuration, + currentRef.actualStartTime, + commitTime, + prevProps.memoizedInteractions + ); break; case 13: + case 19: case 17: - break; case 20: break; - case 19: - break; default: throw ReactError( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ) ); } } @@ -6217,32 +6666,52 @@ function commitRootImpl(root, expirationTime) { } } catch (error) { if (null === nextEffect) - throw ReactError("Should be working on an effect."); + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(nextEffect, error); nextEffect = nextEffect.nextEffect; } while (null !== nextEffect); nextEffect = null; - tracing.__interactionsRef.current = childExpirationTimeBeforeCommit; - workPhase = updateExpirationTimeBeforeCommit; + requestPaint(); + tracing.__interactionsRef.current = prevInteractions; + executionContext = childExpirationTimeBeforeCommit; } else (root.current = finishedWork), (commitTime = now$1()); - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), + if ((effectTag$jscomp$0 = rootDoesHavePassiveEffects)) + (rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsExpirationTime = expirationTime)) - : finishPendingInteractions(root, expirationTime); - expirationTime = root.firstPendingTime; - 0 !== expirationTime - ? ((effectTag$jscomp$0 = requestCurrentTime()), - (effectTag$jscomp$0 = inferPriorityFromExpirationTime( - effectTag$jscomp$0, - expirationTime - )), - scheduleCallbackForRoot(root, effectTag$jscomp$0, expirationTime)) - : (legacyErrorBoundariesThatAlreadyFailed = null); + (pendingPassiveEffectsExpirationTime = expirationTime), + (pendingPassiveEffectsRenderPriority = renderPriorityLevel); + else + for (nextEffect = updateExpirationTimeBeforeCommit; null !== nextEffect; ) + (renderPriorityLevel = nextEffect.nextEffect), + (nextEffect.nextEffect = null), + (nextEffect = renderPriorityLevel); + renderPriorityLevel = root.firstPendingTime; + if (0 !== renderPriorityLevel) { + current$$1$jscomp$1 = requestCurrentTime(); + current$$1$jscomp$1 = inferPriorityFromExpirationTime( + current$$1$jscomp$1, + renderPriorityLevel + ); + if (null !== spawnedWorkDuringRender) + for ( + instance$jscomp$0 = spawnedWorkDuringRender, + spawnedWorkDuringRender = null, + prevProps$jscomp$0 = 0; + prevProps$jscomp$0 < instance$jscomp$0.length; + prevProps$jscomp$0++ + ) + scheduleInteractions( + root, + instance$jscomp$0[prevProps$jscomp$0], + root.memoizedInteractions + ); + scheduleCallbackForRoot(root, current$$1$jscomp$1, renderPriorityLevel); + } else legacyErrorBoundariesThatAlreadyFailed = null; + effectTag$jscomp$0 || finishPendingInteractions(root, expirationTime); "function" === typeof onCommitFiberRoot && - onCommitFiberRoot(finishedWork.stateNode); - 1073741823 === expirationTime + onCommitFiberRoot(finishedWork.stateNode, expirationTime); + 1073741823 === renderPriorityLevel ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -6252,37 +6721,56 @@ function commitRootImpl(root, expirationTime) { (root = firstUncaughtError), (firstUncaughtError = null), root); - if (workPhase === LegacyUnbatchedPhase) return null; - flushImmediateQueue(); + if ((executionContext & LegacyUnbatchedContext) !== NoContext) return null; + flushSyncCallbackQueue(); return null; } function flushPassiveEffects() { if (null === rootWithPendingPassiveEffects) return !1; var root = rootWithPendingPassiveEffects, - expirationTime = pendingPassiveEffectsExpirationTime; + expirationTime = pendingPassiveEffectsExpirationTime, + renderPriorityLevel = pendingPassiveEffectsRenderPriority; rootWithPendingPassiveEffects = null; pendingPassiveEffectsExpirationTime = 0; + pendingPassiveEffectsRenderPriority = 90; + return runWithPriority( + 97 < renderPriorityLevel ? 97 : renderPriorityLevel, + flushPassiveEffectsImpl.bind(null, root, expirationTime) + ); +} +function flushPassiveEffectsImpl(root, expirationTime) { var prevInteractions = tracing.__interactionsRef.current; tracing.__interactionsRef.current = root.memoizedInteractions; - if (workPhase === RenderPhase || workPhase === CommitPhase) - throw ReactError("Cannot flush passive effects while already rendering."); - var prevWorkPhase = workPhase; - workPhase = CommitPhase; + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) + throw ReactError( + Error("Cannot flush passive effects while already rendering.") + ); + var prevExecutionContext = executionContext; + executionContext |= CommitContext; for (var effect = root.current.firstEffect; null !== effect; ) { try { var finishedWork = effect; - commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork); - commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + if (0 !== (finishedWork.effectTag & 512)) + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork), + commitHookEffectList(NoEffect$1, MountPassive, finishedWork); + } } catch (error) { - if (null === effect) throw ReactError("Should be working on an effect."); + if (null === effect) + throw ReactError(Error("Should be working on an effect.")); captureCommitPhaseError(effect, error); } - effect = effect.nextEffect; + finishedWork = effect.nextEffect; + effect.nextEffect = null; + effect = finishedWork; } tracing.__interactionsRef.current = prevInteractions; finishPendingInteractions(root, expirationTime); - workPhase = prevWorkPhase; - flushImmediateQueue(); + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); return !0; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { @@ -6323,11 +6811,18 @@ function pingSuspendedRoot(root, thenable, suspendedTime) { var pingCache = root.pingCache; null !== pingCache && pingCache.delete(thenable); workInProgressRoot === root && renderExpirationTime === suspendedTime - ? prepareFreshStack(root, renderExpirationTime) + ? workInProgressRootExitStatus === RootSuspendedWithDelay || + (workInProgressRootExitStatus === RootSuspended && + 1073741823 === workInProgressRootLatestProcessedExpirationTime && + now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) + ? prepareFreshStack(root, renderExpirationTime) + : (workInProgressRootHasPendingPing = !0) : root.lastPendingTime < suspendedTime || ((thenable = root.pingTime), (0 !== thenable && thenable < suspendedTime) || ((root.pingTime = suspendedTime), + root.finishedExpirationTime === suspendedTime && + ((root.finishedExpirationTime = 0), (root.finishedWork = null)), (thenable = requestCurrentTime()), (thenable = inferPriorityFromExpirationTime(thenable, suspendedTime)), scheduleCallbackForRoot(root, thenable, suspendedTime))); @@ -6336,7 +6831,7 @@ function resolveRetryThenable(boundaryFiber, thenable) { var retryCache = boundaryFiber.stateNode; null !== retryCache && retryCache.delete(thenable); retryCache = requestCurrentTime(); - thenable = computeExpirationForFiber(retryCache, boundaryFiber); + thenable = computeExpirationForFiber(retryCache, boundaryFiber, null); retryCache = inferPriorityFromExpirationTime(retryCache, thenable); boundaryFiber = markUpdateTimeFromFiberToRoot(boundaryFiber, thenable); null !== boundaryFiber && @@ -6389,6 +6884,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress, renderExpirationTime ); + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6396,6 +6896,33 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); return null !== workInProgress ? workInProgress.sibling : null; } + push( + suspenseStackCursor, + suspenseStackCursor.current & SubtreeSuspenseContextMask, + workInProgress + ); + break; + case 19: + updateExpirationTime = + workInProgress.childExpirationTime >= renderExpirationTime; + if (0 !== (current$$1.effectTag & 64)) { + if (updateExpirationTime) + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); + workInProgress.effectTag |= 64; + } + var renderState = workInProgress.memoizedState; + null !== renderState && + ((renderState.rendering = null), (renderState.tail = null)); + push( + suspenseStackCursor, + suspenseStackCursor.current, + workInProgress + ); + if (!updateExpirationTime) return null; } return bailoutOnAlreadyFinishedWork( current$$1, @@ -6408,31 +6935,31 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress.expirationTime = 0; switch (workInProgress.tag) { case 2: - updateExpirationTime = workInProgress.elementType; + updateExpirationTime = workInProgress.type; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - var context = getMaskedContext( + renderState = getMaskedContext( workInProgress, contextStackCursor.current ); prepareToReadContext(workInProgress, renderExpirationTime); - context = renderWithHooks( + renderState = renderWithHooks( null, workInProgress, updateExpirationTime, current$$1, - context, + renderState, renderExpirationTime ); workInProgress.effectTag |= 1; if ( - "object" === typeof context && - null !== context && - "function" === typeof context.render && - void 0 === context.$$typeof + "object" === typeof renderState && + null !== renderState && + "function" === typeof renderState.render && + void 0 === renderState.$$typeof ) { workInProgress.tag = 1; resetHooks(); @@ -6441,8 +6968,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { pushContextProvider(workInProgress); } else hasContext = !1; workInProgress.memoizedState = - null !== context.state && void 0 !== context.state - ? context.state + null !== renderState.state && void 0 !== renderState.state + ? renderState.state : null; var getDerivedStateFromProps = updateExpirationTime.getDerivedStateFromProps; @@ -6453,9 +6980,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { getDerivedStateFromProps, current$$1 ); - context.updater = classComponentUpdater; - workInProgress.stateNode = context; - context._reactInternalFiber = workInProgress; + renderState.updater = classComponentUpdater; + workInProgress.stateNode = renderState; + renderState._reactInternalFiber = workInProgress; mountClassInstance( workInProgress, updateExpirationTime, @@ -6475,28 +7002,28 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( null, workInProgress, - context, + renderState, renderExpirationTime ), (workInProgress = workInProgress.child); return workInProgress; case 16: - context = workInProgress.elementType; + renderState = workInProgress.elementType; null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), (workInProgress.effectTag |= 2)); current$$1 = workInProgress.pendingProps; - context = readLazyComponentType(context); - workInProgress.type = context; - hasContext = workInProgress.tag = resolveLazyComponentTag(context); - current$$1 = resolveDefaultProps(context, current$$1); + renderState = readLazyComponentType(renderState); + workInProgress.type = renderState; + hasContext = workInProgress.tag = resolveLazyComponentTag(renderState); + current$$1 = resolveDefaultProps(renderState, current$$1); switch (hasContext) { case 0: workInProgress = updateFunctionComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6505,7 +7032,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateClassComponent( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6514,7 +7041,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateForwardRef( null, workInProgress, - context, + renderState, current$$1, renderExpirationTime ); @@ -6523,49 +7050,51 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { workInProgress = updateMemoComponent( null, workInProgress, - context, - resolveDefaultProps(context.type, current$$1), + renderState, + resolveDefaultProps(renderState.type, current$$1), updateExpirationTime, renderExpirationTime ); break; default: throw ReactError( - "Element type is invalid. Received a promise that resolves to: " + - context + - ". Lazy element type must resolve to a class or function." + Error( + "Element type is invalid. Received a promise that resolves to: " + + renderState + + ". Lazy element type must resolve to a class or function." + ) ); } return workInProgress; case 0: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateFunctionComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); case 1: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateClassComponent( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6574,10 +7103,12 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { updateExpirationTime = workInProgress.updateQueue; if (null === updateExpirationTime) throw ReactError( - "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + Error( + "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." + ) ); - context = workInProgress.memoizedState; - context = null !== context ? context.element : null; + renderState = workInProgress.memoizedState; + renderState = null !== renderState ? renderState.element : null; processUpdateQueue( workInProgress, updateExpirationTime, @@ -6586,7 +7117,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ); updateExpirationTime = workInProgress.memoizedState.element; - updateExpirationTime === context + updateExpirationTime === renderState ? (workInProgress = bailoutOnAlreadyFinishedWork( current$$1, workInProgress, @@ -6650,16 +7181,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 11: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), updateForwardRef( current$$1, workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ) ); @@ -6697,9 +7228,9 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 10: a: { updateExpirationTime = workInProgress.type._context; - context = workInProgress.pendingProps; + renderState = workInProgress.pendingProps; getDerivedStateFromProps = workInProgress.memoizedProps; - hasContext = context.value; + hasContext = renderState.value; pushProvider(workInProgress, hasContext); if (null !== getDerivedStateFromProps) { var oldValue = getDerivedStateFromProps.value; @@ -6713,7 +7244,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { : 1073741823) | 0; if (0 === hasContext) { if ( - getDerivedStateFromProps.children === context.children && + getDerivedStateFromProps.children === renderState.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -6730,16 +7261,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== oldValue; ) { - var list = oldValue.contextDependencies; + var list = oldValue.dependencies; if (null !== list) { getDerivedStateFromProps = oldValue.child; - for (var dependency = list.first; null !== dependency; ) { + for ( + var dependency = list.firstContext; + null !== dependency; + + ) { if ( dependency.context === updateExpirationTime && 0 !== (dependency.observedBits & hasContext) ) { 1 === oldValue.tag && - ((dependency = createUpdate(renderExpirationTime)), + ((dependency = createUpdate(renderExpirationTime, null)), (dependency.tag = 2), enqueueUpdate(oldValue, dependency)); oldValue.expirationTime < renderExpirationTime && @@ -6748,22 +7283,10 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { null !== dependency && dependency.expirationTime < renderExpirationTime && (dependency.expirationTime = renderExpirationTime); - dependency = renderExpirationTime; - for (var node = oldValue.return; null !== node; ) { - var alternate = node.alternate; - if (node.childExpirationTime < dependency) - (node.childExpirationTime = dependency), - null !== alternate && - alternate.childExpirationTime < dependency && - (alternate.childExpirationTime = dependency); - else if ( - null !== alternate && - alternate.childExpirationTime < dependency - ) - alternate.childExpirationTime = dependency; - else break; - node = node.return; - } + scheduleWorkOnParentPath( + oldValue.return, + renderExpirationTime + ); list.expirationTime < renderExpirationTime && (list.expirationTime = renderExpirationTime); break; @@ -6803,7 +7326,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { reconcileChildren( current$$1, workInProgress, - context.children, + renderState.children, renderExpirationTime ); workInProgress = workInProgress.child; @@ -6811,12 +7334,15 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { return workInProgress; case 9: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = workInProgress.pendingProps), (updateExpirationTime = hasContext.children), prepareToReadContext(workInProgress, renderExpirationTime), - (context = readContext(context, hasContext.unstable_observedBits)), - (updateExpirationTime = updateExpirationTime(context)), + (renderState = readContext( + renderState, + hasContext.unstable_observedBits + )), + (updateExpirationTime = updateExpirationTime(renderState)), (workInProgress.effectTag |= 1), reconcileChildren( current$$1, @@ -6828,16 +7354,16 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { ); case 14: return ( - (context = workInProgress.type), + (renderState = workInProgress.type), (hasContext = resolveDefaultProps( - context, + renderState, workInProgress.pendingProps )), - (hasContext = resolveDefaultProps(context.type, hasContext)), + (hasContext = resolveDefaultProps(renderState.type, hasContext)), updateMemoComponent( current$$1, workInProgress, - context, + renderState, hasContext, updateExpirationTime, renderExpirationTime @@ -6855,11 +7381,11 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { case 17: return ( (updateExpirationTime = workInProgress.type), - (context = workInProgress.pendingProps), - (context = + (renderState = workInProgress.pendingProps), + (renderState = workInProgress.elementType === updateExpirationTime - ? context - : resolveDefaultProps(updateExpirationTime, context)), + ? renderState + : resolveDefaultProps(updateExpirationTime, renderState)), null !== current$$1 && ((current$$1.alternate = null), (workInProgress.alternate = null), @@ -6872,13 +7398,13 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { constructClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), mountClassInstance( workInProgress, updateExpirationTime, - context, + renderState, renderExpirationTime ), finishClassComponent( @@ -6890,13 +7416,20 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) { renderExpirationTime ) ); + case 19: + return updateSuspenseListComponent( + current$$1, + workInProgress, + renderExpirationTime + ); } throw ReactError( - "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + Error( + "Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue." + ) ); }; -function schedulePendingInteraction(root, expirationTime) { - var interactions = tracing.__interactionsRef.current; +function scheduleInteractions(root, expirationTime, interactions) { if (0 < interactions.size) { var pendingInteractionMap = root.pendingInteractionMap, pendingInteractions = pendingInteractionMap.get(expirationTime); @@ -6917,7 +7450,7 @@ function schedulePendingInteraction(root, expirationTime) { ); } } -function startWorkOnPendingInteraction(root, expirationTime) { +function startWorkOnPendingInteractions(root, expirationTime) { var interactions = new Set(); root.pendingInteractionMap.forEach(function( scheduledInteractions, @@ -6982,14 +7515,248 @@ function finishPendingInteractions(root, committedExpirationTime) { }); } } +var onCommitFiberRoot = null, + onCommitFiberUnmount = null, + isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; +function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + var rendererID = hook.inject(internals); + onCommitFiberRoot = function(root, expirationTime) { + try { + var didError = 64 === (root.current.effectTag & 64), + currentTime = requestCurrentTime(), + priorityLevel = inferPriorityFromExpirationTime( + currentTime, + expirationTime + ); + hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + } catch (err) {} + }; + onCommitFiberUnmount = function(fiber) { + try { + hook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) {} + }; + } catch (err) {} + return !0; +} +function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.effectTag = 0; + this.lastEffect = this.firstEffect = this.nextEffect = null; + this.childExpirationTime = this.expirationTime = 0; + this.alternate = null; + this.actualDuration = 0; + this.actualStartTime = -1; + this.treeBaseDuration = this.selfBaseDuration = 0; +} +function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); +} +function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); +} +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} +function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress + ? ((workInProgress = createFiber( + current.tag, + pendingProps, + current.key, + current.mode + )), + (workInProgress.elementType = current.elementType), + (workInProgress.type = current.type), + (workInProgress.stateNode = current.stateNode), + (workInProgress.alternate = current), + (current.alternate = workInProgress)) + : ((workInProgress.pendingProps = pendingProps), + (workInProgress.effectTag = 0), + (workInProgress.nextEffect = null), + (workInProgress.firstEffect = null), + (workInProgress.lastEffect = null), + (workInProgress.actualDuration = 0), + (workInProgress.actualStartTime = -1)); + workInProgress.childExpirationTime = current.childExpirationTime; + workInProgress.expirationTime = current.expirationTime; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = + null === pendingProps + ? null + : { + expirationTime: pendingProps.expirationTime, + firstContext: pendingProps.firstContext, + responders: pendingProps.responders + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + return workInProgress; +} +function createFiberFromTypeAndProps( + type, + key, + pendingProps, + owner, + mode, + expirationTime +) { + var fiberTag = 2; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = 5; + else + a: switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment( + pendingProps.children, + mode, + expirationTime, + key + ); + case REACT_CONCURRENT_MODE_TYPE: + fiberTag = 8; + mode |= 7; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 1; + break; + case REACT_PROFILER_TYPE: + return ( + (type = createFiber(12, pendingProps, key, mode | 8)), + (type.elementType = REACT_PROFILER_TYPE), + (type.type = REACT_PROFILER_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_TYPE: + return ( + (type = createFiber(13, pendingProps, key, mode)), + (type.type = REACT_SUSPENSE_TYPE), + (type.elementType = REACT_SUSPENSE_TYPE), + (type.expirationTime = expirationTime), + type + ); + case REACT_SUSPENSE_LIST_TYPE: + return ( + (type = createFiber(19, pendingProps, key, mode)), + (type.elementType = REACT_SUSPENSE_LIST_TYPE), + (type.expirationTime = expirationTime), + type + ); + default: + if ("object" === typeof type && null !== type) + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = 10; + break a; + case REACT_CONTEXT_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + throw ReactError( + Error( + "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + + (null == type ? type : typeof type) + + "." + ) + ); + } + key = createFiber(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.expirationTime = expirationTime; + return key; +} +function createFiberFromFragment(elements, mode, expirationTime, key) { + elements = createFiber(7, elements, key, mode); + elements.expirationTime = expirationTime; + return elements; +} +function createFiberFromText(content, mode, expirationTime) { + content = createFiber(6, content, null, mode); + content.expirationTime = expirationTime; + return content; +} +function createFiberFromPortal(portal, mode, expirationTime) { + mode = createFiber( + 4, + null !== portal.children ? portal.children : [], + portal.key, + mode + ); + mode.expirationTime = expirationTime; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; +} +function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.current = null; + this.containerInfo = containerInfo; + this.pingCache = this.pendingChildren = null; + this.finishedExpirationTime = 0; + this.finishedWork = null; + this.timeoutHandle = -1; + this.pendingContext = this.context = null; + this.hydrate = hydrate; + this.callbackNode = this.firstBatch = null; + this.pingTime = this.lastPendingTime = this.firstPendingTime = this.callbackExpirationTime = 0; + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); +} function findHostInstance(component) { var fiber = component._reactInternalFiber; if (void 0 === fiber) { if ("function" === typeof component.render) - throw ReactError("Unable to find node on an unmounted component."); + throw ReactError(Error("Unable to find node on an unmounted component.")); throw ReactError( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + Error( + "Argument appears to not be a ReactComponent. Keys: " + + Object.keys(component) + ) ); } component = findCurrentHostFiber(fiber); @@ -6997,8 +7764,13 @@ function findHostInstance(component) { } function updateContainer(element, container, parentComponent, callback) { var current$$1 = container.current, - currentTime = requestCurrentTime(); - current$$1 = computeExpirationForFiber(currentTime, current$$1); + currentTime = requestCurrentTime(), + suspenseConfig = ReactCurrentBatchConfig.suspense; + current$$1 = computeExpirationForFiber( + currentTime, + current$$1, + suspenseConfig + ); currentTime = container.current; a: if (parentComponent) { parentComponent = parentComponent._reactInternalFiber; @@ -7008,7 +7780,9 @@ function updateContainer(element, container, parentComponent, callback) { 1 !== parentComponent.tag ) throw ReactError( - "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + Error( + "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." + ) ); var parentContext = parentComponent; do { @@ -7027,7 +7801,9 @@ function updateContainer(element, container, parentComponent, callback) { parentContext = parentContext.return; } while (null !== parentContext); throw ReactError( - "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + Error( + "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." + ) ); } if (1 === parentComponent.tag) { @@ -7047,12 +7823,11 @@ function updateContainer(element, container, parentComponent, callback) { ? (container.context = parentComponent) : (container.pendingContext = parentComponent); container = callback; - callback = createUpdate(current$$1); - callback.payload = { element: element }; + suspenseConfig = createUpdate(current$$1, suspenseConfig); + suspenseConfig.payload = { element: element }; container = void 0 === container ? null : container; - null !== container && (callback.callback = container); - flushPassiveEffects(); - enqueueUpdate(currentTime, callback); + null !== container && (suspenseConfig.callback = container); + enqueueUpdate(currentTime, suspenseConfig); scheduleUpdateOnFiber(currentTime, current$$1); return current$$1; } @@ -7089,7 +7864,7 @@ function _inherits(subClass, superClass) { var getInspectorDataForViewTag = void 0; getInspectorDataForViewTag = function() { throw ReactError( - "getInspectorDataForViewTag() is not available in production" + Error("getInspectorDataForViewTag() is not available in production") ); }; function findNodeHandle(componentOrHandle) { @@ -7105,19 +7880,19 @@ function findNodeHandle(componentOrHandle) { ? componentOrHandle.canonical._nativeTag : componentOrHandle._nativeTag; } -_batchedUpdatesImpl = function(fn, a) { - if (0 !== workPhase) return fn(a); - workPhase = 1; +batchedUpdatesImpl = function(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= 1; try { return fn(a); } finally { - (workPhase = 0), flushImmediateQueue(); + (executionContext = prevExecutionContext), + executionContext === NoContext && flushSyncCallbackQueue(); } }; -_flushInteractiveUpdatesImpl = function() { - workPhase !== RenderPhase && - workPhase !== CommitPhase && - flushPendingDiscreteUpdates(); +flushDiscreteUpdatesImpl = function() { + (executionContext & (1 | RenderContext | CommitContext)) === NoContext && + (flushPendingDiscreteUpdates(), flushPassiveEffects()); }; var roots = new Map(), ReactNativeRenderer = { @@ -7138,10 +7913,14 @@ var roots = new Map(), } _inherits(ReactNativeComponent, _React$Component); ReactNativeComponent.prototype.blur = function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.focus = function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }; ReactNativeComponent.prototype.measure = function(callback) { var maybeInstance = void 0; @@ -7154,7 +7933,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7170,7 +7949,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7192,7 +7971,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -7216,7 +7995,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -7227,6 +8006,14 @@ var roots = new Map(), })(React.Component); })(findNodeHandle, findHostInstance), findNodeHandle: findNodeHandle, + dispatchCommand: function(handle, command, args) { + null != handle._nativeTag && + ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand( + handle._nativeTag, + command, + args + ); + }, setNativeProps: function(handle, nativeProps) { null != handle._nativeTag && ((nativeProps = diffProperties( @@ -7236,7 +8023,7 @@ var roots = new Map(), handle.viewConfig.validAttributes )), null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( handle._nativeTag, handle.viewConfig.uiViewClassName, nativeProps @@ -7245,9 +8032,9 @@ var roots = new Map(), render: function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, !1); + root = new FiberRootNode(containerTag, 0, !1); var uninitializedFiber = 0; - isDevToolsPresent && (uninitializedFiber |= 4); + isDevToolsPresent && (uninitializedFiber |= 8); uninitializedFiber = createFiber(3, null, null, uninitializedFiber); root.current = uninitializedFiber; uninitializedFiber.stateNode = root; @@ -7274,7 +8061,7 @@ var roots = new Map(), }, unmountComponentAtNodeAndRemoveContainer: function(containerTag) { ReactNativeRenderer.unmountComponentAtNode(containerTag); - UIManager.removeRootView(containerTag); + ReactNativePrivateInterface.UIManager.removeRootView(containerTag); }, createPortal: function(children, containerTag) { return createPortal( @@ -7299,7 +8086,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measure( + : ReactNativePrivateInterface.UIManager.measure( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7315,7 +8102,7 @@ var roots = new Map(), maybeInstance.node, mountSafeCallback_NOT_REALLY_SAFE(this, callback) ) - : UIManager.measureInWindow( + : ReactNativePrivateInterface.UIManager.measureInWindow( findNodeHandle(this), mountSafeCallback_NOT_REALLY_SAFE(this, callback) )); @@ -7333,7 +8120,7 @@ var roots = new Map(), : relativeToNativeNode._nativeTag && (maybeInstance = relativeToNativeNode._nativeTag), null != maybeInstance && - UIManager.measureLayout( + ReactNativePrivateInterface.UIManager.measureLayout( findNodeHandle(this), maybeInstance, mountSafeCallback_NOT_REALLY_SAFE(this, onFail), @@ -7357,7 +8144,7 @@ var roots = new Map(), maybeInstance.validAttributes ); null != nativeProps && - UIManager.updateView( + ReactNativePrivateInterface.UIManager.updateView( nativeTag, maybeInstance.uiViewClassName, nativeProps @@ -7365,10 +8152,14 @@ var roots = new Map(), } }, focus: function() { - TextInputState.focusTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.focusTextInput( + findNodeHandle(this) + ); }, blur: function() { - TextInputState.blurTextInput(findNodeHandle(this)); + ReactNativePrivateInterface.TextInputState.blurTextInput( + findNodeHandle(this) + ); } }; })(findNodeHandle, findHostInstance), @@ -7396,7 +8187,12 @@ var roots = new Map(), return findFiberByHostInstance ? findFiberByHostInstance(instance) : null; - } + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null }) ); })({ diff --git a/Libraries/Renderer/shims/ReactFabric.js b/Libraries/Renderer/shims/ReactFabric.js index 5cea0e09037851..8f6a708fd20579 100644 --- a/Libraries/Renderer/shims/ReactFabric.js +++ b/Libraries/Renderer/shims/ReactFabric.js @@ -10,7 +10,7 @@ 'use strict'; -const BatchedBridge = require('../../BatchedBridge/BatchedBridge'); +import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'; // TODO @sema: Adjust types import type {ReactNativeType} from './ReactNativeTypes'; @@ -18,9 +18,9 @@ import type {ReactNativeType} from './ReactNativeTypes'; let ReactFabric; if (__DEV__) { - ReactFabric = require('ReactFabric-dev'); + ReactFabric = require('../implementations/ReactFabric-dev'); } else { - ReactFabric = require('ReactFabric-prod'); + ReactFabric = require('../implementations/ReactFabric-prod'); } BatchedBridge.registerCallableModule('ReactFabric', ReactFabric); diff --git a/Libraries/Renderer/shims/ReactFeatureFlags.js b/Libraries/Renderer/shims/ReactFeatureFlags.js index 5a2b32e747e601..86feb9c0228212 100644 --- a/Libraries/Renderer/shims/ReactFeatureFlags.js +++ b/Libraries/Renderer/shims/ReactFeatureFlags.js @@ -1,18 +1,17 @@ /** - * 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. * - * @providesModule ReactFeatureFlags + * @format + * @flow */ 'use strict'; const ReactFeatureFlags = { debugRenderPhaseSideEffects: false, - debugRenderPhaseSideEffectsForStrictMode: false, - warnAboutDeprecatedLifecycles: false, }; module.exports = ReactFeatureFlags; diff --git a/Libraries/Renderer/shims/ReactNative.js b/Libraries/Renderer/shims/ReactNative.js index 857858e55bd39a..9f471e4107a7ee 100644 --- a/Libraries/Renderer/shims/ReactNative.js +++ b/Libraries/Renderer/shims/ReactNative.js @@ -15,9 +15,9 @@ import type {ReactNativeType} from './ReactNativeTypes'; let ReactNative; if (__DEV__) { - ReactNative = require('ReactNativeRenderer-dev'); + ReactNative = require('../implementations/ReactNativeRenderer-dev'); } else { - ReactNative = require('ReactNativeRenderer-prod'); + ReactNative = require('../implementations/ReactNativeRenderer-prod'); } module.exports = (ReactNative: ReactNativeType); diff --git a/Libraries/Renderer/shims/ReactNativeTypes.js b/Libraries/Renderer/shims/ReactNativeTypes.js index 3e777114db2ae5..04200f2bb9fa87 100644 --- a/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/Libraries/Renderer/shims/ReactNativeTypes.js @@ -131,6 +131,7 @@ type SecretInternalsFabricType = { export type ReactNativeType = { NativeComponent: typeof ReactNativeComponent, findNodeHandle(componentOrHandle: any): ?number, + dispatchCommand(handle: any, command: string, args: Array): void, setNativeProps(handle: any, nativeProps: Object): void, render( element: React$Element, @@ -147,6 +148,7 @@ export type ReactNativeType = { export type ReactFabricType = { NativeComponent: typeof ReactNativeComponent, findNodeHandle(componentOrHandle: any): ?number, + dispatchCommand(handle: any, command: string, args: Array): void, setNativeProps(handle: any, nativeProps: Object): void, render( element: React$Element, @@ -154,6 +156,82 @@ export type ReactFabricType = { callback: ?Function, ): any, unmountComponentAtNode(containerTag: number): any, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsFabricType, }; + +export type ReactNativeEventTarget = { + node: Object, + canonical: { + _nativeTag: number, + viewConfig: ReactNativeBaseComponentViewConfig<>, + currentProps: Object, + _internalInstanceHandle: Object, + }, +}; + +export type ReactFaricEventTouch = { + identifier: number, + locationX: number, + locationY: number, + pageX: number, + pageY: number, + screenX: number, + screenY: number, + target: number, + timestamp: number, + force: number, +}; + +export type ReactFaricEvent = { + touches: Array, + changedTouches: Array, + targetTouches: Array, + target: number, +}; + +export type ReactNativeResponderEvent = { + nativeEvent: ReactFaricEvent, + responderTarget: null | ReactNativeEventTarget, + target: null | ReactNativeEventTarget, + type: string, +}; + +export type ReactNativeResponderContext = { + dispatchEvent: ( + eventValue: any, + listener: (any) => void, + eventPriority: EventPriority, + ) => void, + isTargetWithinNode: ( + childTarget: ReactNativeEventTarget, + parentTarget: ReactNativeEventTarget, + ) => boolean, + getTargetBoundingRect( + target: ReactNativeEventTarget, + cb: ({ + left: number, + right: number, + top: number, + bottom: number, + }) => void, + ): void, + addRootEventTypes: (rootEventTypes: Array) => void, + removeRootEventTypes: (rootEventTypes: Array) => void, + setTimeout: (func: () => void, timeout: number) => number, + clearTimeout: (timerId: number) => void, + getTimeStamp: () => number, +}; + +export type PointerType = + | '' + | 'mouse' + | 'keyboard' + | 'pen' + | 'touch' + | 'trackpad'; + +export type EventPriority = 0 | 1 | 2; + +export const DiscreteEvent: EventPriority = 0; +export const UserBlockingEvent: EventPriority = 1; +export const ContinuousEvent: EventPriority = 2; diff --git a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js index cb27a9d9668616..c1e192abae644b 100644 --- a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +++ b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js @@ -8,6 +8,8 @@ * @flow strict-local */ +/* eslint-disable react-internal/warning-and-invariant-args */ + 'use strict'; import type { @@ -18,13 +20,11 @@ import type { const invariant = require('invariant'); // Event configs -const customBubblingEventTypes = {}; -const customDirectEventTypes = {}; -const eventTypes = {}; +const customBubblingEventTypes: $TEMPORARY$object<{||}> = {}; +const customDirectEventTypes: $TEMPORARY$object<{||}> = {}; exports.customBubblingEventTypes = customBubblingEventTypes; exports.customDirectEventTypes = customDirectEventTypes; -exports.eventTypes = eventTypes; const viewConfigCallbacks = new Map(); const viewConfigs = new Map(); @@ -49,7 +49,7 @@ function processEventTypes( if (bubblingEventTypes != null) { for (const topLevelType in bubblingEventTypes) { if (customBubblingEventTypes[topLevelType] == null) { - eventTypes[topLevelType] = customBubblingEventTypes[topLevelType] = + customBubblingEventTypes[topLevelType] = bubblingEventTypes[topLevelType]; } } @@ -58,8 +58,7 @@ function processEventTypes( if (directEventTypes != null) { for (const topLevelType in directEventTypes) { if (customDirectEventTypes[topLevelType] == null) { - eventTypes[topLevelType] = customDirectEventTypes[topLevelType] = - directEventTypes[topLevelType]; + customDirectEventTypes[topLevelType] = directEventTypes[topLevelType]; } } } @@ -69,7 +68,6 @@ function processEventTypes( * Registers a native view/component by name. * A callback is provided to load the view config from UIManager. * The callback is deferred until the view is actually rendered. - * This is done to avoid causing Prepack deopts. */ exports.register = function(name: string, callback: ViewConfigGetter): string { invariant( diff --git a/Libraries/Renderer/shims/ReactTypes.js b/Libraries/Renderer/shims/ReactTypes.js index 229889f6156217..7f72ce6782c09a 100644 --- a/Libraries/Renderer/shims/ReactTypes.js +++ b/Libraries/Renderer/shims/ReactTypes.js @@ -7,16 +7,13 @@ * @flow */ -/* eslint-disable no-use-before-define */ export type ReactNode = | React$Element | ReactPortal | ReactText | ReactFragment | ReactProvider - | ReactConsumer - | ReactEventComponent - | ReactEventTarget; + | ReactConsumer; export type ReactEmpty = null | void | boolean; @@ -82,111 +79,86 @@ export type RefObject = {| current: any, |}; -export type ReactEventResponderEventType = - | string - | {name: string, passive?: boolean}; - -export type ReactEventResponder = { - targetEventTypes?: Array, - rootEventTypes?: Array, - createInitialState?: (props: null | Object) => Object, - stopLocalPropagation: boolean, - onEvent?: ( - event: ReactResponderEvent, - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, - onEventCapture?: ( - event: ReactResponderEvent, - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, - onRootEvent?: ( - event: ReactResponderEvent, - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, - onMount?: ( - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, - onUnmount?: ( - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, - onOwnershipChange?: ( - context: ReactResponderContext, - props: null | Object, - state: null | Object, - ) => void, -}; - -export type ReactEventComponentInstance = {| - currentFiber: mixed, - props: null | Object, - responder: ReactEventResponder, +export type ReactEventResponderInstance = {| + fiber: Object, + props: Object, + responder: ReactEventResponder, rootEventTypes: null | Set, - rootInstance: mixed, - state: null | Object, + state: Object, + target: mixed, |}; -export type ReactEventComponent = {| - $$typeof: Symbol | number, - displayName?: string, - props: null | Object, - responder: ReactEventResponder, +export type ReactEventResponderListener = {| + props: Object, + responder: ReactEventResponder, |}; -export type ReactEventTarget = {| +export type ReactEventResponder = { $$typeof: Symbol | number, - displayName?: string, - type: Symbol | number, -|}; + displayName: string, + targetEventTypes: null | Array, + rootEventTypes: null | Array, + getInitialState: null | ((props: Object) => Object), + onEvent: + | null + | ((event: E, context: C, props: Object, state: Object) => void), + onRootEvent: + | null + | ((event: E, context: C, props: Object, state: Object) => void), + onMount: null | ((context: C, props: Object, state: Object) => void), + onUnmount: null | ((context: C, props: Object, state: Object) => void), + onOwnershipChange: + | null + | ((context: C, props: Object, state: Object) => void), +}; -type AnyNativeEvent = Event | KeyboardEvent | MouseEvent | Touch; +export type EventPriority = 0 | 1 | 2; -export type ReactResponderEvent = { - nativeEvent: AnyNativeEvent, - target: Element | Document, - type: string, - passive: boolean, - passiveSupported: boolean, -}; +export const DiscreteEvent: EventPriority = 0; +export const UserBlockingEvent: EventPriority = 1; +export const ContinuousEvent: EventPriority = 2; -export type ReactResponderDispatchEventOptions = { - discrete?: boolean, -}; +export type ReactFundamentalComponentInstance = {| + currentFiber: mixed, + instance: mixed, + prevProps: null | Object, + props: Object, + impl: ReactFundamentalImpl, + state: Object, +|}; -export type ReactResponderContext = { - dispatchEvent: ( - eventObject: Object, - listener: (Object) => void, - options: ReactResponderDispatchEventOptions, - ) => void, - isTargetWithinElement: ( - childTarget: Element | Document, - parentTarget: Element | Document, +export type ReactFundamentalImpl = { + displayName: string, + reconcileChildren: boolean, + getInitialState?: (props: Object) => Object, + getInstance: (context: C, props: Object, state: Object) => H, + getServerSideString?: (context: C, props: Object) => string, + getServerSideStringClose?: (context: C, props: Object) => string, + onMount: (context: C, instance: mixed, props: Object, state: Object) => void, + shouldUpdate?: ( + context: C, + prevProps: null | Object, + nextProps: Object, + state: Object, ) => boolean, - isTargetWithinEventComponent: (Element | Document) => boolean, - isTargetWithinEventResponderScope: (Element | Document) => boolean, - isPositionWithinTouchHitTarget: (x: number, y: number) => boolean, - addRootEventTypes: ( - rootEventTypes: Array, + onUpdate?: ( + context: C, + instance: mixed, + prevProps: null | Object, + nextProps: Object, + state: Object, ) => void, - removeRootEventTypes: ( - rootEventTypes: Array, + onUnmount?: ( + context: C, + instance: mixed, + props: Object, + state: Object, ) => void, - hasOwnership: () => boolean, - requestResponderOwnership: () => boolean, - requestGlobalOwnership: () => boolean, - releaseOwnership: () => boolean, - setTimeout: (func: () => void, timeout: number) => Symbol, - clearTimeout: (timerId: Symbol) => void, - getFocusableElementsInScope(): Array, - getActiveDocument(): Document, + onHydrate?: (context: C, props: Object, state: Object) => boolean, + onFocus?: (context: C, props: Object, state: Object) => boolean, }; + +export type ReactFundamentalComponent = {| + $$typeof: Symbol | number, + impl: ReactFundamentalImpl, +|}; diff --git a/Libraries/Renderer/shims/createReactNativeComponentClass.js b/Libraries/Renderer/shims/createReactNativeComponentClass.js index c632a3c0fbb35a..86a758d918b483 100644 --- a/Libraries/Renderer/shims/createReactNativeComponentClass.js +++ b/Libraries/Renderer/shims/createReactNativeComponentClass.js @@ -10,9 +10,11 @@ 'use strict'; +import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'; + import type {ViewConfigGetter} from './ReactNativeTypes'; -const {register} = require('./ReactNativeViewConfigRegistry'); +const {register} = ReactNativeViewConfigRegistry; /** * Creates a renderable ReactNative host component. diff --git a/Libraries/Sample/Sample.android.js b/Libraries/Sample/Sample.android.js index 2b30b41d7defa4..65ab87d6b04941 100644 --- a/Libraries/Sample/Sample.android.js +++ b/Libraries/Sample/Sample.android.js @@ -16,6 +16,9 @@ const warning = require('fbjs/lib/warning'); const Sample = { test: function() { + /* $FlowFixMe(>=0.103.0 site=react_native_android_fb) This comment + * suppresses an error found when Flow v0.103 was deployed. To see the + * error, delete this comment and run Flow. */ warning('Not yet implemented for Android.'); }, }; diff --git a/Libraries/Sample/Sample.xcodeproj/project.pbxproj b/Libraries/Sample/Sample.xcodeproj/project.pbxproj deleted file mode 100644 index 7200a72610119f..00000000000000 --- a/Libraries/Sample/Sample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,277 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 13BE3DEE1AC21097009241FE /* Sample.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* Sample.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSample.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 13BE3DEC1AC21097009241FE /* Sample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sample.h; sourceTree = ""; }; - 13BE3DED1AC21097009241FE /* Sample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Sample.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libSample.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13BE3DEC1AC21097009241FE /* Sample.h */, - 13BE3DED1AC21097009241FE /* Sample.m */, - 134814211AA4EA7D00B7C361 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* Sample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Sample" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Sample; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libSample.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Sample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* Sample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13BE3DEE1AC21097009241FE /* Sample.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../React/**", - "$(SRCROOT)/../../node_modules/react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = Sample; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = Sample; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/Sample/package.json b/Libraries/Sample/package.json index 3649dfb7c3737d..e4f6875b771eef 100644 --- a/Libraries/Sample/package.json +++ b/Libraries/Sample/package.json @@ -1,5 +1,8 @@ { "name": "Sample", "version": "0.0.1", - "keywords": "react-native" + "keywords": "react-native", + "beachball": { + "shouldPublish": false + } } diff --git a/Libraries/Settings/NativeSettingsManager.js b/Libraries/Settings/NativeSettingsManager.js new file mode 100644 index 00000000000000..1edd6187218962 --- /dev/null +++ b/Libraries/Settings/NativeSettingsManager.js @@ -0,0 +1,26 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + settings: Object, + |}; + +setValues: (values: Object) => void; + +deleteValues: (values: Array) => void; +} + +export default (TurboModuleRegistry.getEnforcing( + 'SettingsManager', +): Spec); diff --git a/Libraries/Settings/RCTSettings.xcodeproj/project.pbxproj b/Libraries/Settings/RCTSettings.xcodeproj/project.pbxproj deleted file mode 100644 index a6bdcec2d3b759..00000000000000 --- a/Libraries/Settings/RCTSettings.xcodeproj/project.pbxproj +++ /dev/null @@ -1,394 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 13DBA45E1AEE749000A17CF8 /* RCTSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */; }; - 2D3B5F2C1D9B0ECA00451313 /* RCTSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */; }; - 6448A5C91F292E63006FF1F5 /* RCTSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTSettings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTSettings.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 13DBA45C1AEE749000A17CF8 /* RCTSettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSettingsManager.h; sourceTree = ""; }; - 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSettingsManager.m; sourceTree = ""; }; - 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTSettings-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6448A5CD1F292E63006FF1F5 /* libRCTSettings-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTSettings-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTSettings.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13DBA45C1AEE749000A17CF8 /* RCTSettingsManager.h */, - 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */, - 6448A5CD1F292E63006FF1F5 /* libRCTSettings-macOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28601D9B046600D4039D /* RCTSettings-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28691D9B046600D4039D /* Build configuration list for PBXNativeTarget "RCTSettings-tvOS" */; - buildPhases = ( - 2D2A285D1D9B046600D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTSettings-tvOS"; - productName = "RCTSettings-tvOS"; - productReference = 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTSettings */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSettings" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTSettings; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTSettings.a */; - productType = "com.apple.product-type.library.static"; - }; - 6448A5C71F292E63006FF1F5 /* RCTSettings-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6448A5CA1F292E63006FF1F5 /* Build configuration list for PBXNativeTarget "RCTSettings-macOS" */; - buildPhases = ( - 6448A5C81F292E63006FF1F5 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTSettings-macOS"; - productName = RCTDataManager; - productReference = 6448A5CD1F292E63006FF1F5 /* libRCTSettings-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28601D9B046600D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSettings" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTSettings */, - 2D2A28601D9B046600D4039D /* RCTSettings-tvOS */, - 6448A5C71F292E63006FF1F5 /* RCTSettings-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A285D1D9B046600D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F2C1D9B0ECA00451313 /* RCTSettingsManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13DBA45E1AEE749000A17CF8 /* RCTSettingsManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6448A5C81F292E63006FF1F5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6448A5C91F292E63006FF1F5 /* RCTSettingsManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28671D9B046600D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28681D9B046600D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTSettings; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTSettings; - }; - name = Release; - }; - 6448A5CB1F292E63006FF1F5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 6448A5CC1F292E63006FF1F5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28691D9B046600D4039D /* Build configuration list for PBXNativeTarget "RCTSettings-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28671D9B046600D4039D /* Debug */, - 2D2A28681D9B046600D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSettings" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSettings" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6448A5CA1F292E63006FF1F5 /* Build configuration list for PBXNativeTarget "RCTSettings-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6448A5CB1F292E63006FF1F5 /* Debug */, - 6448A5CC1F292E63006FF1F5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/Libraries/Settings/RCTSettingsManager.m b/Libraries/Settings/RCTSettingsManager.m index 046ebed391f714..a119fac4e10f7a 100644 --- a/Libraries/Settings/RCTSettingsManager.m +++ b/Libraries/Settings/RCTSettingsManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTSettingsManager.h" +#import #import #import diff --git a/Libraries/Settings/React-RCTSettings.podspec b/Libraries/Settings/React-RCTSettings.podspec index 6c147d557a7195..8b82c09c6d6087 100644 --- a/Libraries/Settings/React-RCTSettings.podspec +++ b/Libraries/Settings/React-RCTSettings.podspec @@ -27,9 +27,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTSettings" - s.dependency "React-Core", version + s.dependency "React-Core/RCTSettingsHeaders", version end diff --git a/Libraries/Settings/Settings.ios.js b/Libraries/Settings/Settings.ios.js index 4084364721ec3e..55d8ff0481d2e1 100644 --- a/Libraries/Settings/Settings.ios.js +++ b/Libraries/Settings/Settings.ios.js @@ -11,15 +11,16 @@ 'use strict'; const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); -const RCTSettingsManager = require('../BatchedBridge/NativeModules') - .SettingsManager; const invariant = require('invariant'); +import NativeSettingsManager from './NativeSettingsManager'; + const subscriptions: Array<{keys: Array, callback: ?Function}> = []; const Settings = { - _settings: RCTSettingsManager && RCTSettingsManager.settings, + _settings: (NativeSettingsManager && + NativeSettingsManager.getConstants().settings: any), get(key: string): mixed { return this._settings[key]; @@ -27,7 +28,7 @@ const Settings = { set(settings: Object) { this._settings = Object.assign(this._settings, settings); - RCTSettingsManager.setValues(settings); + NativeSettingsManager.setValues(settings); }, watchKeys(keys: string | Array, callback: Function): number { diff --git a/Libraries/Settings/Settings.macos.js b/Libraries/Settings/Settings.macos.js index 0b2d4d2f09fa5d..2c430ba85f489d 100644 --- a/Libraries/Settings/Settings.macos.js +++ b/Libraries/Settings/Settings.macos.js @@ -12,8 +12,8 @@ 'use strict'; -var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -var RCTSettingsManager = require('NativeModules').SettingsManager; +var RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); +var RCTSettingsManager = require('../BatchedBridge/NativeModules').SettingsManager; var invariant = require('fbjs/lib/invariant'); diff --git a/Libraries/Share/NativeShareModule.js b/Libraries/Share/NativeShareModule.js new file mode 100644 index 00000000000000..88293b8ce87bac --- /dev/null +++ b/Libraries/Share/NativeShareModule.js @@ -0,0 +1,24 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +share: ( + content: {|title?: string, message?: string|}, + dialogTitle?: string, + ) => Promise<{|action: string|}>; +} + +export default (TurboModuleRegistry.get('ShareModule'): ?Spec); diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js index bd1ae08d5cadb7..1b064db277f459 100644 --- a/Libraries/Share/Share.js +++ b/Libraries/Share/Share.js @@ -15,10 +15,8 @@ const Platform = require('../Utilities/Platform'); const invariant = require('invariant'); const processColor = require('../StyleSheet/processColor'); -const { - ActionSheetManager, - ShareModule, -} = require('../BatchedBridge/NativeModules'); +import NativeActionSheetManager from '../ActionSheetIOS/NativeActionSheetManager'; +import NativeShareModule from './NativeShareModule'; type Content = | {title?: string, message: string} @@ -79,15 +77,40 @@ class Share { ); if (Platform.OS === 'android') { + invariant( + NativeShareModule, + 'ShareModule should be registered on Android.', + ); invariant( !content.title || typeof content.title === 'string', 'Invalid title: title should be a string.', ); - return ShareModule.share(content, options.dialogTitle); + + const newContent = { + title: content.title, + message: + typeof content.message === 'string' ? content.message : undefined, + }; + + return NativeShareModule.share(newContent, options.dialogTitle); } else if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { - ActionSheetManager.showShareActionSheetWithOptions( - {...content, ...options, tintColor: processColor(options.tintColor)}, + const tintColor = processColor(options.tintColor); + + invariant( + NativeActionSheetManager, + 'NativeActionSheetManager is not registered on iOS, but it should be.', + ); + + NativeActionSheetManager.showShareActionSheetWithOptions( + { + message: + typeof content.message === 'string' ? content.message : undefined, + url: typeof content.url === 'string' ? content.url : undefined, + subject: options.subject, + tintColor: tintColor != null ? tintColor : undefined, + excludedActivityTypes: options.excludedActivityTypes, + }, error => reject(error), (success, activityType) => { if (success) { @@ -111,17 +134,13 @@ class Share { /** * The content was successfully shared. */ - static get sharedAction(): string { - return 'sharedAction'; - } + static sharedAction: 'sharedAction' = 'sharedAction'; /** * The dialog has been dismissed. * @platform ios */ - static get dismissedAction(): string { - return 'dismissedAction'; - } + static dismissedAction: 'dismissedAction' = 'dismissedAction'; } module.exports = Share; diff --git a/Libraries/Storage/AsyncStorage.js b/Libraries/Storage/AsyncStorage.js index 5341eacbe4b015..5c749a93805d3d 100644 --- a/Libraries/Storage/AsyncStorage.js +++ b/Libraries/Storage/AsyncStorage.js @@ -12,11 +12,11 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativeAsyncStorage from './NativeAsyncStorage'; +import invariant from 'invariant'; // Use SQLite if available, otherwise file storage. -const RCTAsyncStorage = - NativeModules.AsyncSQLiteDBStorage || NativeModules.AsyncLocalStorage; +const RCTAsyncStorage = NativeAsyncStorage; /** * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value @@ -39,6 +39,7 @@ const AsyncStorage = { key: string, callback?: ?(error: ?Error, result: ?string) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiGet([key], function(errors, result) { // Unpack result to get value from [[key,value]] @@ -64,6 +65,7 @@ const AsyncStorage = { value: string, callback?: ?(error: ?Error) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiSet([[key, value]], function(errors) { const errs = convertErrors(errors); @@ -86,6 +88,7 @@ const AsyncStorage = { key: string, callback?: ?(error: ?Error) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiRemove([key], function(errors) { const errs = convertErrors(errors); @@ -112,6 +115,7 @@ const AsyncStorage = { value: string, callback?: ?(error: ?Error) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiMerge([[key, value]], function(errors) { const errs = convertErrors(errors); @@ -133,6 +137,7 @@ const AsyncStorage = { * See http://facebook.github.io/react-native/docs/asyncstorage.html#clear */ clear: function(callback?: ?(error: ?Error) => void): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.clear(function(error) { callback && callback(convertError(error)); @@ -153,6 +158,7 @@ const AsyncStorage = { getAllKeys: function( callback?: ?(error: ?Error, keys: ?Array) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.getAllKeys(function(error, keys) { callback && callback(convertError(error), keys); @@ -187,6 +193,7 @@ const AsyncStorage = { this._getRequests = []; this._getKeys = []; + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); RCTAsyncStorage.multiGet(getKeys, function(errors, result) { // Even though the runtime complexity of this is theoretically worse vs if we used a map, // it's much, much faster in practice for the data sets we deal with (we avoid @@ -264,6 +271,7 @@ const AsyncStorage = { keyValuePairs: Array>, callback?: ?(errors: ?Array) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiSet(keyValuePairs, function(errors) { const error = convertErrors(errors); @@ -286,6 +294,7 @@ const AsyncStorage = { keys: Array, callback?: ?(errors: ?Array) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiRemove(keys, function(errors) { const error = convertErrors(errors); @@ -311,6 +320,7 @@ const AsyncStorage = { keyValuePairs: Array>, callback?: ?(errors: ?Array) => void, ): Promise { + invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) { const error = convertErrors(errors); diff --git a/Libraries/Storage/NativeAsyncStorage.js b/Libraries/Storage/NativeAsyncStorage.js new file mode 100644 index 00000000000000..e7c8e567bbfefd --- /dev/null +++ b/Libraries/Storage/NativeAsyncStorage.js @@ -0,0 +1,44 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +multiGet: ( + keys: Array, + callback: ( + errors: ?Array<{|message: string|}>, + kvPairs: ?Array>, + ) => void, + ) => void; + +multiSet: ( + kvPairs: Array>, + callback: (errors: ?Array<{|message: string|}>) => void, + ) => void; + +multiMerge: ( + kvPairs: Array>, + callback: (errors: ?Array<{|message: string|}>) => void, + ) => void; + +multiRemove: ( + keys: Array, + callback: (errors: ?Array<{|message: string|}>) => void, + ) => void; + +clear: (callback: (error: {|message: string|}) => void) => void; + +getAllKeys: ( + callback: (error: ?{|message: string|}, allKeys: ?Array) => void, + ) => void; +} + +export default (TurboModuleRegistry.get('AsyncSQLiteDBStorage') || + TurboModuleRegistry.get('AsyncLocalStorage'): ?Spec); diff --git a/Libraries/StyleSheet/StyleSheet.js b/Libraries/StyleSheet/StyleSheet.js index 2692dd5892e4b7..deb6d8cc4e837a 100644 --- a/Libraries/StyleSheet/StyleSheet.js +++ b/Libraries/StyleSheet/StyleSheet.js @@ -151,7 +151,7 @@ export type ImageStyle = ____ImageStyle_Internal; */ export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal; -let hairlineWidth = PixelRatio.roundToNearestPixel(0.4); +let hairlineWidth: number = PixelRatio.roundToNearestPixel(0.4); if (hairlineWidth === 0) { hairlineWidth = 1 / PixelRatio.get(); } @@ -279,7 +279,7 @@ module.exports = { * > **NOTE**: Exercise caution as abusing this can tax you in terms of * > optimizations. * > - * > IDs enable optimizations through the bridge and memory in general. Refering + * > IDs enable optimizations through the bridge and memory in general. Referring * > to style objects directly will deprive you of these optimizations. * * Example: diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index bec6a232061e9a..abb0c769be62b6 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -14,6 +14,11 @@ const AnimatedNode = require('../Animated/src/nodes/AnimatedNode'); import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) export type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) +export type ColorArrayValue = null | $ReadOnlyArray; +export type PointValue = {| + x: number, + y: number, +|}; export type DimensionValue = null | number | string | AnimatedNode; /** diff --git a/Libraries/StyleSheet/StyleSheetValidation.js b/Libraries/StyleSheet/StyleSheetValidation.js index d2bb5303f6e955..6871751eb0dad0 100644 --- a/Libraries/StyleSheet/StyleSheetValidation.js +++ b/Libraries/StyleSheet/StyleSheetValidation.js @@ -11,7 +11,7 @@ 'use strict'; const DeprecatedImageStylePropTypes = require('../DeprecatedPropTypes/DeprecatedImageStylePropTypes'); -const TextStylePropTypes = require('../Text/TextStylePropTypes'); +const DeprecatedTextStylePropTypes = require('../DeprecatedPropTypes/DeprecatedTextStylePropTypes'); const DeprecatedViewStylePropTypes = require('../DeprecatedPropTypes/DeprecatedViewStylePropTypes'); const invariant = require('invariant'); @@ -89,7 +89,7 @@ const allStylePropTypes = {}; if (__DEV__ && !global.__RCTProfileIsProfiling) { StyleSheetValidation.addValidStylePropTypes(DeprecatedImageStylePropTypes); - StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes); + StyleSheetValidation.addValidStylePropTypes(DeprecatedTextStylePropTypes); StyleSheetValidation.addValidStylePropTypes(DeprecatedViewStylePropTypes); } diff --git a/Libraries/StyleSheet/__tests__/normalizeColor-test.js b/Libraries/StyleSheet/__tests__/normalizeColor-test.js index 974fa5ef99566f..094bd0a812c85c 100644 --- a/Libraries/StyleSheet/__tests__/normalizeColor-test.js +++ b/Libraries/StyleSheet/__tests__/normalizeColor-test.js @@ -28,7 +28,7 @@ describe('normalizeColor', function() { expect(normalizeColor(0xffffffff + 1)).toBe(null); }); - it('should temporarly accept floating point values for rgb', function() { + it('should temporarily accept floating point values for rgb', function() { expect(normalizeColor('rgb(1.1, 2.1, 3.1)')).toBe(0x010203ff); expect(normalizeColor('rgba(1.1, 2.1, 3.1, 1.0)')).toBe(0x010203ff); }); diff --git a/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js b/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js index 70b2877ae2cc4d..0bb9a1a19940b3 100644 --- a/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js +++ b/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js @@ -13,11 +13,14 @@ const splitLayoutProps = require('../splitLayoutProps'); test('splits style objects', () => { - const style = {width: 10, margin: 20, padding: 30}; + const style = {width: 10, margin: 20, padding: 30, transform: {scaleY: -1}}; const {outer, inner} = splitLayoutProps(style); expect(outer).toMatchInlineSnapshot(` Object { "margin": 20, + "transform": Object { + "scaleY": -1, + }, "width": 10, } `); diff --git a/Libraries/StyleSheet/processColor.js b/Libraries/StyleSheet/processColor.js index c29c408d1d4161..0129f2a39efb35 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -29,7 +29,7 @@ function processColor( } if (typeof int32Color === 'object') { - const processColorObject = require('processColorObject'); // TODO(macOS ISS#2323203) + const processColorObject = require('../StyleSheet/processColorObject'); // TODO(macOS ISS#2323203) const processedColorObj = processColorObject(int32Color); diff --git a/Libraries/StyleSheet/processColorArray.js b/Libraries/StyleSheet/processColorArray.js new file mode 100644 index 00000000000000..c7a716eea2153a --- /dev/null +++ b/Libraries/StyleSheet/processColorArray.js @@ -0,0 +1,22 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +const processColor = require('./processColor'); +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) + +function processColorArray( + colors: ?Array, +): ?Array { + return colors == null ? null : colors.map(processColor); +} + +module.exports = processColorArray; diff --git a/Libraries/StyleSheet/processColorObject.android.js b/Libraries/StyleSheet/processColorObject.android.js index 6fdcf84aa65212..911241b4631664 100644 --- a/Libraries/StyleSheet/processColorObject.android.js +++ b/Libraries/StyleSheet/processColorObject.android.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index 713d4f7a123a1f..45911b3e8f1a79 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -10,13 +10,13 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { - const processColor = require('processColor'); + const processColor = require('./processColor'); const dynamic = color.dynamic; const dynamicColor: NativeOrDynamicColorType = { dynamic: { diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index 713d4f7a123a1f..45911b3e8f1a79 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -10,13 +10,13 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; +import type {NativeOrDynamicColorType} from '../Color/NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { - const processColor = require('processColor'); + const processColor = require('./processColor'); const dynamic = color.dynamic; const dynamicColor: NativeOrDynamicColorType = { dynamic: { diff --git a/Libraries/StyleSheet/splitLayoutProps.js b/Libraries/StyleSheet/splitLayoutProps.js index 700fbea437f893..ab4197cc45e746 100644 --- a/Libraries/StyleSheet/splitLayoutProps.js +++ b/Libraries/StyleSheet/splitLayoutProps.js @@ -36,6 +36,7 @@ const OUTER_PROPS = Object.assign(Object.create(null), { right: true, bottom: true, top: true, + transform: true, }); function splitLayoutProps( diff --git a/Libraries/Text/BaseText/RCTBaseTextShadowView.h b/Libraries/Text/BaseText/RCTBaseTextShadowView.h index a7cbf10b70d25a..74b7434e43ad34 100644 --- a/Libraries/Text/BaseText/RCTBaseTextShadowView.h +++ b/Libraries/Text/BaseText/RCTBaseTextShadowView.h @@ -13,7 +13,10 @@ NS_ASSUME_NONNULL_BEGIN extern NSString *const RCTBaseTextShadowViewEmbeddedShadowViewAttributeName; -@interface RCTBaseTextShadowView : RCTShadowView +@interface RCTBaseTextShadowView : RCTShadowView { + @protected NSAttributedString *_Nullable cachedAttributedText; + @protected RCTTextAttributes *_Nullable cachedTextAttributes; +} @property (nonatomic, strong) RCTTextAttributes *textAttributes; diff --git a/Libraries/Text/BaseText/RCTBaseTextShadowView.m b/Libraries/Text/BaseText/RCTBaseTextShadowView.m index 993e88f8dcad6d..e834e5c2b2c80b 100644 --- a/Libraries/Text/BaseText/RCTBaseTextShadowView.m +++ b/Libraries/Text/BaseText/RCTBaseTextShadowView.m @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBaseTextShadowView.h" +#import #import -#import "RCTRawTextShadowView.h" -#import "RCTVirtualTextShadowView.h" +#import +#import NSString *const RCTBaseTextShadowViewEmbeddedShadowViewAttributeName = @"RCTBaseTextShadowViewEmbeddedShadowViewAttributeName"; @@ -29,10 +29,6 @@ static void RCTInlineViewYogaNodeDirtied(YGNodeRef node) } @implementation RCTBaseTextShadowView -{ - NSAttributedString *_Nullable _cachedAttributedText; - RCTTextAttributes *_Nullable _cachedTextAttributes; -} - (instancetype)init { @@ -86,8 +82,8 @@ - (NSAttributedString *)attributedTextWithBaseTextAttributes:(nullable RCTTextAt textAttributes = [self.textAttributes copy]; } - if (_cachedAttributedText && [_cachedTextAttributes isEqual:textAttributes]) { - return _cachedAttributedText; + if (cachedAttributedText && [cachedTextAttributes isEqual:textAttributes]) { + return cachedAttributedText; } NSMutableAttributedString *attributedText = [NSMutableAttributedString new]; @@ -133,17 +129,17 @@ - (NSAttributedString *)attributedTextWithBaseTextAttributes:(nullable RCTTextAt [self clearLayout]; - _cachedAttributedText = [attributedText copy]; - _cachedTextAttributes = textAttributes; + cachedAttributedText = [attributedText copy]; + cachedTextAttributes = textAttributes; - return _cachedAttributedText; + return cachedAttributedText; } - (void)dirtyLayout { [super dirtyLayout]; - _cachedAttributedText = nil; - _cachedTextAttributes = nil; + cachedAttributedText = nil; + cachedTextAttributes = nil; } - (void)didUpdateReactSubviews diff --git a/Libraries/Text/BaseText/RCTBaseTextViewManager.m b/Libraries/Text/BaseText/RCTBaseTextViewManager.m index de1c65a9fb1b6c..2899a7f180a249 100644 --- a/Libraries/Text/BaseText/RCTBaseTextViewManager.m +++ b/Libraries/Text/BaseText/RCTBaseTextViewManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBaseTextViewManager.h" +#import @implementation RCTBaseTextViewManager diff --git a/Libraries/Text/RCTConvert+Text.h b/Libraries/Text/RCTConvert+Text.h index 09c8b95cabd89f..745e0c166c4a2a 100644 --- a/Libraries/Text/RCTConvert+Text.h +++ b/Libraries/Text/RCTConvert+Text.h @@ -23,7 +23,7 @@ typedef enum UITextSpellCheckingType : NSInteger { UITextSpellCheckingTypeNo, UITextSpellCheckingTypeYes, } UITextSpellCheckingType; -#endif // TODO(macOS ISS#2323203)] +#endif // ]TODO(macOS ISS#2323203)] @interface RCTConvert (Text) diff --git a/Libraries/Text/RCTConvert+Text.m b/Libraries/Text/RCTConvert+Text.m index cd91ba9623478a..d3c4aa9a5eecf8 100644 --- a/Libraries/Text/RCTConvert+Text.m +++ b/Libraries/Text/RCTConvert+Text.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTConvert+Text.h" +#import @implementation RCTConvert (Text) diff --git a/Libraries/Text/RCTText.xcodeproj/project.pbxproj b/Libraries/Text/RCTText.xcodeproj/project.pbxproj deleted file mode 100644 index fdf6a85cbd48dc..00000000000000 --- a/Libraries/Text/RCTText.xcodeproj/project.pbxproj +++ /dev/null @@ -1,946 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 5956B130200FEBAA008D9D16 /* RCTRawTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */; }; - 5956B131200FEBAA008D9D16 /* RCTRawTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */; }; - 5956B132200FEBAA008D9D16 /* RCTSinglelineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */; }; - 5956B133200FEBAA008D9D16 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B103200FEBA9008D9D16 /* RCTUITextField.m */; }; - 5956B134200FEBAA008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */; }; - 5956B135200FEBAA008D9D16 /* RCTBaseTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */; }; - 5956B136200FEBAA008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */; }; - 5956B137200FEBAA008D9D16 /* RCTBaseTextInputShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */; }; - 5956B138200FEBAA008D9D16 /* RCTTextSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */; }; - 5956B139200FEBAA008D9D16 /* RCTBaseTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */; }; - 5956B13A200FEBAA008D9D16 /* RCTMultilineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */; }; - 5956B13B200FEBAA008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */; }; - 5956B13C200FEBAA008D9D16 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B119200FEBA9008D9D16 /* RCTUITextView.m */; }; - 5956B13D200FEBAA008D9D16 /* RCTBaseTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */; }; - 5956B13E200FEBAA008D9D16 /* RCTBaseTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */; }; - 5956B13F200FEBAA008D9D16 /* RCTTextAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */; }; - 5956B140200FEBAA008D9D16 /* RCTTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */; }; - 5956B141200FEBAA008D9D16 /* NSTextStorage+FontScaling.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */; }; - 5956B142200FEBAA008D9D16 /* RCTTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */; }; - 5956B143200FEBAA008D9D16 /* RCTTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B128200FEBAA008D9D16 /* RCTTextView.m */; }; - 5956B144200FEBAA008D9D16 /* RCTVirtualTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */; }; - 5956B145200FEBAA008D9D16 /* RCTVirtualTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */; }; - 5956B146200FEBAA008D9D16 /* RCTConvert+Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */; }; - 5956B160200FF324008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */; }; - 5956B161200FF324008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */; }; - 5956B162200FF324008D9D16 /* RCTRawTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */; }; - 5956B163200FF324008D9D16 /* RCTRawTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */; }; - 5956B164200FF324008D9D16 /* RCTConvert+Text.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */; }; - 5956B165200FF324008D9D16 /* RCTTextAttributes.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */; }; - 5956B166200FF324008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */; }; - 5956B167200FF324008D9D16 /* RCTTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */; }; - 5956B168200FF324008D9D16 /* RCTTextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B123200FEBAA008D9D16 /* RCTTextView.h */; }; - 5956B169200FF324008D9D16 /* RCTTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */; }; - 5956B16A200FF324008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */; }; - 5956B16B200FF324008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */; }; - 5956B16C200FF324008D9D16 /* RCTUITextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B116200FEBA9008D9D16 /* RCTUITextView.h */; }; - 5956B16E200FF324008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */; }; - 5956B170200FF324008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */; }; - 5956B171200FF324008D9D16 /* RCTBaseTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */; }; - 5956B172200FF324008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */; }; - 5956B173200FF324008D9D16 /* RCTTextSelection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */; }; - 5956B174200FF324008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */; }; - 5956B175200FF324008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */; }; - 5956B176200FF324008D9D16 /* RCTUITextField.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B105200FEBA9008D9D16 /* RCTUITextField.h */; }; - 5956B177200FF324008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */; }; - 5956B178200FF324008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */; }; - 5956B179200FF338008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */; }; - 5956B17A200FF338008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */; }; - 5956B17B200FF338008D9D16 /* RCTRawTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */; }; - 5956B17C200FF338008D9D16 /* RCTRawTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */; }; - 5956B17D200FF338008D9D16 /* RCTConvert+Text.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */; }; - 5956B17E200FF338008D9D16 /* RCTTextAttributes.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */; }; - 5956B17F200FF338008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */; }; - 5956B180200FF338008D9D16 /* RCTTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */; }; - 5956B181200FF338008D9D16 /* RCTTextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B123200FEBAA008D9D16 /* RCTTextView.h */; }; - 5956B182200FF338008D9D16 /* RCTTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */; }; - 5956B183200FF338008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */; }; - 5956B184200FF338008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */; }; - 5956B185200FF338008D9D16 /* RCTUITextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B116200FEBA9008D9D16 /* RCTUITextView.h */; }; - 5956B186200FF338008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */; }; - 5956B187200FF338008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */; }; - 5956B188200FF338008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */; }; - 5956B189200FF338008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */; }; - 5956B18A200FF338008D9D16 /* RCTBaseTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */; }; - 5956B18B200FF338008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */; }; - 5956B18C200FF338008D9D16 /* RCTTextSelection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */; }; - 5956B18D200FF338008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */; }; - 5956B18E200FF338008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */; }; - 5956B18F200FF338008D9D16 /* RCTUITextField.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B105200FEBA9008D9D16 /* RCTUITextField.h */; }; - 5956B190200FF338008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */; }; - 5956B191200FF338008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */; }; - 5956B192200FF35C008D9D16 /* RCTBaseTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */; }; - 5956B193200FF35C008D9D16 /* RCTBaseTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */; }; - 5956B194200FF35C008D9D16 /* RCTRawTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */; }; - 5956B195200FF35C008D9D16 /* RCTRawTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */; }; - 5956B196200FF35C008D9D16 /* RCTConvert+Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */; }; - 5956B197200FF35C008D9D16 /* RCTTextAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */; }; - 5956B198200FF35C008D9D16 /* NSTextStorage+FontScaling.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */; }; - 5956B199200FF35C008D9D16 /* RCTTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */; }; - 5956B19A200FF35C008D9D16 /* RCTTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B128200FEBAA008D9D16 /* RCTTextView.m */; }; - 5956B19B200FF35C008D9D16 /* RCTTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */; }; - 5956B19C200FF35C008D9D16 /* RCTMultilineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */; }; - 5956B19D200FF35C008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */; }; - 5956B19E200FF35C008D9D16 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B119200FEBA9008D9D16 /* RCTUITextView.m */; }; - 5956B19F200FF35C008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */; }; - 5956B1A0200FF35C008D9D16 /* RCTBaseTextInputShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */; }; - 5956B1A1200FF35C008D9D16 /* RCTBaseTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */; }; - 5956B1A2200FF35C008D9D16 /* RCTBaseTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */; }; - 5956B1A3200FF35C008D9D16 /* RCTTextSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */; }; - 5956B1A4200FF35C008D9D16 /* RCTSinglelineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */; }; - 5956B1A5200FF35C008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */; }; - 5956B1A6200FF35C008D9D16 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B103200FEBA9008D9D16 /* RCTUITextField.m */; }; - 5956B1A7200FF35C008D9D16 /* RCTVirtualTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */; }; - 5956B1A8200FF35C008D9D16 /* RCTVirtualTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */; }; - 5970936920845EFC00D163A7 /* RCTTextTransform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5970936820845DDE00D163A7 /* RCTTextTransform.h */; }; - 5970936A20845F0600D163A7 /* RCTTextTransform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5970936820845DDE00D163A7 /* RCTTextTransform.h */; }; - 5C245F39205E216A00D936E9 /* RCTInputAccessoryShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */; }; - 8F2807C7202D2B6B005D65E6 /* RCTInputAccessoryViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */; }; - 8F2807C8202D2B6B005D65E6 /* RCTInputAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */; }; - 8F2807C9202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */; }; - 9F4659E2236262E9000929DF /* RCTBackedTextInputDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */; }; - 9F4659E3236262E9000929DF /* RCTBackedTextInputViewProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */; }; - 9F4659E42362634A000929DF /* RCTBackedTextInputDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */; }; - 9F4659E52362634A000929DF /* RCTBackedTextInputViewProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */; }; - 9F5C189A230DD5E600E3E5A7 /* RCTVirtualTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */; }; - 9F5C189C230DD67C00E3E5A7 /* RCTVirtualTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */; }; - 9F5C189D230DD68B00E3E5A7 /* RCTUITextField.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B105200FEBA9008D9D16 /* RCTUITextField.h */; }; - 9F5C189F230DD6C000E3E5A7 /* RCTSinglelineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */; }; - 9F5C18A0230DD6C000E3E5A7 /* RCTSinglelineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */; }; - 9F5C18A2230DD74500E3E5A7 /* RCTTextSelection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */; }; - 9F5C18A3230DD84400E3E5A7 /* RCTBaseTextInputShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */; }; - 9F5C18A4230DD84400E3E5A7 /* RCTBaseTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */; }; - 9F5C18A5230DD84400E3E5A7 /* RCTBaseTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */; }; - 9F5C18A7230DDB7400E3E5A7 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */; }; - 9F5C18A9230DDB8400E3E5A7 /* RCTUITextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B116200FEBA9008D9D16 /* RCTUITextView.h */; }; - 9F5C18AA230DDB8F00E3E5A7 /* RCTMultilineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */; }; - 9F5C18AB230DDB9000E3E5A7 /* RCTMultilineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */; }; - 9F5C18AC230DDBA300E3E5A7 /* RCTTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */; }; - 9F5C18AD230DDBAA00E3E5A7 /* RCTTextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B123200FEBAA008D9D16 /* RCTTextView.h */; }; - 9F5C18AE230DDBB600E3E5A7 /* RCTTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */; }; - 9F5C18AF230DDBBE00E3E5A7 /* NSTextStorage+FontScaling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */; }; - 9F5C18B0230DDBC900E3E5A7 /* RCTTextAttributes.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */; }; - 9F5C18B1230DDBD100E3E5A7 /* RCTConvert+Text.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */; }; - 9F5C18B2230DDBDE00E3E5A7 /* RCTRawTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */; }; - 9F5C18B3230DDBDE00E3E5A7 /* RCTRawTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */; }; - 9F5C18B4230DDBEE00E3E5A7 /* RCTBaseTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */; }; - 9F5C18B5230DDBEE00E3E5A7 /* RCTBaseTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */; }; - 9F5C18B7230DDC6800E3E5A7 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B103200FEBA9008D9D16 /* RCTUITextField.m */; }; - 9F5C18B8230DDC7700E3E5A7 /* RCTMultilineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */; }; - 9F5C18B9230DDC7E00E3E5A7 /* RCTSinglelineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */; }; - 9F5C18BA230DDC8700E3E5A7 /* NSTextStorage+FontScaling.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */; }; - 9F5C18BB230DDC9000E3E5A7 /* RCTRawTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */; }; - 9F5C18BC230DDC9600E3E5A7 /* RCTTextSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */; }; - 9F5C18BD230DDCA200E3E5A7 /* RCTBaseTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */; }; - 9F5C18BE230DDCAB00E3E5A7 /* RCTSinglelineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */; }; - 9F5C18BF230DDCB100E3E5A7 /* RCTMultilineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */; }; - 9F5C18C2230DDCDA00E3E5A7 /* RCTVirtualTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */; }; - 9F5C18C3230DDCE500E3E5A7 /* RCTBaseTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */; }; - 9F5C18C4230DDCEE00E3E5A7 /* RCTTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */; }; - 9F5C18C5230DDCFC00E3E5A7 /* RCTVirtualTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */; }; - 9F5C18C6230DDD0300E3E5A7 /* RCTBaseTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */; }; - 9F5C18C7230DDD0D00E3E5A7 /* RCTBackedTextInputDelegateAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */; }; - 9F5C18C8230DDD2E00E3E5A7 /* RCTTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B128200FEBAA008D9D16 /* RCTTextView.m */; }; - 9F5C18C9230DDD2E00E3E5A7 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B119200FEBA9008D9D16 /* RCTUITextView.m */; }; - 9F5C18CB230DDD4900E3E5A7 /* RCTTextAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */; }; - 9F5C18CD230DDD5F00E3E5A7 /* RCTConvert+Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */; }; - 9F5C18CF230DDD7100E3E5A7 /* RCTBaseTextInputShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */; }; - 9F5C18D0230DDD8800E3E5A7 /* RCTRawTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */; }; - 9F5C18D1230DDD9600E3E5A7 /* RCTBaseTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */; }; - 9F5C18D2230DDD9600E3E5A7 /* RCTTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */; }; - 9F5C1912230DF3E700E3E5A7 /* RCTTextUIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F5C1911230DF3E700E3E5A7 /* RCTTextUIKit.h */; }; - 9F5C1913230DF3E700E3E5A7 /* RCTTextUIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F5C1911230DF3E700E3E5A7 /* RCTTextUIKit.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 183496EA1F5DF07600C0A1B4 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 9F4659E2236262E9000929DF /* RCTBackedTextInputDelegate.h in Copy Headers */, - 9F4659E3236262E9000929DF /* RCTBackedTextInputViewProtocol.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 1891B31E1FEC3B6500CEDA30 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 9F5C18B4230DDBEE00E3E5A7 /* RCTBaseTextShadowView.h in Copy Headers */, - 9F5C18B5230DDBEE00E3E5A7 /* RCTBaseTextViewManager.h in Copy Headers */, - 9F5C18B2230DDBDE00E3E5A7 /* RCTRawTextShadowView.h in Copy Headers */, - 9F5C18B3230DDBDE00E3E5A7 /* RCTRawTextViewManager.h in Copy Headers */, - 9F5C18B1230DDBD100E3E5A7 /* RCTConvert+Text.h in Copy Headers */, - 9F5C18B0230DDBC900E3E5A7 /* RCTTextAttributes.h in Copy Headers */, - 9F5C18AF230DDBBE00E3E5A7 /* NSTextStorage+FontScaling.h in Copy Headers */, - 9F5C18AE230DDBB600E3E5A7 /* RCTTextShadowView.h in Copy Headers */, - 9F5C18AD230DDBAA00E3E5A7 /* RCTTextView.h in Copy Headers */, - 9F5C18AC230DDBA300E3E5A7 /* RCTTextViewManager.h in Copy Headers */, - 9F5C18AA230DDB8F00E3E5A7 /* RCTMultilineTextInputView.h in Copy Headers */, - 9F5C18AB230DDB9000E3E5A7 /* RCTMultilineTextInputViewManager.h in Copy Headers */, - 9F5C18A9230DDB8400E3E5A7 /* RCTUITextView.h in Copy Headers */, - 9F5C18A7230DDB7400E3E5A7 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */, - 9F5C18A3230DD84400E3E5A7 /* RCTBaseTextInputShadowView.h in Copy Headers */, - 9F5C18A4230DD84400E3E5A7 /* RCTBaseTextInputView.h in Copy Headers */, - 9F5C18A5230DD84400E3E5A7 /* RCTBaseTextInputViewManager.h in Copy Headers */, - 9F5C18A2230DD74500E3E5A7 /* RCTTextSelection.h in Copy Headers */, - 9F5C189F230DD6C000E3E5A7 /* RCTSinglelineTextInputView.h in Copy Headers */, - 9F5C18A0230DD6C000E3E5A7 /* RCTSinglelineTextInputViewManager.h in Copy Headers */, - 9F5C189D230DD68B00E3E5A7 /* RCTUITextField.h in Copy Headers */, - 9F5C189C230DD67C00E3E5A7 /* RCTVirtualTextShadowView.h in Copy Headers */, - 9F5C189A230DD5E600E3E5A7 /* RCTVirtualTextViewManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 599DF25E1F0306540079B53E /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 5970936920845EFC00D163A7 /* RCTTextTransform.h in Copy Headers */, - 5956B160200FF324008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */, - 5956B161200FF324008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */, - 5956B162200FF324008D9D16 /* RCTRawTextShadowView.h in Copy Headers */, - 5956B163200FF324008D9D16 /* RCTRawTextViewManager.h in Copy Headers */, - 5956B164200FF324008D9D16 /* RCTConvert+Text.h in Copy Headers */, - 5956B165200FF324008D9D16 /* RCTTextAttributes.h in Copy Headers */, - 5956B166200FF324008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */, - 5956B167200FF324008D9D16 /* RCTTextShadowView.h in Copy Headers */, - 5956B168200FF324008D9D16 /* RCTTextView.h in Copy Headers */, - 5956B169200FF324008D9D16 /* RCTTextViewManager.h in Copy Headers */, - 5956B16A200FF324008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */, - 5956B16B200FF324008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */, - 5956B16C200FF324008D9D16 /* RCTUITextView.h in Copy Headers */, - 5956B16E200FF324008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */, - 5956B170200FF324008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */, - 5956B171200FF324008D9D16 /* RCTBaseTextInputView.h in Copy Headers */, - 5956B172200FF324008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */, - 5956B173200FF324008D9D16 /* RCTTextSelection.h in Copy Headers */, - 5956B174200FF324008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */, - 5956B175200FF324008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */, - 5956B176200FF324008D9D16 /* RCTUITextField.h in Copy Headers */, - 5956B177200FF324008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */, - 5956B178200FF324008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 599DF2601F0306AD0079B53E /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 5970936A20845F0600D163A7 /* RCTTextTransform.h in Copy Headers */, - 5956B179200FF338008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */, - 5956B17A200FF338008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */, - 5956B17B200FF338008D9D16 /* RCTRawTextShadowView.h in Copy Headers */, - 5956B17C200FF338008D9D16 /* RCTRawTextViewManager.h in Copy Headers */, - 5956B17D200FF338008D9D16 /* RCTConvert+Text.h in Copy Headers */, - 5956B17E200FF338008D9D16 /* RCTTextAttributes.h in Copy Headers */, - 5956B17F200FF338008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */, - 5956B180200FF338008D9D16 /* RCTTextShadowView.h in Copy Headers */, - 5956B181200FF338008D9D16 /* RCTTextView.h in Copy Headers */, - 5956B182200FF338008D9D16 /* RCTTextViewManager.h in Copy Headers */, - 5956B183200FF338008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */, - 5956B184200FF338008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */, - 5956B185200FF338008D9D16 /* RCTUITextView.h in Copy Headers */, - 5956B186200FF338008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */, - 5956B187200FF338008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */, - 5956B188200FF338008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */, - 5956B189200FF338008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */, - 5956B18A200FF338008D9D16 /* RCTBaseTextInputView.h in Copy Headers */, - 5956B18B200FF338008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */, - 5956B18C200FF338008D9D16 /* RCTTextSelection.h in Copy Headers */, - 5956B18D200FF338008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */, - 5956B18E200FF338008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */, - 5956B18F200FF338008D9D16 /* RCTUITextField.h in Copy Headers */, - 5956B190200FF338008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */, - 5956B191200FF338008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 6490EA781F683C2000E20046 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 9F4659E42362634A000929DF /* RCTBackedTextInputDelegate.h in Copy Headers */, - 9F4659E52362634A000929DF /* RCTBackedTextInputViewProtocol.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 19461664225DC3B300E4E008 /* RCTTextRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextRenderer.m; sourceTree = ""; }; - 19461665225DC3B300E4E008 /* RCTTextRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextRenderer.h; sourceTree = ""; }; - 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTText-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 58B5119B1A9E6C1200147675 /* libRCTText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTText.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 58B5119B1A9E6C1200147676 /* libRCTText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTText.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+Text.h"; sourceTree = ""; }; - 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRawTextViewManager.h; sourceTree = ""; }; - 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRawTextShadowView.h; sourceTree = ""; }; - 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRawTextShadowView.m; sourceTree = ""; }; - 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRawTextViewManager.m; sourceTree = ""; }; - 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSinglelineTextInputView.m; sourceTree = ""; }; - 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSinglelineTextInputViewManager.h; sourceTree = ""; }; - 5956B103200FEBA9008D9D16 /* RCTUITextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextField.m; sourceTree = ""; }; - 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSinglelineTextInputView.h; sourceTree = ""; }; - 5956B105200FEBA9008D9D16 /* RCTUITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextField.h; sourceTree = ""; }; - 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSinglelineTextInputViewManager.m; sourceTree = ""; }; - 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputDelegateAdapter.h; sourceTree = ""; }; - 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextSelection.h; sourceTree = ""; }; - 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputShadowView.h; sourceTree = ""; }; - 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputView.m; sourceTree = ""; }; - 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputViewManager.h; sourceTree = ""; }; - 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputDelegate.h; sourceTree = ""; }; - 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBackedTextInputDelegateAdapter.m; sourceTree = ""; }; - 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputView.h; sourceTree = ""; }; - 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputShadowView.m; sourceTree = ""; }; - 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextSelection.m; sourceTree = ""; }; - 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputViewManager.m; sourceTree = ""; }; - 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputViewProtocol.h; sourceTree = ""; }; - 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultilineTextInputViewManager.h; sourceTree = ""; }; - 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultilineTextInputView.m; sourceTree = ""; }; - 5956B116200FEBA9008D9D16 /* RCTUITextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextView.h; sourceTree = ""; }; - 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultilineTextInputView.h; sourceTree = ""; }; - 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultilineTextInputViewManager.m; sourceTree = ""; }; - 5956B119200FEBA9008D9D16 /* RCTUITextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextView.m; sourceTree = ""; }; - 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextAttributes.h; sourceTree = ""; }; - 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextViewManager.h; sourceTree = ""; }; - 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextShadowView.h; sourceTree = ""; }; - 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextShadowView.m; sourceTree = ""; }; - 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextViewManager.m; sourceTree = ""; }; - 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextAttributes.m; sourceTree = ""; }; - 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextShadowView.m; sourceTree = ""; }; - 5956B123200FEBAA008D9D16 /* RCTTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextView.h; sourceTree = ""; }; - 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextViewManager.h; sourceTree = ""; }; - 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTextStorage+FontScaling.m"; sourceTree = ""; }; - 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextShadowView.h; sourceTree = ""; }; - 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextViewManager.m; sourceTree = ""; }; - 5956B128200FEBAA008D9D16 /* RCTTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextView.m; sourceTree = ""; }; - 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextStorage+FontScaling.h"; sourceTree = ""; }; - 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVirtualTextViewManager.m; sourceTree = ""; }; - 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVirtualTextShadowView.h; sourceTree = ""; }; - 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVirtualTextViewManager.h; sourceTree = ""; }; - 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVirtualTextShadowView.m; sourceTree = ""; }; - 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+Text.m"; sourceTree = ""; }; - 5970936820845DDE00D163A7 /* RCTTextTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextTransform.h; sourceTree = ""; }; - 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryShadowView.m; sourceTree = ""; }; - 5C245F38205E216A00D936E9 /* RCTInputAccessoryShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryShadowView.h; sourceTree = ""; }; - 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryViewManager.m; sourceTree = ""; }; - 8F2807C2202D2B6A005D65E6 /* RCTInputAccessoryViewContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryViewContent.h; sourceTree = ""; }; - 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryView.m; sourceTree = ""; }; - 8F2807C4202D2B6A005D65E6 /* RCTInputAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryView.h; sourceTree = ""; }; - 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryViewContent.m; sourceTree = ""; }; - 8F2807C6202D2B6B005D65E6 /* RCTInputAccessoryViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryViewManager.h; sourceTree = ""; }; - 9F5C1911230DF3E700E3E5A7 /* RCTTextUIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextUIKit.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 58B511921A9E6C1200147676 = { - isa = PBXGroup; - children = ( - 5956B11B200FEBA9008D9D16 /* BaseText */, - 58B5119C1A9E6C1200147676 /* Products */, - 5956B0FA200FEBA9008D9D16 /* RawText */, - 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */, - 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */, - 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */, - 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */, - 9F5C1911230DF3E700E3E5A7 /* RCTTextUIKit.h */, - 5970936820845DDE00D163A7 /* RCTTextTransform.h */, - 5956B121200FEBAA008D9D16 /* Text */, - 5956B0FF200FEBA9008D9D16 /* TextInput */, - 5956B12A200FEBAA008D9D16 /* VirtualText */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5119C1A9E6C1200147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5119B1A9E6C1200147676 /* libRCTText.a */, - 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */, - 58B5119B1A9E6C1200147675 /* libRCTText.a */, - ); - name = Products; - sourceTree = ""; - }; - 5956B0FA200FEBA9008D9D16 /* RawText */ = { - isa = PBXGroup; - children = ( - 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */, - 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */, - 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */, - 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */, - ); - path = RawText; - sourceTree = ""; - }; - 5956B0FF200FEBA9008D9D16 /* TextInput */ = { - isa = PBXGroup; - children = ( - 5C245F38205E216A00D936E9 /* RCTInputAccessoryShadowView.h */, - 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */, - 8F2807C4202D2B6A005D65E6 /* RCTInputAccessoryView.h */, - 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */, - 8F2807C2202D2B6A005D65E6 /* RCTInputAccessoryViewContent.h */, - 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */, - 8F2807C6202D2B6B005D65E6 /* RCTInputAccessoryViewManager.h */, - 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */, - 5956B113200FEBA9008D9D16 /* Multiline */, - 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */, - 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */, - 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */, - 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */, - 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */, - 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */, - 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */, - 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */, - 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */, - 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */, - 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */, - 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */, - 5956B100200FEBA9008D9D16 /* Singleline */, - ); - path = TextInput; - sourceTree = ""; - }; - 5956B100200FEBA9008D9D16 /* Singleline */ = { - isa = PBXGroup; - children = ( - 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */, - 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */, - 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */, - 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */, - 5956B105200FEBA9008D9D16 /* RCTUITextField.h */, - 5956B103200FEBA9008D9D16 /* RCTUITextField.m */, - ); - path = Singleline; - sourceTree = ""; - }; - 5956B113200FEBA9008D9D16 /* Multiline */ = { - isa = PBXGroup; - children = ( - 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */, - 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */, - 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */, - 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */, - 5956B116200FEBA9008D9D16 /* RCTUITextView.h */, - 5956B119200FEBA9008D9D16 /* RCTUITextView.m */, - ); - path = Multiline; - sourceTree = ""; - }; - 5956B11B200FEBA9008D9D16 /* BaseText */ = { - isa = PBXGroup; - children = ( - 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */, - 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */, - 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */, - 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */, - ); - path = BaseText; - sourceTree = ""; - }; - 5956B121200FEBAA008D9D16 /* Text */ = { - isa = PBXGroup; - children = ( - 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */, - 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */, - 19461665225DC3B300E4E008 /* RCTTextRenderer.h */, - 19461664225DC3B300E4E008 /* RCTTextRenderer.m */, - 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */, - 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */, - 5956B123200FEBAA008D9D16 /* RCTTextView.h */, - 5956B128200FEBAA008D9D16 /* RCTTextView.m */, - 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */, - 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */, - ); - path = Text; - sourceTree = ""; - }; - 5956B12A200FEBAA008D9D16 /* VirtualText */ = { - isa = PBXGroup; - children = ( - 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */, - 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */, - 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */, - 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */, - ); - path = VirtualText; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 183496EE1F5DF0D600C0A1B4 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F5C1912230DF3E700E3E5A7 /* RCTTextUIKit.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6490EA771F683C1800E20046 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F5C1913230DF3E700E3E5A7 /* RCTTextUIKit.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2D2A287A1D9B048500D4039D /* RCTText-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28831D9B048500D4039D /* Build configuration list for PBXNativeTarget "RCTText-tvOS" */; - buildPhases = ( - 599DF2601F0306AD0079B53E /* Copy Headers */, - 2D2A28771D9B048500D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTText-tvOS"; - productName = "RCTText-tvOS"; - productReference = 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B5119A1A9E6C1200147676 /* RCTText */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511AF1A9E6C1300147676 /* Build configuration list for PBXNativeTarget "RCTText" */; - buildPhases = ( - 599DF25E1F0306540079B53E /* Copy Headers */, - 58B511971A9E6C1200147676 /* Sources */, - 183496EE1F5DF0D600C0A1B4 /* Headers */, - 183496EA1F5DF07600C0A1B4 /* Copy Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTText; - productName = RCTText; - productReference = 58B5119B1A9E6C1200147676 /* libRCTText.a */; - productType = "com.apple.product-type.library.static"; - }; - 6BDE7AB21ECB8D6200CC951F /* RCTText-macos */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6BDE7ABF1ECB8D6200CC951F /* Build configuration list for PBXNativeTarget "RCTText-macos" */; - buildPhases = ( - 1891B31E1FEC3B6500CEDA30 /* Copy Headers */, - 6BDE7AB31ECB8D6200CC951F /* Sources */, - 6490EA771F683C1800E20046 /* Headers */, - 6490EA781F683C2000E20046 /* Copy Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTText-macos"; - productName = RCTText; - productReference = 58B5119B1A9E6C1200147675 /* libRCTText.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511931A9E6C1200147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A287A1D9B048500D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B5119A1A9E6C1200147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511961A9E6C1200147676 /* Build configuration list for PBXProject "RCTText" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = 58B511921A9E6C1200147676; - productRefGroup = 58B5119C1A9E6C1200147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5119A1A9E6C1200147676 /* RCTText */, - 6BDE7AB21ECB8D6200CC951F /* RCTText-macos */, - 2D2A287A1D9B048500D4039D /* RCTText-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28771D9B048500D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5956B192200FF35C008D9D16 /* RCTBaseTextShadowView.m in Sources */, - 5956B193200FF35C008D9D16 /* RCTBaseTextViewManager.m in Sources */, - 5956B194200FF35C008D9D16 /* RCTRawTextShadowView.m in Sources */, - 5956B195200FF35C008D9D16 /* RCTRawTextViewManager.m in Sources */, - 5956B196200FF35C008D9D16 /* RCTConvert+Text.m in Sources */, - 5956B197200FF35C008D9D16 /* RCTTextAttributes.m in Sources */, - 5956B198200FF35C008D9D16 /* NSTextStorage+FontScaling.m in Sources */, - 5956B199200FF35C008D9D16 /* RCTTextShadowView.m in Sources */, - 5956B19A200FF35C008D9D16 /* RCTTextView.m in Sources */, - 5956B19B200FF35C008D9D16 /* RCTTextViewManager.m in Sources */, - 5956B19C200FF35C008D9D16 /* RCTMultilineTextInputView.m in Sources */, - 5956B19D200FF35C008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */, - 5956B19E200FF35C008D9D16 /* RCTUITextView.m in Sources */, - 5956B19F200FF35C008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */, - 5956B1A0200FF35C008D9D16 /* RCTBaseTextInputShadowView.m in Sources */, - 5956B1A1200FF35C008D9D16 /* RCTBaseTextInputView.m in Sources */, - 5956B1A2200FF35C008D9D16 /* RCTBaseTextInputViewManager.m in Sources */, - 5956B1A3200FF35C008D9D16 /* RCTTextSelection.m in Sources */, - 5956B1A4200FF35C008D9D16 /* RCTSinglelineTextInputView.m in Sources */, - 5956B1A5200FF35C008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */, - 5956B1A6200FF35C008D9D16 /* RCTUITextField.m in Sources */, - 5956B1A7200FF35C008D9D16 /* RCTVirtualTextShadowView.m in Sources */, - 5956B1A8200FF35C008D9D16 /* RCTVirtualTextViewManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511971A9E6C1200147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5956B13D200FEBAA008D9D16 /* RCTBaseTextShadowView.m in Sources */, - 5956B140200FEBAA008D9D16 /* RCTTextShadowView.m in Sources */, - 5956B131200FEBAA008D9D16 /* RCTRawTextViewManager.m in Sources */, - 5956B137200FEBAA008D9D16 /* RCTBaseTextInputShadowView.m in Sources */, - 8F2807C7202D2B6B005D65E6 /* RCTInputAccessoryViewManager.m in Sources */, - 5956B146200FEBAA008D9D16 /* RCTConvert+Text.m in Sources */, - 8F2807C9202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m in Sources */, - 5956B13F200FEBAA008D9D16 /* RCTTextAttributes.m in Sources */, - 8F2807C8202D2B6B005D65E6 /* RCTInputAccessoryView.m in Sources */, - 5956B143200FEBAA008D9D16 /* RCTTextView.m in Sources */, - 5956B13C200FEBAA008D9D16 /* RCTUITextView.m in Sources */, - 5956B136200FEBAA008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */, - 5956B13E200FEBAA008D9D16 /* RCTBaseTextViewManager.m in Sources */, - 5956B145200FEBAA008D9D16 /* RCTVirtualTextShadowView.m in Sources */, - 5956B142200FEBAA008D9D16 /* RCTTextViewManager.m in Sources */, - 5956B135200FEBAA008D9D16 /* RCTBaseTextInputView.m in Sources */, - 5956B144200FEBAA008D9D16 /* RCTVirtualTextViewManager.m in Sources */, - 5C245F39205E216A00D936E9 /* RCTInputAccessoryShadowView.m in Sources */, - 5956B13B200FEBAA008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */, - 5956B134200FEBAA008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */, - 5956B139200FEBAA008D9D16 /* RCTBaseTextInputViewManager.m in Sources */, - 5956B138200FEBAA008D9D16 /* RCTTextSelection.m in Sources */, - 5956B130200FEBAA008D9D16 /* RCTRawTextShadowView.m in Sources */, - 5956B141200FEBAA008D9D16 /* NSTextStorage+FontScaling.m in Sources */, - 5956B132200FEBAA008D9D16 /* RCTSinglelineTextInputView.m in Sources */, - 5956B13A200FEBAA008D9D16 /* RCTMultilineTextInputView.m in Sources */, - 5956B133200FEBAA008D9D16 /* RCTUITextField.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6BDE7AB31ECB8D6200CC951F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F5C18D1230DDD9600E3E5A7 /* RCTBaseTextShadowView.m in Sources */, - 9F5C18D2230DDD9600E3E5A7 /* RCTTextShadowView.m in Sources */, - 9F5C18D0230DDD8800E3E5A7 /* RCTRawTextViewManager.m in Sources */, - 9F5C18CF230DDD7100E3E5A7 /* RCTBaseTextInputShadowView.m in Sources */, - 9F5C18CD230DDD5F00E3E5A7 /* RCTConvert+Text.m in Sources */, - 9F5C18CB230DDD4900E3E5A7 /* RCTTextAttributes.m in Sources */, - 9F5C18C8230DDD2E00E3E5A7 /* RCTTextView.m in Sources */, - 9F5C18C9230DDD2E00E3E5A7 /* RCTUITextView.m in Sources */, - 9F5C18C7230DDD0D00E3E5A7 /* RCTBackedTextInputDelegateAdapter.m in Sources */, - 9F5C18C6230DDD0300E3E5A7 /* RCTBaseTextViewManager.m in Sources */, - 9F5C18C5230DDCFC00E3E5A7 /* RCTVirtualTextShadowView.m in Sources */, - 9F5C18C4230DDCEE00E3E5A7 /* RCTTextViewManager.m in Sources */, - 9F5C18C3230DDCE500E3E5A7 /* RCTBaseTextInputView.m in Sources */, - 9F5C18C2230DDCDA00E3E5A7 /* RCTVirtualTextViewManager.m in Sources */, - 9F5C18BF230DDCB100E3E5A7 /* RCTMultilineTextInputViewManager.m in Sources */, - 9F5C18BE230DDCAB00E3E5A7 /* RCTSinglelineTextInputViewManager.m in Sources */, - 9F5C18BD230DDCA200E3E5A7 /* RCTBaseTextInputViewManager.m in Sources */, - 9F5C18BC230DDC9600E3E5A7 /* RCTTextSelection.m in Sources */, - 9F5C18BB230DDC9000E3E5A7 /* RCTRawTextShadowView.m in Sources */, - 9F5C18BA230DDC8700E3E5A7 /* NSTextStorage+FontScaling.m in Sources */, - 9F5C18B9230DDC7E00E3E5A7 /* RCTSinglelineTextInputView.m in Sources */, - 9F5C18B8230DDC7700E3E5A7 /* RCTMultilineTextInputView.m in Sources */, - 9F5C18B7230DDC6800E3E5A7 /* RCTUITextField.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28811D9B048500D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28821D9B048500D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511AD1A9E6C1300147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511AE1A9E6C1300147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511B01A9E6C1300147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511B11A9E6C1300147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 6BDE7AC01ECB8D6200CC951F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTText; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 6BDE7AC11ECB8D6200CC951F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTText; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28831D9B048500D4039D /* Build configuration list for PBXNativeTarget "RCTText-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28811D9B048500D4039D /* Debug */, - 2D2A28821D9B048500D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511961A9E6C1200147676 /* Build configuration list for PBXProject "RCTText" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511AD1A9E6C1300147676 /* Debug */, - 58B511AE1A9E6C1300147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511AF1A9E6C1300147676 /* Build configuration list for PBXNativeTarget "RCTText" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511B01A9E6C1300147676 /* Debug */, - 58B511B11A9E6C1300147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6BDE7ABF1ECB8D6200CC951F /* Build configuration list for PBXNativeTarget "RCTText-macos" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6BDE7AC01ECB8D6200CC951F /* Debug */, - 6BDE7AC11ECB8D6200CC951F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511931A9E6C1200147676 /* Project object */; -} diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index 754b8a458b3587..9e9dce3b729acf 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTextAttributes.h" +#import #import #import @@ -37,7 +37,7 @@ - (instancetype)init - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes { - // Note: All lines marked with `*` does not use explicit/correct rules to compare old and new values becuase + // Note: All lines marked with `*` does not use explicit/correct rules to compare old and new values because // their types do not have special designated value representing undefined/unspecified/inherit meaning. // We will address this in the future. diff --git a/Libraries/Text/RawText/RCTRawTextShadowView.m b/Libraries/Text/RawText/RCTRawTextShadowView.m index 823058626ea186..2317bb2874ba48 100644 --- a/Libraries/Text/RawText/RCTRawTextShadowView.m +++ b/Libraries/Text/RawText/RCTRawTextShadowView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTRawTextShadowView.h" +#import #import diff --git a/Libraries/Text/RawText/RCTRawTextViewManager.m b/Libraries/Text/RawText/RCTRawTextViewManager.m index 03d08fe25caa03..09d75b6bc3dd4a 100644 --- a/Libraries/Text/RawText/RCTRawTextViewManager.m +++ b/Libraries/Text/RawText/RCTRawTextViewManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTRawTextViewManager.h" +#import -#import "RCTRawTextShadowView.h" +#import @implementation RCTRawTextViewManager diff --git a/Libraries/Text/React-RCTText.podspec b/Libraries/Text/React-RCTText.podspec index 60655c8d1a7b7d..e67d060d527d1e 100644 --- a/Libraries/Text/React-RCTText.podspec +++ b/Libraries/Text/React-RCTText.podspec @@ -29,7 +29,7 @@ Pod::Spec.new do |s| s.source = source s.source_files = "**/*.{h,m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTText" - s.dependency "React-Core", version + s.dependency "React-Core/RCTTextHeaders", version end diff --git a/Libraries/Text/Text/RCTTextShadowView.m b/Libraries/Text/Text/RCTTextShadowView.m index 6c793bc8659d7f..10705283af57d0 100644 --- a/Libraries/Text/Text/RCTTextShadowView.m +++ b/Libraries/Text/Text/RCTTextShadowView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTextShadowView.h" +#import #import #import @@ -13,7 +13,7 @@ #import #import "NSTextStorage+FontScaling.h" -#import "RCTTextView.h" +#import @implementation RCTTextShadowView { @@ -116,7 +116,7 @@ - (void)uiManagerWillPerformMounting [descendantViews addObject:descendantView]; }]; - // Removing all references to Shadow Views to avoid unnececery retainning. + // Removing all references to Shadow Views to avoid unnecessary retaining. [textStorage removeAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName range:NSMakeRange(0, textStorage.length)]; [textView setTextStorage:textStorage @@ -174,6 +174,12 @@ - (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize)size { + static UIImage *placeholderImage; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + placeholderImage = [UIImage new]; + }); + NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; @@ -192,6 +198,7 @@ - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize maximumSize:size]; NSTextAttachment *attachment = [NSTextAttachment new]; attachment.bounds = (CGRect){CGPointZero, fittingSize}; + attachment.image = placeholderImage; [attributedText addAttribute:NSAttachmentAttributeName value:attachment range:range]; } ]; diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index 5cc1eaa862e75b..227a7b81b88cca 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTextView.h" +#import #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) #import @@ -17,30 +17,17 @@ #import #import -#import "RCTTextShadowView.h" - -@interface RCTTextTiledLayer : CATiledLayer - -@end - -@implementation RCTTextTiledLayer - -+ (CFTimeInterval)fadeDuration -{ - return 0.05; -} - -@end +#import #import // TODO(macOS ISS#2323203) @implementation RCTTextView { + CAShapeLayer *_highlightLayer; #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) UILongPressGestureRecognizer *_longPressGestureRecognizer; #endif // TODO(macOS ISS#2323203) - CAShapeLayer *_highlightLayer; NSArray *_Nullable _descendantViews; // TODO(macOS ISS#3536887) NSTextStorage *_Nullable _textStorage; CGRect _contentFrame; @@ -167,9 +154,10 @@ - (void)drawRect:(CGRect)rect return; } + NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject; NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - + NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:_contentFrame.origin]; [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:_contentFrame.origin]; @@ -177,7 +165,6 @@ - (void)drawRect:(CGRect)rect __block UIBezierPath *highlightPath = nil; NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL]; - [_textStorage enumerateAttribute:RCTTextAttributesIsHighlightedAttributeName inRange:characterRange options:0 @@ -220,6 +207,7 @@ - (void)drawRect:(CGRect)rect } } + - (NSNumber *)reactTagAtPoint:(CGPoint)point { NSNumber *reactTag = self.reactTag; diff --git a/Libraries/Text/Text/RCTTextViewManager.m b/Libraries/Text/Text/RCTTextViewManager.m index 0e4b3b9484a3a9..8903ec74f7d0be 100644 --- a/Libraries/Text/Text/RCTTextViewManager.m +++ b/Libraries/Text/Text/RCTTextViewManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTextViewManager.h" +#import #import #import @@ -14,8 +14,8 @@ #import #import -#import "RCTTextShadowView.h" -#import "RCTTextView.h" +#import +#import @interface RCTTextViewManager () diff --git a/Libraries/Text/TextAncestor.js b/Libraries/Text/TextAncestor.js index 5a8e79eee2ca7a..24fb1b45512fad 100644 --- a/Libraries/Text/TextAncestor.js +++ b/Libraries/Text/TextAncestor.js @@ -18,4 +18,4 @@ const React = require('react'); /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error * found when Flow v0.85 was deployed. To see the error, delete this comment * and run Flow. */ -module.exports = React.createContext(false); +module.exports = (React.createContext(false): React$Context<$FlowFixMe>); diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m index de023f9678b630..1b4984dfe2d8b1 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTMultilineTextInputView.h" +#import #import -#import "RCTUITextView.h" +#import @implementation RCTMultilineTextInputView { #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) - RCTUIScrollView *_scrollView; // TODO(macOS ISS#3536887) + RCTUIScrollView *_scrollView; #endif // ]TODO(macOS ISS#2323203) RCTUITextView *_backedTextInputView; } diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m index 5e62e0c3fe99bc..6fe7de7c95ed40 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTMultilineTextInputViewManager.h" +#import -#import "RCTMultilineTextInputView.h" +#import @implementation RCTMultilineTextInputViewManager diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.m b/Libraries/Text/TextInput/Multiline/RCTUITextView.m index f4933c7ba8b611..97e4b5a2460b19 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.m +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.m @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTUITextView.h" +#import #import #import -#import "RCTBackedTextInputDelegateAdapter.h" -#import "RCTTextAttributes.h" +#import +#import @implementation RCTUITextView { diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h index c27bb8e6d4bc81..64db080801ade3 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h @@ -30,10 +30,10 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)textInputShouldHandleDeleteBackward:(id)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. TODO(OSS Candidate ISS#2710739) #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) - (BOOL)textInputShouldHandleDeleteForward:(id)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself. -#endif // ]TODO(macOS ISS#2323203) +#endif // ]TODO(macOS ISS#2323203) @optional -- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView; +- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView; // TODO(macOS ISS#2323203) @end diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h index 8c3555b50c400a..d89bb3429fe036 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "../RCTTextUIKit.h" // TODO(macOS ISS#2323203) +#import // TODO(macOS ISS#2323203) NS_ASSUME_NONNULL_BEGIN diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m index 59a800b66587ad..a8fe7f0a39445b 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBackedTextInputDelegateAdapter.h" +#import #import "RCTBackedTextInputViewProtocol.h" // TODO(OSS Candidate ISS#2710739) #import "RCTBackedTextInputDelegate.h" // TODO(OSS Candidate ISS#2710739) #import "../RCTTextUIKit.h" // TODO(macOS ISS#2323203) diff --git a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h index 83e0f63998a128..1947cd71486949 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h @@ -7,7 +7,7 @@ #import // [TODO(macOS ISS#2323203) -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) NS_ASSUME_NONNULL_BEGIN @protocol RCTUITextFieldDelegate @optional diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index d73b3b258c67c7..f7ee634c71db41 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBaseTextInputShadowView.h" +#import #import #import @@ -13,7 +13,7 @@ #import #import "NSTextStorage+FontScaling.h" -#import "RCTBaseTextInputView.h" +#import @implementation RCTBaseTextInputShadowView { @@ -137,7 +137,7 @@ - (void)uiManagerWillPerformMounting NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; - // Removing all references to Shadow Views and tags to avoid unnececery retainning + // Removing all references to Shadow Views and tags to avoid unnecessary retaining // and problems with comparing the strings. [attributedText removeAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName range:NSMakeRange(0, attributedText.length)]; @@ -174,7 +174,12 @@ - (void)uiManagerWillPerformMounting baseTextInputView.reactPaddingInsets = paddingInsets; if (isAttributedTextChanged) { - baseTextInputView.attributedText = attributedText; + // Don't set `attributedText` if length equal to zero, otherwise it would shrink when attributes contain like `lineHeight`. + if (attributedText.length != 0) { + baseTextInputView.attributedText = attributedText; + } else { + baseTextInputView.attributedText = nil; + } } }]; } @@ -190,7 +195,7 @@ - (NSAttributedString *)measurableAttributedText if (attributedText.length == 0) { // It's impossible to measure empty attributed string because all attributes are - // assosiated with some characters, so no characters means no data. + // associated with some characters, so no characters means no data. // Placeholder also can represent the intrinsic size when it is visible. NSString *text = self.placeholder; diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.h b/Libraries/Text/TextInput/RCTBaseTextInputView.h index a728b7cd19b510..d3bd753f8dc67e 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN /** Whether this text input ignores the `textAttributes` property. Defaults to `NO`. If set to `YES`, the value of `textAttributes` will be ignored in favor of standard text input behavior. */ -@property (nonatomic) BOOL ignoresTextAttributes; // [TODO(OSS Candidate ISS#2710739) +@property (nonatomic) BOOL ignoresTextAttributes; // TODO(OSS Candidate ISS#2710739) @property (nonatomic, strong, nullable) RCTTextAttributes *textAttributes; @property (nonatomic, assign) UIEdgeInsets reactPaddingInsets; @property (nonatomic, assign) UIEdgeInsets reactBorderInsets; @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL secureTextEntry; @property (nonatomic, copy) RCTTextSelection *selection; @property (nonatomic, strong, nullable) NSNumber *maxLength; -@property (nonatomic, copy) NSAttributedString *attributedText; +@property (nonatomic, copy, nullable) NSAttributedString *attributedText; @property (nonatomic, copy) NSString *predictedText; // TODO(OSS Candidate ISS#2710739) @property (nonatomic, copy) NSString *inputAccessoryViewID; #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 7c087ab1148a3b..436f799f664bc0 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBaseTextInputView.h" +#import #import #import @@ -15,10 +15,10 @@ #import #import -#import "RCTInputAccessoryView.h" -#import "RCTInputAccessoryViewContent.h" -#import "RCTTextAttributes.h" -#import "RCTTextSelection.h" +#import +#import +#import +#import #import "../RCTTextUIKit.h" // TODO(macOS ISS#2323203) @implementation RCTBaseTextInputView { @@ -104,13 +104,13 @@ - (NSAttributedString *)attributedText } - (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{ - // When the dictation is running we can't update the attibuted text on the backed up text view + // When the dictation is running we can't update the attributed text on the backed up text view // because setting the attributed string will kill the dictation. This means that we can't impose // the settings on a dictation. // Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the // text that we should disregard. See https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc // for more info. - // If the user added an emoji, the sytem adds a font attribute for the emoji and stores the original font in NSOriginalFont. + // If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in NSOriginalFont. // Lastly, when entering a password, etc., there will be additional styling on the field as the native text view // handles showing the last character for a split second. __block BOOL fontHasBeenUpdatedBySystem = false; @@ -190,7 +190,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self updateLocalData]; } else if (eventLag > RCTTextUpdateLagWarningThreshold) { - RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", self.backedTextInputView.attributedText.string, (long long)eventLag); + RCTLog(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", self.backedTextInputView.attributedText.string, (long long)eventLag); } } @@ -233,7 +233,7 @@ - (void)setSelection:(RCTTextSelection *)selection if (eventLag == 0 && !RCTTextSelectionEqual(previousSelectedTextRange, selectedTextRange)) { // TODO(macOS ISS#2323203) [backedTextInputView setSelectedTextRange:selectedTextRange notifyDelegate:NO]; } else if (eventLag > RCTTextUpdateLagWarningThreshold) { - RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", backedTextInputView.attributedText.string, (long long)eventLag); + RCTLog(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", backedTextInputView.attributedText.string, (long long)eventLag); } } @@ -305,6 +305,16 @@ - (void)setTextContentType:(NSString *)type } #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) + +- (void)setPasswordRules:(NSString *)descriptor +{ + #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0 + if (@available(iOS 12.0, *)) { + self.backedTextInputView.passwordRules = [UITextInputPasswordRules passwordRulesWithDescriptor:descriptor]; + } + #endif +} + - (UIKeyboardType)keyboardType { return self.backedTextInputView.keyboardType; @@ -432,7 +442,12 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin // Truncate the input string so the result is exactly maxLength NSString *limitedString = [text substringToIndex:allowedLength]; NSMutableAttributedString *newAttributedText = [backedTextInputView.attributedText mutableCopy]; - [newAttributedText replaceCharactersInRange:range withString:limitedString]; + // Apply text attributes if original input view doesn't have text. + if (backedTextInputView.attributedText.length == 0) { + newAttributedText = [[NSMutableAttributedString alloc] initWithString:[self.textAttributes applyTextAttributesToText:limitedString] attributes:self.textAttributes.effectiveTextAttributes]; + } else { + [newAttributedText replaceCharactersInRange:range withString:limitedString]; + } backedTextInputView.attributedText = newAttributedText; [self setPredictedText:newAttributedText.string]; // TODO(OSS Candidate ISS#2710739) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m index e9857a03e70148..05858cbb36818c 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTBaseTextInputViewManager.h" +#import #import #import @@ -17,10 +17,10 @@ #import #import -#import "RCTBaseTextInputShadowView.h" -#import "RCTBaseTextInputView.h" +#import +#import #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) -#import "RCTConvert+Text.h" +#import #endif // TODO(macOS ISS#2323203) @interface RCTBaseTextInputViewManager () @@ -62,6 +62,7 @@ @implementation RCTBaseTextInputViewManager RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection) RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString) RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString) +RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString) RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock) diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m index 02500e9f591fc5..ebe79f558926db 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTInputAccessoryShadowView.h" +#import #import diff --git a/Libraries/Text/TextInput/RCTInputAccessoryView.m b/Libraries/Text/TextInput/RCTInputAccessoryView.m index 062bf4a83e5527..da34fa0c4bb85b 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryView.m @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTInputAccessoryView.h" +#import #import #import #import -#import "RCTInputAccessoryViewContent.h" +#import @interface RCTInputAccessoryView() diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m index 61e54f9f0f5b8e..14f34f6eba545e 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTInputAccessoryViewContent.h" +#import #import diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m index 5f56c56ee1db72..2327d9c312928c 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTInputAccessoryViewManager.h" +#import -#import "RCTInputAccessoryShadowView.h" -#import "RCTInputAccessoryView.h" +#import +#import @implementation RCTInputAccessoryViewManager diff --git a/Libraries/Text/TextInput/RCTTextSelection.m b/Libraries/Text/TextInput/RCTTextSelection.m index 082b8fd3e48f82..ccece082216cab 100644 --- a/Libraries/Text/TextInput/RCTTextSelection.m +++ b/Libraries/Text/TextInput/RCTTextSelection.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTTextSelection.h" +#import @implementation RCTTextSelection diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m index 6ecc26a667ed3a..df53c3cdb13359 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTSinglelineTextInputView.h" +#import #import -#import "RCTUITextField.h" +#import @implementation RCTSinglelineTextInputView { diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m index f1a467eb4de555..b99315c20d078a 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTSinglelineTextInputViewManager.h" +#import -#import "RCTBaseTextInputShadowView.h" -#import "RCTSinglelineTextInputView.h" +#import +#import @implementation RCTSinglelineTextInputViewManager diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 4c86eebc3ad1df..3cb2c5d583b252 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -5,14 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTUITextField.h" +#import #import #import -#import "RCTBackedTextInputDelegateAdapter.h" -#import "RCTBackedTextInputDelegate.h" // TODO(OSS Candidate ISS#2710739) -#import "RCTTextAttributes.h" +#import +#import // TODO(OSS Candidate ISS#2710739) +#import + #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) @interface RCTUITextFieldCell : NSTextFieldCell @@ -417,6 +418,18 @@ - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)aRange #pragma mark - Overrides +#if !TARGET_OS_OSX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +// Overrides selectedTextRange setter to get notify when selectedTextRange changed. +- (void)setSelectedTextRange:(UITextRange *)selectedTextRange +{ + [super setSelectedTextRange:selectedTextRange]; + [_textInputDelegateAdapter selectedTextRangeWasSet]; +} +#pragma clang diagnostic pop +#endif // !TARGET_OS_OSX + #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) - (BOOL)becomeFirstResponder { diff --git a/Libraries/Text/TextPropTypes.js b/Libraries/Text/TextPropTypes.js deleted file mode 100644 index 756d95721f1b27..00000000000000 --- a/Libraries/Text/TextPropTypes.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('../DeprecatedPropTypes/DeprecatedColorPropType'); -const DeprecatedEdgeInsetsPropType = require('../DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'); -const PropTypes = require('prop-types'); -const DeprecatedStyleSheetPropType = require('../DeprecatedPropTypes/DeprecatedStyleSheetPropType'); -const TextStylePropTypes = require('./TextStylePropTypes'); - -const stylePropType = DeprecatedStyleSheetPropType(TextStylePropTypes); - -const DataDetectorTypes = ['phoneNumber', 'link', 'email', 'none', 'all']; - -module.exports = { - /** - * When `numberOfLines` is set, this prop defines how text will be - * truncated. - * - * See https://facebook.github.io/react-native/docs/text.html#ellipsizemode - */ - ellipsizeMode: PropTypes.oneOf(['head', 'middle', 'tail', 'clip']), - /** - * Used to truncate the text with an ellipsis. - * - * See https://facebook.github.io/react-native/docs/text.html#numberoflines - */ - numberOfLines: PropTypes.number, - /** - * Set text break strategy on Android. - * - * See https://facebook.github.io/react-native/docs/text.html#textbreakstrategy - */ - textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), - /** - * Invoked on mount and layout changes. - * - * See https://facebook.github.io/react-native/docs/text.html#onlayout - */ - onLayout: PropTypes.func, - /** - * This function is called on press. - * - * See https://facebook.github.io/react-native/docs/text.html#onpress - */ - onPress: PropTypes.func, - /** - * This function is called on long press. - * - * See https://facebook.github.io/react-native/docs/text.html#onlongpress - */ - onLongPress: PropTypes.func, - /** - * Defines how far your touch may move off of the button, before - * deactivating the button. - * - * See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset - */ - pressRetentionOffset: DeprecatedEdgeInsetsPropType, - /** - * Lets the user select text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectable - */ - selectable: PropTypes.bool, - /** - * The highlight color of the text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectioncolor - */ - selectionColor: DeprecatedColorPropType, - /** - * When `true`, no visual change is made when text is pressed down. - * - * See https://facebook.github.io/react-native/docs/text.html#supperhighlighting - */ - suppressHighlighting: PropTypes.bool, - style: stylePropType, - /** - * Used to locate this view in end-to-end tests. - * - * See https://facebook.github.io/react-native/docs/text.html#testid - */ - testID: PropTypes.string, - /** - * Used to locate this view from native code. - * - * See https://facebook.github.io/react-native/docs/text.html#nativeid - */ - nativeID: PropTypes.string, - /** - * Whether fonts should scale to respect Text Size accessibility settings. - * - * See https://facebook.github.io/react-native/docs/text.html#allowfontscaling - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * Indicates whether the view is an accessibility element. - * - * See https://facebook.github.io/react-native/docs/text.html#accessible - */ - accessible: PropTypes.bool, - /** - * Whether font should be scaled down automatically. - * - * See https://facebook.github.io/react-native/docs/text.html#adjustsfontsizetofit - */ - adjustsFontSizeToFit: PropTypes.bool, - /** - * Smallest possible scale a font can reach. - * - * See https://facebook.github.io/react-native/docs/text.html#minimumfontscale - */ - minimumFontScale: PropTypes.number, - /** - * Specifies the disabled state of the text view for testing purposes. - * - * See https://facebook.github.io/react-native/docs/text.html#disabled - */ - disabled: PropTypes.bool, - /** - * Determines the types of data converted to clickable URLs in text. - * - * See https://facebook.github.io/react-native/docs/text.html#dataDetectorType - */ - dataDetectorType: PropTypes.oneOf(DataDetectorTypes), -}; diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index 2e55b7c4fa69d6..21951fe145c7f0 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -20,6 +20,7 @@ import type {TextStyleProp} from '../StyleSheet/StyleSheet'; import type { AccessibilityRole, AccessibilityStates, + AccessibilityState, } from '../Components/View/ViewAccessibility'; export type PressRetentionOffset = $ReadOnly<{| @@ -43,6 +44,7 @@ export type TextProps = $ReadOnly<{| accessibilityLabel?: ?Stringish, accessibilityRole?: ?AccessibilityRole, accessibilityStates?: ?AccessibilityStates, + accessibilityState?: ?AccessibilityState, /** * Whether font should be scaled down automatically. diff --git a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m index ef659cc54b797a..1326b3e2796d59 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m +++ b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTVirtualTextShadowView.h" +#import #import #import -#import "RCTRawTextShadowView.h" +#import @implementation RCTVirtualTextShadowView { BOOL _isLayoutDirty; diff --git a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m index ec82788a22645e..1e2908818fc82e 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m +++ b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTVirtualTextViewManager.h" +#import -#import "RCTVirtualTextShadowView.h" +#import @implementation RCTVirtualTextViewManager diff --git a/Libraries/TurboModule/RCTExport.js b/Libraries/TurboModule/RCTExport.js index bf608d6fe8759a..9e8a884d2b724f 100644 --- a/Libraries/TurboModule/RCTExport.js +++ b/Libraries/TurboModule/RCTExport.js @@ -13,23 +13,25 @@ /** * NOTE: This is React Native specific export type. * - * RCTExport is an interface type that allows native code generation for React - * Native native modules. It exists as a hint to the codegen tool that any - * interface that extends it needs to be codegen'ed. Example usage: + * DEPRECATED_RCTExport is an interface type that allows native code generation + * for React Native native modules. It exists as a hint to the codegen tool that + * any interface that extends it needs to be codegen'ed. Example usage: * - * export interface RCTFoobar extends RCTExport {} + * export interface RCTFoobar extends DEPRECATED_RCTExport {} * * Native definition for RCTFoobar will then be generated. * * The type param T is a placeholder for future codegen hinting, like versioning * information, native base classes, etc. For now, simply use `void` type as * there's nothing to give hint about. + * + * NOTE: This export is deprecated. Please us TurboModule. */ // eslint-disable-next-line no-unused-vars -export interface RCTExport { +export interface DEPRECATED_RCTExport { +getConstants?: () => {}; } // eslint-disable-next-line lint/react-native-modules -export interface TurboModule extends RCTExport {} +export interface TurboModule extends DEPRECATED_RCTExport {} diff --git a/Libraries/TurboModule/TurboModuleRegistry.js b/Libraries/TurboModule/TurboModuleRegistry.js index ca64f774deceea..b3b1135f98bf9e 100644 --- a/Libraries/TurboModule/TurboModuleRegistry.js +++ b/Libraries/TurboModule/TurboModuleRegistry.js @@ -11,17 +11,19 @@ 'use strict'; const NativeModules = require('../BatchedBridge/NativeModules'); - import type {TurboModule} from './RCTExport'; import invariant from 'invariant'; const turboModuleProxy = global.__turboModuleProxy; -function get(name: string): ?T { - // Backward compatibility layer during migration. - const legacyModule = NativeModules[name]; - if (legacyModule != null) { - return ((legacyModule: any): T); +export function get(name: string): ?T { + // Bridgeless mode requires TurboModules + if (!global.RN$Bridgeless) { + // Backward compatibility layer during migration. + const legacyModule = NativeModules[name]; + if (legacyModule != null) { + return ((legacyModule: any): T); + } } if (turboModuleProxy != null) { @@ -32,11 +34,12 @@ function get(name: string): ?T { return null; } -function getEnforcing(name: string): T { +export function getEnforcing(name: string): T { const module = get(name); - invariant(module != null, `${name} is not available in this app.`); + invariant( + module != null, + `TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` + + 'Verify that a module by this name is registered in the native binary.', + ); return module; } - -export {get}; -export {getEnforcing}; diff --git a/Libraries/TurboModule/samples/NativeSampleTurboModule.js b/Libraries/TurboModule/samples/NativeSampleTurboModule.js index 486d555aa04516..f82a8e810878e5 100644 --- a/Libraries/TurboModule/samples/NativeSampleTurboModule.js +++ b/Libraries/TurboModule/samples/NativeSampleTurboModule.js @@ -31,4 +31,6 @@ export interface Spec extends TurboModule { +getValueWithPromise: (error: boolean) => Promise; } -export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +export default (TurboModuleRegistry.getEnforcing( + 'SampleTurboModule', +): Spec); diff --git a/Libraries/TypeSafety/RCTConvertHelpers.h b/Libraries/TypeSafety/RCTConvertHelpers.h new file mode 100644 index 00000000000000..15c6c688d5a520 --- /dev/null +++ b/Libraries/TypeSafety/RCTConvertHelpers.h @@ -0,0 +1,67 @@ +/** + * 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. + */ + +#import + +#import + +#import +#import + +namespace facebook { +namespace react { + template + using LazyVector = FB::LazyVector; +}} + +template +NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element)) +{ + NSMutableArray *array = [NSMutableArray new]; + for (size_t i = 0, size = vec.size(); i < size; ++i) { + id object = convertor(vec[i]); + array[i] = object ?: (id)kCFNull; + } + return array; +} +template +NSArray *RCTConvertVecToArray(const ContainerT &vec) +{ + return RCTConvertVecToArray(vec, ^id(typename ContainerT::value_type element) { return element; }); +} + +template +NSArray *RCTConvertOptionalVecToArray(const folly::Optional &vec, id (^convertor)(typename ContainerT::value_type element)) +{ + return vec.hasValue() ? RCTConvertVecToArray(vec.value(), convertor) : nil; +} + +bool RCTBridgingToBool(id value); +folly::Optional RCTBridgingToOptionalBool(id value); +NSString *RCTBridgingToString(id value); +folly::Optional RCTBridgingToOptionalDouble(id value); +double RCTBridgingToDouble(id value); +NSArray *RCTBridgingToArray(id value); + +template +facebook::react::LazyVector RCTBridgingToVec(id value, T (^ctor)(id element)) +{ + NSArray *array = RCTBridgingToArray(value); + typedef typename facebook::react::LazyVector::size_type _size_t; + _size_t size = static_cast<_size_t>(array.count); + return facebook::react::LazyVector::fromUnsafeRawValue(array, size, ctor); +} + +template +folly::Optional> RCTBridgingToOptionalVec(id value, T (^ctor)(id element)) +{ + if (value == nil) { + return folly::none; + } else { + return RCTBridgingToVec(value, ctor); + } +} diff --git a/Libraries/TypeSafety/RCTConvertHelpers.mm b/Libraries/TypeSafety/RCTConvertHelpers.mm new file mode 100644 index 00000000000000..61fef6fe0bea1a --- /dev/null +++ b/Libraries/TypeSafety/RCTConvertHelpers.mm @@ -0,0 +1,45 @@ +/** + * 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. + */ + +#import "RCTConvertHelpers.h" + +#import + +bool RCTBridgingToBool(id value) +{ + return [RCTConvert BOOL:value] ? true : false; +} + +folly::Optional RCTBridgingToOptionalBool(id value) +{ + if (!value) { + return {}; + } + return RCTBridgingToBool(value); +} + +NSString *RCTBridgingToString(id value) +{ + return [RCTConvert NSString:value]; +} + +folly::Optional RCTBridgingToOptionalDouble(id value) +{ + if (!value) { + return {}; + } + return RCTBridgingToDouble(value); +} + +double RCTBridgingToDouble(id value) +{ + return [RCTConvert double:value]; +} + +NSArray *RCTBridgingToArray(id value) { + return [RCTConvert NSArray:value]; +} diff --git a/ReactCommon/jscallinvoker/React-jscallinvoker.podspec b/Libraries/TypeSafety/RCTTypeSafety.podspec similarity index 66% rename from ReactCommon/jscallinvoker/React-jscallinvoker.podspec rename to Libraries/TypeSafety/RCTTypeSafety.podspec index 12876d8068c084..b59d80ef9a2bde 100644 --- a/ReactCommon/jscallinvoker/React-jscallinvoker.podspec +++ b/Libraries/TypeSafety/RCTTypeSafety.podspec @@ -19,23 +19,27 @@ end folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' folly_version = '2018.10.22.00' -boost_compiler_flags = '-Wno-documentation' Pod::Spec.new do |s| - s.name = "React-jscallinvoker" + s.name = "RCTTypeSafety" s.version = version s.summary = "-" # TODO s.homepage = "http://facebook.github.io/react-native/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) + s.compiler_flags = folly_compiler_flags s.source = source - s.source_files = "jsireact/*.{cpp,h}" - s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.header_dir = "jsireact" - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" } + s.source_files = "**/*.{c,h,m,mm,cpp}" + s.header_dir = "RCTTypeSafety" + s.pod_target_xcconfig = { + "USE_HEADERMAP" => "YES", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/Libraries/TypeSafety\" \"$(PODS_ROOT)/Folly\"" + } - s.dependency "React-cxxreact", version + s.dependency "FBLazyVector", version s.dependency "Folly", folly_version - + s.dependency "RCTRequired", version + s.dependency "React-Core", version end diff --git a/Libraries/TypeSafety/RCTTypedModuleConstants.h b/Libraries/TypeSafety/RCTTypedModuleConstants.h new file mode 100644 index 00000000000000..25437174a6aa42 --- /dev/null +++ b/Libraries/TypeSafety/RCTTypedModuleConstants.h @@ -0,0 +1,47 @@ +/** + * 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. + */ + +#include + +#import + +#import +#import + +/** + * Interop type layer for RN's exportedConstants and the C++ structs generated by our typesafety codegen. + * + * The NativeModuleSpec will define a constantsToExport method which you can implement as follows: + * + * - (nonnull ModuleConstants)constantsToExport + * { + * return typedConstants({ ... }); + * } + */ + +// Internal container for module constants. Do not use yourself directly, instead use the typedConstants helpers below. +@interface _RCTTypedModuleConstants : NSDictionary + ++ (instancetype)newWithUnsafeDictionary:(NSDictionary *)dictionary; + +@end + +namespace facebook { +namespace react { + +// Objective-C doesn't allow arbitrary types in its lightweight generics, only object and block types. We can work +// around that by having the struct type we care about be a block-argument. The block never exists at runtime. +template +using ModuleConstants = _RCTTypedModuleConstants *; + +template +ModuleConstants typedConstants(typename T::Builder::Input &&value) { + typename T::Builder builder(std::move(value)); + return [_RCTTypedModuleConstants newWithUnsafeDictionary:builder.buildUnsafeRawValue()]; +} + +} } diff --git a/Libraries/TypeSafety/RCTTypedModuleConstants.mm b/Libraries/TypeSafety/RCTTypedModuleConstants.mm new file mode 100644 index 00000000000000..a3c6c34540cc7b --- /dev/null +++ b/Libraries/TypeSafety/RCTTypedModuleConstants.mm @@ -0,0 +1,48 @@ +/** + * 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. + */ + +#import "RCTTypedModuleConstants.h" + +#import + +@implementation _RCTTypedModuleConstants { + NSDictionary *_dictionary; +} + ++ (instancetype)newWithUnsafeDictionary:(NSDictionary *)dictionary +{ + _RCTTypedModuleConstants *constants = [self new]; + if (constants) { + constants->_dictionary = dictionary; + } + return constants; +} + +#pragma mark - NSDictionary subclass + +// See subclassing notes in https://developer.apple.com/documentation/foundation/nsdictionary#//apple_ref/occ/cl/NSDictionary + +RCT_NOT_IMPLEMENTED(- (instancetype)initWithObjects:(id _Nonnull const [])objects + forKeys:(id _Nonnull const [])keys + count:(NSUInteger)count) + +- (NSUInteger)count +{ + return [_dictionary count]; +} + +- (id)objectForKey:(id)key +{ + return [_dictionary objectForKey:key]; +} + +- (NSEnumerator *)keyEnumerator +{ + return [_dictionary keyEnumerator]; +} + +@end diff --git a/Libraries/Types/CodegenTypes.js b/Libraries/Types/CodegenTypes.js new file mode 100644 index 00000000000000..9d499ae2fa4efe --- /dev/null +++ b/Libraries/Types/CodegenTypes.js @@ -0,0 +1,40 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; + +import type {SyntheticEvent} from './CoreEventTypes'; + +// Event types +// We're not using the PaperName, it is only used to codegen view config settings + +export type BubblingEventHandler< + T, + PaperName: string | empty = empty, // eslint-disable-line no-unused-vars +> = (event: SyntheticEvent) => void | Promise; +export type DirectEventHandler< + T, + PaperName: string | empty = empty, // eslint-disable-line no-unused-vars +> = (event: SyntheticEvent) => void | Promise; + +// Prop types +export type Double = number; +export type Float = number; +export type Int32 = number; + +type DefaultTypes = number | boolean | string | $ReadOnlyArray; +// Default handling, ignore the unused value +// we're only using it for type checking +// +// TODO: (rickhanlonii) T44881457 If a default is provided, it should always be optional +// but that is currently not supported in the codegen since we require a default +// +// eslint-disable-next-line no-unused-vars +export type WithDefault = ?Type; diff --git a/Libraries/Types/CoreEventTypes.js b/Libraries/Types/CoreEventTypes.js index 99cbc70186e78d..517e875d43db43 100644 --- a/Libraries/Types/CoreEventTypes.js +++ b/Libraries/Types/CoreEventTypes.js @@ -84,18 +84,18 @@ export type TextLayoutEvent = SyntheticEvent< export type PressEvent = ResponderSyntheticEvent< $ReadOnly<{| - altKey: ?boolean, // TODO(macOS) - button: ?number, // TODO(macOS) + altKey: ?boolean, // TODO(macOS ISS#2323203) + button: ?number, // TODO(macOS ISS#2323203) changedTouches: $ReadOnlyArray<$PropertyType>, - ctrlKey: ?boolean, + ctrlKey: ?boolean, // TODO(macOS ISS#2323203) force: number, identifier: number, locationX: number, locationY: number, - metaKey: ?boolean, // TODO(macOS) + metaKey: ?boolean, // TODO(macOS ISS#2323203) pageX: number, pageY: number, - shiftKey: ?boolean, // TODO(macOS) + shiftKey: ?boolean, // TODO(macOS ISS#2323203) target: ?number, timestamp: number, touches: $ReadOnlyArray<$PropertyType>, @@ -132,13 +132,7 @@ export type ScrollEvent = SyntheticEvent< |}>, zoomScale?: number, responderIgnoreScroll?: boolean, - key?: string, // TODO(macOS) - preferredScrollerStyle?: string, // TODO(macOS) - |}>, ->; - -export type SwitchChangeEvent = SyntheticEvent< - $ReadOnly<{| - value: boolean, + key?: string, // TODO(macOS ISS#2323203) + preferredScrollerStyle?: string, // TODO(macOS ISS#2323203) |}>, >; diff --git a/Libraries/UTFSequence.js b/Libraries/UTFSequence.js index db5ff90fcf8f94..4e6c030ef20f20 100644 --- a/Libraries/UTFSequence.js +++ b/Libraries/UTFSequence.js @@ -19,7 +19,22 @@ const deepFreezeAndThrowOnMutationInDev = require('./Utilities/deepFreezeAndThro * - Source code should be limitted to ASCII. * - Less chance of typos. */ -const UTFSequence = deepFreezeAndThrowOnMutationInDev({ +const UTFSequence: $TEMPORARY$object<{| + BOM: string, + BULLET: string, + BULLET_SP: string, + MDASH: string, + MDASH_SP: string, + MIDDOT: string, + MIDDOT_KATAKANA: string, + MIDDOT_SP: string, + NBSP: string, + NDASH: string, + NDASH_SP: string, + PIZZA: string, + TRIANGLE_LEFT: string, + TRIANGLE_RIGHT: string, +|}> = deepFreezeAndThrowOnMutationInDev({ BOM: '\ufeff', // byte order mark BULLET: '\u2022', // bullet: • BULLET_SP: '\u00A0\u2022\u00A0', //  •  diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index be48d8b8119f13..ce7e226fad1a4c 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -10,9 +10,8 @@ 'use strict'; -const DeviceEventManager = require('../BatchedBridge/NativeModules') - .DeviceEventManager; -const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); +import NativeDeviceEventManager from '../../Libraries/NativeModules/specs/NativeDeviceEventManager'; +import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter'; const DEVICE_BACK_EVENT = 'hardwareBackPress'; @@ -75,7 +74,11 @@ type TBackHandler = {| |}; const BackHandler: TBackHandler = { exitApp: function(): void { - DeviceEventManager.invokeDefaultBackPressHandler(); + if (!NativeDeviceEventManager) { + return; + } + + NativeDeviceEventManager.invokeDefaultBackPressHandler(); }, /** diff --git a/Libraries/Utilities/DeviceInfo.js b/Libraries/Utilities/DeviceInfo.js index 9757f2686e5a70..c3f59c5e88bced 100644 --- a/Libraries/Utilities/DeviceInfo.js +++ b/Libraries/Utilities/DeviceInfo.js @@ -10,10 +10,6 @@ 'use strict'; -const DeviceInfo = require('../BatchedBridge/NativeModules').DeviceInfo; +import NativeDeviceInfo from './NativeDeviceInfo'; -const invariant = require('invariant'); - -invariant(DeviceInfo, 'DeviceInfo native module is not installed correctly'); - -module.exports = DeviceInfo; +module.exports = NativeDeviceInfo; diff --git a/Libraries/Utilities/Dimensions.js b/Libraries/Utilities/Dimensions.js index 383dcc44c8ac5c..4a07a7f38c3e0a 100644 --- a/Libraries/Utilities/Dimensions.js +++ b/Libraries/Utilities/Dimensions.js @@ -10,88 +10,84 @@ 'use strict'; -const EventEmitter = require('../vendor/emitter/EventEmitter'); -const Platform = require('./Platform'); -const RCTDeviceEventEmitter = require('../EventEmitter/RCTDeviceEventEmitter'); +import EventEmitter from '../vendor/emitter/EventEmitter'; +import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter'; +import NativeDeviceInfo, { + type DisplayMetrics, + type DimensionsPayload, +} from './NativeDeviceInfo'; +import invariant from 'invariant'; -const invariant = require('invariant'); +type DimensionsValue = {window?: DisplayMetrics, screen?: DisplayMetrics}; const eventEmitter = new EventEmitter(); let dimensionsInitialized = false; -const dimensions = {}; +let dimensions: DimensionsValue; + class Dimensions { + /** + * NOTE: `useWindowDimensions` is the preffered API for React components. + * + * Initial dimensions are set before `runApplication` is called so they should + * be available before any other require's are run, but may be updated later. + * + * Note: Although dimensions are available immediately, they may change (e.g + * due to device rotation) so any rendering logic or styles that depend on + * these constants should try to call this function on every render, rather + * than caching the value (for example, using inline styles rather than + * setting a value in a `StyleSheet`). + * + * Example: `const {height, width} = Dimensions.get('window');` + * + * @param {string} dim Name of dimension as defined when calling `set`. + * @returns {Object?} Value for the dimension. + */ + static get(dim: string): Object { + invariant(dimensions[dim], 'No dimension set for key ' + dim); + return dimensions[dim]; + } + /** * This should only be called from native code by sending the * didUpdateDimensions event. * * @param {object} dims Simple string-keyed object of dimensions to set */ - static set(dims: {[key: string]: any}): void { + static set(dims: $ReadOnly<{[key: string]: any}>): void { // We calculate the window dimensions in JS so that we don't encounter loss of // precision in transferring the dimensions (which could be non-integers) over // the bridge. - if (dims && dims.windowPhysicalPixels) { - // parse/stringify => Clone hack - dims = JSON.parse(JSON.stringify(dims)); - - const windowPhysicalPixels = dims.windowPhysicalPixels; - dims.window = { + let {screen, window} = dims; + const {windowPhysicalPixels} = dims; + if (windowPhysicalPixels) { + window = { width: windowPhysicalPixels.width / windowPhysicalPixels.scale, height: windowPhysicalPixels.height / windowPhysicalPixels.scale, scale: windowPhysicalPixels.scale, fontScale: windowPhysicalPixels.fontScale, }; - if (Platform.OS === 'android') { - // Screen and window dimensions are different on android - const screenPhysicalPixels = dims.screenPhysicalPixels; - dims.screen = { - width: screenPhysicalPixels.width / screenPhysicalPixels.scale, - height: screenPhysicalPixels.height / screenPhysicalPixels.scale, - scale: screenPhysicalPixels.scale, - fontScale: screenPhysicalPixels.fontScale, - }; - - // delete so no callers rely on this existing - delete dims.screenPhysicalPixels; - } else { - dims.screen = dims.window; - } - // delete so no callers rely on this existing - delete dims.windowPhysicalPixels; + } + const {screenPhysicalPixels} = dims; + if (screenPhysicalPixels) { + screen = { + width: screenPhysicalPixels.width / screenPhysicalPixels.scale, + height: screenPhysicalPixels.height / screenPhysicalPixels.scale, + scale: screenPhysicalPixels.scale, + fontScale: screenPhysicalPixels.fontScale, + }; + } else if (screen == null) { + screen = window; } - Object.assign(dimensions, dims); + dimensions = {window, screen}; if (dimensionsInitialized) { // Don't fire 'change' the first time the dimensions are set. - eventEmitter.emit('change', { - window: dimensions.window, - screen: dimensions.screen, - }); + eventEmitter.emit('change', dimensions); } else { dimensionsInitialized = true; } } - /** - * Initial dimensions are set before `runApplication` is called so they should - * be available before any other require's are run, but may be updated later. - * - * Note: Although dimensions are available immediately, they may change (e.g - * due to device rotation) so any rendering logic or styles that depend on - * these constants should try to call this function on every render, rather - * than caching the value (for example, using inline styles rather than - * setting a value in a `StyleSheet`). - * - * Example: `var {height, width} = Dimensions.get('window');` - * - * @param {string} dim Name of dimension as defined when calling `set`. - * @returns {Object?} Value for the dimension. - */ - static get(dim: string): Object { - invariant(dimensions[dim], 'No dimension set for key ' + dim); - return dimensions[dim]; - } - /** * Add an event handler. Supported events: * @@ -100,7 +96,7 @@ class Dimensions { * are the same as the return values of `Dimensions.get('window')` and * `Dimensions.get('screen')`, respectively. */ - static addEventListener(type: string, handler: Function) { + static addEventListener(type: 'change', handler: Function) { invariant( type === 'change', 'Trying to subscribe to unknown event: "%s"', @@ -112,7 +108,7 @@ class Dimensions { /** * Remove an event handler. */ - static removeEventListener(type: string, handler: Function) { + static removeEventListener(type: 'change', handler: Function) { invariant( type === 'change', 'Trying to remove listener for unknown event: "%s"', @@ -122,26 +118,23 @@ class Dimensions { } } -let dims: ?{[key: string]: any} = +let initialDims: ?$ReadOnly<{[key: string]: any}> = global.nativeExtensions && global.nativeExtensions.DeviceInfo && global.nativeExtensions.DeviceInfo.Dimensions; -let nativeExtensionsEnabled = true; -if (!dims) { - const DeviceInfo = require('./DeviceInfo'); - dims = DeviceInfo.Dimensions; - nativeExtensionsEnabled = false; +if (!initialDims) { + // Subscribe before calling getConstants to make sure we don't miss any updates in between. + RCTDeviceEventEmitter.addListener( + 'didUpdateDimensions', + (update: DimensionsPayload) => { + Dimensions.set(update); + }, + ); + // Can't use NativeDeviceInfo in ComponentScript because it does not support NativeModules, + // but has nativeExtensions instead. + initialDims = NativeDeviceInfo.getConstants().Dimensions; } -invariant( - dims, - 'Either DeviceInfo native extension or DeviceInfo Native Module must be registered', -); -Dimensions.set(dims); -if (!nativeExtensionsEnabled) { - RCTDeviceEventEmitter.addListener('didUpdateDimensions', function(update) { - Dimensions.set(update); - }); -} +Dimensions.set(initialDims); module.exports = Dimensions; diff --git a/Libraries/Utilities/GlobalPerformanceLogger.js b/Libraries/Utilities/GlobalPerformanceLogger.js index ccab5e4685a6de..6b1d9266a4a334 100644 --- a/Libraries/Utilities/GlobalPerformanceLogger.js +++ b/Libraries/Utilities/GlobalPerformanceLogger.js @@ -8,9 +8,10 @@ * @format */ 'use strict'; - const createPerformanceLogger = require('./createPerformanceLogger'); +import type {IPerformanceLogger} from './createPerformanceLogger'; + /** * This is a global shared instance of IPerformanceLogger that is created with * createPerformanceLogger(). @@ -18,6 +19,6 @@ const createPerformanceLogger = require('./createPerformanceLogger'); * that are logged during loading bundle. If you want to log something from your * React component you should use PerformanceLoggerContext instead. */ -const GlobalPerformanceLogger = createPerformanceLogger(); +const GlobalPerformanceLogger: IPerformanceLogger = createPerformanceLogger(); module.exports = GlobalPerformanceLogger; diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index 050c509c3e40b7..08c0f4e432eb44 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -14,47 +14,169 @@ const invariant = require('invariant'); const MetroHMRClient = require('metro/src/lib/bundle-modules/HMRClient'); +import NativeRedBox from '../NativeModules/specs/NativeRedBox'; + +import type {ExtendedError} from '../Core/Devtools/parseErrorStack'; + +const pendingEntryPoints = []; +let hmrClient = null; +let hmrUnavailableReason: string | null = null; +let currentCompileErrorMessage: string | null = null; +let didConnect: boolean = false; + +type LogLevel = + | 'trace' + | 'info' + | 'warn' + | 'log' + | 'group' + | 'groupCollapsed' + | 'groupEnd' + | 'debug'; + +export type HMRClientNativeInterface = {| + enable(): void, + disable(): void, + registerBundle(requestUrl: string): void, + log(level: LogLevel, data: Array): void, + setup( + platform: string, + bundleEntry: string, + host: string, + port: number | string, + isEnabled: boolean, + ): void, +|}; + /** * HMR Client that receives from the server HMR updates and propagates them * runtime to reflects those changes. */ -const HMRClient = { - enable(platform: string, bundleEntry: string, host: string, port: number) { +const HMRClient: HMRClientNativeInterface = { + enable() { + if (hmrUnavailableReason !== null) { + // If HMR became unavailable while you weren't using it, + // explain why when you try to turn it on. + // This is an error (and not a warning) because it is shown + // in response to a direct user action. + throw new Error(hmrUnavailableReason); + } + + invariant(hmrClient, 'Expected HMRClient.setup() call at startup.'); + const LoadingView = require('./LoadingView'); + + // We use this for internal logging only. + // It doesn't affect the logic. + hmrClient.send(JSON.stringify({type: 'log-opt-in'})); + + // When toggling Fast Refresh on, we might already have some stashed updates. + // Since they'll get applied now, we'll show a banner. + const hasUpdates = hmrClient.hasPendingUpdates(); + + if (hasUpdates) { + LoadingView.showMessage('Refreshing...', 'refresh'); + } + try { + hmrClient.enable(); + } finally { + if (hasUpdates) { + LoadingView.hide(); + } + } + + // There could be a compile error while Fast Refresh was off, + // but we ignored it at the time. Show it now. + showCompileError(); + }, + + disable() { + invariant(hmrClient, 'Expected HMRClient.setup() call at startup.'); + hmrClient.disable(); + }, + + registerBundle(requestUrl: string) { + invariant(hmrClient, 'Expected HMRClient.setup() call at startup.'); + pendingEntryPoints.push(requestUrl); + registerBundleEntryPoints(hmrClient); + }, + + log(level: LogLevel, data: Array) { + try { + if (hmrClient) { + let message; + if (global.Symbol) { + message = JSON.stringify({ + type: 'log', + level, + data: data.map(item => + typeof item === 'string' + ? item + : require('pretty-format')(item, { + escapeString: true, + highlight: true, + maxDepth: 3, + min: true, + plugins: [require('pretty-format').plugins.ReactElement], + }), + ), + }); + } else { + try { + message = JSON.stringify({type: 'log', level, data}); + } catch (error) { + message = JSON.stringify({ + type: 'log', + level, + data: [error.message], + }); + } + } + + hmrClient.send(message); + } + } catch (error) { + // If sending logs causes any failures we want to silently ignore them + // to ensure we do not cause infinite-logging loops. + } + }, + + // Called once by the bridge on startup, even if Fast Refresh is off. + // It creates the HMR client but doesn't actually set up the socket yet. + setup( + platform: string, + bundleEntry: string, + host: string, + port: number | string, + isEnabled: boolean, + ) { invariant(platform, 'Missing required parameter `platform`'); invariant(bundleEntry, 'Missing required paramenter `bundleEntry`'); invariant(host, 'Missing required paramenter `host`'); + invariant(!hmrClient, 'Cannot initialize hmrClient twice'); // Moving to top gives errors due to NativeModules not being initialized - // $FlowFixMe - const HMRLoadingView = require('./HMRLoadingView'); - - /* $FlowFixMe(>=0.84.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.84 was deployed. To see the error, delete this - * comment and run Flow. */ - const wsHostPort = port !== null && port !== '' ? `${host}:${port}` : host; - - bundleEntry = bundleEntry.replace(/\.(bundle|delta)/, '.js'); + const LoadingView = require('./LoadingView'); - // Build the websocket url - const wsUrl = - `ws://${wsHostPort}/hot?` + - `platform=${platform}&` + - `bundleEntry=${bundleEntry}`; + const wsHost = port !== null && port !== '' ? `${host}:${port}` : host; + const client = new MetroHMRClient(`ws://${wsHost}/hot`); + hmrClient = client; - const hmrClient = new MetroHMRClient(wsUrl); + pendingEntryPoints.push( + `ws://${wsHost}/hot?bundleEntry=${bundleEntry}&platform=${platform}`, + ); - hmrClient.on('connection-error', e => { - let error = `Hot loading isn't working because it cannot connect to the development server. + client.on('connection-error', e => { + let error = `Cannot connect to the Metro server. Try the following to fix the issue: -- Ensure that the packager server is running and available on the same network`; +- Ensure that the Metro server is running and available on the same network`; if ( Platform.OS === 'ios' || Platform.OS === 'macos' /* TODO(macOS ISS#2323203) */ ) { error += ` -- Ensure that the Packager server URL is correctly set in AppDelegate`; +- Ensure that the Metro server URL is correctly set in AppDelegate`; } else { error += ` - Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices @@ -68,57 +190,128 @@ URL: ${host}:${port} Error: ${e.message}`; - throw new Error(error); + setHMRUnavailableReason(error); }); - hmrClient.on('update-start', () => { - HMRLoadingView.showMessage('Hot Loading...'); + client.on('update-start', ({isInitialUpdate}) => { + currentCompileErrorMessage = null; + didConnect = true; + + if (client.isEnabled() && !isInitialUpdate) { + LoadingView.showMessage('Refreshing...', 'refresh'); + } }); - hmrClient.on('update', () => { - if (Platform.OS === 'ios') { - const RCTRedBox = require('../BatchedBridge/NativeModules').RedBox; - RCTRedBox && RCTRedBox.dismiss && RCTRedBox.dismiss(); - } else { - const RCTExceptionsManager = require('../BatchedBridge/NativeModules') - .ExceptionsManager; - RCTExceptionsManager && - RCTExceptionsManager.dismissRedbox && - RCTExceptionsManager.dismissRedbox(); + client.on('update', ({isInitialUpdate}) => { + if (client.isEnabled() && !isInitialUpdate) { + dismissRedbox(); } }); - hmrClient.on('update-done', () => { - HMRLoadingView.hide(); + client.on('update-done', () => { + LoadingView.hide(); }); - hmrClient.on('error', data => { - HMRLoadingView.hide(); + client.on('error', data => { + LoadingView.hide(); if (data.type === 'GraphNotFoundError') { - hmrClient.disable(); - throw new Error( - 'The packager server has restarted since the last Hot update. Hot Reloading will be disabled until you reload the application.', + client.close(); + setHMRUnavailableReason( + 'The Metro server has restarted since the last edit. Reload to reconnect.', ); } else if (data.type === 'RevisionNotFoundError') { - hmrClient.disable(); - throw new Error( - 'The packager server and the client are out of sync. Hot Reloading will be disabled until you reload the application.', + client.close(); + setHMRUnavailableReason( + 'The Metro server and the client are out of sync. Reload to reconnect.', ); } else { - throw new Error(`${data.type} ${data.message}`); + currentCompileErrorMessage = `${data.type} ${data.message}`; + if (client.isEnabled()) { + showCompileError(); + } } }); - hmrClient.on('close', data => { - HMRLoadingView.hide(); - throw new Error( - 'Disconnected from the packager server. Hot Reloading will be disabled until you reload the application.', + client.on('close', data => { + LoadingView.hide(); + setHMRUnavailableReason( + 'Disconnected from the Metro server. Reload to reconnect.', ); }); - hmrClient.enable(); + if (isEnabled) { + HMRClient.enable(); + } else { + HMRClient.disable(); + } + + registerBundleEntryPoints(hmrClient); }, }; +function setHMRUnavailableReason(reason) { + invariant(hmrClient, 'Expected HMRClient.setup() call at startup.'); + if (hmrUnavailableReason !== null) { + // Don't show more than one warning. + return; + } + hmrUnavailableReason = reason; + + // We only want to show a warning if Fast Refresh is on *and* if we ever + // previously managed to connect successfully. We don't want to show + // the warning to native engineers who use cached bundles without Metro. + if (hmrClient.isEnabled() && didConnect) { + console.warn(reason); + // (Not using the `warning` module to prevent a Buck cycle.) + } +} + +function registerBundleEntryPoints(client) { + if (pendingEntryPoints.length > 0) { + client.send( + JSON.stringify({ + type: 'register-entrypoints', + entryPoints: pendingEntryPoints, + }), + ); + pendingEntryPoints.length = 0; + } +} + +function dismissRedbox() { + if ( + Platform.OS === 'ios' && + NativeRedBox != null && + NativeRedBox.dismiss != null + ) { + NativeRedBox.dismiss(); + } else { + const NativeExceptionsManager = require('../Core/NativeExceptionsManager') + .default; + NativeExceptionsManager && + NativeExceptionsManager.dismissRedbox && + NativeExceptionsManager.dismissRedbox(); + } +} + +function showCompileError() { + if (currentCompileErrorMessage === null) { + return; + } + + // Even if there is already a redbox, syntax errors are more important. + // Otherwise you risk seeing a stale runtime error while a syntax error is more recent. + dismissRedbox(); + + const message = currentCompileErrorMessage; + currentCompileErrorMessage = null; + + const error: ExtendedError = new Error(message); + // Symbolicating compile errors is wasted effort + // because the stack trace is meaningless: + error.preventSymbolication = true; + throw error; +} + module.exports = HMRClient; diff --git a/Libraries/Utilities/HMRClientProdShim.js b/Libraries/Utilities/HMRClientProdShim.js new file mode 100644 index 00000000000000..cb4fdb6a60d34f --- /dev/null +++ b/Libraries/Utilities/HMRClientProdShim.js @@ -0,0 +1,29 @@ +/** + * 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. + * + * @format + * @flow + */ +'use strict'; + +import type {HMRClientNativeInterface} from './HMRClient'; + +// This shim ensures DEV binary builds don't crash in JS +// when they're combined with a PROD JavaScript build. +const HMRClientProdShim: HMRClientNativeInterface = { + setup() {}, + enable() { + console.error( + 'Fast Refresh is disabled in JavaScript bundles built in production mode. ' + + 'Did you forget to run Metro?', + ); + }, + disable() {}, + registerBundle() {}, + log() {}, +}; + +module.exports = HMRClientProdShim; diff --git a/Libraries/Utilities/HMRLoadingView.android.js b/Libraries/Utilities/HMRLoadingView.android.js deleted file mode 100644 index 9daf8e2e4435f7..00000000000000 --- a/Libraries/Utilities/HMRLoadingView.android.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - * - * @format - * @flow - */ - -'use strict'; - -const ToastAndroid = require('../Components/ToastAndroid/ToastAndroid'); - -const TOAST_SHORT_DELAY = 2000; - -class HMRLoadingView { - static _showing: boolean; - - static showMessage(message: string) { - if (HMRLoadingView._showing) { - return; - } - ToastAndroid.show(message, ToastAndroid.SHORT); - HMRLoadingView._showing = true; - setTimeout(() => { - HMRLoadingView._showing = false; - }, TOAST_SHORT_DELAY); - } - - static hide() { - // noop - } -} - -module.exports = HMRLoadingView; diff --git a/Libraries/Utilities/HMRLoadingView.js b/Libraries/Utilities/HMRLoadingView.js deleted file mode 100644 index 0fe67ae435097b..00000000000000 --- a/Libraries/Utilities/HMRLoadingView.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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. - * - * @format - * @flow strict-local - */ - -// TODO(macOS ISS#2323203) TODO(windows ISS): this file is HMRLoadingView.ios.js in facebook's repo. Renamed to HMRLoadingView.js since it is shared here between ios, macos, and windows. - -'use strict'; - -const processColor = require('../StyleSheet/processColor'); -const {DevLoadingView} = require('../BatchedBridge/NativeModules'); - -class HMRLoadingView { - static showMessage(message: string) { - DevLoadingView.showMessage( - message, - processColor('#000000'), - processColor('#aaaaaa'), - ); - } - - static hide() { - DevLoadingView.hide(); - } -} - -module.exports = HMRLoadingView; diff --git a/Libraries/Utilities/JSDevSupportModule.js b/Libraries/Utilities/JSDevSupportModule.js index c609faf91a766f..9e6d60dce01fa9 100644 --- a/Libraries/Utilities/JSDevSupportModule.js +++ b/Libraries/Utilities/JSDevSupportModule.js @@ -10,26 +10,29 @@ 'use strict'; -const JSDevSupport = require('../BatchedBridge/NativeModules').JSDevSupport; +import NativeJSDevSupport from './NativeJSDevSupport'; const ReactNative = require('../Renderer/shims/ReactNative'); const JSDevSupportModule = { getJSHierarchy: function(tag: number) { - try { - const { - computeComponentStackForErrorReporting, - } = ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - const componentStack = computeComponentStackForErrorReporting(tag); - if (!componentStack) { - JSDevSupport.onFailure( - JSDevSupport.ERROR_CODE_VIEW_NOT_FOUND, - "Component stack doesn't exist for tag " + tag, - ); - } else { - JSDevSupport.onSuccess(componentStack); + if (NativeJSDevSupport) { + const constants = NativeJSDevSupport.getConstants(); + try { + const { + computeComponentStackForErrorReporting, + } = ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + const componentStack = computeComponentStackForErrorReporting(tag); + if (!componentStack) { + NativeJSDevSupport.onFailure( + constants.ERROR_CODE_VIEW_NOT_FOUND, + "Component stack doesn't exist for tag " + tag, + ); + } else { + NativeJSDevSupport.onSuccess(componentStack); + } + } catch (e) { + NativeJSDevSupport.onFailure(constants.ERROR_CODE_EXCEPTION, e.message); } - } catch (e) { - JSDevSupport.onFailure(JSDevSupport.ERROR_CODE_EXCEPTION, e.message); } }, }; diff --git a/Libraries/Utilities/LoadingView.android.js b/Libraries/Utilities/LoadingView.android.js new file mode 100644 index 00000000000000..3b9511f52a4a30 --- /dev/null +++ b/Libraries/Utilities/LoadingView.android.js @@ -0,0 +1,29 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; + +import ToastAndroid from '../Components/ToastAndroid/ToastAndroid'; + +const TOAST_SHORT_DELAY = 2000; +let isVisible = false; + +module.exports = { + showMessage(message: string, type: 'load' | 'refresh') { + if (!isVisible) { + ToastAndroid.show(message, ToastAndroid.SHORT); + isVisible = true; + setTimeout(() => { + isVisible = false; + }, TOAST_SHORT_DELAY); + } + }, + hide() {}, +}; diff --git a/Libraries/Utilities/LoadingView.ios.js b/Libraries/Utilities/LoadingView.ios.js new file mode 100644 index 00000000000000..782bedfbbb69c0 --- /dev/null +++ b/Libraries/Utilities/LoadingView.ios.js @@ -0,0 +1,32 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +import processColor from '../StyleSheet/processColor'; +import NativeDevLoadingView from './NativeDevLoadingView'; + +module.exports = { + showMessage(message: string, type: 'load' | 'refresh') { + if (NativeDevLoadingView) { + NativeDevLoadingView.showMessage( + message, + // Use same colors as iOS "Personal Hotspot" bar. + processColor('#ffffff'), + type && type === 'load' + ? processColor('#275714') + : processColor('#2584e8'), + ); + } + }, + hide() { + NativeDevLoadingView && NativeDevLoadingView.hide(); + }, +}; diff --git a/RNTester/js/ToolbarAndroidExample.ios.js b/Libraries/Utilities/LoadingView.js similarity index 71% rename from RNTester/js/ToolbarAndroidExample.ios.js rename to Libraries/Utilities/LoadingView.js index 6d1eff69dc8b28..2a02730fc55d27 100644 --- a/RNTester/js/ToolbarAndroidExample.ios.js +++ b/Libraries/Utilities/LoadingView.js @@ -10,7 +10,7 @@ 'use strict'; -const {View} = require('react-native'); - -// Not applicable to iOS. -module.exports = View; +module.exports = { + showMessage(message: string, type: 'load' | 'refresh') {}, + hide() {}, +}; diff --git a/Libraries/Utilities/LoadingView.macos.js b/Libraries/Utilities/LoadingView.macos.js new file mode 100644 index 00000000000000..782bedfbbb69c0 --- /dev/null +++ b/Libraries/Utilities/LoadingView.macos.js @@ -0,0 +1,32 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +import processColor from '../StyleSheet/processColor'; +import NativeDevLoadingView from './NativeDevLoadingView'; + +module.exports = { + showMessage(message: string, type: 'load' | 'refresh') { + if (NativeDevLoadingView) { + NativeDevLoadingView.showMessage( + message, + // Use same colors as iOS "Personal Hotspot" bar. + processColor('#ffffff'), + type && type === 'load' + ? processColor('#275714') + : processColor('#2584e8'), + ); + } + }, + hide() { + NativeDevLoadingView && NativeDevLoadingView.hide(); + }, +}; diff --git a/Libraries/Utilities/NativeDevLoadingView.js b/Libraries/Utilities/NativeDevLoadingView.js new file mode 100644 index 00000000000000..e672771778b8a1 --- /dev/null +++ b/Libraries/Utilities/NativeDevLoadingView.js @@ -0,0 +1,25 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +showMessage: ( + message: string, + color: Object, + backgroundColor: Object, + ) => void; + +hide: () => void; +} + +export default (TurboModuleRegistry.get('DevLoadingView'): ?Spec); diff --git a/Libraries/Utilities/NativeDeviceInfo.js b/Libraries/Utilities/NativeDeviceInfo.js new file mode 100644 index 00000000000000..0e42dd6f25d1e5 --- /dev/null +++ b/Libraries/Utilities/NativeDeviceInfo.js @@ -0,0 +1,49 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +type DisplayMetricsAndroid = $ReadOnly<{| + width: number, + height: number, + scale: number, + fontScale: number, + densityDpi: number, +|}>; + +export type DisplayMetrics = $ReadOnly<{| + width: number, + height: number, + scale: number, + fontScale: number, +|}>; + +export type DimensionsPayload = $ReadOnly<{| + window?: DisplayMetrics, + screen?: DisplayMetrics, + windowPhysicalPixels?: DisplayMetricsAndroid, + screenPhysicalPixels?: DisplayMetricsAndroid, +|}>; + +export interface Spec extends TurboModule { + +getConstants: () => {| + +Dimensions: DimensionsPayload, + +isIPhoneX_deprecated?: boolean, + |}; +} + +const NativeModule: Spec = TurboModuleRegistry.getEnforcing('DeviceInfo'); + +const NativeDeviceInfo = NativeModule; + +export default NativeDeviceInfo; diff --git a/Libraries/Utilities/NativeJSDevSupport.js b/Libraries/Utilities/NativeJSDevSupport.js new file mode 100644 index 00000000000000..3128d3d83bd214 --- /dev/null +++ b/Libraries/Utilities/NativeJSDevSupport.js @@ -0,0 +1,25 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + ERROR_CODE_EXCEPTION: number, + ERROR_CODE_VIEW_NOT_FOUND: number, + |}; + +onSuccess: (data: Object) => void; + +onFailure: (errorCode: number, error: string) => void; +} + +export default (TurboModuleRegistry.get('JSDevSupport'): ?Spec); diff --git a/Libraries/Utilities/NativePlatformConstantsAndroid.js b/Libraries/Utilities/NativePlatformConstantsAndroid.js new file mode 100644 index 00000000000000..dcf276ae2ac3f4 --- /dev/null +++ b/Libraries/Utilities/NativePlatformConstantsAndroid.js @@ -0,0 +1,38 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + isTesting: boolean, + reactNativeVersion: {| + major: number, + minor: number, + patch: number, + prerelease: ?number, + |}, + Version: number, + Release: string, + Serial: string, + Fingerprint: string, + Model: string, + ServerHost: string, + uiMode: string, + |}; + +getAndroidID: () => string; +} + +export default (TurboModuleRegistry.getEnforcing( + 'PlatformConstants', +): Spec); diff --git a/Libraries/Utilities/NativePlatformConstantsIOS.js b/Libraries/Utilities/NativePlatformConstantsIOS.js new file mode 100644 index 00000000000000..fd73bcffadb93b --- /dev/null +++ b/Libraries/Utilities/NativePlatformConstantsIOS.js @@ -0,0 +1,34 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + isTesting: boolean, + reactNativeVersion: {| + major: number, + minor: number, + patch: number, + prerelease: ?number, + |}, + forceTouchAvailable: boolean, + osVersion: string, + systemName: string, + interfaceIdiom: string, + |}; +} + +export default (TurboModuleRegistry.getEnforcing( + 'PlatformConstants', +): Spec); diff --git a/Libraries/Utilities/NativePlatformConstantsMacOS.js b/Libraries/Utilities/NativePlatformConstantsMacOS.js new file mode 100644 index 00000000000000..bea9264b17dcba --- /dev/null +++ b/Libraries/Utilities/NativePlatformConstantsMacOS.js @@ -0,0 +1,32 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {| + isTesting: boolean, + reactNativeVersion: {| + major: number, + minor: number, + patch: number, + prerelease: ?number, + |}, + osVersion: string, + systemName: string, + |}; +} + +export default (TurboModuleRegistry.getEnforcing( + 'PlatformConstants', +): Spec); diff --git a/Libraries/Utilities/Platform.android.js b/Libraries/Utilities/Platform.android.js index 40b7a83034efbc..e228adc98d2744 100644 --- a/Libraries/Utilities/Platform.android.js +++ b/Libraries/Utilities/Platform.android.js @@ -10,7 +10,7 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativePlatformConstantsAndroid from './NativePlatformConstantsAndroid'; export type PlatformSelectSpec = { android?: A, @@ -18,21 +18,25 @@ export type PlatformSelectSpec = { }; const Platform = { + __constants: null, OS: 'android', get Version() { - const constants = NativeModules.PlatformConstants; - return constants && constants.Version; + return this.constants.Version; + }, + get constants() { + if (this.__constants == null) { + this.__constants = NativePlatformConstantsAndroid.getConstants(); + } + return this.__constants; }, get isTesting(): boolean { if (__DEV__) { - const constants = NativeModules.PlatformConstants; - return constants && constants.isTesting; + return this.constants.isTesting; } return false; }, get isTV(): boolean { - const constants = NativeModules.PlatformConstants; - return constants && constants.uiMode === 'tv'; + return this.constants.uiMode === 'tv'; }, select: (spec: PlatformSelectSpec): A | D => 'android' in spec ? spec.android : spec.default, diff --git a/Libraries/Utilities/Platform.ios.js b/Libraries/Utilities/Platform.ios.js index 2ac52e3005a061..17e1caf389f5a4 100644 --- a/Libraries/Utilities/Platform.ios.js +++ b/Libraries/Utilities/Platform.ios.js @@ -10,7 +10,7 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativePlatformConstantsIOS from './NativePlatformConstantsIOS'; export type PlatformSelectSpec = { default?: D, @@ -18,29 +18,44 @@ export type PlatformSelectSpec = { }; const Platform = { + __constants: null, OS: 'ios', - get Version() { - const constants = NativeModules.PlatformConstants; - return constants && constants.osVersion; + get Version(): $FlowFixMe { + return this.constants.osVersion; }, - get isPad() { - const constants = NativeModules.PlatformConstants; - return constants ? constants.interfaceIdiom === 'pad' : false; + get constants(): {| + forceTouchAvailable: boolean, + interfaceIdiom: string, + isTesting: boolean, + osVersion: string, + reactNativeVersion: {| + major: number, + minor: number, + patch: number, + prerelease: ?number, + |}, + systemName: string, + |} { + if (this.__constants == null) { + this.__constants = NativePlatformConstantsIOS.getConstants(); + } + return this.__constants; + }, + get isPad(): boolean { + return this.constants.interfaceIdiom === 'pad'; }, /** * Deprecated, use `isTV` instead. */ - get isTVOS() { + get isTVOS(): boolean { return Platform.isTV; }, - get isTV() { - const constants = NativeModules.PlatformConstants; - return constants ? constants.interfaceIdiom === 'tv' : false; + get isTV(): boolean { + return this.constants.interfaceIdiom === 'tv'; }, get isTesting(): boolean { if (__DEV__) { - const constants = NativeModules.PlatformConstants; - return constants && constants.isTesting; + return this.constants.isTesting; } return false; }, diff --git a/Libraries/Utilities/Platform.macos.js b/Libraries/Utilities/Platform.macos.js index 3b77a4c186ca3f..c2bb10a585bc8f 100644 --- a/Libraries/Utilities/Platform.macos.js +++ b/Libraries/Utilities/Platform.macos.js @@ -12,7 +12,7 @@ 'use strict'; -const NativeModules = require('../BatchedBridge/NativeModules'); +import NativePlatformConstantsMacOS from './NativePlatformConstantsMacOS'; export type PlatformSelectSpec = { default?: D, @@ -20,19 +20,34 @@ export type PlatformSelectSpec = { }; const Platform = { + __constants: null, OS: 'macos', - get Version() { - const constants = NativeModules.PlatformConstants; - return constants && constants.osVersion; + get Version(): $FlowFixMe { + return this.constants.osVersion; }, - get isTesting(): boolean { - if (__DEV__) { - const constants = NativeModules.PlatformConstants; - return constants && constants.isTesting; + get constants(): {| + isTesting: boolean, + osVersion: string, + reactNativeVersion: {| + major: number, + minor: number, + patch: number, + prerelease: ?number, + |}, + systemName: string, + |} { + if (this.__constants == null) { + this.__constants = NativePlatformConstantsMacOS.getConstants(); } + return this.__constants; + }, + get isTV(): boolean { return false; }, - get isTV() { + get isTesting(): boolean { + if (__DEV__) { + return this.constants.isTesting; + } return false; }, select: (spec: PlatformSelectSpec): D | I => diff --git a/Libraries/Utilities/ReactNativeTestTools.js b/Libraries/Utilities/ReactNativeTestTools.js index 6028bd94ba5026..a245134b674c95 100644 --- a/Libraries/Utilities/ReactNativeTestTools.js +++ b/Libraries/Utilities/ReactNativeTestTools.js @@ -108,12 +108,12 @@ function maximumDepthOfJSON(node: ReactTestRendererNode): number { } } -function renderAndEnforceStrictMode(element: React.Node) { +function renderAndEnforceStrictMode(element: React.Node): any { expectNoConsoleError(); return renderWithStrictMode(element); } -function renderWithStrictMode(element: React.Node) { +function renderWithStrictMode(element: React.Node): any { const WorkAroundBugWithStrictModeInTestRenderer = prps => prps.children; const StrictMode = (React: $FlowFixMe).StrictMode; return ReactTestRenderer.create( diff --git a/Libraries/Utilities/__tests__/DeviceInfo-test.js b/Libraries/Utilities/__tests__/DeviceInfo-test.js index 049feb571d7549..8cc9c224461aeb 100644 --- a/Libraries/Utilities/__tests__/DeviceInfo-test.js +++ b/Libraries/Utilities/__tests__/DeviceInfo-test.js @@ -14,6 +14,6 @@ describe('DeviceInfo', () => { const DeviceInfo = require('../DeviceInfo'); it('should give device info', () => { - expect(DeviceInfo).toHaveProperty('Dimensions'); + expect(DeviceInfo.getConstants()).toHaveProperty('Dimensions'); }); }); diff --git a/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js b/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js index 2895c46ef344ab..ef5cc10d42d352 100644 --- a/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js +++ b/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js @@ -187,7 +187,7 @@ describe('buildStyleInterpolator', function() { }); }); }); - it('should detect chnages correctly', function() { + it('should detect changes correctly', function() { const testAnim = { opacity: { from: 0, diff --git a/Libraries/Utilities/__tests__/codegenNativeComponent-test.js b/Libraries/Utilities/__tests__/codegenNativeComponent-test.js new file mode 100644 index 00000000000000..f9acf7fe816ea2 --- /dev/null +++ b/Libraries/Utilities/__tests__/codegenNativeComponent-test.js @@ -0,0 +1,67 @@ +/** + * 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. + * + * @format + * @emails oncall+react_native + */ + +'use strict'; + +const codegenNativeComponent = require('../codegenNativeComponent').default; +const {UIManager} = require('react-native'); + +// We need to unmock requireNativeComponent since it's under test. +// Instead, we mock the function it calls, createReactNativeComponentClass, +// so that we don't run into issues populating the registry with the same +// component names. +jest.unmock('../../ReactNative/requireNativeComponent'); +jest.mock( + '../../Renderer/shims/createReactNativeComponentClass', + () => componentName => componentName, +); +jest + .spyOn(UIManager, 'getViewManagerConfig') + .mockImplementation(componentName => + componentName.includes('ComponentNameDoesNotExist') ? false : true, + ); + +describe('codegenNativeComponent', () => { + it('should require component as is ', () => { + const component = codegenNativeComponent('ComponentName'); + expect(component).toBe('ComponentName'); + }); + + it('should require paperComponentName', () => { + const component = codegenNativeComponent('ComponentName', { + paperComponentName: 'PaperComponentName', + }); + expect(component).toBe('PaperComponentName'); + }); + + it('should fall back to requiring the deprecated paper component name', () => { + const component = codegenNativeComponent('ComponentNameDoesNotExist', { + paperComponentNameDeprecated: 'ComponentName', + }); + expect(component).toBe('ComponentName'); + }); + + it('should require the new component name', () => { + const component = codegenNativeComponent('ComponentName', { + paperComponentNameDeprecated: 'ComponentNameDoesNotExist', + }); + expect(component).toBe('ComponentName'); + }); + + it('should throw if neither component names exist', () => { + expect(() => + codegenNativeComponent('ComponentNameDoesNotExistOne', { + paperComponentNameDeprecated: 'ComponentNameDoesNotExistTwo', + }), + ).toThrow( + 'Failed to find native component for either ComponentNameDoesNotExistOne or ComponentNameDoesNotExistTwo', + ); + }); +}); diff --git a/Libraries/Utilities/__tests__/stringifySafe-test.js b/Libraries/Utilities/__tests__/stringifySafe-test.js index b7eb1f21192fee..c259caf20a7fd6 100644 --- a/Libraries/Utilities/__tests__/stringifySafe-test.js +++ b/Libraries/Utilities/__tests__/stringifySafe-test.js @@ -47,4 +47,10 @@ describe('stringifySafe', () => { const result = stringifySafe(arg); expect(result).toEqual('["object" failed to stringify]'); }); + + it('stringifySafe stringifies error messages', () => { + const error = new Error('error'); + const result = stringifySafe(error); + expect(result).toEqual('Error: error'); + }); }); diff --git a/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js b/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js index fade9976f66095..58acd17758cab8 100644 --- a/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js +++ b/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js @@ -10,10 +10,12 @@ 'use strict'; -const getNativeComponentAttributes = require('getNativeComponentAttributes'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const getNativeComponentAttributes = require('../../ReactNative/getNativeComponentAttributes'); +const verifyComponentAttributeEquivalence = require('../verifyComponentAttributeEquivalence') + .default; -jest.mock('getNativeComponentAttributes', () => () => ({ +jest.dontMock('../verifyComponentAttributeEquivalence'); +jest.mock('../../ReactNative/getNativeComponentAttributes', () => () => ({ NativeProps: { value: 'BOOL', }, diff --git a/Libraries/Utilities/binaryToBase64.js b/Libraries/Utilities/binaryToBase64.js index 430fd46be68447..19d23d125d2249 100644 --- a/Libraries/Utilities/binaryToBase64.js +++ b/Libraries/Utilities/binaryToBase64.js @@ -12,7 +12,7 @@ const base64 = require('base64-js'); -function binaryToBase64(data: ArrayBuffer | $ArrayBufferView) { +function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): any { if (data instanceof ArrayBuffer) { data = new Uint8Array(data); } diff --git a/Libraries/Utilities/codegenNativeCommands.js b/Libraries/Utilities/codegenNativeCommands.js new file mode 100644 index 00000000000000..1cee4d918af9e5 --- /dev/null +++ b/Libraries/Utilities/codegenNativeCommands.js @@ -0,0 +1,31 @@ +/** + * 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. + * + * @format + * @flow + */ + +'use strict'; + +import {dispatchCommand} from '../../Libraries/Renderer/shims/ReactNative'; + +type Options = $ReadOnly<{| + supportedCommands: $ReadOnlyArray, +|}>; + +function codegenNativeCommands(options: Options<$Keys>): T { + const commandObj = {}; + + options.supportedCommands.forEach(command => { + commandObj[command] = (ref, ...args) => { + dispatchCommand(ref, command, args); + }; + }); + + return ((commandObj: any): T); +} + +export default codegenNativeCommands; diff --git a/Libraries/Utilities/codegenNativeComponent.js b/Libraries/Utilities/codegenNativeComponent.js new file mode 100644 index 00000000000000..7a39d7a65d40fe --- /dev/null +++ b/Libraries/Utilities/codegenNativeComponent.js @@ -0,0 +1,61 @@ +/** + * 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. + * + * @format + * @flow + */ +// TODO: move this file to shims/ReactNative (requires React update and sync) + +'use strict'; + +import type {NativeComponent} from '../../Libraries/Renderer/shims/ReactNative'; +import requireNativeComponent from '../../Libraries/ReactNative/requireNativeComponent'; +import {UIManager} from 'react-native'; + +// TODO: import from CodegenSchema once workspaces are enabled +type Options = $ReadOnly<{| + interfaceOnly?: boolean, + paperComponentName?: string, + paperComponentNameDeprecated?: string, +|}>; + +export type NativeComponentType = Class>; + +function codegenNativeComponent( + componentName: string, + options?: Options, +): NativeComponentType { + let componentNameInUse = + options && options.paperComponentName + ? options.paperComponentName + : componentName; + + if (options != null && options.paperComponentNameDeprecated != null) { + if (UIManager.getViewManagerConfig(componentName)) { + componentNameInUse = componentName; + } else if ( + options.paperComponentNameDeprecated != null && + UIManager.getViewManagerConfig(options.paperComponentNameDeprecated) + ) { + componentNameInUse = options.paperComponentNameDeprecated; + } else { + throw new Error( + `Failed to find native component for either ${componentName} or ${options.paperComponentNameDeprecated || + '(unknown)'}`, + ); + } + } + + // If this function is run at runtime then that means the view configs were not + // generated with the view config babel plugin, so we need to require the native component. + // + // This will be useful during migration, but eventually this will error. + return ((requireNativeComponent(componentNameInUse): any): Class< + NativeComponent, + >); +} + +export default codegenNativeComponent; diff --git a/Libraries/Utilities/createPerformanceLogger.js b/Libraries/Utilities/createPerformanceLogger.js index 2f49f988c15ce9..0e27a9c0e73c53 100644 --- a/Libraries/Utilities/createPerformanceLogger.js +++ b/Libraries/Utilities/createPerformanceLogger.js @@ -51,7 +51,7 @@ const _cookies: {[key: string]: number} = {}; const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`; /** - * This function creates peformance loggers that can be used to collect and log + * This function creates performance loggers that can be used to collect and log * various performance data such as timespans, points and extras. * The loggers need to have minimal overhead since they're used in production. */ @@ -67,7 +67,7 @@ function createPerformanceLogger(): IPerformanceLogger { addTimespan(key: string, lengthInMs: number, description?: string) { if (this._timespans[key]) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to add a timespan that already exists ', key, @@ -84,7 +84,7 @@ function createPerformanceLogger(): IPerformanceLogger { startTimespan(key: string, description?: string) { if (this._timespans[key]) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to start a timespan that already exists ', key, @@ -106,7 +106,7 @@ function createPerformanceLogger(): IPerformanceLogger { stopTimespan(key: string) { const timespan = this._timespans[key]; if (!timespan || !timespan.startTime) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to end a timespan that has not started ', key, @@ -115,7 +115,7 @@ function createPerformanceLogger(): IPerformanceLogger { return; } if (timespan.endTime) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to end a timespan that has already ended ', key, @@ -187,9 +187,11 @@ function createPerformanceLogger(): IPerformanceLogger { }, logTimespans() { - for (const key in this._timespans) { - if (this._timespans[key].totalTime) { - infoLog(key + ': ' + this._timespans[key].totalTime + 'ms'); + if (PRINT_TO_CONSOLE) { + for (const key in this._timespans) { + if (this._timespans[key].totalTime) { + infoLog(key + ': ' + this._timespans[key].totalTime + 'ms'); + } } } }, @@ -203,7 +205,7 @@ function createPerformanceLogger(): IPerformanceLogger { setExtra(key: string, value: any) { if (this._extras[key]) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to set an extra that already exists ', {key, currentValue: this._extras[key], attemptedValue: value}, @@ -225,12 +227,14 @@ function createPerformanceLogger(): IPerformanceLogger { }, logExtras() { - infoLog(this._extras); + if (PRINT_TO_CONSOLE) { + infoLog(this._extras); + } }, markPoint(key: string, timestamp?: number) { if (this._points[key]) { - if (__DEV__) { + if (PRINT_TO_CONSOLE && __DEV__) { infoLog( 'PerformanceLogger: Attempting to mark a point that has been already logged ', key, @@ -246,8 +250,10 @@ function createPerformanceLogger(): IPerformanceLogger { }, logPoints() { - for (const key in this._points) { - infoLog(key + ': ' + this._points[key] + 'ms'); + if (PRINT_TO_CONSOLE) { + for (const key in this._points) { + infoLog(key + ': ' + this._points[key] + 'ms'); + } } }, diff --git a/Libraries/Utilities/differ/insetsDiffer.js b/Libraries/Utilities/differ/insetsDiffer.js index 4ebf9746260ff8..53c9d9605c4a02 100644 --- a/Libraries/Utilities/differ/insetsDiffer.js +++ b/Libraries/Utilities/differ/insetsDiffer.js @@ -24,7 +24,7 @@ const dummyInsets = { bottom: undefined, }; -const insetsDiffer = function(one: Inset, two: Inset) { +const insetsDiffer = function(one: Inset, two: Inset): boolean { one = one || dummyInsets; two = two || dummyInsets; return ( diff --git a/Libraries/Utilities/registerGeneratedViewConfig.js b/Libraries/Utilities/registerGeneratedViewConfig.js new file mode 100644 index 00000000000000..45f92adb3ce860 --- /dev/null +++ b/Libraries/Utilities/registerGeneratedViewConfig.js @@ -0,0 +1,70 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +const ReactNativeViewConfigRegistry = require('../Renderer/shims/ReactNativeViewConfigRegistry'); +const ReactNativeViewViewConfig = require('../Components/View/ReactNativeViewViewConfig'); +import verifyComponentAttributeEquivalence from './verifyComponentAttributeEquivalence'; + +type GeneratedViewConfig = { + uiViewClassName: string, + bubblingEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{| + phasedRegistrationNames: $ReadOnly<{| + captured: string, + bubbled: string, + |}>, + |}>, + }>, + directEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{| + registrationName: string, + |}>, + }>, + validAttributes?: { + [propName: string]: + | true + | $ReadOnly<{| + diff?: (arg1: any, arg2: any) => boolean, + process?: (arg1: any) => any, + |}>, + }, +}; + +function registerGeneratedViewConfig( + componentName: string, + viewConfig: GeneratedViewConfig, +) { + const mergedViewConfig = { + uiViewClassName: componentName, + Commands: {}, + bubblingEventTypes: { + ...ReactNativeViewViewConfig.bubblingEventTypes, + ...(viewConfig.bubblingEventTypes || {}), + }, + directEventTypes: { + ...ReactNativeViewViewConfig.directEventTypes, + ...(viewConfig.directEventTypes || {}), + }, + validAttributes: { + ...ReactNativeViewViewConfig.validAttributes, + ...(viewConfig.validAttributes || {}), + }, + }; + + ReactNativeViewConfigRegistry.register(componentName, () => { + verifyComponentAttributeEquivalence(componentName, mergedViewConfig); + + return mergedViewConfig; + }); +} + +module.exports = registerGeneratedViewConfig; diff --git a/Libraries/Utilities/setAndForwardRef.js b/Libraries/Utilities/setAndForwardRef.js index cf32c492005107..ba1a18b41d03b5 100644 --- a/Libraries/Utilities/setAndForwardRef.js +++ b/Libraries/Utilities/setAndForwardRef.js @@ -48,7 +48,10 @@ type Args = $ReadOnly<{| * module.exports = MyViewWithRef; */ -function setAndForwardRef({getForwardedRef, setLocalRef}: Args) { +function setAndForwardRef({ + getForwardedRef, + setLocalRef, +}: Args): (ref: ElementRef) => void { return function forwardRef(ref: ElementRef) { const forwardedRef = getForwardedRef(); diff --git a/Libraries/Utilities/stringifySafe.js b/Libraries/Utilities/stringifySafe.js index 73e81a345dbf17..d562a911e976ca 100644 --- a/Libraries/Utilities/stringifySafe.js +++ b/Libraries/Utilities/stringifySafe.js @@ -29,6 +29,8 @@ function stringifySafe(arg: any): string { } catch (e) { ret = '[function unknown]'; } + } else if (arg instanceof Error) { + ret = arg.name + ': ' + arg.message; } else { // Perform a try catch, just in case the object has a circular // reference or stringify throws for some other reason. diff --git a/Libraries/Utilities/useWindowDimensions.js b/Libraries/Utilities/useWindowDimensions.js new file mode 100644 index 00000000000000..f719ea56b82717 --- /dev/null +++ b/Libraries/Utilities/useWindowDimensions.js @@ -0,0 +1,35 @@ +/** + * 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. + * + * @format + * @flow strict-local + */ + +'use strict'; + +import Dimensions from './Dimensions'; +import {type DisplayMetrics} from './NativeDeviceInfo'; +import * as React from 'react'; + +export default function useWindowDimensions(): DisplayMetrics { + const dims = Dimensions.get('window'); // always read the latest value + const forceUpdate = React.useState(false)[1].bind(null, v => !v); + const initialDims = React.useState(dims)[0]; + React.useEffect(() => { + Dimensions.addEventListener('change', forceUpdate); + + const latestDims = Dimensions.get('window'); + if (latestDims !== initialDims) { + // We missed an update between calling `get` in render and + // `addEventListener` in this handler... + forceUpdate(); + } + return () => { + Dimensions.removeEventListener('change', forceUpdate); + }; + }, [forceUpdate, initialDims]); + return dims; +} diff --git a/Libraries/Utilities/verifyComponentAttributeEquivalence.js b/Libraries/Utilities/verifyComponentAttributeEquivalence.js index f950b6cf13ee15..98a725ab02e319 100644 --- a/Libraries/Utilities/verifyComponentAttributeEquivalence.js +++ b/Libraries/Utilities/verifyComponentAttributeEquivalence.js @@ -10,11 +10,12 @@ 'use strict'; -const getNativeComponentAttributes = require('getNativeComponentAttributes'); +const getNativeComponentAttributes = require('../ReactNative/getNativeComponentAttributes'); -import type {ReactNativeBaseComponentViewConfig} from 'ReactNativeTypes'; +import ReactNativeViewViewConfig from '../Components/View/ReactNativeViewViewConfig'; +import type {ReactNativeBaseComponentViewConfig} from '../Renderer/shims/ReactNativeTypes'; -const IGNORED_KEYS = ['transform']; +const IGNORED_KEYS = ['transform', 'hitSlop']; /** * The purpose of this function is to validate that the view config that * native exposes for a given view manager is the same as the view config @@ -42,7 +43,7 @@ function verifyComponentAttributeEquivalence( componentName: string, config: ReactNativeBaseComponentViewConfig<>, ) { - if (__DEV__) { + if (__DEV__ && !global.RN$Bridgeless) { const nativeAttributes = getNativeComponentAttributes(componentName); ['validAttributes', 'bubblingEventTypes', 'directEventTypes'].forEach( @@ -63,7 +64,7 @@ function verifyComponentAttributeEquivalence( } } -function lefthandObjectDiff(leftObj: Object, rightObj: Object) { +export function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object { const differentKeys = {}; function compare(leftItem, rightItem, key) { @@ -101,4 +102,33 @@ function lefthandObjectDiff(leftObj: Object, rightObj: Object) { return differentKeys; } -module.exports = verifyComponentAttributeEquivalence; +export function getConfigWithoutViewProps( + viewConfig: ReactNativeBaseComponentViewConfig<>, + propName: string, +): $TEMPORARY$object<{||}> { + if (!viewConfig[propName]) { + return {}; + } + + return Object.keys(viewConfig[propName]) + .filter(prop => !ReactNativeViewViewConfig[propName][prop]) + .reduce((obj, prop) => { + obj[prop] = viewConfig[propName][prop]; + return obj; + }, {}); +} + +export function stringifyViewConfig(viewConfig: any): string { + return JSON.stringify( + viewConfig, + (key, val) => { + if (typeof val === 'function') { + return `ƒ ${val.name}`; + } + return val; + }, + 2, + ); +} + +export default verifyComponentAttributeEquivalence; diff --git a/Libraries/Vibration/NativeVibration.js b/Libraries/Vibration/NativeVibration.js new file mode 100644 index 00000000000000..1416925da5447e --- /dev/null +++ b/Libraries/Vibration/NativeVibration.js @@ -0,0 +1,25 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +getConstants: () => {||}; + +vibrate: (pattern?: number) => void; + + // Android only + +vibrateByPattern: (pattern: Array, repeat: number) => void; + +cancel: () => void; +} + +export default (TurboModuleRegistry.getEnforcing('Vibration'): Spec); diff --git a/Libraries/Vibration/RCTVibration.m b/Libraries/Vibration/RCTVibration.m index 0c960cd449ce1a..db991b0775cc1b 100644 --- a/Libraries/Vibration/RCTVibration.m +++ b/Libraries/Vibration/RCTVibration.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTVibration.h" +#import #import diff --git a/Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj b/Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj deleted file mode 100644 index 7a40cee85e0452..00000000000000 --- a/Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj +++ /dev/null @@ -1,261 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */ = {isa = PBXBuildFile; fileRef = 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTVibration.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVibration.h; sourceTree = ""; }; - 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVibration.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 832C81771AAF6DEF007FA2F7 = { - isa = PBXGroup; - children = ( - 832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */, - 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */, - 832C81811AAF6DEF007FA2F7 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 832C81811AAF6DEF007FA2F7 /* Products */ = { - isa = PBXGroup; - children = ( - 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 832C817F1AAF6DEF007FA2F7 /* RCTVibration */ = { - isa = PBXNativeTarget; - buildConfigurationList = 832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */; - buildPhases = ( - 832C817C1AAF6DEF007FA2F7 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTVibration; - productName = RCTVibration; - productReference = 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 832C81781AAF6DEF007FA2F7 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 832C817F1AAF6DEF007FA2F7 = { - CreatedOnToolsVersion = 6.2; - }; - }; - }; - buildConfigurationList = 832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 832C81771AAF6DEF007FA2F7; - productRefGroup = 832C81811AAF6DEF007FA2F7 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 832C817F1AAF6DEF007FA2F7 /* RCTVibration */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 832C817C1AAF6DEF007FA2F7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 832C81921AAF6DF0007FA2F7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 832C81931AAF6DF0007FA2F7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 832C81951AAF6DF0007FA2F7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 832C81961AAF6DF0007FA2F7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832C81921AAF6DF0007FA2F7 /* Debug */, - 832C81931AAF6DF0007FA2F7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832C81951AAF6DF0007FA2F7 /* Debug */, - 832C81961AAF6DF0007FA2F7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 832C81781AAF6DEF007FA2F7 /* Project object */; -} diff --git a/Libraries/Vibration/React-RCTVibration.podspec b/Libraries/Vibration/React-RCTVibration.podspec index cc5e2f4a0993d3..079622762fe4d9 100644 --- a/Libraries/Vibration/React-RCTVibration.podspec +++ b/Libraries/Vibration/React-RCTVibration.podspec @@ -27,9 +27,9 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source - s.source_files = "*.{h,m}" + s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" + s.header_dir = "RCTVibration" - s.dependency "React-Core", version + s.dependency "React-Core/RCTVibrationHeaders", version end diff --git a/Libraries/Vibration/Vibration.js b/Libraries/Vibration/Vibration.js index 892aeacfc7cb51..2f20cd7ae6061e 100644 --- a/Libraries/Vibration/Vibration.js +++ b/Libraries/Vibration/Vibration.js @@ -11,7 +11,7 @@ 'use strict'; -const RCTVibration = require('../BatchedBridge/NativeModules').Vibration; +import NativeVibration from './NativeVibration'; const Platform = require('../Utilities/Platform'); /** @@ -29,7 +29,7 @@ function vibrateByPattern(pattern: Array, repeat: boolean = false) { } _vibrating = true; if (pattern[0] === 0) { - RCTVibration.vibrate(); + NativeVibration.vibrate(); pattern = pattern.slice(1); } if (pattern.length === 0) { @@ -48,7 +48,7 @@ function vibrateScheduler( if (!_vibrating || id !== _id) { return; } - RCTVibration.vibrate(); + NativeVibration.vibrate(); if (nextIndex >= pattern.length) { if (repeat) { nextIndex = 0; @@ -75,9 +75,9 @@ const Vibration = { ) { if (Platform.OS === 'android') { if (typeof pattern === 'number') { - RCTVibration.vibrate(pattern); + NativeVibration.vibrate(pattern); } else if (Array.isArray(pattern)) { - RCTVibration.vibrateByPattern(pattern, repeat ? 0 : -1); + NativeVibration.vibrateByPattern(pattern, repeat ? 0 : -1); } else { throw new Error('Vibration pattern should be a number or array'); } @@ -86,7 +86,7 @@ const Vibration = { return; } if (typeof pattern === 'number') { - RCTVibration.vibrate(); + NativeVibration.vibrate(); } else if (Array.isArray(pattern)) { vibrateByPattern(pattern, repeat); } else { @@ -103,7 +103,7 @@ const Vibration = { if (Platform.OS === 'ios') { _vibrating = false; } else { - RCTVibration.cancel(); + NativeVibration.cancel(); } }, }; diff --git a/Libraries/WebSocket/NativeWebSocketModule.js b/Libraries/WebSocket/NativeWebSocketModule.js new file mode 100644 index 00000000000000..da2c57fdabca6e --- /dev/null +++ b/Libraries/WebSocket/NativeWebSocketModule.js @@ -0,0 +1,35 @@ +/** + * 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. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +connect: ( + url: string, + protocols: ?Array, + options: ?{headers?: {origin?: string}}, + socketID: number, + ) => void; + +send: (message: string, socketID: number) => void; + +sendBinary: (base64String: string, socketID: number) => void; + +ping: (socketID: number) => void; + +close: (code: number, reason: string, socketID: number) => void; + + // RCTEventEmitter + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.getEnforcing( + 'WebSocketModule', +): Spec); diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.m b/Libraries/WebSocket/RCTReconnectingWebSocket.m index d6d2569f2fa6da..467da99e4c3e17 100644 --- a/Libraries/WebSocket/RCTReconnectingWebSocket.m +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.m @@ -5,81 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTReconnectingWebSocket.h" +#import #import #import -#if __has_include() -#import -#else -#import -#endif - -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ -#import -#endif /* __IPHONE_10_3 */ - -#import "RCTSRWebSocket.h" +#import #if RCT_DEV // Only supported in dev mode -#if DEBUG // TODO(OSS Candidate ISS#2710739) - -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ - -// From https://github.com/apple/swift/blob/ad40c770bfe372f879b530443a3d94761fe258a6/stdlib/public/SDK/os/os_log.m -typedef struct os_log_pack_s { - uint64_t olp_continuous_time; - struct timespec olp_wall_time; - const void *olp_mh; - const void *olp_pc; - const char *olp_format; - uint8_t olp_data[0]; -} os_log_pack_s, *os_log_pack_t; - -static void (*orig__nwlog_pack)(os_log_pack_t pack, os_log_type_t logType); - -static void my__nwlog_pack(os_log_pack_t pack, os_log_type_t logType) -{ - if (logType == OS_LOG_TYPE_ERROR && strstr(pack->olp_format, "Connection has no connected handler") == NULL) { - orig__nwlog_pack(pack, logType); - } -} - -#endif /* __IPHONE_10_3 */ - -static void (*orig_nwlog_legacy_v)(int, char*, va_list); - -static void my_nwlog_legacy_v(int level, char *format, va_list args) { - static const uint buffer_size = 256; - static char buffer[buffer_size]; - va_list copy; - va_copy(copy, args); - vsnprintf(buffer, buffer_size, format, copy); - va_end(copy); - - if (strstr(buffer, "nw_connection_get_connected_socket_block_invoke") == NULL && - strstr(buffer, "Connection has no connected handler") == NULL) { - orig_nwlog_legacy_v(level, format, args); - } -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - -static void (*orig_os_log_error_impl)(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); - -static void my_os_log_error_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size) -{ - if (strstr(format, "TCP Conn %p Failed : error %ld:%d") == NULL) { - orig_os_log_error_impl(dso, log, type, format, buf, size); - } -} - -#endif /* __IPHONE_11_0 */ - -#endif /* DEBUG */ // TODO(OSS Candidate ISS#2710739) - @interface RCTReconnectingWebSocket () @end @@ -88,28 +22,6 @@ @implementation RCTReconnectingWebSocket { RCTSRWebSocket *_socket; } -#if DEBUG // TODO(OSS Candidate ISS#2710739) -+ (void)load -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - rebind_symbols((struct rebinding[1]){ - {"nwlog_legacy_v", my_nwlog_legacy_v, (void *)&orig_nwlog_legacy_v} - }, 1); -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ - rebind_symbols((struct rebinding[1]){ - {"__nwlog_pack", my__nwlog_pack, (void *)&orig__nwlog_pack} - }, 1); -#endif /* __IPHONE_10_3 */ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - rebind_symbols((struct rebinding[1]){ - {"_os_log_error_impl", my_os_log_error_impl, (void *)&orig_os_log_error_impl} - }, 1); -#endif /* __IPHONE_11_0 */ - }); -} -#endif /* DEBUG */ // TODO(OSS Candidate ISS#2710739) - - (instancetype)initWithURL:(NSURL *)url queue:(dispatch_queue_t)queue { if (self = [super init]) { diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index cf38043dc8c5ca..937fe98ab8a1b9 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -14,7 +14,9 @@ // limitations under the License. // -#import "RCTSRWebSocket.h" +#if !TARGET_OS_UIKITFORMAC + +#import #import #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) @@ -1637,3 +1639,5 @@ - (NSRunLoop *)runLoop; } @end + +#endif diff --git a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj deleted file mode 100644 index 41b8cccfbb6916..00000000000000 --- a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj +++ /dev/null @@ -1,754 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; - 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; - 180B4A3E1FEC530900879A02 /* libfishhook-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18C3A9BF1FE1D41600DEC48A /* libfishhook-macOS.a */; }; - 181B13CA216528F100D3B7D2 /* libfishhook-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; }; - 181B13CC21652C3600D3B7D2 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; - 181B13CD21652C4000D3B7D2 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; - 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; }; - 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; - 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; - 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - 3DBE0D141F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; - 3DBE0D151F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; - 3DBE0D801F3B1AF00099AA32 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; - 3DBE0D821F3B1B0C0099AA32 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; - 64BF1F341EF8457600B83E07 /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; - 64BF1F351EF8457900B83E07 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; - 64BF1F361EF8457B00B83E07 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; - 64BF1F381EF8458500B83E07 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; - A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; - ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 18C3A9C01FE1D44F00DEC48A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3C86DF3E1ADF2C930047B81A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 18C3A9B71FE1D41600DEC48A; - remoteInfo = "fishhook-macOS"; - }; - 3DBE0D0E1F3B18490099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3C86DF3E1ADF2C930047B81A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3DBE0CF41F3B181A0099AA32; - remoteInfo = fishhook; - }; - 3DBE0D101F3B184D0099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3C86DF3E1ADF2C930047B81A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3DBE0D011F3B181C0099AA32; - remoteInfo = "fishhook-tvOS"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 18C3A9B81FE1D41600DEC48A /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/fishhook; - dstSubfolderSpec = 16; - files = ( - 181B13CC21652C3600D3B7D2 /* fishhook.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0D7F1F3B1AEC0099AA32 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/fishhook; - dstSubfolderSpec = 16; - files = ( - 3DBE0D801F3B1AF00099AA32 /* fishhook.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0D811F3B1B010099AA32 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/fishhook; - dstSubfolderSpec = 16; - files = ( - 3DBE0D821F3B1B0C0099AA32 /* fishhook.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSRWebSocket.h; sourceTree = ""; }; - 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSRWebSocket.m; sourceTree = ""; }; - 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketExecutor.h; sourceTree = ""; }; - 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketExecutor.m; sourceTree = ""; }; - 13526A511F362F7F0008EF00 /* libfishhook.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libfishhook.a; sourceTree = ""; }; - 18C3A9BF1FE1D41600DEC48A /* libfishhook-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libfishhook-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTWebSocket-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DC5E5271F3A6CFD000EE84B /* libfishhook-tvOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libfishhook-tvOS.a"; path = "../fishhook/build/Debug-appletvos/libfishhook-tvOS.a"; sourceTree = ""; }; - 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketModule.h; sourceTree = ""; }; - 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketModule.m; sourceTree = ""; }; - 3DBE0D001F3B181A0099AA32 /* libfishhook.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfishhook.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libfishhook-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 3DBE0D121F3B185A0099AA32 /* fishhook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fishhook.c; path = ../fishhook/fishhook.c; sourceTree = ""; }; - 3DBE0D131F3B185A0099AA32 /* fishhook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fishhook.h; path = ../fishhook/fishhook.h; sourceTree = ""; }; - 6BDE7A581ECB6B8200CC951F /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; }; - A12E9E2C1E5DEC4E0029001B /* RCTReconnectingWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReconnectingWebSocket.h; sourceTree = ""; }; - A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReconnectingWebSocket.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 13526A4F1F362F770008EF00 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 180B4A3D1FEC52FE00879A02 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 180B4A3E1FEC530900879A02 /* libfishhook-macOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DC5E5151F3A6C39000EE84B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 13526A501F362F7F0008EF00 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 2DC5E5271F3A6CFD000EE84B /* libfishhook-tvOS.a */, - 13526A511F362F7F0008EF00 /* libfishhook.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 3C86DF3D1ADF2C930047B81A = { - isa = PBXGroup; - children = ( - 3DBE0D121F3B185A0099AA32 /* fishhook.c */, - 3DBE0D131F3B185A0099AA32 /* fishhook.h */, - A12E9E2C1E5DEC4E0029001B /* RCTReconnectingWebSocket.h */, - A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */, - 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */, - 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */, - 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */, - 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */, - 3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */, - 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */, - 3C86DF471ADF2C930047B81A /* Products */, - 13526A501F362F7F0008EF00 /* Frameworks */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 3C86DF471ADF2C930047B81A /* Products */ = { - isa = PBXGroup; - children = ( - 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */, - 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */, - 6BDE7A581ECB6B8200CC951F /* libRCTWebSocket.a */, - 3DBE0D001F3B181A0099AA32 /* libfishhook.a */, - 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */, - 18C3A9BF1FE1D41600DEC48A /* libfishhook-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 18C3A9B71FE1D41600DEC48A /* fishhook-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18C3A9BC1FE1D41600DEC48A /* Build configuration list for PBXNativeTarget "fishhook-macOS" */; - buildPhases = ( - 18C3A9B81FE1D41600DEC48A /* CopyFiles */, - 18C3A9BA1FE1D41600DEC48A /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "fishhook-macOS"; - productName = WebSocket; - productReference = 18C3A9BF1FE1D41600DEC48A /* libfishhook-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 2D2A28871D9B049200D4039D /* RCTWebSocket-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28901D9B049200D4039D /* Build configuration list for PBXNativeTarget "RCTWebSocket-tvOS" */; - buildPhases = ( - 2D2A28841D9B049200D4039D /* Sources */, - 2DC5E5151F3A6C39000EE84B /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 3DBE0D111F3B184D0099AA32 /* PBXTargetDependency */, - ); - name = "RCTWebSocket-tvOS"; - productName = "RCTWebSocket-tvOS"; - productReference = 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 3C86DF451ADF2C930047B81A /* RCTWebSocket */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */; - buildPhases = ( - 3C86DF421ADF2C930047B81A /* Sources */, - 13526A4F1F362F770008EF00 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 3DBE0D0F1F3B18490099AA32 /* PBXTargetDependency */, - ); - name = RCTWebSocket; - productName = WebSocket; - productReference = 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */; - productType = "com.apple.product-type.library.static"; - }; - 3DBE0CF41F3B181A0099AA32 /* fishhook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3DBE0CFD1F3B181A0099AA32 /* Build configuration list for PBXNativeTarget "fishhook" */; - buildPhases = ( - 3DBE0D7F1F3B1AEC0099AA32 /* CopyFiles */, - 3DBE0CF51F3B181A0099AA32 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = fishhook; - productName = WebSocket; - productReference = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; - productType = "com.apple.product-type.library.static"; - }; - 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3DBE0D0A1F3B181C0099AA32 /* Build configuration list for PBXNativeTarget "fishhook-tvOS" */; - buildPhases = ( - 3DBE0D811F3B1B010099AA32 /* CopyFiles */, - 3DBE0D021F3B181C0099AA32 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "fishhook-tvOS"; - productName = "RCTWebSocket-tvOS"; - productReference = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 6BDE7A4F1ECB6B8200CC951F /* RCTWebSocket-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6BDE7A551ECB6B8200CC951F /* Build configuration list for PBXNativeTarget "RCTWebSocket-macOS" */; - buildPhases = ( - 64BF1F331EF8457300B83E07 /* Sources */, - 180B4A3D1FEC52FE00879A02 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 18C3A9C11FE1D44F00DEC48A /* PBXTargetDependency */, - ); - name = "RCTWebSocket-macOS"; - productName = WebSocket; - productReference = 6BDE7A581ECB6B8200CC951F /* libRCTWebSocket.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 3C86DF3E1ADF2C930047B81A /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28871D9B049200D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 3C86DF451ADF2C930047B81A = { - CreatedOnToolsVersion = 6.3; - }; - }; - }; - buildConfigurationList = 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 3C86DF3D1ADF2C930047B81A; - productRefGroup = 3C86DF471ADF2C930047B81A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 3C86DF451ADF2C930047B81A /* RCTWebSocket */, - 6BDE7A4F1ECB6B8200CC951F /* RCTWebSocket-macOS */, - 2D2A28871D9B049200D4039D /* RCTWebSocket-tvOS */, - 3DBE0CF41F3B181A0099AA32 /* fishhook */, - 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */, - 18C3A9B71FE1D41600DEC48A /* fishhook-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 18C3A9BA1FE1D41600DEC48A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 181B13CD21652C4000D3B7D2 /* fishhook.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D2A28841D9B049200D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */, - 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */, - A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */, - 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3C86DF421ADF2C930047B81A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */, - 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */, - A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */, - 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0CF51F3B181A0099AA32 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DBE0D141F3B185A0099AA32 /* fishhook.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0D021F3B181C0099AA32 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DBE0D151F3B185A0099AA32 /* fishhook.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 64BF1F331EF8457300B83E07 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 64BF1F381EF8458500B83E07 /* RCTWebSocketModule.m in Sources */, - 64BF1F351EF8457900B83E07 /* RCTSRWebSocket.m in Sources */, - 64BF1F341EF8457600B83E07 /* RCTReconnectingWebSocket.m in Sources */, - 64BF1F361EF8457B00B83E07 /* RCTWebSocketExecutor.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 18C3A9C11FE1D44F00DEC48A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 18C3A9B71FE1D41600DEC48A /* fishhook-macOS */; - targetProxy = 18C3A9C01FE1D44F00DEC48A /* PBXContainerItemProxy */; - }; - 3DBE0D0F1F3B18490099AA32 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3DBE0CF41F3B181A0099AA32 /* fishhook */; - targetProxy = 3DBE0D0E1F3B18490099AA32 /* PBXContainerItemProxy */; - }; - 3DBE0D111F3B184D0099AA32 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */; - targetProxy = 3DBE0D101F3B184D0099AA32 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 18C3A9BD1FE1D41600DEC48A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 18C3A9BE1FE1D41600DEC48A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; - 2D2A288E1D9B049200D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A288F1D9B049200D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 3C86DF581ADF2C930047B81A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 3C86DF591ADF2C930047B81A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 3C86DF5B1ADF2C930047B81A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "RCT_METRO_PORT=${RCT_METRO_PORT}", - "$(inherited)", - ); - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 3C86DF5C1ADF2C930047B81A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = "RCT_METRO_PORT=${RCT_METRO_PORT}"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0CFE1F3B181A0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 3DBE0CFF1F3B181A0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0D0B1F3B181C0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 3DBE0D0C1F3B181C0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 6BDE7A561ECB6B8200CC951F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTWebSocket; - SDKROOT = macosx; - }; - name = Debug; - }; - 6BDE7A571ECB6B8200CC951F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTWebSocket; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 18C3A9BC1FE1D41600DEC48A /* Build configuration list for PBXNativeTarget "fishhook-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18C3A9BD1FE1D41600DEC48A /* Debug */, - 18C3A9BE1FE1D41600DEC48A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D2A28901D9B049200D4039D /* Build configuration list for PBXNativeTarget "RCTWebSocket-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A288E1D9B049200D4039D /* Debug */, - 2D2A288F1D9B049200D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3C86DF581ADF2C930047B81A /* Debug */, - 3C86DF591ADF2C930047B81A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3C86DF5B1ADF2C930047B81A /* Debug */, - 3C86DF5C1ADF2C930047B81A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3DBE0CFD1F3B181A0099AA32 /* Build configuration list for PBXNativeTarget "fishhook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3DBE0CFE1F3B181A0099AA32 /* Debug */, - 3DBE0CFF1F3B181A0099AA32 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3DBE0D0A1F3B181C0099AA32 /* Build configuration list for PBXNativeTarget "fishhook-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3DBE0D0B1F3B181C0099AA32 /* Debug */, - 3DBE0D0C1F3B181C0099AA32 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6BDE7A551ECB6B8200CC951F /* Build configuration list for PBXNativeTarget "RCTWebSocket-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6BDE7A561ECB6B8200CC951F /* Debug */, - 6BDE7A571ECB6B8200CC951F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 3C86DF3E1ADF2C930047B81A /* Project object */; -} diff --git a/Libraries/WebSocket/RCTWebSocketExecutor.m b/Libraries/WebSocket/RCTWebSocketExecutor.m index 4d8daa32f47d5b..5cd8d732ce8472 100644 --- a/Libraries/WebSocket/RCTWebSocketExecutor.m +++ b/Libraries/WebSocket/RCTWebSocketExecutor.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTWebSocketExecutor.h" +#import #import #import @@ -14,7 +14,7 @@ #import #import -#import "RCTSRWebSocket.h" +#import #if RCT_DEV // Debug executors are only supported in dev mode diff --git a/Libraries/WebSocket/RCTWebSocketModule.m b/Libraries/WebSocket/RCTWebSocketModule.m index 0150cd59582f5c..d9387c464d18a2 100644 --- a/Libraries/WebSocket/RCTWebSocketModule.m +++ b/Libraries/WebSocket/RCTWebSocketModule.m @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTWebSocketModule.h" +#import #import #import #import -#import "RCTSRWebSocket.h" +#import @implementation RCTSRWebSocket (React) @@ -155,7 +155,8 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message - (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket { [self sendEventWithName:@"websocketOpen" body:@{ - @"id": webSocket.reactTag + @"id": webSocket.reactTag, + @"protocol": webSocket.protocol ? webSocket.protocol : @"" }]; } diff --git a/Libraries/WebSocket/React-RCTWebSocket.podspec b/Libraries/WebSocket/React-RCTWebSocket.podspec deleted file mode 100644 index 62525de4d9bbd8..00000000000000 --- a/Libraries/WebSocket/React-RCTWebSocket.podspec +++ /dev/null @@ -1,37 +0,0 @@ -# coding: utf-8 -# 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. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "React-RCTWebSocket" - s.version = version - s.summary = "A library for supporting WebSockets, a protocol which provides full-duplex communication channels over a single TCP connection." - s.homepage = "http://facebook.github.io/react-native/" - s.documentation_url = "https://facebook.github.io/react-native/docs/network#websocket-support" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) - s.source = source - s.source_files = "*.{h,m}", - "Libraries/fishhook/*.{h,c}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "React" - - s.dependency "React-Core", version - s.dependency "React-fishhook", version -end diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index 472fd833e63096..35f0757b4dc691 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -11,10 +11,9 @@ 'use strict'; const Blob = require('../Blob/Blob'); +const BlobManager = require('../Blob/BlobManager'); const EventTarget = require('event-target-shim'); const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); -const BlobManager = require('../Blob/BlobManager'); -const NativeModules = require('../BatchedBridge/NativeModules'); const Platform = require('../Utilities/Platform'); const WebSocketEvent = require('./WebSocketEvent'); @@ -22,9 +21,8 @@ const base64 = require('base64-js'); const binaryToBase64 = require('../Utilities/binaryToBase64'); const invariant = require('invariant'); -const {WebSocketModule} = NativeModules; - import type EventSubscription from '../vendor/emitter/EventSubscription'; +import NativeWebSocketModule from './NativeWebSocketModule'; type ArrayBufferView = | Int8Array @@ -57,11 +55,11 @@ let nextWebSocketId = 0; * See https://developer.mozilla.org/en-US/docs/Web/API/WebSocket * See https://github.com/websockets/ws */ -class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { - static CONNECTING = CONNECTING; - static OPEN = OPEN; - static CLOSING = CLOSING; - static CLOSED = CLOSED; +class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) { + static CONNECTING: number = CONNECTING; + static OPEN: number = OPEN; + static CLOSING: number = CLOSING; + static CLOSED: number = CLOSED; CONNECTING: number = CONNECTING; OPEN: number = OPEN; @@ -128,10 +126,10 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { protocols = null; } - this._eventEmitter = new NativeEventEmitter(WebSocketModule); + this._eventEmitter = new NativeEventEmitter(NativeWebSocketModule); this._socketId = nextWebSocketId++; this._registerEvents(); - WebSocketModule.connect(url, protocols, {headers}, this._socketId); + NativeWebSocketModule.connect(url, protocols, {headers}, this._socketId); } get binaryType(): ?BinaryType { @@ -180,12 +178,12 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { } if (typeof data === 'string') { - WebSocketModule.send(data, this._socketId); + NativeWebSocketModule.send(data, this._socketId); return; } if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { - WebSocketModule.sendBinary(binaryToBase64(data), this._socketId); + NativeWebSocketModule.sendBinary(binaryToBase64(data), this._socketId); return; } @@ -197,14 +195,14 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { throw new Error('INVALID_STATE_ERR'); } - WebSocketModule.ping(this._socketId); + NativeWebSocketModule.ping(this._socketId); } _close(code?: number, reason?: string): void { // See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent const statusCode = typeof code === 'number' ? code : CLOSE_NORMAL; const closeReason = typeof reason === 'string' ? reason : ''; - WebSocketModule.close(statusCode, closeReason, this._socketId); + NativeWebSocketModule.close(statusCode, closeReason, this._socketId); if (BlobManager.isAvailable && this._binaryType === 'blob') { BlobManager.removeWebSocketHandler(this._socketId); @@ -238,6 +236,7 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { return; } this.readyState = this.OPEN; + this.protocol = ev.protocol; this.dispatchEvent(new WebSocketEvent('open')); }), this._eventEmitter.addListener('websocketClosed', ev => { diff --git a/Libraries/WebSocket/WebSocketInterceptor.js b/Libraries/WebSocket/WebSocketInterceptor.js index 58cd3da3a3b7d7..6c371c1028c485 100644 --- a/Libraries/WebSocket/WebSocketInterceptor.js +++ b/Libraries/WebSocket/WebSocketInterceptor.js @@ -9,16 +9,16 @@ 'use strict'; -const RCTWebSocketModule = require('../BatchedBridge/NativeModules') - .WebSocketModule; const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); +import NativeWebSocketModule from './NativeWebSocketModule'; + const base64 = require('base64-js'); -const originalRCTWebSocketConnect = RCTWebSocketModule.connect; -const originalRCTWebSocketSend = RCTWebSocketModule.send; -const originalRCTWebSocketSendBinary = RCTWebSocketModule.sendBinary; -const originalRCTWebSocketClose = RCTWebSocketModule.close; +const originalRCTWebSocketConnect = NativeWebSocketModule.connect; +const originalRCTWebSocketSend = NativeWebSocketModule.send; +const originalRCTWebSocketSendBinary = NativeWebSocketModule.sendBinary; +const originalRCTWebSocketClose = NativeWebSocketModule.close; let eventEmitter: NativeEventEmitter; let subscriptions: Array; @@ -135,13 +135,18 @@ const WebSocketInterceptor = { if (isInterceptorEnabled) { return; } - eventEmitter = new NativeEventEmitter(RCTWebSocketModule); + eventEmitter = new NativeEventEmitter(NativeWebSocketModule); WebSocketInterceptor._registerEvents(); // Override `connect` method for all RCTWebSocketModule requests // to intercept the request url, protocols, options and socketId, // then pass them through the `connectCallback`. - RCTWebSocketModule.connect = function(url, protocols, options, socketId) { + NativeWebSocketModule.connect = function( + url, + protocols, + options, + socketId, + ) { if (connectCallback) { connectCallback(url, protocols, options, socketId); } @@ -150,7 +155,7 @@ const WebSocketInterceptor = { // Override `send` method for all RCTWebSocketModule requests to intercept // the data sent, then pass them through the `sendCallback`. - RCTWebSocketModule.send = function(data, socketId) { + NativeWebSocketModule.send = function(data, socketId) { if (sendCallback) { sendCallback(data, socketId); } @@ -159,7 +164,7 @@ const WebSocketInterceptor = { // Override `sendBinary` method for all RCTWebSocketModule requests to // intercept the data sent, then pass them through the `sendCallback`. - RCTWebSocketModule.sendBinary = function(data, socketId) { + NativeWebSocketModule.sendBinary = function(data, socketId) { if (sendCallback) { sendCallback(WebSocketInterceptor._arrayBufferToString(data), socketId); } @@ -168,7 +173,7 @@ const WebSocketInterceptor = { // Override `close` method for all RCTWebSocketModule requests to intercept // the close information, then pass them through the `closeCallback`. - RCTWebSocketModule.close = function() { + NativeWebSocketModule.close = function() { if (closeCallback) { if (arguments.length === 3) { closeCallback(arguments[0], arguments[1], arguments[2]); @@ -203,10 +208,10 @@ const WebSocketInterceptor = { return; } isInterceptorEnabled = false; - RCTWebSocketModule.send = originalRCTWebSocketSend; - RCTWebSocketModule.sendBinary = originalRCTWebSocketSendBinary; - RCTWebSocketModule.close = originalRCTWebSocketClose; - RCTWebSocketModule.connect = originalRCTWebSocketConnect; + NativeWebSocketModule.send = originalRCTWebSocketSend; + NativeWebSocketModule.sendBinary = originalRCTWebSocketSendBinary; + NativeWebSocketModule.close = originalRCTWebSocketClose; + NativeWebSocketModule.connect = originalRCTWebSocketConnect; connectCallback = null; closeCallback = null; diff --git a/Libraries/Wrapper/RCTWrapperView.m b/Libraries/Wrapper/RCTWrapperView.m index af24bb6e95f00c..6fc328d0eba865 100644 --- a/Libraries/Wrapper/RCTWrapperView.m +++ b/Libraries/Wrapper/RCTWrapperView.m @@ -74,7 +74,7 @@ - (void)invalidateIntrinsicContentSize [super invalidateIntrinsicContentSize]; // Setting `intrinsicContentSize` dirties the Yoga node and - // enfoce Yoga to call `measure` function (backed to `measureBlock`). + // enforce Yoga to call `measure` function (backed to `measureBlock`). [_bridge.uiManager setIntrinsicContentSize:self.intrinsicContentSize forView:self]; } diff --git a/Libraries/YellowBox/Data/YellowBoxSymbolication.js b/Libraries/YellowBox/Data/YellowBoxSymbolication.js index f8186daeeb9868..d31d6ef06b757c 100644 --- a/Libraries/YellowBox/Data/YellowBoxSymbolication.js +++ b/Libraries/YellowBox/Data/YellowBoxSymbolication.js @@ -12,7 +12,7 @@ const symbolicateStackTrace = require('../../Core/Devtools/symbolicateStackTrace'); -import type {StackFrame} from '../../Core/Devtools/parseErrorStack'; +import type {StackFrame} from '../../Core/NativeExceptionsManager'; type CacheKey = string; diff --git a/Libraries/YellowBox/Data/__tests__/YellowBoxRegistry-test.js b/Libraries/YellowBox/Data/__tests__/YellowBoxRegistry-test.js index 35a6dc9b8cfc23..fb1543717307ab 100644 --- a/Libraries/YellowBox/Data/__tests__/YellowBoxRegistry-test.js +++ b/Libraries/YellowBox/Data/__tests__/YellowBoxRegistry-test.js @@ -185,7 +185,7 @@ describe('YellowBoxRegistry', () => { expect(observer.mock.calls[0][0]).toBe(registry()); }); - it('sends batched updates asynchoronously', () => { + it('sends batched updates asynchronously', () => { const {observer} = observe(); expect(observer.mock.calls.length).toBe(1); diff --git a/Libraries/YellowBox/Data/__tests__/YellowBoxSymbolication-test.js b/Libraries/YellowBox/Data/__tests__/YellowBoxSymbolication-test.js index b438ab1142e92d..f125ff380f040a 100644 --- a/Libraries/YellowBox/Data/__tests__/YellowBoxSymbolication-test.js +++ b/Libraries/YellowBox/Data/__tests__/YellowBoxSymbolication-test.js @@ -11,7 +11,7 @@ 'use strict'; -import type {StackFrame} from '../../../Core/Devtools/parseErrorStack'; +import type {StackFrame} from '../../../Core/NativeExceptionsManager'; jest.mock('../../../Core/Devtools/symbolicateStackTrace'); diff --git a/Libraries/YellowBox/Data/__tests__/YellowBoxWarning-test.js b/Libraries/YellowBox/Data/__tests__/YellowBoxWarning-test.js index 65369bf8e5e60f..3bbca34dd569e7 100644 --- a/Libraries/YellowBox/Data/__tests__/YellowBoxWarning-test.js +++ b/Libraries/YellowBox/Data/__tests__/YellowBoxWarning-test.js @@ -11,7 +11,7 @@ 'use strict'; -import type {StackFrame} from '../../../Core/Devtools/parseErrorStack'; +import type {StackFrame} from '../../../Core/NativeExceptionsManager'; jest.mock('../YellowBoxSymbolication'); diff --git a/Libraries/YellowBox/UI/YellowBoxImageSource.js b/Libraries/YellowBox/UI/YellowBoxImageSource.js index 8c186beb89e502..88822ee938e3dd 100644 --- a/Libraries/YellowBox/UI/YellowBoxImageSource.js +++ b/Libraries/YellowBox/UI/YellowBoxImageSource.js @@ -29,36 +29,31 @@ const scale = PixelRatio.get(); * @license MIT */ const YellowBoxImageSource = { - alertTriangle: - scale > 2 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAB60lEQVRoge2Z3W3DIBSFj9oFPAIjZARGyAiMkBHuJh4hI2QEj5AR3Me+tQ91JALHmD8bKvmTkCr5Auc6/kzUACcnRXzuvL4GoAB8Afjeea9qXADcAfw4475c65orgBl++NeYl5ouUQiHt5tQTRJuwB6b5zLY49QVGn7I0bo+kuv60IQbuHf5CWCIqOkCgX93maia1MkRAUMo+OI+AvUPp7a50EzcUCBF6psJrUkYiZgnZJ7eId8mMeIyhpW5hyLw72LKCXsl86VqwgAKceKapW5e/nZpJnSsuHaTM7muyDq7C63JprJS69YxhNTpSlkpKeLGNHCo0EJChcSNaQA4SGiFtBMXJFSI3YVOPXFB6kMoUl9NaE0Wl4h5KQ0AOwqde+KmNrCL0EKCxJ64qQ0AlYVWSBfXZusgW6Oa0Dni2hiEv0qsoci+yUJrsoikLlKAkP11ygK54taiSOgb/O5b/DMqS+gBZeLWJlnoEX7XwQkBDPIktlEkz7hWrEmxZG4M5L9GXYTk0qxwcopKxa3VABN6cosM/C5LxTUof4ReMKHf1nRlaSnuGsGM7kfU4w8RF5Bz4aNlokLe/HQ/ngl9/Qih4L9k3h4hA1+S3odxu3Q77Hl4r1Hg75n6D01M2Difbp02Mi3ZTk5OLH4BUyEtOlDYuK0AAAAASUVORK5CYII=' - : scale > 1 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABVklEQVRYheWX4U3DMBBGH4gBMoJHyAgeoSNkAxjBG5QNOkJHCGzQDcoGZQP4gY3Oqe1cEscS4pNOqs9Jvqvv6ZrCf9fDhnutD4A3H810Br4mcW5l7hLmIdze5mZi+OJD5syeBYzC6CjyR5Ef9zI/CJMb0Im9zufC/qG2eQdchcGQuGYQ+9dJgZvl0B2xbJGrZW6IIevFXp9YVwcyB540syJfFcgSeJb0cVcDcg68XAFQCUhH+ShLBcBGIA158LQFqIB8zBRwEp9fgctcxQld/L2pZxZVAk/KkucjaDGQmoknrz35KEE2sABIRxm8tVIBaZgHb61UQOYmXk7aFgQVJ6QWPCnLAriYAVILnpTxD7yh/9EZiIEE4m+y29uMkGy1nQ6i9wYFRB5PwKdYP/v1msmnUe89gn695bG0iqjdXeMiRu9599csvGKZ0jlu0Ac/7d2rxX9Q37HW6QfX/ZguAAAAAElFTkSuQmCC' - : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAvUlEQVQ4jbWT4Q3CIBCFP40DdANxg24gIzhKuwEjuIFxAkcwTtARGicoG+iPXlMCB8UfvoQc4e7ePV4A/ogWuMlqc0W7AsEo0QMNcPplugMmwMia5KwKWkNIuIkHq3wLXGQ/Sq4IC3wkLpOfmZyKeEpIEKsDYB8VN0Afkfpg30uNiycbdKcNqXEOxdBEWoEAoqta8uZ0iqqkxwGDUrSFAXAHZpOWd/+ubD5Kz335Cx1wZna4Bh54AddauVl8ARfCLO9Xq7xGAAAAAElFTkSuQmCC', - check: - scale > 2 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAqElEQVRoge3YTQ7CIBRF4bPUu/8JS6gTSaqilh95vuR+CaO2cGgYNAUzMzOzFgHlPhRaMkDAcRoltKaTeIxPtQHxGn+Q5AgJx8cQjo8hHB9DOP76Yiu/RcTmN18WLiQCjs3zBkYXVGOeLWd+xcIr5pgyEzDz7FIjISPP/FRPUM+9W4nvYVfuCSXeB3669ldEOzRFfCUSx1cicXwlEsdXIvEPKDMzM7PMbtugw3XTpNA2AAAAAElFTkSuQmCC' - : scale > 1 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAf0lEQVRYhe2UvQ2AIBQGL3EBR3AESkv3bxxFN8DmWUgwvkI+En1X0cBd+IMg+DuDyDMCs413kfMiX4EMbD3l8oCaPIU85B4mYLEF5XJscrYFPRGvb/sZ4IlocubJGdH0wj1FSG77XYT0qdUi5O+8jOjyyZQRUnkZ0UUeBMF3OQC/0VsyGlxligAAAABJRU5ErkJggg==' - : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAASElEQVQ4jWNgGJHAgIGBIYESze8ZGBjWU6L5PAMDgwBNNCdAFZJt83qoQmRDSHK2AFQhzBCy/IxsCNkBJsDAwLAfiknWPBIBAETPFeuA4fr6AAAAAElFTkSuQmCC', - chevronLeft: - scale > 2 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAgElEQVRoge3YMQ6DQBAEwRYvnf8nPAECbAnkyATsrt0lXUyPdAE6kCRJ/yXA+jopLbkhwHY6a2nNl8I1ftSA8Bm/MeQKBeNrBONrBONrBONrhMHxcPwOlMUvT32oszD8CoEj+giO6CE4oofgiB7Cj44Y86zyFoYPgOFPi5Ik6WwHji+QVIOyhqgAAAAASUVORK5CYII=' - : scale > 1 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAaUlEQVRYhe3WsQ2AMAwAwRcs5LEYg3HpYANoQKKgcEEUI/6adM5LbgySfmZsNDeACdiApdEfaQGswH6+Xd1jugc9xYQxxhjz9RhaxwxvDuul3MrAqDyjsozKKnWgXUqdsJcAZgqsTFJ5B7gjUNw0n0HHAAAAAElFTkSuQmCC' - : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAARklEQVQ4jWNgGPKAmUh1AQwMDBIMDAwPyLEkgYGB4T/UELI1J9BdcwCxmpnIMZ1YkECsK+hmCNZoZCHCgAUMDAwfoHg4AgDJuQ/bcLyV+QAAAABJRU5ErkJggg==', - chevronRight: - scale > 2 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAeElEQVRoge3YMQ6AIBQE0Ykn3fs3HEEbC6MdFp+v8xJaspNQAZIkqbcA4zwpXTJpAPvlpHTNhHtAu4jwDDCiQjBiDcGINQQj1hCMWEN4Boy3l25vL/iL0PgJBcfXCI6vERxfIzi+Rmg8Hj7wrdL+Yys0/1qUJEmzDvSAkFQ8EOdJAAAAAElFTkSuQmCC' - : scale > 1 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAZElEQVRYhe3WsQmAQAxA0Y8ulLEcw3HtdANtBNvzCJjD/5pUgQ9pApJ+Zu7YCWABDmDLzemzA+c94+MW4AkqExUY1caoVka1GibqlSm7qJJSJzPGGGMylYqBgi9sACtFYiQN7wKC6VDcJ7tlpQAAAABJRU5ErkJggg==' - : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAANUlEQVQ4jWNgGLbAgYGBIYASAwIYGBj+MzAwJFBiSMLQMISJEpMptp2mmimORgcGChPSEAIAHGENPH8gqdYAAAAASUVORK5CYII=', - loader: - scale > 2 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABXElEQVRoge2a3W3DMAyEr+0CHkGjaISOcKN4k6zQETpCR+gGzgbpQ10kcamIpKQ6avQBBPxg3pHwL2UDg/8LASxrcNdKnCwATmssrUyeWgnju/DmXs8tRP+Sh2kgAJga1rFlWj2rcMD5YqQh77QJLbzIORjyRIJQCJW5ngYo5AVlrsgkCGqbsDbAhFfxqZsSZibP0oDXQ43HQPsg82i7sBoR+VcJq2YxKcPo0IoJLRZXmYGC6ezQmQUdVqhPBVH/CNBTSMkLVlzjA8Bbocb7GoPBoADi+umZilYzbrG/JrnljOvy734iu4To/BQaDB6Rl4LciPPF9Lmjhgvi+s7w6tCIGw3WKS0P8fvWNjt0ZkGHFeq7CQXTbkZKGg2JOxrqPUZ3s6ziNdju38IjS/dLi0EQpDLX2gDQYHEX6Hx5/YcA+6H0NgAYPnCMj3x7Mxq4wTGx3Q1E578aDDR8AX0mOGD6BEN/AAAAAElFTkSuQmCC' - : scale > 1 - ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABN0lEQVRYhe2WzU3EMBCFP34KyJEjJaQDXAIlJJ24BSow2wEdhHSwJSwd7JHbcmC0mOxMnDiWDIInWbHkN29exo4n8IvRAEFGU8OAA04yulyR60Jm7msbyIZloAMGwBfI4UWrWxM08LW/weC4iOMNTog4g0awKjBG827GxBwC3996NHizAifsSrTRmlsZm23CT9adktyXSq6ZUPdxgiXnZzW8CLcLuC3lvqA/gCt5NtjlPQL7TP0Wu1HtRRu4PO3T4TKTz2kG+AG9IN6CR/Su9iojBw69egfghWgL/pGCp+JFVPUqTjWjlsuqeAo1o6rt2C8QcNiV0UxoHPMieojmz0CfMKyhl1hN84xbI3gnz5Ftp7kH3iT5LsFdDUf6pzSJ6r2glIFDbuDNhqRH4I7Pvv4EvG/QqocP2Jh/xzzX/zUAAAAASUVORK5CYII=' - : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsklEQVQ4jaWTYRHCMAyFP7gJmIQ6oChgEpBQKXMwC3MADpAAEiphDuBHC4QuDRu8u9ylyWtem7Rgw2X7GT1wsghb4beAVzhtsfYyJgs44AoEQzBkjrMId1HkKPwyZ6oMSnxYsnk1NqT7yMo34Fzhd9meGJvs7Hh3NhqCLXDI/rT0lKsR+KOJgc9RdaRRarkZvELogYsi8HqxjUhGYE+aQg1jzketwFTZXHbbEpjB8eU7PwAbLiJz46707gAAAABJRU5ErkJggg==', + alertTriangle: ((scale > 2 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAB60lEQVRoge2Z3W3DIBSFj9oFPAIjZARGyAiMkBHuJh4hI2QEj5AR3Me+tQ91JALHmD8bKvmTkCr5Auc6/kzUACcnRXzuvL4GoAB8Afjeea9qXADcAfw4475c65orgBl++NeYl5ouUQiHt5tQTRJuwB6b5zLY49QVGn7I0bo+kuv60IQbuHf5CWCIqOkCgX93maia1MkRAUMo+OI+AvUPp7a50EzcUCBF6psJrUkYiZgnZJ7eId8mMeIyhpW5hyLw72LKCXsl86VqwgAKceKapW5e/nZpJnSsuHaTM7muyDq7C63JprJS69YxhNTpSlkpKeLGNHCo0EJChcSNaQA4SGiFtBMXJFSI3YVOPXFB6kMoUl9NaE0Wl4h5KQ0AOwqde+KmNrCL0EKCxJ64qQ0AlYVWSBfXZusgW6Oa0Dni2hiEv0qsoci+yUJrsoikLlKAkP11ygK54taiSOgb/O5b/DMqS+gBZeLWJlnoEX7XwQkBDPIktlEkz7hWrEmxZG4M5L9GXYTk0qxwcopKxa3VABN6cosM/C5LxTUof4ReMKHf1nRlaSnuGsGM7kfU4w8RF5Bz4aNlokLe/HQ/ngl9/Qih4L9k3h4hA1+S3odxu3Q77Hl4r1Hg75n6D01M2Difbp02Mi3ZTk5OLH4BUyEtOlDYuK0AAAAASUVORK5CYII=' + : scale > 1 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABVklEQVRYheWX4U3DMBBGH4gBMoJHyAgeoSNkAxjBG5QNOkJHCGzQDcoGZQP4gY3Oqe1cEscS4pNOqs9Jvqvv6ZrCf9fDhnutD4A3H810Br4mcW5l7hLmIdze5mZi+OJD5syeBYzC6CjyR5Ef9zI/CJMb0Im9zufC/qG2eQdchcGQuGYQ+9dJgZvl0B2xbJGrZW6IIevFXp9YVwcyB540syJfFcgSeJb0cVcDcg68XAFQCUhH+ShLBcBGIA158LQFqIB8zBRwEp9fgctcxQld/L2pZxZVAk/KkucjaDGQmoknrz35KEE2sABIRxm8tVIBaZgHb61UQOYmXk7aFgQVJ6QWPCnLAriYAVILnpTxD7yh/9EZiIEE4m+y29uMkGy1nQ6i9wYFRB5PwKdYP/v1msmnUe89gn695bG0iqjdXeMiRu9599csvGKZ0jlu0Ac/7d2rxX9Q37HW6QfX/ZguAAAAAElFTkSuQmCC' + : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAvUlEQVQ4jbWT4Q3CIBCFP40DdANxg24gIzhKuwEjuIFxAkcwTtARGicoG+iPXlMCB8UfvoQc4e7ePV4A/ogWuMlqc0W7AsEo0QMNcPplugMmwMia5KwKWkNIuIkHq3wLXGQ/Sq4IC3wkLpOfmZyKeEpIEKsDYB8VN0Afkfpg30uNiycbdKcNqXEOxdBEWoEAoqta8uZ0iqqkxwGDUrSFAXAHZpOWd/+ubD5Kz335Cx1wZna4Bh54AddauVl8ARfCLO9Xq7xGAAAAAElFTkSuQmCC'): string), + check: ((scale > 2 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAqElEQVRoge3YTQ7CIBRF4bPUu/8JS6gTSaqilh95vuR+CaO2cGgYNAUzMzOzFgHlPhRaMkDAcRoltKaTeIxPtQHxGn+Q5AgJx8cQjo8hHB9DOP76Yiu/RcTmN18WLiQCjs3zBkYXVGOeLWd+xcIr5pgyEzDz7FIjISPP/FRPUM+9W4nvYVfuCSXeB3669ldEOzRFfCUSx1cicXwlEsdXIvEPKDMzM7PMbtugw3XTpNA2AAAAAElFTkSuQmCC' + : scale > 1 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAf0lEQVRYhe2UvQ2AIBQGL3EBR3AESkv3bxxFN8DmWUgwvkI+En1X0cBd+IMg+DuDyDMCs413kfMiX4EMbD3l8oCaPIU85B4mYLEF5XJscrYFPRGvb/sZ4IlocubJGdH0wj1FSG77XYT0qdUi5O+8jOjyyZQRUnkZ0UUeBMF3OQC/0VsyGlxligAAAABJRU5ErkJggg==' + : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAASElEQVQ4jWNgGJHAgIGBIYESze8ZGBjWU6L5PAMDgwBNNCdAFZJt83qoQmRDSHK2AFQhzBCy/IxsCNkBJsDAwLAfiknWPBIBAETPFeuA4fr6AAAAAElFTkSuQmCC'): string), + chevronLeft: ((scale > 2 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAgElEQVRoge3YMQ6DQBAEwRYvnf8nPAECbAnkyATsrt0lXUyPdAE6kCRJ/yXA+jopLbkhwHY6a2nNl8I1ftSA8Bm/MeQKBeNrBONrBONrBONrhMHxcPwOlMUvT32oszD8CoEj+giO6CE4oofgiB7Cj44Y86zyFoYPgOFPi5Ik6WwHji+QVIOyhqgAAAAASUVORK5CYII=' + : scale > 1 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAaUlEQVRYhe3WsQ2AMAwAwRcs5LEYg3HpYANoQKKgcEEUI/6adM5LbgySfmZsNDeACdiApdEfaQGswH6+Xd1jugc9xYQxxhjz9RhaxwxvDuul3MrAqDyjsozKKnWgXUqdsJcAZgqsTFJ5B7gjUNw0n0HHAAAAAElFTkSuQmCC' + : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAARklEQVQ4jWNgGPKAmUh1AQwMDBIMDAwPyLEkgYGB4T/UELI1J9BdcwCxmpnIMZ1YkECsK+hmCNZoZCHCgAUMDAwfoHg4AgDJuQ/bcLyV+QAAAABJRU5ErkJggg=='): string), + chevronRight: ((scale > 2 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAeElEQVRoge3YMQ6AIBQE0Ykn3fs3HEEbC6MdFp+v8xJaspNQAZIkqbcA4zwpXTJpAPvlpHTNhHtAu4jwDDCiQjBiDcGINQQj1hCMWEN4Boy3l25vL/iL0PgJBcfXCI6vERxfIzi+Rmg8Hj7wrdL+Yys0/1qUJEmzDvSAkFQ8EOdJAAAAAElFTkSuQmCC' + : scale > 1 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAZElEQVRYhe3WsQmAQAxA0Y8ulLEcw3HtdANtBNvzCJjD/5pUgQ9pApJ+Zu7YCWABDmDLzemzA+c94+MW4AkqExUY1caoVka1GibqlSm7qJJSJzPGGGMylYqBgi9sACtFYiQN7wKC6VDcJ7tlpQAAAABJRU5ErkJggg==' + : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAANUlEQVQ4jWNgGLbAgYGBIYASAwIYGBj+MzAwJFBiSMLQMISJEpMptp2mmimORgcGChPSEAIAHGENPH8gqdYAAAAASUVORK5CYII='): string), + loader: ((scale > 2 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABXElEQVRoge2a3W3DMAyEr+0CHkGjaISOcKN4k6zQETpCR+gGzgbpQ10kcamIpKQ6avQBBPxg3pHwL2UDg/8LASxrcNdKnCwATmssrUyeWgnju/DmXs8tRP+Sh2kgAJga1rFlWj2rcMD5YqQh77QJLbzIORjyRIJQCJW5ngYo5AVlrsgkCGqbsDbAhFfxqZsSZibP0oDXQ43HQPsg82i7sBoR+VcJq2YxKcPo0IoJLRZXmYGC6ezQmQUdVqhPBVH/CNBTSMkLVlzjA8Bbocb7GoPBoADi+umZilYzbrG/JrnljOvy734iu4To/BQaDB6Rl4LciPPF9Lmjhgvi+s7w6tCIGw3WKS0P8fvWNjt0ZkGHFeq7CQXTbkZKGg2JOxrqPUZ3s6ziNdju38IjS/dLi0EQpDLX2gDQYHEX6Hx5/YcA+6H0NgAYPnCMj3x7Mxq4wTGx3Q1E578aDDR8AX0mOGD6BEN/AAAAAElFTkSuQmCC' + : scale > 1 + ? 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABN0lEQVRYhe2WzU3EMBCFP34KyJEjJaQDXAIlJJ24BSow2wEdhHSwJSwd7JHbcmC0mOxMnDiWDIInWbHkN29exo4n8IvRAEFGU8OAA04yulyR60Jm7msbyIZloAMGwBfI4UWrWxM08LW/weC4iOMNTog4g0awKjBG827GxBwC3996NHizAifsSrTRmlsZm23CT9adktyXSq6ZUPdxgiXnZzW8CLcLuC3lvqA/gCt5NtjlPQL7TP0Wu1HtRRu4PO3T4TKTz2kG+AG9IN6CR/Su9iojBw69egfghWgL/pGCp+JFVPUqTjWjlsuqeAo1o6rt2C8QcNiV0UxoHPMieojmz0CfMKyhl1hN84xbI3gnz5Ftp7kH3iT5LsFdDUf6pzSJ6r2glIFDbuDNhqRH4I7Pvv4EvG/QqocP2Jh/xzzX/zUAAAAASUVORK5CYII=' + : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsklEQVQ4jaWTYRHCMAyFP7gJmIQ6oChgEpBQKXMwC3MADpAAEiphDuBHC4QuDRu8u9ylyWtem7Rgw2X7GT1wsghb4beAVzhtsfYyJgs44AoEQzBkjrMId1HkKPwyZ6oMSnxYsnk1NqT7yMo34Fzhd9meGJvs7Hh3NhqCLXDI/rT0lKsR+KOJgc9RdaRRarkZvELogYsi8HqxjUhGYE+aQg1jzketwFTZXHbbEpjB8eU7PwAbLiJz46707gAAAABJRU5ErkJggg=='): string), }; module.exports = YellowBoxImageSource; diff --git a/Libraries/YellowBox/UI/YellowBoxInspector.js b/Libraries/YellowBox/UI/YellowBoxInspector.js index 1d4cf6f17f331a..424b8ed5d13077 100644 --- a/Libraries/YellowBox/UI/YellowBoxInspector.js +++ b/Libraries/YellowBox/UI/YellowBoxInspector.js @@ -41,7 +41,7 @@ type State = {| class YellowBoxInspector extends React.Component { _symbolication: ?SymbolicationRequest; - state = { + state: State = { selectedIndex: 0, }; @@ -85,19 +85,24 @@ class YellowBoxInspector extends React.Component { status={warning.symbolicated.status} /> - {warning.getAvailableStack().map((frame, index) => ( - { - openFileInEditor(frame.file, frame.lineNumber); - } - : null - } - /> - ))} + {warning.getAvailableStack().map((frame, index) => { + const {file, lineNumber} = frame; + return ( + { + openFileInEditor(file, lineNumber); + } + : null + } + /> + ); + })} { - state = { + state: State = { animation: null, rotate: null, }; diff --git a/Libraries/YellowBox/UI/YellowBoxInspectorStackFrame.js b/Libraries/YellowBox/UI/YellowBoxInspectorStackFrame.js index efac349d35ee3c..01c6f03c5aa7df 100644 --- a/Libraries/YellowBox/UI/YellowBoxInspectorStackFrame.js +++ b/Libraries/YellowBox/UI/YellowBoxInspectorStackFrame.js @@ -17,7 +17,7 @@ const YellowBoxPressable = require('./YellowBoxPressable'); const YellowBoxStyle = require('./YellowBoxStyle'); import type {PressEvent} from '../../Types/CoreEventTypes'; -import type {StackFrame} from '../../Core/Devtools/parseErrorStack'; +import type {StackFrame} from '../../Core/NativeExceptionsManager'; type Props = $ReadOnly<{| frame: StackFrame, @@ -40,22 +40,34 @@ const YellowBoxInspectorStackFrame = (props: Props): React.Node => { ellipsizeMode="middle" numberOfLines={1} style={styles.frameLocation}> - {`${getFrameLocation(frame.file)}:${frame.lineNumber}${ - frame.column == null ? '' : ':' + frame.column - }`} + {formatFrameLocation(frame)} ); }; -const getFrameLocation = (uri: string): string => { - const queryIndex = uri.indexOf('?'); - const query = queryIndex < 0 ? '' : uri.substr(queryIndex); +const formatFrameLocation = (frame: StackFrame): string => { + const {file, lineNumber, column} = frame; + if (file == null) { + return ''; + } + const queryIndex = file.indexOf('?'); + const query = queryIndex < 0 ? '' : file.substr(queryIndex); - const path = queryIndex < 0 ? uri : uri.substr(0, queryIndex); - const file = path.substr(path.lastIndexOf('/') + 1); + const path = queryIndex < 0 ? file : file.substr(0, queryIndex); + let location = path.substr(path.lastIndexOf('/') + 1) + query; - return file + query; + if (lineNumber == null) { + return location; + } + + location = location + ':' + lineNumber; + + if (column == null) { + return location; + } + + return location + ':' + column; }; const styles = StyleSheet.create({ diff --git a/Libraries/YellowBox/UI/YellowBoxList.js b/Libraries/YellowBox/UI/YellowBoxList.js index d5caa06ee2cbf9..edb2f5aaae18a3 100644 --- a/Libraries/YellowBox/UI/YellowBoxList.js +++ b/Libraries/YellowBox/UI/YellowBoxList.js @@ -11,8 +11,8 @@ 'use strict'; const Dimensions = require('../../Utilities/Dimensions'); -const React = require('react'); const FlatList = require('../../Lists/FlatList'); +const React = require('react'); const SafeAreaView = require('../../Components/SafeAreaView/SafeAreaView'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const View = require('../../Components/View/View'); @@ -41,7 +41,7 @@ const MAX_ITEMS = Math.floor( ); class YellowBoxList extends React.Component { - state = { + state: State = { selectedCategory: null, }; diff --git a/Libraries/YellowBox/UI/YellowBoxListRow.js b/Libraries/YellowBox/UI/YellowBoxListRow.js index d10f11b9034709..367a40e9c6835d 100644 --- a/Libraries/YellowBox/UI/YellowBoxListRow.js +++ b/Libraries/YellowBox/UI/YellowBoxListRow.js @@ -13,9 +13,9 @@ const React = require('react'); const StyleSheet = require('../../StyleSheet/StyleSheet'); const Text = require('../../Text/Text'); -const YellowBoxPressable = require('./YellowBoxPressable'); const View = require('../../Components/View/View'); const YellowBoxCategory = require('../Data/YellowBoxCategory'); +const YellowBoxPressable = require('./YellowBoxPressable'); const YellowBoxStyle = require('./YellowBoxStyle'); const YellowBoxWarning = require('../Data/YellowBoxWarning'); @@ -28,8 +28,8 @@ type Props = $ReadOnly<{| |}>; class YellowBoxListRow extends React.Component { - static GUTTER = StyleSheet.hairlineWidth; - static HEIGHT = 48; + static GUTTER: number = StyleSheet.hairlineWidth; + static HEIGHT: number = 48; shouldComponentUpdate(nextProps: Props): boolean { const prevProps = this.props; @@ -38,7 +38,7 @@ class YellowBoxListRow extends React.Component { prevProps.onPress !== nextProps.onPress || prevProps.warnings.length !== nextProps.warnings.length || prevProps.warnings.some( - (prevWarning, index) => prevWarning !== nextProps[index], + (prevWarning, index) => prevWarning !== nextProps.warnings[index], ) ); } diff --git a/Libraries/YellowBox/UI/YellowBoxPressable.js b/Libraries/YellowBox/UI/YellowBoxPressable.js index 0090ca69ab37f2..ed7b688a76854d 100644 --- a/Libraries/YellowBox/UI/YellowBoxPressable.js +++ b/Libraries/YellowBox/UI/YellowBoxPressable.js @@ -16,9 +16,9 @@ const TouchableWithoutFeedback = require('../../Components/Touchable/TouchableWi const View = require('../../Components/View/View'); const YellowBoxStyle = require('./YellowBoxStyle'); -import type {PressEvent} from '../../Types/CoreEventTypes'; import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; +import type {PressEvent} from '../../Types/CoreEventTypes'; type Props = $ReadOnly<{| backgroundColor: $ReadOnly<{| @@ -36,14 +36,16 @@ type State = {| |}; class YellowBoxPressable extends React.Component { - static defaultProps = { + static defaultProps: $TEMPORARY$object<{| + backgroundColor: $TEMPORARY$object<{|default: string, pressed: string|}>, + |}> = { backgroundColor: { default: YellowBoxStyle.getBackgroundColor(0.95), pressed: YellowBoxStyle.getHighlightColor(1), }, }; - state = { + state: State = { pressed: false, }; diff --git a/Libraries/YellowBox/YellowBox.js b/Libraries/YellowBox/YellowBox.js index feb27f5faffe93..d94e23b50c359b 100644 --- a/Libraries/YellowBox/YellowBox.js +++ b/Libraries/YellowBox/YellowBox.js @@ -138,7 +138,7 @@ if (__DEV__) { YellowBoxRegistry.add({args, framesToPop: 2}); }; } else { - YellowBox = class extends React.Component { + YellowBox = class extends React.Component { static ignoreWarnings(patterns: $ReadOnlyArray): void { // Do nothing. } @@ -157,4 +157,8 @@ if (__DEV__) { }; } -module.exports = YellowBox; +module.exports = (YellowBox: Class> & { + ignoreWarnings($ReadOnlyArray): void, + install(): void, + uninstall(): void, +}); diff --git a/Libraries/fishhook/LICENSE b/Libraries/fishhook/LICENSE deleted file mode 100755 index c45bb7c0ffffa5..00000000000000 --- a/Libraries/fishhook/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/Libraries/fishhook/README.md b/Libraries/fishhook/README.md deleted file mode 100755 index 1374fba5dcd8ed..00000000000000 --- a/Libraries/fishhook/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# fishhook - -__fishhook__ is a very simple library that enables dynamically rebinding symbols in Mach-O binaries running on iOS in the simulator and on device. This provides functionality that is similar to using [`DYLD_INTERPOSE`][interpose] on OS X. At Facebook, we've found it useful as a way to hook calls in libSystem for debugging/tracing purposes (for example, auditing for double-close issues with file descriptors). - -[interpose]: http://opensource.apple.com/source/dyld/dyld-210.2.3/include/mach-o/dyld-interposing.h "" - -## Usage - -Once you add `fishhook.h`/`fishhook.c` to your project, you can rebind symbols as follows: -```Objective-C -#import - -#import - -#import "AppDelegate.h" -#import "fishhook.h" - -static int (*orig_close)(int); -static int (*orig_open)(const char *, int, ...); - -int my_close(int fd) { - printf("Calling real close(%d)\n", fd); - return orig_close(fd); -} - -int my_open(const char *path, int oflag, ...) { - va_list ap = {0}; - mode_t mode = 0; - - if ((oflag & O_CREAT) != 0) { - // mode only applies to O_CREAT - va_start(ap, oflag); - mode = va_arg(ap, int); - va_end(ap); - printf("Calling real open('%s', %d, %d)\n", path, oflag, mode); - return orig_open(path, oflag, mode); - } else { - printf("Calling real open('%s', %d)\n", path, oflag); - return orig_open(path, oflag, mode); - } -} - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - rebind_symbols((struct rebinding[2]){{"close", my_close, (void *)&orig_close}, {"open", my_open, (void *)&orig_open}}, 2); - - // Open our own binary and print out first 4 bytes (which is the same - // for all Mach-O binaries on a given architecture) - int fd = open(argv[0], O_RDONLY); - uint32_t magic_number = 0; - read(fd, &magic_number, 4); - printf("Mach-O Magic Number: %x \n", magic_number); - close(fd); - - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} -``` -### Sample output -``` -Calling real open('/var/mobile/Applications/161DA598-5B83-41F5-8A44-675491AF6A2C/Test.app/Test', 0) -Mach-O Magic Number: feedface -Calling real close(3) -... -``` - -## How it works - -`dyld` binds lazy and non-lazy symbols by updating pointers in particular sections of the `__DATA` segment of a Mach-O binary. __fishhook__ re-binds these symbols by determining the locations to update for each of the symbol names passed to `rebind_symbols` and then writing out the corresponding replacements. - -For a given image, the `__DATA` segment may contain two sections that are relevant for dynamic symbol bindings: `__nl_symbol_ptr` and `__la_symbol_ptr`. `__nl_symbol_ptr` is an array of pointers to non-lazily bound data (these are bound at the time a library is loaded) and `__la_symbol_ptr` is an array of pointers to imported functions that is generally filled by a routine called `dyld_stub_binder` during the first call to that symbol (it's also possible to tell `dyld` to bind these at launch). In order to find the name of the symbol that corresponds to a particular location in one of these sections, we have to jump through several layers of indirection. For the two relevant sections, the section headers (`struct section`s from ``) provide an offset (in the `reserved1` field) into what is known as the indirect symbol table. The indirect symbol table, which is located in the `__LINKEDIT` segment of the binary, is just an array of indexes into the symbol table (also in `__LINKEDIT`) whose order is identical to that of the pointers in the non-lazy and lazy symbol sections. So, given `struct section nl_symbol_ptr`, the corresponding index in the symbol table of the first address in that section is `indirect_symbol_table[nl_symbol_ptr->reserved1]`. The symbol table itself is an array of `struct nlist`s (see ``), and each `nlist` contains an index into the string table in `__LINKEDIT` which where the actual symbol names are stored. So, for each pointer `__nl_symbol_ptr` and `__la_symbol_ptr`, we are able to find the corresponding symbol and then the corresponding string to compare against the requested symbol names, and if there is a match, we replace the pointer in the section with the replacement. - -The process of looking up the name of a given entry in the lazy or non-lazy pointer tables looks like this: -![Visual explanation](http://i.imgur.com/HVXqHCz.png) \ No newline at end of file diff --git a/Libraries/fishhook/fishhook.c b/Libraries/fishhook/fishhook.c deleted file mode 100755 index 205ee82b3b03ed..00000000000000 --- a/Libraries/fishhook/fishhook.c +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#import "fishhook.h" - -#import -#import -#import -#import -#import -#import -#import - -#ifdef __LP64__ -typedef struct mach_header_64 mach_header_t; -typedef struct segment_command_64 segment_command_t; -typedef struct section_64 section_t; -typedef struct nlist_64 nlist_t; -#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64 -#else -typedef struct mach_header mach_header_t; -typedef struct segment_command segment_command_t; -typedef struct section section_t; -typedef struct nlist nlist_t; -#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT -#endif - -#ifndef SEG_DATA_CONST -#define SEG_DATA_CONST "__DATA_CONST" -#endif - -struct rebindings_entry { - struct rebinding *rebindings; - size_t rebindings_nel; - struct rebindings_entry *next; -}; - -static struct rebindings_entry *_rebindings_head; - -static int prepend_rebindings(struct rebindings_entry **rebindings_head, - struct rebinding rebindings[], - size_t nel) { - struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry)); - if (!new_entry) { - return -1; - } - new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel); - if (!new_entry->rebindings) { - free(new_entry); - return -1; - } - memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel); - new_entry->rebindings_nel = nel; - new_entry->next = *rebindings_head; - *rebindings_head = new_entry; - return 0; -} - -static void perform_rebinding_with_section(struct rebindings_entry *rebindings, - section_t *section, - intptr_t slide, - nlist_t *symtab, - char *strtab, - uint32_t *indirect_symtab) { - uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1; - void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr); - for (uint i = 0; i < section->size / sizeof(void *); i++) { - uint32_t symtab_index = indirect_symbol_indices[i]; - if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL || - symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) { - continue; - } - uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx; - char *symbol_name = strtab + strtab_offset; - if (strnlen(symbol_name, 2) < 2) { - continue; - } - struct rebindings_entry *cur = rebindings; - while (cur) { - for (uint j = 0; j < cur->rebindings_nel; j++) { - if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) { - if (cur->rebindings[j].replaced != NULL && - indirect_symbol_bindings[i] != cur->rebindings[j].replacement) { - *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; - } - indirect_symbol_bindings[i] = cur->rebindings[j].replacement; - goto symbol_loop; - } - } - cur = cur->next; - } - symbol_loop:; - } -} - -static void rebind_symbols_for_image(struct rebindings_entry *rebindings, - const struct mach_header *header, - intptr_t slide) { - Dl_info info; - if (dladdr(header, &info) == 0) { - return; - } - - segment_command_t *cur_seg_cmd; - segment_command_t *linkedit_segment = NULL; - struct symtab_command* symtab_cmd = NULL; - struct dysymtab_command* dysymtab_cmd = NULL; - - uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t); - for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { - cur_seg_cmd = (segment_command_t *)cur; - if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { - if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) { - linkedit_segment = cur_seg_cmd; - } - } else if (cur_seg_cmd->cmd == LC_SYMTAB) { - symtab_cmd = (struct symtab_command*)cur_seg_cmd; - } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) { - dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd; - } - } - - if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment || - !dysymtab_cmd->nindirectsyms) { - return; - } - - // Find base symbol/string table addresses - uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff; - nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff); - char *strtab = (char *)(linkedit_base + symtab_cmd->stroff); - - // Get indirect symbol table (array of uint32_t indices into symbol table) - uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff); - - cur = (uintptr_t)header + sizeof(mach_header_t); - for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { - cur_seg_cmd = (segment_command_t *)cur; - if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { - if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 && - strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) { - continue; - } - for (uint j = 0; j < cur_seg_cmd->nsects; j++) { - section_t *sect = - (section_t *)(cur + sizeof(segment_command_t)) + j; - if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) { - perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); - } - if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) { - perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); - } - } - } - } -} - -static void _rebind_symbols_for_image(const struct mach_header *header, - intptr_t slide) { - rebind_symbols_for_image(_rebindings_head, header, slide); -} - -int rebind_symbols_image(void *header, - intptr_t slide, - struct rebinding rebindings[], - size_t rebindings_nel) { - struct rebindings_entry *rebindings_head = NULL; - int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel); - rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide); - free(rebindings_head); - return retval; -} - -int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) { - int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel); - if (retval < 0) { - return retval; - } - // If this was the first call, register callback for image additions (which is also invoked for - // existing images, otherwise, just run on existing images - if (!_rebindings_head->next) { - _dyld_register_func_for_add_image(_rebind_symbols_for_image); - } else { - uint32_t c = _dyld_image_count(); - for (uint32_t i = 0; i < c; i++) { - _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i)); - } - } - return retval; -} diff --git a/Libraries/fishhook/fishhook.h b/Libraries/fishhook/fishhook.h deleted file mode 100755 index 0d8e36a990cf28..00000000000000 --- a/Libraries/fishhook/fishhook.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef fishhook_h -#define fishhook_h - -#include -#include - -#if !defined(FISHHOOK_EXPORT) -#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden"))) -#else -#define FISHHOOK_VISIBILITY __attribute__((visibility("default"))) -#endif - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -/* - * A structure representing a particular intended rebinding from a symbol - * name to its replacement - */ -struct rebinding { - const char *name; - void *replacement; - void **replaced; -}; - -/* - * For each rebinding in rebindings, rebinds references to external, indirect - * symbols with the specified name to instead point at replacement for each - * image in the calling process as well as for all future images that are loaded - * by the process. If rebind_functions is called more than once, the symbols to - * rebind are added to the existing list of rebindings, and if a given symbol - * is rebound more than once, the later rebinding will take precedence. - */ -FISHHOOK_VISIBILITY -int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel); - -/* - * Rebinds as above, but only in the specified image. The header should point - * to the mach-o header, the slide should be the slide offset. Others as above. - */ -FISHHOOK_VISIBILITY -int rebind_symbols_image(void *header, - intptr_t slide, - struct rebinding rebindings[], - size_t rebindings_nel); - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //fishhook_h - diff --git a/Libraries/polyfills/console.js b/Libraries/polyfills/console.js index a0ca8523656296..f1a1db139f59b8 100644 --- a/Libraries/polyfills/console.js +++ b/Libraries/polyfills/console.js @@ -42,6 +42,7 @@ const inspect = (function() { function inspect(obj, opts) { var ctx = { seen: [], + formatValueCalls: 0, stylize: stylizeNoColor, }; return formatValue(ctx, obj, opts.depth); @@ -62,6 +63,13 @@ const inspect = (function() { } function formatValue(ctx, value, recurseTimes) { + ctx.formatValueCalls++; + if (ctx.formatValueCalls > 200) { + return `[TOO BIG formatValueCalls ${ + ctx.formatValueCalls + } exceeded limit of 200]`; + } + // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { @@ -549,6 +557,11 @@ if (global.nativeLoggingHook) { assert: consoleAssertPolyfill, }; + Object.defineProperty(console, '_isPolyfilled', { + value: true, + enumerable: false, + }); + // If available, also call the original `console` method since that is // sometimes useful. Ex: on OS X, this will let you see rich output in // the Safari Web Inspector console. @@ -601,4 +614,9 @@ if (global.nativeLoggingHook) { debug: log, table: log, }; + + Object.defineProperty(console, '_isPolyfilled', { + value: true, + enumerable: false, + }); } diff --git a/Libraries/polyfills/error-guard.js b/Libraries/polyfills/error-guard.js index 48ccc57933946e..5b968d18a35e4b 100644 --- a/Libraries/polyfills/error-guard.js +++ b/Libraries/polyfills/error-guard.js @@ -5,18 +5,24 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow strict * @polyfill - * @nolint */ let _inGuard = 0; +type ErrorHandler = (error: mixed, isFatal: boolean) => void; +type Fn = (...Args) => Return; + /** * This is the error handler that is called when we encounter an exception * when loading a module. This will report any errors encountered before * ExceptionsManager is configured. */ -let _globalHandler = function onError(e) { +let _globalHandler: ErrorHandler = function onError( + e: mixed, + isFatal: boolean, +) { throw e; }; @@ -29,21 +35,31 @@ let _globalHandler = function onError(e) { * set) globally before requiring anything. */ const ErrorUtils = { - setGlobalHandler(fun) { + setGlobalHandler(fun: ErrorHandler): void { _globalHandler = fun; }, - getGlobalHandler() { + getGlobalHandler(): ErrorHandler { return _globalHandler; }, - reportError(error) { - _globalHandler && _globalHandler(error); + reportError(error: mixed): void { + _globalHandler && _globalHandler(error, false); }, - reportFatalError(error) { + reportFatalError(error: mixed): void { + // NOTE: This has an untyped call site in Metro. _globalHandler && _globalHandler(error, true); }, - applyWithGuard(fun, context, args) { + applyWithGuard, TOut>( + fun: Fn, + context?: ?mixed, + args?: ?TArgs, + // Unused, but some code synced from www sets it to null. + unused_onError?: null, + // Some callers pass a name here, which we ignore. + unused_name?: ?string, + ): ?TOut { try { _inGuard++; + // $FlowFixMe: TODO T48204745 (1) apply(context, null) is fine. (2) array -> rest array should work return fun.apply(context, args); } catch (e) { ErrorUtils.reportError(e); @@ -52,30 +68,41 @@ const ErrorUtils = { } return null; }, - applyWithGuardIfNeeded(fun, context, args) { + applyWithGuardIfNeeded, TOut>( + fun: Fn, + context?: ?mixed, + args?: ?TArgs, + ): ?TOut { if (ErrorUtils.inGuard()) { + // $FlowFixMe: TODO T48204745 (1) apply(context, null) is fine. (2) array -> rest array should work return fun.apply(context, args); } else { ErrorUtils.applyWithGuard(fun, context, args); } return null; }, - inGuard() { - return _inGuard; + inGuard(): boolean { + return !!_inGuard; }, - guard(fun, name, context) { + guard, TOut>( + fun: Fn, + name?: ?string, + context?: ?mixed, + ): ?(...TArgs) => ?TOut { + // TODO: (moti) T48204753 Make sure this warning is never hit and remove it - types + // should be sufficient. if (typeof fun !== 'function') { console.warn('A function must be passed to ErrorUtils.guard, got ', fun); return null; } - name = name || fun.name || ''; - function guarded() { + const guardName = name ?? fun.name ?? ''; + function guarded(...args: TArgs): ?TOut { return ErrorUtils.applyWithGuard( fun, - context || this, - arguments, + context ?? this, + args, null, - name, + guardName, ); } @@ -84,3 +111,5 @@ const ErrorUtils = { }; global.ErrorUtils = ErrorUtils; + +export type ErrorUtilsT = typeof ErrorUtils; diff --git a/Libraries/react-native/react-native-implementation.js b/Libraries/react-native/react-native-implementation.js index 94188dcf3744a3..720b81155f2ad4 100644 --- a/Libraries/react-native/react-native-implementation.js +++ b/Libraries/react-native/react-native-implementation.js @@ -11,22 +11,28 @@ 'use strict'; const invariant = require('invariant'); -const warnOnce = require('warnOnce'); +const warnOnce = require('../Utilities/warnOnce'); // Export React, plus some native additions. module.exports = { // Components get AccessibilityInfo() { - return require('AccessibilityInfo'); + return require('../Components/AccessibilityInfo/AccessibilityInfo'); }, get ActivityIndicator() { - return require('ActivityIndicator'); + return require('../Components/ActivityIndicator/ActivityIndicator'); }, get ART() { - return require('ReactNativeART'); + warnOnce( + 'art-moved', + 'React Native ART has been extracted from react-native core and will be removed in a future release. ' + + "It can now be installed and imported from '@react-native-community/art' instead of 'react-native'. " + + 'See https://github.com/react-native-community/art', + ); + return require('../ART/ReactNativeART'); }, get Button() { - return require('Button'); + return require('../Components/Button'); }, get CheckBox() { warnOnce( @@ -35,47 +41,34 @@ module.exports = { "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + 'See https://github.com/react-native-community/react-native-checkbox', ); - return require('CheckBox'); + return require('../Components/CheckBox/CheckBox'); }, get DatePickerIOS() { - return require('DatePickerIOS'); + warnOnce( + 'DatePickerIOS-merged', + 'DatePickerIOS has been merged with DatePickerAndroid and will be removed in a future release. ' + + "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-datetimepicker', + ); + return require('../Components/DatePicker/DatePickerIOS'); }, get DrawerLayoutAndroid() { - return require('DrawerLayoutAndroid'); + return require('../Components/DrawerAndroid/DrawerLayoutAndroid'); }, get FlatList() { - return require('FlatList'); + return require('../Lists/FlatList'); }, get Image() { - return require('Image'); + return require('../Image/Image'); }, get ImageBackground() { - return require('ImageBackground'); - }, - get ImageEditor() { - warnOnce( - 'image-editor-moved', - 'Image Editor has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/image-editor' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-image-editor', - ); - return require('ImageEditor'); - }, - get ImageStore() { - warnOnce( - 'imagestore-deprecation', - 'ImageStore is deprecated and will be removed in a future release. ' + - 'To get a base64-encoded string from a local image use either of the following third-party libraries:' + - "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" + - "* react-native-fs: `readFile(filepath, 'base64')`", - ); - return require('ImageStore'); + return require('../Image/ImageBackground'); }, get InputAccessoryView() { - return require('InputAccessoryView'); + return require('../Components/TextInput/InputAccessoryView'); }, get KeyboardAvoidingView() { - return require('KeyboardAvoidingView'); + return require('../Components/Keyboard/KeyboardAvoidingView'); }, get MaskedViewIOS() { warnOnce( @@ -84,34 +77,34 @@ module.exports = { "It can now be installed and imported from '@react-native-community/masked-view' instead of 'react-native'. " + 'See https://github.com/react-native-community/react-native-masked-view', ); - return require('MaskedViewIOS'); + return require('../Components/MaskedView/MaskedViewIOS'); }, get Modal() { - return require('Modal'); + return require('../Modal/Modal'); }, get Picker() { - return require('Picker'); + return require('../Components/Picker/Picker'); }, get PickerIOS() { - return require('PickerIOS'); + return require('../Components/Picker/PickerIOS'); }, get ProgressBarAndroid() { - return require('ProgressBarAndroid'); + return require('../Components/ProgressBarAndroid/ProgressBarAndroid'); }, get ProgressViewIOS() { - return require('ProgressViewIOS'); + return require('../Components/ProgressViewIOS/ProgressViewIOS'); }, get SafeAreaView() { - return require('SafeAreaView'); + return require('../Components/SafeAreaView/SafeAreaView'); }, get ScrollView() { - return require('ScrollView'); + return require('../Components/ScrollView/ScrollView'); }, get SectionList() { - return require('SectionList'); + return require('../Lists/SectionList'); }, get SegmentedControlIOS() { - return require('SegmentedControlIOS'); + return require('../Components/SegmentedControlIOS/SegmentedControlIOS'); }, get Slider() { warnOnce( @@ -120,151 +113,147 @@ module.exports = { "It can now be installed and imported from '@react-native-community/slider' instead of 'react-native'. " + 'See https://github.com/react-native-community/react-native-slider', ); - return require('Slider'); + return require('../Components/Slider/Slider'); }, get Switch() { - return require('Switch'); + return require('../Components/Switch/Switch'); }, get RefreshControl() { - return require('RefreshControl'); + return require('../Components/RefreshControl/RefreshControl'); }, get StatusBar() { - return require('StatusBar'); + return require('../Components/StatusBar/StatusBar'); }, get Text() { - return require('Text'); + return require('../Text/Text'); }, get TextInput() { - return require('TextInput'); - }, - get ToolbarAndroid() { - return require('ToolbarAndroid'); + return require('../Components/TextInput/TextInput'); }, get Touchable() { - return require('Touchable'); + return require('../Components/Touchable/Touchable'); }, get TouchableHighlight() { - return require('TouchableHighlight'); + return require('../Components/Touchable/TouchableHighlight'); }, get TouchableNativeFeedback() { - return require('TouchableNativeFeedback'); + return require('../Components/Touchable/TouchableNativeFeedback'); }, get TouchableOpacity() { - return require('TouchableOpacity'); + return require('../Components/Touchable/TouchableOpacity'); }, get TouchableWithoutFeedback() { - return require('TouchableWithoutFeedback'); + return require('../Components/Touchable/TouchableWithoutFeedback'); }, get View() { - return require('View'); - }, - get ViewPagerAndroid() { - warnOnce( - 'viewpager-moved', - 'ViewPagerAndroid has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-viewpager', - ); - return require('ViewPagerAndroid'); + return require('../Components/View/View'); }, get VirtualizedList() { - return require('VirtualizedList'); + return require('../Lists/VirtualizedList'); }, get VirtualizedSectionList() { - return require('VirtualizedSectionList'); + return require('../Lists/VirtualizedSectionList'); }, // APIs get ActionSheetIOS() { - return require('ActionSheetIOS'); + return require('../ActionSheetIOS/ActionSheetIOS'); }, get Alert() { - return require('Alert'); + return require('../Alert/Alert'); }, + // [TODO(macOS ISS#2323203) get AlertMacOS() { - return require('AlertMacOS'); - }, + return require('../Alert/AlertMacOS'); + }, // ]TODO(macOS ISS#2323203) get Animated() { - return require('Animated'); + return require('../Animated/src/Animated'); }, get AppRegistry() { - return require('AppRegistry'); + return require('../ReactNative/AppRegistry'); }, get AppState() { - return require('AppState'); + return require('../AppState/AppState'); }, get AsyncStorage() { warnOnce( 'async-storage-moved', - 'Async Storage has been extracted from react-native core and will be removed in a future release. ' + + 'AsyncStorage has been extracted from react-native core and will be removed in a future release. ' + "It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. " + 'See https://github.com/react-native-community/react-native-async-storage', ); - return require('AsyncStorage'); + return require('../Storage/AsyncStorage'); }, get BackHandler() { - return require('BackHandler'); - }, - get CameraRoll() { - warnOnce( - 'cameraroll-moved', - 'CameraRoll has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/cameraroll' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-cameraroll', - ); - return require('CameraRoll'); + return require('../Utilities/BackHandler'); }, get Clipboard() { - return require('Clipboard'); + return require('../Components/Clipboard/Clipboard'); }, get DatePickerAndroid() { - return require('DatePickerAndroid'); + warnOnce( + 'DatePickerAndroid-merged', + 'DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release. ' + + "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-datetimepicker', + ); + return require('../Components/DatePickerAndroid/DatePickerAndroid'); }, // [TODO(macOS ISS#2323203) get DatePickerMacOS() { - return require('DatePickerMacOS'); + return require('../Components/DatePickerMacOS/DatePickerMacOS'); }, // ]TODO(macOS ISS#2323203) get DeviceInfo() { - return require('DeviceInfo'); + return require('../Utilities/DeviceInfo'); }, get Dimensions() { - return require('Dimensions'); + return require('../Utilities/Dimensions'); }, get Easing() { - return require('Easing'); + return require('../Animated/src/Easing'); }, get findNodeHandle() { - return require('ReactNative').findNodeHandle; + return require('../Renderer/shims/ReactNative').findNodeHandle; }, get I18nManager() { - return require('I18nManager'); + return require('../ReactNative/I18nManager'); }, get ImagePickerIOS() { - return require('ImagePickerIOS'); + warnOnce( + 'imagePickerIOS-moved', + 'ImagePickerIOS has been extracted from react-native core and will be removed in a future release. ' + + "Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " + + "If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " + + 'See https://github.com/react-native-community/react-native-image-picker-ios', + ); + return require('../Image/ImagePickerIOS'); }, get InteractionManager() { - return require('InteractionManager'); + return require('../Interaction/InteractionManager'); }, get Keyboard() { - return require('Keyboard'); + return require('../Components/Keyboard/Keyboard'); }, get LayoutAnimation() { - return require('LayoutAnimation'); + return require('../LayoutAnimation/LayoutAnimation'); }, get Linking() { - return require('Linking'); + return require('../Linking/Linking'); + }, + get NativeDialogManagerAndroid() { + return require('../NativeModules/specs/NativeDialogManagerAndroid').default; }, get NativeEventEmitter() { - return require('NativeEventEmitter'); + return require('../EventEmitter/NativeEventEmitter'); }, get PanResponder() { - return require('PanResponder'); + return require('../Interaction/PanResponder'); }, get PermissionsAndroid() { - return require('PermissionsAndroid'); + return require('../PermissionsAndroid/PermissionsAndroid'); }, get PixelRatio() { - return require('PixelRatio'); + return require('../Utilities/PixelRatio'); }, get PushNotificationIOS() { warnOnce( @@ -273,83 +262,99 @@ module.exports = { "It can now be installed and imported from '@react-native-community/push-notification-ios' instead of 'react-native'. " + 'See https://github.com/react-native-community/react-native-push-notification-ios', ); - return require('PushNotificationIOS'); + return require('../PushNotificationIOS/PushNotificationIOS'); }, get Settings() { - return require('Settings'); + return require('../Settings/Settings'); }, get Share() { - return require('Share'); + return require('../Share/Share'); }, get StatusBarIOS() { - return require('StatusBarIOS'); + warnOnce( + 'StatusBarIOS-merged', + 'StatusBarIOS has been merged with StatusBar and will be removed in a future release. Use StatusBar for mutating the status bar', + ); + return require('../Components/StatusBar/StatusBarIOS'); }, get StyleSheet() { - return require('StyleSheet'); + return require('../StyleSheet/StyleSheet'); }, get Systrace() { - return require('Systrace'); + return require('../Performance/Systrace'); }, get TimePickerAndroid() { - return require('TimePickerAndroid'); + warnOnce( + 'TimePickerAndroid-merged', + 'TimePickerAndroid has been merged with DatePickerIOS and DatePickerAndroid and will be removed in a future release. ' + + "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-datetimepicker', + ); + return require('../Components/TimePickerAndroid/TimePickerAndroid'); }, get ToastAndroid() { - return require('ToastAndroid'); + return require('../Components/ToastAndroid/ToastAndroid'); }, get TurboModuleRegistry() { - return require('TurboModuleRegistry'); + return require('../TurboModule/TurboModuleRegistry'); }, get TVEventHandler() { - return require('TVEventHandler'); + return require('../Components/AppleTV/TVEventHandler'); }, get UIManager() { - return require('UIManager'); + return require('../ReactNative/UIManager'); }, get unstable_batchedUpdates() { - return require('ReactNative').unstable_batchedUpdates; + return require('../Renderer/shims/ReactNative').unstable_batchedUpdates; + }, + get useWindowDimensions() { + return require('../Utilities/useWindowDimensions').default; }, get UTFSequence() { - return require('UTFSequence'); + return require('../UTFSequence'); }, get Vibration() { - return require('Vibration'); + return require('../Vibration/Vibration'); }, get YellowBox() { - return require('YellowBox'); + return require('../YellowBox/YellowBox'); }, // Plugins get DeviceEventEmitter() { - return require('RCTDeviceEventEmitter'); + return require('../EventEmitter/RCTDeviceEventEmitter'); }, get NativeAppEventEmitter() { - return require('RCTNativeAppEventEmitter'); + return require('../EventEmitter/RCTNativeAppEventEmitter'); }, get NativeModules() { - return require('NativeModules'); + return require('../BatchedBridge/NativeModules'); }, get Platform() { - return require('Platform'); + return require('../Utilities/Platform'); }, get processColor() { - return require('processColor'); + return require('../StyleSheet/processColor'); }, get requireNativeComponent() { - return require('requireNativeComponent'); + return require('../ReactNative/requireNativeComponent'); + }, + get unstable_RootTagContext() { + return require('../ReactNative/RootTagContext'); }, // Prop Types get ColorPropType() { - return require('DeprecatedColorPropType'); + return require('../DeprecatedPropTypes/DeprecatedColorPropType'); }, get EdgeInsetsPropType() { - return require('DeprecatedEdgeInsetsPropType'); + return require('../DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'); }, get PointPropType() { - return require('DeprecatedPointPropType'); + return require('../DeprecatedPropTypes/DeprecatedPointPropType'); }, get ViewPropTypes() { - return require('DeprecatedViewPropTypes'); + return require('../DeprecatedPropTypes/DeprecatedViewPropTypes'); }, }; @@ -392,4 +397,70 @@ if (__DEV__) { ); }, }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access NetInfo. + Object.defineProperty(module.exports, 'NetInfo', { + configurable: true, + get() { + invariant( + false, + 'NetInfo has been removed from React Native. ' + + "It can now be installed and imported from 'react-native-netinfo' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-netinfo', + ); + }, + }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access CameraRoll. + Object.defineProperty(module.exports, 'CameraRoll', { + configurable: true, + get() { + invariant( + false, + 'CameraRoll has been removed from React Native. ' + + "It can now be installed and imported from 'react-native-cameraroll' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-cameraroll', + ); + }, + }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access ImageStore. + Object.defineProperty(module.exports, 'ImageStore', { + configurable: true, + get() { + invariant( + false, + 'ImageStore has been removed from React Native. ' + + 'To get a base64-encoded string from a local image use either of the following third-party libraries:' + + "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" + + "* react-native-fs: `readFile(filepath, 'base64')`", + ); + }, + }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access ImageEditor. + Object.defineProperty(module.exports, 'ImageEditor', { + configurable: true, + get() { + invariant( + false, + 'ImageEditor has been removed from React Native. ' + + "It can now be installed and imported from 'react-native-image-editor' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-image-editor', + ); + }, + }); + + // $FlowFixMe This is intentional: Flow will error when attempting to access ViewPagerAndroid. + Object.defineProperty(module.exports, 'ViewPagerAndroid', { + configurable: true, + get() { + invariant( + false, + 'ViewPagerAndroid has been removed from React Native. ' + + "It can now be installed and imported from 'react-native-viewpager' instead of 'react-native'. " + + 'See https://github.com/react-native-community/react-native-viewpager', + ); + }, + }); } diff --git a/Libraries/vendor/core/ErrorUtils.js b/Libraries/vendor/core/ErrorUtils.js index a54b855244d282..0c0f140280a4ba 100644 --- a/Libraries/vendor/core/ErrorUtils.js +++ b/Libraries/vendor/core/ErrorUtils.js @@ -8,7 +8,7 @@ * @flow strict */ -/* eslint-disable strict */ +import type {ErrorUtilsT} from '../../polyfills/error-guard.js'; /** * The particular require runtime that we are using looks for a global @@ -22,4 +22,4 @@ * that use it aren't just using a global variable, so simply export the global * variable here. ErrorUtils is originally defined in a file named error-guard.js. */ -module.exports = global.ErrorUtils; +module.exports = (global.ErrorUtils: ErrorUtilsT); diff --git a/Libraries/vendor/core/Map.js b/Libraries/vendor/core/Map.js deleted file mode 100644 index 4f23b1f4783ab8..00000000000000 --- a/Libraries/vendor/core/Map.js +++ /dev/null @@ -1,590 +0,0 @@ -/** - * 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. - * - * @format - * @preventMunge - * @typechecks - */ - -/* eslint-disable no-extend-native, no-shadow-restricted-names */ - -'use strict'; - -const _shouldPolyfillES6Collection = require('./_shouldPolyfillES6Collection'); -const guid = require('./guid'); -const toIterator = require('./toIterator'); - -module.exports = (function(global, undefined) { - // Since our implementation is spec-compliant for the most part we can safely - // delegate to a built-in version if exists and is implemented correctly. - // Firefox had gotten a few implementation details wrong across different - // versions so we guard against that. - if (!_shouldPolyfillES6Collection('Map')) { - return global.Map; - } - - const hasOwn = Object.prototype.hasOwnProperty; - - /** - * == ES6 Map Collection == - * - * This module is meant to implement a Map collection as described in chapter - * 23.1 of the ES6 specification. - * - * Map objects are collections of key/value pairs where both the keys and - * values may be arbitrary ECMAScript language values. A distinct key value - * may only occur in one key/value pair within the Map's collection. - * - * https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects - * - * There only two -- rather small -- deviations from the spec: - * - * 1. The use of untagged frozen objects as keys. - * We decided not to allow and simply throw an error, because this - * implementation of Map works by tagging objects used as Map keys - * with a secret hash property for fast access to the object's place - * in the internal _mapData array. However, to limit the impact of - * this spec deviation, Libraries/Core/InitializeCore.js also wraps - * Object.freeze, Object.seal, and Object.preventExtensions so that - * they tag objects before making them non-extensible, by inserting - * each object into a Map and then immediately removing it. - * - * 2. The `size` property on a map object is a regular property and not a - * computed property on the prototype as described by the spec. - * The reason being is that we simply want to support ES3 environments - * which doesn't implement computed properties. - * - * == Usage == - * - * var map = new Map(iterable); - * - * map.set(key, value); - * map.get(key); // value - * map.has(key); // true - * map.delete(key); // true - * - * var iterator = map.keys(); - * iterator.next(); // {value: key, done: false} - * - * var iterator = map.values(); - * iterator.next(); // {value: value, done: false} - * - * var iterator = map.entries(); - * iterator.next(); // {value: [key, value], done: false} - * - * map.forEach(function(value, key){ this === thisArg }, thisArg); - * - * map.clear(); // resets map. - */ - - /** - * Constants - */ - - // Kinds of map iterations 23.1.5.3 - const KIND_KEY = 'key'; - const KIND_VALUE = 'value'; - const KIND_KEY_VALUE = 'key+value'; - - // In older browsers we can't create a null-prototype object so we have to - // defend against key collisions with built-in methods. - const KEY_PREFIX = '$map_'; - - // This property will be used as the internal size variable to disallow - // writing and to issue warnings for writings in development. - let SECRET_SIZE_PROP; - if (__DEV__) { - SECRET_SIZE_PROP = '$size' + guid(); - } - - class Map { - /** - * 23.1.1.1 - * Takes an `iterable` which is basically any object that implements a - * Symbol.iterator (@@iterator) method. The iterable is expected to be a - * collection of pairs. Each pair is a key/value pair that will be used - * to instantiate the map. - * - * @param {*} iterable - */ - constructor(iterable) { - if (!isObject(this)) { - throw new TypeError('Wrong map object type.'); - } - - initMap(this); - - if (iterable != null) { - const it = toIterator(iterable); - let next; - while (!(next = it.next()).done) { - if (!isObject(next.value)) { - throw new TypeError('Expected iterable items to be pair objects.'); - } - this.set(next.value[0], next.value[1]); - } - } - } - - /** - * 23.1.3.1 - * Clears the map from all keys and values. - */ - clear() { - initMap(this); - } - - /** - * 23.1.3.7 - * Check if a key exists in the collection. - * - * @param {*} key - * @return {boolean} - */ - has(key) { - const index = getIndex(this, key); - return !!(index != null && this._mapData[index]); - } - - /** - * 23.1.3.9 - * Adds a key/value pair to the collection. - * - * @param {*} key - * @param {*} value - * @return {map} - */ - set(key, value) { - let index = getIndex(this, key); - - if (index != null && this._mapData[index]) { - this._mapData[index][1] = value; - } else { - index = this._mapData.push([key, value]) - 1; - setIndex(this, key, index); - if (__DEV__) { - this[SECRET_SIZE_PROP] += 1; - } else { - this.size += 1; - } - } - - return this; - } - - /** - * 23.1.3.6 - * Gets a value associated with a key in the collection. - * - * @param {*} key - * @return {*} - */ - get(key) { - const index = getIndex(this, key); - if (index == null) { - return undefined; - } else { - return this._mapData[index][1]; - } - } - - /** - * 23.1.3.3 - * Delete a key/value from the collection. - * - * @param {*} key - * @return {boolean} Whether the key was found and deleted. - */ - delete(key) { - const index = getIndex(this, key); - if (index != null && this._mapData[index]) { - setIndex(this, key, undefined); - this._mapData[index] = undefined; - if (__DEV__) { - this[SECRET_SIZE_PROP] -= 1; - } else { - this.size -= 1; - } - return true; - } else { - return false; - } - } - - /** - * 23.1.3.4 - * Returns an iterator over the key/value pairs (in the form of an Array) in - * the collection. - * - * @return {MapIterator} - */ - entries() { - return new MapIterator(this, KIND_KEY_VALUE); - } - - /** - * 23.1.3.8 - * Returns an iterator over the keys in the collection. - * - * @return {MapIterator} - */ - keys() { - return new MapIterator(this, KIND_KEY); - } - - /** - * 23.1.3.11 - * Returns an iterator over the values pairs in the collection. - * - * @return {MapIterator} - */ - values() { - return new MapIterator(this, KIND_VALUE); - } - - /** - * 23.1.3.5 - * Iterates over the key/value pairs in the collection calling `callback` - * with [value, key, map]. An optional `thisArg` can be passed to set the - * context when `callback` is called. - * - * @param {function} callback - * @param {?object} thisArg - */ - forEach(callback, thisArg) { - if (typeof callback !== 'function') { - throw new TypeError('Callback must be callable.'); - } - - const boundCallback = callback.bind(thisArg || undefined); - const mapData = this._mapData; - - // Note that `mapData.length` should be computed on each iteration to - // support iterating over new items in the map that were added after the - // start of the iteration. - for (let i = 0; i < mapData.length; i++) { - const entry = mapData[i]; - if (entry != null) { - boundCallback(entry[1], entry[0], this); - } - } - } - } - - // 23.1.3.12 - Map.prototype[toIterator.ITERATOR_SYMBOL] = Map.prototype.entries; - - class MapIterator { - /** - * 23.1.5.1 - * Create a `MapIterator` for a given `map`. While this class is private it - * will create objects that will be passed around publicily. - * - * @param {map} map - * @param {string} kind - */ - constructor(map, kind) { - if (!(isObject(map) && map._mapData)) { - throw new TypeError('Object is not a map.'); - } - - if ([KIND_KEY, KIND_KEY_VALUE, KIND_VALUE].indexOf(kind) === -1) { - throw new Error('Invalid iteration kind.'); - } - - this._map = map; - this._nextIndex = 0; - this._kind = kind; - } - - /** - * 23.1.5.2.1 - * Get the next iteration. - * - * @return {object} - */ - next() { - if (!this instanceof Map) { - throw new TypeError('Expected to be called on a MapIterator.'); - } - - const map = this._map; - let index = this._nextIndex; - const kind = this._kind; - - if (map == null) { - return createIterResultObject(undefined, true); - } - - const entries = map._mapData; - - while (index < entries.length) { - const record = entries[index]; - - index += 1; - this._nextIndex = index; - - if (record) { - if (kind === KIND_KEY) { - return createIterResultObject(record[0], false); - } else if (kind === KIND_VALUE) { - return createIterResultObject(record[1], false); - } else if (kind) { - return createIterResultObject(record, false); - } - } - } - - this._map = undefined; - - return createIterResultObject(undefined, true); - } - } - - // We can put this in the class definition once we have computed props - // transform. - // 23.1.5.2.2 - MapIterator.prototype[toIterator.ITERATOR_SYMBOL] = function() { - return this; - }; - - /** - * Helper Functions. - */ - - /** - * Return an index to map.[[MapData]] array for a given Key. - * - * @param {map} map - * @param {*} key - * @return {?number} - */ - function getIndex(map, key) { - if (isObject(key)) { - const hash = getHash(key); - return map._objectIndex[hash]; - } else { - const prefixedKey = KEY_PREFIX + key; - if (typeof key === 'string') { - return map._stringIndex[prefixedKey]; - } else { - return map._otherIndex[prefixedKey]; - } - } - } - - /** - * Setup an index that refer to the key's location in map.[[MapData]]. - * - * @param {map} map - * @param {*} key - */ - function setIndex(map, key, index) { - const shouldDelete = index == null; - - if (isObject(key)) { - const hash = getHash(key); - if (shouldDelete) { - delete map._objectIndex[hash]; - } else { - map._objectIndex[hash] = index; - } - } else { - const prefixedKey = KEY_PREFIX + key; - if (typeof key === 'string') { - if (shouldDelete) { - delete map._stringIndex[prefixedKey]; - } else { - map._stringIndex[prefixedKey] = index; - } - } else { - if (shouldDelete) { - delete map._otherIndex[prefixedKey]; - } else { - map._otherIndex[prefixedKey] = index; - } - } - } - } - - /** - * Instantiate a map with internal slots. - * - * @param {map} map - */ - function initMap(map) { - // Data structure design inspired by Traceur's Map implementation. - // We maintain an internal array for all the entries. The array is needed - // to remember order. However, to have a reasonable HashMap performance - // i.e. O(1) for insertion, deletion, and retrieval. We maintain indices - // in objects for fast look ups. Indices are split up according to data - // types to avoid collisions. - map._mapData = []; - - // Object index maps from an object "hash" to index. The hash being a unique - // property of our choosing that we associate with the object. Association - // is done by ways of keeping a non-enumerable property on the object. - // Ideally these would be `Object.create(null)` objects but since we're - // trying to support ES3 we'll have to guard against collisions using - // prefixes on the keys rather than rely on null prototype objects. - map._objectIndex = {}; - - // String index maps from strings to index. - map._stringIndex = {}; - - // Numbers, booleans, undefined, and null. - map._otherIndex = {}; - - // Unfortunately we have to support ES3 and cannot have `Map.prototype.size` - // be a getter method but just a regular method. The biggest problem with - // this is safety. Clients can change the size property easily and possibly - // without noticing (e.g. `if (map.size = 1) {..}` kind of typo). What we - // can do to mitigate use getters and setters in development to disallow - // and issue a warning for changing the `size` property. - if (__DEV__) { - if (isES5) { - // If the `SECRET_SIZE_PROP` property is already defined then we're not - // in the first call to `initMap` (e.g. coming from `map.clear()`) so - // all we need to do is reset the size without defining the properties. - if (hasOwn.call(map, SECRET_SIZE_PROP)) { - map[SECRET_SIZE_PROP] = 0; - } else { - Object.defineProperty(map, SECRET_SIZE_PROP, { - value: 0, - writable: true, - }); - Object.defineProperty(map, 'size', { - set: v => { - console.error( - 'PLEASE FIX ME: You are changing the map size property which ' + - 'should not be writable and will break in production.', - ); - throw new Error('The map size property is not writable.'); - }, - get: () => map[SECRET_SIZE_PROP], - }); - } - - // NOTE: Early return to implement immutable `.size` in DEV. - return; - } - } - - // This is a diviation from the spec. `size` should be a getter on - // `Map.prototype`. However, we have to support IE8. - map.size = 0; - } - - /** - * Check if something is an object. - * - * @param {*} o - * @return {boolean} - */ - function isObject(o) { - return o != null && (typeof o === 'object' || typeof o === 'function'); - } - - /** - * Create an iteration object. - * - * @param {*} value - * @param {boolean} done - * @return {object} - */ - function createIterResultObject(value, done) { - return {value, done}; - } - - // Are we in a legit ES5 environment. Spoiler alert: that doesn't include IE8. - const isES5 = (function() { - try { - Object.defineProperty({}, 'x', {}); - return true; - } catch (e) { - return false; - } - })(); - - /** - * Check if an object can be extended. - * - * @param {object|array|function|regexp} o - * @return {boolean} - */ - function isExtensible(o) { - if (!isES5) { - return true; - } else { - return Object.isExtensible(o); - } - } - - const getHash = (function() { - const propIsEnumerable = Object.prototype.propertyIsEnumerable; - const hashProperty = '__MAP_POLYFILL_INTERNAL_HASH__'; - let hashCounter = 0; - - const nonExtensibleObjects = []; - const nonExtensibleHashes = []; - - /** - * Get the "hash" associated with an object. - * - * @param {object|array|function|regexp} o - * @return {number} - */ - return function getHash(o) { - if (hasOwn.call(o, hashProperty)) { - return o[hashProperty]; - } - - if (!isES5) { - if ( - hasOwn.call(o, 'propertyIsEnumerable') && - hasOwn.call(o.propertyIsEnumerable, hashProperty) - ) { - return o.propertyIsEnumerable[hashProperty]; - } - } - - if (isExtensible(o)) { - if (isES5) { - Object.defineProperty(o, hashProperty, { - enumerable: false, - writable: false, - configurable: false, - value: ++hashCounter, - }); - return hashCounter; - } - - if (o.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Additionally, since this is a function it - // will not show up in `JSON.stringify` which is what we want. - o.propertyIsEnumerable = function() { - return propIsEnumerable.apply(this, arguments); - }; - return (o.propertyIsEnumerable[hashProperty] = ++hashCounter); - } - } - - // If the object is not extensible, fall back to storing it in an - // array and using Array.prototype.indexOf to find it. - let index = nonExtensibleObjects.indexOf(o); - if (index < 0) { - index = nonExtensibleObjects.length; - nonExtensibleObjects[index] = o; - nonExtensibleHashes[index] = ++hashCounter; - } - return nonExtensibleHashes[index]; - }; - })(); - - return Map; -})(Function('return this')()); // eslint-disable-line no-new-func diff --git a/Libraries/vendor/core/Set.js b/Libraries/vendor/core/Set.js deleted file mode 100644 index 564f530b9afd8a..00000000000000 --- a/Libraries/vendor/core/Set.js +++ /dev/null @@ -1,198 +0,0 @@ -/** - * 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. - * - * @format - * @preventMunge - * @typechecks - */ - -/* eslint-disable no-extend-native */ - -'use strict'; - -const Map = require('./Map'); - -const _shouldPolyfillES6Collection = require('./_shouldPolyfillES6Collection'); -const toIterator = require('./toIterator'); - -module.exports = (function(global) { - // Since our implementation is spec-compliant for the most part we can safely - // delegate to a built-in version if exists and is implemented correctly. - // Firefox had gotten a few implementation details wrong across different - // versions so we guard against that. - // These checks are adapted from es6-shim https://fburl.com/34437854 - if (!_shouldPolyfillES6Collection('Set')) { - return global.Set; - } - - /** - * == ES6 Set Collection == - * - * This module is meant to implement a Set collection as described in chapter - * 23.2 of the ES6 specification. - * - * Set objects are collections of unique values. Where values can be any - * JavaScript value. - * https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects - * - * There only two -- rather small -- diviations from the spec: - * - * 1. The use of frozen objects as keys. @see Map module for more on this. - * - * 2. The `size` property on a map object is a regular property and not a - * computed property on the prototype as described by the spec. - * The reason being is that we simply want to support ES3 environments - * which doesn't implement computed properties. - * - * == Usage == - * - * var set = new set(iterable); - * - * set.set(value); - * set.has(value); // true - * set.delete(value); // true - * - * var iterator = set.keys(); - * iterator.next(); // {value: value, done: false} - * - * var iterator = set.values(); - * iterator.next(); // {value: value, done: false} - * - * var iterator = set.entries(); - * iterator.next(); // {value: [value, value], done: false} - * - * set.forEach(function(value, value){ this === thisArg }, thisArg); - * - * set.clear(); // resets set. - */ - - class Set { - /** - * 23.2.1.1 - * - * Takes an optional `iterable` (which is basically any object that - * implements a Symbol.iterator (@@iterator) method). That is a collection - * of values used to instantiate the set. - * - * @param {*} iterable - */ - constructor(iterable) { - if ( - this == null || - (typeof this !== 'object' && typeof this !== 'function') - ) { - throw new TypeError('Wrong set object type.'); - } - - initSet(this); - - if (iterable != null) { - const it = toIterator(iterable); - let next; - while (!(next = it.next()).done) { - this.add(next.value); - } - } - } - - /** - * 23.2.3.1 - * - * If it doesn't already exist in the collection a `value` is added. - * - * @param {*} value - * @return {set} - */ - add(value) { - this._map.set(value, value); - this.size = this._map.size; - return this; - } - - /** - * 23.2.3.2 - * - * Clears the set. - */ - clear() { - initSet(this); - } - - /** - * 23.2.3.4 - * - * Deletes a `value` from the collection if it exists. - * Returns true if the value was found and deleted and false otherwise. - * - * @param {*} value - * @return {boolean} - */ - delete(value) { - const ret = this._map.delete(value); - this.size = this._map.size; - return ret; - } - - /** - * 23.2.3.5 - * - * Returns an iterator over a collection of [value, value] tuples. - */ - entries() { - return this._map.entries(); - } - - /** - * 23.2.3.6 - * - * Iterate over the collection calling `callback` with (value, value, set). - * - * @param {function} callback - */ - forEach(callback) { - const thisArg = arguments[1]; - const it = this._map.keys(); - let next; - while (!(next = it.next()).done) { - callback.call(thisArg, next.value, next.value, this); - } - } - - /** - * 23.2.3.7 - * - * Iterate over the collection calling `callback` with (value, value, set). - * - * @param {*} value - * @return {boolean} - */ - has(value) { - return this._map.has(value); - } - - /** - * 23.2.3.7 - * - * Returns an iterator over the colleciton of values. - */ - values() { - return this._map.values(); - } - } - - // 23.2.3.11 - Set.prototype[toIterator.ITERATOR_SYMBOL] = Set.prototype.values; - - // 23.2.3.7 - Set.prototype.keys = Set.prototype.values; - - function initSet(set) { - set._map = new Map(); - set.size = set._map.size; - } - - return Set; -})(Function('return this')()); // eslint-disable-line no-new-func diff --git a/Libraries/vendor/core/_shouldPolyfillES6Collection.js b/Libraries/vendor/core/_shouldPolyfillES6Collection.js deleted file mode 100644 index 1ba893c5aebdbe..00000000000000 --- a/Libraries/vendor/core/_shouldPolyfillES6Collection.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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. - * - * @format - * @preventMunge - * @flow strict - */ - -'use strict'; - -/** - * Checks whether a collection name (e.g. "Map" or "Set") has a native polyfill - * that is safe to be used. - */ -function _shouldActuallyPolyfillES6Collection(collectionName: string): boolean { - const Collection = global[collectionName]; - if (Collection == null) { - return true; - } - - // The iterator protocol depends on `Symbol.iterator`. If a collection is - // implemented, but `Symbol` is not, it's going to break iteration because - // we'll be using custom "@@iterator" instead, which is not implemented on - // native collections. - if (typeof global.Symbol !== 'function') { - return true; - } - - const proto = Collection.prototype; - - // These checks are adapted from es6-shim: https://fburl.com/34437854 - // NOTE: `isCallableWithoutNew` and `!supportsSubclassing` are not checked - // because they make debugging with "break on exceptions" difficult. - return ( - Collection == null || - typeof Collection !== 'function' || - typeof proto.clear !== 'function' || - new Collection().size !== 0 || - typeof proto.keys !== 'function' || - typeof proto.forEach !== 'function' - ); -} - -const cache: {[name: string]: boolean} = {}; - -/** - * Checks whether a collection name (e.g. "Map" or "Set") has a native polyfill - * that is safe to be used and caches this result. - * Make sure to make a first call to this function before a corresponding - * property on global was overriden in any way. - */ -function _shouldPolyfillES6Collection(collectionName: string) { - let result = cache[collectionName]; - if (result !== undefined) { - return result; - } - - result = _shouldActuallyPolyfillES6Collection(collectionName); - cache[collectionName] = result; - return result; -} - -module.exports = _shouldPolyfillES6Collection; diff --git a/Libraries/vendor/emitter/EventEmitterWithHolding.js b/Libraries/vendor/emitter/EventEmitterWithHolding.js index 945506e3c0f182..c553dde0631358 100644 --- a/Libraries/vendor/emitter/EventEmitterWithHolding.js +++ b/Libraries/vendor/emitter/EventEmitterWithHolding.js @@ -49,14 +49,14 @@ class EventEmitterWithHolding { /** * @see EventEmitter#addListener */ - addListener(eventType: string, listener: Function, context: ?Object) { + addListener(eventType: string, listener: Function, context: ?Object): any { return this._emitter.addListener(eventType, listener, context); } /** * @see EventEmitter#once */ - once(eventType: string, listener: Function, context: ?Object) { + once(eventType: string, listener: Function, context: ?Object): any { return this._emitter.once(eventType, listener, context); } @@ -115,7 +115,7 @@ class EventEmitterWithHolding { /** * @see EventEmitter#listeners */ - listeners(eventType: string) /* TODO: Annotate return type here */ { + listeners(eventType: string): any /* TODO: Annotate return type here */ { return this._emitter.listeners(eventType); } diff --git a/Libraries/vendor/emitter/EventHolder.js b/Libraries/vendor/emitter/EventHolder.js index ea68ef9d784848..54728e753904d1 100644 --- a/Libraries/vendor/emitter/EventHolder.js +++ b/Libraries/vendor/emitter/EventHolder.js @@ -42,7 +42,10 @@ class EventHolder { * }); //logs 'abc' * */ - holdEvent(eventType: string, ...args: any) { + holdEvent( + eventType: string, + ...args: any + ): $TEMPORARY$object<{|eventType: string, index: $FlowFixMeEmpty|}> { this._heldEvents[eventType] = this._heldEvents[eventType] || []; const eventsOfType = this._heldEvents[eventType]; const key = { diff --git a/Libraries/vendor/emitter/EventValidator.js b/Libraries/vendor/emitter/EventValidator.js index 39bf3147bdfa48..429cc636237715 100644 --- a/Libraries/vendor/emitter/EventValidator.js +++ b/Libraries/vendor/emitter/EventValidator.js @@ -30,7 +30,7 @@ const EventValidator = { * const types = {someEvent: true, anotherEvent: true}; * const emitter = EventValidator.addValidation(emitter, types); */ - addValidation: function(emitter: Object, types: Object) { + addValidation: function(emitter: Object, types: Object): {emit: any => any} { const eventTypes = Object.keys(types); const emitterWithValidation = Object.create(emitter); diff --git a/README.md b/README.md index eb0dd2b602d231..86b98cb6ff5fe6 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ React Native is developed and supported by many companies and individual core co - [Documentation](#-documentation) - [Upgrading](#-upgrading) - [How to Contribute](#-how-to-contribute) -- [Code of Conduct](#-code-of-conduct) +- [Code of Conduct](#code-of-conduct) - [License](#-license) @@ -86,7 +86,6 @@ React Native is developed and supported by many companies and individual core co React Native apps may target iOS 9.0 and Android 4.1 (API 16) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like [Expo](https://expo.io) can be used to work around this. ## 🎉 Building your first React Native app ->>>>>>> v0.60.0 Follow the [Getting Started guide](https://facebook.github.io/react-native/docs/getting-started.html). The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios: diff --git a/RNTester/.gitignore b/RNTester/.gitignore deleted file mode 100644 index 389a2b20c85b1c..00000000000000 --- a/RNTester/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Pods/ diff --git a/RNTester/Gemfile b/RNTester/Gemfile new file mode 100644 index 00000000000000..81519cdc4d97da --- /dev/null +++ b/RNTester/Gemfile @@ -0,0 +1,4 @@ +# Gemfile +source 'https://rubygems.org' + +gem 'cocoapods', '= 1.7.1' diff --git a/RNTester/Podfile b/RNTester/Podfile index 7719e8865ae210..8d964494724c4f 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -42,26 +42,26 @@ require_relative '../scripts/autolink-ios' # FIXME: https://github.com/microsoft/react-native/issues/210 install! 'cocoapods', :deterministic_uuids => false -# TODO(macOS GH#214) -def pods() - # Uncomment for Swift - # use_frameworks! +if ENV['USE_FRAMEWORKS'] == '1' + puts "Installing pods with use_frameworks!" + use_frameworks! +end +def pods() project 'RNTesterPods.xcodeproj' - + # Enable TurboModule - use_react_native!(path: "..", turbo_modules_enabled: true) - pod 'React-turbomodule-samples', :path => '../ReactCommon/turbomodule/samples' + use_react_native!(path: "..") + pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon' # Additional Pods which aren't included in the default Podfile - pod 'React-RCTCameraRoll', :path => '../Libraries/CameraRoll' pod 'React-ART', :path => '../Libraries/ART' pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS' # Additional Pods which are classed as unstable # # To use fabric: add `fabric_enabled` option to the use_react_native method above, like below - # use_react_native!(path: "..", turbo_modules_enabled: true, fabric_enabled: true) + # use_react_native!(path: "..", fabric_enabled: true) end target 'RNTester' do @@ -69,32 +69,37 @@ target 'RNTester' do pods() end -target 'RNTesterUnitTests' do - platform :ios, '9.0' +target 'RNTester-macOS' do + platform :osx, '10.14' pods() - pod 'React-RCTTest', :path => "./RCTTest" end -target 'RNTesterIntegrationTests' do +target 'RNTesterUnitTests' do platform :ios, '9.0' pods() - pod 'React-RCTTest', :path => "./RCTTest" + pod 'React-RCTTest', :path => "RCTTest" end -# TODO(macOS GH#214) -target 'RNTester-macOS' do - platform :osx, '10.14' +target 'RNTesterIntegrationTests' do + platform :ios, '9.0' pods() + pod 'React-RCTTest', :path => "RCTTest" end target 'RNTester-macOSUnitTests' do platform :osx, '10.14' pods() - pod 'React-RCTTest', :path => "./RCTTest" + pod 'React-RCTTest', :path => "RCTTest" end target 'RNTester-macOSIntegrationTests' do platform :osx, '10.14' pods() - pod 'React-RCTTest', :path => "./RCTTest" + pod 'React-RCTTest', :path => "RCTTest" +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + puts target.name + end end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 5d70d302a10a1c..442e036662fbb5 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -1,6 +1,14 @@ PODS: - boost-for-react-native (1.63.0) - DoubleConversion (1.1.6) + - FBLazyVector (0.61.5-microsoft-fb61merge.1) + - FBReactNativeSpec (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - RCTRequired (= 0.61.5-microsoft-fb61merge.1) + - RCTTypeSafety (= 0.61.5-microsoft-fb61merge.1) + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) - Folly (2018.10.22.00): - boost-for-react-native - DoubleConversion @@ -11,171 +19,299 @@ PODS: - DoubleConversion - glog - glog (0.3.5) - - React (1000.0.0): - - React-Core (= 1000.0.0) - - React-DevSupport (= 1000.0.0) - - React-RCTActionSheet (= 1000.0.0) - - React-RCTAnimation (= 1000.0.0) - - React-RCTBlob (= 1000.0.0) - - React-RCTImage (= 1000.0.0) - - React-RCTLinking (= 1000.0.0) - - React-RCTNetwork (= 1000.0.0) - - React-RCTSettings (= 1000.0.0) - - React-RCTText (= 1000.0.0) - - React-RCTVibration (= 1000.0.0) - - React-RCTWebSocket (= 1000.0.0) - - React-ART (1000.0.0): - - React-Core (= 1000.0.0) - - React-Core (1000.0.0): - - Folly (= 2018.10.22.00) - - React-cxxreact (= 1000.0.0) - - React-jsiexecutor (= 1000.0.0) - - yoga (= 1000.0.0.React) - - React-cxxreact (1000.0.0): + - RCTRequired (0.61.5-microsoft-fb61merge.1) + - RCTTypeSafety (0.61.5-microsoft-fb61merge.1): + - FBLazyVector (= 0.61.5-microsoft-fb61merge.1) + - Folly (= 2018.10.22.00) + - RCTRequired (= 0.61.5-microsoft-fb61merge.1) + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React (0.61.5-microsoft-fb61merge.1): + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React-Core/DevSupport (= 0.61.5-microsoft-fb61merge.1) + - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) + - React-RCTActionSheet (= 0.61.5-microsoft-fb61merge.1) + - React-RCTAnimation (= 0.61.5-microsoft-fb61merge.1) + - React-RCTBlob (= 0.61.5-microsoft-fb61merge.1) + - React-RCTImage (= 0.61.5-microsoft-fb61merge.1) + - React-RCTLinking (= 0.61.5-microsoft-fb61merge.1) + - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) + - React-RCTSettings (= 0.61.5-microsoft-fb61merge.1) + - React-RCTText (= 0.61.5-microsoft-fb61merge.1) + - React-RCTVibration (= 0.61.5-microsoft-fb61merge.1) + - React-ART (0.61.5-microsoft-fb61merge.1): + - React-Core/ARTHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-Core (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/ARTHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/CoreModulesHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/Default (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/DevSupport (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) + - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - React-jsinspector (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTActionSheetHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTAnimationHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTBlobHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTImageHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTLinkingHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTNetworkHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTPushNotificationHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTSettingsHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTTextHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTVibrationHeaders (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-Core/RCTWebSocket (0.61.5-microsoft-fb61merge.1): + - Folly (= 2018.10.22.00) + - glog + - React-Core/Default (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsiexecutor (= 0.61.5-microsoft-fb61merge.1) + - Yoga + - React-CoreModules (0.61.5-microsoft-fb61merge.1): + - FBReactNativeSpec (= 0.61.5-microsoft-fb61merge.1) + - Folly (= 2018.10.22.00) + - RCTTypeSafety (= 0.61.5-microsoft-fb61merge.1) + - React-Core/CoreModulesHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTImage (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (0.61.5-microsoft-fb61merge.1): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsinspector (= 1000.0.0) - - React-DevSupport (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTWebSocket (= 1000.0.0) - - React-fishhook (1000.0.0) - - React-jscallinvoker (1000.0.0): - - Folly (= 2018.10.22.00) - - React-cxxreact (= 1000.0.0) - - React-jsi (1000.0.0): + - React-jsinspector (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (0.61.5-microsoft-fb61merge.1): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsi/Default (= 1000.0.0) - - React-jsi/Default (1000.0.0): + - React-jsi/Default (= 0.61.5-microsoft-fb61merge.1) + - React-jsi/Default (0.61.5-microsoft-fb61merge.1): - boost-for-react-native (= 1.63.0) - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-jsiexecutor (1000.0.0): + - React-jsiexecutor (0.61.5-microsoft-fb61merge.1): + - DoubleConversion + - Folly (= 2018.10.22.00) + - glog + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-jsinspector (0.61.5-microsoft-fb61merge.1) + - React-RCTActionSheet (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTActionSheetHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTAnimation (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTAnimationHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTBlob (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTBlobHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-Core/RCTWebSocket (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) + - React-RCTImage (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTImageHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTNetwork (= 0.61.5-microsoft-fb61merge.1) + - React-RCTLinking (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTLinkingHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTNetwork (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTNetworkHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTPushNotification (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTPushNotificationHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTSettings (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTSettingsHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTTest (0.61.5-microsoft-fb61merge.1): + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React-RCTText (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTTextHeaders (= 0.61.5-microsoft-fb61merge.1) + - React-RCTVibration (0.61.5-microsoft-fb61merge.1): + - React-Core/RCTVibrationHeaders (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/jscallinvoker (0.61.5-microsoft-fb61merge.1): - DoubleConversion - Folly (= 2018.10.22.00) - glog - - React-cxxreact (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-jsinspector (1000.0.0) - - React-RCTActionSheet (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTAnimation (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTBlob (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTNetwork (= 1000.0.0) - - React-RCTWebSocket (= 1000.0.0) - - React-RCTCameraRoll (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTImage (= 1000.0.0) - - React-RCTImage (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTNetwork (= 1000.0.0) - - React-RCTLinking (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTNetwork (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTPushNotification (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTSettings (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTTest (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTText (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTVibration (1000.0.0): - - React-Core (= 1000.0.0) - - React-RCTWebSocket (1000.0.0): - - React-Core (= 1000.0.0) - - React-fishhook (= 1000.0.0) - - React-turbomodule-core (1000.0.0): - - Folly (= 2018.10.22.00) - - React-Core (= 1000.0.0) - - React-cxxreact (= 1000.0.0) - - React-jscallinvoker (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-turbomodule-core/core-ios (= 1000.0.0) - - React-turbomodule-core/core-ios (1000.0.0): - - Folly (= 2018.10.22.00) - - React-Core (= 1000.0.0) - - React-cxxreact (= 1000.0.0) - - React-jscallinvoker (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-turbomodule-samples (1000.0.0): - - Folly (= 2018.10.22.00) - - React-Core (= 1000.0.0) - - React-cxxreact (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-turbomodule-core (= 1000.0.0) - - React-turbomodule-samples/samples-ios (= 1000.0.0) - - React-turbomodule-samples/samples-ios (1000.0.0): - - Folly (= 2018.10.22.00) - - React-Core (= 1000.0.0) - - React-cxxreact (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-turbomodule-core (= 1000.0.0) - - yoga (1000.0.0.React) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/turbomodule/core (0.61.5-microsoft-fb61merge.1): + - DoubleConversion + - Folly (= 2018.10.22.00) + - glog + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/jscallinvoker (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/turbomodule/samples (0.61.5-microsoft-fb61merge.1): + - DoubleConversion + - Folly (= 2018.10.22.00) + - glog + - React-Core (= 0.61.5-microsoft-fb61merge.1) + - React-cxxreact (= 0.61.5-microsoft-fb61merge.1) + - React-jsi (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/jscallinvoker (= 0.61.5-microsoft-fb61merge.1) + - ReactCommon/turbomodule/core (= 0.61.5-microsoft-fb61merge.1) + - Yoga (1.14.0) DEPENDENCIES: - boost-for-react-native (from `../third-party-podspecs/boost-for-react-native.podspec`) - DoubleConversion (from `../third-party-podspecs/DoubleConversion.podspec`) + - FBLazyVector (from `../Libraries/FBLazyVector`) + - FBReactNativeSpec (from `../Libraries/FBReactNativeSpec`) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) + - RCTRequired (from `../Libraries/RCTRequired`) + - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) - React-ART (from `../Libraries/ART`) - - React-Core (from `../React`) + - React-Core (from `../`) + - React-Core/DevSupport (from `../`) + - React-Core/RCTWebSocket (from `../`) + - React-CoreModules (from `../React/CoreModules`) - React-cxxreact (from `../ReactCommon/cxxreact`) - - React-DevSupport (from `../React`) - - React-fishhook (from `../Libraries/fishhook`) - - React-jscallinvoker (from `../ReactCommon/jscallinvoker`) - React-jsi (from `../ReactCommon/jsi`) - React-jsiexecutor (from `../ReactCommon/jsiexecutor`) - React-jsinspector (from `../ReactCommon/jsinspector`) - React-RCTActionSheet (from `../Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../Libraries/NativeAnimation`) - React-RCTBlob (from `../Libraries/Blob`) - - React-RCTCameraRoll (from `../Libraries/CameraRoll`) - React-RCTImage (from `../Libraries/Image`) - React-RCTLinking (from `../Libraries/LinkingIOS`) - React-RCTNetwork (from `../Libraries/Network`) - React-RCTPushNotification (from `../Libraries/PushNotificationIOS`) - React-RCTSettings (from `../Libraries/Settings`) - - React-RCTTest (from `./RCTTest`) + - React-RCTTest (from `RCTTest`) - React-RCTText (from `../Libraries/Text`) - React-RCTVibration (from `../Libraries/Vibration`) - - React-RCTWebSocket (from `../Libraries/WebSocket`) - - React-turbomodule-core (from `../ReactCommon/turbomodule/core`) - - React-turbomodule-samples (from `../ReactCommon/turbomodule/samples`) - - yoga (from `../ReactCommon/yoga`) + - ReactCommon/jscallinvoker (from `../ReactCommon`) + - ReactCommon/turbomodule/core (from `../ReactCommon`) + - ReactCommon/turbomodule/samples (from `../ReactCommon`) + - Yoga (from `../ReactCommon/yoga`) EXTERNAL SOURCES: boost-for-react-native: :podspec: "../third-party-podspecs/boost-for-react-native.podspec" DoubleConversion: :podspec: "../third-party-podspecs/DoubleConversion.podspec" + FBLazyVector: + :path: "../Libraries/FBLazyVector" + FBReactNativeSpec: + :path: "../Libraries/FBReactNativeSpec" Folly: :podspec: "../third-party-podspecs/Folly.podspec" glog: :podspec: "../third-party-podspecs/glog.podspec" + RCTRequired: + :path: "../Libraries/RCTRequired" + RCTTypeSafety: + :path: "../Libraries/TypeSafety" React: :path: "../" React-ART: :path: "../Libraries/ART" React-Core: - :path: "../React" + :path: "../" + React-CoreModules: + :path: "../React/CoreModules" React-cxxreact: :path: "../ReactCommon/cxxreact" - React-DevSupport: - :path: "../React" - React-fishhook: - :path: "../Libraries/fishhook" - React-jscallinvoker: - :path: "../ReactCommon/jscallinvoker" React-jsi: :path: "../ReactCommon/jsi" React-jsiexecutor: @@ -188,8 +324,6 @@ EXTERNAL SOURCES: :path: "../Libraries/NativeAnimation" React-RCTBlob: :path: "../Libraries/Blob" - React-RCTCameraRoll: - :path: "../Libraries/CameraRoll" React-RCTImage: :path: "../Libraries/Image" React-RCTLinking: @@ -201,52 +335,47 @@ EXTERNAL SOURCES: React-RCTSettings: :path: "../Libraries/Settings" React-RCTTest: - :path: "./RCTTest" + :path: RCTTest React-RCTText: :path: "../Libraries/Text" React-RCTVibration: :path: "../Libraries/Vibration" - React-RCTWebSocket: - :path: "../Libraries/WebSocket" - React-turbomodule-core: - :path: "../ReactCommon/turbomodule/core" - React-turbomodule-samples: - :path: "../ReactCommon/turbomodule/samples" - yoga: + ReactCommon: + :path: "../ReactCommon" + Yoga: :path: "../ReactCommon/yoga" SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 DoubleConversion: a1bc12a74baa397a2609e0f10e19b8062d864053 + FBLazyVector: 5dfe164c4ecb355c7c99cd823e1d84ff1a5788bc + FBReactNativeSpec: 28b8ea431b593568368273a8351d3626b7072b76 Folly: feff29ba9d0b7c2e4f793a94942831d6cc5bbad7 glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 - React: 74861516f70acbdca7b2548aa557bf8deee9698d - React-ART: 08abf61755c11f2adbc78ae6e2f5b087a403a677 - React-Core: 06246a75cdb32beacf777cda87c61c13276b4271 - React-cxxreact: 3e49ca16e0117d19b859450041c7fe4dc9296399 - React-DevSupport: 91d8812ad81fbfa8084b06e131e3d80087c665e9 - React-fishhook: 1a55e7b86dcab2d0e0db1268681365c3f5eefe0a - React-jscallinvoker: f84d92e0e70a0f8a04907d0682a7c58533708b67 - React-jsi: 87033eb3052f4e6b8bf54af32c8f0a29ffbec13c - React-jsiexecutor: 9af31e4fb3c7157d6437d11a4686974ffd5310b7 - React-jsinspector: bd0f3d1d100ec90008bdceeecc3b2ccde15f349c - React-RCTActionSheet: c3adb7754a32492fc5e0bcaf2395221006588b6b - React-RCTAnimation: ae01c6e813366aef34ebe182f007ca42365b5f47 - React-RCTBlob: 4c36d6a42e2d2ad5deff4b2182ffcf4c6ff0c048 - React-RCTCameraRoll: 4c8233e7d0d3aee3448faaaa5df90f8168abaeed - React-RCTImage: 841010ce5a7a0eb96bc3f22659560a176a254fc9 - React-RCTLinking: 4fe50097a4d8c9649b25fd6639257aa475530656 - React-RCTNetwork: b7bf49cc581752158e8aeee3e9aae83ab61fbcd0 - React-RCTPushNotification: 79cbb2aaf51f65b94e844c876f462ec07be33ac5 - React-RCTSettings: 1ad264bf310d7cf7f2b29c94836b84e5a0ca1561 - React-RCTTest: 6621c76066fa0c1293149d06c2bf2d5b06be6956 - React-RCTText: fc8369e3ce7c9a474efc539d84b4f9bdc921bc0a - React-RCTVibration: d9a3da17bd5d3f4d8b57a40e3e7fb842f7e62694 - React-RCTWebSocket: 7bb0868fafa9e8ed961a8f87879e2d2bf7946b3d - React-turbomodule-core: 970dd38c0e59a09b5919e0a097abdd099c4ae9a7 - React-turbomodule-samples: 4d9081847444fe313ac06bb6ec604c35e49ba8c7 - yoga: fb23117669f477b0f4b3849d6999414cba0c69b7 + RCTRequired: a92bf3036ee83300f125e3ee403252f551293faf + RCTTypeSafety: 894595ede98c88e05ee2032f4316e30a07c909d0 + React: 1a7744d3583f828c5b368d97bc1d6883c3ef5061 + React-ART: 55140fce0343403c2673714c647dcce3197a3e21 + React-Core: f9055a8a893057ebbb2d6c23760e3f6ef79d68fb + React-CoreModules: b9bb34399e89d5e0377318e133da1ac378931f39 + React-cxxreact: c0472143c05562852bf9733164bc4df083267b0e + React-jsi: e72668b938c2fa510bcd1512ba57428a85bda150 + React-jsiexecutor: dd2f155314ab1298d2de1552aab62293e91ecb90 + React-jsinspector: cd6ba3c471eb2bc85907e6b34b330efe932bf841 + React-RCTActionSheet: d2286019562b8d450539169bd8e652c2a1e89339 + React-RCTAnimation: cb5a777cb6d0da54b17d1466c6fd6851a468cd89 + React-RCTBlob: b108e5553a9a1c6876d88e6e896ec766f2160b06 + React-RCTImage: 1110fc0018a3689e19033373eff412aad9855e0e + React-RCTLinking: 69e440dda05ef2a05475b6f59d6ae13df3fc0897 + React-RCTNetwork: 24ea076fa72d5268f040154908794da9f1de4677 + React-RCTPushNotification: 23dad6b2aed72c0314de77d69dcd71e5c4471b78 + React-RCTSettings: ca6bee2469300226003a53a29eaac57be1e2c918 + React-RCTTest: 054f7afca584b04069b25cde0570494d5824336d + React-RCTText: 8d5cf19c48793405597b7ac85e71ae48606fcf0c + React-RCTVibration: c1d3ddc2070a3bee4b0c8d8653393ca0ff976dc7 + ReactCommon: 7571c31a09af5ea4d3f0bf2bc4c64b4442ff300c + Yoga: 8e1634114a2a688230bce816fa00459aaa088671 -PODFILE CHECKSUM: d10549a91f1ecde1496088874e41348b2cd79f9f +PODFILE CHECKSUM: c0ee8fa1224b483cb7f0297981cb8fe4813aa299 COCOAPODS: 1.8.4 diff --git a/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h b/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h index 9c252b714a4b1f..b432fa652c10bf 100644 --- a/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h +++ b/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h @@ -55,7 +55,7 @@ extern NSString *const FBReferenceImageFilePathKey; Performs the comparison of the view. @param view The view to snapshot. @param selector selector - @param identifier An optional identifier, used is there are muliptle snapshot tests in a given -test method. + @param identifier An optional identifier, used is there are multiple snapshot tests in a given -test method. @param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc). @returns YES if the comparison (or saving of the reference image) succeeded. */ diff --git a/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m b/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m index 4b8ca212578278..154e18e943e924 100644 --- a/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m +++ b/RNTester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m @@ -10,6 +10,8 @@ #import +#import // TODO(macOS ISS#2323203) + #import "UIImage+Compare.h" #import "UIImage+Diff.h" diff --git a/RNTester/RCTTest/RCTTest.xcodeproj/project.pbxproj b/RNTester/RCTTest/RCTTest.xcodeproj/project.pbxproj deleted file mode 100644 index ed521b57a7cf05..00000000000000 --- a/RNTester/RCTTest/RCTTest.xcodeproj/project.pbxproj +++ /dev/null @@ -1,593 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 183938D21F9A563A00930D92 /* RCTTestRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135361AB3C56F00882537 /* RCTTestRunner.m */; }; - 183938D61F9A58A500930D92 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; }; - 18DF57141EFA052000BF4666 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 18DF57161EFA052000BF4666 /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; }; - 18DF57191EFA052000BF4666 /* RCTSnapshotManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */; }; - 18DF571A1EFA052000BF4666 /* RCTTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135341AB3C56F00882537 /* RCTTestModule.m */; }; - 2D3B5F2D1D9B0F2800451313 /* RCTSnapshotManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */; }; - 2D3B5F2E1D9B0F2B00451313 /* RCTTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135341AB3C56F00882537 /* RCTTestModule.m */; }; - 2D3B5F2F1D9B0F2E00451313 /* RCTTestRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135361AB3C56F00882537 /* RCTTestRunner.m */; }; - 2D3B5F301D9B0F3D00451313 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; }; - 2D3B5F311D9B0F4200451313 /* UIImage+Compare.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */; }; - 2D3B5F321D9B0F4500451313 /* UIImage+Diff.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */; }; - 3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; }; - 3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; }; - 3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 585135371AB3C56F00882537 /* RCTTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135341AB3C56F00882537 /* RCTTestModule.m */; }; - 585135381AB3C57000882537 /* RCTTestRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135361AB3C56F00882537 /* RCTTestRunner.m */; }; - 58E64FED1AB964CD007446E2 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; }; - 58E64FEE1AB964CD007446E2 /* UIImage+Compare.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */; }; - 58E64FEF1AB964CD007446E2 /* UIImage+Diff.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */; }; - 9913A84B1BBE833400D70E66 /* RCTSnapshotManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */; }; - 9F153502233AB5A1006DFE44 /* UIImage+Compare.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */; }; - 9F153503233AB65F006DFE44 /* UIImage+Diff.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 18DF57151EFA052000BF4666 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTTest; - dstSubfolderSpec = 16; - files = ( - 18DF57161EFA052000BF4666 /* RCTTestRunner.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3030271DF8299E00D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTTest; - dstSubfolderSpec = 16; - files = ( - 3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3030291DF82A6E00D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTTest; - dstSubfolderSpec = 16; - files = ( - 3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 18DF57221EFA052000BF4666 /* libRCTTest-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTTest-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D2A286E1D9B047700D4039D /* libRCTTest-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTTest-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 580C376F1AB104AF0015E709 /* libRCTTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTTest.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 585135331AB3C56F00882537 /* RCTTestModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTestModule.h; sourceTree = ""; }; - 585135341AB3C56F00882537 /* RCTTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTestModule.m; sourceTree = ""; }; - 585135351AB3C56F00882537 /* RCTTestRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTestRunner.h; sourceTree = ""; }; - 585135361AB3C56F00882537 /* RCTTestRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTestRunner.m; sourceTree = ""; }; - 58E64FE41AB964CD007446E2 /* FBSnapshotTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSnapshotTestCase.h; sourceTree = ""; }; - 58E64FE51AB964CD007446E2 /* FBSnapshotTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSnapshotTestCase.m; sourceTree = ""; }; - 58E64FE61AB964CD007446E2 /* FBSnapshotTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSnapshotTestController.h; sourceTree = ""; }; - 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSnapshotTestController.m; sourceTree = ""; }; - 58E64FE81AB964CD007446E2 /* UIImage+Compare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Compare.h"; sourceTree = ""; }; - 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Compare.m"; sourceTree = ""; }; - 58E64FEA1AB964CD007446E2 /* UIImage+Diff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Diff.h"; sourceTree = ""; }; - 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Diff.m"; sourceTree = ""; }; - 9913A8491BBE833400D70E66 /* RCTSnapshotManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSnapshotManager.h; sourceTree = ""; }; - 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSnapshotManager.m; sourceTree = ""; }; - 9F153505233AB783006DFE44 /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 18DF571E1EFA052000BF4666 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D2A286B1D9B047700D4039D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 580C376C1AB104AF0015E709 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 580C37661AB104AF0015E709 = { - isa = PBXGroup; - children = ( - 58E64FE31AB964CD007446E2 /* FBSnapshotTestCase */, - 9913A8491BBE833400D70E66 /* RCTSnapshotManager.h */, - 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */, - 585135331AB3C56F00882537 /* RCTTestModule.h */, - 585135341AB3C56F00882537 /* RCTTestModule.m */, - 585135351AB3C56F00882537 /* RCTTestRunner.h */, - 585135361AB3C56F00882537 /* RCTTestRunner.m */, - 580C37701AB104AF0015E709 /* Products */, - 9F153504233AB783006DFE44 /* Frameworks */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 580C37701AB104AF0015E709 /* Products */ = { - isa = PBXGroup; - children = ( - 580C376F1AB104AF0015E709 /* libRCTTest.a */, - 2D2A286E1D9B047700D4039D /* libRCTTest-tvOS.a */, - 18DF57221EFA052000BF4666 /* libRCTTest-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 58E64FE31AB964CD007446E2 /* FBSnapshotTestCase */ = { - isa = PBXGroup; - children = ( - 58E64FE41AB964CD007446E2 /* FBSnapshotTestCase.h */, - 58E64FE51AB964CD007446E2 /* FBSnapshotTestCase.m */, - 58E64FE61AB964CD007446E2 /* FBSnapshotTestController.h */, - 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */, - 58E64FE81AB964CD007446E2 /* UIImage+Compare.h */, - 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */, - 58E64FEA1AB964CD007446E2 /* UIImage+Diff.h */, - 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */, - ); - path = FBSnapshotTestCase; - sourceTree = ""; - }; - 9F153504233AB783006DFE44 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 9F153505233AB783006DFE44 /* libReact.a */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 18DF57131EFA052000BF4666 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 18DF57141EFA052000BF4666 /* RCTTestRunner.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DED3AA11DE6FC2200336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DED3AA31DE6FC4700336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 18DF57121EFA052000BF4666 /* RCTTest-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18DF571F1EFA052000BF4666 /* Build configuration list for PBXNativeTarget "RCTTest-macOS" */; - buildPhases = ( - 18DF57131EFA052000BF4666 /* Headers */, - 18DF57151EFA052000BF4666 /* Copy Headers */, - 18DF57171EFA052000BF4666 /* Sources */, - 18DF571E1EFA052000BF4666 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTTest-macOS"; - productName = RCTTest; - productReference = 18DF57221EFA052000BF4666 /* libRCTTest-macOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 2D2A286D1D9B047700D4039D /* RCTTest-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28761D9B047700D4039D /* Build configuration list for PBXNativeTarget "RCTTest-tvOS" */; - buildPhases = ( - 3DED3AA31DE6FC4700336DD7 /* Headers */, - 3D3030291DF82A6E00D6DDAE /* Copy Headers */, - 2D2A286A1D9B047700D4039D /* Sources */, - 2D2A286B1D9B047700D4039D /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTTest-tvOS"; - productName = "RCTTest-tvOS"; - productReference = 2D2A286E1D9B047700D4039D /* libRCTTest-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 580C376E1AB104AF0015E709 /* RCTTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 580C37831AB104AF0015E709 /* Build configuration list for PBXNativeTarget "RCTTest" */; - buildPhases = ( - 3DED3AA11DE6FC2200336DD7 /* Headers */, - 3D3030271DF8299E00D6DDAE /* Copy Headers */, - 580C376B1AB104AF0015E709 /* Sources */, - 580C376C1AB104AF0015E709 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTTest; - productName = RCTTest; - productReference = 580C376F1AB104AF0015E709 /* libRCTTest.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 580C37671AB104AF0015E709 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A286D1D9B047700D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 580C376E1AB104AF0015E709 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 580C376A1AB104AF0015E709 /* Build configuration list for PBXProject "RCTTest" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = 580C37661AB104AF0015E709; - productRefGroup = 580C37701AB104AF0015E709 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 580C376E1AB104AF0015E709 /* RCTTest */, - 2D2A286D1D9B047700D4039D /* RCTTest-tvOS */, - 18DF57121EFA052000BF4666 /* RCTTest-macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 18DF57171EFA052000BF4666 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F153502233AB5A1006DFE44 /* UIImage+Compare.m in Sources */, - 18DF57191EFA052000BF4666 /* RCTSnapshotManager.m in Sources */, - 9F153503233AB65F006DFE44 /* UIImage+Diff.m in Sources */, - 183938D61F9A58A500930D92 /* FBSnapshotTestController.m in Sources */, - 183938D21F9A563A00930D92 /* RCTTestRunner.m in Sources */, - 18DF571A1EFA052000BF4666 /* RCTTestModule.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D2A286A1D9B047700D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F311D9B0F4200451313 /* UIImage+Compare.m in Sources */, - 2D3B5F2F1D9B0F2E00451313 /* RCTTestRunner.m in Sources */, - 2D3B5F321D9B0F4500451313 /* UIImage+Diff.m in Sources */, - 2D3B5F301D9B0F3D00451313 /* FBSnapshotTestController.m in Sources */, - 2D3B5F2D1D9B0F2800451313 /* RCTSnapshotManager.m in Sources */, - 2D3B5F2E1D9B0F2B00451313 /* RCTTestModule.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 580C376B1AB104AF0015E709 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 58E64FEE1AB964CD007446E2 /* UIImage+Compare.m in Sources */, - 9913A84B1BBE833400D70E66 /* RCTSnapshotManager.m in Sources */, - 585135371AB3C56F00882537 /* RCTTestModule.m in Sources */, - 58E64FEF1AB964CD007446E2 /* UIImage+Diff.m in Sources */, - 58E64FED1AB964CD007446E2 /* FBSnapshotTestController.m in Sources */, - 585135381AB3C57000882537 /* RCTTestRunner.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 18DF57201EFA052000BF4666 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = ( - "-ObjC", - "-framework", - XCTest, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - RUN_CLANG_STATIC_ANALYZER = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 18DF57211EFA052000BF4666 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = ( - "-ObjC", - "-framework", - XCTest, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - SDKROOT = macosx; - }; - name = Release; - }; - 2D2A28741D9B047700D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28751D9B047700D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 580C37811AB104AF0015E709 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 580C37821AB104AF0015E709 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 580C37841AB104AF0015E709 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = ( - "-ObjC", - "-framework", - XCTest, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 580C37851AB104AF0015E709 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = ( - "-ObjC", - "-framework", - XCTest, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 18DF571F1EFA052000BF4666 /* Build configuration list for PBXNativeTarget "RCTTest-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18DF57201EFA052000BF4666 /* Debug */, - 18DF57211EFA052000BF4666 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D2A28761D9B047700D4039D /* Build configuration list for PBXNativeTarget "RCTTest-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28741D9B047700D4039D /* Debug */, - 2D2A28751D9B047700D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 580C376A1AB104AF0015E709 /* Build configuration list for PBXProject "RCTTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 580C37811AB104AF0015E709 /* Debug */, - 580C37821AB104AF0015E709 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 580C37831AB104AF0015E709 /* Build configuration list for PBXNativeTarget "RCTTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 580C37841AB104AF0015E709 /* Debug */, - 580C37851AB104AF0015E709 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 580C37671AB104AF0015E709 /* Project object */; -} diff --git a/RNTester/RCTTest/RCTTestRunner.m b/RNTester/RCTTest/RCTTestRunner.m index d357295bd80a5b..29be554a4cf422 100644 --- a/RNTester/RCTTest/RCTTestRunner.m +++ b/RNTester/RCTTest/RCTTestRunner.m @@ -61,6 +61,10 @@ - (instancetype)initWithApp:(NSString *)app RCTAssertParam(app); RCTAssertParam(referenceDirectory); + // TODO(macOS ISS#2323203): uncomment to record snapshot images +// referenceDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; + // Search for `_runner.recordMode = ` and change instances to YES + if ((self = [super init])) { if (!referenceDirectory.length) { referenceDirectory = [[NSBundle bundleForClass:self.class].resourcePath stringByAppendingPathComponent:@"ReferenceImages"]; @@ -88,7 +92,8 @@ - (instancetype)initWithApp:(NSString *)app - (NSURL *)defaultScriptURL { if (getenv("CI_USE_PACKAGER") || _useBundler) { - return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true", _appPath, kRCTPlatformName]]; // TODO(macOS ISS#2323203) + NSString *bundlePrefix = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"RN_BUNDLE_PREFIX"] ?: @""; // TODO(macOS ISS#2323203) + return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@%@.bundle?platform=%@&dev=true", bundlePrefix, _appPath, kRCTPlatformName]]; // TODO(macOS ISS#2323203) } else { return [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"]; } diff --git a/RNTester/RCTTest/React-RCTTest.podspec b/RNTester/RCTTest/React-RCTTest.podspec index a95213a0db6d41..0a56a736dad188 100644 --- a/RNTester/RCTTest/React-RCTTest.podspec +++ b/RNTester/RCTTest/React-RCTTest.podspec @@ -30,6 +30,6 @@ Pod::Spec.new do |s| s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.framework = "XCTest" s.header_dir = "RCTTest" - + s.dependency "React-Core", version end diff --git a/RNTester/README.md b/RNTester/README.md index f7d35ebe1396ff..33dfed103e0796 100644 --- a/RNTester/README.md +++ b/RNTester/README.md @@ -14,18 +14,9 @@ Before running the app, make sure you ran: Both macOS and Xcode are required. -- Open `RNTester/RNTester.xcodeproj` in Xcode -- Hit the Run button - -See [Running on device](https://facebook.github.io/react-native/docs/running-on-device.html) if you want to use a physical device. - -### Running on iOS with CocoaPods - -Similar to above, you can build the app via Xcode with help of CocoaPods. - -- Install [CocoaPods](http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#3-install-cocoapods) +- Install CocoaPods. We installing CocoaPods using [Homebrew](http://brew.sh/): `brew install cocoapods` - Run `cd RNTester; pod install` -- Open the generated `RNTesterPods.xcworkspace` (this is not checked in). Do not open `RNTesterPods.xcodeproj` directly. +- Open the generated `RNTesterPods.xcworkspace`. This is not checked in, as it is generated by CocoaPods. Do not open `RNTesterPods.xcodeproj` directly. ### Running on Android diff --git a/RNTester/RNTester-macOS/Info.plist b/RNTester/RNTester-macOS/Info.plist index d7887f58cdee79..1850a3c1eda534 100644 --- a/RNTester/RNTester-macOS/Info.plist +++ b/RNTester/RNTester-macOS/Info.plist @@ -36,15 +36,17 @@ NSAllowsArbitraryLoads - NSPhotoLibraryUsageDescription - Photo library access needed for some tests. NSHumanReadableCopyright Copyright © 2017 Facebook. All rights reserved. NSLocationWhenInUseUsageDescription true NSMainStoryboardFile Main + NSPhotoLibraryUsageDescription + Photo library access needed for some tests. NSPrincipalClass NSApplication + RN_BUNDLE_PREFIX + $(RN_BUNDLE_PREFIX) diff --git a/RNTester/RNTester-macOS/RNTester_macOS.entitlements b/RNTester/RNTester-macOS/RNTester_macOS.entitlements index c3731178b4cfae..36fe293685410b 100644 --- a/RNTester/RNTester-macOS/RNTester_macOS.entitlements +++ b/RNTester/RNTester-macOS/RNTester_macOS.entitlements @@ -2,6 +2,8 @@ + com.apple.security.get-task-allow + com.apple.security.personal-information.photos-library diff --git a/RNTester/RNTester-tvOS/Info.plist b/RNTester/RNTester-tvOS/Info.plist index 0afedbb816c675..1f05733996acbd 100644 --- a/RNTester/RNTester-tvOS/Info.plist +++ b/RNTester/RNTester-tvOS/Info.plist @@ -31,5 +31,7 @@ UIUserInterfaceStyle Automatic + RN_BUNDLE_PREFIX + $(RN_BUNDLE_PREFIX) diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj deleted file mode 100644 index 61ac1e853aa869..00000000000000 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ /dev/null @@ -1,4537 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 001BFCE41D838343008E587E /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */; }; - 04F27E112288190500F536C3 /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F27E102288190500F536C3 /* RCTPerformanceLoggerTests.m */; }; - 1300627F1B59179B0043FE5A /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1300627E1B59179B0043FE5A /* RCTGzipTests.m */; }; - 13129DD41C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13129DD31C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m */; }; - 13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; }; - 134180011AA9153C003F314A /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; }; - 1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; }; - 134CB92A1C85A38800265FA6 /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */; }; - 138D6A181B53CD440074A87E /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; - 138DEE241B9EDFB6007F4EA5 /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */; }; - 1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */; }; - 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 13B6C1A31C34225900D3FAF5 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; - 13BCE84F1C9C209600DD7AAD /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */; }; - 13DB03481B5D2ED500C27245 /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */; }; - 13DF61B61B67A45000EDB188 /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */; }; - 13E501F11D07A84A005F35D8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E501A31D07A502005F35D8 /* libRCTAnimation.a */; }; - 143BC5A11B21E45C00462512 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 143BC5A01B21E45C00462512 /* RNTesterSnapshotTests.m */; }; - 144D21241B2204C5006DB32B /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 144D21231B2204C5006DB32B /* RCTImageUtilTests.m */; }; - 147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; }; - 1497CFAC1B21F5E400C1F8F2 /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA41B21F5E400C1F8F2 /* RCTAllocationTests.m */; }; - 1497CFAF1B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */; }; - 1497CFB01B21F5E400C1F8F2 /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */; }; - 1497CFB11B21F5E400C1F8F2 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */; }; - 1497CFB31B21F5E400C1F8F2 /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */; }; - 14D6D7111B220EB3001FB087 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14D6D7101B220EB3001FB087 /* libOCMock.a */; }; - 14D6D71E1B2222EF001FB087 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; }; - 14D6D7211B2222EF001FB087 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; }; - 14D6D7221B2222EF001FB087 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; }; - 14D6D7231B2222EF001FB087 /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DC67F11AB71876001358AB /* libRCTPushNotification.a */; }; - 14D6D7241B2222EF001FB087 /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 834C36D21AF8DA610019C93C /* libRCTSettings.a */; }; - 14D6D7261B2222EF001FB087 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; }; - 14D6D7271B2222EF001FB087 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; }; - 14D6D7281B2222EF001FB087 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; - 14D6D7291B2222EF001FB087 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; }; - 14DC67F41AB71881001358AB /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DC67F11AB71876001358AB /* libRCTPushNotification.a */; }; - 180B9CC41F01B040006AF028 /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13129DD31C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m */; }; - 1827ADAD20ACEA6600E266FC /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */; }; - 1827ADEF20ACEB7100E266FC /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB99D0B1BA0340600302749 /* RNTesterIntegrationTests.m */; }; - 18316DFC1EF9D981003DADF3 /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 192F69B61E82409A008692C7 /* RCTConvert_YGValueTests.m */; }; - 18316DFD1EF9D996003DADF3 /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */; }; - 18316DFE1EF9DA43003DADF3 /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */; }; - 18316E011EF9DC9C003DADF3 /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */; }; - 18316E021EF9E0DE003DADF3 /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */; }; - 18316E041EF9EAD1003DADF3 /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1300627E1B59179B0043FE5A /* RCTGzipTests.m */; }; - 18316E1B1EF9EB7D003DADF3 /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA41B21F5E400C1F8F2 /* RCTAllocationTests.m */; }; - 183938D01F9A55AE00930D92 /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */; }; - 1879ECF921E84E2800D98372 /* RCTConvert_NSColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1879ECDE21E84E2800D98372 /* RCTConvert_NSColorTests.m */; }; - 18AA4BD41EF9C724008C7756 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; - 18BFA4CB1F01C52400969486 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */; }; - 18D5934D1EF9F8BC005F0CEC /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */; }; - 18D593781EF9F8CB005F0CEC /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */; }; - 18D593791EF9F8DA005F0CEC /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 144D21231B2204C5006DB32B /* RCTImageUtilTests.m */; }; - 18D5937A1EF9F95A005F0CEC /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */; }; - 18D5937B1EF9F96A005F0CEC /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */; }; - 18D5937D1EF9F990005F0CEC /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */; }; - 18D5937E1EF9FA22005F0CEC /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */; }; - 18D5937F1EF9FA39005F0CEC /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */; }; - 18D593801EF9FA48005F0CEC /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; - 18D593811EF9FA57005F0CEC /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */; }; - 18D593841EF9FAB9005F0CEC /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 39AA31A31DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m */; }; - 18D949451F9AC375007BB668 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 27B885551BED29AF00008352 /* RCTRootViewIntegrationTests.m */; }; - 18D9497D1F9AC3D0007BB668 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */; }; - 18DF57111EFA047400BF4666 /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */; }; - 18FC778A1EF4770B002B3F17 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FC77891EF4770B002B3F17 /* AppDelegate.m */; }; - 18FC778D1EF4770B002B3F17 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FC778C1EF4770B002B3F17 /* main.m */; }; - 18FC77901EF4770B002B3F17 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FC778F1EF4770B002B3F17 /* ViewController.m */; }; - 18FC77951EF4770B002B3F17 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18FC77931EF4770B002B3F17 /* Main.storyboard */; }; - 18FC77A01EF4770B002B3F17 /* RNTesterUnitTests_macOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FC779F1EF4770B002B3F17 /* RNTesterUnitTests_macOS.m */; }; - 18FC77AB1EF4770B002B3F17 /* RNTesterIntegrationTests_macOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FC77AA1EF4770B002B3F17 /* RNTesterIntegrationTests_macOS.m */; }; - 18FE57B02149BCDB000CB2A7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 647647C81F0BCC5500C2D89B /* libRCTAnimation.a */; }; - 192F69B81E82409A008692C7 /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 192F69B51E82409A008692C7 /* RCTAnimationUtilsTests.m */; }; - 192F69B91E82409A008692C7 /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 192F69B61E82409A008692C7 /* RCTConvert_YGValueTests.m */; }; - 192F69BA1E82409A008692C7 /* RCTNativeAnimatedNodesManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 192F69B71E82409A008692C7 /* RCTNativeAnimatedNodesManagerTests.m */; }; - 192F69DA1E8240E2008692C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E501A31D07A502005F35D8 /* libRCTAnimation.a */; }; - 19BA88D51F84344F00741C5A /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 19BA88D41F84344F00741C5A /* RCTBlobManagerTests.m */; }; - 19BA89031F8439A700741C5A /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */; }; - 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; - 27B885561BED29AF00008352 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 27B885551BED29AF00008352 /* RCTRootViewIntegrationTests.m */; }; - 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; - 2D4624FA1DA2EAC300C74D09 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */; }; - 2D4624FB1DA2EAC300C74D09 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 27B885551BED29AF00008352 /* RCTRootViewIntegrationTests.m */; }; - 2D4624FD1DA2EAC300C74D09 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 143BC5A01B21E45C00462512 /* RNTesterSnapshotTests.m */; }; - 2D4624FE1DA2EAC300C74D09 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */; }; - 2D4BD8D21DA2E20D005AC8A8 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; - 2D4BD8D31DA2E20D005AC8A8 /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */; }; - 2D4BD8D41DA2E20D005AC8A8 /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA41B21F5E400C1F8F2 /* RCTAllocationTests.m */; }; - 2D4BD8D71DA2E20D005AC8A8 /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */; }; - 2D4BD8D81DA2E20D005AC8A8 /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */; }; - 2D4BD8D91DA2E20D005AC8A8 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */; }; - 2D4BD8DA1DA2E20D005AC8A8 /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1300627E1B59179B0043FE5A /* RCTGzipTests.m */; }; - 2D4BD8DB1DA2E20D005AC8A8 /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */; }; - 2D4BD8DC1DA2E20D005AC8A8 /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */; }; - 2D4BD8DD1DA2E20D005AC8A8 /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 144D21231B2204C5006DB32B /* RCTImageUtilTests.m */; }; - 2D4BD8DE1DA2E20D005AC8A8 /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */; }; - 2D4BD8DF1DA2E20D005AC8A8 /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */; }; - 2D4BD8E21DA2E20D005AC8A8 /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */; }; - 2D4BD8E31DA2E20D005AC8A8 /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; - 2D4BD8E41DA2E20D005AC8A8 /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */; }; - 2D4BD8E61DA2E20D005AC8A8 /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */; }; - 2D4BD8E71DA2E20D005AC8A8 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14D6D7101B220EB3001FB087 /* libOCMock.a */; }; - 2D66FF8F1ECA406D00F0A767 /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF651ECA405900F0A767 /* libART.a */; }; - 2D66FF901ECA407E00F0A767 /* libART-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF671ECA405900F0A767 /* libART-tvOS.a */; }; - 2D8C2E321DA40403000EE098 /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */; }; - 2DD323DC1DA2DDBF000FE1B8 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; - 2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; - 2DD323E01DA2DDBF000FE1B8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 2DD323E11DA2DDBF000FE1B8 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation.a */; }; - 2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */; }; - 2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */; }; - 2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */; }; - 2DD323E81DA2DE3F000FE1B8 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D01DA2DD8B000FE1B8 /* libRCTText-tvOS.a */; }; - 2DD323E91DA2DE3F000FE1B8 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D51DA2DD8B000FE1B8 /* libRCTWebSocket-tvOS.a */; }; - 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; }; - 2DE7E7FD1FB2A4F3009E225D /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation.a */; }; - 2DE7E7FE1FB2A4F3009E225D /* libRCTBlob-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA531EEAC9A700AC40CD /* libRCTBlob-tvOS.a */; }; - 2DE7E7FF1FB2A4F3009E225D /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; }; - 2DE7E8001FB2A4F3009E225D /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */; }; - 2DE7E8011FB2A4F3009E225D /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */; }; - 2DE7E8021FB2A4F3009E225D /* libRCTPushNotification-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D05746C1DE6008900184BB4 /* libRCTPushNotification-tvOS.a */; }; - 2DE7E8031FB2A4F3009E225D /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */; }; - 2DE7E8051FB2A4F3009E225D /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D01DA2DD8B000FE1B8 /* libRCTText-tvOS.a */; }; - 2DE7E8061FB2A4F3009E225D /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D51DA2DD8B000FE1B8 /* libRCTWebSocket-tvOS.a */; }; - 2DE7E8071FB2A4F3009E225D /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D91DA2DD8B000FE1B8 /* libReact.a */; }; - 3578590A1B28D2CF00341EDB /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 357859011B28D2C500341EDB /* libRCTLinking.a */; }; - 383C517F243447EC00CCBC30 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; - 383C51A624344A4600CCBC30 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; - 3860669D24461CDF007E7C32 /* RCTNativeSampleTurboModuleSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B71152267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm */; }; - 386066C424461CE3007E7C32 /* RCTSampleTurboModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B711A2267DB1A0066069E /* RCTSampleTurboModule.mm */; }; - 38C500E222D3CF2E00BCD999 /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38C500E122D3CF2E00BCD999 /* RCTConvert_UIColorTests.m */; }; - 39AA31A41DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 39AA31A31DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m */; }; - 3D05746D1DE6008900184BB4 /* libRCTPushNotification-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D05746C1DE6008900184BB4 /* libRCTPushNotification-tvOS.a */; }; - 3D0E379D1F1CC77200DCAC9F /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; }; - 3D13F8481D6F6AF900E69E0E /* ImageInBundle.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */; }; - 3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; }; - 3D299BAF1D33EBFA00FA1057 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */; }; - 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; }; - 3D56F9F11D6F6E9B00F53A06 /* RNTesterBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */; }; - 3DB99D0C1BA0340600302749 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB99D0B1BA0340600302749 /* RNTesterIntegrationTests.m */; }; - 3DD981D61D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */; }; - 52C11BBB1EEACA7100C1A058 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */; }; - 52C11BE11EEACA7800C1A058 /* libRCTBlob-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA531EEAC9A700AC40CD /* libRCTBlob-tvOS.a */; }; - 5C2B71672267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B71152267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm */; }; - 5C2B716A2267DB1A0066069E /* RCTSampleTurboModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B711A2267DB1A0066069E /* RCTSampleTurboModule.mm */; }; - 5C60EB592264416A0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB582264416A0018C04F /* AppDelegate.mm */; }; - 6862DFC62229DCE600684E03 /* libRCTTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6862DFAC2229DCC400684E03 /* libRCTTest.a */; }; - 6862DFC72229DD1000684E03 /* libRCTTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6862DFAC2229DCC400684E03 /* libRCTTest.a */; }; - 6862DFC82229DD1900684E03 /* libRCTTest-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6862DFAE2229DCC400684E03 /* libRCTTest-tvOS.a */; }; - 6862DFC92229DD2100684E03 /* libRCTTest-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6862DFAE2229DCC400684E03 /* libRCTTest-tvOS.a */; }; - 6862DFCF2229DFCC00684E03 /* Screenshot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6862DFCE2229DFCC00684E03 /* Screenshot.m */; }; - 68FF44381CF6111500720EFD /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */; }; - 834C36EC1AF8DED70019C93C /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 834C36D21AF8DA610019C93C /* libRCTSettings.a */; }; - 83636F8F1B53F22C009F943E /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */; }; - 8385CEF51B873B5C00C6273E /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */; }; - 8385CF041B87479200C6273E /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */; }; - 9F1534BE233AB44F006DFE44 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9F153508233AB998006DFE44 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21D122242EFA400E7F88E /* libReact.a */; }; - 9F15350A233ABA82006DFE44 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9F15350B233ACE27006DFE44 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21D122242EFA400E7F88E /* libReact.a */; }; - 9F15350C233ACE3B006DFE44 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9F15350D233ACE67006DFE44 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */; }; - 9F15356B233C2CC5006DFE44 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */; }; - 9F15359E233C2D6A006DFE44 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF12242EFA400E7F88E /* libRCTText.a */; }; - 9F153610233C32AF006DFE44 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE12242EFA400E7F88E /* libRCTImage.a */; }; - 9F153611233C32B8006DFE44 /* libRCTLinking-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D429028F1F1CE21600685AE7 /* libRCTLinking-macOS.a */; }; - 9F153612233C37AE006DFE44 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18BFA4931F01C46700969486 /* OCMock.framework */; }; - 9F153613233C37C8006DFE44 /* OCMock.framework in Copy Framework */ = {isa = PBXBuildFile; fileRef = 18BFA4931F01C46700969486 /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9F5C1823230B4F3500E3E5A7 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */; }; - 9F5C1824230B4F4000E3E5A7 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF12242EFA400E7F88E /* libRCTText.a */; }; - 9F5C1825230B4F4500E3E5A7 /* libRCTSettings-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6448A5D21F292F16006FF1F5 /* libRCTSettings-macOS.a */; }; - 9F5C1826230B4F5000E3E5A7 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE12242EFA400E7F88E /* libRCTImage.a */; }; - 9F5C1827230B4F5600E3E5A7 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */; }; - 9F5C1828230B4F6200E3E5A7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 647647C81F0BCC5500C2D89B /* libRCTAnimation.a */; }; - 9F5C1829230B4F6800E3E5A7 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F5C1806230B4F2400E3E5A7 /* libRCTActionSheet.a */; }; - 9F5C182A230B4F7000E3E5A7 /* libART-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 647647311F0BC04800C2D89B /* libART-macOS.a */; }; - 9F5C182B230B4F7400E3E5A7 /* libRCTBlob-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6484CE5A201A7557004275A4 /* libRCTBlob-macOS.a */; }; - 9F5C182C230B7A6800E3E5A7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21D122242EFA400E7F88E /* libReact.a */; }; - 9F5C182D230B7A7E00E3E5A7 /* libRCTPushNotification-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6424F7B21F669A8E0025D741 /* libRCTPushNotification-macOS.a */; }; - 9F7CD4122339A8FF005B9D55 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */; }; - 9F7CD4132339A906005B9D55 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF12242EFA400E7F88E /* libRCTText.a */; }; - 9F7CD4142339A90C005B9D55 /* libRCTTest-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F5C181A230B4F2400E3E5A7 /* libRCTTest-macOS.a */; }; - 9F7CD4152339A913005B9D55 /* libRCTSettings-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6448A5D21F292F16006FF1F5 /* libRCTSettings-macOS.a */; }; - 9F7CD4162339A91A005B9D55 /* libRCTPushNotification-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6424F7B21F669A8E0025D741 /* libRCTPushNotification-macOS.a */; }; - 9F7CD4172339A920005B9D55 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */; }; - 9F7CD4182339A925005B9D55 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE12242EFA400E7F88E /* libRCTImage.a */; }; - 9F7CD4192339A92D005B9D55 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F5C1806230B4F2400E3E5A7 /* libRCTActionSheet.a */; }; - 9F7CD41A2339A936005B9D55 /* libRCTBlob-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6484CE5A201A7557004275A4 /* libRCTBlob-macOS.a */; }; - 9F7CD41B2339A95F005B9D55 /* libRCTTest-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F5C181A230B4F2400E3E5A7 /* libRCTTest-macOS.a */; }; - 9FBFA519233C7E88003D9A8D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18FC77911EF4770B002B3F17 /* Assets.xcassets */; }; - 9FBFA51A233C7E91003D9A8D /* RNTesterBundle-macOS.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9FBFA513233C7E4C003D9A8D /* RNTesterBundle-macOS.bundle */; }; - 9FBFA51B233C7E97003D9A8D /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 9FBFA51C233C7EAF003D9A8D /* ImageInBundle.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */; }; - 9FBFA51D233C7EB4003D9A8D /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; }; - 9FBFA5CF233C9469003D9A8D /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323D91DA2DD8B000FE1B8 /* libReact.a */; }; - 9FF406A2239F165E005F0C58 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF12242EFA400E7F88E /* libRCTText.a */; }; - 9FF406D5239F1665005F0C58 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */; }; - 9FF406D6239F166B005F0C58 /* libRCTSettings-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6448A5D21F292F16006FF1F5 /* libRCTSettings-macOS.a */; }; - 9FF406D7239F166F005F0C58 /* libRCTLinking-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D429028F1F1CE21600685AE7 /* libRCTLinking-macOS.a */; }; - 9FF406D8239F1675005F0C58 /* libRCTPushNotification-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6424F7B21F669A8E0025D741 /* libRCTPushNotification-macOS.a */; }; - 9FF406D9239F1684005F0C58 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE12242EFA400E7F88E /* libRCTImage.a */; }; - 9FF406DA239F168A005F0C58 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */; }; - 9FF406DB239F1691005F0C58 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 647647C81F0BCC5500C2D89B /* libRCTAnimation.a */; }; - 9FF406DC239F1697005F0C58 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F5C1806230B4F2400E3E5A7 /* libRCTActionSheet.a */; }; - 9FF406DD239F169D005F0C58 /* libART-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 647647311F0BC04800C2D89B /* libART-macOS.a */; }; - 9FF406DE239F16A3005F0C58 /* libRCTBlob-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6484CE5A201A7557004275A4 /* libRCTBlob-macOS.a */; }; - 9FF406E0239F16DD005F0C58 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */; }; - 9FF406E1239F16E2005F0C58 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; }; - 9FF406E2239F16E7005F0C58 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21CF12242EFA400E7F88E /* libRCTText.a */; }; - 9FF406E5239F16FD005F0C58 /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 834C36D21AF8DA610019C93C /* libRCTSettings.a */; }; - 9FF406E6239F1703005F0C58 /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DC67F11AB71876001358AB /* libRCTPushNotification.a */; }; - 9FF406E7239F1708005F0C58 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 357859011B28D2C500341EDB /* libRCTLinking.a */; }; - 9FF406E8239F1710005F0C58 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; }; - 9FF406E9239F1717005F0C58 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; }; - 9FF406EA239F1721005F0C58 /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */; }; - 9FF406EB239F1727005F0C58 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E501A31D07A502005F35D8 /* libRCTAnimation.a */; }; - 9FF406EC239F172D005F0C58 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; }; - 9FF406ED239F1732005F0C58 /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF651ECA405900F0A767 /* libART.a */; }; - 9FF406EE239F1737005F0C58 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */; }; - 9FF406EF239F173D005F0C58 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; }; - 9FF406F0239F1746005F0C58 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; - 9FF406F1239F174B005F0C58 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; }; - 9FF406F2239F1751005F0C58 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; }; - 9FF406F3239F1756005F0C58 /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 834C36D21AF8DA610019C93C /* libRCTSettings.a */; }; - 9FF406F4239F175D005F0C58 /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DC67F11AB71876001358AB /* libRCTPushNotification.a */; }; - 9FF406F5239F1762005F0C58 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 357859011B28D2C500341EDB /* libRCTLinking.a */; }; - 9FF406F6239F1767005F0C58 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; }; - 9FF406F7239F176D005F0C58 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; }; - 9FF406F8239F1771005F0C58 /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */; }; - 9FF406F9239F1777005F0C58 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E501A31D07A502005F35D8 /* libRCTAnimation.a */; }; - 9FF406FA239F177E005F0C58 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; }; - 9FF406FB239F1783005F0C58 /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D66FF651ECA405900F0A767 /* libART.a */; }; - 9FF406FC239F1787005F0C58 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */; }; - 9FF406FD239F178F005F0C58 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; }; - 9FF406FE239F1794005F0C58 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9FF406FF239F179A005F0C58 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9FF40700239F17A0005F0C58 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */; }; - 9FF40702239F1AA7005F0C58 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD21D122242EFA400E7F88E /* libReact.a */; }; - AFEACA842223EB05004E5198 /* CrashyCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = AFEACA832223EB05004E5198 /* CrashyCrash.m */; }; - BC9C03401DC9F1D600B1C635 /* RCTDevMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9C033F1DC9F1D600B1C635 /* RCTDevMenuTests.m */; }; - C60A228221C9726800B820FE /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C60A228121C9726800B820FE /* RCTFormatErrorTests.m */; }; - C60A228321C9726800B820FE /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C60A228121C9726800B820FE /* RCTFormatErrorTests.m */; }; - C654F0B31EB34A73000B7A9A /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */; }; - C654F17E1EB34D24000B7A9A /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */; }; - D42902901F1CE21600685AE7 /* libRCTLinking-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D429028F1F1CE21600685AE7 /* libRCTLinking-macOS.a */; }; - D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; }; - E77B20F321C481F8007FDF6D /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */; }; - ED2970992150247000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2970982150247000B7C4FE /* JavaScriptCore.framework */; }; - EDEBC856214C774100DD5AC8 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 13417FE71AA91428003F314A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 13417FEE1AA914B8003F314A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; - 1341802A1AA91779003F314A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 13E501A21D07A502005F35D8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 143BC59B1B21E3E100462512 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = RNTester; - }; - 147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 14AADF031AC3DB95002390C9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 14DC67F01AB71876001358AB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTPushNotification; - }; - 18B8F9C22143301000CE911A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 18F3BA1C2142F86400AD247D; - remoteInfo = "jsinspector-macOS"; - }; - 18CD946E2149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6484CE4D201A74FA004275A4; - remoteInfo = "RCTBlob-macOS"; - }; - 18CD94702149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 647647611F0BC33500C2D89B; - remoteInfo = "ART-macOS"; - }; - 18CD94722149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6B857DA21EC51FC600A9D063; - remoteInfo = "React-macOS"; - }; - 18CD94742149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 649D87CC1F69D9BC0005AF18; - remoteInfo = "RCTActionSheet-macOS"; - }; - 18CD94762149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 647647861F0BC7F200C2D89B; - remoteInfo = "RCTAnimation-macOS"; - }; - 18CD947A2149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7ACD1ECB9C4400CC951F; - remoteInfo = "RCTImage-macOS"; - }; - 18CD947C2149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = D4C812E11F1CC42300FFA059; - remoteInfo = "RCTLinking-macOS"; - }; - 18CD947E2149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7A851ECB6E8400CC951F; - remoteInfo = "RCTNetwork-macOS"; - }; - 18CD94802149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6424F7A41F669A3A0025D741; - remoteInfo = "RCTPushNotification-macOS"; - }; - 18CD94822149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6448A5C71F292E63006FF1F5; - remoteInfo = "RCTSettings-macOS"; - }; - 18CD94862149B235009E2179 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7A4F1ECB6B8200CC951F; - remoteInfo = "RCTWebSocket-macOS"; - }; - 18CF93E8214723F400CDCB6F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7AB21ECB8D6200CC951F; - remoteInfo = "RCTText-macos"; - }; - 18FC77A71EF4770B002B3F17 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 18FC77851EF4770B002B3F17; - remoteInfo = "RNTester-macOS"; - }; - 2D66FF641ECA405900F0A767 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C; - remoteInfo = ART; - }; - 2D66FF661ECA405900F0A767 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 323A12871E5F266B004975B8; - remoteInfo = "ART-tvOS"; - }; - 2D66FF8B1ECA405900F0A767 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D383D3C1EBD27B6005632C8; - remoteInfo = "third-party-tvOS"; - }; - 2D66FF8D1ECA405900F0A767 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D383D621EBD27B9005632C8; - remoteInfo = "double-conversion-tvOS"; - }; - 2DD323B41DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 2DD323BA1DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; - remoteInfo = "RCTImage-tvOS"; - }; - 2DD323BE1DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28471D9B043800D4039D; - remoteInfo = "RCTLinking-tvOS"; - }; - 2DD323C21DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28541D9B044C00D4039D; - remoteInfo = "RCTNetwork-tvOS"; - }; - 2DD323C71DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28611D9B046600D4039D; - remoteInfo = "RCTSettings-tvOS"; - }; - 2DD323CF1DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A287B1D9B048500D4039D; - remoteInfo = "RCTText-tvOS"; - }; - 2DD323D41DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28881D9B049200D4039D; - remoteInfo = "RCTWebSocket-tvOS"; - }; - 2DD323D81DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "React-tvOS"; - }; - 357859001B28D2C500341EDB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 3D05746B1DE6008900184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D05745F1DE6004600184BB4; - remoteInfo = "RCTPushNotification-tvOS"; - }; - 3D05748B1DE6008900184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 3D05748D1DE6008900184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 3D13F84B1D6F6B5F00E69E0E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D13F83D1D6F6AE000E69E0E; - remoteInfo = RNTesterBundle; - }; - 3D3C08801DE3424E00C268FA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C059A1DE3340900C268FA; - remoteInfo = yoga; - }; - 3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C06751DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3D507F411EBC88B700B56834 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; - remoteInfo = "third-party"; - }; - 3D507F431EBC88B700B56834 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 139D7E881E25C6D100323FB7; - remoteInfo = "double-conversion"; - }; - 3DBE0D321F3B18670099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3DBE0D001F3B181A0099AA32; - remoteInfo = fishhook; - }; - 3DBE0D341F3B18670099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32; - remoteInfo = "fishhook-tvOS"; - }; - 3DCE53211FEAB1C500613583 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EBF21BDC1FC498900052F4D5; - remoteInfo = jsinspector; - }; - 3DCE53231FEAB1C500613583 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5; - remoteInfo = "jsinspector-tvOS"; - }; - 5281CA501EEAC9A700AC40CD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 358F4ED71D1E81A9004DF814; - remoteInfo = RCTBlob; - }; - 5281CA521EEAC9A700AC40CD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ADD01A681E09402E00F6D226; - remoteInfo = "RCTBlob-tvOS"; - }; - 6424F7B11F669A8E0025D741 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6424F7AC1F669A3A0025D741; - remoteInfo = "RCTPushNotification-macOS"; - }; - 6448A5D11F292F16006FF1F5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6448A5CD1F292E63006FF1F5; - remoteInfo = "RCTSettings-macOS"; - }; - 647647301F0BC04800C2D89B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 647646E41F0BAC6600C2D89B; - remoteInfo = "ART-macOS"; - }; - 647647C71F0BCC5500C2D89B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 647647C51F0BC7F200C2D89B; - remoteInfo = "RCTAnimation-macOS"; - }; - 6484CE59201A7557004275A4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6484CE57201A74FA004275A4; - remoteInfo = "RCTBlob-macOS"; - }; - 649BF7182019105B0068273E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 18C3A9BF1FE1D41600DEC48A; - remoteInfo = "fishhook-macOS"; - }; - 6862DFAB2229DCC400684E03 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 580C376F1AB104AF0015E709; - remoteInfo = RCTTest; - }; - 6862DFAD2229DCC400684E03 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A286E1D9B047700D4039D; - remoteInfo = "RCTTest-tvOS"; - }; - 834C36D11AF8DA610019C93C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 9F5C1805230B4F2400E3E5A7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 649D87D21F69D9BC0005AF18; - remoteInfo = "RCTActionSheet-macOS"; - }; - 9F5C1819230B4F2400E3E5A7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 18DF57221EFA052000BF4666; - remoteInfo = "RCTTest-macOS"; - }; - 9FB7D3E6224ABD0E00F31D11 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9FD21D78224303D900E7F88E; - remoteInfo = "jsi-macOS"; - }; - 9FB7D3E8224ABD0E00F31D11 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9FD21D94224305AA00E7F88E; - remoteInfo = "jsiexecutor-macOS"; - }; - 9FBFA7AB233D53BA003D9A8D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FBFA512233C7E4C003D9A8D; - remoteInfo = "RNTesterBundle-macOS"; - }; - 9FD21CD42242EE5B00E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 2DD3238F1DA2DD8A000FE1B8; - remoteInfo = "RNTester-tvOS"; - }; - 9FD21CE02242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6BDE7AEB1ECB9C4400CC951F; - remoteInfo = "RCTImage-macOS"; - }; - 9FD21CE62242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6BDE7A901ECB6E8400CC951F; - remoteInfo = "RCTNetwork-macOS"; - }; - 9FD21CF02242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147675; - remoteInfo = "RCTText-macos"; - }; - 9FD21CF82242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6BDE7A581ECB6B8200CC951F; - remoteInfo = "RCTWebSocket-macOS"; - }; - 9FD21D112242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9F2AC95D2239D788005C9C14; - remoteInfo = "React-macOS"; - }; - 9FD21D132242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6B857F341EC51FCC00A9D063; - remoteInfo = "yoga-macOS"; - }; - 9FD21D152242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 6B857F421EC51FCF00A9D063; - remoteInfo = "cxxreact-macOS"; - }; - 9FD21D192242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 188202A21EF48CF700C9B354; - remoteInfo = "third-party-macOS"; - }; - 9FD21D1B2242EFA400E7F88E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 1882027C1EF48B7E00C9B354; - remoteInfo = "double-conversion-macOS"; - }; - 9FF40703239F1AB4005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6B857DA21EC51FC600A9D063; - remoteInfo = "React-macOS"; - }; - 9FF40705239F1ADA005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7AB21ECB8D6200CC951F; - remoteInfo = "RCTText-macos"; - }; - 9FF40707239F1AE1005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7A4F1ECB6B8200CC951F; - remoteInfo = "RCTWebSocket-macOS"; - }; - 9FF40709239F1AE8005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6448A5C71F292E63006FF1F5; - remoteInfo = "RCTSettings-macOS"; - }; - 9FF4070B239F1AEE005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = D4C812E11F1CC42300FFA059; - remoteInfo = "RCTLinking-macOS"; - }; - 9FF4070D239F1AF6005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6424F7A41F669A3A0025D741; - remoteInfo = "RCTPushNotification-macOS"; - }; - 9FF4070F239F1AFC005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7ACD1ECB9C4400CC951F; - remoteInfo = "RCTImage-macOS"; - }; - 9FF40711239F1B01005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6BDE7A851ECB6E8400CC951F; - remoteInfo = "RCTNetwork-macOS"; - }; - 9FF40713239F1B09005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 647647861F0BC7F200C2D89B; - remoteInfo = "RCTAnimation-macOS"; - }; - 9FF40715239F1B11005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 649D87CC1F69D9BC0005AF18; - remoteInfo = "RCTActionSheet-macOS"; - }; - 9FF40717239F1B18005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 647647611F0BC33500C2D89B; - remoteInfo = "ART-macOS"; - }; - 9FF40719239F1B1D005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 6484CE4D201A74FA004275A4; - remoteInfo = "RCTBlob-macOS"; - }; - 9FF4071B239F1B6D005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 3C86DF451ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 9FF4071D239F1B72005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 832C817F1AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 9FF4071F239F1B77005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5119A1A9E6C1200147676; - remoteInfo = RCTText; - }; - 9FF40721239F1B7D005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTSettings; - }; - 9FF40723239F1B83005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTPushNotification; - }; - 9FF40725239F1B88005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTLinking; - }; - 9FF40727239F1B8D005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5115C1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 9FF40729239F1B92005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 9FF4072B239F1B98005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5115C1A9E6B3D00147676; - remoteInfo = RCTCameraRoll; - }; - 9FF4072D239F1B9E005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTAnimation; - }; - 9FF4072F239F1BA4005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTActionSheet; - }; - 9FF40731239F1BAB005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0CF68AC01AF0540F00FF9E5C; - remoteInfo = ART; - }; - 9FF40733239F1BB1005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 358F4ED61D1E81A9004DF814; - remoteInfo = RCTBlob; - }; - 9FF40735239F1BB7005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 83CBBA2D1A601D0E00E9B192; - remoteInfo = React; - }; - 9FF40737239F1BC9005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 3C86DF451ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 9FF40739239F1BCE005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 832C817F1AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 9FF4073B239F1BD4005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5119A1A9E6C1200147676; - remoteInfo = RCTText; - }; - 9FF4073D239F1BD9005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTSettings; - }; - 9FF4073F239F1BE1005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTPushNotification; - }; - 9FF40741239F1BE5005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTLinking; - }; - 9FF40743239F1BEB005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5115C1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 9FF40745239F1BF1005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 9FF40747239F1BF6005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B5115C1A9E6B3D00147676; - remoteInfo = RCTCameraRoll; - }; - 9FF40749239F1BFE005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTAnimation; - }; - 9FF4074B239F1C04005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 58B511DA1A9E6C8500147676; - remoteInfo = RCTActionSheet; - }; - 9FF4074D239F1C09005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0CF68AC01AF0540F00FF9E5C; - remoteInfo = ART; - }; - 9FF4074F239F1C0E005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 358F4ED61D1E81A9004DF814; - remoteInfo = RCTBlob; - }; - 9FF40751239F1C15005F0C58 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 83CBBA2D1A601D0E00E9B192; - remoteInfo = React; - }; - D429028E1F1CE21600685AE7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = D4C812E71F1CC42300FFA059; - remoteInfo = "RCTLinking-macOS"; - }; - D85B829B1AB6D5CE003F4FE2 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - ED2970942150246200B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ED296FB6214C9A0900B7C4FE; - remoteInfo = "jsi-tvOS"; - }; - ED2970962150246200B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ED296FEE214C9CF800B7C4FE; - remoteInfo = "jsiexecutor-tvOS"; - }; - EDEBC6FB214B402000DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EDEBC6D6214B3E7000DD5AC8; - remoteInfo = jsi; - }; - EDEBC7C9214C503A00DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EDEBC73B214B45A300DD5AC8; - remoteInfo = jsiexecutor; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9FCC5EAC2252D34C009029D1 /* Copy Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 9F153613233C37C8006DFE44 /* OCMock.framework in Copy Framework */, - ); - name = "Copy Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC7DE214C68E400DD5AC8 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReaderTests.m; sourceTree = ""; }; - 004D289E1AAF61C70097A701 /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 04F27E102288190500F536C3 /* RCTPerformanceLoggerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLoggerTests.m; sourceTree = ""; }; - 1300627E1B59179B0043FE5A /* RCTGzipTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGzipTests.m; sourceTree = ""; }; - 13129DD31C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitNotificationRaceTests.m; sourceTree = ""; }; - 13417FE31AA91428003F314A /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; - 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; - 134180261AA91779003F314A /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; - 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitTests.m; sourceTree = ""; }; - 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowViewTests.m; sourceTree = ""; }; - 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTCameraRoll.xcodeproj; path = ../Libraries/CameraRoll/RCTCameraRoll.xcodeproj; sourceTree = ""; }; - 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethodTests.mm; sourceTree = ""; }; - 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* RNTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNTester.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RNTester/AppDelegate.h; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNTester/main.m; sourceTree = ""; }; - 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTURLUtilsTests.m; sourceTree = ""; }; - 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentPropsTests.m; sourceTree = ""; }; - 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; - 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = ""; }; - 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMethodArgumentTests.m; sourceTree = ""; }; - 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = ../Libraries/NativeAnimation/RCTAnimation.xcodeproj; sourceTree = ""; }; - 143BC57E1B21E18100462512 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 143BC5951B21E3E100462512 /* RNTesterIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 143BC5981B21E3E100462512 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 143BC5A01B21E45C00462512 /* RNTesterSnapshotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterSnapshotTests.m; sourceTree = ""; }; - 144D21231B2204C5006DB32B /* RCTImageUtilTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtilTests.m; sourceTree = ""; }; - 1497CFA41B21F5E400C1F8F2 /* RCTAllocationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAllocationTests.m; sourceTree = ""; }; - 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSURLTests.m; sourceTree = ""; }; - 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = ""; }; - 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventDispatcherTests.m; sourceTree = ""; }; - 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerTests.m; sourceTree = ""; }; - 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../React/React.xcodeproj; sourceTree = ""; }; - 14D6D7021B220AE3001FB087 /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; - 14D6D7031B220AE3001FB087 /* OCMArg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMArg.h; sourceTree = ""; }; - 14D6D7041B220AE3001FB087 /* OCMConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMConstraint.h; sourceTree = ""; }; - 14D6D7051B220AE3001FB087 /* OCMLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMLocation.h; sourceTree = ""; }; - 14D6D7061B220AE3001FB087 /* OCMMacroState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMMacroState.h; sourceTree = ""; }; - 14D6D7071B220AE3001FB087 /* OCMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMock.h; sourceTree = ""; }; - 14D6D7081B220AE3001FB087 /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = ""; }; - 14D6D7091B220AE3001FB087 /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = ""; }; - 14D6D70A1B220AE3001FB087 /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = ""; }; - 14D6D7101B220EB3001FB087 /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = ""; }; - 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTPushNotification.xcodeproj; path = ../Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj; sourceTree = ""; }; - 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; - 1879ECDE21E84E2800D98372 /* RCTConvert_NSColorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSColorTests.m; sourceTree = ""; }; - 18BFA4931F01C46700969486 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMock.framework; sourceTree = ""; }; - 18D8D99F21C06BCE00E0CCAC /* libiosDeviceBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiosDeviceBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 18FC77861EF4770B002B3F17 /* RNTester-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RNTester-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 18FC77881EF4770B002B3F17 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 18FC77891EF4770B002B3F17 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 18FC778C1EF4770B002B3F17 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 18FC778E1EF4770B002B3F17 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 18FC778F1EF4770B002B3F17 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 18FC77911EF4770B002B3F17 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 18FC77941EF4770B002B3F17 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 18FC77961EF4770B002B3F17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 18FC779B1EF4770B002B3F17 /* RNTester-macOSUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-macOSUnitTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 18FC779F1EF4770B002B3F17 /* RNTesterUnitTests_macOS.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTesterUnitTests_macOS.m; sourceTree = ""; }; - 18FC77A11EF4770B002B3F17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 18FC77A61EF4770B002B3F17 /* RNTester-macOSIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-macOSIntegrationTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 18FC77AA1EF4770B002B3F17 /* RNTesterIntegrationTests_macOS.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests_macOS.m; sourceTree = ""; }; - 18FC77AC1EF4770B002B3F17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 192F69B51E82409A008692C7 /* RCTAnimationUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtilsTests.m; sourceTree = ""; }; - 192F69B61E82409A008692C7 /* RCTConvert_YGValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_YGValueTests.m; sourceTree = ""; }; - 192F69B71E82409A008692C7 /* RCTNativeAnimatedNodesManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedNodesManagerTests.m; sourceTree = ""; }; - 19BA88D41F84344F00741C5A /* RCTBlobManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTBlobManagerTests.m; sourceTree = ""; }; - 272E6B3B1BEA849E001FCF37 /* UpdatePropertiesExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UpdatePropertiesExampleView.h; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.h; sourceTree = ""; }; - 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UpdatePropertiesExampleView.m; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.m; sourceTree = ""; }; - 27B885551BED29AF00008352 /* RCTRootViewIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootViewIntegrationTests.m; sourceTree = ""; }; - 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlexibleSizeExampleView.m; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.m; sourceTree = ""; }; - 27F441EA1BEBE5030039B79C /* FlexibleSizeExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlexibleSizeExampleView.h; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.h; sourceTree = ""; }; - 2D4624E01DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-tvOSIntegrationTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = ../Libraries/ART/ART.xcodeproj; sourceTree = ""; }; - 2DD323901DA2DD8A000FE1B8 /* RNTester-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RNTester-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DD323A01DA2DD8B000FE1B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2DD323A51DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-tvOSUnitTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RNTester/Images.xcassets; sourceTree = ""; }; - 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; - 38C500E122D3CF2E00BCD999 /* RCTConvert_UIColorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_UIColorTests.m; sourceTree = ""; }; - 39AA31A31DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUnicodeDecodeTests.m; sourceTree = ""; }; - 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D13F8401D6F6AE000E69E0E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; - 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ImageInBundle.png; sourceTree = ""; }; - 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = OtherImages.xcassets; sourceTree = ""; }; - 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLoggingTests.m; sourceTree = ""; }; - 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "legacy_image@2x.png"; path = "RNTester/legacy_image@2x.png"; sourceTree = ""; }; - 3DB99D0B1BA0340600302749 /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = ""; }; - 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RNTesterUnitTestsBundle.js; sourceTree = ""; }; - 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = ../Libraries/Blob/RCTBlob.xcodeproj; sourceTree = ""; }; - 5C2B71142267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeSampleTurboModuleSpec.h; sourceTree = ""; }; - 5C2B71152267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNativeSampleTurboModuleSpec.mm; sourceTree = ""; }; - 5C2B71182267DB1A0066069E /* RCTSampleTurboModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSampleTurboModule.h; sourceTree = ""; }; - 5C2B711A2267DB1A0066069E /* RCTSampleTurboModule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSampleTurboModule.mm; sourceTree = ""; }; - 5C60EB582264416A0018C04F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = RNTester/AppDelegate.mm; sourceTree = ""; }; - 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTTest.xcodeproj; path = RCTTest/RCTTest.xcodeproj; sourceTree = ""; }; - 6862DFCD2229DFCB00684E03 /* Screenshot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Screenshot.h; sourceTree = ""; }; - 6862DFCE2229DFCC00684E03 /* Screenshot.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Screenshot.m; sourceTree = ""; }; - 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = ""; }; - 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = ""; }; - 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderTests.m; sourceTree = ""; }; - 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderHelpers.m; sourceTree = ""; }; - 8385CF051B8747A000C6273E /* RCTImageLoaderHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTImageLoaderHelpers.h; sourceTree = ""; }; - 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; - 9F1C4D00236CB06B0022EC0D /* RNTesterTestPlan_iOS.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = RNTesterTestPlan_iOS.xctestplan; sourceTree = ""; }; - 9F4D1F022375E7A10012B4A9 /* RNTesterTestPlan_mac.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = RNTesterTestPlan_mac.xctestplan; sourceTree = ""; }; - 9F5C1923230F46CB00E3E5A7 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; - 9FBFA513233C7E4C003D9A8D /* RNTesterBundle-macOS.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTesterBundle-macOS.bundle"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9FBFA515233C7E4C003D9A8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AFEACA822223EB05004E5198 /* CrashyCrash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrashyCrash.h; sourceTree = ""; }; - AFEACA832223EB05004E5198 /* CrashyCrash.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CrashyCrash.m; sourceTree = ""; }; - BC9C033F1DC9F1D600B1C635 /* RCTDevMenuTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenuTests.m; sourceTree = ""; }; - C60A228121C9726800B820FE /* RCTFormatErrorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTFormatErrorTests.m; sourceTree = ""; }; - C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterTestModule.m; sourceTree = ""; }; - D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; - ED2970982150247000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; - EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 004D289B1AAF61C70097A701 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E77B20F321C481F8007FDF6D /* JavaScriptCore.framework in Frameworks */, - 19BA89031F8439A700741C5A /* libRCTBlob.a in Frameworks */, - 192F69DA1E8240E2008692C7 /* libRCTAnimation.a in Frameworks */, - 14D6D71E1B2222EF001FB087 /* libRCTActionSheet.a in Frameworks */, - 14D6D7211B2222EF001FB087 /* libRCTImage.a in Frameworks */, - 14D6D7221B2222EF001FB087 /* libRCTNetwork.a in Frameworks */, - 14D6D7231B2222EF001FB087 /* libRCTPushNotification.a in Frameworks */, - 14D6D7241B2222EF001FB087 /* libRCTSettings.a in Frameworks */, - 6862DFC62229DCE600684E03 /* libRCTTest.a in Frameworks */, - 14D6D7261B2222EF001FB087 /* libRCTText.a in Frameworks */, - 14D6D7271B2222EF001FB087 /* libRCTVibration.a in Frameworks */, - 14D6D7281B2222EF001FB087 /* libRCTWebSocket.a in Frameworks */, - 14D6D7291B2222EF001FB087 /* libReact.a in Frameworks */, - 14D6D7111B220EB3001FB087 /* libOCMock.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - EDEBC856214C774100DD5AC8 /* JavaScriptCore.framework in Frameworks */, - 3D0E379D1F1CC77200DCAC9F /* libReact.a in Frameworks */, - 52C11BBB1EEACA7100C1A058 /* libRCTBlob.a in Frameworks */, - 2D66FF8F1ECA406D00F0A767 /* libART.a in Frameworks */, - 147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */, - 13E501F11D07A84A005F35D8 /* libRCTAnimation.a in Frameworks */, - 138DEE241B9EDFB6007F4EA5 /* libRCTCameraRoll.a in Frameworks */, - 1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */, - 13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */, - 3578590A1B28D2CF00341EDB /* libRCTLinking.a in Frameworks */, - 14DC67F41AB71881001358AB /* libRCTPushNotification.a in Frameworks */, - 834C36EC1AF8DED70019C93C /* libRCTSettings.a in Frameworks */, - 134180011AA9153C003F314A /* libRCTText.a in Frameworks */, - D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */, - 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 143BC5921B21E3E100462512 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6862DFC72229DD1000684E03 /* libRCTTest.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18D8D99C21C06BCE00E0CCAC /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FF406FF239F179A005F0C58 /* JavaScriptCore.framework in Frameworks */, - 9FF406EF239F173D005F0C58 /* libReact.a in Frameworks */, - 9FF406EE239F1737005F0C58 /* libRCTBlob.a in Frameworks */, - 9FF406ED239F1732005F0C58 /* libART.a in Frameworks */, - 9FF406EC239F172D005F0C58 /* libRCTActionSheet.a in Frameworks */, - 9FF406EB239F1727005F0C58 /* libRCTAnimation.a in Frameworks */, - 9FF406EA239F1721005F0C58 /* libRCTCameraRoll.a in Frameworks */, - 9FF406E9239F1717005F0C58 /* libRCTNetwork.a in Frameworks */, - 9FF406E8239F1710005F0C58 /* libRCTImage.a in Frameworks */, - 9FF406E7239F1708005F0C58 /* libRCTLinking.a in Frameworks */, - 9FF406E6239F1703005F0C58 /* libRCTPushNotification.a in Frameworks */, - 9FF406E5239F16FD005F0C58 /* libRCTSettings.a in Frameworks */, - 9FF406E2239F16E7005F0C58 /* libRCTText.a in Frameworks */, - 9FF406E1239F16E2005F0C58 /* libRCTVibration.a in Frameworks */, - 9FF406E0239F16DD005F0C58 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77831EF4770B002B3F17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F15350A233ABA82006DFE44 /* JavaScriptCore.framework in Frameworks */, - 9F5C182C230B7A6800E3E5A7 /* libReact.a in Frameworks */, - 9F5C182B230B4F7400E3E5A7 /* libRCTBlob-macOS.a in Frameworks */, - 9F5C182A230B4F7000E3E5A7 /* libART-macOS.a in Frameworks */, - 9F5C1829230B4F6800E3E5A7 /* libRCTActionSheet.a in Frameworks */, - 9F5C1828230B4F6200E3E5A7 /* libRCTAnimation.a in Frameworks */, - 9F5C1827230B4F5600E3E5A7 /* libRCTNetwork.a in Frameworks */, - 9F5C1826230B4F5000E3E5A7 /* libRCTImage.a in Frameworks */, - 9F5C182D230B7A7E00E3E5A7 /* libRCTPushNotification-macOS.a in Frameworks */, - D42902901F1CE21600685AE7 /* libRCTLinking-macOS.a in Frameworks */, - 9F5C1825230B4F4500E3E5A7 /* libRCTSettings-macOS.a in Frameworks */, - 9F5C1823230B4F3500E3E5A7 /* libRCTWebSocket.a in Frameworks */, - 9F5C1824230B4F4000E3E5A7 /* libRCTText.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77981EF4770B002B3F17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F153612233C37AE006DFE44 /* OCMock.framework in Frameworks */, - 9F1534BE233AB44F006DFE44 /* JavaScriptCore.framework in Frameworks */, - 9F7CD41A2339A936005B9D55 /* libRCTBlob-macOS.a in Frameworks */, - 18FE57B02149BCDB000CB2A7 /* libRCTAnimation.a in Frameworks */, - 9F7CD4192339A92D005B9D55 /* libRCTActionSheet.a in Frameworks */, - 9F7CD4182339A925005B9D55 /* libRCTImage.a in Frameworks */, - 9F7CD4172339A920005B9D55 /* libRCTNetwork.a in Frameworks */, - 9F7CD4162339A91A005B9D55 /* libRCTPushNotification-macOS.a in Frameworks */, - 9F7CD4152339A913005B9D55 /* libRCTSettings-macOS.a in Frameworks */, - 9F7CD4142339A90C005B9D55 /* libRCTTest-macOS.a in Frameworks */, - 9F7CD4132339A906005B9D55 /* libRCTText.a in Frameworks */, - 9F7CD4122339A8FF005B9D55 /* libRCTWebSocket.a in Frameworks */, - 9F153508233AB998006DFE44 /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77A31EF4770B002B3F17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F15350C233ACE3B006DFE44 /* JavaScriptCore.framework in Frameworks */, - 9F153611233C32B8006DFE44 /* libRCTLinking-macOS.a in Frameworks */, - 9F153610233C32AF006DFE44 /* libRCTImage.a in Frameworks */, - 9F15359E233C2D6A006DFE44 /* libRCTText.a in Frameworks */, - 9F15356B233C2CC5006DFE44 /* libRCTNetwork.a in Frameworks */, - 9F15350D233ACE67006DFE44 /* libRCTWebSocket.a in Frameworks */, - 9F15350B233ACE27006DFE44 /* libReact.a in Frameworks */, - 9F7CD41B2339A95F005B9D55 /* libRCTTest-macOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D4624D91DA2EA6900C74D09 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6862DFC92229DD2100684E03 /* libRCTTest-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD3238D1DA2DD8A000FE1B8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FBFA5CF233C9469003D9A8D /* libReact.a in Frameworks */, - ED2970992150247000B7C4FE /* JavaScriptCore.framework in Frameworks */, - 52C11BE11EEACA7800C1A058 /* libRCTBlob-tvOS.a in Frameworks */, - 2D66FF901ECA407E00F0A767 /* libART-tvOS.a in Frameworks */, - 2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation.a in Frameworks */, - 3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */, - 2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */, - 2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */, - 3D05746D1DE6008900184BB4 /* libRCTPushNotification-tvOS.a in Frameworks */, - 2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */, - 2DD323E81DA2DE3F000FE1B8 /* libRCTText-tvOS.a in Frameworks */, - 2DD323E91DA2DE3F000FE1B8 /* libRCTWebSocket-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD323A21DA2DD8B000FE1B8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6862DFC82229DD1900684E03 /* libRCTTest-tvOS.a in Frameworks */, - 2DE7E7FD1FB2A4F3009E225D /* libRCTAnimation.a in Frameworks */, - 2DE7E7FE1FB2A4F3009E225D /* libRCTBlob-tvOS.a in Frameworks */, - 2DE7E7FF1FB2A4F3009E225D /* libRCTImage-tvOS.a in Frameworks */, - 2DE7E8001FB2A4F3009E225D /* libRCTLinking-tvOS.a in Frameworks */, - 2DE7E8011FB2A4F3009E225D /* libRCTNetwork-tvOS.a in Frameworks */, - 2DE7E8021FB2A4F3009E225D /* libRCTPushNotification-tvOS.a in Frameworks */, - 2DE7E8031FB2A4F3009E225D /* libRCTSettings-tvOS.a in Frameworks */, - 2DE7E8051FB2A4F3009E225D /* libRCTText-tvOS.a in Frameworks */, - 2DE7E8061FB2A4F3009E225D /* libRCTWebSocket-tvOS.a in Frameworks */, - 2DE7E8071FB2A4F3009E225D /* libReact.a in Frameworks */, - 2D4BD8E71DA2E20D005AC8A8 /* libOCMock.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D13F83B1D6F6AE000E69E0E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F61696A225FB3F1008F89F1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FF406FE239F1794005F0C58 /* JavaScriptCore.framework in Frameworks */, - 9FF406FD239F178F005F0C58 /* libReact.a in Frameworks */, - 9FF406FC239F1787005F0C58 /* libRCTBlob.a in Frameworks */, - 9FF406FB239F1783005F0C58 /* libART.a in Frameworks */, - 9FF406FA239F177E005F0C58 /* libRCTActionSheet.a in Frameworks */, - 9FF406F9239F1777005F0C58 /* libRCTAnimation.a in Frameworks */, - 9FF406F8239F1771005F0C58 /* libRCTCameraRoll.a in Frameworks */, - 9FF406F7239F176D005F0C58 /* libRCTNetwork.a in Frameworks */, - 9FF406F6239F1767005F0C58 /* libRCTImage.a in Frameworks */, - 9FF406F5239F1762005F0C58 /* libRCTLinking.a in Frameworks */, - 9FF406F4239F175D005F0C58 /* libRCTPushNotification.a in Frameworks */, - 9FF406F3239F1756005F0C58 /* libRCTSettings.a in Frameworks */, - 9FF406F2239F1751005F0C58 /* libRCTText.a in Frameworks */, - 9FF406F1239F174B005F0C58 /* libRCTVibration.a in Frameworks */, - 9FF406F0239F1746005F0C58 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F616990225FB40C008F89F1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FF40700239F17A0005F0C58 /* JavaScriptCore.framework in Frameworks */, - 9FF40702239F1AA7005F0C58 /* libReact.a in Frameworks */, - 9FF406DE239F16A3005F0C58 /* libRCTBlob-macOS.a in Frameworks */, - 9FF406DD239F169D005F0C58 /* libART-macOS.a in Frameworks */, - 9FF406DC239F1697005F0C58 /* libRCTActionSheet.a in Frameworks */, - 9FF406DB239F1691005F0C58 /* libRCTAnimation.a in Frameworks */, - 9FF406DA239F168A005F0C58 /* libRCTNetwork.a in Frameworks */, - 9FF406D9239F1684005F0C58 /* libRCTImage.a in Frameworks */, - 9FF406D8239F1675005F0C58 /* libRCTPushNotification-macOS.a in Frameworks */, - 9FF406D7239F166F005F0C58 /* libRCTLinking-macOS.a in Frameworks */, - 9FF406D6239F166B005F0C58 /* libRCTSettings-macOS.a in Frameworks */, - 9FF406D5239F1665005F0C58 /* libRCTWebSocket.a in Frameworks */, - 9FF406A2239F165E005F0C58 /* libRCTText.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FBFA510233C7E4C003D9A8D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1316A21D1AA397F400C0188E /* Libraries */ = { - isa = PBXGroup; - children = ( - 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */, - 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */, - 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */, - 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */, - 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */, - 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */, - 13417FE31AA91428003F314A /* RCTImage.xcodeproj */, - 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */, - 134180261AA91779003F314A /* RCTNetwork.xcodeproj */, - 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */, - 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */, - 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */, - 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */, - D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */, - 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 1323F18D1C04ABAC0091BED0 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */, - 13B07FB61A68108700A75B9A /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 13417FE41AA91428003F314A /* Products */ = { - isa = PBXGroup; - children = ( - 13417FE81AA91428003F314A /* libRCTImage.a */, - 9FD21CE12242EFA400E7F88E /* libRCTImage.a */, - 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13417FEB1AA914B8003F314A /* Products */ = { - isa = PBXGroup; - children = ( - 13417FEF1AA914B8003F314A /* libRCTText.a */, - 9FD21CF12242EFA400E7F88E /* libRCTText.a */, - 2DD323D01DA2DD8B000FE1B8 /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 134180271AA91779003F314A /* Products */ = { - isa = PBXGroup; - children = ( - 1341802B1AA91779003F314A /* libRCTNetwork.a */, - 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */, - 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 138DEE031B9EDDDB007F4EA5 /* Products */ = { - isa = PBXGroup; - children = ( - 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDECB1B0651EA00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */, - 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */, - 2DD323D51DA2DD8B000FE1B8 /* libRCTWebSocket-tvOS.a */, - 3DBE0D331F3B18670099AA32 /* libfishhook.a */, - 3DBE0D351F3B18670099AA32 /* libfishhook-tvOS.a */, - 649BF7192019105B0068273E /* libfishhook-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* RNTester */ = { - isa = PBXGroup; - children = ( - 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */, - 272E6B3A1BEA846C001FCF37 /* NativeExampleViews */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 5C60EB582264416A0018C04F /* AppDelegate.mm */, - AFEACAB12223EB2C004E5198 /* NativeExampleModules */, - 6862DFD02229E1DE00684E03 /* NativeModuleExample */, - 5C2B70EF2267DB1A0066069E /* turbomodule */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - 1323F18D1C04ABAC0091BED0 /* Supporting Files */, - ); - name = RNTester; - sourceTree = ""; - }; - 13E5019D1D07A502005F35D8 /* Products */ = { - isa = PBXGroup; - children = ( - 13E501A31D07A502005F35D8 /* libRCTAnimation.a */, - 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation.a */, - 647647C81F0BCC5500C2D89B /* libRCTAnimation.a */, - ); - name = Products; - sourceTree = ""; - }; - 143BC57C1B21E18100462512 /* RNTesterUnitTests */ = { - isa = PBXGroup; - children = ( - 18BFA4931F01C46700969486 /* OCMock.framework */, - 192F69B51E82409A008692C7 /* RCTAnimationUtilsTests.m */, - 19BA88D41F84344F00741C5A /* RCTBlobManagerTests.m */, - 192F69B61E82409A008692C7 /* RCTConvert_YGValueTests.m */, - 192F69B71E82409A008692C7 /* RCTNativeAnimatedNodesManagerTests.m */, - 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */, - 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */, - 1497CFA41B21F5E400C1F8F2 /* RCTAllocationTests.m */, - 1879ECDE21E84E2800D98372 /* RCTConvert_NSColorTests.m */, - 38C500E122D3CF2E00BCD999 /* RCTConvert_UIColorTests.m */, - 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */, - 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */, - 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */, - C60A228121C9726800B820FE /* RCTFormatErrorTests.m */, - 1300627E1B59179B0043FE5A /* RCTGzipTests.m */, - 8385CF051B8747A000C6273E /* RCTImageLoaderHelpers.h */, - 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */, - 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */, - 144D21231B2204C5006DB32B /* RCTImageUtilTests.m */, - 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */, - 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */, - 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */, - 13129DD31C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m */, - 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */, - 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */, - 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */, - 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */, - BC9C033F1DC9F1D600B1C635 /* RCTDevMenuTests.m */, - 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */, - 39AA31A31DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m */, - 04F27E102288190500F536C3 /* RCTPerformanceLoggerTests.m */, - 143BC57E1B21E18100462512 /* Info.plist */, - 3DD981D51D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js */, - 14D6D7101B220EB3001FB087 /* libOCMock.a */, - 14D6D7011B220AE3001FB087 /* OCMock */, - ); - path = RNTesterUnitTests; - sourceTree = ""; - }; - 143BC5961B21E3E100462512 /* RNTesterIntegrationTests */ = { - isa = PBXGroup; - children = ( - 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */, - 27B885551BED29AF00008352 /* RCTRootViewIntegrationTests.m */, - 3DB99D0B1BA0340600302749 /* RNTesterIntegrationTests.m */, - 143BC5A01B21E45C00462512 /* RNTesterSnapshotTests.m */, - C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */, - 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */, - 143BC5971B21E3E100462512 /* Supporting Files */, - ); - path = RNTesterIntegrationTests; - sourceTree = ""; - }; - 143BC5971B21E3E100462512 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 143BC5981B21E3E100462512 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 147CED471AB34F8C00DA3E4C /* Products */ = { - isa = PBXGroup; - children = ( - 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */, - 9F5C1806230B4F2400E3E5A7 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 14AADF001AC3DB95002390C9 /* Products */ = { - isa = PBXGroup; - children = ( - 14AADF041AC3DB95002390C9 /* libReact.a */, - 9FD21D122242EFA400E7F88E /* libReact.a */, - 2DD323D91DA2DD8B000FE1B8 /* libReact.a */, - 3D3C08811DE3424E00C268FA /* libyoga.a */, - 9FD21D142242EFA400E7F88E /* libyoga.a */, - 3D3C08831DE3424E00C268FA /* libyoga.a */, - 3D05748C1DE6008900184BB4 /* libcxxreact.a */, - 9FD21D162242EFA400E7F88E /* libcxxreact.a */, - 3D05748E1DE6008900184BB4 /* libcxxreact.a */, - 3DCE53221FEAB1C500613583 /* libjsinspector.a */, - 18B8F9C32143301000CE911A /* libjsinspector-macOS.a */, - 3DCE53241FEAB1C500613583 /* libjsinspector-tvOS.a */, - 3D507F421EBC88B700B56834 /* libthird-party.a */, - 9FD21D1A2242EFA400E7F88E /* libthird-party.a */, - 2D66FF8C1ECA405900F0A767 /* libthird-party.a */, - 3D507F441EBC88B700B56834 /* libdouble-conversion.a */, - 9FD21D1C2242EFA400E7F88E /* libdouble-conversion.a */, - 2D66FF8E1ECA405900F0A767 /* libdouble-conversion.a */, - EDEBC6FC214B402000DD5AC8 /* libjsi.a */, - ED2970952150246200B7C4FE /* libjsi-tvOS.a */, - 9FB7D3E7224ABD0E00F31D11 /* libjsi-macOS.a */, - EDEBC7CA214C503A00DD5AC8 /* libjsiexecutor.a */, - 9FB7D3E9224ABD0E00F31D11 /* libjsiexecutor-macOS.a */, - ED2970972150246200B7C4FE /* libjsiexecutor-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 14D6D7011B220AE3001FB087 /* OCMock */ = { - isa = PBXGroup; - children = ( - 14D6D7021B220AE3001FB087 /* NSNotificationCenter+OCMAdditions.h */, - 14D6D7031B220AE3001FB087 /* OCMArg.h */, - 14D6D7041B220AE3001FB087 /* OCMConstraint.h */, - 14D6D7051B220AE3001FB087 /* OCMLocation.h */, - 14D6D7061B220AE3001FB087 /* OCMMacroState.h */, - 14D6D7071B220AE3001FB087 /* OCMock.h */, - 14D6D7081B220AE3001FB087 /* OCMockObject.h */, - 14D6D7091B220AE3001FB087 /* OCMRecorder.h */, - 14D6D70A1B220AE3001FB087 /* OCMStubRecorder.h */, - ); - path = OCMock; - sourceTree = ""; - }; - 14DC67E81AB71876001358AB /* Products */ = { - isa = PBXGroup; - children = ( - 14DC67F11AB71876001358AB /* libRCTPushNotification.a */, - 3D05746C1DE6008900184BB4 /* libRCTPushNotification-tvOS.a */, - 6424F7B21F669A8E0025D741 /* libRCTPushNotification-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 18FC77871EF4770B002B3F17 /* RNTester-macOS */ = { - isa = PBXGroup; - children = ( - 9F4D1F022375E7A10012B4A9 /* RNTesterTestPlan_mac.xctestplan */, - 18FC77881EF4770B002B3F17 /* AppDelegate.h */, - 18FC77891EF4770B002B3F17 /* AppDelegate.m */, - 18FC778E1EF4770B002B3F17 /* ViewController.h */, - 18FC778F1EF4770B002B3F17 /* ViewController.m */, - 18FC77911EF4770B002B3F17 /* Assets.xcassets */, - 18FC77931EF4770B002B3F17 /* Main.storyboard */, - 18FC77961EF4770B002B3F17 /* Info.plist */, - 18FC778B1EF4770B002B3F17 /* Supporting Files */, - ); - path = "RNTester-macOS"; - sourceTree = ""; - }; - 18FC778B1EF4770B002B3F17 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 18FC778C1EF4770B002B3F17 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 18FC779E1EF4770B002B3F17 /* RNTester-macOSUnitTests */ = { - isa = PBXGroup; - children = ( - 18FC779F1EF4770B002B3F17 /* RNTesterUnitTests_macOS.m */, - 18FC77A11EF4770B002B3F17 /* Info.plist */, - ); - path = "RNTester-macOSUnitTests"; - sourceTree = ""; - }; - 18FC77A91EF4770B002B3F17 /* RNTester-macOSIntegrationTests */ = { - isa = PBXGroup; - children = ( - 18FC77AA1EF4770B002B3F17 /* RNTesterIntegrationTests_macOS.m */, - 18FC77AC1EF4770B002B3F17 /* Info.plist */, - ); - path = "RNTester-macOSIntegrationTests"; - sourceTree = ""; - }; - 272E6B3A1BEA846C001FCF37 /* NativeExampleViews */ = { - isa = PBXGroup; - children = ( - 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */, - 27F441EA1BEBE5030039B79C /* FlexibleSizeExampleView.h */, - 272E6B3B1BEA849E001FCF37 /* UpdatePropertiesExampleView.h */, - 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */, - ); - name = NativeExampleViews; - sourceTree = ""; - }; - 2D66FF601ECA405900F0A767 /* Products */ = { - isa = PBXGroup; - children = ( - 2D66FF651ECA405900F0A767 /* libART.a */, - 2D66FF671ECA405900F0A767 /* libART-tvOS.a */, - 647647311F0BC04800C2D89B /* libART-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 2DD323911DA2DD8B000FE1B8 /* RNTester-tvOS */ = { - isa = PBXGroup; - children = ( - 2DD323A01DA2DD8B000FE1B8 /* Info.plist */, - ); - path = "RNTester-tvOS"; - sourceTree = ""; - }; - 2DE7E7D81FB2A4F3009E225D /* Frameworks */ = { - isa = PBXGroup; - children = ( - 9F1534BD233AB44F006DFE44 /* JavaScriptCore.framework */, - 9F5C1923230F46CB00E3E5A7 /* JavaScriptCore.framework */, - ED2970982150247000B7C4FE /* JavaScriptCore.framework */, - EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 357858F91B28D2C400341EDB /* Products */ = { - isa = PBXGroup; - children = ( - 357859011B28D2C500341EDB /* libRCTLinking.a */, - 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */, - D429028F1F1CE21600685AE7 /* libRCTLinking-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 3D13F83F1D6F6AE000E69E0E /* RNTesterBundle */ = { - isa = PBXGroup; - children = ( - 9F1C4D00236CB06B0022EC0D /* RNTesterTestPlan_iOS.xctestplan */, - 3D13F8401D6F6AE000E69E0E /* Info.plist */, - 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */, - 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */, - ); - name = RNTesterBundle; - path = RNTester/RNTesterBundle; - sourceTree = ""; - }; - 5281CA4C1EEAC9A700AC40CD /* Products */ = { - isa = PBXGroup; - children = ( - 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */, - 5281CA531EEAC9A700AC40CD /* libRCTBlob-tvOS.a */, - 6484CE5A201A7557004275A4 /* libRCTBlob-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 5C2B70EF2267DB1A0066069E /* turbomodule */ = { - isa = PBXGroup; - children = ( - 5C2B710E2267DB1A0066069E /* samples */, - ); - name = turbomodule; - path = ../ReactCommon/turbomodule; - sourceTree = ""; - }; - 5C2B710E2267DB1A0066069E /* samples */ = { - isa = PBXGroup; - children = ( - 5C2B71102267DB1A0066069E /* platform */, - ); - path = samples; - sourceTree = ""; - }; - 5C2B71102267DB1A0066069E /* platform */ = { - isa = PBXGroup; - children = ( - 5C2B71112267DB1A0066069E /* ios */, - ); - path = platform; - sourceTree = ""; - }; - 5C2B71112267DB1A0066069E /* ios */ = { - isa = PBXGroup; - children = ( - 5C2B71142267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.h */, - 5C2B71152267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm */, - 5C2B71182267DB1A0066069E /* RCTSampleTurboModule.h */, - 5C2B711A2267DB1A0066069E /* RCTSampleTurboModule.mm */, - ); - path = ios; - sourceTree = ""; - }; - 6862DF942229DCC400684E03 /* Products */ = { - isa = PBXGroup; - children = ( - 6862DFAC2229DCC400684E03 /* libRCTTest.a */, - 6862DFAE2229DCC400684E03 /* libRCTTest-tvOS.a */, - 9F5C181A230B4F2400E3E5A7 /* libRCTTest-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 6862DFD02229E1DE00684E03 /* NativeModuleExample */ = { - isa = PBXGroup; - children = ( - 6862DFCD2229DFCB00684E03 /* Screenshot.h */, - 6862DFCE2229DFCC00684E03 /* Screenshot.m */, - ); - path = NativeModuleExample; - sourceTree = ""; - }; - 834C36CE1AF8DA610019C93C /* Products */ = { - isa = PBXGroup; - children = ( - 834C36D21AF8DA610019C93C /* libRCTSettings.a */, - 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */, - 6448A5D21F292F16006FF1F5 /* libRCTSettings-macOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* RNTester */, - 1316A21D1AA397F400C0188E /* Libraries */, - 143BC57C1B21E18100462512 /* RNTesterUnitTests */, - 143BC5961B21E3E100462512 /* RNTesterIntegrationTests */, - 3D13F83F1D6F6AE000E69E0E /* RNTesterBundle */, - 2DD323911DA2DD8B000FE1B8 /* RNTester-tvOS */, - 18FC77871EF4770B002B3F17 /* RNTester-macOS */, - 18FC779E1EF4770B002B3F17 /* RNTester-macOSUnitTests */, - 18FC77A91EF4770B002B3F17 /* RNTester-macOSIntegrationTests */, - 9FBFA514233C7E4C003D9A8D /* RNTesterBundle-macOS */, - 83CBBA001A601CBA00E9B192 /* Products */, - 2DE7E7D81FB2A4F3009E225D /* Frameworks */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* RNTester.app */, - 004D289E1AAF61C70097A701 /* RNTesterUnitTests.xctest */, - 143BC5951B21E3E100462512 /* RNTesterIntegrationTests.xctest */, - 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */, - 2DD323901DA2DD8A000FE1B8 /* RNTester-tvOS.app */, - 2DD323A51DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests.xctest */, - 2D4624E01DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests.xctest */, - 18FC77861EF4770B002B3F17 /* RNTester-macOS.app */, - 18FC779B1EF4770B002B3F17 /* RNTester-macOSUnitTests.xctest */, - 18FC77A61EF4770B002B3F17 /* RNTester-macOSIntegrationTests.xctest */, - 18D8D99F21C06BCE00E0CCAC /* libiosDeviceBuild.a */, - 9FBFA513233C7E4C003D9A8D /* RNTesterBundle-macOS.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 9FBFA514233C7E4C003D9A8D /* RNTesterBundle-macOS */ = { - isa = PBXGroup; - children = ( - 9FBFA515233C7E4C003D9A8D /* Info.plist */, - ); - path = "RNTesterBundle-macOS"; - sourceTree = ""; - }; - AFEACAB12223EB2C004E5198 /* NativeExampleModules */ = { - isa = PBXGroup; - children = ( - AFEACA822223EB05004E5198 /* CrashyCrash.h */, - AFEACA832223EB05004E5198 /* CrashyCrash.m */, - ); - name = NativeExampleModules; - path = RNTester/NativeExampleModules; - sourceTree = ""; - }; - D85B82921AB6D5CE003F4FE2 /* Products */ = { - isa = PBXGroup; - children = ( - D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 004D289D1AAF61C70097A701 /* RNTesterUnitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 004D28AD1AAF61C70097A701 /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */; - buildPhases = ( - 004D289A1AAF61C70097A701 /* Sources */, - 004D289B1AAF61C70097A701 /* Frameworks */, - 004D289C1AAF61C70097A701 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RNTesterUnitTests; - productName = RNTesterTests; - productReference = 004D289E1AAF61C70097A701 /* RNTesterUnitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* RNTester */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNTester" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 68CD48B71D2BCB2C007E06A9 /* Run Script */, - EDEBC7DE214C68E400DD5AC8 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 18CD93F621498A8C009E2179 /* PBXTargetDependency */, - 18CD943921498A92009E2179 /* PBXTargetDependency */, - 18CD943B21498A98009E2179 /* PBXTargetDependency */, - 18CD943D21498AA0009E2179 /* PBXTargetDependency */, - 18CD943F21498AA7009E2179 /* PBXTargetDependency */, - 18CD944121498AAD009E2179 /* PBXTargetDependency */, - 18CD944321498AB2009E2179 /* PBXTargetDependency */, - 18CD944521498AB8009E2179 /* PBXTargetDependency */, - 18CD944721498ABE009E2179 /* PBXTargetDependency */, - 18CD944921498AC5009E2179 /* PBXTargetDependency */, - 18CD944B21498ACA009E2179 /* PBXTargetDependency */, - 18CD944D21498AD0009E2179 /* PBXTargetDependency */, - 18CD944F21498AD5009E2179 /* PBXTargetDependency */, - 18CD945121498ADA009E2179 /* PBXTargetDependency */, - 18CD945321498ADF009E2179 /* PBXTargetDependency */, - 3D13F84C1D6F6B5F00E69E0E /* PBXTargetDependency */, - ); - name = RNTester; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* RNTester.app */; - productType = "com.apple.product-type.application"; - }; - 143BC5941B21E3E100462512 /* RNTesterIntegrationTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 143BC59D1B21E3E100462512 /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */; - buildPhases = ( - 143BC5911B21E3E100462512 /* Sources */, - 143BC5921B21E3E100462512 /* Frameworks */, - 143BC5931B21E3E100462512 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 143BC59C1B21E3E100462512 /* PBXTargetDependency */, - ); - name = RNTesterIntegrationTests; - productName = RNTesterIntegrationTests; - productReference = 143BC5951B21E3E100462512 /* RNTesterIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 18D8D99E21C06BCE00E0CCAC /* iosDeviceBuild */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18D8D9C121C06BCE00E0CCAC /* Build configuration list for PBXNativeTarget "iosDeviceBuild" */; - buildPhases = ( - 18D8D99B21C06BCE00E0CCAC /* Sources */, - 18D8D99C21C06BCE00E0CCAC /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 9FF40752239F1C15005F0C58 /* PBXTargetDependency */, - 9FF40750239F1C0E005F0C58 /* PBXTargetDependency */, - 9FF4074E239F1C09005F0C58 /* PBXTargetDependency */, - 9FF4074C239F1C04005F0C58 /* PBXTargetDependency */, - 9FF4074A239F1BFE005F0C58 /* PBXTargetDependency */, - 9FF40748239F1BF6005F0C58 /* PBXTargetDependency */, - 9FF40746239F1BF1005F0C58 /* PBXTargetDependency */, - 9FF40744239F1BEB005F0C58 /* PBXTargetDependency */, - 9FF40742239F1BE5005F0C58 /* PBXTargetDependency */, - 9FF40740239F1BE1005F0C58 /* PBXTargetDependency */, - 9FF4073E239F1BD9005F0C58 /* PBXTargetDependency */, - 9FF4073C239F1BD4005F0C58 /* PBXTargetDependency */, - 9FF4073A239F1BCE005F0C58 /* PBXTargetDependency */, - 9FF40738239F1BC9005F0C58 /* PBXTargetDependency */, - ); - name = iosDeviceBuild; - productName = DeviceBuild; - productReference = 18D8D99F21C06BCE00E0CCAC /* libiosDeviceBuild.a */; - productType = "com.apple.product-type.library.static"; - }; - 18FC77851EF4770B002B3F17 /* RNTester-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18FC77F01EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOS" */; - buildPhases = ( - 18FC77821EF4770B002B3F17 /* Sources */, - 18FC77831EF4770B002B3F17 /* Frameworks */, - 18FC77841EF4770B002B3F17 /* Resources */, - 64BF1F6D1EF848FB00B83E07 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 9FBFA7AC233D53BA003D9A8D /* PBXTargetDependency */, - 18CD94732149B235009E2179 /* PBXTargetDependency */, - 18CD946F2149B235009E2179 /* PBXTargetDependency */, - 18CD94712149B235009E2179 /* PBXTargetDependency */, - 18CD94752149B235009E2179 /* PBXTargetDependency */, - 18CD94772149B235009E2179 /* PBXTargetDependency */, - 18CD947F2149B235009E2179 /* PBXTargetDependency */, - 18CD947B2149B235009E2179 /* PBXTargetDependency */, - 18CD94812149B235009E2179 /* PBXTargetDependency */, - 18CD947D2149B235009E2179 /* PBXTargetDependency */, - 18CD94832149B235009E2179 /* PBXTargetDependency */, - 18CD94872149B235009E2179 /* PBXTargetDependency */, - 18CF93E9214723F400CDCB6F /* PBXTargetDependency */, - ); - name = "RNTester-macOS"; - productName = "RNTester-macOS"; - productReference = 18FC77861EF4770B002B3F17 /* RNTester-macOS.app */; - productType = "com.apple.product-type.application"; - }; - 18FC779A1EF4770B002B3F17 /* RNTester-macOSUnitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18FC77F11EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOSUnitTests" */; - buildPhases = ( - 18FC77971EF4770B002B3F17 /* Sources */, - 18FC77981EF4770B002B3F17 /* Frameworks */, - 18FC77991EF4770B002B3F17 /* Resources */, - 9FCC5EAC2252D34C009029D1 /* Copy Framework */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RNTester-macOSUnitTests"; - productName = "RNTester-macOSTests"; - productReference = 18FC779B1EF4770B002B3F17 /* RNTester-macOSUnitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 18FC77A51EF4770B002B3F17 /* RNTester-macOSIntegrationTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18FC77F21EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOSIntegrationTests" */; - buildPhases = ( - 18FC77A21EF4770B002B3F17 /* Sources */, - 18FC77A31EF4770B002B3F17 /* Frameworks */, - 18FC77A41EF4770B002B3F17 /* Resources */, - 185127A120ADEF4800270B2D /* Modify xctest.xcent file */, - ); - buildRules = ( - ); - dependencies = ( - 18FC77A81EF4770B002B3F17 /* PBXTargetDependency */, - ); - name = "RNTester-macOSIntegrationTests"; - productName = "RNTester-macOSUITests"; - productReference = 18FC77A61EF4770B002B3F17 /* RNTester-macOSIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; - 2D4624C11DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D4624DD1DA2EA6900C74D09 /* Build configuration list for PBXNativeTarget "RNTester-tvOSIntegrationTests" */; - buildPhases = ( - 2D4624C41DA2EA6900C74D09 /* Sources */, - 2D4624D91DA2EA6900C74D09 /* Frameworks */, - 2D4624DB1DA2EA6900C74D09 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 2D4624C21DA2EA6900C74D09 /* PBXTargetDependency */, - ); - name = "RNTester-tvOSIntegrationTests"; - productName = "RNTester-tvOSUnitTests"; - productReference = 2D4624E01DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 2DD3238F1DA2DD8A000FE1B8 /* RNTester-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2DD323DA1DA2DD8B000FE1B8 /* Build configuration list for PBXNativeTarget "RNTester-tvOS" */; - buildPhases = ( - 2DD3238C1DA2DD8A000FE1B8 /* Sources */, - 2DD3238D1DA2DD8A000FE1B8 /* Frameworks */, - 2DD3238E1DA2DD8A000FE1B8 /* Resources */, - 2DD323EB1DA2DEC1000FE1B8 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 18CD94572149B19D009E2179 /* PBXTargetDependency */, - 18CD94592149B19D009E2179 /* PBXTargetDependency */, - 18CD945B2149B19D009E2179 /* PBXTargetDependency */, - 18CD945D2149B19D009E2179 /* PBXTargetDependency */, - 18CD945F2149B19D009E2179 /* PBXTargetDependency */, - 18CD94612149B19D009E2179 /* PBXTargetDependency */, - 18CD94632149B19D009E2179 /* PBXTargetDependency */, - 18CD94652149B19D009E2179 /* PBXTargetDependency */, - 18CD94672149B19D009E2179 /* PBXTargetDependency */, - 18CD946B2149B19D009E2179 /* PBXTargetDependency */, - 18CD946D2149B19D009E2179 /* PBXTargetDependency */, - ); - name = "RNTester-tvOS"; - productName = "RNTester-tvOS"; - productReference = 2DD323901DA2DD8A000FE1B8 /* RNTester-tvOS.app */; - productType = "com.apple.product-type.application"; - }; - 2DD323A41DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2DD323DB1DA2DD8B000FE1B8 /* Build configuration list for PBXNativeTarget "RNTester-tvOSUnitTests" */; - buildPhases = ( - 2DD323A11DA2DD8B000FE1B8 /* Sources */, - 2DD323A21DA2DD8B000FE1B8 /* Frameworks */, - 2DD323A31DA2DD8B000FE1B8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RNTester-tvOSUnitTests"; - productName = "RNTester-tvOSUnitTests"; - productReference = 2DD323A51DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D13F8411D6F6AE000E69E0E /* Build configuration list for PBXNativeTarget "RNTesterBundle" */; - buildPhases = ( - 3D13F83A1D6F6AE000E69E0E /* Sources */, - 3D13F83B1D6F6AE000E69E0E /* Frameworks */, - 3D13F83C1D6F6AE000E69E0E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RNTesterBundle; - productName = RNTesterBundle; - productReference = 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */; - productType = "com.apple.product-type.bundle"; - }; - 9F616959225FB3F1008F89F1 /* iosSimulatorBuild */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9F61697B225FB3F1008F89F1 /* Build configuration list for PBXNativeTarget "iosSimulatorBuild" */; - buildPhases = ( - 9F616969225FB3F1008F89F1 /* Sources */, - 9F61696A225FB3F1008F89F1 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 9FF40736239F1BB7005F0C58 /* PBXTargetDependency */, - 9FF40734239F1BB1005F0C58 /* PBXTargetDependency */, - 9FF40732239F1BAB005F0C58 /* PBXTargetDependency */, - 9FF40730239F1BA4005F0C58 /* PBXTargetDependency */, - 9FF4072E239F1B9E005F0C58 /* PBXTargetDependency */, - 9FF4072C239F1B98005F0C58 /* PBXTargetDependency */, - 9FF4072A239F1B92005F0C58 /* PBXTargetDependency */, - 9FF40728239F1B8D005F0C58 /* PBXTargetDependency */, - 9FF40726239F1B88005F0C58 /* PBXTargetDependency */, - 9FF40724239F1B83005F0C58 /* PBXTargetDependency */, - 9FF40722239F1B7D005F0C58 /* PBXTargetDependency */, - 9FF40720239F1B77005F0C58 /* PBXTargetDependency */, - 9FF4071E239F1B72005F0C58 /* PBXTargetDependency */, - 9FF4071C239F1B6D005F0C58 /* PBXTargetDependency */, - ); - name = iosSimulatorBuild; - productName = DeviceBuild; - productType = "com.apple.product-type.library.static"; - }; - 9F61697F225FB40C008F89F1 /* macOSBuild */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9F6169A1225FB40C008F89F1 /* Build configuration list for PBXNativeTarget "macOSBuild" */; - buildPhases = ( - 9F61698F225FB40C008F89F1 /* Sources */, - 9F616990225FB40C008F89F1 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 9FF40704239F1AB4005F0C58 /* PBXTargetDependency */, - 9FF4071A239F1B1D005F0C58 /* PBXTargetDependency */, - 9FF40718239F1B18005F0C58 /* PBXTargetDependency */, - 9FF40716239F1B11005F0C58 /* PBXTargetDependency */, - 9FF40714239F1B09005F0C58 /* PBXTargetDependency */, - 9FF40712239F1B01005F0C58 /* PBXTargetDependency */, - 9FF40710239F1AFC005F0C58 /* PBXTargetDependency */, - 9FF4070E239F1AF6005F0C58 /* PBXTargetDependency */, - 9FF4070C239F1AEE005F0C58 /* PBXTargetDependency */, - 9FF4070A239F1AE8005F0C58 /* PBXTargetDependency */, - 9FF40708239F1AE1005F0C58 /* PBXTargetDependency */, - 9FF40706239F1ADA005F0C58 /* PBXTargetDependency */, - ); - name = macOSBuild; - productName = DeviceBuild; - productType = "com.apple.product-type.library.static"; - }; - 9FBFA512233C7E4C003D9A8D /* RNTesterBundle-macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9FBFA516233C7E4C003D9A8D /* Build configuration list for PBXNativeTarget "RNTesterBundle-macOS" */; - buildPhases = ( - 9FBFA50F233C7E4C003D9A8D /* Sources */, - 9FBFA510233C7E4C003D9A8D /* Frameworks */, - 9FBFA511233C7E4C003D9A8D /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RNTesterBundle-macOS"; - productName = "RNTesterBundle-macOS"; - productReference = 9FBFA513233C7E4C003D9A8D /* RNTesterBundle-macOS.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - DefaultBuildSystemTypeForWorkspace = Original; - LastUpgradeCheck = 0820; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 004D289D1AAF61C70097A701 = { - CreatedOnToolsVersion = 6.1.1; - }; - 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = VYK7DLU38Z; - }; - 143BC5941B21E3E100462512 = { - CreatedOnToolsVersion = 6.3.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - 18D8D99E21C06BCE00E0CCAC = { - CreatedOnToolsVersion = 10.1; - ProvisioningStyle = Automatic; - }; - 18FC77851EF4770B002B3F17 = { - CreatedOnToolsVersion = 8.3.2; - ProvisioningStyle = Automatic; - }; - 18FC779A1EF4770B002B3F17 = { - CreatedOnToolsVersion = 8.3.2; - ProvisioningStyle = Automatic; - TestTargetID = 18FC77851EF4770B002B3F17; - }; - 18FC77A51EF4770B002B3F17 = { - CreatedOnToolsVersion = 8.3.2; - ProvisioningStyle = Automatic; - TestTargetID = 18FC77851EF4770B002B3F17; - }; - 2DD3238F1DA2DD8A000FE1B8 = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 2DD323A41DA2DD8B000FE1B8 = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - TestTargetID = 2DD3238F1DA2DD8A000FE1B8; - }; - 3D13F83D1D6F6AE000E69E0E = { - CreatedOnToolsVersion = 7.3.1; - }; - 9FBFA512233C7E4C003D9A8D = { - CreatedOnToolsVersion = 11.0; - DevelopmentTeam = UBF8T346G9; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTester" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 2D66FF601ECA405900F0A767 /* Products */; - ProjectRef = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; - }, - { - ProductGroup = 147CED471AB34F8C00DA3E4C /* Products */; - ProjectRef = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 13E5019D1D07A502005F35D8 /* Products */; - ProjectRef = 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = 5281CA4C1EEAC9A700AC40CD /* Products */; - ProjectRef = 5281CA4B1EEAC9A700AC40CD /* RCTBlob.xcodeproj */; - }, - { - ProductGroup = 138DEE031B9EDDDB007F4EA5 /* Products */; - ProjectRef = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; - }, - { - ProductGroup = 13417FE41AA91428003F314A /* Products */; - ProjectRef = 13417FE31AA91428003F314A /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 357858F91B28D2C400341EDB /* Products */; - ProjectRef = 357858F81B28D2C400341EDB /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 134180271AA91779003F314A /* Products */; - ProjectRef = 134180261AA91779003F314A /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 14DC67E81AB71876001358AB /* Products */; - ProjectRef = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */; - }, - { - ProductGroup = 834C36CE1AF8DA610019C93C /* Products */; - ProjectRef = 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 6862DF942229DCC400684E03 /* Products */; - ProjectRef = 6862DF932229DCC400684E03 /* RCTTest.xcodeproj */; - }, - { - ProductGroup = 13417FEB1AA914B8003F314A /* Products */; - ProjectRef = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */; - }, - { - ProductGroup = D85B82921AB6D5CE003F4FE2 /* Products */; - ProjectRef = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDECB1B0651EA00C62182 /* Products */; - ProjectRef = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 14AADF001AC3DB95002390C9 /* Products */; - ProjectRef = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* RNTester */, - 004D289D1AAF61C70097A701 /* RNTesterUnitTests */, - 143BC5941B21E3E100462512 /* RNTesterIntegrationTests */, - 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */, - 2DD3238F1DA2DD8A000FE1B8 /* RNTester-tvOS */, - 2DD323A41DA2DD8B000FE1B8 /* RNTester-tvOSUnitTests */, - 2D4624C11DA2EA6900C74D09 /* RNTester-tvOSIntegrationTests */, - 18FC77851EF4770B002B3F17 /* RNTester-macOS */, - 18FC779A1EF4770B002B3F17 /* RNTester-macOSUnitTests */, - 18FC77A51EF4770B002B3F17 /* RNTester-macOSIntegrationTests */, - 9FBFA512233C7E4C003D9A8D /* RNTesterBundle-macOS */, - 18D8D99E21C06BCE00E0CCAC /* iosDeviceBuild */, - 9F616959225FB3F1008F89F1 /* iosSimulatorBuild */, - 9F61697F225FB40C008F89F1 /* macOSBuild */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 13417FE81AA91428003F314A /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 13417FE71AA91428003F314A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 13417FEF1AA914B8003F314A /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 13417FEE1AA914B8003F314A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 1341802B1AA91779003F314A /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 1341802A1AA91779003F314A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTCameraRoll.a; - remoteRef = 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 13E501A31D07A502005F35D8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 13E501A21D07A502005F35D8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 14AADF041AC3DB95002390C9 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 14AADF031AC3DB95002390C9 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 14DC67F11AB71876001358AB /* libRCTPushNotification.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTPushNotification.a; - remoteRef = 14DC67F01AB71876001358AB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 18B8F9C32143301000CE911A /* libjsinspector-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsinspector-macOS.a"; - remoteRef = 18B8F9C22143301000CE911A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D66FF651ECA405900F0A767 /* libART.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libART.a; - remoteRef = 2D66FF641ECA405900F0A767 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D66FF671ECA405900F0A767 /* libART-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libART-tvOS.a"; - remoteRef = 2D66FF661ECA405900F0A767 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D66FF8C1ECA405900F0A767 /* libthird-party.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 2D66FF8B1ECA405900F0A767 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D66FF8E1ECA405900F0A767 /* libdouble-conversion.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libdouble-conversion.a"; - remoteRef = 2D66FF8D1ECA405900F0A767 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 2DD323B41DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTImage-tvOS.a"; - remoteRef = 2DD323BA1DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-tvOS.a"; - remoteRef = 2DD323BE1DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTNetwork-tvOS.a"; - remoteRef = 2DD323C21DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-tvOS.a"; - remoteRef = 2DD323C71DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323D01DA2DD8B000FE1B8 /* libRCTText-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTText-tvOS.a"; - remoteRef = 2DD323CF1DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323D51DA2DD8B000FE1B8 /* libRCTWebSocket-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTWebSocket-tvOS.a"; - remoteRef = 2DD323D41DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DD323D91DA2DD8B000FE1B8 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 2DD323D81DA2DD8B000FE1B8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 357859011B28D2C500341EDB /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 357859001B28D2C500341EDB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D05746C1DE6008900184BB4 /* libRCTPushNotification-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTPushNotification-tvOS.a"; - remoteRef = 3D05746B1DE6008900184BB4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D05748C1DE6008900184BB4 /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3D05748B1DE6008900184BB4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D05748E1DE6008900184BB4 /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3D05748D1DE6008900184BB4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D3C08811DE3424E00C268FA /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3D3C08801DE3424E00C268FA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D3C08831DE3424E00C268FA /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D507F421EBC88B700B56834 /* libthird-party.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 3D507F411EBC88B700B56834 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D507F441EBC88B700B56834 /* libdouble-conversion.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libdouble-conversion.a"; - remoteRef = 3D507F431EBC88B700B56834 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DBE0D331F3B18670099AA32 /* libfishhook.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libfishhook.a; - remoteRef = 3DBE0D321F3B18670099AA32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DBE0D351F3B18670099AA32 /* libfishhook-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libfishhook-tvOS.a"; - remoteRef = 3DBE0D341F3B18670099AA32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DCE53221FEAB1C500613583 /* libjsinspector.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsinspector.a; - remoteRef = 3DCE53211FEAB1C500613583 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DCE53241FEAB1C500613583 /* libjsinspector-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsinspector-tvOS.a"; - remoteRef = 3DCE53231FEAB1C500613583 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5281CA511EEAC9A700AC40CD /* libRCTBlob.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTBlob.a; - remoteRef = 5281CA501EEAC9A700AC40CD /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5281CA531EEAC9A700AC40CD /* libRCTBlob-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTBlob-tvOS.a"; - remoteRef = 5281CA521EEAC9A700AC40CD /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 6424F7B21F669A8E0025D741 /* libRCTPushNotification-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTPushNotification-macOS.a"; - remoteRef = 6424F7B11F669A8E0025D741 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 6448A5D21F292F16006FF1F5 /* libRCTSettings-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-macOS.a"; - remoteRef = 6448A5D11F292F16006FF1F5 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 647647311F0BC04800C2D89B /* libART-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libART-macOS.a"; - remoteRef = 647647301F0BC04800C2D89B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 647647C81F0BCC5500C2D89B /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 647647C71F0BCC5500C2D89B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 6484CE5A201A7557004275A4 /* libRCTBlob-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTBlob-macOS.a"; - remoteRef = 6484CE59201A7557004275A4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 649BF7192019105B0068273E /* libfishhook-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libfishhook-macOS.a"; - remoteRef = 649BF7182019105B0068273E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 6862DFAC2229DCC400684E03 /* libRCTTest.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTTest.a; - remoteRef = 6862DFAB2229DCC400684E03 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 6862DFAE2229DCC400684E03 /* libRCTTest-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTTest-tvOS.a"; - remoteRef = 6862DFAD2229DCC400684E03 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 834C36D21AF8DA610019C93C /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 834C36D11AF8DA610019C93C /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9F5C1806230B4F2400E3E5A7 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 9F5C1805230B4F2400E3E5A7 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9F5C181A230B4F2400E3E5A7 /* libRCTTest-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTTest-macOS.a"; - remoteRef = 9F5C1819230B4F2400E3E5A7 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FB7D3E7224ABD0E00F31D11 /* libjsi-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsi-macOS.a"; - remoteRef = 9FB7D3E6224ABD0E00F31D11 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FB7D3E9224ABD0E00F31D11 /* libjsiexecutor-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsiexecutor-macOS.a"; - remoteRef = 9FB7D3E8224ABD0E00F31D11 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21CE12242EFA400E7F88E /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 9FD21CE02242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21CE72242EFA400E7F88E /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 9FD21CE62242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21CF12242EFA400E7F88E /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 9FD21CF02242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21CF92242EFA400E7F88E /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 9FD21CF82242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21D122242EFA400E7F88E /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 9FD21D112242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21D142242EFA400E7F88E /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 9FD21D132242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21D162242EFA400E7F88E /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 9FD21D152242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21D1A2242EFA400E7F88E /* libthird-party.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 9FD21D192242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9FD21D1C2242EFA400E7F88E /* libdouble-conversion.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libdouble-conversion.a"; - remoteRef = 9FD21D1B2242EFA400E7F88E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - D429028F1F1CE21600685AE7 /* libRCTLinking-macOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-macOS.a"; - remoteRef = D429028E1F1CE21600685AE7 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = D85B829B1AB6D5CE003F4FE2 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - ED2970952150246200B7C4FE /* libjsi-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsi-tvOS.a"; - remoteRef = ED2970942150246200B7C4FE /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - ED2970972150246200B7C4FE /* libjsiexecutor-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsiexecutor-tvOS.a"; - remoteRef = ED2970962150246200B7C4FE /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - EDEBC6FC214B402000DD5AC8 /* libjsi.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsi.a; - remoteRef = EDEBC6FB214B402000DD5AC8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - EDEBC7CA214C503A00DD5AC8 /* libjsiexecutor.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsiexecutor.a; - remoteRef = EDEBC7C9214C503A00DD5AC8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 004D289C1AAF61C70097A701 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DD981D61D33C6FB007DC7BE /* RNTesterUnitTestsBundle.js in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D56F9F11D6F6E9B00F53A06 /* RNTesterBundle.bundle in Resources */, - 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */, - 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 143BC5931B21E3E100462512 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77841EF4770B002B3F17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FBFA519233C7E88003D9A8D /* Assets.xcassets in Resources */, - 9FBFA51A233C7E91003D9A8D /* RNTesterBundle-macOS.bundle in Resources */, - 18FC77951EF4770B002B3F17 /* Main.storyboard in Resources */, - 9FBFA51B233C7E97003D9A8D /* legacy_image@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77991EF4770B002B3F17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 18316DFE1EF9DA43003DADF3 /* RNTesterUnitTestsBundle.js in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77A41EF4770B002B3F17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D4624DB1DA2EA6900C74D09 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD3238E1DA2DD8A000FE1B8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DD323E11DA2DDBF000FE1B8 /* legacy_image@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD323A31DA2DD8B000FE1B8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D4BD8E61DA2E20D005AC8A8 /* RNTesterUnitTestsBundle.js in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D13F83C1D6F6AE000E69E0E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D13F8481D6F6AF900E69E0E /* ImageInBundle.png in Resources */, - 3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FBFA511233C7E4C003D9A8D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FBFA51D233C7EB4003D9A8D /* OtherImages.xcassets in Resources */, - 9FBFA51C233C7EAF003D9A8D /* ImageInBundle.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 185127A120ADEF4800270B2D /* Modify xctest.xcent file */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(PROJECT_DIR)/scripts/ModifyXcuitestEntitlements.py", - ); - name = "Modify xctest.xcent file"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/bin/env python \"${SCRIPT_INPUT_FILE_0}\""; - }; - 2DD323EB1DA2DEC1000FE1B8 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; - }; - 64BF1F6D1EF848FB00B83E07 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.macos.js\n"; - }; - 68CD48B71D2BCB2C007E06A9 /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 004D289A1AAF61C70097A701 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1497CFB01B21F5E400C1F8F2 /* RCTFontTests.m in Sources */, - 13BCE84F1C9C209600DD7AAD /* RCTComponentPropsTests.m in Sources */, - 144D21241B2204C5006DB32B /* RCTImageUtilTests.m in Sources */, - C60A228221C9726800B820FE /* RCTFormatErrorTests.m in Sources */, - 1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.mm in Sources */, - 1300627F1B59179B0043FE5A /* RCTGzipTests.m in Sources */, - 1497CFAF1B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m in Sources */, - 13129DD41C85F87C007D611C /* RCTModuleInitNotificationRaceTests.m in Sources */, - 192F69B81E82409A008692C7 /* RCTAnimationUtilsTests.m in Sources */, - 134CB92A1C85A38800265FA6 /* RCTModuleInitTests.m in Sources */, - 192F69BA1E82409A008692C7 /* RCTNativeAnimatedNodesManagerTests.m in Sources */, - 1497CFB11B21F5E400C1F8F2 /* RCTEventDispatcherTests.m in Sources */, - 1497CFB31B21F5E400C1F8F2 /* RCTUIManagerTests.m in Sources */, - 13DB03481B5D2ED500C27245 /* RCTJSONTests.m in Sources */, - 1497CFAC1B21F5E400C1F8F2 /* RCTAllocationTests.m in Sources */, - 04F27E112288190500F536C3 /* RCTPerformanceLoggerTests.m in Sources */, - 001BFCE41D838343008E587E /* RCTMultipartStreamReaderTests.m in Sources */, - 13DF61B61B67A45000EDB188 /* RCTMethodArgumentTests.m in Sources */, - 138D6A181B53CD440074A87E /* RCTShadowViewTests.m in Sources */, - 39AA31A41DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m in Sources */, - 13B6C1A31C34225900D3FAF5 /* RCTURLUtilsTests.m in Sources */, - 8385CF041B87479200C6273E /* RCTImageLoaderHelpers.m in Sources */, - 192F69B91E82409A008692C7 /* RCTConvert_YGValueTests.m in Sources */, - BC9C03401DC9F1D600B1C635 /* RCTDevMenuTests.m in Sources */, - 19BA88D51F84344F00741C5A /* RCTBlobManagerTests.m in Sources */, - 68FF44381CF6111500720EFD /* RCTBundleURLProviderTests.m in Sources */, - 8385CEF51B873B5C00C6273E /* RCTImageLoaderTests.m in Sources */, - 38C500E222D3CF2E00BCD999 /* RCTConvert_UIColorTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5C2B716A2267DB1A0066069E /* RCTSampleTurboModule.mm in Sources */, - 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */, - 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - AFEACA842223EB05004E5198 /* CrashyCrash.m in Sources */, - 5C60EB592264416A0018C04F /* AppDelegate.mm in Sources */, - 5C2B71672267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm in Sources */, - 6862DFCF2229DFCC00684E03 /* Screenshot.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 143BC5911B21E3E100462512 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C654F0B31EB34A73000B7A9A /* RNTesterTestModule.m in Sources */, - 3DB99D0C1BA0340600302749 /* RNTesterIntegrationTests.m in Sources */, - 83636F8F1B53F22C009F943E /* RCTUIManagerScenarioTests.m in Sources */, - 3D299BAF1D33EBFA00FA1057 /* RCTLoggingTests.m in Sources */, - 143BC5A11B21E45C00462512 /* RNTesterSnapshotTests.m in Sources */, - 27B885561BED29AF00008352 /* RCTRootViewIntegrationTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18D8D99B21C06BCE00E0CCAC /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77821EF4770B002B3F17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3860669D24461CDF007E7C32 /* RCTNativeSampleTurboModuleSpec.mm in Sources */, - 18FC77901EF4770B002B3F17 /* ViewController.m in Sources */, - 18FC778D1EF4770B002B3F17 /* main.m in Sources */, - 18FC778A1EF4770B002B3F17 /* AppDelegate.m in Sources */, - 383C51A624344A4600CCBC30 /* FlexibleSizeExampleView.m in Sources */, - 383C517F243447EC00CCBC30 /* UpdatePropertiesExampleView.m in Sources */, - 386066C424461CE3007E7C32 /* RCTSampleTurboModule.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77971EF4770B002B3F17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 18316E011EF9DC9C003DADF3 /* RCTConvert_NSURLTests.m in Sources */, - 18BFA4CB1F01C52400969486 /* RCTEventDispatcherTests.m in Sources */, - 18D593801EF9FA48005F0CEC /* RCTShadowViewTests.m in Sources */, - 18316E1B1EF9EB7D003DADF3 /* RCTAllocationTests.m in Sources */, - 18D5937E1EF9FA22005F0CEC /* RCTModuleMethodTests.mm in Sources */, - 18FC77A01EF4770B002B3F17 /* RNTesterUnitTests_macOS.m in Sources */, - 18D5937A1EF9F95A005F0CEC /* RCTJSONTests.m in Sources */, - 18DF57111EFA047400BF4666 /* RCTComponentPropsTests.m in Sources */, - 18AA4BD41EF9C724008C7756 /* RCTURLUtilsTests.m in Sources */, - 18D593811EF9FA57005F0CEC /* RCTUIManagerTests.m in Sources */, - 1879ECF921E84E2800D98372 /* RCTConvert_NSColorTests.m in Sources */, - 18D593841EF9FAB9005F0CEC /* RCTUnicodeDecodeTests.m in Sources */, - 18D593781EF9F8CB005F0CEC /* RCTImageLoaderTests.m in Sources */, - 18D5937F1EF9FA39005F0CEC /* RCTMultipartStreamReaderTests.m in Sources */, - 18D5937B1EF9F96A005F0CEC /* RCTMethodArgumentTests.m in Sources */, - 18316DFD1EF9D996003DADF3 /* RCTBundleURLProviderTests.m in Sources */, - 18D593791EF9F8DA005F0CEC /* RCTImageUtilTests.m in Sources */, - 180B9CC41F01B040006AF028 /* RCTModuleInitNotificationRaceTests.m in Sources */, - 18316E041EF9EAD1003DADF3 /* RCTGzipTests.m in Sources */, - 18316E021EF9E0DE003DADF3 /* RCTFontTests.m in Sources */, - 18D5934D1EF9F8BC005F0CEC /* RCTImageLoaderHelpers.m in Sources */, - 18316DFC1EF9D981003DADF3 /* RCTConvert_YGValueTests.m in Sources */, - 18D5937D1EF9F990005F0CEC /* RCTModuleInitTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 18FC77A21EF4770B002B3F17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 18FC77AB1EF4770B002B3F17 /* RNTesterIntegrationTests_macOS.m in Sources */, - 1827ADEF20ACEB7100E266FC /* RNTesterIntegrationTests.m in Sources */, - 18D9497D1F9AC3D0007BB668 /* RCTUIManagerScenarioTests.m in Sources */, - 1827ADAD20ACEA6600E266FC /* RCTLoggingTests.m in Sources */, - 183938D01F9A55AE00930D92 /* RNTesterTestModule.m in Sources */, - 18D949451F9AC375007BB668 /* RCTRootViewIntegrationTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D4624C41DA2EA6900C74D09 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C654F17E1EB34D24000B7A9A /* RNTesterTestModule.m in Sources */, - 2D4624FA1DA2EAC300C74D09 /* RCTLoggingTests.m in Sources */, - 2D4624FE1DA2EAC300C74D09 /* RCTUIManagerScenarioTests.m in Sources */, - 2D4624FD1DA2EAC300C74D09 /* RNTesterSnapshotTests.m in Sources */, - 2D4624FB1DA2EAC300C74D09 /* RCTRootViewIntegrationTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD3238C1DA2DD8A000FE1B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DD323DC1DA2DDBF000FE1B8 /* FlexibleSizeExampleView.m in Sources */, - 2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */, - 2DD323E01DA2DDBF000FE1B8 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DD323A11DA2DD8B000FE1B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D4BD8DC1DA2E20D005AC8A8 /* RCTImageLoaderTests.m in Sources */, - 2D4BD8D91DA2E20D005AC8A8 /* RCTEventDispatcherTests.m in Sources */, - 2D4BD8D41DA2E20D005AC8A8 /* RCTAllocationTests.m in Sources */, - 2D4BD8DA1DA2E20D005AC8A8 /* RCTGzipTests.m in Sources */, - 2D4BD8DB1DA2E20D005AC8A8 /* RCTImageLoaderHelpers.m in Sources */, - 2D4BD8D71DA2E20D005AC8A8 /* RCTConvert_NSURLTests.m in Sources */, - C60A228321C9726800B820FE /* RCTFormatErrorTests.m in Sources */, - 2D4BD8E21DA2E20D005AC8A8 /* RCTModuleMethodTests.mm in Sources */, - 2D4BD8DF1DA2E20D005AC8A8 /* RCTMethodArgumentTests.m in Sources */, - 2D4BD8D31DA2E20D005AC8A8 /* RCTBundleURLProviderTests.m in Sources */, - 2D4BD8D21DA2E20D005AC8A8 /* RCTURLUtilsTests.m in Sources */, - 2D8C2E321DA40403000EE098 /* RCTMultipartStreamReaderTests.m in Sources */, - 2D4BD8DE1DA2E20D005AC8A8 /* RCTJSONTests.m in Sources */, - 2D4BD8E31DA2E20D005AC8A8 /* RCTShadowViewTests.m in Sources */, - 2D4BD8D81DA2E20D005AC8A8 /* RCTFontTests.m in Sources */, - 2D4BD8DD1DA2E20D005AC8A8 /* RCTImageUtilTests.m in Sources */, - 2D4BD8E41DA2E20D005AC8A8 /* RCTUIManagerTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D13F83A1D6F6AE000E69E0E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F616969225FB3F1008F89F1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F61698F225FB40C008F89F1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FBFA50F233C7E4C003D9A8D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 143BC59C1B21E3E100462512 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* RNTester */; - targetProxy = 143BC59B1B21E3E100462512 /* PBXContainerItemProxy */; - }; - 18CD93F621498A8C009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = React; - }; - 18CD943921498A92009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTBlob; - }; - 18CD943B21498A98009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ART; - }; - 18CD943D21498AA0009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTActionSheet; - }; - 18CD943F21498AA7009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTAnimation; - }; - 18CD944121498AAD009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTCameraRoll; - }; - 18CD944321498AB2009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTGeolocation; - }; - 18CD944521498AB8009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTNetwork; - }; - 18CD944721498ABE009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTImage; - }; - 18CD944921498AC5009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTLinking; - }; - 18CD944B21498ACA009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTPushNotification; - }; - 18CD944D21498AD0009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTSettings; - }; - 18CD944F21498AD5009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTText; - }; - 18CD945121498ADA009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTVibration; - }; - 18CD945321498ADF009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTWebSocket; - }; - 18CD94572149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTBlob-tvOS"; - }; - 18CD94592149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "ART-tvOS"; - }; - 18CD945B2149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "React-tvOS"; - }; - 18CD945D2149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTAnimation-tvOS"; - }; - 18CD945F2149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTImage-tvOS"; - }; - 18CD94612149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTLinking-tvOS"; - }; - 18CD94632149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTNetwork-tvOS"; - }; - 18CD94652149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTPushNotification-tvOS"; - }; - 18CD94672149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTSettings-tvOS"; - }; - 18CD946B2149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTText-tvOS"; - }; - 18CD946D2149B19D009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTWebSocket-tvOS"; - }; - 18CD946F2149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTBlob-macOS"; - targetProxy = 18CD946E2149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94712149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "ART-macOS"; - targetProxy = 18CD94702149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94732149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "React-macOS"; - targetProxy = 18CD94722149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94752149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTActionSheet-macOS"; - targetProxy = 18CD94742149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94772149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTAnimation-macOS"; - targetProxy = 18CD94762149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD947B2149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTImage-macOS"; - targetProxy = 18CD947A2149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD947D2149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTLinking-macOS"; - targetProxy = 18CD947C2149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD947F2149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTNetwork-macOS"; - targetProxy = 18CD947E2149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94812149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTPushNotification-macOS"; - targetProxy = 18CD94802149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94832149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTSettings-macOS"; - targetProxy = 18CD94822149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CD94872149B235009E2179 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTWebSocket-macOS"; - targetProxy = 18CD94862149B235009E2179 /* PBXContainerItemProxy */; - }; - 18CF93E9214723F400CDCB6F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTText-macos"; - targetProxy = 18CF93E8214723F400CDCB6F /* PBXContainerItemProxy */; - }; - 18FC77A81EF4770B002B3F17 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 18FC77851EF4770B002B3F17 /* RNTester-macOS */; - targetProxy = 18FC77A71EF4770B002B3F17 /* PBXContainerItemProxy */; - }; - 2D4624C21DA2EA6900C74D09 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 2DD3238F1DA2DD8A000FE1B8 /* RNTester-tvOS */; - targetProxy = 9FD21CD42242EE5B00E7F88E /* PBXContainerItemProxy */; - }; - 3D13F84C1D6F6B5F00E69E0E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */; - targetProxy = 3D13F84B1D6F6B5F00E69E0E /* PBXContainerItemProxy */; - }; - 9FBFA7AC233D53BA003D9A8D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FBFA512233C7E4C003D9A8D /* RNTesterBundle-macOS */; - targetProxy = 9FBFA7AB233D53BA003D9A8D /* PBXContainerItemProxy */; - }; - 9FF40704239F1AB4005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "React-macOS"; - targetProxy = 9FF40703239F1AB4005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40706239F1ADA005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTText-macos"; - targetProxy = 9FF40705239F1ADA005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40708239F1AE1005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTWebSocket-macOS"; - targetProxy = 9FF40707239F1AE1005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4070A239F1AE8005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTSettings-macOS"; - targetProxy = 9FF40709239F1AE8005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4070C239F1AEE005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTLinking-macOS"; - targetProxy = 9FF4070B239F1AEE005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4070E239F1AF6005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTPushNotification-macOS"; - targetProxy = 9FF4070D239F1AF6005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40710239F1AFC005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTImage-macOS"; - targetProxy = 9FF4070F239F1AFC005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40712239F1B01005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTNetwork-macOS"; - targetProxy = 9FF40711239F1B01005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40714239F1B09005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTAnimation-macOS"; - targetProxy = 9FF40713239F1B09005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40716239F1B11005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTActionSheet-macOS"; - targetProxy = 9FF40715239F1B11005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40718239F1B18005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "ART-macOS"; - targetProxy = 9FF40717239F1B18005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4071A239F1B1D005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "RCTBlob-macOS"; - targetProxy = 9FF40719239F1B1D005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4071C239F1B6D005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTWebSocket; - targetProxy = 9FF4071B239F1B6D005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4071E239F1B72005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTVibration; - targetProxy = 9FF4071D239F1B72005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40720239F1B77005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTText; - targetProxy = 9FF4071F239F1B77005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40722239F1B7D005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTSettings; - targetProxy = 9FF40721239F1B7D005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40724239F1B83005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTPushNotification; - targetProxy = 9FF40723239F1B83005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40726239F1B88005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTLinking; - targetProxy = 9FF40725239F1B88005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40728239F1B8D005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTImage; - targetProxy = 9FF40727239F1B8D005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4072A239F1B92005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTNetwork; - targetProxy = 9FF40729239F1B92005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4072C239F1B98005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTCameraRoll; - targetProxy = 9FF4072B239F1B98005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4072E239F1B9E005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTAnimation; - targetProxy = 9FF4072D239F1B9E005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40730239F1BA4005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTActionSheet; - targetProxy = 9FF4072F239F1BA4005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40732239F1BAB005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ART; - targetProxy = 9FF40731239F1BAB005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40734239F1BB1005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTBlob; - targetProxy = 9FF40733239F1BB1005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40736239F1BB7005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = React; - targetProxy = 9FF40735239F1BB7005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40738239F1BC9005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTWebSocket; - targetProxy = 9FF40737239F1BC9005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4073A239F1BCE005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTVibration; - targetProxy = 9FF40739239F1BCE005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4073C239F1BD4005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTText; - targetProxy = 9FF4073B239F1BD4005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4073E239F1BD9005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTSettings; - targetProxy = 9FF4073D239F1BD9005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40740239F1BE1005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTPushNotification; - targetProxy = 9FF4073F239F1BE1005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40742239F1BE5005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTLinking; - targetProxy = 9FF40741239F1BE5005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40744239F1BEB005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTImage; - targetProxy = 9FF40743239F1BEB005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40746239F1BF1005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTNetwork; - targetProxy = 9FF40745239F1BF1005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40748239F1BF6005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTCameraRoll; - targetProxy = 9FF40747239F1BF6005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4074A239F1BFE005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTAnimation; - targetProxy = 9FF40749239F1BFE005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4074C239F1C04005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTActionSheet; - targetProxy = 9FF4074B239F1C04005F0C58 /* PBXContainerItemProxy */; - }; - 9FF4074E239F1C09005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ART; - targetProxy = 9FF4074D239F1C09005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40750239F1C0E005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RCTBlob; - targetProxy = 9FF4074F239F1C0E005F0C58 /* PBXContainerItemProxy */; - }; - 9FF40752239F1C15005F0C58 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = React; - targetProxy = 9FF40751239F1C15005F0C58 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = RNTester; - sourceTree = ""; - }; - 18FC77931EF4770B002B3F17 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 18FC77941EF4770B002B3F17 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 004D28A61AAF61C70097A701 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/RNTesterUnitTests", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 004D28A71AAF61C70097A701 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/RNTesterUnitTests", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - BUNDLE_CONFIG = "$(SRCROOT)/../metro.config.js"; - DEVELOPMENT_TEAM = VYK7DLU38Z; - GCC_PREPROCESSOR_DEFINITIONS = ( - "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)", - "DEBUG=1", - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; - PRODUCT_NAME = RNTester; - RN_BUNDLE_PREFIX = ""; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - BUNDLE_CONFIG = "$(SRCROOT)/../metro.config.js"; - DEVELOPMENT_TEAM = VYK7DLU38Z; - GCC_PREPROCESSOR_DEFINITIONS = "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)"; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; - PRODUCT_NAME = RNTester; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 143BC59E1B21E3E100462512 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/$(PROJECT_NAME)IntegrationTests/ReferenceImages\\\"\"", - ); - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; - }; - name = Debug; - }; - 143BC59F1B21E3E100462512 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; - }; - name = Release; - }; - 18D8D9A521C06BCE00E0CCAC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 18D8D9A621C06BCE00E0CCAC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 18FC77AD1EF4770B002B3F17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - INFOPLIST_FILE = "RNTester-macOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 18FC77AE1EF4770B002B3F17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - INFOPLIST_FILE = "RNTester-macOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; - 18FC77AF1EF4770B002B3F17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - INFOPLIST_FILE = "RNTester-macOSUnitTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOSUnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 18FC77B01EF4770B002B3F17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - INFOPLIST_FILE = "RNTester-macOSUnitTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOSUnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; - 18FC77B11EF4770B002B3F17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - INFOPLIST_FILE = "RNTester-macOSIntegrationTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOSIntegrationTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SDKROOT = macosx; - TEST_TARGET_NAME = "RNTester-macOS"; - }; - name = Debug; - }; - 18FC77B21EF4770B002B3F17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - INFOPLIST_FILE = "RNTester-macOSIntegrationTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; - PRODUCT_BUNDLE_IDENTIFIER = "RCT.RNTester-macOSIntegrationTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SDKROOT = macosx; - TEST_TARGET_NAME = "RNTester-macOS"; - }; - name = Release; - }; - 2D4624DE1DA2EA6900C74D09 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/$(PROJECT_NAME)IntegrationTests/ReferenceImages\\\"\"", - ); - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOSIntegrationTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester-tvOS.app/RNTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D4624DF1DA2EA6900C74D09 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOSIntegrationTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester-tvOS.app/RNTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 2DD323AC1DA2DD8B000FE1B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "RNTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 10.2; - }; - name = Debug; - }; - 2DD323AD1DA2DD8B000FE1B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "RNTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 10.2; - }; - name = Release; - }; - 2DD323AE1DA2DD8B000FE1B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/RNTesterUnitTests/**", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOSUnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester-tvOS.app/RNTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2DD323AF1DA2DD8B000FE1B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/RNTesterUnitTests/**", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOSUnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester-tvOS.app/RNTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 3D13F8421D6F6AE000E69E0E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - COMBINE_HIDPI_IMAGES = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 3D13F8431D6F6AE000E69E0E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - COMBINE_HIDPI_IMAGES = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_ASSIGN_ENUM = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/$(PROJECT_NAME)IntegrationTests/ReferenceImages\\\"\"", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNKNOWN_PRAGMAS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - OTHER_CPLUSPLUSFLAGS = ( - "$(OTHER_CFLAGS)", - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - SDKROOT = iphoneos; - WARNING_CFLAGS = ( - "-Wextra", - "-Wall", - "-Wno-semicolon-before-method-body", - ); - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_ASSIGN_ENUM = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNKNOWN_PRAGMAS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_CPLUSPLUSFLAGS = ( - "$(OTHER_CFLAGS)", - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Wextra", - "-Wall", - "-Wno-semicolon-before-method-body", - ); - }; - name = Release; - }; - 9F61697C225FB3F1008F89F1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 9F61697D225FB3F1008F89F1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 9F6169A2225FB40C008F89F1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 9F6169A3225FB40C008F89F1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(ARCHS_STANDARD)", - arm64e, - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 9FBFA517233C7E4C003D9A8D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "RNTesterBundle-macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTesterBundle-macOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 9FBFA518233C7E4C003D9A8D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; - INFOPLIST_FILE = "RNTesterBundle-macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTesterBundle-macOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 004D28AD1AAF61C70097A701 /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 004D28A61AAF61C70097A701 /* Debug */, - 004D28A71AAF61C70097A701 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 143BC59D1B21E3E100462512 /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 143BC59E1B21E3E100462512 /* Debug */, - 143BC59F1B21E3E100462512 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 18D8D9C121C06BCE00E0CCAC /* Build configuration list for PBXNativeTarget "iosDeviceBuild" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18D8D9A521C06BCE00E0CCAC /* Debug */, - 18D8D9A621C06BCE00E0CCAC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 18FC77F01EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18FC77AD1EF4770B002B3F17 /* Debug */, - 18FC77AE1EF4770B002B3F17 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 18FC77F11EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOSUnitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18FC77AF1EF4770B002B3F17 /* Debug */, - 18FC77B01EF4770B002B3F17 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 18FC77F21EF4770B002B3F17 /* Build configuration list for PBXNativeTarget "RNTester-macOSIntegrationTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18FC77B11EF4770B002B3F17 /* Debug */, - 18FC77B21EF4770B002B3F17 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D4624DD1DA2EA6900C74D09 /* Build configuration list for PBXNativeTarget "RNTester-tvOSIntegrationTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D4624DE1DA2EA6900C74D09 /* Debug */, - 2D4624DF1DA2EA6900C74D09 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2DD323DA1DA2DD8B000FE1B8 /* Build configuration list for PBXNativeTarget "RNTester-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2DD323AC1DA2DD8B000FE1B8 /* Debug */, - 2DD323AD1DA2DD8B000FE1B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2DD323DB1DA2DD8B000FE1B8 /* Build configuration list for PBXNativeTarget "RNTester-tvOSUnitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2DD323AE1DA2DD8B000FE1B8 /* Debug */, - 2DD323AF1DA2DD8B000FE1B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D13F8411D6F6AE000E69E0E /* Build configuration list for PBXNativeTarget "RNTesterBundle" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D13F8421D6F6AE000E69E0E /* Debug */, - 3D13F8431D6F6AE000E69E0E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9F61697B225FB3F1008F89F1 /* Build configuration list for PBXNativeTarget "iosSimulatorBuild" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9F61697C225FB3F1008F89F1 /* Debug */, - 9F61697D225FB3F1008F89F1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9F6169A1225FB40C008F89F1 /* Build configuration list for PBXNativeTarget "macOSBuild" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9F6169A2225FB40C008F89F1 /* Debug */, - 9F6169A3225FB40C008F89F1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FBFA516233C7E4C003D9A8D /* Build configuration list for PBXNativeTarget "RNTesterBundle-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FBFA517233C7E4C003D9A8D /* Debug */, - 9FBFA518233C7E4C003D9A8D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/RNTester/RNTester/AppDelegate.mm b/RNTester/RNTester/AppDelegate.mm index 44a7ceda3ca114..f390405d3db047 100644 --- a/RNTester/RNTester/AppDelegate.mm +++ b/RNTester/RNTester/AppDelegate.mm @@ -18,7 +18,7 @@ #import -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif @@ -27,26 +27,17 @@ #import #endif -#ifdef RN_TURBO_MODULE_ENABLED -#import +#import #import "RNTesterTurboModuleProvider.h" -#endif -#ifdef RN_TURBO_MODULE_ENABLED @interface AppDelegate() { -#else -@interface AppDelegate() { -#endif #ifdef RN_FABRIC_ENABLED RCTSurfacePresenter *_surfacePresenter; #endif -#ifdef RN_TURBO_MODULE_ENABLED RCTTurboModuleManager *_turboModuleManager; -#endif - } @end @@ -54,9 +45,7 @@ @implementation AppDelegate - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { -#ifdef RN_TURBO_MODULE_ENABLED RCTEnableTurboModule(YES); -#endif _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; @@ -69,7 +58,13 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith } #ifdef RN_FABRIC_ENABLED - _surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge config:nil]; + _surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge + config:nil + imageLoader:RCTTurboModuleEnabled() ? + [_bridge moduleForName:@"RCTImageLoader" + lazilyLoadIfNecessary:YES] : nil + runtimeExecutor:nullptr]; + _bridge.surfacePresenter = _surfacePresenter; UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps]; @@ -120,29 +115,30 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge } __typeof(self) strongSelf = weakSelf; if (strongSelf) { -#ifdef RN_TURBO_MODULE_ENABLED strongSelf->_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge delegate:strongSelf]; [strongSelf->_turboModuleManager installJSBindingWithRuntime:&runtime]; -#endif } }); } #pragma mark RCTTurboModuleManagerDelegate -#ifdef RN_TURBO_MODULE_ENABLED +- (Class)getModuleClassFromName:(const char *)name +{ + return facebook::react::RNTesterTurboModuleClassProvider(name); +} - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker { - return RNTesterTurboModuleProvider(name, jsInvoker); + return facebook::react::RNTesterTurboModuleProvider(name, jsInvoker); } - (std::shared_ptr)getTurboModule:(const std::string &)name instance:(id)instance jsInvoker:(std::shared_ptr)jsInvoker { - return RNTesterTurboModuleProvider(name, instance, jsInvoker); + return facebook::react::RNTesterTurboModuleProvider(name, instance, jsInvoker); } - (id)getModuleInstanceFromClass:(Class)moduleClass @@ -151,11 +147,9 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge return [moduleClass new]; } -#endif - # pragma mark - Push Notifications -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC // Required to register for notifications - (void)application:(__unused UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings diff --git a/RNTester/RNTester/RNTester.entitlements b/RNTester/RNTester/RNTester.entitlements new file mode 100644 index 00000000000000..98ca2664ea88e1 --- /dev/null +++ b/RNTester/RNTester/RNTester.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + com.apple.security.personal-information.photos-library + + com.apple.security.get-task-allow + + + diff --git a/RNTester/RNTester/RNTesterTurboModuleProvider.h b/RNTester/RNTester/RNTesterTurboModuleProvider.h index d55c415bc6b203..2d4e99f8e32dd4 100644 --- a/RNTester/RNTester/RNTesterTurboModuleProvider.h +++ b/RNTester/RNTester/RNTesterTurboModuleProvider.h @@ -6,13 +6,16 @@ * */ -#ifdef RN_TURBO_MODULE_ENABLED - -#import +#import namespace facebook { namespace react { +/** + * Provide the TurboModule class for the given name. + */ +Class RNTesterTurboModuleClassProvider(const char *name); + /** * Provide a pure C++ instance of a TurboModule, specific to this app. */ @@ -27,5 +30,3 @@ std::shared_ptr RNTesterTurboModuleProvider(const std::string &name } // namespace react } // namespace facebook - -#endif diff --git a/RNTester/RNTester/RNTesterTurboModuleProvider.mm b/RNTester/RNTester/RNTesterTurboModuleProvider.mm index b93d94878fef84..d8283bd12ef213 100644 --- a/RNTester/RNTester/RNTesterTurboModuleProvider.mm +++ b/RNTester/RNTester/RNTesterTurboModuleProvider.mm @@ -6,18 +6,21 @@ * */ -#ifdef RN_TURBO_MODULE_ENABLED - #import "RNTesterTurboModuleProvider.h" -#import -#import +#import +#import +#import // NOTE: This entire file should be codegen'ed. namespace facebook { namespace react { +Class RNTesterTurboModuleClassProvider(const char *name) { + return RCTCoreModulesClassProvider(name); +} + std::shared_ptr RNTesterTurboModuleProvider(const std::string &name, std::shared_ptr jsInvoker) { if (name == "SampleTurboCxxModule") { return std::make_shared(jsInvoker); @@ -38,5 +41,3 @@ } // namespace react } // namespace facebook - -#endif diff --git a/RNTester/RNTesterBundle-macOS/Info.plist b/RNTester/RNTesterBundle-macOS/Info.plist deleted file mode 100644 index 80c285bc578389..00000000000000 --- a/RNTester/RNTesterBundle-macOS/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - NSHumanReadableCopyright - Copyright © 2019 Facebook. All rights reserved. - NSPrincipalClass - - - diff --git a/RNTester/RNTesterIntegrationTests/RCTLoggingTests.m b/RNTester/RNTesterIntegrationTests/RCTLoggingTests.m index 020aa1b99687c4..84fadf2965ba83 100644 --- a/RNTester/RNTesterIntegrationTests/RCTLoggingTests.m +++ b/RNTester/RNTesterIntegrationTests/RCTLoggingTests.m @@ -11,7 +11,6 @@ #import #import #import -#import @interface RCTLoggingTests : XCTestCase @@ -43,7 +42,6 @@ - (void)setUp RCTAssert(scriptURL != nil, @"No scriptURL set"); _bridge = [[RCTBridge alloc] initWithBundleURL:scriptURL moduleProvider:NULL launchOptions:nil]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:60]; while (date.timeIntervalSinceNow > 0 && _bridge.loading) { [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; @@ -98,7 +96,7 @@ - (void)testLogging XCTAssertEqual(_lastLogLevel, RCTLogLevelError); XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Invariant failed"); + XCTAssertEqualObjects(_lastLogMessage, @"Invariant Violation: Invariant failed"); [_bridge enqueueJSCall:@"LoggingTestModule.logErrorToConsole" args:@[@"Invoking console.error"]]; dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) @@ -122,7 +120,7 @@ - (void)testLogging XCTAssertEqual(_lastLogLevel, RCTLogLevelError); XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Throwing an error"); + XCTAssertEqualObjects(_lastLogMessage, @"Error: Throwing an error"); } @end diff --git a/RNTester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m b/RNTester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m index aea0c0b2fda639..d1543672e6ef7f 100644 --- a/RNTester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m +++ b/RNTester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m @@ -6,7 +6,7 @@ * */ -#import +#import // TODO(macOS ISS#3536887) #import #import diff --git a/RNTester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m b/RNTester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m index 0756cb98fa181a..d79da587c6ddc4 100644 --- a/RNTester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m +++ b/RNTester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m @@ -6,7 +6,7 @@ * */ -#import +#import // TODO(macOS ISS#3536887) #import #import diff --git a/RNTester/RNTesterIntegrationTests/RNTesterIntegrationTests.m b/RNTester/RNTesterIntegrationTests/RNTesterIntegrationTests.m index 8bb2bec4cf05c7..289aa23d9be626 100644 --- a/RNTester/RNTesterIntegrationTests/RNTesterIntegrationTests.m +++ b/RNTester/RNTesterIntegrationTests/RNTesterIntegrationTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import // TODO(macOS ISS#3536887) #import #import @@ -76,6 +76,7 @@ - (void)testTheTester_waitOneFrame #if !TARGET_OS_OSX // ios specific RCT_TEST(AccessibilityManagerTest) #endif +RCT_TEST(GlobalEvalWithSourceUrlTest) @end diff --git a/RNTester/RNTesterIntegrationTests/RNTesterSnapshotTests.m b/RNTester/RNTesterIntegrationTests/RNTesterSnapshotTests.m index 41ca2d1fd52a69..21b28f90f153ef 100644 --- a/RNTester/RNTesterIntegrationTests/RNTesterSnapshotTests.m +++ b/RNTester/RNTesterIntegrationTests/RNTesterSnapshotTests.m @@ -6,7 +6,7 @@ * */ -#import +#import // TODO(macOS ISS#3536887) #import #import @@ -22,14 +22,14 @@ @implementation RNTesterSnapshotTests - (void)setUp { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // TODO(macOS ISS#3536887) _runner = RCTInitRunnerForApp(@"RNTester/js/RNTesterApp.ios", nil, nil); if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10) { _runner.testSuffix = [NSString stringWithFormat:@"-iOS%d", UIDevice.currentDevice.systemVersion.intValue]; } -#else // TARGET_OS_OSX +#else // [TODO(macOS ISS#3536887) _runner = RCTInitRunnerForApp(@"RNTester/js/RNTesterApp.macos", nil, nil); -#endif +#endif // ]TODO(macOS ISS#3536887) _runner.recordMode = NO; } @@ -43,9 +43,8 @@ - (void)test##name \ RCT_TEST(LayoutExample) RCT_TEST(ARTExample) RCT_TEST(ScrollViewExample) -#if !TARGET_OS_TV -// TODO(OSS Candidate ISS#2710739): RCTPicker which TextExample depends on not available on tvOS RCT_TEST(TextExample) +#if !TARGET_OS_TV // No switch or slider available on tvOS RCT_TEST(SwitchExample) RCT_TEST(SliderExample) diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1_macOS.png index ead694d19a12f256932cd586b0ba8124ad76a0cd..107b06345f060c235af6d3e8b0798b7a14c7bd6e 100644 GIT binary patch literal 13329 zcmeI&`#Y5B9|!Q~8HS0R79*mWvX#oA#x`s;Moy_FF-@e=5GrTUYLz)yG-}b>G=;4h z``uMJtaT`r$P}?D(=NplCb9;t8AgMdF|*ST{RiLu;d_1WAMWe=T<_<(?jJt){rX(b z56^`I`~3{`tn?rVGVtH+9Rxuz5rTAIqI5J#{f6^B5TtDx8YDD0UC~=V(2KPrG%RKv5Pe%d zUF_yu9P^-dIC>^SdR=_u+|2zGVx;JPMF^+R3`Upy;$VRrO=Vxo-MQtvY&OqArz|+o zW=q)ZeF%Jj{+T;RM!X)Mqy716NX4yg^tCa^p28ff|Lc~1?j=}qlhTz2pOqJ4Jf=d| z$c~8`w-MW%&fa?)+4m%sz{rm|{?2~1Cl^T}$L3x&zVy6((RZa{+pn)_JW}j*g=qZ8 zW2IjW@oJOB5h`v1|74Cd;mJ)wF_(}nj-V>GY+pa|Hn44P#rIraC2BM-fqvIoILIk2 zH1W{+?#*yXO}UBKn_4xfThYS(srt^vwTy{uywrZwAy?os@r=yxudKM-{sTX)t#Nzk z+?<xBnLN@hD!6ba-Ta}(oJ+e^C6rF$#o57T$c=qcPU|DMbcNwYZ)y2_ug7G;^Y zW#uxznMBzUbw<$rCvRsN z>fp?(%`7j{%8pyCo@jNS+tE<`g5UDENY&X%%UZhE-LN@|P51^~XQeEtLia?^R_0J6 zO+6U)E(nheme|k!%n}^M`O6AV;ox=Y7u`v+%hq+KQDS-jo_L?5?k=yFALcm+m6!Sq zec8~&3s*aD-bW?(RoNTfJ#X8!Nr4P&Rz9WGQYYY zzExL|^4O(AmizO)tLC%j*$wv18|ik-Pn%!RpV42?yXpKeM4?;P^|6+>j>(u*+EZDq z)GBo396EhfXBX)gx8ZQB%P};n@omdw%^+)6|9dWp4N8+@>3-dF3|G0e2ss_KAQ!*vWy|wCm z=e~lIWcENp=xU^Rc>dCSDXz)L^oXP14~mtoEgrM)6^^3?4G_ngmDypNxJvL$cNpm^ z%^s*5d0L-p-IpI9`gZc4K#)_C zzqjYXui?K3`LSVs#y)|MghZ7(Zs*pABCY2>JBl{FiilZtUy)XgTOBZWmZ?-qyjZOm zH#?6dvWQqL3ofzMMx92X!aLTGJV64w0dB&-szBoGI@U=uTU?fl zorZ^*9|Q|EsIH_U?rLvY2?cAVG$cyP@1^!v^L5eg%WBN&`hu|9k8q+ z#daGQVT3>|vc`fnlT;rSzQ7>)v0AfO5J9+T4kLyTh)-KdG{e|kIb2hq|B$f6^tHxF zy9Da@Bl5lu!BwX-!aNoezH#^pTXXiBoqK+qu_bCU2t@zGosg8Yyrhqigv+W#C;1w2 z`cjj6C%RUyr$$i67fvCx@ks4t@<`(f;}CP>Rtf{Nkr+-ULM|WZrBEgXhW{U4LK$nm zMIacV4GPc%a1($6pa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o zfC8WZC;$q80-yjW01AKtpa3ZNuPG4TZB=9Tn?8$~=0E=U3%4PIBpS{k|?(mg}uW}5g~+->yYe;kl4GM8S~g^Xop1FE*aYG zxE;#2q=`-z2G-suc(CsA<2?7#p)sF7>n@*))Ab z{CVK#rvr|5ovSr|dk@gI&sJ#na5_+;`4^2*mv)=WDyAdDM01z+uUQACf4VVOw#%+8 z{(j4N+-I8Ts-P8j zV(+JV>UKEK^y_MZ3dpdT8EiCN9 zar5qnm(M>*l_UjLElf?$?kw+5KjS7{d2nW*n4Ze|=F<#qT9jRCr7ZpRN=cSZPgX9Y z#(lSVYC_iX){CH^pI|WQ$*{iki+Z@t`^cml(}Uh?^&Ezcy>;hSG6SmRZf!rMqRpX7 z4gMGM{YI?r&CV_R_YUaMShO7bhD-)qt!<5>`Okl6cB%LrQqVkNPFCXSzCK!)rLJVF z-K4F5o>KFj-ufx7)55pyWzW0W4@+cyeUz-_y94dpjxb$*)NM787BuP(#mzV5M8s;5 zGAtbs(iVN<-`->mM%j9bi%!_Wo6ekf@(~vswrU*_ti1M0+#BWO@N)IR1-pP76?@0N zY45C#mfLOH9})Pf(Ng`+Ig|da62-_a>0?Su#Ehkb|D6f_tM@|&mMP0~Qd_ZwG~qg* z@gZcsBlStxZ=J3CAAL+bly)k}AW7-HuJE5_y?MPxq7(BULNwenN}rZZH7`awg&wz7 zcW=C+xRS6OtnZue*0`9p$ZWUlGNYTXKJI!>e@1^!AE0+fB1OCUufAu$vraKiqdXQT zhz!Db>AGjubx>zYk2QL2G)dIipqu*8{+)k}?Sk1_eC!_o*O{eFa}r&aO_j5edaUuE zwUP+7bugSKX+ai!WI;g(XHrVG8U-Ksab)k-y0F>x$b}O7gG+ZqL^Yc(`%MPK69RVy zYSpz2@77?p-8fmDgh-@DFY1z817`n-9j7CqL*FLPsXf;@<^4zTVS{G-ZKdV2)44a- zo$K3Qa5RuPk`%UHQ82z(xL9G^si75a?NKRN%Vm@1KT5183fiGkLp1Y=N%FeEXUgM> zj-u?5*3oXGqJ1<~{_xUAF=xg0bjIrN%-f!{#wjcGw!^Ng9G>9&mo8*^14PYdz||~T zkV1s20D{Pnr`zs>r{Pbd-SyYKHQoKgZ}BChCWRUuWBx^T7ui_ZoUfn0&b@1|7keli zxrE1)dZ19IvZ74JuW&AdU_`D(Ad_$iu1bf%rTPip;qdrs9yUIxg6Fr@E~Owi-0#P+ zDO5$A@Xb)VBa9%^4rG+uh9F-*&Nx>>Fub^)NalyaFipI;!52lL6*U4;*oZ1Q>} z$Yf|$2~Rj3Oomv_T}&+^5zSD*;hijq=wQ|OqcsEqnFE9ELG%9$q9@I%HWdme@?g9lc@CL(I)<>HERFJmQ7hB}{zGPPjX$$vo~ z!QH|FWidGGkHc4DC(FAuNFb*Cib7Fmf(xLah29bl|^LoIP$k+Nxsomn1^FAqBVp*6@0XKhpq`Z+KLE9KsP`V zfC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+ofC8WZDEPlsKs7Zjh9D)*zy1OM rZ|=YgMDY3&C;$q8g8wN6Qsw!cjaPCus}x~hU_qXHecf*DiT?2~dL+%# diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testARTExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testARTExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testLayoutExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testLayoutExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testScrollViewExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testScrollViewExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSliderExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSliderExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSwitchExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testSwitchExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testTextExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testTextExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testViewExample_1_macOS.png b/RNTester/RNTesterIntegrationTests/ReferenceImages/RNTester-js-RNTesterApp.macos/testViewExample_1_macOS.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c25e7be44c756daf1128754c3d401f5952af03 GIT binary patch literal 12381 zcmeI&`#;lr90&04rj6rT2g4#t7rAC?6uD$*A!ZFR$t{-*(W%5-8f}UsS|M%D=_t1x ztQ1-1QcCDVC2}oos20nTwe4g*0K3SgoU6ka}@(=_m z;rHUaAP8m;L9)-~kSm?~&1d@{Xq8r^qoe0hM;FJ~=-7B-Tu?}uOIS=;d}N51%N_`_ z%E=)GL}-)LY?~6o^*8nqqqk=szh$SiNh#lZdnu9MkC zS}OH$@=P|LE>>%Q*pQ}Y@Kt5VmSc8Ve$!yTo`EgrJIzyYzHFw@+M+PBv34ZvbF!#J zcs=R!{cs^daKFNrnWqLr72P(`z)U32a~ZphE@sf#8pu)~f{sx@xf>kop>Xn!|EObY zQsA4H!^^Dd24@|0y<@t;^&f62FmhpEZj!oAz)mmb>Do>EtrG_e8qDq6%}(DN4|&~| zV4IQ?dE~wEL>~h|B1SQ;tj>Mb@!eTbV*byoK(>3-Ood?b&*0)ehS{}o!k}dqg%^=2 zqO{%YEo9kd2!qHHqaB<0Yc<5@dDO(hFN8B7yd>EBlhXzJ}WMrx_EgP1?DT>Ez4Y8kC4 z^dvsj^wM9-{$}q2C}o0PS49oWeqC48%woD1`vWv zBbk+)iLFdeiPc{<0q zc?;EG=}~hx^(nQR+C$|9!1JuTO5SnDP2+SE0w0N^L}st@qWj^dgv>SdhGj`=;q&gxB+`MYxPq-Z z-m&ghTnE+cjgFz&1=s`M?)ivHH(d6Z^om?fv?i*S*Y-Q8(Cf=iuqkkfROe-ROr6*C zi;xj2{9xa%m>H#R^^>kI@`KSeSVLyfw19C-^K7Tvg$N>jkm9!%Asm^{oiD~Tsi^v! zx?Gbews7rcKT1p|E^r{Gc3S#l{TR*Or?MjmD^bQ^-4IVFZ*Q`~SpT<=;)jcvQz=XR zQ*YZ7s`w^pcPy<-9*zo+zp}OeQ3-|Tq{7&&WReV7LAbIjtipWpN8H^Z!<8%t!RV3D zs+9y=DfCJ~5S$JF)q&ZwWqxJZ=RXgfJ9%voWYmPmIUG0z`}ExW=UglMs|Q6kmSG>% zk_MAODr#;!3<9_W@DhLmpa3WU3V;Hj04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj z04M+ofC8WZC;$q80-yjW01AKtpa3WU3V;Hj04M+o{=b4TT}`wW1T#u6zwz@sFWzZC K?)IL;XZ{1iFWwXY literal 0 HcmV?d00001 diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 7c847941a6d581..6ba1c72de992a1 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -3,146 +3,115 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 10F9D0AD3F8E4C0DD7187464 /* libPods-RNTester-macOSUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E39630912E65B1C853EA5C8 /* libPods-RNTester-macOSUnitTests.a */; }; 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 1551B774FBA023F7BC207D4C /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D189458AC7EF7C7E25C6A79F /* libPods-RNTesterIntegrationTests.a */; }; 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; }; - 388291A32445522200D89845 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 388291A22445522200D89845 /* JavaScriptCore.framework */; }; + 3811324724550A8F009E988D /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */; }; + 383838BD244BC2FF005FAC75 /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */; }; + 383838C0244BC3BD005FAC75 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 383838BF244BC3AE005FAC75 /* libPods-RNTesterUnitTests.a */; }; + 383838C1244BC3D9005FAC75 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB213022B2C649005AC45F /* JavaScriptCore.framework */; }; + 383838C2244BC52B005FAC75 /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */; }; + 383838C3244BC52E005FAC75 /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */; }; + 383838C4244BC532005FAC75 /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */; }; + 383838C5244BC535005FAC75 /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */; }; + 383838C6244BC53F005FAC75 /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */; }; + 383838C7244BC542005FAC75 /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */; }; + 383838C9244BC548005FAC75 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C022B2BAA4005AC45F /* RCTEventDispatcherTests.m */; }; + 383838CA244BC54B005FAC75 /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */; }; + 383838CB244BC54E005FAC75 /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */; }; + 383838CC244BC551005FAC75 /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */; }; + 383838CD244BC55B005FAC75 /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */; }; + 383838CE244BC55E005FAC75 /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C222B2BAA4005AC45F /* RCTImageLoaderTests.m */; }; + 383838CF244BC561005FAC75 /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */; }; + 383838D0244BC564005FAC75 /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */; }; + 383838D1244BC567005FAC75 /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C322B2BAA4005AC45F /* RCTMethodArgumentTests.m */; }; + 383838D2244BC56A005FAC75 /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */; }; + 383838D3244BC56E005FAC75 /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */; }; + 383838D4244BC570005FAC75 /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */; }; + 383838D5244BC574005FAC75 /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */; }; + 383838D6244BC577005FAC75 /* RCTNativeAnimatedNodesManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20BE22B2BAA4005AC45F /* RCTNativeAnimatedNodesManagerTests.m */; }; + 383838D7244BC57A005FAC75 /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */; }; + 383838D8244BC57D005FAC75 /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C422B2BAA4005AC45F /* RCTShadowViewTests.m */; }; + 383838D9244BC581005FAC75 /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20BF22B2BAA4005AC45F /* RCTUIManagerTests.m */; }; + 383838DA244BC584005FAC75 /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C122B2BAA4005AC45F /* RCTUnicodeDecodeTests.m */; }; + 383838DB244BC587005FAC75 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20D022B2BAA5005AC45F /* RCTURLUtilsTests.m */; }; + 383838DD244BC596005FAC75 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; }; + 383838DE244BC59A005FAC75 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215E22B2F3EC005AC45F /* RCTLoggingTests.m */; }; + 383838DF244BC59D005FAC75 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB216122B2F3EC005AC45F /* RCTRootViewIntegrationTests.m */; }; + 383838E0244BC5A0005FAC75 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */; }; + 383838E1244BC5A4005FAC75 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB216022B2F3EC005AC45F /* RNTesterSnapshotTests.m */; }; + 383838E2244BC5A8005FAC75 /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */; }; + 38784804245633870035033A /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784803245633870035033A /* libPods-RNTester.a */; }; + 38784806245633A90035033A /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784805245633A90035033A /* libPods-RNTester.a */; }; + 38784808245633B70035033A /* libPods-RNTester-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38784807245633B70035033A /* libPods-RNTester-macOS.a */; }; 3882C0E22445657000E92FB9 /* OCMock.framework in Copy Files (1 item) */ = {isa = PBXBuildFile; fileRef = 38A93816244532460025DABB /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 38A93827244532470025DABB /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93805244532460025DABB /* RCTModuleInitNotificationRaceTests.m */; }; - 38A93828244532470025DABB /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 38A93806244532460025DABB /* RCTModuleMethodTests.mm */; }; - 38A93829244532470025DABB /* RCTDevMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93807244532460025DABB /* RCTDevMenuTests.m */; }; - 38A9382A244532470025DABB /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93808244532460025DABB /* RCTMultipartStreamReaderTests.m */; }; - 38A9382B244532470025DABB /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93809244532460025DABB /* RCTShadowViewTests.m */; }; - 38A9382C244532470025DABB /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380A244532460025DABB /* RCTComponentPropsTests.m */; }; - 38A9382D244532470025DABB /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380B244532460025DABB /* RCTFontTests.m */; }; - 38A9382E244532470025DABB /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380C244532460025DABB /* RCTConvert_NSURLTests.m */; }; - 38A9382F244532470025DABB /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380D244532460025DABB /* RCTURLUtilsTests.m */; }; - 38A93830244532470025DABB /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 38A9380E244532460025DABB /* RNTesterUnitTestsBundle.js */; }; - 38A93831244532470025DABB /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380F244532460025DABB /* RCTConvert_UIColorTests.m */; }; - 38A93832244532470025DABB /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93810244532460025DABB /* RCTBlobManagerTests.m */; }; - 38A93833244532470025DABB /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93812244532460025DABB /* RCTImageUtilTests.m */; }; - 38A93834244532470025DABB /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93813244532460025DABB /* RCTFormatErrorTests.m */; }; - 38A93835244532470025DABB /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93814244532460025DABB /* RCTImageLoaderTests.m */; }; - 38A93836244532470025DABB /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93815244532460025DABB /* RCTImageLoaderHelpers.m */; }; - 38A93838244532470025DABB /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93817244532460025DABB /* RCTEventDispatcherTests.m */; }; - 38A93839244532470025DABB /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93818244532460025DABB /* RCTUnicodeDecodeTests.m */; }; - 38A9383A244532470025DABB /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93819244532460025DABB /* RCTBundleURLProviderTests.m */; }; 38A9383C244532470025DABB /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38A9381B244532460025DABB /* libOCMock.a */; }; - 38A9383D244532470025DABB /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381C244532470025DABB /* RCTGzipTests.m */; }; - 38A9383E244532470025DABB /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381D244532470025DABB /* RCTJSONTests.m */; }; - 38A9383F244532470025DABB /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381E244532470025DABB /* RCTModuleInitTests.m */; }; - 38A93840244532470025DABB /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381F244532470025DABB /* RCTAnimationUtilsTests.m */; }; - 38A93842244532470025DABB /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93821244532470025DABB /* RCTAllocationTests.m */; }; - 38A93843244532470025DABB /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93822244532470025DABB /* RCTPerformanceLoggerTests.m */; }; - 38A93844244532470025DABB /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93823244532470025DABB /* RCTUIManagerTests.m */; }; - 38A93845244532470025DABB /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93824244532470025DABB /* RCTConvert_YGValueTests.m */; }; - 38A93846244532470025DABB /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93825244532470025DABB /* RCTMethodArgumentTests.m */; }; - 38A93847244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93826244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m */; }; 38B2630B2444F5EB006AB4D5 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; 38B2630C2444F628006AB4D5 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; - 38BB7CB824455EB300803CDE /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93821244532470025DABB /* RCTAllocationTests.m */; }; - 38BB7CB924455EB300803CDE /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381F244532470025DABB /* RCTAnimationUtilsTests.m */; }; - 38BB7CBA24455EB300803CDE /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93810244532460025DABB /* RCTBlobManagerTests.m */; }; - 38BB7CBB24455EB300803CDE /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93819244532460025DABB /* RCTBundleURLProviderTests.m */; }; - 38BB7CBC24455EB300803CDE /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380A244532460025DABB /* RCTComponentPropsTests.m */; }; - 38BB7CBD24455EB300803CDE /* RCTConvert_NSColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93820244532470025DABB /* RCTConvert_NSColorTests.m */; }; - 38BB7CBE24455EB300803CDE /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380C244532460025DABB /* RCTConvert_NSURLTests.m */; }; - 38BB7CC024455EB300803CDE /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93824244532470025DABB /* RCTConvert_YGValueTests.m */; }; - 38BB7CC224455EB300803CDE /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93817244532460025DABB /* RCTEventDispatcherTests.m */; }; - 38BB7CC324455EB300803CDE /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380B244532460025DABB /* RCTFontTests.m */; }; - 38BB7CC424455EB300803CDE /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93813244532460025DABB /* RCTFormatErrorTests.m */; }; - 38BB7CC524455EB300803CDE /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381C244532470025DABB /* RCTGzipTests.m */; }; - 38BB7CC624455EB300803CDE /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93815244532460025DABB /* RCTImageLoaderHelpers.m */; }; - 38BB7CC724455EB300803CDE /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93814244532460025DABB /* RCTImageLoaderTests.m */; }; - 38BB7CC824455EB300803CDE /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93812244532460025DABB /* RCTImageUtilTests.m */; }; - 38BB7CC924455EB300803CDE /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381D244532470025DABB /* RCTJSONTests.m */; }; - 38BB7CCA24455EB300803CDE /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93825244532470025DABB /* RCTMethodArgumentTests.m */; }; - 38BB7CCB24455EB300803CDE /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93805244532460025DABB /* RCTModuleInitNotificationRaceTests.m */; }; - 38BB7CCC24455EB300803CDE /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9381E244532470025DABB /* RCTModuleInitTests.m */; }; - 38BB7CCD24455EB300803CDE /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 38A93806244532460025DABB /* RCTModuleMethodTests.mm */; }; - 38BB7CCE24455EB300803CDE /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93808244532460025DABB /* RCTMultipartStreamReaderTests.m */; }; - 38BB7CCF24455EB300803CDE /* RCTNativeAnimatedNodesManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93826244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m */; }; - 38BB7CD024455EB300803CDE /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93822244532470025DABB /* RCTPerformanceLoggerTests.m */; }; - 38BB7CD124455EB300803CDE /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93809244532460025DABB /* RCTShadowViewTests.m */; }; - 38BB7CD224455EB300803CDE /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93823244532470025DABB /* RCTUIManagerTests.m */; }; - 38BB7CD324455EB300803CDE /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A93818244532460025DABB /* RCTUnicodeDecodeTests.m */; }; - 38BB7CD424455EB300803CDE /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38A9380D244532460025DABB /* RCTURLUtilsTests.m */; }; 38BB7CD524455EDD00803CDE /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38A93816244532460025DABB /* OCMock.framework */; }; - 38BB7CFC24455F4300803CDE /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 38A9380E244532460025DABB /* RNTesterUnitTestsBundle.js */; }; 38BB7CFD244560CC00803CDE /* RNTesterUnitTests_macOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F153471233AB2C7006DFE44 /* RNTesterUnitTests_macOS.m */; }; - 38BB7CFF244564DB00803CDE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 388291A22445522200D89845 /* JavaScriptCore.framework */; }; 38CB64352445042D009035CC /* RNTesterTurboModuleProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */; }; - 38E0B2B924456B0700EF053A /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E0B2B824456B0700EF053A /* RNTesterIntegrationTests.m */; }; - 38E9442624456C9F004A39E0 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442124456C9F004A39E0 /* RNTesterSnapshotTests.m */; }; - 38E9442724456C9F004A39E0 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442224456C9F004A39E0 /* RCTRootViewIntegrationTests.m */; }; - 38E9442824456C9F004A39E0 /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442324456C9F004A39E0 /* RNTesterTestModule.m */; }; - 38E9442924456C9F004A39E0 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442424456C9F004A39E0 /* RCTLoggingTests.m */; }; - 38E9442A24456C9F004A39E0 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442524456C9F004A39E0 /* RCTUIManagerScenarioTests.m */; }; - 38E9442B2446159A004A39E0 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442424456C9F004A39E0 /* RCTLoggingTests.m */; }; - 38E9442C2446159A004A39E0 /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442224456C9F004A39E0 /* RCTRootViewIntegrationTests.m */; }; - 38E9442D2446159A004A39E0 /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442524456C9F004A39E0 /* RCTUIManagerScenarioTests.m */; }; - 38E9442E2446159A004A39E0 /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442124456C9F004A39E0 /* RNTesterSnapshotTests.m */; }; - 38E9442F2446159A004A39E0 /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E9442324456C9F004A39E0 /* RNTesterTestModule.m */; }; - 38E944302446159A004A39E0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E0B2B824456B0700EF053A /* RNTesterIntegrationTests.m */; }; - 3D13F8481D6F6AF900E69E0E /* ImageInBundle.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */; }; - 3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; }; 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 3D56F9F11D6F6E9B00F53A06 /* RNTesterBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */; }; + 413F654822EE16AED0DF2540 /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F94084777080D7B374FB4783 /* libPods-RNTester.a */; }; 5101985723AD9EE600118BF1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5101985523AD9EE600118BF1 /* Main.storyboard */; }; 5101985A23AD9F5B00118BF1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5101985923AD9F5B00118BF1 /* ViewController.m */; }; 5101985B23ADA00B00118BF1 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 5101986823ADA13C00118BF1 /* ImageInBundle.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */; }; - 5101986923ADA13C00118BF1 /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; }; - 5101986A23ADA15700118BF1 /* RNTesterBundle-macOS.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 5101986223ADA0FC00118BF1 /* RNTesterBundle-macOS.bundle */; }; 5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB1B226440DB0018C04F /* AppDelegate.mm */; }; 5CB07C9B226467E60039471C /* RNTesterTurboModuleProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */; }; 68E1E4BC2230DF2F00570185 /* ComponentRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 68E1E4BB2230DF2F00570185 /* ComponentRegistry.cpp */; }; 7C718C7B78F06C4CD1D1771A /* libPods-RNTester-macOSIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B8A3294D74D7AC1BE88DC4E /* libPods-RNTester-macOSIntegrationTests.a */; }; + 8BBFF9F061783A02D50DD2EC /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8210317F3CE28B1945488740 /* libPods-RNTesterIntegrationTests.a */; }; 9F15345F233AB2C4006DFE44 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F15345E233AB2C4006DFE44 /* AppDelegate.m */; }; 9F153461233AB2C7006DFE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F153460233AB2C7006DFE44 /* Assets.xcassets */; }; 9F153467233AB2C7006DFE44 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F153466233AB2C7006DFE44 /* main.m */; }; A13DC98BDCE5EE508FFA7BE7 /* libPods-RNTester-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A355204268D03CF69ABC11D /* libPods-RNTester-macOS.a */; }; - AED7599CAA60E74DF4523090 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0628D8AFAF46D4219B398D8D /* libPods-RNTesterUnitTests.a */; }; - B9C5BB1881F54450DBCA70F5 /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8508AD3C1DC3509924E63948 /* libPods-RNTester.a */; }; + E59A0FBD0170A092274A6207 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 72247071A1BF06D54F0FECC7 /* libPods-RNTesterUnitTests.a */; }; + E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; }; + E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */; }; + E7DB20D222B2BAA6005AC45F /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */; }; + E7DB20D322B2BAA6005AC45F /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */; }; + E7DB20D522B2BAA6005AC45F /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */; }; + E7DB20D622B2BAA6005AC45F /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */; }; + E7DB20D722B2BAA6005AC45F /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */; }; + E7DB20D822B2BAA6005AC45F /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */; }; + E7DB20D922B2BAA6005AC45F /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */; }; + E7DB20DA22B2BAA6005AC45F /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */; }; + E7DB20DB22B2BAA6005AC45F /* RCTNativeAnimatedNodesManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20BE22B2BAA4005AC45F /* RCTNativeAnimatedNodesManagerTests.m */; }; + E7DB20DC22B2BAA6005AC45F /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20BF22B2BAA4005AC45F /* RCTUIManagerTests.m */; }; + E7DB20DD22B2BAA6005AC45F /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C022B2BAA4005AC45F /* RCTEventDispatcherTests.m */; }; + E7DB20DE22B2BAA6005AC45F /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C122B2BAA4005AC45F /* RCTUnicodeDecodeTests.m */; }; + E7DB20DF22B2BAA6005AC45F /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C222B2BAA4005AC45F /* RCTImageLoaderTests.m */; }; + E7DB20E022B2BAA6005AC45F /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C322B2BAA4005AC45F /* RCTMethodArgumentTests.m */; }; + E7DB20E122B2BAA6005AC45F /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C422B2BAA4005AC45F /* RCTShadowViewTests.m */; }; + E7DB20E222B2BAA6005AC45F /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */; }; + E7DB20E322B2BAA6005AC45F /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */; }; + E7DB20E422B2BAA6005AC45F /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */; }; + E7DB20E522B2BAA6005AC45F /* RCTDevMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */; }; + E7DB20E622B2BAA6005AC45F /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */; }; + E7DB20E722B2BAA6005AC45F /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */; }; + E7DB20E822B2BAA6005AC45F /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */; }; + E7DB20E922B2BAA6005AC45F /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */; }; + E7DB20EA22B2BAA6005AC45F /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */; }; + E7DB20EB22B2BAA6005AC45F /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */; }; + E7DB20EC22B2BAA6005AC45F /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */; }; + E7DB20ED22B2BAA6005AC45F /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20D022B2BAA5005AC45F /* RCTURLUtilsTests.m */; }; + E7DB216222B2F3EC005AC45F /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */; }; + E7DB216322B2F3EC005AC45F /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215E22B2F3EC005AC45F /* RCTLoggingTests.m */; }; + E7DB216422B2F3EC005AC45F /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */; }; + E7DB216522B2F3EC005AC45F /* RNTesterSnapshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB216022B2F3EC005AC45F /* RNTesterSnapshotTests.m */; }; + E7DB216622B2F3EC005AC45F /* RCTRootViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB216122B2F3EC005AC45F /* RCTRootViewIntegrationTests.m */; }; + E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB213022B2C649005AC45F /* JavaScriptCore.framework */; }; + E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB218B22B41FCD005AC45F /* XCTest.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 38A93800244531670025DABB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = RNTester; - }; - 38E0B2BB24456B0700EF053A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = RNTester; - }; - 3D13F84B1D6F6B5F00E69E0E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D13F83D1D6F6AE000E69E0E; - remoteInfo = RNTesterBundle; - }; - 5101986B23ADA17000118BF1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5101986123ADA0FC00118BF1; - remoteInfo = "RNTesterBundle-macOS"; - }; 9F15346E233AB2C7006DFE44 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; @@ -157,9 +126,34 @@ remoteGlobalIDString = 9F15345A233AB2C4006DFE44; remoteInfo = "RNTester-macOS"; }; + E7DB215822B2F332005AC45F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = RNTester; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 387847CF245631D80035033A /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 387847DC245631F50035033A /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3882C0E12445655100E92FB9 /* Copy Files (1 item) */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -174,7 +168,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0628D8AFAF46D4219B398D8D /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 0A355204268D03CF69ABC11D /* libPods-RNTester-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 0BFED72B21FBD987A97E30B9 /* Pods-RNTester-macOSIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSIntegrationTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests.release.xcconfig"; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* RNTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNTester.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -189,73 +182,34 @@ 27F441EA1BEBE5030039B79C /* FlexibleSizeExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlexibleSizeExampleView.h; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.h; sourceTree = ""; }; 2BE07A0C310D8A03C00D6F07 /* Pods-RNTester-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS.debug.xcconfig"; sourceTree = ""; }; 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RNTester/Images.xcassets; sourceTree = ""; }; - 388291A22445522200D89845 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; - 38A937FB244531670025DABB /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 38A937FF244531670025DABB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 38A93805244532460025DABB /* RCTModuleInitNotificationRaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitNotificationRaceTests.m; sourceTree = ""; }; - 38A93806244532460025DABB /* RCTModuleMethodTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethodTests.mm; sourceTree = ""; }; - 38A93807244532460025DABB /* RCTDevMenuTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenuTests.m; sourceTree = ""; }; - 38A93808244532460025DABB /* RCTMultipartStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReaderTests.m; sourceTree = ""; }; - 38A93809244532460025DABB /* RCTShadowViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowViewTests.m; sourceTree = ""; }; - 38A9380A244532460025DABB /* RCTComponentPropsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentPropsTests.m; sourceTree = ""; }; - 38A9380B244532460025DABB /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = ""; }; - 38A9380C244532460025DABB /* RCTConvert_NSURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSURLTests.m; sourceTree = ""; }; - 38A9380D244532460025DABB /* RCTURLUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTURLUtilsTests.m; sourceTree = ""; }; - 38A9380E244532460025DABB /* RNTesterUnitTestsBundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RNTesterUnitTestsBundle.js; sourceTree = ""; }; - 38A9380F244532460025DABB /* RCTConvert_UIColorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_UIColorTests.m; sourceTree = ""; }; - 38A93810244532460025DABB /* RCTBlobManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBlobManagerTests.m; sourceTree = ""; }; - 38A93812244532460025DABB /* RCTImageUtilTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtilTests.m; sourceTree = ""; }; - 38A93813244532460025DABB /* RCTFormatErrorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFormatErrorTests.m; sourceTree = ""; }; - 38A93814244532460025DABB /* RCTImageLoaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderTests.m; sourceTree = ""; }; - 38A93815244532460025DABB /* RCTImageLoaderHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderHelpers.m; sourceTree = ""; }; + 34028D6B10F47E490042EB27 /* Pods-RNTesterUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.debug.xcconfig"; sourceTree = ""; }; + 38360C8B244E7D8B007B212D /* RNTester.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = RNTester.entitlements; path = RNTester/RNTester.entitlements; sourceTree = ""; }; + 383838BF244BC3AE005FAC75 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RNTesterUnitTests.a"; path = "../../../Library/Developer/Xcode/DerivedData/RNTesterPods-bpqvwgykvczlrybljbollkvfwjik/Build/Products/Debug-iphoneos/libPods-RNTesterUnitTests.a"; sourceTree = ""; }; + 387847D1245631D80035033A /* libiosDeviceBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiosDeviceBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 387847DE245631F50035033A /* libiosSimulatorBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiosSimulatorBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 387847EB2456320C0035033A /* libmacOSBuild.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmacOSBuild.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 38784803245633870035033A /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 38784805245633A90035033A /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 38784807245633B70035033A /* libPods-RNTester-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 38A93816244532460025DABB /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMock.framework; sourceTree = ""; }; - 38A93817244532460025DABB /* RCTEventDispatcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventDispatcherTests.m; sourceTree = ""; }; - 38A93818244532460025DABB /* RCTUnicodeDecodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUnicodeDecodeTests.m; sourceTree = ""; }; - 38A93819244532460025DABB /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = ""; }; - 38A9381A244532460025DABB /* OCMock */ = {isa = PBXFileReference; lastKnownFileType = folder; path = OCMock; sourceTree = ""; }; 38A9381B244532460025DABB /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = ""; }; - 38A9381C244532470025DABB /* RCTGzipTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGzipTests.m; sourceTree = ""; }; - 38A9381D244532470025DABB /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = ""; }; - 38A9381E244532470025DABB /* RCTModuleInitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitTests.m; sourceTree = ""; }; - 38A9381F244532470025DABB /* RCTAnimationUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtilsTests.m; sourceTree = ""; }; - 38A93820244532470025DABB /* RCTConvert_NSColorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSColorTests.m; sourceTree = ""; }; - 38A93821244532470025DABB /* RCTAllocationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAllocationTests.m; sourceTree = ""; }; - 38A93822244532470025DABB /* RCTPerformanceLoggerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLoggerTests.m; sourceTree = ""; }; - 38A93823244532470025DABB /* RCTUIManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerTests.m; sourceTree = ""; }; - 38A93824244532470025DABB /* RCTConvert_YGValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_YGValueTests.m; sourceTree = ""; }; - 38A93825244532470025DABB /* RCTMethodArgumentTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMethodArgumentTests.m; sourceTree = ""; }; - 38A93826244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedNodesManagerTests.m; sourceTree = ""; }; 38BB7CB524455C4100803CDE /* libPods-RNTester-macOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-RNTester-macOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 38E0B2B624456B0700EF053A /* RNTesterIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 38E0B2B824456B0700EF053A /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = ""; }; - 38E0B2BA24456B0700EF053A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 38E9442124456C9F004A39E0 /* RNTesterSnapshotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterSnapshotTests.m; sourceTree = ""; }; - 38E9442224456C9F004A39E0 /* RCTRootViewIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootViewIntegrationTests.m; sourceTree = ""; }; - 38E9442324456C9F004A39E0 /* RNTesterTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterTestModule.m; sourceTree = ""; }; - 38E9442424456C9F004A39E0 /* RCTLoggingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLoggingTests.m; sourceTree = ""; }; - 38E9442524456C9F004A39E0 /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = ""; }; 3CCA44B8467CB06ACED8E0E9 /* Pods-RNTester-macOSIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSIntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests.debug.xcconfig"; sourceTree = ""; }; - 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D13F8401D6F6AE000E69E0E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; - 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ImageInBundle.png; sourceTree = ""; }; - 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = OtherImages.xcassets; sourceTree = ""; }; 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "legacy_image@2x.png"; path = "RNTester/legacy_image@2x.png"; sourceTree = ""; }; 406E6935B300A29BA57EE1B0 /* Pods-RNTester-macOSUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests.debug.xcconfig"; sourceTree = ""; }; 5101985623AD9EE600118BF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 5101985823AD9F5B00118BF1 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 5101985923AD9F5B00118BF1 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 5101986223ADA0FC00118BF1 /* RNTesterBundle-macOS.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTesterBundle-macOS.bundle"; sourceTree = BUILT_PRODUCTS_DIR; }; - 5101986423ADA0FC00118BF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 5641CFF8E3CFBC3C4B0EDEEF /* Pods-RNTesterIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.debug.xcconfig"; sourceTree = ""; }; 5BEC8567F3741044B6A5EFC5 /* Pods-RNTester.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester/Pods-RNTester.release.xcconfig"; sourceTree = ""; }; 5C60EB1B226440DB0018C04F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = RNTester/AppDelegate.mm; sourceTree = ""; }; 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RNTesterTurboModuleProvider.mm; path = RNTester/RNTesterTurboModuleProvider.mm; sourceTree = ""; }; 5CB07C9A226467E60039471C /* RNTesterTurboModuleProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNTesterTurboModuleProvider.h; path = RNTester/RNTesterTurboModuleProvider.h; sourceTree = ""; }; 68E1E4BB2230DF2F00570185 /* ComponentRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ComponentRegistry.cpp; sourceTree = ""; }; - 6A55F88CAB1906507EDD1D79 /* Pods-RNTester-macOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSTests/Pods-RNTester-macOSTests.release.xcconfig"; sourceTree = ""; }; + 72247071A1BF06D54F0FECC7 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7D51F73F0DA20287418D98BD /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = ""; }; 7E39630912E65B1C853EA5C8 /* libPods-RNTester-macOSUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester-macOSUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 7F200C0DF2E2C1B204C6FB34 /* Pods-RNTester-macOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSTests/Pods-RNTester-macOSTests.debug.xcconfig"; sourceTree = ""; }; - 8508AD3C1DC3509924E63948 /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 8210317F3CE28B1945488740 /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 972A459EE6CF8CC63531A088 /* Pods-RNTesterIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.debug.xcconfig"; sourceTree = ""; }; 98233960D1D6A1977D1C7EAF /* Pods-RNTester.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester/Pods-RNTester.debug.xcconfig"; sourceTree = ""; }; 9AED879F1A9397646A861A9F /* Pods-RNTester-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS.release.xcconfig"; sourceTree = ""; }; 9EAC9B16F3BA65B8E1511E5E /* Pods-RNTester-macOSUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester-macOSUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests.release.xcconfig"; sourceTree = ""; }; @@ -272,10 +226,80 @@ 9F153478233AB2C7006DFE44 /* RNTester-macOSIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNTester-macOSIntegrationTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 9F15347C233AB2C7006DFE44 /* RNTesterIntegrationTests_macOS.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests_macOS.m; sourceTree = ""; }; 9F15347E233AB2C7006DFE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - BC303BFA161D25E2F036356A /* Pods-RNTesterUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.release.xcconfig"; sourceTree = ""; }; - D189458AC7EF7C7E25C6A79F /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - EF203F288E86F13DB63D5348 /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = ""; }; - F94ACFCA0BC1A9B7B93A26C0 /* Pods-RNTesterUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.debug.xcconfig"; sourceTree = ""; }; + E68A0B7D2448B4F300228B0B /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E771AEEA22B44E3100EA1189 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = ""; }; + E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = ""; }; + E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20A322B2BA84005AC45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = ""; }; + E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitNotificationRaceTests.m; sourceTree = ""; }; + E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBlobManagerTests.m; sourceTree = ""; }; + E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLoggerTests.m; sourceTree = ""; }; + E7DB20AE22B2BAA4005AC45F /* RCTImageLoaderHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoaderHelpers.h; sourceTree = ""; }; + E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = ""; }; + E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitTests.m; sourceTree = ""; }; + E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = ""; }; + E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtilsTests.m; sourceTree = ""; }; + E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RNTesterUnitTestsBundle.js; sourceTree = ""; }; + E7DB20BE22B2BAA4005AC45F /* RCTNativeAnimatedNodesManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedNodesManagerTests.m; sourceTree = ""; }; + E7DB20BF22B2BAA4005AC45F /* RCTUIManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerTests.m; sourceTree = ""; }; + E7DB20C022B2BAA4005AC45F /* RCTEventDispatcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventDispatcherTests.m; sourceTree = ""; }; + E7DB20C122B2BAA4005AC45F /* RCTUnicodeDecodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUnicodeDecodeTests.m; sourceTree = ""; }; + E7DB20C222B2BAA4005AC45F /* RCTImageLoaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderTests.m; sourceTree = ""; }; + E7DB20C322B2BAA4005AC45F /* RCTMethodArgumentTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMethodArgumentTests.m; sourceTree = ""; }; + E7DB20C422B2BAA4005AC45F /* RCTShadowViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowViewTests.m; sourceTree = ""; }; + E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGzipTests.m; sourceTree = ""; }; + E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAllocationTests.m; sourceTree = ""; }; + E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFormatErrorTests.m; sourceTree = ""; }; + E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenuTests.m; sourceTree = ""; }; + E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderHelpers.m; sourceTree = ""; }; + E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSURLTests.m; sourceTree = ""; }; + E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethodTests.mm; sourceTree = ""; }; + E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentPropsTests.m; sourceTree = ""; }; + E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtilTests.m; sourceTree = ""; }; + E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_YGValueTests.m; sourceTree = ""; }; + E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReaderTests.m; sourceTree = ""; }; + E7DB20D022B2BAA5005AC45F /* RCTURLUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTURLUtilsTests.m; sourceTree = ""; }; + E7DB20F022B2BD53005AC45F /* libDoubleConversion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libDoubleConversion.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20F222B2BD53005AC45F /* libFolly.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFolly.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20F422B2BD53005AC45F /* libglog.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libglog.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20F822B2BD53005AC45F /* libReact-ART.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-ART.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20FA22B2BD53005AC45F /* libReact-Core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-Core.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB20FC22B2BD53005AC45F /* libReact-cxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-cxxreact.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210222B2BD53005AC45F /* libReact-jsi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-jsi.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210422B2BD53005AC45F /* libReact-jsiexecutor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-jsiexecutor.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210622B2BD53005AC45F /* libReact-jsinspector.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-jsinspector.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210822B2BD53005AC45F /* libReact-RCTActionSheet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTActionSheet.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210A22B2BD53005AC45F /* libReact-RCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTAnimation.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210C22B2BD53005AC45F /* libReact-RCTBlob.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTBlob.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB210E22B2BD53005AC45F /* libReact-RCTImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTImage.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211022B2BD53005AC45F /* libReact-RCTLinking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTLinking.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211222B2BD53005AC45F /* libReact-RCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTNetwork.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211422B2BD53005AC45F /* libReact-RCTPushNotification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTPushNotification.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211622B2BD53005AC45F /* libReact-RCTSettings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTSettings.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211822B2BD53005AC45F /* libReact-RCTText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTText.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTVibration.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB212222B2BD53005AC45F /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB212622B2C342005AC45F /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = ""; }; + E7DB212722B2C342005AC45F /* OCMMacroState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMMacroState.h; sourceTree = ""; }; + E7DB212822B2C342005AC45F /* OCMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMock.h; sourceTree = ""; }; + E7DB212922B2C342005AC45F /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; + E7DB212A22B2C342005AC45F /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = ""; }; + E7DB212B22B2C342005AC45F /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = ""; }; + E7DB212C22B2C342005AC45F /* OCMLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMLocation.h; sourceTree = ""; }; + E7DB212D22B2C342005AC45F /* OCMConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMConstraint.h; sourceTree = ""; }; + E7DB212E22B2C342005AC45F /* OCMArg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMArg.h; sourceTree = ""; }; + E7DB213022B2C649005AC45F /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E7DB215722B2F332005AC45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterTestModule.m; sourceTree = ""; }; + E7DB215E22B2F3EC005AC45F /* RCTLoggingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLoggingTests.m; sourceTree = ""; }; + E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = ""; }; + E7DB216022B2F3EC005AC45F /* RNTesterSnapshotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterSnapshotTests.m; sourceTree = ""; }; + E7DB216122B2F3EC005AC45F /* RCTRootViewIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootViewIntegrationTests.m; sourceTree = ""; }; + E7DB218B22B41FCD005AC45F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + E9618482EC8608D4872A6E28 /* Pods-RNTesterUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.release.xcconfig"; sourceTree = ""; }; + F94084777080D7B374FB4783 /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -283,39 +307,31 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B9C5BB1881F54450DBCA70F5 /* libPods-RNTester.a in Frameworks */, + 413F654822EE16AED0DF2540 /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 38A937F8244531670025DABB /* Frameworks */ = { + 387847CE245631D80035033A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 388291A32445522200D89845 /* JavaScriptCore.framework in Frameworks */, - 38A9383C244532470025DABB /* libOCMock.a in Frameworks */, - AED7599CAA60E74DF4523090 /* libPods-RNTesterUnitTests.a in Frameworks */, + 38784804245633870035033A /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 38E0B2B324456B0700EF053A /* Frameworks */ = { + 387847DB245631F50035033A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1551B774FBA023F7BC207D4C /* libPods-RNTesterIntegrationTests.a in Frameworks */, + 38784806245633A90035033A /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3D13F83B1D6F6AE000E69E0E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5101985F23ADA0FC00118BF1 /* Frameworks */ = { + 387847E92456320C0035033A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 38784808245633B70035033A /* libPods-RNTester-macOS.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -331,7 +347,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38BB7CFF244564DB00803CDE /* JavaScriptCore.framework in Frameworks */, 38BB7CD524455EDD00803CDE /* OCMock.framework in Frameworks */, 10F9D0AD3F8E4C0DD7187464 /* libPods-RNTester-macOSUnitTests.a in Frameworks */, ); @@ -345,6 +360,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E7DB209C22B2BA84005AC45F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 383838C0244BC3BD005FAC75 /* libPods-RNTesterUnitTests.a in Frameworks */, + 383838C1244BC3D9005FAC75 /* JavaScriptCore.framework in Frameworks */, + 38A9383C244532470025DABB /* libOCMock.a in Frameworks */, + E59A0FBD0170A092274A6207 /* libPods-RNTesterUnitTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E7DB215022B2F332005AC45F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */, + E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */, + 8BBFF9F061783A02D50DD2EC /* libPods-RNTesterIntegrationTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -360,6 +396,8 @@ 13B07FAE1A68108700A75B9A /* RNTester */ = { isa = PBXGroup; children = ( + 38360C8B244E7D8B007B212D /* RNTester.entitlements */, + E771AEEA22B44E3100EA1189 /* Info.plist */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 5C60EB1B226440DB0018C04F /* AppDelegate.mm */, 5CB07C9A226467E60039471C /* RNTesterTurboModuleProvider.h */, @@ -388,92 +426,43 @@ 2DE7E7D81FB2A4F3009E225D /* Frameworks */ = { isa = PBXGroup; children = ( + 38784807245633B70035033A /* libPods-RNTester-macOS.a */, + 38784805245633A90035033A /* libPods-RNTester.a */, + 38784803245633870035033A /* libPods-RNTester.a */, 38BB7CB524455C4100803CDE /* libPods-RNTester-macOSTests.a */, - 388291A22445522200D89845 /* JavaScriptCore.framework */, - 8508AD3C1DC3509924E63948 /* libPods-RNTester.a */, + E7DB218B22B41FCD005AC45F /* XCTest.framework */, + E7DB213022B2C649005AC45F /* JavaScriptCore.framework */, + E7DB20F022B2BD53005AC45F /* libDoubleConversion.a */, + E7DB20F222B2BD53005AC45F /* libFolly.a */, + E7DB20F422B2BD53005AC45F /* libglog.a */, + E7DB20F822B2BD53005AC45F /* libReact-ART.a */, + E7DB20FA22B2BD53005AC45F /* libReact-Core.a */, + E7DB20FC22B2BD53005AC45F /* libReact-cxxreact.a */, + E7DB210222B2BD53005AC45F /* libReact-jsi.a */, + E7DB210422B2BD53005AC45F /* libReact-jsiexecutor.a */, + E7DB210622B2BD53005AC45F /* libReact-jsinspector.a */, + E7DB210822B2BD53005AC45F /* libReact-RCTActionSheet.a */, + E7DB210A22B2BD53005AC45F /* libReact-RCTAnimation.a */, + E7DB210C22B2BD53005AC45F /* libReact-RCTBlob.a */, + E7DB210E22B2BD53005AC45F /* libReact-RCTImage.a */, + E7DB211022B2BD53005AC45F /* libReact-RCTLinking.a */, + E7DB211222B2BD53005AC45F /* libReact-RCTNetwork.a */, + E7DB211422B2BD53005AC45F /* libReact-RCTPushNotification.a */, + E7DB211622B2BD53005AC45F /* libReact-RCTSettings.a */, + E7DB211822B2BD53005AC45F /* libReact-RCTText.a */, + E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */, + E7DB212222B2BD53005AC45F /* libyoga.a */, + F94084777080D7B374FB4783 /* libPods-RNTester.a */, 0A355204268D03CF69ABC11D /* libPods-RNTester-macOS.a */, - 0628D8AFAF46D4219B398D8D /* libPods-RNTesterUnitTests.a */, + 8210317F3CE28B1945488740 /* libPods-RNTesterIntegrationTests.a */, + 72247071A1BF06D54F0FECC7 /* libPods-RNTesterUnitTests.a */, 7E39630912E65B1C853EA5C8 /* libPods-RNTester-macOSUnitTests.a */, - D189458AC7EF7C7E25C6A79F /* libPods-RNTesterIntegrationTests.a */, 1B8A3294D74D7AC1BE88DC4E /* libPods-RNTester-macOSIntegrationTests.a */, + 383838BF244BC3AE005FAC75 /* libPods-RNTesterUnitTests.a */, ); name = Frameworks; sourceTree = ""; }; - 38A937FC244531670025DABB /* RNTesterUnitTests */ = { - isa = PBXGroup; - children = ( - 38A9381A244532460025DABB /* OCMock */, - 38A9381B244532460025DABB /* libOCMock.a */, - 38A93816244532460025DABB /* OCMock.framework */, - 38A9380E244532460025DABB /* RNTesterUnitTestsBundle.js */, - 38A93821244532470025DABB /* RCTAllocationTests.m */, - 38A9381F244532470025DABB /* RCTAnimationUtilsTests.m */, - 38A93810244532460025DABB /* RCTBlobManagerTests.m */, - 38A93819244532460025DABB /* RCTBundleURLProviderTests.m */, - 38A9380A244532460025DABB /* RCTComponentPropsTests.m */, - 38A93820244532470025DABB /* RCTConvert_NSColorTests.m */, - 38A9380C244532460025DABB /* RCTConvert_NSURLTests.m */, - 38A9380F244532460025DABB /* RCTConvert_UIColorTests.m */, - 38A93824244532470025DABB /* RCTConvert_YGValueTests.m */, - 38A93807244532460025DABB /* RCTDevMenuTests.m */, - 38A93817244532460025DABB /* RCTEventDispatcherTests.m */, - 38A9380B244532460025DABB /* RCTFontTests.m */, - 38A93813244532460025DABB /* RCTFormatErrorTests.m */, - 38A9381C244532470025DABB /* RCTGzipTests.m */, - 38A93815244532460025DABB /* RCTImageLoaderHelpers.m */, - 38A93814244532460025DABB /* RCTImageLoaderTests.m */, - 38A93812244532460025DABB /* RCTImageUtilTests.m */, - 38A9381D244532470025DABB /* RCTJSONTests.m */, - 38A93825244532470025DABB /* RCTMethodArgumentTests.m */, - 38A93805244532460025DABB /* RCTModuleInitNotificationRaceTests.m */, - 38A9381E244532470025DABB /* RCTModuleInitTests.m */, - 38A93808244532460025DABB /* RCTMultipartStreamReaderTests.m */, - 38A93826244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m */, - 38A93822244532470025DABB /* RCTPerformanceLoggerTests.m */, - 38A93809244532460025DABB /* RCTShadowViewTests.m */, - 38A93823244532470025DABB /* RCTUIManagerTests.m */, - 38A93818244532460025DABB /* RCTUnicodeDecodeTests.m */, - 38A9380D244532460025DABB /* RCTURLUtilsTests.m */, - 38A93806244532460025DABB /* RCTModuleMethodTests.mm */, - 38A937FF244531670025DABB /* Info.plist */, - ); - path = RNTesterUnitTests; - sourceTree = ""; - }; - 38E0B2B724456B0700EF053A /* RNTesterIntegrationTests */ = { - isa = PBXGroup; - children = ( - 38E9442424456C9F004A39E0 /* RCTLoggingTests.m */, - 38E9442224456C9F004A39E0 /* RCTRootViewIntegrationTests.m */, - 38E9442524456C9F004A39E0 /* RCTUIManagerScenarioTests.m */, - 38E9442124456C9F004A39E0 /* RNTesterSnapshotTests.m */, - 38E9442324456C9F004A39E0 /* RNTesterTestModule.m */, - 38E0B2B824456B0700EF053A /* RNTesterIntegrationTests.m */, - 38E0B2BA24456B0700EF053A /* Info.plist */, - ); - path = RNTesterIntegrationTests; - sourceTree = ""; - }; - 3D13F83F1D6F6AE000E69E0E /* RNTesterBundle */ = { - isa = PBXGroup; - children = ( - 3D13F8401D6F6AE000E69E0E /* Info.plist */, - 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */, - 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */, - ); - name = RNTesterBundle; - path = RNTester/RNTesterBundle; - sourceTree = ""; - }; - 5101986323ADA0FC00118BF1 /* RNTesterBundle-macOS */ = { - isa = PBXGroup; - children = ( - 5101986423ADA0FC00118BF1 /* Info.plist */, - ); - path = "RNTesterBundle-macOS"; - sourceTree = ""; - }; 571A4A20844C3BA40A3D302B /* Pods */ = { isa = PBXGroup; children = ( @@ -481,14 +470,12 @@ 5BEC8567F3741044B6A5EFC5 /* Pods-RNTester.release.xcconfig */, 2BE07A0C310D8A03C00D6F07 /* Pods-RNTester-macOS.debug.xcconfig */, 9AED879F1A9397646A861A9F /* Pods-RNTester-macOS.release.xcconfig */, - F94ACFCA0BC1A9B7B93A26C0 /* Pods-RNTesterUnitTests.debug.xcconfig */, - BC303BFA161D25E2F036356A /* Pods-RNTesterUnitTests.release.xcconfig */, - 7F200C0DF2E2C1B204C6FB34 /* Pods-RNTester-macOSTests.debug.xcconfig */, - 6A55F88CAB1906507EDD1D79 /* Pods-RNTester-macOSTests.release.xcconfig */, + 972A459EE6CF8CC63531A088 /* Pods-RNTesterIntegrationTests.debug.xcconfig */, + 7D51F73F0DA20287418D98BD /* Pods-RNTesterIntegrationTests.release.xcconfig */, + 34028D6B10F47E490042EB27 /* Pods-RNTesterUnitTests.debug.xcconfig */, + E9618482EC8608D4872A6E28 /* Pods-RNTesterUnitTests.release.xcconfig */, 406E6935B300A29BA57EE1B0 /* Pods-RNTester-macOSUnitTests.debug.xcconfig */, 9EAC9B16F3BA65B8E1511E5E /* Pods-RNTester-macOSUnitTests.release.xcconfig */, - 5641CFF8E3CFBC3C4B0EDEEF /* Pods-RNTesterIntegrationTests.debug.xcconfig */, - EF203F288E86F13DB63D5348 /* Pods-RNTesterIntegrationTests.release.xcconfig */, 3CCA44B8467CB06ACED8E0E9 /* Pods-RNTester-macOSIntegrationTests.debug.xcconfig */, 0BFED72B21FBD987A97E30B9 /* Pods-RNTester-macOSIntegrationTests.release.xcconfig */, ); @@ -507,13 +494,11 @@ isa = PBXGroup; children = ( 13B07FAE1A68108700A75B9A /* RNTester */, - 38A937FC244531670025DABB /* RNTesterUnitTests */, - 38E0B2B724456B0700EF053A /* RNTesterIntegrationTests */, - 3D13F83F1D6F6AE000E69E0E /* RNTesterBundle */, + E7DB20A022B2BA84005AC45F /* RNTesterUnitTests */, + E7DB215422B2F332005AC45F /* RNTesterIntegrationTests */, 9F15345C233AB2C4006DFE44 /* RNTester-macOS */, 9F153470233AB2C7006DFE44 /* RNTester-macOSUnitTests */, 9F15347B233AB2C7006DFE44 /* RNTester-macOSIntegrationTests */, - 5101986323ADA0FC00118BF1 /* RNTesterBundle-macOS */, 83CBBA001A601CBA00E9B192 /* Products */, 2DE7E7D81FB2A4F3009E225D /* Frameworks */, 571A4A20844C3BA40A3D302B /* Pods */, @@ -527,13 +512,15 @@ isa = PBXGroup; children = ( 13B07F961A680F5B00A75B9A /* RNTester.app */, - 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */, 9F15345B233AB2C4006DFE44 /* RNTester-macOS.app */, + E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */, + E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */, 9F15346D233AB2C7006DFE44 /* RNTester-macOSUnitTests.xctest */, 9F153478233AB2C7006DFE44 /* RNTester-macOSIntegrationTests.xctest */, - 5101986223ADA0FC00118BF1 /* RNTesterBundle-macOS.bundle */, - 38A937FB244531670025DABB /* RNTesterUnitTests.xctest */, - 38E0B2B624456B0700EF053A /* RNTesterIntegrationTests.xctest */, + E68A0B7D2448B4F300228B0B /* RNTesterUnitTests.xctest */, + 387847D1245631D80035033A /* libiosDeviceBuild.a */, + 387847DE245631F50035033A /* libiosSimulatorBuild.a */, + 387847EB2456320C0035033A /* libmacOSBuild.a */, ); name = Products; sourceTree = ""; @@ -572,8 +559,88 @@ path = "RNTester-macOSIntegrationTests"; sourceTree = ""; }; + E7DB20A022B2BA84005AC45F /* RNTesterUnitTests */ = { + isa = PBXGroup; + children = ( + E7DB20A322B2BA84005AC45F /* Info.plist */, + E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */, + E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */, + E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */, + E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */, + E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */, + E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */, + E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */, + E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */, + E7DB20C022B2BAA4005AC45F /* RCTEventDispatcherTests.m */, + E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */, + E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */, + E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */, + E7DB20AE22B2BAA4005AC45F /* RCTImageLoaderHelpers.h */, + E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */, + E7DB20C222B2BAA4005AC45F /* RCTImageLoaderTests.m */, + E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */, + E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */, + E7DB20C322B2BAA4005AC45F /* RCTMethodArgumentTests.m */, + E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */, + E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */, + E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */, + E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */, + E7DB20BE22B2BAA4005AC45F /* RCTNativeAnimatedNodesManagerTests.m */, + E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */, + E7DB20C422B2BAA4005AC45F /* RCTShadowViewTests.m */, + E7DB20BF22B2BAA4005AC45F /* RCTUIManagerTests.m */, + E7DB20C122B2BAA4005AC45F /* RCTUnicodeDecodeTests.m */, + E7DB20D022B2BAA5005AC45F /* RCTURLUtilsTests.m */, + 38A9381B244532460025DABB /* libOCMock.a */, + 38A93816244532460025DABB /* OCMock.framework */, + E7DB212522B2C342005AC45F /* OCMock */, + E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */, + ); + path = RNTesterUnitTests; + sourceTree = ""; + }; + E7DB212522B2C342005AC45F /* OCMock */ = { + isa = PBXGroup; + children = ( + E7DB212622B2C342005AC45F /* OCMockObject.h */, + E7DB212722B2C342005AC45F /* OCMMacroState.h */, + E7DB212822B2C342005AC45F /* OCMock.h */, + E7DB212922B2C342005AC45F /* NSNotificationCenter+OCMAdditions.h */, + E7DB212A22B2C342005AC45F /* OCMStubRecorder.h */, + E7DB212B22B2C342005AC45F /* OCMRecorder.h */, + E7DB212C22B2C342005AC45F /* OCMLocation.h */, + E7DB212D22B2C342005AC45F /* OCMConstraint.h */, + E7DB212E22B2C342005AC45F /* OCMArg.h */, + ); + path = OCMock; + sourceTree = ""; + }; + E7DB215422B2F332005AC45F /* RNTesterIntegrationTests */ = { + isa = PBXGroup; + children = ( + E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */, + E7DB215E22B2F3EC005AC45F /* RCTLoggingTests.m */, + E7DB216122B2F3EC005AC45F /* RCTRootViewIntegrationTests.m */, + E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */, + E7DB216022B2F3EC005AC45F /* RNTesterSnapshotTests.m */, + E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */, + E7DB215722B2F332005AC45F /* Info.plist */, + ); + path = RNTesterIntegrationTests; + sourceTree = ""; + }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 387847E72456320C0035033A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 13B07F861A680F5B00A75B9A /* RNTester */ = { isa = PBXNativeTarget; @@ -589,84 +656,62 @@ buildRules = ( ); dependencies = ( - 3D13F84C1D6F6B5F00E69E0E /* PBXTargetDependency */, ); name = RNTester; productName = "Hello World"; productReference = 13B07F961A680F5B00A75B9A /* RNTester.app */; productType = "com.apple.product-type.application"; }; - 38A937FA244531670025DABB /* RNTesterUnitTests */ = { + 387847D0245631D80035033A /* iosDeviceBuild */ = { isa = PBXNativeTarget; - buildConfigurationList = 38A93804244531670025DABB /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */; + buildConfigurationList = 387847D7245631D80035033A /* Build configuration list for PBXNativeTarget "iosDeviceBuild" */; buildPhases = ( - 028389B42A4C8A10132535AA /* [CP] Check Pods Manifest.lock */, - 38A937F7244531670025DABB /* Sources */, - 38A937F8244531670025DABB /* Frameworks */, - 38A937F9244531670025DABB /* Resources */, + 387847CD245631D80035033A /* Sources */, + 387847CE245631D80035033A /* Frameworks */, + 387847CF245631D80035033A /* CopyFiles */, ); buildRules = ( ); dependencies = ( - 38A93801244531670025DABB /* PBXTargetDependency */, ); - name = RNTesterUnitTests; - productName = RNTesterUnitTests; - productReference = 38A937FB244531670025DABB /* RNTesterUnitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; + name = iosDeviceBuild; + productName = iosDeviceBuild; + productReference = 387847D1245631D80035033A /* libiosDeviceBuild.a */; + productType = "com.apple.product-type.library.static"; }; - 38E0B2B524456B0700EF053A /* RNTesterIntegrationTests */ = { + 387847DD245631F50035033A /* iosSimulatorBuild */ = { isa = PBXNativeTarget; - buildConfigurationList = 38E0B2BF24456B0700EF053A /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */; + buildConfigurationList = 387847E4245631F50035033A /* Build configuration list for PBXNativeTarget "iosSimulatorBuild" */; buildPhases = ( - CFB100ED5A9EF047900A5A86 /* [CP] Check Pods Manifest.lock */, - 38E0B2B224456B0700EF053A /* Sources */, - 38E0B2B324456B0700EF053A /* Frameworks */, - 38E0B2B424456B0700EF053A /* Resources */, + 387847DA245631F50035033A /* Sources */, + 387847DB245631F50035033A /* Frameworks */, + 387847DC245631F50035033A /* CopyFiles */, ); buildRules = ( ); dependencies = ( - 38E0B2BC24456B0700EF053A /* PBXTargetDependency */, ); - name = RNTesterIntegrationTests; - productName = RNTesterIntegrationTests; - productReference = 38E0B2B624456B0700EF053A /* RNTesterIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; - 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D13F8411D6F6AE000E69E0E /* Build configuration list for PBXNativeTarget "RNTesterBundle" */; - buildPhases = ( - 3D13F83A1D6F6AE000E69E0E /* Sources */, - 3D13F83B1D6F6AE000E69E0E /* Frameworks */, - 3D13F83C1D6F6AE000E69E0E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RNTesterBundle; - productName = RNTesterBundle; - productReference = 3D13F83E1D6F6AE000E69E0E /* RNTesterBundle.bundle */; - productType = "com.apple.product-type.bundle"; + name = iosSimulatorBuild; + productName = iosSimulatorBuild; + productReference = 387847DE245631F50035033A /* libiosSimulatorBuild.a */; + productType = "com.apple.product-type.library.static"; }; - 5101986123ADA0FC00118BF1 /* RNTesterBundle-macOS */ = { + 387847EA2456320C0035033A /* macOSBuild */ = { isa = PBXNativeTarget; - buildConfigurationList = 5101986523ADA0FC00118BF1 /* Build configuration list for PBXNativeTarget "RNTesterBundle-macOS" */; + buildConfigurationList = 387847F12456320C0035033A /* Build configuration list for PBXNativeTarget "macOSBuild" */; buildPhases = ( - 5101985E23ADA0FC00118BF1 /* Sources */, - 5101985F23ADA0FC00118BF1 /* Frameworks */, - 5101986023ADA0FC00118BF1 /* Resources */, + 387847E72456320C0035033A /* Headers */, + 387847E82456320C0035033A /* Sources */, + 387847E92456320C0035033A /* Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = "RNTesterBundle-macOS"; - productName = "RNTesterBundle-macOS"; - productReference = 5101986223ADA0FC00118BF1 /* RNTesterBundle-macOS.bundle */; - productType = "com.apple.product-type.bundle"; + name = macOSBuild; + productName = macOSBuild; + productReference = 387847EB2456320C0035033A /* libmacOSBuild.a */; + productType = "com.apple.product-type.library.static"; }; 9F15345A233AB2C4006DFE44 /* RNTester-macOS */ = { isa = PBXNativeTarget; @@ -676,12 +721,12 @@ 9F153457233AB2C4006DFE44 /* Sources */, 9F153458233AB2C4006DFE44 /* Frameworks */, 9F153459233AB2C4006DFE44 /* Resources */, + 38C8132424577FB500BFFA62 /* Build JS Bundle */, 51B9D81723C4D5A4002B30E1 /* Start Metro */, ); buildRules = ( ); dependencies = ( - 5101986C23ADA17000118BF1 /* PBXTargetDependency */, ); name = "RNTester-macOS"; productName = "RNTester-macOS"; @@ -727,6 +772,43 @@ productReference = 9F153478233AB2C7006DFE44 /* RNTester-macOSIntegrationTests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; + E7DB209E22B2BA84005AC45F /* RNTesterUnitTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E7DB20A622B2BA84005AC45F /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */; + buildPhases = ( + 64C8C8D2305EEDFDE304A0E6 /* [CP] Check Pods Manifest.lock */, + E7DB209B22B2BA84005AC45F /* Sources */, + E7DB209C22B2BA84005AC45F /* Frameworks */, + E7DB209D22B2BA84005AC45F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RNTesterUnitTests; + productName = RNTesterUnitTests; + productReference = E68A0B7D2448B4F300228B0B /* RNTesterUnitTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + E7DB215222B2F332005AC45F /* RNTesterIntegrationTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E7DB215A22B2F332005AC45F /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */; + buildPhases = ( + 56D84768A7BBB2750D674CF3 /* [CP] Check Pods Manifest.lock */, + E7DB214F22B2F332005AC45F /* Sources */, + E7DB215022B2F332005AC45F /* Frameworks */, + E7DB215122B2F332005AC45F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + E7DB215922B2F332005AC45F /* PBXTargetDependency */, + ); + name = RNTesterIntegrationTests; + productName = RNTesterIntegrationTests; + productReference = E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -736,21 +818,14 @@ LastUpgradeCheck = 0940; ORGANIZATIONNAME = Facebook; TargetAttributes = { - 38A937FA244531670025DABB = { - CreatedOnToolsVersion = 11.2.1; - ProvisioningStyle = Automatic; - }; - 38E0B2B524456B0700EF053A = { - CreatedOnToolsVersion = 11.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 13B07F861A680F5B00A75B9A; + 387847D0245631D80035033A = { + CreatedOnToolsVersion = 11.3.1; }; - 3D13F83D1D6F6AE000E69E0E = { - CreatedOnToolsVersion = 7.3.1; + 387847DD245631F50035033A = { + CreatedOnToolsVersion = 11.3.1; }; - 5101986123ADA0FC00118BF1 = { - CreatedOnToolsVersion = 11.2.1; - ProvisioningStyle = Automatic; + 387847EA2456320C0035033A = { + CreatedOnToolsVersion = 11.3.1; }; 9F15345A233AB2C4006DFE44 = { CreatedOnToolsVersion = 11.0; @@ -758,19 +833,25 @@ }; 9F15346C233AB2C7006DFE44 = { CreatedOnToolsVersion = 11.0; - DevelopmentTeam = UBF8T346G9; ProvisioningStyle = Automatic; }; 9F153477233AB2C7006DFE44 = { CreatedOnToolsVersion = 11.0; - DevelopmentTeam = UBF8T346G9; ProvisioningStyle = Automatic; TestTargetID = 9F15345A233AB2C4006DFE44; }; + E7DB209E22B2BA84005AC45F = { + CreatedOnToolsVersion = 10.2.1; + }; + E7DB215222B2F332005AC45F = { + CreatedOnToolsVersion = 10.2.1; + ProvisioningStyle = Automatic; + TestTargetID = 13B07F861A680F5B00A75B9A; + }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTesterPods" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -784,13 +865,14 @@ projectRoot = ""; targets = ( 13B07F861A680F5B00A75B9A /* RNTester */, - 38A937FA244531670025DABB /* RNTesterUnitTests */, - 38E0B2B524456B0700EF053A /* RNTesterIntegrationTests */, - 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */, + E7DB209E22B2BA84005AC45F /* RNTesterUnitTests */, + E7DB215222B2F332005AC45F /* RNTesterIntegrationTests */, 9F15345A233AB2C4006DFE44 /* RNTester-macOS */, 9F15346C233AB2C7006DFE44 /* RNTester-macOSUnitTests */, 9F153477233AB2C7006DFE44 /* RNTester-macOSIntegrationTests */, - 5101986123ADA0FC00118BF1 /* RNTesterBundle-macOS */, + 387847D0245631D80035033A /* iosDeviceBuild */, + 387847DD245631F50035033A /* iosSimulatorBuild */, + 387847EA2456320C0035033A /* macOSBuild */, ); }; /* End PBXProject section */ @@ -800,66 +882,46 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3D56F9F11D6F6E9B00F53A06 /* RNTesterBundle.bundle in Resources */, 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */, 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */, 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 38A937F9244531670025DABB /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 38A93830244532470025DABB /* RNTesterUnitTestsBundle.js in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 38E0B2B424456B0700EF053A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D13F83C1D6F6AE000E69E0E /* Resources */ = { + 9F153459233AB2C4006DFE44 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3D13F8481D6F6AF900E69E0E /* ImageInBundle.png in Resources */, - 3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */, + 5101985B23ADA00B00118BF1 /* legacy_image@2x.png in Resources */, + 9F153461233AB2C7006DFE44 /* Assets.xcassets in Resources */, + 5101985723AD9EE600118BF1 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 5101986023ADA0FC00118BF1 /* Resources */ = { + 9F15346B233AB2C7006DFE44 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5101986823ADA13C00118BF1 /* ImageInBundle.png in Resources */, - 5101986923ADA13C00118BF1 /* OtherImages.xcassets in Resources */, + 3811324724550A8F009E988D /* RNTesterUnitTestsBundle.js in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9F153459233AB2C4006DFE44 /* Resources */ = { + 9F153476233AB2C7006DFE44 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5101986A23ADA15700118BF1 /* RNTesterBundle-macOS.bundle in Resources */, - 5101985B23ADA00B00118BF1 /* legacy_image@2x.png in Resources */, - 9F153461233AB2C7006DFE44 /* Assets.xcassets in Resources */, - 5101985723AD9EE600118BF1 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9F15346B233AB2C7006DFE44 /* Resources */ = { + E7DB209D22B2BA84005AC45F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 38BB7CFC24455F4300803CDE /* RNTesterUnitTestsBundle.js in Resources */, + E7DB20DA22B2BAA6005AC45F /* RNTesterUnitTestsBundle.js in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9F153476233AB2C7006DFE44 /* Resources */ = { + E7DB215122B2F332005AC45F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -869,7 +931,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 028389B42A4C8A10132535AA /* [CP] Check Pods Manifest.lock */ = { + 0DDB94B4378380EBD190814A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -884,14 +946,14 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTesterUnitTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RNTester-macOSUnitTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 0DDB94B4378380EBD190814A /* [CP] Check Pods Manifest.lock */ = { + 26ED73F8C59C75926FA607C9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -906,14 +968,14 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTester-macOSUnitTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RNTester-macOS-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 26ED73F8C59C75926FA607C9 /* [CP] Check Pods Manifest.lock */ = { + 38C8132424577FB500BFFA62 /* Build JS Bundle */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -921,19 +983,15 @@ inputFileListPaths = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Check Pods Manifest.lock"; + name = "Build JS Bundle"; outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTester-macOS-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; + shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.macos.js\n"; }; 51B9D81723C4D5A4002B30E1 /* Start Metro */ = { isa = PBXShellScriptBuildPhase; @@ -954,7 +1012,7 @@ shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; - 599A88804E613F1AA7525CB9 /* [CP] Check Pods Manifest.lock */ = { + 56D84768A7BBB2750D674CF3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -969,43 +1027,51 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTester-macOSIntegrationTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RNTesterIntegrationTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 5CF0FD27207FC6EC00C13D65 /* Start Metro */ = { + 599A88804E613F1AA7525CB9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "Start Metro"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RNTester-macOSIntegrationTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */ = { + 5CF0FD27207FC6EC00C13D65 /* Start Metro */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Build JS Bundle"; + name = "Start Metro"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js"; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + showEnvVarsInLog = 0; }; - CFB100ED5A9EF047900A5A86 /* [CP] Check Pods Manifest.lock */ = { + 64C8C8D2305EEDFDE304A0E6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -1020,13 +1086,27 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTesterIntegrationTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RNTesterUnitTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Build JS Bundle"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; + }; F9CB97B0D9633939D43E75E0 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1061,62 +1141,21 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 38A937F7244531670025DABB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 38A93835244532470025DABB /* RCTImageLoaderTests.m in Sources */, - 38A93844244532470025DABB /* RCTUIManagerTests.m in Sources */, - 38A93843244532470025DABB /* RCTPerformanceLoggerTests.m in Sources */, - 38A93829244532470025DABB /* RCTDevMenuTests.m in Sources */, - 38A93831244532470025DABB /* RCTConvert_UIColorTests.m in Sources */, - 38A9383D244532470025DABB /* RCTGzipTests.m in Sources */, - 38A93832244532470025DABB /* RCTBlobManagerTests.m in Sources */, - 38A93846244532470025DABB /* RCTMethodArgumentTests.m in Sources */, - 38A93836244532470025DABB /* RCTImageLoaderHelpers.m in Sources */, - 38A93834244532470025DABB /* RCTFormatErrorTests.m in Sources */, - 38A9383E244532470025DABB /* RCTJSONTests.m in Sources */, - 38A9382F244532470025DABB /* RCTURLUtilsTests.m in Sources */, - 38A93845244532470025DABB /* RCTConvert_YGValueTests.m in Sources */, - 38A93842244532470025DABB /* RCTAllocationTests.m in Sources */, - 38A93828244532470025DABB /* RCTModuleMethodTests.mm in Sources */, - 38A9382E244532470025DABB /* RCTConvert_NSURLTests.m in Sources */, - 38A93838244532470025DABB /* RCTEventDispatcherTests.m in Sources */, - 38A93847244532470025DABB /* RCTNativeAnimatedNodesManagerTests.m in Sources */, - 38A93839244532470025DABB /* RCTUnicodeDecodeTests.m in Sources */, - 38A93827244532470025DABB /* RCTModuleInitNotificationRaceTests.m in Sources */, - 38A9382B244532470025DABB /* RCTShadowViewTests.m in Sources */, - 38A9382C244532470025DABB /* RCTComponentPropsTests.m in Sources */, - 38A93840244532470025DABB /* RCTAnimationUtilsTests.m in Sources */, - 38A9382A244532470025DABB /* RCTMultipartStreamReaderTests.m in Sources */, - 38A9382D244532470025DABB /* RCTFontTests.m in Sources */, - 38A9383A244532470025DABB /* RCTBundleURLProviderTests.m in Sources */, - 38A93833244532470025DABB /* RCTImageUtilTests.m in Sources */, - 38A9383F244532470025DABB /* RCTModuleInitTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 38E0B2B224456B0700EF053A /* Sources */ = { + 387847CD245631D80035033A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 38E9442824456C9F004A39E0 /* RNTesterTestModule.m in Sources */, - 38E0B2B924456B0700EF053A /* RNTesterIntegrationTests.m in Sources */, - 38E9442A24456C9F004A39E0 /* RCTUIManagerScenarioTests.m in Sources */, - 38E9442924456C9F004A39E0 /* RCTLoggingTests.m in Sources */, - 38E9442624456C9F004A39E0 /* RNTesterSnapshotTests.m in Sources */, - 38E9442724456C9F004A39E0 /* RCTRootViewIntegrationTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3D13F83A1D6F6AE000E69E0E /* Sources */ = { + 387847DA245631F50035033A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 5101985E23ADA0FC00118BF1 /* Sources */ = { + 387847E82456320C0035033A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -1140,34 +1179,33 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 383838C3244BC52E005FAC75 /* RCTAnimationUtilsTests.m in Sources */, + 383838D9244BC581005FAC75 /* RCTUIManagerTests.m in Sources */, + 383838C9244BC548005FAC75 /* RCTEventDispatcherTests.m in Sources */, + 383838C6244BC53F005FAC75 /* RCTConvert_NSURLTests.m in Sources */, + 383838D8244BC57D005FAC75 /* RCTShadowViewTests.m in Sources */, + 383838CC244BC551005FAC75 /* RCTGzipTests.m in Sources */, + 383838CE244BC55E005FAC75 /* RCTImageLoaderTests.m in Sources */, + 383838C2244BC52B005FAC75 /* RCTAllocationTests.m in Sources */, + 383838D6244BC577005FAC75 /* RCTNativeAnimatedNodesManagerTests.m in Sources */, + 383838DB244BC587005FAC75 /* RCTURLUtilsTests.m in Sources */, + 383838D2244BC56A005FAC75 /* RCTModuleInitNotificationRaceTests.m in Sources */, + 383838D0244BC564005FAC75 /* RCTJSONTests.m in Sources */, + 383838D5244BC574005FAC75 /* RCTMultipartStreamReaderTests.m in Sources */, + 383838D3244BC56E005FAC75 /* RCTModuleInitTests.m in Sources */, + 383838D7244BC57A005FAC75 /* RCTPerformanceLoggerTests.m in Sources */, + 383838CA244BC54B005FAC75 /* RCTFontTests.m in Sources */, + 383838D4244BC570005FAC75 /* RCTModuleMethodTests.mm in Sources */, + 383838C4244BC532005FAC75 /* RCTBlobManagerTests.m in Sources */, + 383838CB244BC54E005FAC75 /* RCTFormatErrorTests.m in Sources */, + 383838DA244BC584005FAC75 /* RCTUnicodeDecodeTests.m in Sources */, 38BB7CFD244560CC00803CDE /* RNTesterUnitTests_macOS.m in Sources */, - 38BB7CB824455EB300803CDE /* RCTAllocationTests.m in Sources */, - 38BB7CB924455EB300803CDE /* RCTAnimationUtilsTests.m in Sources */, - 38BB7CBA24455EB300803CDE /* RCTBlobManagerTests.m in Sources */, - 38BB7CBB24455EB300803CDE /* RCTBundleURLProviderTests.m in Sources */, - 38BB7CBC24455EB300803CDE /* RCTComponentPropsTests.m in Sources */, - 38BB7CBD24455EB300803CDE /* RCTConvert_NSColorTests.m in Sources */, - 38BB7CBE24455EB300803CDE /* RCTConvert_NSURLTests.m in Sources */, - 38BB7CC024455EB300803CDE /* RCTConvert_YGValueTests.m in Sources */, - 38BB7CC224455EB300803CDE /* RCTEventDispatcherTests.m in Sources */, - 38BB7CC324455EB300803CDE /* RCTFontTests.m in Sources */, - 38BB7CC424455EB300803CDE /* RCTFormatErrorTests.m in Sources */, - 38BB7CC524455EB300803CDE /* RCTGzipTests.m in Sources */, - 38BB7CC624455EB300803CDE /* RCTImageLoaderHelpers.m in Sources */, - 38BB7CC724455EB300803CDE /* RCTImageLoaderTests.m in Sources */, - 38BB7CC824455EB300803CDE /* RCTImageUtilTests.m in Sources */, - 38BB7CC924455EB300803CDE /* RCTJSONTests.m in Sources */, - 38BB7CCA24455EB300803CDE /* RCTMethodArgumentTests.m in Sources */, - 38BB7CCB24455EB300803CDE /* RCTModuleInitNotificationRaceTests.m in Sources */, - 38BB7CCC24455EB300803CDE /* RCTModuleInitTests.m in Sources */, - 38BB7CCD24455EB300803CDE /* RCTModuleMethodTests.mm in Sources */, - 38BB7CCE24455EB300803CDE /* RCTMultipartStreamReaderTests.m in Sources */, - 38BB7CCF24455EB300803CDE /* RCTNativeAnimatedNodesManagerTests.m in Sources */, - 38BB7CD024455EB300803CDE /* RCTPerformanceLoggerTests.m in Sources */, - 38BB7CD124455EB300803CDE /* RCTShadowViewTests.m in Sources */, - 38BB7CD224455EB300803CDE /* RCTUIManagerTests.m in Sources */, - 38BB7CD324455EB300803CDE /* RCTUnicodeDecodeTests.m in Sources */, - 38BB7CD424455EB300803CDE /* RCTURLUtilsTests.m in Sources */, + 383838CF244BC561005FAC75 /* RCTImageUtilTests.m in Sources */, + 383838CD244BC55B005FAC75 /* RCTImageLoaderHelpers.m in Sources */, + 383838C7244BC542005FAC75 /* RCTConvert_YGValueTests.m in Sources */, + 383838C5244BC535005FAC75 /* RCTBundleURLProviderTests.m in Sources */, + 383838BD244BC2FF005FAC75 /* RCTComponentPropsTests.m in Sources */, + 383838D1244BC567005FAC75 /* RCTMethodArgumentTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1175,38 +1213,65 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 38E9442E2446159A004A39E0 /* RNTesterSnapshotTests.m in Sources */, - 38E944302446159A004A39E0 /* RNTesterIntegrationTests.m in Sources */, - 38E9442F2446159A004A39E0 /* RNTesterTestModule.m in Sources */, - 38E9442B2446159A004A39E0 /* RCTLoggingTests.m in Sources */, - 38E9442D2446159A004A39E0 /* RCTUIManagerScenarioTests.m in Sources */, - 38E9442C2446159A004A39E0 /* RCTRootViewIntegrationTests.m in Sources */, + 383838DF244BC59D005FAC75 /* RCTRootViewIntegrationTests.m in Sources */, + 383838DD244BC596005FAC75 /* RNTesterIntegrationTests.m in Sources */, + 383838DE244BC59A005FAC75 /* RCTLoggingTests.m in Sources */, + 383838E0244BC5A0005FAC75 /* RCTUIManagerScenarioTests.m in Sources */, + 383838E2244BC5A8005FAC75 /* RNTesterTestModule.m in Sources */, + 383838E1244BC5A4005FAC75 /* RNTesterSnapshotTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E7DB209B22B2BA84005AC45F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E7DB20DF22B2BAA6005AC45F /* RCTImageLoaderTests.m in Sources */, + E7DB20D222B2BAA6005AC45F /* RCTModuleInitNotificationRaceTests.m in Sources */, + E7DB20D522B2BAA6005AC45F /* RCTPerformanceLoggerTests.m in Sources */, + E7DB20D922B2BAA6005AC45F /* RCTAnimationUtilsTests.m in Sources */, + E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */, + E7DB20EC22B2BAA6005AC45F /* RCTMultipartStreamReaderTests.m in Sources */, + E7DB20E022B2BAA6005AC45F /* RCTMethodArgumentTests.m in Sources */, + E7DB20E822B2BAA6005AC45F /* RCTModuleMethodTests.mm in Sources */, + E7DB20E222B2BAA6005AC45F /* RCTGzipTests.m in Sources */, + E7DB20ED22B2BAA6005AC45F /* RCTURLUtilsTests.m in Sources */, + E7DB20D322B2BAA6005AC45F /* RCTBlobManagerTests.m in Sources */, + E7DB20DC22B2BAA6005AC45F /* RCTUIManagerTests.m in Sources */, + E7DB20E322B2BAA6005AC45F /* RCTAllocationTests.m in Sources */, + E7DB20E622B2BAA6005AC45F /* RCTImageLoaderHelpers.m in Sources */, + E7DB20D622B2BAA6005AC45F /* RCTFontTests.m in Sources */, + E7DB20DB22B2BAA6005AC45F /* RCTNativeAnimatedNodesManagerTests.m in Sources */, + E7DB20E722B2BAA6005AC45F /* RCTConvert_NSURLTests.m in Sources */, + E7DB20DD22B2BAA6005AC45F /* RCTEventDispatcherTests.m in Sources */, + E7DB20E122B2BAA6005AC45F /* RCTShadowViewTests.m in Sources */, + E7DB20EA22B2BAA6005AC45F /* RCTImageUtilTests.m in Sources */, + E7DB20D722B2BAA6005AC45F /* RCTModuleInitTests.m in Sources */, + E7DB20E522B2BAA6005AC45F /* RCTDevMenuTests.m in Sources */, + E7DB20DE22B2BAA6005AC45F /* RCTUnicodeDecodeTests.m in Sources */, + E7DB20E422B2BAA6005AC45F /* RCTFormatErrorTests.m in Sources */, + E7DB20EB22B2BAA6005AC45F /* RCTConvert_YGValueTests.m in Sources */, + E7DB20E922B2BAA6005AC45F /* RCTComponentPropsTests.m in Sources */, + E7DB20D822B2BAA6005AC45F /* RCTJSONTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E7DB214F22B2F332005AC45F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E7DB216222B2F3EC005AC45F /* RNTesterTestModule.m in Sources */, + E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */, + E7DB216322B2F3EC005AC45F /* RCTLoggingTests.m in Sources */, + E7DB216622B2F3EC005AC45F /* RCTRootViewIntegrationTests.m in Sources */, + E7DB216422B2F3EC005AC45F /* RCTUIManagerScenarioTests.m in Sources */, + E7DB216522B2F3EC005AC45F /* RNTesterSnapshotTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 38A93801244531670025DABB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* RNTester */; - targetProxy = 38A93800244531670025DABB /* PBXContainerItemProxy */; - }; - 38E0B2BC24456B0700EF053A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* RNTester */; - targetProxy = 38E0B2BB24456B0700EF053A /* PBXContainerItemProxy */; - }; - 3D13F84C1D6F6B5F00E69E0E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D13F83D1D6F6AE000E69E0E /* RNTesterBundle */; - targetProxy = 3D13F84B1D6F6B5F00E69E0E /* PBXContainerItemProxy */; - }; - 5101986C23ADA17000118BF1 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5101986123ADA0FC00118BF1 /* RNTesterBundle-macOS */; - targetProxy = 5101986B23ADA17000118BF1 /* PBXContainerItemProxy */; - }; 9F15346F233AB2C7006DFE44 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9F15345A233AB2C4006DFE44 /* RNTester-macOS */; @@ -1217,6 +1282,11 @@ target = 9F15345A233AB2C4006DFE44 /* RNTester-macOS */; targetProxy = 9F153479233AB2C7006DFE44 /* PBXContainerItemProxy */; }; + E7DB215922B2F332005AC45F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* RNTester */; + targetProxy = E7DB215822B2F332005AC45F /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -1246,6 +1316,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; DEVELOPMENT_TEAM = ""; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1253,12 +1324,10 @@ "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", "\"${PODS_ROOT}/Headers/Public/React-ART\"", "\"${PODS_ROOT}/Headers/Public/React-Core\"", - "\"${PODS_ROOT}/Headers/Public/React-DevSupport\"", "\"${PODS_ROOT}/Headers/Public/React-Fabric\"", "\"${PODS_ROOT}/Headers/Public/React-RCTActionSheet\"", "\"${PODS_ROOT}/Headers/Public/React-RCTAnimation\"", "\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"", - "\"${PODS_ROOT}/Headers/Public/React-RCTCameraRoll\"", "\"${PODS_ROOT}/Headers/Public/React-RCTFabric\"", "\"${PODS_ROOT}/Headers/Public/React-RCTGeolocation\"", "\"${PODS_ROOT}/Headers/Public/React-RCTImage\"", @@ -1268,7 +1337,6 @@ "\"${PODS_ROOT}/Headers/Public/React-RCTSettings\"", "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", "\"${PODS_ROOT}/Headers/Public/React-RCTVibration\"", - "\"${PODS_ROOT}/Headers/Public/React-RCTWebSocket\"", "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", "\"${PODS_ROOT}/Headers/Public/React-fishhook\"", "\"${PODS_ROOT}/Headers/Public/React-jsi\"", @@ -1278,11 +1346,19 @@ "\"${PODS_ROOT}/Headers/Public/libevent\"", "\"$(PODS_ROOT)/boost-for-react-native\"", "\"$(PODS_ROOT)/Folly\"", + "\"$(PODS_ROOT)/DoubleConversion\"", ); INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_CFLAGS = "$(inherited)"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-l\"stdc++\"", + "-framework", + "\"JavaScriptCore\"", + ); PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1295,6 +1371,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; DEVELOPMENT_TEAM = ""; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1302,12 +1379,10 @@ "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", "\"${PODS_ROOT}/Headers/Public/React-ART\"", "\"${PODS_ROOT}/Headers/Public/React-Core\"", - "\"${PODS_ROOT}/Headers/Public/React-DevSupport\"", "\"${PODS_ROOT}/Headers/Public/React-Fabric\"", "\"${PODS_ROOT}/Headers/Public/React-RCTActionSheet\"", "\"${PODS_ROOT}/Headers/Public/React-RCTAnimation\"", "\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"", - "\"${PODS_ROOT}/Headers/Public/React-RCTCameraRoll\"", "\"${PODS_ROOT}/Headers/Public/React-RCTFabric\"", "\"${PODS_ROOT}/Headers/Public/React-RCTGeolocation\"", "\"${PODS_ROOT}/Headers/Public/React-RCTImage\"", @@ -1317,7 +1392,6 @@ "\"${PODS_ROOT}/Headers/Public/React-RCTSettings\"", "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", "\"${PODS_ROOT}/Headers/Public/React-RCTVibration\"", - "\"${PODS_ROOT}/Headers/Public/React-RCTWebSocket\"", "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", "\"${PODS_ROOT}/Headers/Public/React-fishhook\"", "\"${PODS_ROOT}/Headers/Public/React-jsi\"", @@ -1327,20 +1401,27 @@ "\"${PODS_ROOT}/Headers/Public/libevent\"", "\"$(PODS_ROOT)/boost-for-react-native\"", "\"$(PODS_ROOT)/Folly\"", + "\"$(PODS_ROOT)/DoubleConversion\"", ); INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_CFLAGS = "$(inherited)"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-l\"stdc++\"", + "-framework", + "\"JavaScriptCore\"", + ); PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; - 38A93802244531670025DABB /* Debug */ = { + 387847D8245631D80035033A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F94ACFCA0BC1A9B7B93A26C0 /* Pods-RNTesterUnitTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1348,28 +1429,18 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = RCT.RNTesterUnitTests; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - 38A93803244531670025DABB /* Release */ = { + 387847D9245631D80035033A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BC303BFA161D25E2F036356A /* Pods-RNTesterUnitTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1378,27 +1449,17 @@ CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); - INFOPLIST_FILE = RNTesterUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/RNTesterUnitTests", - ); MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = RCT.RNTesterUnitTests; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; - 38E0B2BD24456B0700EF053A /* Debug */ = { + 387847E5245631F50035033A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5641CFF8E3CFBC3C4B0EDEEF /* Pods-RNTesterIntegrationTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1406,21 +1467,18 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; DEBUG_INFORMATION_FORMAT = dwarf; - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = RCT.RNTesterIntegrationTests; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = RNTester; }; name = Debug; }; - 38E0B2BE24456B0700EF053A /* Release */ = { + 387847E6245631F50035033A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EF203F288E86F13DB63D5348 /* Pods-RNTesterIntegrationTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1429,46 +1487,16 @@ CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = RCT.RNTesterIntegrationTests; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = RNTester; }; name = Release; }; - 3D13F8421D6F6AE000E69E0E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - COMBINE_HIDPI_IMAGES = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 3D13F8431D6F6AE000E69E0E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - COMBINE_HIDPI_IMAGES = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 5101986623ADA0FC00118BF1 /* Debug */ = { + 387847F22456320C0035033A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; @@ -1476,22 +1504,18 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; - INFOPLIST_FILE = "RNTesterBundle-macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.14; + EXECUTABLE_PREFIX = lib; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTesterBundle-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; }; name = Debug; }; - 5101986723ADA0FC00118BF1 /* Release */ = { + 387847F32456320C0035033A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; @@ -1499,18 +1523,14 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - INFOPLIST_FILE = "RNTesterBundle-macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.14; + EXECUTABLE_PREFIX = lib; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTesterBundle-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - WRAPPER_EXTENSION = bundle; }; name = Release; }; @@ -1546,6 +1566,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1626,6 +1647,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1683,7 +1705,10 @@ DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "RNTester-macOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -1710,7 +1735,10 @@ DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "RNTester-macOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTester-macOS"; @@ -1730,13 +1758,17 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", ); INFOPLIST_FILE = "RNTester-macOSUnitTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -1758,13 +1790,17 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", ); INFOPLIST_FILE = "RNTester-macOSUnitTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTester-macOSTests"; @@ -1784,9 +1820,18 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; + DEVELOPMENT_TEAM = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "COCOAPODS=1", + "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/RNTesterIntegrationTests/ReferenceImages\\\"\"", + ); INFOPLIST_FILE = "RNTester-macOSIntegrationTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -1809,9 +1854,13 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RNTester-macOSIntegrationTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "Microsoft.RNTester-macOSUITests"; @@ -1821,6 +1870,130 @@ }; name = Release; }; + E7DB20A722B2BA84005AC45F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 34028D6B10F47E490042EB27 /* Pods-RNTesterUnitTests.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = RNTesterUnitTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/RNTesterUnitTests", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterUnitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E7DB20A822B2BA84005AC45F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E9618482EC8608D4872A6E28 /* Pods-RNTesterUnitTests.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = RNTesterUnitTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/RNTesterUnitTests", + ); + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterUnitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + E7DB215B22B2F332005AC45F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 972A459EE6CF8CC63531A088 /* Pods-RNTesterIntegrationTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/RNTesterIntegrationTests/ReferenceImages\\\"\"", + "$(inherited)", + ); + INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterIntegrationTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; + }; + name = Debug; + }; + E7DB215C22B2F332005AC45F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7D51F73F0DA20287418D98BD /* Pods-RNTesterIntegrationTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterIntegrationTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1833,38 +2006,29 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 38A93804244531670025DABB /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */ = { + 387847D7245631D80035033A /* Build configuration list for PBXNativeTarget "iosDeviceBuild" */ = { isa = XCConfigurationList; buildConfigurations = ( - 38A93802244531670025DABB /* Debug */, - 38A93803244531670025DABB /* Release */, + 387847D8245631D80035033A /* Debug */, + 387847D9245631D80035033A /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 38E0B2BF24456B0700EF053A /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */ = { + 387847E4245631F50035033A /* Build configuration list for PBXNativeTarget "iosSimulatorBuild" */ = { isa = XCConfigurationList; buildConfigurations = ( - 38E0B2BD24456B0700EF053A /* Debug */, - 38E0B2BE24456B0700EF053A /* Release */, + 387847E5245631F50035033A /* Debug */, + 387847E6245631F50035033A /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 3D13F8411D6F6AE000E69E0E /* Build configuration list for PBXNativeTarget "RNTesterBundle" */ = { + 387847F12456320C0035033A /* Build configuration list for PBXNativeTarget "macOSBuild" */ = { isa = XCConfigurationList; buildConfigurations = ( - 3D13F8421D6F6AE000E69E0E /* Debug */, - 3D13F8431D6F6AE000E69E0E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5101986523ADA0FC00118BF1 /* Build configuration list for PBXNativeTarget "RNTesterBundle-macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5101986623ADA0FC00118BF1 /* Debug */, - 5101986723ADA0FC00118BF1 /* Release */, + 387847F22456320C0035033A /* Debug */, + 387847F32456320C0035033A /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -1905,6 +2069,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + E7DB20A622B2BA84005AC45F /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E7DB20A722B2BA84005AC45F /* Debug */, + E7DB20A822B2BA84005AC45F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E7DB215A22B2F332005AC45F /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E7DB215B22B2F332005AC45F /* Debug */, + E7DB215C22B2F332005AC45F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; diff --git a/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTester-macOS.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTester-macOS.xcscheme index b2bb1f3c08d9d1..81aed751023ed8 100644 --- a/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTester-macOS.xcscheme +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTester-macOS.xcscheme @@ -3,7 +3,7 @@ LastUpgradeVersion = "1120" version = "1.3"> @@ -58,9 +58,9 @@ skipped = "NO"> diff --git a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester-tvOS.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme similarity index 51% rename from RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester-tvOS.xcscheme rename to RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme index 0c3555d5cfc2c5..ed4d39a4a86380 100644 --- a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester-tvOS.xcscheme +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme @@ -1,6 +1,6 @@ - - - - + BlueprintIdentifier = "13B07F861A680F5B00A75B9A" + BuildableName = "RNTester.app" + BlueprintName = "RNTester" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> @@ -40,38 +26,45 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "NO"> - - - - + BlueprintIdentifier = "E7DB215222B2F332005AC45F" + BuildableName = "RNTesterIntegrationTests.xctest" + BlueprintName = "RNTesterIntegrationTests" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> + + + + + BlueprintIdentifier = "13B07F861A680F5B00A75B9A" + BuildableName = "RNTester.app" + BlueprintName = "RNTester" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> + + + + + + @@ -85,23 +78,15 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - + + BlueprintIdentifier = "13B07F861A680F5B00A75B9A" + BuildableName = "RNTester.app" + BlueprintName = "RNTester" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - - - - - + @@ -111,16 +96,15 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> - + + BlueprintIdentifier = "13B07F861A680F5B00A75B9A" + BuildableName = "RNTester.app" + BlueprintName = "RNTester" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - + diff --git a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterUnitTests.xcscheme similarity index 57% rename from RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme rename to RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterUnitTests.xcscheme index 2202cf9c8b5de0..35508981b41ce4 100644 --- a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterUnitTests.xcscheme @@ -1,39 +1,11 @@ - - - - - - - - + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - - - - + ReferencedContainer = "container:RNTesterPods.xcodeproj"> @@ -103,20 +61,25 @@ skipped = "NO"> + ReferencedContainer = "container:RNTesterPods.xcodeproj"> + + + + + BlueprintIdentifier = "E7DB217A22B30380005AC45F" + BuildableName = "RNTesterBundle.xctest" + BlueprintName = "RNTesterBundle" + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - + + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - - - - - - - + - + + ReferencedContainer = "container:RNTesterPods.xcodeproj"> - + diff --git a/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosDeviceBuild.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosDeviceBuild.xcscheme new file mode 100644 index 00000000000000..3c641f49383921 --- /dev/null +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosDeviceBuild.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosSimulatorBuild.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosSimulatorBuild.xcscheme new file mode 100644 index 00000000000000..848622fc7c5dd6 --- /dev/null +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/iosSimulatorBuild.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/macOSBuild.xcscheme b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/macOSBuild.xcscheme new file mode 100644 index 00000000000000..d9f60490f4d097 --- /dev/null +++ b/RNTester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/macOSBuild.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RNTester/RNTesterUnitTests/OCMock/OCMStubRecorder.h b/RNTester/RNTesterUnitTests/OCMock/OCMStubRecorder.h index 86eb818048e129..283fd963bf33af 100644 --- a/RNTester/RNTesterUnitTests/OCMock/OCMStubRecorder.h +++ b/RNTester/RNTesterUnitTests/OCMock/OCMStubRecorder.h @@ -14,7 +14,7 @@ * under the License. */ -#import +#import "OCMRecorder.h" @interface OCMStubRecorder : OCMRecorder diff --git a/RNTester/RNTesterUnitTests/OCMock/OCMock.h b/RNTester/RNTesterUnitTests/OCMock/OCMock.h index f0083b3507ea74..ea5d93c126d8d8 100644 --- a/RNTester/RNTesterUnitTests/OCMock/OCMock.h +++ b/RNTester/RNTesterUnitTests/OCMock/OCMock.h @@ -14,14 +14,14 @@ * under the License. */ -#import -#import -#import -#import -#import -#import -#import -#import +#import "OCMockObject.h" +#import "OCMRecorder.h" +#import "OCMStubRecorder.h" +#import "OCMConstraint.h" +#import "OCMArg.h" +#import "OCMLocation.h" +#import "OCMMacroState.h" +#import "NSNotificationCenter+OCMAdditions.h" #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] diff --git a/RNTester/RNTesterUnitTests/RCTAllocationTests.m b/RNTester/RNTesterUnitTests/RCTAllocationTests.m index 04c1a72666a980..aebfd3f7923584 100644 --- a/RNTester/RNTesterUnitTests/RCTAllocationTests.m +++ b/RNTester/RNTesterUnitTests/RCTAllocationTests.m @@ -172,7 +172,7 @@ - (void)testContentViewIsInvalidated /** * T42930872: * - * Both bridge invalidation and bridge setUp occurr execute concurrently. + * Both bridge invalidation and bridge setUp occur execute concurrently. * Therefore, it's not safe for us to create a bridge, and immediately reload on * it. It's also unsafe to just reload the bridge, because that calls invalidate * and then setUp. Because of these race conditions, this test may randomly diff --git a/RNTester/RNTesterUnitTests/RCTAnimationUtilsTests.m b/RNTester/RNTesterUnitTests/RCTAnimationUtilsTests.m index dc40bd1f1d8202..a0546a93131a8b 100644 --- a/RNTester/RNTesterUnitTests/RCTAnimationUtilsTests.m +++ b/RNTester/RNTesterUnitTests/RCTAnimationUtilsTests.m @@ -8,7 +8,7 @@ #import -#import +#import @interface RCTAnimationUtilsTests : XCTestCase diff --git a/RNTester/RNTesterUnitTests/RCTBlobManagerTests.m b/RNTester/RNTesterUnitTests/RCTBlobManagerTests.m index 2b0f5eb754b39a..b3a472e16841ef 100644 --- a/RNTester/RNTesterUnitTests/RCTBlobManagerTests.m +++ b/RNTester/RNTesterUnitTests/RCTBlobManagerTests.m @@ -8,7 +8,7 @@ #import -#import +#import @interface RCTBlobManagerTests : XCTestCase diff --git a/RNTester/RNTesterUnitTests/RCTBundleURLProviderTests.m b/RNTester/RNTesterUnitTests/RCTBundleURLProviderTests.m index 7fbea5cb9dcbb8..ed88b6135ddb45 100644 --- a/RNTester/RNTesterUnitTests/RCTBundleURLProviderTests.m +++ b/RNTester/RNTesterUnitTests/RCTBundleURLProviderTests.m @@ -20,12 +20,12 @@ static NSURL *localhostBundleURL() { - return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true&minify=false", testFile, kRCTPlatformName]]; + return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true&minify=false", testFile, kRCTPlatformName]]; // TODO(macOS ISS#3536887) } static NSURL *ipBundleURL() { - return [NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&minify=false", testFile, kRCTPlatformName]]; + return [NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&minify=false", testFile, kRCTPlatformName]]; // TODO(macOS ISS#3536887) } @implementation NSBundle (RCTBundleURLProviderTests) diff --git a/RNTester/RNTesterUnitTests/RCTConvert_NSColorTests.m b/RNTester/RNTesterUnitTests/RCTConvert_NSColorTests.m index 1d5b3ef6e038bf..64a1b20ebe08a4 100644 --- a/RNTester/RNTesterUnitTests/RCTConvert_NSColorTests.m +++ b/RNTester/RNTesterUnitTests/RCTConvert_NSColorTests.m @@ -6,6 +6,8 @@ * */ +// TODO(macOS ISS#3536887) + #import #import diff --git a/RNTester/RNTesterUnitTests/RCTConvert_NSURLTests.m b/RNTester/RNTesterUnitTests/RCTConvert_NSURLTests.m index fb944003c6d9be..cdf4bfec8bf92f 100644 --- a/RNTester/RNTesterUnitTests/RCTConvert_NSURLTests.m +++ b/RNTester/RNTesterUnitTests/RCTConvert_NSURLTests.m @@ -30,7 +30,7 @@ - (void)test_##name { \ } \ #define TEST_BUNDLE_PATH(name, _input, _expectedPath) \ -TEST_PATH(name, _input, [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:_expectedPath]) +TEST_PATH(name, _input, [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:_expectedPath]) // Basic tests TEST_URL(basic, @"http://example.com", @"http://example.com") diff --git a/RNTester/RNTesterUnitTests/RCTConvert_UIColorTests.m b/RNTester/RNTesterUnitTests/RCTConvert_UIColorTests.m index 01507bd9fa0b0b..443265302687c4 100644 --- a/RNTester/RNTesterUnitTests/RCTConvert_UIColorTests.m +++ b/RNTester/RNTesterUnitTests/RCTConvert_UIColorTests.m @@ -6,6 +6,8 @@ * */ +// TODO(macOS ISS#3536887) + #import #import diff --git a/RNTester/RNTesterUnitTests/RCTEventDispatcherTests.m b/RNTester/RNTesterUnitTests/RCTEventDispatcherTests.m index 405a3050340c48..b4064e0d3799dd 100644 --- a/RNTester/RNTesterUnitTests/RCTEventDispatcherTests.m +++ b/RNTester/RNTesterUnitTests/RCTEventDispatcherTests.m @@ -6,10 +6,10 @@ * */ -#import +#import // TODO(macOS ISS#3536887) #import -#import +#import "OCMock/OCMock.h" #import diff --git a/RNTester/RNTesterUnitTests/RCTImageLoaderTests.m b/RNTester/RNTesterUnitTests/RCTImageLoaderTests.m index e85c408a1407c1..cb1718538bc5a4 100644 --- a/RNTester/RNTesterUnitTests/RCTImageLoaderTests.m +++ b/RNTester/RNTesterUnitTests/RCTImageLoaderTests.m @@ -53,13 +53,20 @@ - (void)testImageLoading NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:^{ return @[loader]; } launchOptions:nil]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://facebook.github.io/react-native/img/opengraph.png"]]; - [bridge.imageLoader loadImageWithURLRequest:urlRequest size:CGSizeMake(100, 100) scale:1.0 clipped:YES resizeMode:RCTResizeModeContain progressBlock:^(int64_t progress, int64_t total) { - XCTAssertEqual(progress, 1); - XCTAssertEqual(total, 1); - } partialLoadBlock:nil completionBlock:^(NSError *loadError, id loadedImage) { - XCTAssertEqualObjects(loadedImage, image); - XCTAssertNil(loadError); - }]; + [[bridge moduleForClass:[RCTImageLoader class]] + loadImageWithURLRequest:urlRequest + size:CGSizeMake(100, 100) + scale:1.0 + clipped:YES + resizeMode:RCTResizeModeContain + progressBlock:^(int64_t progress, int64_t total) { + XCTAssertEqual(progress, 1); + XCTAssertEqual(total, 1); + } + partialLoadBlock:nil completionBlock:^(NSError *loadError, id loadedImage) { + XCTAssertEqualObjects(loadedImage, image); + XCTAssertNil(loadError); + }]; } - (void)testImageLoaderUsesImageURLLoaderWithHighestPriority @@ -84,13 +91,20 @@ - (void)testImageLoaderUsesImageURLLoaderWithHighestPriority NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:^{ return @[loader1, loader2]; } launchOptions:nil]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://facebook.github.io/react-native/img/opengraph.png"]]; - [bridge.imageLoader loadImageWithURLRequest:urlRequest size:CGSizeMake(100, 100) scale:1.0 clipped:YES resizeMode:RCTResizeModeContain progressBlock:^(int64_t progress, int64_t total) { - XCTAssertEqual(progress, 1); - XCTAssertEqual(total, 1); - } partialLoadBlock:nil completionBlock:^(NSError *loadError, id loadedImage) { - XCTAssertEqualObjects(loadedImage, image); - XCTAssertNil(loadError); - }]; + [[bridge moduleForClass:[RCTImageLoader class]] + loadImageWithURLRequest:urlRequest + size:CGSizeMake(100, 100) + scale:1.0 + clipped:YES + resizeMode:RCTResizeModeContain + progressBlock:^(int64_t progress, int64_t total) { + XCTAssertEqual(progress, 1); + XCTAssertEqual(total, 1); + } + partialLoadBlock:nil completionBlock:^(NSError *loadError, id loadedImage) { + XCTAssertEqualObjects(loadedImage, image); + XCTAssertNil(loadError); + }]; } - (void)testImageDecoding @@ -108,10 +122,17 @@ - (void)testImageDecoding NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:^{ return @[decoder]; } launchOptions:nil]; - RCTImageLoaderCancellationBlock cancelBlock = [bridge.imageLoader decodeImageData:data size:CGSizeMake(1, 1) scale:1.0 clipped:NO resizeMode:RCTResizeModeStretch completionBlock:^(NSError *decodeError, id decodedImage) { + RCTImageLoaderCancellationBlock cancelBlock = + [[bridge moduleForClass:[RCTImageLoader class]] + decodeImageData:data + size:CGSizeMake(1, 1) + scale:1.0 + clipped:NO + resizeMode:RCTResizeModeStretch + completionBlock:^(NSError *decodeError, id decodedImage) { XCTAssertEqualObjects(decodedImage, image); XCTAssertNil(decodeError); - }]; + }]; XCTAssertNotNil(cancelBlock); } @@ -137,10 +158,17 @@ - (void)testImageLoaderUsesImageDecoderWithHighestPriority NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:^{ return @[decoder1, decoder2]; } launchOptions:nil]; - RCTImageLoaderCancellationBlock cancelBlock = [bridge.imageLoader decodeImageData:data size:CGSizeMake(1, 1) scale:1.0 clipped:NO resizeMode:RCTResizeModeStretch completionBlock:^(NSError *decodeError, id decodedImage) { - XCTAssertEqualObjects(decodedImage, image); - XCTAssertNil(decodeError); - }]; + RCTImageLoaderCancellationBlock cancelBlock = + [[bridge moduleForClass:[RCTImageLoader class]] + decodeImageData:data + size:CGSizeMake(1, 1) + scale:1.0 + clipped:NO + resizeMode:RCTResizeModeStretch + completionBlock:^(NSError *decodeError, id decodedImage) { + XCTAssertEqualObjects(decodedImage, image); + XCTAssertNil(decodeError); + }]; XCTAssertNotNil(cancelBlock); } diff --git a/RNTester/RNTesterUnitTests/RCTImageUtilTests.m b/RNTester/RNTesterUnitTests/RCTImageUtilTests.m index 44bd2a9abecfb4..d1775e05dc9f0f 100644 --- a/RNTester/RNTesterUnitTests/RCTImageUtilTests.m +++ b/RNTester/RNTesterUnitTests/RCTImageUtilTests.m @@ -8,13 +8,10 @@ #import #import +// TODO(OSS Candidate ISS#2710739) #import #import -#if __has_include() // TODO(macOS ISS#2323203) #import -#else // [TODO(macOS ISS#2323203) -#import -#endif // ]TODO(macOS ISS#2323203) #define RCTAssertEqualPoints(a, b) { \ XCTAssertEqual(a.x, b.x); \ diff --git a/RNTester/RNTesterUnitTests/RCTMethodArgumentTests.m b/RNTester/RNTesterUnitTests/RCTMethodArgumentTests.m index 240d4fa14030a9..8f47ae9621b50d 100644 --- a/RNTester/RNTesterUnitTests/RCTMethodArgumentTests.m +++ b/RNTester/RNTesterUnitTests/RCTMethodArgumentTests.m @@ -6,7 +6,7 @@ * */ -#import +#import // TODO(macOS ISS#2323203) #import #import diff --git a/RNTester/RNTesterUnitTests/RCTModuleInitNotificationRaceTests.m b/RNTester/RNTesterUnitTests/RCTModuleInitNotificationRaceTests.m index 137408b6f16ac6..3bcecc6dc66e0a 100644 --- a/RNTester/RNTesterUnitTests/RCTModuleInitNotificationRaceTests.m +++ b/RNTester/RNTesterUnitTests/RCTModuleInitNotificationRaceTests.m @@ -10,6 +10,7 @@ #import #import + #import #import #import diff --git a/RNTester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m b/RNTester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m index e9476dd63614c2..1aed902aa68886 100644 --- a/RNTester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m +++ b/RNTester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m @@ -8,12 +8,12 @@ #import -#import +#import "OCMock/OCMock.h" -#import -#import +#import +#import #import -#import +#import // TODO(macOS ISS#2323203) static const NSTimeInterval FRAME_LENGTH = 1.0 / 60.0; @@ -123,7 +123,6 @@ @implementation RCTNativeAnimatedNodesManagerTests id _uiManager; RCTNativeAnimatedNodesManager *_nodesManager; RCTFakeDisplayLink *_displayLink; - } - (void)setUp @@ -171,7 +170,6 @@ - (void)testFramesAnimation [[_uiManager expect] synchronouslyUpdateViewOnUIThread:@1001 viewName:@"UIView" props:RCTPropChecker(@"opacity", frame)]; - [_nodesManager stepAnimations:_displayLink]; [_uiManager verify]; } @@ -1030,7 +1028,7 @@ - (void)testTrackingPausesWhenEndValueIsReached */ - (void) testSpringTrackingRetainsSpeed { - // this spring config correspomds to tension 20 and friction 0.5 which makes the spring settle + // this spring config corresponds to tension 20 and friction 0.5 which makes the spring settle // very slowly NSDictionary *springConfig = @{@"type": @"spring", @"restSpeedThreshold": @0.001, diff --git a/RNTester/RNTesterUnitTests/RCTUtilsTests.m b/RNTester/RNTesterUnitTests/RCTUtilsTests.m new file mode 100644 index 00000000000000..c4d678c0d4bd11 --- /dev/null +++ b/RNTester/RNTesterUnitTests/RCTUtilsTests.m @@ -0,0 +1,64 @@ +/** + * 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. + * + */ + +#import + +#import +#import + +static NSString * RCTLogsError(void (^block)(void)) +{ + __block NSString* loggedMessage = @""; + __block BOOL loggedError = NO; + RCTPerformBlockWithLogFunction(block, ^(RCTLogLevel level, + __unused RCTLogSource source, + __unused NSString *fileName, + __unused NSNumber *lineNumber, + NSString *message) { + loggedError = (level == RCTLogLevelError); + loggedMessage = message; + }); + if (loggedError) { + return loggedMessage; + } + return nil; +} + + +@interface RCTUtilsTests : XCTestCase + +@end + +@implementation RCTUtilsTests + +- (void)testRCTHumanReadableType +{ + XCTAssertEqualObjects(RCTHumanReadableType(@"str"), @"string"); + XCTAssertEqualObjects(RCTHumanReadableType([NSNumber numberWithInt:4]), @"number"); + + // If we could detect that this was definitely a boolean and not a number that would be ideal + // That seems difficult in ObjC though + XCTAssertEqualObjects(RCTHumanReadableType(@(YES)), @"boolean or number"); + XCTAssertEqualObjects(RCTHumanReadableType(@(NO)), @"boolean or number"); + // These ideally would just say number + XCTAssertEqualObjects(RCTHumanReadableType([NSNumber numberWithInt:0]), @"boolean or number"); + XCTAssertEqualObjects(RCTHumanReadableType([NSNumber numberWithInt:1]), @"boolean or number"); +} + +- (void)testRCTValidateTypeOfViewCommandArgument +{ + XCTAssertEqualObjects(RCTLogsError(^{ + RCTValidateTypeOfViewCommandArgument(@"str", [NSNumber class], @"number", @"ScrollView", @"scrollTo", @"2nd"); + }), @"ScrollView command scrollTo received 2nd argument of type string, expected number."); + + XCTAssertEqualObjects(RCTLogsError(^{ + RCTValidateTypeOfViewCommandArgument(@"str", [NSString class], @"string", @"ScrollView", @"scrollTo", @"1st"); + }), nil); +} + +@end diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle index 9463a2ad5a0dd2..d87be06c06d7e9 100644 --- a/RNTester/android/app/build.gradle +++ b/RNTester/android/app/build.gradle @@ -64,11 +64,13 @@ plugins { */ project.ext.react = [ - cliPath: "$rootDir/cli.js", bundleAssetName: "RNTesterApp.android.bundle", entryFile: file("../../js/RNTesterApp.android.js"), root: "$rootDir", - inputExcludes: ["android/**", "./**", ".gradle/**"] + inputExcludes: ["android/**", "./**", ".gradle/**"], + composeSourceMapsPath: "$rootDir/scripts/compose-source-maps.js", + hermesCommand: "../../../node_modules/hermes-engine/%OS-BIN%/hermes", + enableHermesForVariant: { def v -> v.name.contains("hermes") } ] apply from: "../../../react.gradle" @@ -105,6 +107,16 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } + flavorDimensions "vm" + productFlavors { + hermes { + dimension "vm" + } + jsc { + dimension "vm" + } + } + defaultConfig { applicationId "com.facebook.react.uiapp" minSdkVersion 16 @@ -137,13 +149,26 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } + } + packagingOptions { + pickFirst 'lib/x86/libc++_shared.so' + pickFirst 'lib/x86_64/libjsc.so' + pickFirst 'lib/arm64-v8a/libjsc.so' + pickFirst 'lib/arm64-v8a/libc++_shared.so' + pickFirst 'lib/x86_64/libc++_shared.so' + pickFirst 'lib/armeabi-v7a/libc++_shared.so' + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':ReactAndroid') + def hermesPath = '$projectDir/../../../../node_modules/hermes-engine/android/' + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") + if (useIntlJsc) { implementation 'org.webkit:android-jsc-intl:+' } else { diff --git a/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterActivity.java b/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterActivity.java index 36b14a98c5f9fa..6878202e867898 100644 --- a/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterActivity.java +++ b/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterActivity.java @@ -1,20 +1,16 @@ /** * 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. - * + *

This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. */ - package com.facebook.react.uiapp; import android.os.Bundle; - +import androidx.annotation.Nullable; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; -import javax.annotation.Nullable; - public class RNTesterActivity extends ReactActivity { public static class RNTesterActivityDelegate extends ReactActivityDelegate { private static final String LOG_TAG = "RNTesterActivity"; @@ -32,10 +28,11 @@ protected void onCreate(Bundle savedInstanceState) { // Get remote param before calling super which uses it Bundle bundle = mActivity.getIntent().getExtras(); if (bundle != null && bundle.containsKey(PARAM_ROUTE)) { - String routeUri = new StringBuilder("rntester://example/") - .append(bundle.getString(PARAM_ROUTE)) - .append("Example") - .toString(); + String routeUri = + new StringBuilder("rntester://example/") + .append(bundle.getString(PARAM_ROUTE)) + .append("Example") + .toString(); mInitialProps = new Bundle(); mInitialProps.putString("exampleFromAppetizeParams", routeUri); } diff --git a/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java b/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java index a6601115ad981d..f6f33b6e2fe3a0 100644 --- a/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java +++ b/RNTester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java @@ -1,54 +1,51 @@ /** * 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. - * + *

This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. */ - package com.facebook.react.uiapp; import android.app.Application; - import com.facebook.react.BuildConfig; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.react.views.text.ReactFontManager; - +import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class RNTesterApplication extends Application implements ReactApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - public String getJSMainModuleName() { - return "RNTester/js/RNTesterApp.android"; - } - - @Override - public String getBundleAssetName() { - return "RNTesterApp.android.bundle"; - } - - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - public List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); - } - }; + private final ReactNativeHost mReactNativeHost = + new ReactNativeHost(this) { + @Override + public String getJSMainModuleName() { + return "RNTester/js/RNTesterApp.android"; + } + + @Override + public String getBundleAssetName() { + return "RNTesterApp.android.bundle"; + } + + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + public List getPackages() { + return Arrays.asList(new MainReactPackage()); + } + }; @Override public void onCreate() { ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik); super.onCreate(); + SoLoader.init(this, /* native exopackage */ false); } @Override diff --git a/RNTester/e2e/__tests__/Button-test.js~HEAD b/RNTester/e2e/__tests__/Button-test.js~HEAD deleted file mode 100644 index 2d5a573f043e9c..00000000000000 --- a/RNTester/e2e/__tests__/Button-test.js~HEAD +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - * - * @emails oncall+react_native - * @format - */ - -/* global device, element, by, expect */ - -describe('Button', () => { - beforeAll(async () => { - await device.reloadReactNative(); - await element(by.id('explorer_search')).replaceText('