Skip to content

Commit fb23000

Browse files
Yann PringaultFacebook Github Bot
authored andcommitted
Call handleUpdateLayout even if the content didn't change
Summary: This PR fixes #11096. I don't know enough the ReactAndroid's source code so I don't know if this is correct but I hope it is. In a recent commit (d4b8ae7), the `dispatchUpdates` method now returns a boolean to dispatch or not the `onLayout` event. This works well but if the content is unchanged, the line `nativeViewHierarchyOptimizer.handleUpdateLayout(this);` is never called. I don't know if it was intended but it was this which introduces my issue. I called this again even if the content didn't change. This was the behaviour before 0.38 so I guess I didn't break anything. **Test plan (required)** I tested my pretty big app with this fix and every screen is ok. Closes #11222 Differential Revision: D4252101 Pulled By: astreet fbshipit-source-id: 551559234631ac37245a854d81ba568f0ddb02dd
1 parent b1fd7bd commit fb23000

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -286,23 +286,10 @@ public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
286286
}
287287

288288
if (hasNewLayout()) {
289-
float newLeft = Math.round(absoluteX + getLayoutX());
290-
float newTop = Math.round(absoluteY + getLayoutY());
291-
float newRight = Math.round(absoluteX + getLayoutX() + getLayoutWidth());
292-
float newBottom = Math.round(absoluteY + getLayoutY() + getLayoutHeight());
293-
294-
if (newLeft == mAbsoluteLeft &&
295-
newRight == mAbsoluteRight &&
296-
newTop == mAbsoluteTop &&
297-
newBottom == mAbsoluteBottom) {
298-
return false;
299-
}
300-
301-
mAbsoluteLeft = newLeft;
302-
mAbsoluteTop = newTop;
303-
mAbsoluteRight = newRight;
304-
mAbsoluteBottom = newBottom;
305-
289+
mAbsoluteLeft = Math.round(absoluteX + getLayoutX());
290+
mAbsoluteTop = Math.round(absoluteY + getLayoutY());
291+
mAbsoluteRight = Math.round(absoluteX + getLayoutX() + getLayoutWidth());
292+
mAbsoluteBottom = Math.round(absoluteY + getLayoutY() + getLayoutHeight());
306293
nativeViewHierarchyOptimizer.handleUpdateLayout(this);
307294
return true;
308295
} else {

0 commit comments

Comments
 (0)