Summary:
LocalData isn't used by any components. We've moved towards State.
Changelog: [internal]
Reviewed By: mdvacca
Differential Revision: D19250732
fbshipit-source-id: dd23a723c5392632165798f6365ea107b37b54cd
Summary:
LocalData isn't used by any components. We've moved towards State.
Changelog: [internal]
Reviewed By: mdvacca
Differential Revision: D19250603
fbshipit-source-id: f95da375117dcb8f6540a6c75d3a80bba630672c
Summary:
Adds a bare minimum test that verifies correct behaviour of `getRelativeLayoutMetrics`.
Changelog: [internal]
Reviewed By: shergin
Differential Revision: D19449128
fbshipit-source-id: afde997a770921d580575eb0cdd04fce6252cb5a
Summary:
# Logs
```
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 0 tag: 1432 debugValue: r1
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r2
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r2
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 0 tag: 1432 debugValue: r1/sealed <----------------- FIRST TAP
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 0 tag: 1432 debugValue: r1/sealed <----------------- FIRST TAP
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r4
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r5
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r6
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r7
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r8
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 375 tag: 1432 debugValue: r7/sealed <----------------- SECOND TAP
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 375 tag: 1432 debugValue: r7/sealed <----------------- SECOND TAP
```
# What’s happening here?
Opening a *BottomSheet* and tapping the first item. As you can see before the item is tapped, it has *width* set to 375 in revision *r2*.
When the tap happens, JavaScript is requesting an old revision of ShadowNode, which still has width 0.
# My assumption.
1. Native creates node with *width* 0 and returns handle to *JS*.
2. Native *clones* the node, sets its *width* to 375, doesn’t tell *JS* about it. This update is due to state change.
3. *JS* tries to get the size of the node, but asking for first revision of the component it receives width 0.
# Other observations
1. Manually setting width to 375 in UIManager::getRelativeLayoutMetrics fixes the problem.
2. This happens only on device, I wasn’t able to reproduce this on simulator.
# Fix
Find the newest revision of ShadowNodeFamily, and return its layoutMetrics.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19433873
fbshipit-source-id: 4558cf6e704051e9b3968e83821d8d25b3dadcda
Summary:
# Problem
The issue is in implementation of `LayoutableShadowNode::getRelativeLayoutMetrics`.
If you have view tree (A has a child B), and you call `B.getRelativeLayoutMetrics(A)`, the expected result is B's origin within A. The implementation wasn't reflecting that, it was reflecting B's origin within A + A's origin within its parent.
# Fix
When iterating over ancestors of ShadowNode, the last ancestor should be skipped.
AncestorList is a list that starts with provided ancestor and ends with parent of `this`. To skip provided ancestor we iterate to `rend() - 1`.
# Why does it work in some cases?
This function is triggered from `UIManager.getRelativeLayoutMetrics` without `ancestorShadowNode` provided, we find the RootShadowNode, which has origin `{0, 0}`.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19447900
fbshipit-source-id: 4a9606dc1fab3fecfb85d337b014188d80e5b355
Summary:
Changelog: [Internal]
Refactor the setup code for tests to a single place.
Now there is fixed set of nodes where we test different methods of ShadowNode.
Reviewed By: shergin
Differential Revision: D19464966
fbshipit-source-id: 749e9f56ac2e5489647885b2ddcb1309eb20909a
Summary:
Changelog: [Internal]
1. Replace ASSERT_* with EXPECT_*. Assert is a fatal assertion. Expect is non-fatal assertion. So if assert fails, tests do not continue and therefore provide less information.
2. Rename tests in `RawPropsTest.cpp` from `ShadowNodeTest` to `RawPropsTest`.
Source: https://github.com/google/googletest/blob/master/googletest/docs/primer.md#basic-assertions
Reviewed By: shergin
Differential Revision: D19464967
fbshipit-source-id: add83751ebdb0a12fbf8f70b851747aa5624366a
Summary:
This fixes a crash caused by a `JSError` exception not being successfully caught in a different dynamic library from where it was thrown. Since the libraries were compiled with hidden symbols and loaded with `RTLD_LOCAL`, the exception typeinfo becomes unique to each module.
Reading on this subject:
https://gcc.gnu.org/wiki/Visibilityhttps://stackoverflow.com/questions/14268736/symbol-visibility-exceptions-runtime-error
Reviewed By: mhorowitz
Differential Revision: D19343161
fbshipit-source-id: 4eb3bc2576bbcca2c3aef4f52b5a27dfde214c6a
Summary:
In bridgeless mode, `RCTTurboModuleManager` is initialized with a nil bridge. This has mostly worked, since `RCTBridge` doesn't do too many things for TMM (some notifs and perf markers). The one important thing it provides is a `_jsInvoker`.
In bridgeless mode, up until this point `_jsInvoker` has been nil, and turbo modules were not able to call functions on the JS thread. This diff fixes that.
Reviewed By: RSNara
Differential Revision: D19437174
fbshipit-source-id: 86bfc0a47bd9576e7d3203b860e86446eb0b63dd
Summary:
Changelog: [Internal] Upgrade Chrome devtools protocol for Hermes
Update to the most recent version of the devtools protocol, r730699.
This just adds a few parameters to the stable API.
They have reasonable defaults that shouldn't break the existing functionality.
Reviewed By: willholen
Differential Revision: D19387559
fbshipit-source-id: 49d9ebf4a1a20f349ea6e46be6d5f36184ba8afb
Summary:
Changelog: [Internal]
Before, we were relying on checking out the `devtools-protocol` Github repo at a specific commit and
making special changes to the JSON file.
In order to make it easier to update, use the officially published npm package.
I found the closest package version that was published, but it had two differences:
* `Runtime.getHeapUsage` was either missing (in earlier versions) or experimental (in later versions)
* `isDefault` and `isPageContext` were removed. I'm not sure what these were used for anyway, the comment leads me to believe they're probably not necessary anymore
There were some customizations made previously to annotate `recursive` on some properties. The npm package doesn't set these,
so I wrote some checks to add it back in if it can be detected. This was mostly to handle one special case: `Runtime.StackTrace`.
The workaround seems to be fine for that case.
Reviewed By: willholen
Differential Revision: D19386890
fbshipit-source-id: db0d85f6bc71cba77ee67d85efe2f38376d7cc87
Summary:
Changelog: [Internal]
This separate `.flowconfig` file was causing versioning issues.
Delete it so that `msggen` can share the same flowconfig as the rest
of React Native.
Reviewed By: willholen
Differential Revision: D19413710
fbshipit-source-id: 748cb50a3151df1c67ee7176e57e259e48f50be7
Summary:
interop layer doesn't deal with `nil` being sent as event, example https://fburl.com/diffusion/t5zx6xm0.
This later triggers following assertion https://fburl.com/diffusion/dr5xzgic.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19309356
fbshipit-source-id: 82b3841c337f949ce7ca0b875c98f608edddb599
Summary:
This is C++ part of the implementation of Fabric-compatible <TextInput> component on iOS.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: JoshuaGross
Differential Revision: D19169987
fbshipit-source-id: e2eac9beac6d1e124b5176b4a23676b8e05490c3
Summary:
ImageState if created with default constructor is created with `imageRequest_` being nullptr.
Calling `getObserverCoordinator()` on it was causing a crash.
We create initial state data with `imageRequest` populated.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19332711
fbshipit-source-id: 0266222551dbfb10b3f86e72a43d5306650fd09b
Summary:
On Android/when printing to logcat, output is truncated to a certain max length; outputting a massive string as a single log item will cause some of it to be truncated. In the case of the mutations list and shadow node description, most of it is truncated.
Easy fix: split into lines and log each line. This isn't necessary on iOS but works fine.
I also removed the conditional and changed to an assert. Most of the time when we're using this block of code, it's because we want to see all mutations; and unless we reintroduce a bug into the core, the assert is never hit and so (before this change) the conditional would never be true and we'd never see this output. It's more generally useful to be able to see this output if the `RN_SHADOW_TREE_INTROSPECTION` macro is defined.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D19378929
fbshipit-source-id: 2f5dffeef7608823ac1ba092090d8c2ab5e965e1
Summary:
Changelog: [Internal]
We are moving away from LocalData in favour of State.
Reviewed By: shergin
Differential Revision: D19250592
fbshipit-source-id: 6d2eef9a0c0e53e0146da609ba0c24fa09766433
Summary:
Changelog: [Internal]
We are moving away from LocalData in favour of State.
Reviewed By: shergin
Differential Revision: D19247031
fbshipit-source-id: 8884133b13dd111e8d9e2cd4936bf90bfc5b4932
Summary:
It is time to target SDK version 10.0+.
Changelog: [iOS] [Deprecated] - Deprecating support for iOS/tvOS SDK 9.x, 10.0+ is now required
Reviewed By: mdvacca
Differential Revision: D19265731
fbshipit-source-id: 93b6f9e8f61c5b36ff69e80d3f18256aa96cc2c0
Summary:
We see some asserts firing inside the Shadow Tree introspection.
While we are investigating what exactly went wrong it's better to disable that to stop bleading.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D19256449
fbshipit-source-id: 9920392996a00879043d9516e5bc189a1c806ead
Summary:
This diff removes the findShadowNodeByTag_DEPRECATED method from class UIManagerBinding. This method was created on D17175953 to implement findNodeHandle in Fabric. Recently we decided that we don't need to expose findNodeHandle anymore. This diff cleans up thi code.
Changelog: [internal]
Reviewed By: JoshuaGross
Differential Revision: D19216996
fbshipit-source-id: 07c16aeed28851afc09b0f5d6be338bb4440f813
Summary:
This diff implements the findNodeAtPoint API into UIManagerBinding to allow JS to call this method
changeLog: [Internal]
Reviewed By: shergin
Differential Revision: D19190284
fbshipit-source-id: 3a65a2238f964ce031b12c8cf264cdacb6cc8f2e
Summary:
This diff implements the findNodeAtPoint method to return the ShadowNode that is positioned into a Point of the screen.
What's not supported:
- Scroll position
- Transform
- return layoutable nodes that are contained inside a non-layoutable node
Changelog: [internal]
Reviewed By: shergin
Differential Revision: D19190285
fbshipit-source-id: fdc0358dc21312e9950a4eb16c36020e9e43e33f
Summary:
This diff extends Geometry class with methods to substract points and to determine if a Rect contains a Point or not
Changelog: [internal]
Reviewed By: sammy-SC
Differential Revision: D19190283
fbshipit-source-id: 7c7dd73be2cd644081ed9af8eeef7e137c618ae4
Summary:
This diff exposes eventTarget on the EventEmitter API
Changelog: [internal]
Reviewed By: shergin
Differential Revision: D19190281
fbshipit-source-id: 00dc8cf64f42b1fe176ecb7beefad59e61bd53ca
Summary:
This diff changes the signature of ComponentDescriptor constructor to make it simpler and easier to support: now all arguments are passed via struct that contains all these arguments as fields.
Now the ComponentDescriptor constructor accepts three arguments one of which is optional. This causes some confusion and the possibility of bugs in all subclasses that needs to implement a custom constructor. Mostly because in every case we need to ensure that the constructor:
* Accepts and pass down all parameters/arguments;
* Accepts the right types of those parameters (shared vs weak pointers, references vs values).
* Accepts all thee arguments and pass them (including flavor!). We failed this point several times.
Overal that makes the code simpler and allows changing the set of parameters relatively easy. (There is no plan for it!)
Look at the LOC balance: less code!
Changelog: [INTERNAL]
Reviewed By: sammy-SC
Differential Revision: D18548173
fbshipit-source-id: 5d038b135e004f6c054026b3235ed57db99c086d
Summary:
If building a JSError causes a JSError, this would lead to infinite recursion. This changes the error handling path so the problem is visible to JS. There's also a few related cleanups included, and a new test case.
Changelog: [General] [Fixed] - If Error global is not callable when building an error, jsi will throw a JS exception back to JS code. #158
Reviewed By: tmikov, dulinriley
Differential Revision: D18796269
fbshipit-source-id: 57a45d144fa2ea5e78d18c27d3130611737dda96
Summary:
GitHub still marks some dependencies as vulnerable. Updating them.
Changelog: [Internal]
Reviewed By: avp
Differential Revision: D19183702
fbshipit-source-id: 9c9c815816c4fc591c77d811058234a63aeda727
Summary:
As part of the plan is splitting ShadowNodeFragment into two parts. ShadowNodeFamilyFragment is already in place. This diff removes use of `ShadowNodeFragment::eventEmitter` and goes over all call sites to change it to `ShadowNodeFamilyFragment::surfaceId`.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19146697
fbshipit-source-id: 22cae5404b0f3098feb86c0437a4aa256d5b773e
Summary:
As part of the plan is splitting `ShadowNodeFragment` into two parts. `ShadowNodeFamilyFragment` is already in place. This diff removes use of `ShadowNodeFragment::surfaceId` and goes over all call sites to change it to `ShadowNodeFamilyFragment::surfaceId`.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19115785
fbshipit-source-id: 5972332c3360b88ca935581ed36070f26e678b22
Summary:
As part of the plan is splitting `ShadowNodeFragment` into two parts. `ShadowNodeFamilyFragment` is already in place. This diff removes use of `ShadowNodeFragment::tag` and goes over all call sites to change it to `ShadowNodeFamilyFragment::tag`.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19115781
fbshipit-source-id: 6ab3464a063c220d0924bf5a69b75449ca178650
Summary:
`msggen` has dependencies on some npm packages with vulnerabilities.
This diff updates the dependency list.
Changelog: [Internal]
Reviewed By: avp
Differential Revision: D19107926
fbshipit-source-id: 0526f6fe430c162322ec9ecb84f3d78604cd76bc
Summary:
Having automatic defaults/an optional arg for `convertRawProp` has caused way more problems than it is worth. Remove the default argument.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19151594
fbshipit-source-id: 839ec8d138b2c3c083f221a2871582454004648c
Summary:
This implements propagation of ScrollView's contentOffset value on Android. That allows `LayoutableShadowNode::getRelativeLayoutMetrics` (and some measure functions) return values that take that info into account.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: mdvacca
Differential Revision: D19027433
fbshipit-source-id: 023ff9642d023971b3d24d5cc5f7c2f4b443031e
Summary:
This diff re-enables propagation of ScrollView's content-offset value down to the ShadowTree layer and enables measure fucntions opt-in incorporating this info to result.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: zackargyle
Differential Revision: D18981891
fbshipit-source-id: a6c0f4e690703b0ee07d45efab161750cfcc4b60
Summary:
This diff reverts D15908765 where we disabled the introspection feature because we were afraid that it leaks into prod because of some sort of misconfiguration. Seems that wasn't the case.
We need to re-enable this to get some signals if it's broken.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: JoshuaGross
Differential Revision: D19104526
fbshipit-source-id: 696c0e68bb858da270dbbb5da11032e664d75659
Summary:
We used that on iOS only before we had `ComponentDescriptorProviderRequest`. Now iOS does not use `_fallbackComponentDescriptor`.
On Android we still use `_fallbackComponentDescriptor` but set that explicitly via `ComponentDescriptorRegistry::setFallbackComponentDescriptor`.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D19103296
fbshipit-source-id: fb2a2142afb183145fd3c8e48f620cb3f316c0bb
Summary:
Added basic hook to enable image instrumentation. The hook passes information to the existing image loader, where instrumentation is done, specific for each app, if any.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D19047899
fbshipit-source-id: 6c013806cce98bcf1ea240d696a7ede9697e5cd9
Summary:
The `RCTImageURLLoaderWithAttribution` protocol historically only returns a cancellation block to cancel the url request. But for more complex instrumentation, we may need to associate a requestId for the specific URL request. To do this, the protocol now returns an object that has both the unique ID and the cancellation block, so that instrumentation logic can refer to the ID in the future.
Note that the `RCTImageURLLoader` protocol is unchanged, because the request ID is only relevant for instrumentation purpose.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D19047900
fbshipit-source-id: cd029f2470c32fc7bffd674b09a5353fe1dbc80b
Summary:
Motivation: in Marketplace, there's a TextInput in JS that sends { lineHeight: null } to C++. In Paper this was correctly handled as a default value, which just causes that property to not be set. In C++ in Fabric, it was being parsed incorrectly as 0 (because of incorrect defaults being passed into `convertRawProp`), causing the text to not be visible at all. The solution is to make sure that its default value is NaN, which is handled correctly, and causes the Text to render again.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19128049
fbshipit-source-id: fe985428f3ed8b90d56cfa387fbc2d1476d19d36
Summary:
The coefficients in the code were incorrect: the default value of the scale should be 1, not 0.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sahrens
Differential Revision: D19101221
fbshipit-source-id: 3b4c3afc692ddb6bf32bf2344a77ec5ca34a06e4