mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 17:13:46 +08:00
Remove UIManagerModule dependency in UIViewOperationQueue
Reviewed By: astreet Differential Revision: D2463226 fb-gh-sync-id: eafc876ca750a08406917d8bbbfe87c27a4649fd
This commit is contained in:
committed by
facebook-github-bot-0
parent
f624d01cac
commit
ac0134322f
@@ -35,7 +35,7 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeUiManagerDebugListener;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
@@ -87,7 +87,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
private final NativeViewHierarchyOptimizer mNativeViewHierarchyOptimizer;
|
||||
private final int[] mMeasureBuffer = new int[4];
|
||||
|
||||
private @Nullable NotThreadSafeUiManagerDebugListener mUiManagerDebugListener;
|
||||
private int mNextRootViewTag = 1;
|
||||
private int mBatchId = 0;
|
||||
|
||||
@@ -100,7 +99,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
mViewManagers);
|
||||
mOperationsQueue = new UIViewOperationQueue(
|
||||
reactContext,
|
||||
this,
|
||||
mNativeViewHierarchyManager,
|
||||
mAnimationRegistry);
|
||||
mNativeViewHierarchyOptimizer = new NativeViewHierarchyOptimizer(
|
||||
@@ -771,8 +769,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
}
|
||||
}
|
||||
|
||||
public void setUiManagerDebugListener(@Nullable NotThreadSafeUiManagerDebugListener listener) {
|
||||
mUiManagerDebugListener = listener;
|
||||
public void setViewHierarchyUpdateDebugListener(
|
||||
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
|
||||
mOperationsQueue.setViewHierarchyUpdateDebugListener(listener);
|
||||
}
|
||||
|
||||
public EventDispatcher getEventDispatcher() {
|
||||
@@ -836,34 +835,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
cssNode.markUpdateSeen();
|
||||
}
|
||||
|
||||
/* package */ void notifyOnViewHierarchyUpdateEnqueued() {
|
||||
if (mUiManagerDebugListener != null) {
|
||||
mUiManagerDebugListener.onViewHierarchyUpdateEnqueued();
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ void notifyOnViewHierarchyUpdateFinished() {
|
||||
if (mUiManagerDebugListener != null) {
|
||||
mUiManagerDebugListener.onViewHierarchyUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendAccessibilityEvent(int tag, int eventType) {
|
||||
mOperationsQueue.enqueueSendAccessibilityEvent(tag, eventType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first non-virtual (i.e. native) parent view tag of the react view with the passed tag.
|
||||
* If the passed tag represents a non-virtual view, the same tag is returned. If the passed tag
|
||||
* doesn't map to a react view, or a non-virtual parent cannot be found, -1 is returned.
|
||||
*/
|
||||
/* package */ int getNonVirtualParent(int reactTag) {
|
||||
ReactShadowNode node = mShadowNodeRegistry.getNode(reactTag);
|
||||
while (node != null && node.isVirtual()) {
|
||||
node = node.getParent();
|
||||
}
|
||||
return node == null ? -1 : node.getReactTag();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user