mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix UIManager detection in touch event emitter
Summary: Certain events (practically always touch events probably?) will not be correctly emitted to JS in Fabric if there is no View underneath the touch - if there is no touch target besides the ReactRootView. We can just rely on the UIManagerType annotation on the Event, which is correct and reliable. Instead, what we do today is derive UIManagerType from ViewTag, which is correct UNLESS the viewtag is the same as the SurfaceId, in which case we may incorrectly detect that the touch is on a non-Fabric View when in fact it is on a Fabric ReactRootView. ViewTag is not a reliable way to detect Fabric vs non-Fabric /when looking at the RootView/, where ViewTag is the same as SurfaceId. Ironically, only Fabric RootViews have a SurfaceId at all. Practically, this won't change anything since events emitted to ReactRootView don't go anywhere (they don't have EventEmitters). So this is a pretty low-stakes fix, but is still technically correct. Changelog: [internal] Reviewed By: mdvacca Differential Revision: D34149878 fbshipit-source-id: f01da556865eb597a50cd49e9787316a0ed56f70
This commit is contained in:
committed by
Facebook GitHub Bot
parent
49f3f47b1e
commit
9bc6c0f8a5
+1
-1
@@ -86,7 +86,7 @@ public class ReactEventEmitter implements RCTModernEventEmitter {
|
||||
@Override
|
||||
public void receiveTouches(TouchEvent event) {
|
||||
int reactTag = event.getViewTag();
|
||||
@UIManagerType int uiManagerType = ViewUtil.getUIManagerType(reactTag);
|
||||
@UIManagerType int uiManagerType = event.getUIManagerType();
|
||||
if (uiManagerType == UIManagerType.FABRIC && mFabricEventEmitter != null) {
|
||||
mFabricEventEmitter.receiveTouches(event);
|
||||
} else if (uiManagerType == UIManagerType.DEFAULT && getEventEmitter(reactTag) != null) {
|
||||
|
||||
Reference in New Issue
Block a user