Skip to content
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 RN ViewRenderer not updating internal dimensions on Layout #782

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/platform/reactnative/viewrenderer/ViewRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ export default class ViewRenderer extends BaseViewRenderer<any> {
//Preventing layout thrashing in super fast scrolls where RN messes up onLayout event
const xDiff = Math.abs(this.props.x - event.nativeEvent.layout.x);
const 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)) {
if (xDiff < 1 && yDiff < 1) {
this._dim.height = event.nativeEvent.layout.height;
this._dim.width = event.nativeEvent.layout.width;
if (this.props.onSizeChanged) {

if ((this.props.height !== event.nativeEvent.layout.height ||
this.props.width !== event.nativeEvent.layout.width) &&
this.props.onSizeChanged) {
this.props.onSizeChanged(this._dim, this.props.index);
}
}
Expand Down