mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Don't use NodeRegion to update View bounds
Summary: NodeRegions are touch regions within hosting View, and while in most cases they are the same as View boundaries, there is one case where it's not true: TextNodeRegion. When mounted to a View, TextNodeRegion will have a bounds of (0,0,width,height) which is clearly different from (left,top,right,bottom). Initially I assumed they would always be the same so we could use information stored in NodeRegion (should probably be called TouchRegion) to update node's View boundaries, but it breaks RCTTextView when it mount to a View (because it would either contain incorrect bounds, or View will be laid out incorrectly). Right now touch is not working on RCTView that mounts to a View. To fix the issue, separate the 2 concepts. Reviewed By: ahmedre Differential Revision: D2816268
This commit is contained in:
committed by
Ahmed El-Helw
parent
2fb7ebfb7b
commit
e7d8d2c3ab
@@ -86,7 +86,7 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
/**
|
||||
* UIOperation that updates View bounds for a View defined by reactTag.
|
||||
*/
|
||||
private final class UpdateViewBounds implements UIOperation {
|
||||
public final class UpdateViewBounds implements UIOperation {
|
||||
|
||||
private final int mReactTag;
|
||||
private final int mLeft;
|
||||
@@ -234,11 +234,20 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
enqueueUIOperation(new UpdateViewGroup(reactTag, viewsToAdd, viewsToDetach));
|
||||
}
|
||||
|
||||
public UpdateViewBounds createUpdateViewBounds(
|
||||
int reactTag,
|
||||
int left,
|
||||
int top,
|
||||
int right,
|
||||
int bottom) {
|
||||
return new UpdateViewBounds(reactTag, left, top, right, bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues a new UIOperation that will update View bounds for a View defined by reactTag.
|
||||
*/
|
||||
public void enqueueUpdateViewBounds(int reactTag, int left, int top, int right, int bottom) {
|
||||
enqueueUIOperation(new UpdateViewBounds(reactTag, left, top, right, bottom));
|
||||
public void enqueueUpdateViewBounds(UpdateViewBounds updateViewBounds) {
|
||||
enqueueUIOperation(updateViewBounds);
|
||||
}
|
||||
|
||||
public void enqueueSetPadding(
|
||||
|
||||
Reference in New Issue
Block a user