diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 156cac88d5b..7eb300c1924 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -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