Граф коммитов

3325 Коммитов

Автор SHA1 Сообщение Дата
Xin Chen 0975e96d53 Fix transform when calculate overflowInset
Summary:
This diff fixes overflowInset calculation when a shadow node has transform matrix from a transfrom prop in JS. Specifically, this fixed the use case when transform directly used on a view component. When using Animated.View, it will create an invisible wrapper which will behave correctly with existing logic. This diff bring both use cases to work properly.

When a shadow node has transform on it, it will affect the overflowInset values for its parent nodes, but won't affect its own or any of its child nodes overflowInset values. This is obvious for translateX/Y case, but not for scale case. Take a look at the following case:

```
     ┌────────────────┐                 ┌────────────────┐                      ┌────────────────┐
     │Original Layout │                 │  Translate AB  │                      │    Scale AB    │
     └────────────────┘                 └────────────────┘                      └────────────────┘
                                                        ─────▶           ◀─────                  ─────▶
┌ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ┐     ┌ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ─ ┐      ┌ ─ ─ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ─ ┐
        │ A        │                      │ A        │                             │ A        │
│       │          │        │     │       │          │          │      ├ ─ ─ ─ ─ ─ ┼ ─ ─┌─────┤─ ─ ─ ─ ─ ┤
 ─ ─ ─ ─│─ ─ ─┌───┐┼ ─ ─ ─ ─              │          │                   ◀─ ─ ─    │    │AB   │  ─ ─ ─▶
│       │     │AB ││        │     │ ┌ ─ ─ ┼ ─ ─ ─ ┬──┴┬ ─ ─ ─ ─ ┤      │           │    │     │          │
        └─────┤   ├┘                      └───────┤AB │                            └────┤     │
│             │┌──┴─────────┤     │ │             │   │         │      │ │              │ ┌───┴──────────┤
              ││ABC         │                     │┌──┴─────────┐                       │ │ABC           │
│             │└──┬─────────┤   │ │ │             ││ABC         │    │ │ │              │ │              │
┌───ABD───────┴─┐ │             │                 │└──┬─────────┘    │   ▼              │ └───┬──────────┘
├─────────────┬─┘ │         │   │ │ ├───ABD───────┴─┐ │         │    │ ├────────────────┴──┐  │          │
 ─ ─ ─ ─ ─ ─ ─└───┘─ ─ ─ ─ ─    ▼   └─────────────┬─┘ │              ▼ │      ABD          │  │
                                  └ ┴ ─ ─ ─ ─ ─ ─ ┴───┴ ─ ─ ─ ─ ┘      ├────────────────┬──┘  │          │
                                                                        ─ ─ ─ ─ ─ ─ ─ ─ ┴─────┴ ─ ─ ─ ─ ─
```

For the translate case, only view A has change on the overflowInset values for `right` and `bottom`. Note that the `left` and `top` are not changed as we union before and after transform is applied.

For the scale case, similar things are happening for view A, and both `left`, `right`, and `bottom` values are increased. However, for View AB or any of its children, they only *appear* to be increased, but that is purely cosmetic as it's caused by transform. The actual values are not changed, which will later be converted during render phase to actual pixels on screen.

In summary, overflowInset is affected from child nodes transform matrix to the current node (bottom up), but not from transform matrix on the current node to child nodes (top down). So the correct way to apply transform is to make it only affect calculating `contentFrame` during layout, which collects child nodes layout information and their transforms. The `contentFrame` is then used to decide the overflowInset values for the parent node. The current transform matrix on parent node is never used as it's not affecting overflowInset for the current node or its child nodes.

This diff reflects the context above with added unit test to cover the scale and translate transform matrix.

Changelog:
[Android/IOS][Fixed] - Fixed how we calculate overflowInset with transform matrix

Reviewed By: sammy-SC

Differential Revision: D34433404

