Summary: If a root node is being removed and has an id of NO_ID, it was likely already removed previously, likely due to a race condition caused by RN's async nature. In those cases, let's avoid crashing the app and instead silently ignore the root view removal.
Reviewed By: mdvacca
Differential Revision: D13055140
fbshipit-source-id: ec10f4c79f2ba21614f52f57557f6b3d734c9461
Summary:
In preparation for D12843022, starting using folly::none instead of
nullptr to indicate an empty optional.
Reviewed By: nlutsenko
Differential Revision: D13052075
fbshipit-source-id: ed869f98b5fb1556bca1e01e3ac3e44ea914dc52
Summary: There are cases where we're trying to drop a view that is not associated with a ViewManager. This is likely caused by race conditions that can occur if we're dropping a view from JS (when it's no longer used) but at the same time dropping it from native (when layout animation ends, when the rootview gets unmounted). In either of those cases, it should be safe to ignore the drop operation because the view was likely dropped already.
Reviewed By: mdvacca
Differential Revision: D13036643
fbshipit-source-id: 260ffb56d32a0d670ad08f449b8df165b2533195
Summary:
Unused loads still take time to process and pollute
execution environment.
drop-conflicts
Reviewed By: passy
Differential Revision: D13054018
fbshipit-source-id: a8fe58d1c55c031925c2c0267e24e67f021cd91d
Summary: This diff fixes the dispaching of Async Events in Android C++ layer to ensure proper asynchronouns dispatching in the JS thread.
Reviewed By: shergin
Differential Revision: D12988348
fbshipit-source-id: 7aa60b11e2c264c2e68354ed83eb75139060d211
Summary:
@public
Currently only parent can tell the layout to align its children based on baseline. But if one of the children is a column or row then basealign does not work as expected.
We have added an api setReferenceBaseline which when set to true would mean that it's baseline would be considered as the reference baseline for parent amongst its siblings. If there are more than one siblings with referenceBaseline set, the first one would be considered.
Reviewed By: davidaurelio
Differential Revision: D12883323
fbshipit-source-id: 19beccfc47d98bb38f81f5b66ba764e83680f821
Summary:
This regression was caused by 199c918 - property values are initialized to true rather than a string that matches the property name now.
Pull Request resolved: https://github.com/facebook/react-native/pull/22262
Differential Revision: D13048839
Pulled By: hramos
fbshipit-source-id: 09471334c37f3930aae7e35066943f33f8e617e5
Summary:
When the remote server closes the websocket, the app doesn't get a 'close' event in Android, There is no issue on iOS.
Pull Request resolved: https://github.com/facebook/react-native/pull/22248
Differential Revision: D13047556
Pulled By: hramos
fbshipit-source-id: c5c56ea8418cfdf734fb51f863b3066856de6512
Summary: Testing is a __DEV__ time only, so let's optimize for prod bundles.
Reviewed By: ejanzer
Differential Revision: D13050583
fbshipit-source-id: a96e35e4d5f3bd09c235c11d4ece3e4d07882de7
Summary:
Some module classes may not be loaded yet, so looking up via classes may not always give the correct instance. This diff added a new lookup method that delegate to the bridge delegate to force load the modules as needed.
The existing moduleForName: method was left untouched because it's solely used by RCTUIManager at the moment.
Reviewed By: dshahidehpour
Differential Revision: D13033876
fbshipit-source-id: 4082fcd68498004f678b4b95adc82b5b134fefdf
Summary:
When writing a native module in C++ using CxxModule, its not currently possible to write async methods which take two callbacks, that shouldn't be projected to JS as a promise. I hit this when trying to implement the AppState module in c++. AppState has a single method on it, getCurrentAppState, which takes two callbacks (a success and a failure callback).
This change adds a couple of new CxxModule::Method ctors, which allow devs to specify that they want two callbacks, but not a promise. This is done using an extra tag in the ctor, similar to how you specify that you want to make a synchronous method. I used the existing AsyncTag to indicate that the 2 callback version should be async, and not a promise.
Pull Request resolved: https://github.com/facebook/react-native/pull/21586
Reviewed By: shergin
Differential Revision: D10520204
Pulled By: fkgozali
fbshipit-source-id: bcb2dbd91cba3c1db987dc18960247218fdbc032
Summary:
@public
We're seeing a crash on line 191 when we do `CFRelease(self->_firstTimeReachability);`. My thinking is that there's a race condition between the deallocation coming from calling `getCurrentConnectivity` twice in a row and the callback coming back.
Reviewed By: PeteTheHeat
Differential Revision: D12982772
fbshipit-source-id: d3d882a074b67a5e547e7f480f561fcaf8d79ec4
Summary:
GraphNotFoundError: When the user moves the app to the background on Android, restarts the Metro server and reopens the app, since the client hasn't requested either a delta or a bundle, the graph cache of the server is empty and thus we can't compute an update for the client (what if changes happened when the metro server was down?).
RevisionNotFoundError: I didn't manage to reproduce that one. It could happen if two clients live side-by-side, requesting the exact same bundle. In the future, if we want to handle that case, we'll need to manage a list of clients listening to a single graph so that we don't try to update the same graph multiple times for a single file change.
Disconnection: Same as GraphNotFoundError, but happens when the user moves the app to the background on iOS.
Reviewed By: mjesun
Differential Revision: D12960939
fbshipit-source-id: 5ac1dc7fd12bad5e0ee8dfa5a21c112773454ee5
Summary: Adds support for the `deleted` key to remove modules from the bundle. Without this, source maps would break after removing a module, since it would still end up in the patched bundle but not in the source map.
Reviewed By: mjesun
Differential Revision: D12874011
fbshipit-source-id: 79239756854cb2c02f14ec8b0bb2b649766393fe
Summary:
This pull request fixes a path name to be a proper case in `UITemplateProcessor`, which fixes this build warning:
```
{snip}/react/uimanager/UITemplateProcessor.cpp:17:10: warning: non-portable path to file '<react/core/ComponentDescriptor.h>';
specified path differs in case from file name on disk [-Wnonportable-include-path]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<react/core/ComponentDescriptor.h>
1 warning generated.
```
Pull Request resolved: https://github.com/facebook/react-native/pull/22239
Differential Revision: D13020871
Pulled By: shergin
fbshipit-source-id: 77555018cd569880518ff884ed8768effc4ea97e
Summary: This diff changes the behavior of the Scheduler.schedulerDidRequestPreliminaryViewAllocation to avoid pre-allocating views that are non-layoutables
Reviewed By: shergin
Differential Revision: D12962008
fbshipit-source-id: cb2670beafdcbd2116fbdaf2dc5d1b4726330ec2
Summary: We are moving to more stable APIs removing all mentiones of the effort name from the codebase.
Reviewed By: mdvacca
Differential Revision: D12912894
fbshipit-source-id: 4a0c6b9e7454b8b14e62d419e9e9311dc0c56e7a
Summary:
androidID was a constant that was exposed as a Platform constant, but it seems to use slightly expensive methods when they need to be computed. Moving this to a method so that it is computed only when needed.
Test Plan
Reviewed By: ejanzer
Differential Revision: D6563853
fbshipit-source-id: 3c5929fcbc947c13c3a25f2bf473e145ac4bf73e
Summary:
D12911108 fixed a UBN race condition by adding a flag for module registry.
This flag was never reset if react instance gets reset, causing an assert to fire in IG.
Reviewed By: fkgozali
Differential Revision: D13010651
fbshipit-source-id: e20453f3c546d759a58fd7fb93553f774410905f
Summary: I recently changed the implementation of `getServerHost` to be more expensive. I am excluding it from constants in non-debug builds, since loading that module lies on a critical path.
Reviewed By: axe-fb
Differential Revision: D12982150
fbshipit-source-id: eaaa50418726dbb2da2d517d0810f39b0dc7fac2
Summary:
Yet another issue with mAttachedRootViews. Every time attachRootView is called, the root view's id is reset to NO_ID. However, there can be a case where the react context has not initialized yet, so we delay attaching the root view to the instance manager until setupReactContext. If attachRootView was called a second time before the react context has finished initializing, we end up in a situation where we try to attach the same root view twice
I'm planning to remove mAttachedRootViews all together in a future diff, but for now let's avoid these crashes.
Reviewed By: mmmulani
Differential Revision: D12835167
fbshipit-source-id: ebef3fadc5f9f467eebb3b5644c685acc5ea10bf
Summary:
When RN starts up, it lowers the default priority of the JS thread. This diff sets a point to see when the JS thread priority is lowered.
In subsequent diffs, we will be able to use this marker to play around with bumping the priority of the JS thread till TTI is done.
Reviewed By: alexeylang
Differential Revision: D8965457
fbshipit-source-id: 87cb1e3d3b370af183f388c411fd9a87a6cba250
Summary: It seems like `nativePerformanceNow` might not be getting installed in time to be used by InitializeCore on Android. Using PerformanceLogger.currentTimestamp instead, which uses nativeQPLTimestamp (which is what we should be using anyway)
Reviewed By: alexeylang
Differential Revision: D12875187
fbshipit-source-id: 6eda5d2ed7948ba48c63f76b40b2014511c32494
Summary:
D12829677 introduced a deadlock where onHostResume holds the lock on `moveToResumedLifecycleState()` then waits for the `mReactContext` lock, but at the same time setupReactContext holds the `mReactContext` lock and waits for `moveToResumedLifecycleState()` https://our.intern.facebook.com/intern/everpaste/?handle=GAgXFgLQH1ZlQikBAMQzo2LZ6h9TbiAxAAAz. The purpose of the previous diff was to make sure that detachRootoView and
setupReactContext did not interfere with each other, and implemented that by blocking on mReactContext. Since this overloads the usage of mReactContext, let's use a different lock `mAttachedRootViews` to implement this behavior instead
Reviewed By: mdvacca
Differential Revision: D12989555
fbshipit-source-id: c12e5fd9c5fa4c2037167e9400dc0c1578e38959
Summary: Depending on when Chrome debugger is attached, modules may get double registered. Simply ignore it for this case. The redbox was not a fatal error, which can be dismissed.
Reviewed By: shergin
Differential Revision: D12996107
fbshipit-source-id: 292f63102337077848842ca46b3daed08b1cae12
Summary:
it's possible that moduleForName won't return anything, so we should return.
Created from Diffusion's 'Open in Editor' feature.
Reviewed By: spredolac
Differential Revision: D12963342
fbshipit-source-id: c059595a68bfcaa38221e05fb62d70cc29887ca7
Summary: Trivial diff to include copyright header into ContextUtils class
Reviewed By: achen1
Differential Revision: D13001556
fbshipit-source-id: 439f25647a094485381637ea2b59f62962b9c1ac
Summary: In the previous approach, when event emitter got disabled for split second, we could lose the EventTarget because JS GC can collect it before we re-enable this. Now we "over-enable" this first, and "under-disable" later.
Reviewed By: mdvacca
Differential Revision: D12990112
fbshipit-source-id: 4e3c0c0e05f03509ec72ca570f59ce16597353f0
Summary: Using strings to refer to Native Modules and View Managers in ReactPackages are prone to error. The compiler replaces the constants with the actual strings anyway, so using constants gives us better type safety
Reviewed By: achen1
Differential Revision: D12843649
fbshipit-source-id: 7a7c6c854c8689193f40df92dc8426a3b37f82c8
Summary: ShimmeringView is called: RTShimmeringView Android and ShimmeringView in iOS. This diff adds a mapping into ComponentDescriptorRegistry to temporary enable ShimmeringView component until we can unify names in JS.
Reviewed By: sahrens
Differential Revision: D12991351
fbshipit-source-id: 48e08b8021116221ccfd5f2512c76f65145baa2a
Summary:
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->
**Summary**
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
This is an updated followup from https://github.com/facebook/metro/pull/280, which we would still need to address the following assumptions about `/assets/`:
e7deea1900/packages/metro/src/Server.js (L332)e7deea1900/packages/metro/src/Server.js (L379)e7deea1900/packages/metro/src/Server.js (L385)
As pointed out by gdborton, there isn't currently a way to make this a configurable option. I am not certain how to find a proper workaround for `processRequest`.
We found a temporary solution to have our express app pick up serving the assets from a publicPath as a middleware. But the change in this PR is still necessary to get it working fully.
**Test plan**
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->
- Will add tests once we figure out a comprehensive solution
Pull Request resolved: https://github.com/facebook/metro/pull/299
Reviewed By: rafeca
Differential Revision: D12939229
Pulled By: mjesun
fbshipit-source-id: 769c23468c5ac434f8319e5e7caaf46dd6453f2d
Summary: Remove `force_static=true` from cxxreact:bridge, add dependencies to targets that were pulling them in from a statically linked cxxreact:bridge.
Reviewed By: mhorowitz
Differential Revision: D12914861
fbshipit-source-id: ff335b70e80d014538a8d5dc8c0bb7b095e7940e
Summary:
It does not supported on Android and nobody uses it.
I could find only one use cases: Very old versin of `SectionList` library (4 years ago).
Reviewed By: sahrens
Differential Revision: D12972361
fbshipit-source-id: a5dfef5e877e996adec2d4941417b4a2e727cfb7
Summary:
This was failing due to issues with refs, which we were able to fix and then finally due to some jest tests that were failing due to things being null that shouldn't be which I couldn't easily figure out. Reverting the stack until we can actually solve it, hopefully with additional tests.
This was created by running:
```
$ hg backout c2fe2c46e538
fetching tree '' b9bbfc1925c6daf85ba3227d12f177aca9c0c054, based on 4257c76aefa84aaa17279e65aa7ca1174f4401e7, found via 02368b670953
connected to hg015.frc2.facebook.com
60 trees fetched over 2.91s
fetching tree '' c3c304df13399f0f1a29a668242da454fc1d8a97, based on b9bbfc1925c6daf85ba3227d12f177aca9c0c054, found via c2fe2c46e538
7 trees fetched over 0.03s
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
commit 4270328:50a65c5c2e27 backs out commit 4266783:c2fe2c46e538
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.57s
[twsvcscm@sandcastle3265.ftw1 /data/sandcastle/boxes/instance-ide/xplat/js (50a65c5)]$ hg backout 02368b670953
fetching tree '' a46c8ca065f5b92cf375d7ed899fc5ca268ba4da, based on b9bbfc1925c6daf85ba3227d12f177aca9c0c054, found via bade4285eafb
connected to hg024.frc2.facebook.com
27 trees fetched over 3.21s
fetching tree '' 361548a090e81d18bab6f4fc16036c518cb4d7c1, based on a46c8ca065f5b92cf375d7ed899fc5ca268ba4da, found via bade4285eafb
41 trees fetched over 0.10s
merging react-native-github/Libraries/Components/TextInput/TextInput.js
8 files updated, 1 files merged, 0 files removed, 0 files unresolved
commit 4270329:dbaca0daf0ac backs out commit 4266782:02368b670953
14 files fetched over 7 fetches - (14 misses, 0.00% hit ratio) over 1.72s
[twsvcscm@sandcastle3265.ftw1 /data/sandcastle/boxes/instance-ide/xplat/js (dbaca0d)]$ hg backout bade4285eafb
connected to hg030.frc2.facebook.com
fetching tree '' 1b4a17164fdbfcad40139e46da4a9bfa8aa8def3, based on 361548a090e81d18bab6f4fc16036c518cb4d7c1, found via 5cfb25344385
7 trees fetched over 0.06s
merging react-native-github/Libraries/Components/TextInput/TextInput.js
20 files updated, 1 files merged, 0 files removed, 0 files unresolved
commit 4270330:2951740e5b32 backs out commit 4266781:bade4285eafb
33 files fetched over 14 fetches - (33 misses, 0.00% hit ratio) over 4.50s
[twsvcscm@sandcastle3265.ftw1 /data/sandcastle/boxes/instance-ide/xplat/js (2951740)]$ hg backout 5cfb25344385
connected to hg035.frc2.facebook.com
merging react-native-github/Libraries/Components/TextInput/TextInput.js
0 files updated, 1 files merged, 2 files removed, 0 files unresolved
commit 4270331:fffb4629a397 backs out commit 4266780:5cfb25344385
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 4.03s
```
Reviewed By: yungsters
Differential Revision: D12989604
fbshipit-source-id: 703a7c9c1f5bdd710077e515bdff06fdb34502ec
Summary:
Fixes `react-native/no-inline-styles` warning for several examples. I'm limiting the size of this PR to make it simpler to review.
Pull Request resolved: https://github.com/facebook/react-native/pull/22123
Reviewed By: RSNara
Differential Revision: D12929701
Pulled By: TheSavior
fbshipit-source-id: 7a976f2208b557fcfda46d5b586b30652c550eb2
Summary:
Older versions of JSC (ios 11 and before) have a bug which I
believe the ProtectionQueue mechanism tickles:
https://bugs.webkit.org/show_bug.cgi?id=186827
This removes the ProtectionQueue and replaces it with an atomic flag
to avoid calling unprotect after VM shutdown.
This also fixes a race condition in shutdown.
Reviewed By: danzimm
Differential Revision: D12969953
fbshipit-source-id: fa3a14f3207be67a987ac3cf0fc1c9ce88837b0b
Summary: This diff exposes rootTag as part of SchedulerDelegate.schedulerDidRequestPreliminaryViewAllocation(). This will be necessary to be able to pool views per Surface in Android
Reviewed By: shergin
Differential Revision: D12875656
fbshipit-source-id: d2a8c1f9bcc6b14c17b34bf59085da44ae3c3416
Summary:
This diff refactors the exeuction of 'AsyncEventBeat.induce()' as part of the delivery of events of Fabric Android implementation.
The first part of the refactor moves the exeuction of onBatchEventDispatched out of the synchronization block for mEventsToDispatchLock. This lock is accessed from the UI Thread and executing the induce inside this synchronization block will affect UI,
The second part of the refactor is to ensure that the exeuction of the C++ method AsyncEventBeat.induce() always happen in the JS Thread.
Reviewed By: shergin
Differential Revision: D12861387
fbshipit-source-id: e1cd03467274a1c5fcd04b0ac7efdbe7169b14c3
Summary: This diff adds systrace support in the C++ side of Fabric
Reviewed By: ejanzer
Differential Revision: D12861373
fbshipit-source-id: 0291f3e406f239bbef3686ac0bba6e9f1c7eac57
Summary: This diff ensures that JS uses rootTags during navigation. A redbox will be rendered in debug mode when a non-rootTag is used during navigation. This change enables proper navigation for Fabric.
Reviewed By: shergin
Differential Revision: D10855198
fbshipit-source-id: a82aaa706cd62ce92143fa86d0a422c1ae439a50
Summary: AndroidSwipeRefreshLayout is rendered in the "Marketplace Your Items" screen altough it is disabled. This diff just temporary implements the AndroidSwipeRefreshLayout component as a View (similar to the iOS counterpart RefreshControl).
Reviewed By: shergin
Differential Revision: D10524049
fbshipit-source-id: 5df38fbdf1339b3857138d82a7100ec7f15854b3
Summary: This diff fixes exception handling for Mounting of views, as soon as there is an exception we stop the mounting of views because from that point the UI View tree is going to be inconsistent with the ReactShadow tree from C++. We also stop the mounting of views when the host is paused, this allows us to not keep mounting views
Reviewed By: shergin
Differential Revision: D10510334
fbshipit-source-id: b0d3eba580ff92d8b8400244ec9d7c266db42ff9