Ensure that layout events contain the correct padding information

Summary:
This diff changes the order of execution for the "updatePadding" mount item
Padding mountItems must be executed before layout props are updated in the view. This is necessary to ensure that events (resulting from layout changes) are dispatched with the correct padding information.

This fixes a 'flickering' bug in Marketplace Vehicles (see test plan)

changelog:[internal]

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D22034850

fbshipit-source-id: 222fa9412dd01f65a1a034f53e1eb0e7b774ec1f
This commit is contained in:
David Vacca
2020-06-13 22:18:06 -07:00
committed by Facebook GitHub Bot
parent 86c38739a7
commit 1e453860d0
@@ -762,17 +762,21 @@ void Binding::schedulerDidFinishTransaction(
createUpdateStateMountItem(localJavaUIManager, mutation);
}
auto updateLayoutMountItem =
createUpdateLayoutMountItem(localJavaUIManager, mutation);
if (updateLayoutMountItem) {
mountItems[position++] = updateLayoutMountItem;
}
// Padding: padding mountItems must be executed before layout props
// are updated in the view. This is necessary to ensure that events
// (resulting from layout changes) are dispatched with the correct
// padding information.
auto updatePaddingMountItem =
createUpdatePaddingMountItem(localJavaUIManager, mutation);
if (updatePaddingMountItem) {
mountItems[position++] = updatePaddingMountItem;
}
auto updateLayoutMountItem =
createUpdateLayoutMountItem(localJavaUIManager, mutation);
if (updateLayoutMountItem) {
mountItems[position++] = updateLayoutMountItem;
}
}
if (mutation.oldChildShadowView.eventEmitter !=
@@ -805,19 +809,22 @@ void Binding::schedulerDidFinishTransaction(
createUpdateStateMountItem(localJavaUIManager, mutation);
}
// Padding: padding mountItems must be executed before layout props
// are updated in the view. This is necessary to ensure that events
// (resulting from layout changes) are dispatched with the correct
// padding information.
auto updatePaddingMountItem =
createUpdatePaddingMountItem(localJavaUIManager, mutation);
if (updatePaddingMountItem) {
mountItems[position++] = updatePaddingMountItem;
}
// Layout
auto updateLayoutMountItem =
createUpdateLayoutMountItem(localJavaUIManager, mutation);
if (updateLayoutMountItem) {
mountItems[position++] = updateLayoutMountItem;
}
// Padding
auto updatePaddingMountItem =
createUpdatePaddingMountItem(localJavaUIManager, mutation);
if (updatePaddingMountItem) {
mountItems[position++] = updatePaddingMountItem;
}
}
// EventEmitter