mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-10 09:29:39 +08:00
Apply FlatShadowNode padding to View
Summary: Any padding that a FlatShadowNode is assigned by React runtime should be translated to a backing Android View so it looks correct and lays out children accordingly. Reviewed By: sriramramani Differential Revision: D2756562
This commit is contained in:
committed by
Ahmed El-Helw
parent
dbe9cc333c
commit
312f04d2b7
@@ -96,6 +96,38 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
}
|
||||
}
|
||||
|
||||
private final class SetPadding implements UIOperation {
|
||||
|
||||
private final int mReactTag;
|
||||
private final int mPaddingLeft;
|
||||
private final int mPaddingTop;
|
||||
private final int mPaddingRight;
|
||||
private final int mPaddingBottom;
|
||||
|
||||
private SetPadding(
|
||||
int reactTag,
|
||||
int paddingLeft,
|
||||
int paddingTop,
|
||||
int paddingRight,
|
||||
int paddingBottom) {
|
||||
mReactTag = reactTag;
|
||||
mPaddingLeft = paddingLeft;
|
||||
mPaddingTop = paddingTop;
|
||||
mPaddingRight = paddingRight;
|
||||
mPaddingBottom = paddingBottom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
mNativeViewHierarchyManager.setPadding(
|
||||
mReactTag,
|
||||
mPaddingLeft,
|
||||
mPaddingTop,
|
||||
mPaddingRight,
|
||||
mPaddingBottom);
|
||||
}
|
||||
}
|
||||
|
||||
public final class DetachAllChildrenFromViews implements UIViewOperationQueue.UIOperation {
|
||||
private @Nullable int[] mViewsToDetachAllChildrenFrom;
|
||||
|
||||
@@ -139,6 +171,16 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
enqueueUIOperation(new UpdateViewBounds(reactTag, left, top, right, bottom));
|
||||
}
|
||||
|
||||
public void enqueueSetPadding(
|
||||
int reactTag,
|
||||
int paddingLeft,
|
||||
int paddingTop,
|
||||
int paddingRight,
|
||||
int paddingBottom) {
|
||||
enqueueUIOperation(
|
||||
new SetPadding(reactTag, paddingLeft, paddingTop, paddingRight, paddingBottom));
|
||||
}
|
||||
|
||||
public DetachAllChildrenFromViews enqueueDetachAllChildrenFromViews() {
|
||||
DetachAllChildrenFromViews op = new DetachAllChildrenFromViews();
|
||||
enqueueUIOperation(op);
|
||||
|
||||
Reference in New Issue
Block a user