-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for getItemType causing incorrect measures #25431
Changes from all commits
22a2d65
e03f767
2580ce0
1c9ec8a
7528e33
e3a4c89
e05bab7
01a5cb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js b/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js | ||
index 9cd3c57..f65012e 100644 | ||
--- a/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js | ||
+++ b/node_modules/recyclerlistview/dist/reactnative/core/layoutmanager/LayoutManager.js | ||
@@ -114,7 +114,7 @@ var WrapGridLayoutManager = /** @class */ (function (_super) { | ||
for (var i = startIndex; i < itemCount; i++) { | ||
oldLayout = this._layouts[i]; | ||
var layoutType = this._layoutProvider.getLayoutTypeForIndex(i); | ||
- if (oldLayout && oldLayout.isOverridden && oldLayout.type === layoutType) { | ||
+ if (oldLayout && oldLayout.isOverridden /*&& oldLayout.type === layoutType*/) { | ||
itemDim.height = oldLayout.height; | ||
itemDim.width = oldLayout.width; | ||
} | ||
@@ -145,9 +145,12 @@ var WrapGridLayoutManager = /** @class */ (function (_super) { | ||
itemRect.x = startX; | ||
itemRect.y = startY; | ||
itemRect.type = layoutType; | ||
+ const nextOverriden = !!itemRect.isOverridden && itemRect.width === itemDim.width && itemRect.height === itemDim.height; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we happened to adopt the size and have the same dimensions we can keep the override flag or we don't have it |
||
+ itemRect.isOverridden = nextOverriden | ||
itemRect.width = itemDim.width; | ||
itemRect.height = itemDim.height; | ||
} | ||
+ | ||
if (this._isHorizontal) { | ||
startY += itemDim.height; | ||
} | ||
diff --git a/node_modules/recyclerlistview/dist/reactnative/platform/reactnative/viewrenderer/ViewRenderer.js b/node_modules/recyclerlistview/dist/reactnative/platform/reactnative/viewrenderer/ViewRenderer.js | ||
index d9c7031..dfc6d92 100644 | ||
--- a/node_modules/recyclerlistview/dist/reactnative/platform/reactnative/viewrenderer/ViewRenderer.js | ||
+++ b/node_modules/recyclerlistview/dist/reactnative/platform/reactnative/viewrenderer/ViewRenderer.js | ||
@@ -44,9 +44,10 @@ var ViewRenderer = /** @class */ (function (_super) { | ||
}; | ||
_this._onLayout = function (event) { | ||
//Preventing layout thrashing in super fast scrolls where RN messes up onLayout event | ||
- var xDiff = Math.abs(_this.props.x - event.nativeEvent.layout.x); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i haven't see this messed up RN |
||
- var yDiff = Math.abs(_this.props.y - event.nativeEvent.layout.y); | ||
- if (xDiff < 1 && yDiff < 1 && | ||
+ //var xDiff = Math.abs(_this.props.x - event.nativeEvent.layout.x); | ||
+ //var yDiff = Math.abs(_this.props.y - event.nativeEvent.layout.y); | ||
+ | ||
+ if (/*xDiff < 1 && yDiff < 1 &&*/ | ||
(_this.props.height !== event.nativeEvent.layout.height || | ||
_this.props.width !== event.nativeEvent.layout.width)) { | ||
_this._dim.height = event.nativeEvent.layout.height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the relationship between the types has no greater significance here. If its overridden keep the size or it can get lost as its possible it never gets re-added and then fires an
onLayout
losing the size forever