fbshipit-source-id: 0e48e4af4cfd5a6dd32a30e7667686e8ef1a7004
2022-03-01 14:33:04 -08:00
Janic Duplessis cff9590864 Implement Runtime.getHeapUsage for hermes chrome inspector (#33173)
Summary:
Reland of https://github.com/facebook/react-native/issues/32895 with fix for optional params object.

Original description:

I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

## Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

Pull Request resolved: https://github.com/facebook/react-native/pull/33173

Test Plan:
I was able to reproduce the issue that caused the initial PR to be reverted using the resume request in Flipper. Pausing JS execution then resuming it will cause it to crash before this change, and works fine after.

Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: jpporto

Differential Revision: D34446672

Pulled By: ShikaSD

fbshipit-source-id: 6e26b8d53cd88cddded36437c72a01822551b9d0
2022-03-01 10:09:05 -08:00
David Vacca be9cf17316 Move TextLayoutManager constructor to Cpp file
Summary:
Move TextLayoutManager constructor to Cpp file

changelog: [internal] internal

Reviewed By: genkikondo

Differential Revision: D34246014

fbshipit-source-id: a85e144b05e2cefad8cb1757dad14bedacbb8d74
2022-02-27 22:23:48 -08:00
David Vacca 3fb3ce4fa2 Delete TextMeasurement destructor
Summary:
TextMeasurement destructor is not necessary, we are deleting it

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D34246015

fbshipit-source-id: 6ca4803fafc8b195828d546ba8fb45353257f383
2022-02-27 22:23:48 -08:00
David Vacca 926ab6ca26 Mark TextLayoutManager as not copyable / not movable
Summary:
TextLayoutManger should be not copyable / not movable

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D34246013

fbshipit-source-id: dc20db2ad9e2709ddca5bef5218356bd2b292c2d
2022-02-27 22:23:48 -08:00
Paige Sun 6e03945c7f Use @synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder hack
Summary:
Changelog: [iOS][Internal] Use synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder

Remove the `RCTWeakViewHolder` hack, since it can be replaced with `viewRegistry_DEPRECATED viewForReactTag`.

Reviewed By: RSNara

Differential Revision: D34468082

fbshipit-source-id: be41ed2df6ee195409724f6069fd99a793dca01a
2022-02-25 13:45:22 -08:00
Paige Sun 34c953f398 4/5 Attach @synthesize ivars to RCTViewManagers using RCTBridgeModuleDecorator in Bridgeless mode
Summary:
Changelog: [iOS][Internal] 4/5 Attach synthesize ivars to RCTViewManagers using RCTBridgeModuleDecorator in Bridgeless mode

- In RCTInstance, insert RCTBridgeModuleDecorator into RCTInstance into contextContainer
- In LegacyViewManagerInteropComponentDescriptor.mm, unwrap RCTBridgeModuleDecorator from contextContainer
- Then pass RCTBridgeModuleDecorator from LegacyViewManagerInteropComponentDescriptor to RCTLegacyViewManagerInteropCoordinator
- In RCTLegacyViewManagerInteropCoordinator, call `RCTBridgeModuleDecorator attachInteropAPIsToModule` to attach synthesize ivars to all RCTViewManagers.

This does not affect Bridge mode.

Reviewed By: RSNara

Differential Revision: D34439950

fbshipit-source-id: d814c56a52f226e3a2c96fea01efb51afc571721
2022-02-25 08:50:34 -08:00
Pieter De Baets dc50308994 Remove default usages of enable_exceptions/rtti
Summary: Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34379947

fbshipit-source-id: abff08ec99cff60d16ff82b7c0422d72caffd59b
2022-02-25 07:46:11 -08:00
Pieter De Baets 4b1c8584e1 Remove size_ field from RawPropsParser
Summary:
`size_` will always match `keys_.size()` so we don't have to keep track of it.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34391445

fbshipit-source-id: f6c9316c989137425abfb7b3d72b571d08240f34
2022-02-25 04:08:01 -08:00
Andrei Shikov 78f6cdf2be Fix OSS native Android build (#33167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33167

The build is failing with:

```
error: undefined reference to 'folly::SharedMutexImpl<false, void, std::__ndk1::atomic, folly::SharedMutexPolicyDefault>::unlock_shared()'
```

Indicating missing link to `folly_futures`.

Changelog: [Internal]

Reviewed By: cortinico, GijsWeterings

Differential Revision: D34419236

fbshipit-source-id: ca777e0c3a13c2f23791a94b13de18911c93edd5
2022-02-23 09:23:21 -08:00
Andrei Shikov 1953f6f02e Exclude raw props from view shadow nodes
Summary:
With the `MapBuffer`-based props calculated from C++ props, there's no need to keep `rawProps` around for Android views.

This change makes sure that the `rawProps` field is only initialized under the feature flag that is responsible for enabling `MapBuffer` for prop diffing, potentially decreasing memory footprint and speeding up node initialization as JS props don't have to be converted to `folly::dynamic` anymore.

For layout animations, props rely on C++ values, so there's no need to update `rawProps` values either.

Changelog: [Internal][Android] - Do not init `rawProps` when mapbuffer serialization is used for ViewProps.

Reviewed By: mdvacca

Differential Revision: D33793044

fbshipit-source-id: 35873b10d3ca8b152b25344ef2c27aff9641846f
2022-02-22 17:23:05 -08:00
Andrei Shikov 733f228506 Diff C++ props for Android consumption
Summary:
Creates a mapbuffer from two ViewProp objects. This MapBuffer is used later instead of bag of props from JS to set the properties with platform ViewManager.

Changelog: [Internal] - Added MapBuffer diffing for ViewProps

Reviewed By: mdvacca

Differential Revision: D33735246

fbshipit-source-id: 10ad46251ea71aa844586624c888f5223fa44e57
2022-02-22 08:23:40 -08:00
Andrei Shikov da72b5d02c Add accessibility and view props required for Android to C++ layer
Summary:
Parses a set of props previously missing from C++ representation (they weren't required for iOS and core processing before).

Changelog: [Internal] - Added missing fields for Android to C++ view props

Reviewed By: sammy-SC

Differential Revision: D33797489

fbshipit-source-id: 1625baa0c1a592fcef409a5f206496dff0368912
2022-02-22 08:23:40 -08:00
Samuel Susla b8662f8f8a Remove mobile config remove_outstanding_surfaces_on_destruction_android
Summary:
changelog: [internal]

fewer flags = fewer problems.

Reviewed By: javache

Differential Revision: D34380114

fbshipit-source-id: c7213bd31e253fabeefc2514c7b51611d7c47e4e
2022-02-22 07:23:16 -08:00
Pieter De Baets d31c0c9109 Avoid string copy in RawPropsKey comparison
Summary:
Small performance improvement since we don't need to copy the char * into a string just for the sake of comparison.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34351387

fbshipit-source-id: 10163164f6e95ab0737e8f865c37d8f0c3500662
2022-02-22 03:23:12 -08:00
Samuel Susla bb7214b9c4 Allow tests to be executed in platform agnostic environment
Summary:
changelog: [internal]

Make ManagedObjectWrapper compile in platform independent environment.

Reviewed By: ryancat

Differential Revision: D34302957

fbshipit-source-id: 50bf296983525c48cda1e532934b9998077c9fbf
2022-02-18 09:23:27 -08:00
Samuel Susla 5e88223d85 Add support for nested components in legacy interop
Summary: changelog: [internal]

Reviewed By: ShikaSD

Differential Revision: D34173837

fbshipit-source-id: 09fbf12e9d8eb13a170ff92afff97f203d0ef805
2022-02-18 07:11:44 -08:00
Pieter De Baets 45af635b1e Fix some nits/typos in MapBuffer
Summary:
Was trying out some behaviour when using the MapBuffer experiment and fixed some small issues.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34108859

fbshipit-source-id: 550ca0847419006ec17472cc4b70d38fc8d05396
2022-02-15 14:06:42 -08:00
Neil Dhar 9010bfe457 Add PropNameID::fromSymbol
Summary:
Changelog:
[General][Added] - Add ability to access properties with symbol keys through JSI

Reviewed By: mhorowitz

Differential Revision: D33830544

fbshipit-source-id: 8de366b4c7d5ea9d2fd5df70dfb776a056e23806
2022-02-14 22:29:16 -08:00
Genki Kondo 49f3f47b1e Support color animation with native driver for iOS
Summary:
Adds support for Animated.Color with native driver for iOS. Reads the native config for the rbga channel AnimatedNodes, and on update(), converts the values into a SharedColor.

Followup changes will include support for platform colors.

Ran update_pods: https://www.internalfb.com/intern/wiki/React_Native/Preparing_to_Ship/Open_Source_Pods/

Changelog:
[iOS][Added] - Support running animations with AnimatedColor with native driver

Reviewed By: sammy-SC

Differential Revision: D33860583

fbshipit-source-id: 990ad0f754a21e3939f2cb233bcfa793ef12eb14
2022-02-10 11:18:39 -08:00
Andrei Shikov 980c52de41 Disable view flattening when the view has event handlers on Android
Summary:
The views with touch event props are currently flattened by Fabric core, as we don't take event listeners into account when calculating whether the view should be flattened. This results in a confusing situation when components with touch event listeners (e.g. `<View onTouchStart={() => {}} /> `) or ones using `PanResponder` are either ignored (iOS) or cause a crash (Android).

This change passes touch event props to C++ layer and uses them to calculate whether the view node should be flattened or not. It also refactors events to be kept as a singular bitset with 32 bit (~`uint32_t`).

Changelog: [Changed][General] Avoid flattening nodes with event props

Reviewed By: sammy-SC

Differential Revision: D34005536

fbshipit-source-id: 96255b389a7bfff4aa208a96fd0c173d9edf1512
2022-02-10 06:07:39 -08:00
John Porto b467094f18 Add StringPrimitive::create for UTF8 strings
Summary:
This is pre-work for adding the v8 stack trace API support.

Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34048366

fbshipit-source-id: 9d2b469767f7669cb428c61b215f193894892c03
2022-02-10 05:00:32 -08:00
Chiara Mooney 42b391775f Fix ReactCommon Break for Windows (#33047)
Summary:
Changes to MapBuffer code in aaff15c...d287598 broke build for Windows. Errors included incompatible type conversions, the use of `__attribute__(__packed__)` which is only supported by GCC and Clang, and the usage of designated initializers which are only supported on C++20.

Changes here restore build on Windows.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Fix build break on Windows with ReactCommon

Pull Request resolved: https://github.com/facebook/react-native/pull/33047

Test Plan: React Native project built on Windows and passes react-native-windows repository pipeline. These edits are currently merged into the main branch of react-native-windows.

Reviewed By: ShikaSD

Differential Revision: D34101367

Pulled By: philIip

fbshipit-source-id: 1596365c2e92f377c6375805b33de5e1c7b78e66
2022-02-09 13:03:10 -08:00
Andrei Shikov 3112238b14 De-duplicate conversion of SharedColor to Android int value
Summary:
Removes duplicated code in SharedColor conversions. The original copy was done for the MapBuffer experiment, as the method was returning `folly::dynamic` instead of integer. Nothing prevents us from returning integer here directly, so we can keep one implementation.

Changelog: [Internal] - Removed duplicated SharedColor conversion for Android

Reviewed By: javache

Differential Revision: D33797490

fbshipit-source-id: 196657f0616e6cb7e987225b76328fe77fd6c28a
2022-02-09 10:26:30 -08:00
Pieter De Baets a75bbe7552 Fix docs in ModalHostView headers
Summary:
Copy-paste error

Changelog: [Internal]

Reviewed By: genkikondo

Differential Revision: D34077530

fbshipit-source-id: 04ab17ba9308762361d993b7ed1b372af400b8d1
2022-02-09 03:03:09 -08:00
CodemodService FBSourceClangFormatLinterBot e737270d11 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D34099214

fbshipit-source-id: 7a1fc8550968d8b87f016e4bf706252bf03e4483
2022-02-08 19:15:34 -08:00
Neil Dhar 5b66bb90c6 Add missing symbol handling in kindToString
Summary: Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34062869

fbshipit-source-id: 08fed59d62b0d0a46e0868874a89b125731a44e5
2022-02-08 15:18:15 -08:00
Raphael Herouart 669cd0257c Test Chrome DevTools Notifications
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Notifications
Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34055503

fbshipit-source-id: 8c2dd1066ba2b68e395226f15954d303894d0365
2022-02-08 06:46:31 -08:00
Raphael Herouart 921ed737eb Test Chrome DevTools Protocol Responses Format
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Responses
Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34052619

fbshipit-source-id: d213ed41335b64bf3168a43ce043f2c57f05fc52
2022-02-08 06:46:30 -08:00
Samuel Susla d79f658016 Rename RuntimeScheduler::callImmediates to RuntimeScheduelr::callExpiredTasks
Summary:
changelog: [internal]

Rename method so it does not collide with immediates that already exist in React Native.

Reviewed By: javache

Differential Revision: D34041418

fbshipit-source-id: 0ae75b683983c3be50320b195a7068d7178b0ed8
2022-02-07 10:06:07 -08:00
Raphael Herouart 31a92b008d Add some tests for compliance to the Chrome DevTools Protocol
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Messages

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34042008

fbshipit-source-id: 3a074e9840706ca977ff86d050e67b0dcea5c7ef
2022-02-07 09:06:31 -08:00
Samuel Susla ee454e4f0b Add description to ConcreteComponentDescriptor::adopt
Summary: changelog: [internal]

Reviewed By: javache

Differential Revision: D34041312

fbshipit-source-id: 3b6d650034481813273f67444426e2fa5cb7d59f
2022-02-07 09:03:56 -08:00
Andrei Shikov 2bc883e6b7 Back out "Implement Runtime.getHeapUsage for hermes chrome inspector"
Summary:
The new messages are breaking SparkAR VSCode debugger
Original commit changeset: 49d863e6a58d
Original Phabricator Diff: D33616658 (3568a72987)
Changelog: [Internal]

Reviewed By: the-over-ape

Differential Revision: D34003669

fbshipit-source-id: 5327820cda60d5f58521da56e2e1f5d824bf861d
2022-02-04 07:20:31 -08:00
Samuel Susla 5e933fdd2a Yield for each access to the runtime
Summary:
changelog: [internal]

With multiple requests to the runtime, we need to make sure they are all granted before React continues with rendering. A boolean is not enough to track this. The first lambda that has VM will set it to false and subsequent requests will have to wait for React to finish rendering.

To prevent this, we can count how many lambdas are pending access to the runtime.

Reviewed By: ShikaSD

Differential Revision: D33792734

fbshipit-source-id: f785fae3575470179dd69acc6a466211b79b633b
2022-02-03 10:20:33 -08:00
Samuel Susla 491c4231db Pass raw ShadowNode instead of shared_ptr
Summary:
changelog: [internal]

pass raw ShadowNode instead of shared_ptr. Ownership is not transferred, shared_ptr is misleading.

Reviewed By: javache

Differential Revision: D33917010

fbshipit-source-id: 4d9fdd4b4e0376149f1719ad160b957de4afdce3
2022-02-03 04:30:10 -08:00
Janic Duplessis 3568a72987 Implement Runtime.getHeapUsage for hermes chrome inspector (#32895)
Summary:
I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

## Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

Pull Request resolved: https://github.com/facebook/react-native/pull/32895

Test Plan:
Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: christophpurrer

Differential Revision: D33616658

Pulled By: ShikaSD

fbshipit-source-id: 49d863e6a58d4a92d4c86f9a288ac33ed8d2cb0d
2022-02-02 10:37:06 -08:00
John Porto eb08af57a9 Implement Runtime.callFunctionOn
Summary:
[Hermes][Inspector] Implement the CDP API for calling a function on an object.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D33722301

fbshipit-source-id: da26e865cf29920be77c5c602dde1b443b4c64da
2022-02-01 16:50:14 -08:00
Felipe Perez 3552ff0562 Back out "Delete RuntimeScheduler yielding mobile config"
Summary:
D33740360 (16ed62a850) broke Explore VR on React Native. The app would go into a loop on boot and not finish mounting. This is probably a product code issue, but it's not a trivial issue to solve. Unlanding to unblock the RN migration.

Changelog:

[internal] internal

Reviewed By: mdvacca

Differential Revision: D33918026

fbshipit-source-id: cc77c70ece9994d82c91f7ae8783e959629e9cfb
2022-02-01 15:17:14 -08:00
Samuel Susla 6351064b75 Introduce RuntimeScheduler::callImmediates
Summary:
changelog: [internal]

React on web uses microtasks to schedule a synchronous update for discrete event. Microtasks are not yet available in React Native and as a fallback, React uses native scheduler and task with immediate priority. Until Microtasks are in place, React Native needs to make sure all immediate tasks are executed after it dispatches each event.

I tried to stay as close to [microtask standard](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) as I reasonably could.

Once microtasks on RN are shipped, this code can be removed.

Reviewed By: mdvacca

Differential Revision: D33742583

fbshipit-source-id: eddebb1bd5131ee056252faad48327a70de78a4a
2022-01-28 16:35:18 -08:00
John Porto d2f5044c37 Catch exceptions thrown by user callbacks
Summary:
Calls to Inspector::evaluate() and Inspector::executeIfEnabled()
take a user-provided callback which are not try-guarded. This
means that, should the user code throw, the inspector's process
will likely die due to the unhandled exception. This change
makes sure that, if the user provided callback throws, then
the promise attached to those methods will be fulfilled by
an exception.

Change: [internal]

Reviewed By: avp

Differential Revision: D33852073

fbshipit-source-id: 7fbb6662b28d393a5d5b494c004aa9521e23ebb6
2022-01-28 13:38:27 -08:00
Xin Chen 8aa87814f6 Consider transform when calculating overflowInset values
Summary:
The fix in this diff seems simple, but it took some time to understand why this change fixed the issue that views animated use native driver out from their parent's layout are not getting touch events.

We introduced `overflowInset` to RN Android a while back to give each shadow node extra information to cover all its children's layout. These values (left, top, right, bottom extensions from the view's own layout) help us improve hit-testing algorithm used in touch events. We could ignore all subtrees that the touch point not in their parent's overflowInset box.

However, this was not working for native animation. When `userNativeDriver` is on, all animation happens without Fabric knows anything about them. The overflowInset is out of date with the final animated layout, which caused the issue that we ignored the animated view as we thought it's not under the pointer.

Here is a playground demo (P476407654) for the issue:

https://pxl.cl/1XfPL

We've tried to fix this by passing the final animated values via `passthroughAnimatedPropExplicitValues` added in D32539976. This is a prop that will get merged into `style` prop for [animation component](https://fburl.com/code/jybzfgu5). The transform values were already applied when measuring layout in [Pressability](https://fburl.com/code/5mect2k3), which uses [LayoutableShadowNode](https://fburl.com/code/qh8fufrw). However, this is not the case for overflowInset calculation. Hence, the fix here is to apply the transform matrix in Yoga before calculating the overflowInset.

Changelog:
[Android][Fixed] - Fix overflowInset calculation by using transform values

Reviewed By: ShikaSD

Differential Revision: D33806030

fbshipit-source-id: e438618e3d6e5b0333cff9ff9919b841d73b2e9d
2022-01-28 10:37:34 -08:00
David Vacca 4b7face721 Move pointerEvents from formsStacking -> formsView
Summary:
This was a bug, we are fixing it.

Move pointerEvents from formsStacking -> formsView and we are also removing "onLayout" from formsStackingContext

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D33846660

fbshipit-source-id: 6b65a9a7815972e34dafbc48b3d732d9b02d5e9f
2022-01-28 09:30:17 -08:00
Pieter De Baets 20b9ed91c0 Remove FBREMAP experiment
Summary:
The flag was removed in https://www.internalfb.com/diff/D28467996 (2c5f68df46) but the code was not removed yet.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33792884

fbshipit-source-id: 0ae5d904ca2ca94437ca63b495d41e47585fde33
2022-01-27 12:02:19 -08:00
Pieter De Baets 86fa2a5106 Emit warning when dispatching event to null target
Reviewed By: ShikaSD

Differential Revision: D33767454

fbshipit-source-id: c2f10b6b857544c06780fb13b66417d12f9b8d2c
2022-01-26 11:24:32 -08:00
Samuel Susla b856465e3a Add missing header and initialisation in RuntimeSchedulerTest
Summary: changelog: [internal]

Reviewed By: ShikaSD

Differential Revision: D33789519

fbshipit-source-id: 395c0cc7ddd1d63fbe57efb8f3212e5f5647e2bd
2022-01-26 09:23:08 -08:00
Samuel Susla 9bf533e6b8 Remove shared_ptr from RuntimeScheduler::cancelTask interface and add comments
Summary:
Changelog: [internal]

Add comments and avoid using shared_ptr unnecessarily.

Why note shared_ptr? Using shared_ptr suggests we are transferring ownership of object, which we are not.

Reviewed By: javache

Differential Revision: D33741836

fbshipit-source-id: 56ebb098e6185793f05e2bb587005bb0f093c0c9
2022-01-26 09:23:08 -08:00
Samuel Susla 16ed62a850 Delete RuntimeScheduler yielding mobile config
Summary:
changelog: [internal]

Yielding in RuntimeScheduler is shipped. This diff removes the gating around it.

Reviewed By: sshic

Differential Revision: D33740360

fbshipit-source-id: 267372e81e66dda96e451435954a7c3546cc6fbe
2022-01-26 09:23:08 -08:00
Andrei Shikov 3c86e82a02 Namespace MapBuffer structs and typealiases by moving them into class
Summary:
Refactors MapBuffer-related `primitives.h` to be namespaced with `MapBuffer` class, to avoid name collisions and confusion later on.
Most of the size constants are moved to relevant .cpp files or updated to use `sizeof`.

Additionally, adds a little bit of documentation about `MapBuffer` serialization format.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33662487

fbshipit-source-id: 5a7a2b1c7f2bb13ee1edfc5fae51ba88c34f0d3c
2022-01-20 12:57:22 -08:00
Andrei Shikov adb2167640 Serialize and assert type information in mapbuffer
Summary:
Serializes type information along with key/value in MapBuffer, asserting the data type on Java side during read. At the moment, accessing value with incorrect will result in a crash.

Other changes:
Adds a `getType` method to verify types before accessing them.
Removes `null` as a type, as just not inserting value and checking for its existence with `hasKey` is more optimal.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33656841

fbshipit-source-id: 23a78daa0d84704aab141088b5dfe881e9609472
2022-01-20 12:57:22 -08:00
Andrei Shikov d287598d23 Allow random stores and accesses to MapBuffer values
Summary:
Removes the need to store keys in incremental order by sorting them after before inserting into MapBuffer.
Updates MapBuffer to support random access on C++ side, actually retrieving values by keys and not bucket index.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33611758

fbshipit-source-id: c81e970613c8ecc688bfacb29ba038bf081a0c0f
2022-01-20 12:57:22 -08:00