mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-11 11:29:03 +08:00
Add backward compatible support for onLayout event in Fabric
Reviewed By: achen1 Differential Revision: D8231722 fbshipit-source-id: 3d0641a7813e742ca81b98576f9ffc30ee597f30
This commit is contained in:
committed by
Facebook Github Bot
parent
6c989fe7c6
commit
6aea98441a
@@ -96,6 +96,38 @@ public class UIViewOperationQueue {
|
||||
}
|
||||
}
|
||||
|
||||
private final class EmitOnLayoutEventOperation extends ViewOperation {
|
||||
|
||||
private final int mScreenX;
|
||||
private final int mScreenY;
|
||||
private final int mScreenWidth;
|
||||
private final int mScreenHeight;
|
||||
|
||||
public EmitOnLayoutEventOperation(
|
||||
int tag,
|
||||
int screenX,
|
||||
int screenY,
|
||||
int screenWidth,
|
||||
int screenHeight) {
|
||||
super(tag);
|
||||
mScreenX = screenX;
|
||||
mScreenY = screenY;
|
||||
mScreenWidth = screenWidth;
|
||||
mScreenHeight = screenHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
mReactApplicationContext.getNativeModule(UIManagerModule.class)
|
||||
.getEventDispatcher()
|
||||
.dispatchEvent(OnLayoutEvent.obtain(
|
||||
mTag,
|
||||
mScreenX,
|
||||
mScreenY,
|
||||
mScreenWidth,
|
||||
mScreenHeight));
|
||||
}
|
||||
}
|
||||
|
||||
private final class UpdateInstanceHandleOperation extends ViewOperation {
|
||||
|
||||
@@ -706,6 +738,16 @@ public class UIViewOperationQueue {
|
||||
mOperations.add(new UpdatePropertiesOperation(reactTag, props));
|
||||
}
|
||||
|
||||
public void enqueueOnLayoutEvent(
|
||||
int tag,
|
||||
int screenX,
|
||||
int screenY,
|
||||
int screenWidth,
|
||||
int screenHeight) {
|
||||
mOperations.add(new EmitOnLayoutEventOperation(tag, screenX, screenY, screenWidth, screenHeight));
|
||||
}
|
||||
|
||||
|
||||
public void enqueueUpdateLayout(
|
||||
int parentTag,
|
||||
int reactTag,
|
||||
|
||||
Reference in New Issue
Block a user