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 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: Before lazily-loading code existed, modules that were already loaded into memory took precedent over modules that were additionally registered. With lazily loading modules, instead of giving eagerly loaded modules precdence, it throws a redbox. This diff fixes that behavior.
Reviewed By: PeteTheHeat
Differential Revision: D12983805
fbshipit-source-id: fe4fcf35d5c2ca6f9f4e3f0d1d8c2ca35468fb1b
Summary:
Previously, asking for an instance of NativeModule from the native side gave `nil` if the lazy modules have not been loaded, which is not consistent with the access from JS. This at least attempts to force load the lazy modules when asked from native.
p.s. one asks for a module by doing `[bridge moduleForClass:[FooBar class]]`.
Reviewed By: spredolac
Differential Revision: D12931640
fbshipit-source-id: 15d2dc574067d3386ef921512ce4bc837749dabd
Summary: Trivial. We don't use it anymore.
Reviewed By: mdvacca
Differential Revision: D12876743
fbshipit-source-id: dc979aaea1fef443b8caf2e58d44b0c7aad90246
Summary:
We double down on JSI in Fabric. So, practically, JSI is now a hard dependency for Fabric. I hope it's for good.
Now `jsi::Runtime` is coupled with scheduling via `EventExecuter`, so we have to make `jsi::Runtime` a part of `EventBeat` to proxy runtime reference to bindgings.
Reviewed By: sahrens
Differential Revision: D12837225
fbshipit-source-id: 98edc33d6a3358e6c2905f2f03ce0004a9ca0503
Summary: Now we use RuntimeExecutor instead of MessageQueue; that's more clear and remove a dependency from Bridge.
Reviewed By: sahrens
Differential Revision: D12837226
fbshipit-source-id: 0ea3782ce2f49c7f3a91425880863e3b3ea37712
Summary:
It works great on iOS, and mostly works on Android, and is now OTA'able as part of the screen config! Haven't done template view yet. One remaining issue:
Layout is borked on Android. I'm guessing the issue has to do with the timing of setting the constraints in `updateRootLayoutSpecs` and calling `mBinding.startSurface` which actually builds the shadow tree. If I try to call `updateRootLayoutSpecs` earlier, it just crashes immediately. Here's the layout it spits out, which clearly has -440 for the x of 420006, which is the RCTText component, causing it to get cut off on the left of the screen:
```
updateLayoutMountItem for reactTag: 420006 x: -440, y: -13, width: 931, height: 78
updateLayoutMountItem for reactTag: 420010 x: 26, y: 79, width: 0, height: 1651
updateLayoutMountItem for reactTag: 420012 x: 0, y: 26, width: 0, height: 158
updateLayoutMountItem for reactTag: 420016 x: 0, y: 210, width: 454, height: 454
updateLayoutMountItem for reactTag: 420018 x: 454, y: 210, width: 455, height: 454
updateLayoutMountItem for reactTag: 420022 x: 0, y: 690, width: 454, height: 454
updateLayoutMountItem for reactTag: 420024 x: 454, y: 690, width: 455, height: 454
updateLayoutMountItem for reactTag: 420028 x: 0, y: 1171, width: 454, height: 454
updateLayoutMountItem for reactTag: 420030 x: 454, y: 1171, width: 455, height: 454
updateLayoutMountItem for reactTag: 420032 x: 0, y: 1651, width: 0, height: 0
```
Reviewed By: mdvacca
Differential Revision: D12813192
fbshipit-source-id: 450d646af4883ff25184141721351da67b091b7c
Summary:
D12904277 was my sad, optimistic attempt to fix this crash.
As @[100006577537606:Slobodan] mentioned on T35879909, the real issue is that moduleRegistry is being created (using _moduleDataByID dict) concurrently while we try to append to this dict.
I added locks around these usage of _moduleDataByID.
Reviewed By: fkgozali
Differential Revision: D12911108
fbshipit-source-id: 2435b7a477c27585898f351c4a0d4c1bd4056756
Summary:
T35879909 is a UBN caused by a race condition in RN initialization. I haven't been able to repro, but the crash logs point to a bad memory access in this method. Another thread must be deallocating something concurrently.
This is a quick fix to patch into v197.
Reviewed By: fkgozali
Differential Revision: D12904277
fbshipit-source-id: 5740183f9a7c8f2c45ca627662891cb0c1048764
Summary:
@public
This allows apps to specify custom lazy modules that they need to load during chrome debugging. This is because lazy modules won't be available on start up, hence these modules will be missing in JS land, causing problems.
Reviewed By: shergin
Differential Revision: D12899408
fbshipit-source-id: dca313648e994b22e3ee5afec856ef76470065f9
Summary: Simply changing RCTLogWarn() to RCTLogInfo(), since some modules can be loaded without explicit export (experimental).
Reviewed By: mdvacca
Differential Revision: D12899442
fbshipit-source-id: 524d345265eda4a601101d878d51c244a8441fb5
Summary: Adds copyright headers to all files that are missing them.
Reviewed By: hramos
Differential Revision: D12837494
fbshipit-source-id: 6330a18919676dec9ff2c03b7c9329ed9127d930
Summary:
Fix the lazily LaodedView to avoid weird naming issues
This makes more sense. i would like to not have this suffix Manager at all in play, but it is possible that some of the names should be tweaked for that. Since TurboModule is coming we should probably not invest in that removal.
Reviewed By: dshahidehpour
Differential Revision: D12831482
fbshipit-source-id: 1cc557cf0bdfaca35032f75823b2facb778dc3ac
Summary:
This diff introduces a new integration concept (called RuntimeExecutor) which consolidates `Runtime` and the dispatching mechanism.
As simple as that:
`using RuntimeExecutor = std::function<void(std::function<void(facebook::jsi::Runtime &runtime)> &&callback)>;`
Reviewed By: fkgozali
Differential Revision: D12816746
fbshipit-source-id: 9e27ef16b98af861d494fe50c7e50bd0536e6aaf
Summary:
Fixes#20302 (For iOS)
Note:
------
1. Checked the changes did not break CocoaPods integration.
2. The change for glog copying header into exported/ is to prevent build break for folly.
`folly/detail/Demangle.h` will try to use libstdc++'s demangle.h. Unfortunately, glog also has a demangle.h in source code. So I copy exported headers and only search headers in exported/ folder during build.
Pull Request resolved: https://github.com/facebook/react-native/pull/21976
Reviewed By: hramos
Differential Revision: D12818131
Pulled By: fkgozali
fbshipit-source-id: b3c637d09d1b3adde0ea15c82eb56e28f846885b
Summary:
While debugging internally, we have found that modules are almost always registered
with their "RK" or "RCT" prefixes dropped.
However, if a view is named `RCTFooView` and needs `RCTFooViewManager` to render natively, it will almost never find it because `RCT` was dropped from the key to the ViewManager instance.
In the event you look for a `ViewManager` and don't find it, this strips any "React" prefixes from your key and tries ones more time.
Reviewed By: spredolac
Differential Revision: D10734005
fbshipit-source-id: 2bfa6f19830f14f09af2fe7dc7e44b7e26e0ac3f
Summary:
This class contains metrics about RN bridge startup that was being sent via FBAnalytics.
This diff refactors out any timespans being collected into a separate method. This refactor is NOT ENOUGH to format the data into a format QPL accepts. I still need to refactor these timespans into _start and _end points for QPL points to work correctly. This diff is a starting point.
Reviewed By: ejanzer
Differential Revision: D10466982
fbshipit-source-id: 4bc1159c4e53328f2252a8c606c8d6ff8d657489
Summary:
[RN] Relax the requirement that lazy module cannot be initialized on the main thread
I tried to understand the D5364734 that intoduced this, and I am not sure, but belive that asserting here is too strict. If you have a module that you want to lazily initialize, and module does not demand the main queue, it should be just a warning if you run on the main queue, not necessarily an error.
Reviewed By: mmmulani
Differential Revision: D10429880
fbshipit-source-id: 018c211d45b98dd8c552bf0289fe517d05e56d47
Summary:
Marc deleted a few files from react-native-github, so I removed them from the RNTester XCode project. I also included the files he created, and created new targets: `jsiexecutor-tvOS`, `jsiexecutor`, `jsi`, `jsi-tvOS`.
**Note:** The tvOS build of RNTester is broken in this diff because of a few `WKWebView` changes I landed earlier. D9844322 includes the fix.
Reviewed By: axe-fb
Differential Revision: D9875409
fbshipit-source-id: 31a9f241a524de91e78dfff0555aec5d1373d789
Summary:
JSI+JSCRuntime replaces direct use of JSC. This is like the previous
diff, except for iOS.
Reviewed By: RSNara
Differential Revision: D9369108
fbshipit-source-id: 4ed2c0d660ba2a30edf699d95278c72cabcc9203
Summary:
change RCTCxxBridge to use JSIExecutorFactory+JSCRuntime
instead of JSCExecutorFactory. Also remove JSC usage from RN in other
files. This allows deleting files, too, which is done further down
the stack.
Reviewed By: RSNara
Differential Revision: D9369111
fbshipit-source-id: 67ef3146e3abe5244b6cf3249a0268598f91b277
Summary: The code fragment `super.accessibilityLabel` always meant "use stored value which came from Props". But after we override the implementation of this getter in the base class, this starts working differently (wrong). This change basically reverts that to original intent.
Reviewed By: sahrens
Differential Revision: D10350597
fbshipit-source-id: 913951eb08c4ede76fc0e9be76b48d86599bcc62
Summary: Empty string in AccessibilityProps basically means same as `nil` in iOS Accessibility API.
Reviewed By: sahrens
Differential Revision: D10350596
fbshipit-source-id: fad9cdc914388c72e1b8261b27f14cbfa9a037db
Summary: We didn't have support for them... and now we have it.
Reviewed By: sahrens
Differential Revision: D10280430
fbshipit-source-id: 7275d4617ed3994366f673a17c24b823293d7092
Summary:
This diff fixes previously broken custom border rendering.
We need a dedicated CALayer for border bitmap in order to fully support all UIView capabilities in case if some subclass uses that. Otherwise, any call of `drawRect:` method can override any content which is stored inside `contents` property of CALayer.
Q&A:
How does it work in current RN? - It does not. All `drawRect:` methods in RCTView subclasses are dysfunctional.
How does text view work in current RN? - RCTTextView does not inherit RCTView, so it does not have this problem.
How does text view support custom borders in current RN then? - It does not.
Reviewed By: PeteTheHeat
Differential Revision: D10228805
fbshipit-source-id: 22bc31f41ab1914a97f3a5981cd1b24ebca725cd
Summary:
Fixes#20774
The new Xcode build system uses parallel execution to run build steps that don't have an obvious dependency. Our Xcode project was written with the assumption that the **Install Third Party** build step is run _before_ compiling the `third-party` libraries. To address this issue, this PR adds dependency information to the project to teach Xcode that `ios-install-third-party.sh` is generating the files under `third-party`. With this additional information, Xcode correctly waits for `ios-install-third-party.sh` to finish before advancing to the compile step.
In addition to the Xcode project changes, I had to make some changes to the script `ios-install-third-party.sh` so that
1. it would always execute the `ios-configure-glog.sh` script regardless of how it was invoked
2. it would always install the libraries even if Xcode had partially created the tree or if a previous install was interrupted
Pull Request resolved: https://github.com/facebook/react-native/pull/21458
Differential Revision: D10365495
Pulled By: hramos
fbshipit-source-id: c88042583f21d2447a16f6ae2b6abb929c659a26
Summary:
Size constraints are essential part of the running Surface, decoupling them from starting process means that we will have to perform additional commit later.
This and previous couple diffs fix a problem with initial zero size of the surface and following visible "jumpy" relayout.
Reviewed By: sahrens
Differential Revision: D10174280
fbshipit-source-id: 0ec48692cb814fd46cc3a1d044c5eb8ab9ecb031
Summary:
New `ShadowTree::synchronize` method allows to perform operations on ShadowTree without a risk of an unsuccessful commit. To make it happen, the `commitMutex_` is now recursive and `synchronize` acquires it before calling the callback.
Using that we finally can implement reliable `constraintLayout`.
Reviewed By: mdvacca
Differential Revision: D10174281
fbshipit-source-id: 9864ebb5343d40e2da205272a834710f0ab730db
Summary:
Setting the right expectations: setting layout constraints might fail. Nothing really changed.
Implementing a reliable `constraintLayout` which locks instead of returning immediately requires some additional work and new/additional API.
Reviewed By: mdvacca
Differential Revision: D10159457
fbshipit-source-id: bb23c7de105629ef086ae0b04667ff32c6ffb81d
Summary:
This adds a synchronous method that JS can call to load view managers.
Notably, we don't have an exact way to go from a JS name to the native view manager, so this naively adds 'Manager' to the end.
After lazily loading the view, it makes sure to cache all its values in native and JS, as further calls from JS will fail.
Reviewed By: PeteTheHeat
Differential Revision: D10204314
fbshipit-source-id: ebf42a85dcc467f3b4c5d6e18e49e04f9e8aa4f9
Summary: That's why we need the previous three diffs. Synchonous executor deadlocks if the beat is missing.
Reviewed By: sahrens
Differential Revision: D10081501
fbshipit-source-id: 9986d0a1844e642048b6f37a1fcb5f623a267663
Summary:
This PR splits and renames all references of ViewAccessibility to DeprecatedViewAccessibility
Related to #21342
Pull Request resolved: https://github.com/facebook/react-native/pull/21422
Reviewed By: yungsters
Differential Revision: D10132659
Pulled By: RSNara
fbshipit-source-id: 68c371230c69ed37c3e44bf8a36043adb04afc78
Summary: The current buffer size isn't enough even to capture a short TTI trace.
Reviewed By: mhorowitz
Differential Revision: D10112538
fbshipit-source-id: 266fa6ffa916049245b21d7725a364d75589c776
Summary:
This PR fixes an obscure rendering bug on iOS for borders with asymmetric radii. It appears to be a problem with the custom drawing that React Native performs when it cannot use native UIKit/CoreAnimation border drawing.
Pull Request resolved: https://github.com/facebook/react-native/pull/21208
Differential Revision: D10130120
Pulled By: hramos
fbshipit-source-id: d9fbc5c622c060db15658d038a068216b47bb26d
Summary:
Update several files to use the proper copyright header:
```
// 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.
```
In the case of Xcode project files, I used the shortform version, `Copyright (c) Facebook, Inc. and its affiliates.`
Reviewed By: axe-fb
Differential Revision: D10114529
fbshipit-source-id: a1f2d5a46d04797c1cf281ea9ab80d3a2caa6fb4
Summary:
Don't ask.
Really, all those descriptions from official docs like below are useless:
* `__bridge_transfer` Moves a Core Foundation pointer to Objective-C with transfer of the ownership to ARC.
* `__bridge` Transfers a pointer between Objective-C and Core Foundation with no transfer of ownership
All that is totally confusing and useless. At the end of the day, we only have to think about which additional `CFRetain` and `CFRelease` ARC will add or will not add for our pointers.
So, following official docs recommendation, we would like to add `__bridge_transfer` because of course, we do want to ARC managing the variable after we introduced it to ARC here. But we also want to have shared ownership of this. That's the key. If we use `__bridge_transfer` ARC will assume that this variable already retained once (because it exists) and will call CFRelease at the end of the scope. Right before that when we pass this variable down to call stack ARC will retain and then manage the variable according to the rest of the code. But still, from this point, we will have zero-balanced reference counter; the owning by `shared_ptr` bump is already compensated with `CFRelease` at the end of the scope. As soon as the rest of the code release the object, it will be incorrectly deallocated.
So, instead of using `__bridge_transfer` we have to use `__bridge`. That will indicate that *in this block* ARC does not manage the reference counter of the variable (which is kinda true because having `shared_ptr` inside the block already retains that) and will not add `CFRelease` at the end of the block.
Reviewed By: mdvacca
Differential Revision: D10054241
fbshipit-source-id: 6e82c5270fe5d53f1ed68e167b94f70dc4367a9f
Summary: Apparently, after updating CALayer props we have to request redrowing on top of it manually.
Reviewed By: mdvacca
Differential Revision: D10053340
fbshipit-source-id: f87311399bab809c9e13a3076f526bbe3f7f3fb4
Summary:
Instead of wrapping all public methods into The controller you requested could not be found. blocks/mutexes, RCTSurfacePresenter utilizes a different thread-safety pattern where all instance variable are granularly thread-safe.
The names of all internal methods were prefixed by '_'.
Reviewed By: mdvacca
Differential Revision: D10033407
fbshipit-source-id: 97fd2879c879dd9ef8d9ece24e25af00f749a871
Summary:
There is no need to make JS calls to start or stop React Native apps; Scheduler does it automatically. Yay!
With this change (because we have to change Scheduler API) we are starting slow process migrating away from using term `reactRootTag` when we refer to running a ReactNative app (aka Surface). We will use `surfaceId` instead. We plan to slowly and gracefully retire `reactTag` term entity replacing it with several appropriate entities specific for particular usage, e.g. `viewId` (some id which makes sense for mounting), `surfaceId`, `nodeId` (unique id representing nodes which were cloned from the original one), or `eventTarget`.
Reviewed By: mdvacca
Differential Revision: D9999336
fbshipit-source-id: bbc7303c195b070b8c235c9ca35546d1dc693e98
Summary: Besides that it's more simple and straight-forward now, we need that to always instantiate Scheduler with a context full of fresh valid objects derived from the new instance of the bridge.
Reviewed By: mdvacca
Differential Revision: D9995780
fbshipit-source-id: 534a314152d93562b08dd7857962f174b0d06886
Summary:
The original design of RCTSurface implied that the Surface starts on initialization and stops on deallocation. Recently I realized that this not sufficient API in some cases when the application uses ARC with autorelease pools (that can postpone object deallocations, which is highly undesirable).
And that's simply handy to have those methods sometimes.
Reviewed By: mdvacca
Differential Revision: D9982356
fbshipit-source-id: baa3bd24804d3708606ebd00b8795f2d5c9d4de9
Summary: We call this method in a constructor before the actual object is beeing constructed, so it's incorrect; it should be class method.
Reviewed By: mdvacca
Differential Revision: D9931315
fbshipit-source-id: 304ba8e2354f3f408cfa2bf1729266525a08f951
Summary: All integration with Bridge was removed from RCTFabricSurface, now it's Surface's responsibility to start and stop JS app and register the ShadowTree in the Scheduler.
Reviewed By: mdvacca
Differential Revision: D9931317
fbshipit-source-id: 55a682f0afb1c542a904e1a8570029e4690967cc
Summary: Now we have a way to enumerate surfaces stored in RCTSurfaceRegistry.
Reviewed By: mdvacca
Differential Revision: D9931316
fbshipit-source-id: 6b886c4b52cebddf15fef0239190fb2730d682cc
Summary:
Several reasons:
* We are fulfilling a promise that RCTScheduler is just a very thin interop proxy between C++ and Objective-C;
* We have to pass all parameters down to Scheduler anyway, so instead of creating all of them separately and then passing one-by-one, we consolidate them into Context created where we have all those values.
In the future, we probably will move it to some dedicated place.
Reviewed By: mdvacca
Differential Revision: D9884892
fbshipit-source-id: f1d5744e4044bc4bdfe53ec9a97ee61dcf0c60c2