Fixes removeClipSubviews check for offscreen rendering of ListViews
Summary: This issue has been open for a really long time, but I'm pretty sure this is the line that needed to change: https://github.com/facebook/react-native/issues/1831 What was happening here is that `CGRectIsEmpty` returns true when either height or width is zero. With the current logic, one of those would always be zero when the parent was rendered off screen. This ensures that there the intersection be of CGSizeZero for the view to actually be clipped. That being said, there seems to be something more complex going on here that I'm not understanding? I would think that you'd simply want to check if the child view's frame is within the bounds of the parent at all. If it was, then don't clip it. If I'm in the wrong, could someone explain this a bit more? If so, I'll fix this issue. Using this [repository](https://github.com/jcharlet/react_native_listview_bug), this one line change fixes the issue and still clips cells as they are scrolled off screen. Closes https://github.com/facebook/react-native/pull/15669 Differential Revision: D5815056 Pulled By: shergin fbshipit-source-id: 32382e4954139e4d5af67d786422fd87173b1a1a
This commit is contained in:
parent
e3a6be5d37
commit
03ae65bc25
|
@ -346,8 +346,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused)
|
|||
|
||||
// Mount / unmount views
|
||||
for (UIView *view in self.reactSubviews) {
|
||||
if (!CGRectIsEmpty(CGRectIntersection(clipRect, view.frame))) {
|
||||
|
||||
if (!CGSizeEqualToSize(CGRectIntersection(clipRect, view.frame).size, CGSizeZero)) {
|
||||
// View is at least partially visible, so remount it if unmounted
|
||||
[self addSubview:view];
|
||||
|
||||
|
|
Loading…
Reference in New Issue