Commit Graph

18 Commits

Author SHA1 Message Date
Luna Wei 1753e7697d Fix: Ensure forms stacking context for events
Summary: Changelog: [Internal] - If any relevant view events (pointer, touch events, gesture responder, etc.) are declared on view, then the view must form stacking context. We need this change for pointer events specifically to determine whether we've entered/exited a view

Reviewed By: vincentriemer

Differential Revision: D37678352

fbshipit-source-id: 02641549ef608b1c9468ac693c7da629143212cb
2022-07-08 13:11:56 -07: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 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
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
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
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
David Vacca 26e30a5ee9 Fix incorrect ViewFlattening for views that were listening for a JS event
Summary:
This diff prevents view flattening for views that are handling some events in the JS side

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D32253124

fbshipit-source-id: acda2b12287f0a9c39a810b23a101765093ba217
2021-11-19 15:48:15 -08:00
Pieter De Baets 9b97c09612 Short-circuit evaluation of formsView
Summary:
Changelog: [Internal]

Small optimization, we can avoid evaluating some properties if `formsStackingContext` is already set, because the end-result is always true.

Reviewed By: sammy-SC

Differential Revision: D30990925

fbshipit-source-id: 08f500aa4b75446a6c644e8821f84dbfccbfebb6
2021-09-17 07:25:54 -07:00
Samuel Susla 1ecd98adc7 Do not flatten view if prop accessibilityViewIsModal is true
Summary:
changelog: [internal]

As per title, prevent view from flattening if `accessibilityViewIsModal` is true.

Reviewed By: jimmy623

Differential Revision: D30696223

fbshipit-source-id: 0c6bfc116458d1808f152cb13ba6c941c58f052e
2021-09-15 08:31:58 -07:00
Samuel Susla c5f8c31435 Implement View.removeClippedSubviews prop
Summary:
Changelog: [internal]

Fabric didn't have prop [removeClippedSubviews](https://reactnative.dev/docs/view#removeclippedsubviews) implemented. This diff adds it. It is

Reviewed By: JoshuaGross

Differential Revision: D29906458

fbshipit-source-id: 5851fa41d7facea9aab73ca131b4a0d23a2411ea
2021-07-27 03:04:15 -07:00
Andrew Coates 7aeac4236f Move isColorMeaningful to platform specific code (#31557)
Summary:
`isColorMeaningful` is the only place in xplat code that currently uses `colorComponentsFromColor`, which assumes that a color is an RGBA value.  When implementing `PlatformColor` for windows, where colors might be complex patterns or effects, I'd like to keep the details of `SharedColor` isolated within `SharedColor`.  This change moves `isColorMeaningful` into `color.cpp`, where each platform can provide an implementation that takes into account its platform specific color capabilities.

See https://github.com/microsoft/react-native-windows/pull/7801 for an example of window's SharedColor which can be either an RGBA value, or a name of a native color/brush.

## 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
-->

[Internal] [Changed] - Move isColorMeaningful to platform specific code

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

Test Plan: This shouldn't change any of the code, its just moving the existing function - normal CI/automation should be plenty of validation.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D28557698

Pulled By: mdvacca

fbshipit-source-id: 2a94850fe9c5037598107e1307f4153cee6491fb
2021-05-22 23:24:14 -07:00
Joshua Gross 077f1d233c Remove Android-specific ViewShadowNode concrete/flattened view hack
Summary:
This hack was introduced to fix T63560216. See before/after, it no longer repros.

Changelog: [Internal]

Differential Revision: D26306134

fbshipit-source-id: 7e6f886d76f3c54912fbb548069c31faaac08786
2021-02-09 22:43:43 -08:00
Valentin Shergin 272ef6b86f Fabric: AccessibilityProps::testId mapped to testID and implemented for iOS
Summary:
This should make `testID` prop work as it works in pre-Fabric renderer on iOS.
On Android it should already work fine.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D25524890

fbshipit-source-id: 3f25eb427d4449abaab790099546be18ae573f98
2020-12-13 22:36:10 -08:00
Valentin Shergin 4d920fe7c9 Fabric: Enable zIndex only for non-static-positioned views
Summary:
The standard says that zIndex should only be defined for non-`static` positioned views. This diff implements it.
For now, it actually enables zIndex for all views in RN because there is no way to specify `position: static` but we will give that ability by changing Flow definitions in future diffs in a couple of weeks (to ensure OTA safety).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D23559447

fbshipit-source-id: 20ea10c9349de2c5b1adea5735324a8f57150695
2020-09-07 11:51:20 -07:00
Valentin Shergin f8e5423c89 Fabric: Make views with accessibilityElementsHidden form stacking context
Summary:
`accessibilityElementsHidden` property hides a subtree starting from the node with this prop from VoiceOver and TalkBack, so the node with this prop should form the stacking context (otherwise the children will mount as siblings and the property will not have an effect).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23202220

fbshipit-source-id: d87dfab5f791219551c1eb90cdf3b3fa86f9c51f
2020-08-19 12:45:30 -07:00
Samuel Susla 7a1d1bc355 Fix a condition in forms stacking context evaluation
Summary: Changelog: [internal]

Reviewed By: cpojer

Differential Revision: D22921257

fbshipit-source-id: cff6ca629ec9c7e5c003a58e87c5051178587892
2020-08-04 07:22:52 -07:00
Samuel Susla 709a3a0ceb Backout "[RN] Fabric: Enable zIndex only for non-static positioned views"
Summary:
Changelog: [internal]

Backout D22098586 (https://github.com/facebook/react-native/commit/476ab7481e23070fc4db3f584e45a95eb2f9f7e1) because of issues like D22843134 (https://github.com/facebook/react-native/commit/799654b1058f6685c052f4e300c6e3ab81005549).

[428](https://fburl.com/codesearch/0dyyakf5) places with zIndex and most of them do not have position defined. This could cause views to be overlapped.

Reviewed By: JoshuaGross

Differential Revision: D22890669

fbshipit-source-id: 200d1cbe2a4c27e2a0445b315868f37418ab1d9b
2020-08-02 08:14:17 -07:00
David Vacca 3093010ea5 move fabric to ReactCommon/react/renderer
Summary:
This diff moves fabric C++ code from ReactCommon/fabric to ReactCommon/react/renderer
As part of this diff I also refactored components, codegen and callsites on CatalystApp, FB4A and venice

Script: P137350694

changelog: [internal] internal refactor

Reviewed By: fkgozali

Differential Revision: D22852139

fbshipit-source-id: f85310ba858b6afd81abfd9cbe6d70b28eca7415
2020-07-31 13:34:29 -07:00