Android: Added back touch event handling based on reactTag
Summary: It turned out the previous attempt to rely on the Event's UIManagerType wasn't sufficient, as not all Fabric touch event had a surfaceId set on them, e.g. Modal etc. This brings back the UIManagerType detection based on reactTag, but do it only for non-rootView to keep handling touch via the right dispatcher for rootView as well. Changelog: [Fixed][Android] Bring back non-rootview touch handling based on reactTag Reviewed By: JoshuaGross, sshic Differential Revision: D37063335 fbshipit-source-id: 76e2d7ae5f00006c5ecaf50c86920ea6e85155b7
This commit is contained in:
Родитель
1b6584b9f5
Коммит
8b837268b4
|
@ -12,6 +12,7 @@ import com.facebook.react.bridge.WritableMap;
|
|||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.IllegalViewOperationException;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
|
||||
/**
|
||||
* A UI event that can be dispatched to JS.
|
||||
|
@ -80,7 +81,14 @@ public abstract class Event<T extends Event> {
|
|||
// non-Fabric UIManager, and we cannot use the ViewTag for inference since it's not controlled
|
||||
// by RN and is essentially a random number.
|
||||
// At some point it would be great to pass the SurfaceContext here instead.
|
||||
mUIManagerType = (surfaceId == -1 ? UIManagerType.DEFAULT : UIManagerType.FABRIC);
|
||||
@UIManagerType
|
||||
int uiManagerType = (surfaceId == -1 ? UIManagerType.DEFAULT : UIManagerType.FABRIC);
|
||||
if (uiManagerType == UIManagerType.DEFAULT && !ViewUtil.isRootTag(viewTag)) {
|
||||
// TODO (T123064648): Some events for Fabric still didn't have the surfaceId set, so if it's
|
||||
// not a React RootView, double check if the tag belongs to Fabric.
|
||||
uiManagerType = ViewUtil.getUIManagerType(viewTag);
|
||||
}
|
||||
mUIManagerType = uiManagerType;
|
||||
|
||||
mTimestampMs = timestampMs;
|
||||
mInitialized = true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче