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 https://github.com/facebook/react-native/pull/11003

Differential Revision: D4220855

Pulled By: mkonicek

fbshipit-source-id: 95349867ef89c021a8441b383a09052ca0dd569c
This commit is contained in:
Adam Comella 2016-11-22 10:52:37 -08:00 committed by Facebook Github Bot
parent 7e6ff74bc9
commit aa85408f56
1 changed files with 4 additions and 4 deletions

View File

@ -164,10 +164,10 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
float[] padding = (float[]) extraData;
view.setPadding(
(int) Math.ceil(padding[0]),
(int) Math.ceil(padding[1]),
(int) Math.ceil(padding[2]),
(int) Math.ceil(padding[3]));
(int) Math.floor(padding[0]),
(int) Math.floor(padding[1]),
(int) Math.floor(padding[2]),
(int) Math.floor(padding[3]));
} else if (extraData instanceof ReactTextUpdate) {
ReactTextUpdate update = (ReactTextUpdate) extraData;
if (update.containsImages()) {