From 342041e9ee0f4c72b70a19f290a79040c200f859 Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Thu, 23 Nov 2023 10:34:32 -0800 Subject: [PATCH] Fix static view config not to filter out "onClick" events on Android (#41628) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41628 # Changelog: Even though `onClick` is used on Android (e.g. via Pressability), the fact of having the handler registered didn't get through to the C++ side on New Architecture, because of being filtered out via the corresponding static view config. As the result, there was no way to know on C++ side whether the corresponding event handler is registered for the view or not. Dynamic updates to the prop also wouldn't correctly propagate to C++, which may be a problem if a view gets e.g. the handler dynamically added. Reviewed By: javache Differential Revision: D51551255 fbshipit-source-id: 0783f5a27c7250f83fb357173bbe5be6213277e5 --- .../Libraries/NativeComponent/BaseViewConfig.android.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/Libraries/NativeComponent/BaseViewConfig.android.js b/packages/react-native/Libraries/NativeComponent/BaseViewConfig.android.js index 0326ec9afd621d..a077a2b1f5f3b2 100644 --- a/packages/react-native/Libraries/NativeComponent/BaseViewConfig.android.js +++ b/packages/react-native/Libraries/NativeComponent/BaseViewConfig.android.js @@ -304,6 +304,7 @@ const validAttributesForEventProps = { onTouchCancel: true, // Pointer events + onClick: true, onPointerEnter: true, onPointerEnterCapture: true, onPointerLeave: true,