Skip to content

Commit aa85408

Browse files
Adam ComellaFacebook Github Bot
authored andcommitted
Android: Fix inconsistency with fractional TextInput padding
Summary: TextInput rounds padding down with `floor` when measuring. However, it rounds padding up with `ceil` when rendering. This change makes things consistent by moving TextInput's rendering code to use `floor` as well. It looks like this is the intended behavior because commit bdff10b moved measuring from `ceil` to `floor`. It looks like TextInput's rendering code was just overlooked in that commit. **Test plan (required)** Verified TextInput padding works in a test app. Also, my team uses this change in our app. Adam Comella Microsoft Corp. Closes #11003 Differential Revision: D4220855 Pulled By: mkonicek fbshipit-source-id: 95349867ef89c021a8441b383a09052ca0dd569c
1 parent 7e6ff74 commit aa85408

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ public void updateExtraData(ReactEditText view, Object extraData) {
164164
float[] padding = (float[]) extraData;
165165

166166
view.setPadding(
167-
(int) Math.ceil(padding[0]),
168-
(int) Math.ceil(padding[1]),
169-
(int) Math.ceil(padding[2]),
170-
(int) Math.ceil(padding[3]));
167+
(int) Math.floor(padding[0]),
168+
(int) Math.floor(padding[1]),
169+
(int) Math.floor(padding[2]),
170+
(int) Math.floor(padding[3]));
171171
} else if (extraData instanceof ReactTextUpdate) {
172172
ReactTextUpdate update = (ReactTextUpdate) extraData;
173173
if (update.containsImages()) {

0 commit comments

Comments
 (0)