From d5f76226111bc71d45f20b9d0c849006cc6aca1c Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 24 Sep 2020 10:36:21 -0700 Subject: [PATCH] Fix rounding issue when setting padding Summary: Changelog: [Internal] Padding needs to be rounded down (floor function), not rounded to the closest natural number. Otherwise the content of the view might not fit. Reviewed By: JoshuaGross Differential Revision: D23905145 fbshipit-source-id: e84d70155b207144b98646dd0c4fea7a8c4bd876 --- .../main/java/com/facebook/react/fabric/jni/Binding.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 390166bfd7f..134c1c5de27 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 @@ -442,10 +442,10 @@ local_ref createUpdatePaddingMountItem( auto pointScaleFactor = layoutMetrics.pointScaleFactor; auto contentInsets = layoutMetrics.contentInsets; - int left = round(contentInsets.left * pointScaleFactor); - int top = round(contentInsets.top * pointScaleFactor); - int right = round(contentInsets.right * pointScaleFactor); - int bottom = round(contentInsets.bottom * pointScaleFactor); + int left = floor(contentInsets.left * pointScaleFactor); + int top = floor(contentInsets.top * pointScaleFactor); + int right = floor(contentInsets.right * pointScaleFactor); + int bottom = floor(contentInsets.bottom * pointScaleFactor); return updatePaddingInstruction( javaUIManager, newChildShadowView.tag, left, top, right, bottom);