@@ -338,6 +338,34 @@ local_ref<JMountItem::javaobject> createUpdateLayoutMountItem(
338
338
return nullptr ;
339
339
}
340
340
341
+ local_ref<JMountItem::javaobject> createUpdatePaddingMountItem (
342
+ const jni::global_ref<jobject> &javaUIManager,
343
+ const ShadowViewMutation &mutation) {
344
+
345
+ auto oldChildShadowView = mutation.oldChildShadowView ;
346
+ auto newChildShadowView = mutation.newChildShadowView ;
347
+
348
+ if (oldChildShadowView.layoutMetrics .contentInsets == newChildShadowView.layoutMetrics .contentInsets ) {
349
+ return nullptr ;
350
+ }
351
+
352
+ static auto updateLayoutInstruction =
353
+ jni::findClassStatic (UIManagerJavaDescriptor)
354
+ ->getMethod <alias_ref<JMountItem>(jint, jint, jint, jint, jint)>(
355
+ " updatePaddingMountItem" );
356
+
357
+ auto layoutMetrics = newChildShadowView.layoutMetrics ;
358
+ auto pointScaleFactor = layoutMetrics.pointScaleFactor ;
359
+ auto contentInsets = layoutMetrics.contentInsets ;
360
+
361
+ int left = round (contentInsets.left * pointScaleFactor);
362
+ int top = round (contentInsets.top * pointScaleFactor);
363
+ int right = round (contentInsets.right * pointScaleFactor);
364
+ int bottom = round (contentInsets.bottom * pointScaleFactor);
365
+
366
+ return updateLayoutInstruction (javaUIManager, newChildShadowView.tag , left, top, right, bottom);
367
+ }
368
+
341
369
local_ref<JMountItem::javaobject> createInsertMountItem (
342
370
const jni::global_ref<jobject> &javaUIManager,
343
371
const ShadowViewMutation &mutation) {
@@ -559,6 +587,11 @@ void Binding::schedulerDidFinishTransaction(
559
587
if (updateLayoutMountItem) {
560
588
mountItems[position++] = updateLayoutMountItem;
561
589
}
590
+
591
+ auto updatePaddingMountItem = createUpdatePaddingMountItem (localJavaUIManager, mutation);
592
+ if (updatePaddingMountItem) {
593
+ mountItems[position++] = updatePaddingMountItem;
594
+ }
562
595
}
563
596
564
597
if (mutation.oldChildShadowView .eventEmitter !=
@@ -602,6 +635,13 @@ void Binding::schedulerDidFinishTransaction(
602
635
if (updateLayoutMountItem) {
603
636
mountItems[position++] = updateLayoutMountItem;
604
637
}
638
+
639
+ // Padding
640
+ auto updatePaddingMountItem =
641
+ createUpdatePaddingMountItem (localJavaUIManager, mutation);
642
+ if (updatePaddingMountItem) {
643
+ mountItems[position++] = updatePaddingMountItem;
644
+ }
605
645
}
606
646
607
647
// EventEmitter
0 commit comments