From 211ea485cd993ca25d6640be41e54f327ca1629c Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 23 Sep 2019 10:26:02 -0700 Subject: [PATCH] Fix `includeFontPadding` for `TextInput` placeholder (#26432) Summary: The custom font I'm using requires using `includeFontPadding={false}` to be correctly centered vertically. The only case where this is not working is with the placeholder of `TextInput`. To fix it we call `setIncludeFontPadding` on the `EditText` instance, like we do for `Text`. ## Changelog [Android] [Fixed] - Fix `includeFontPadding` for `TextInput` placeholder Pull Request resolved: https://github.com/facebook/react-native/pull/26432 Test Plan: Tested the fix in an app. Before ![image](https://user-images.githubusercontent.com/2677334/64898120-f1de0600-d653-11e9-97b3-f53416d5f9fe.png) After ![image](https://user-images.githubusercontent.com/2677334/64897961-5b114980-d653-11e9-8897-baa14fc0f56c.png) Reviewed By: mdvacca, mmmulani Differential Revision: D17468767 Pulled By: JoshuaGross fbshipit-source-id: ae29debf9a57198a636a24ec8ed9ba3d77f0a73e --- .../react/views/textinput/ReactTextInputManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 5dfc945ca919ab..89938960ea634a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -248,6 +248,11 @@ public void setFontStyle(ReactEditText view, @Nullable String fontStyle) { view.setFontStyle(fontStyle); } + @ReactProp(name = ViewProps.INCLUDE_FONT_PADDING, defaultBoolean = true) + public void setIncludeFontPadding(ReactEditText view, boolean includepad) { + view.setIncludeFontPadding(includepad); + } + @ReactProp(name = "importantForAutofill") public void setImportantForAutofill(ReactEditText view, @Nullable String value) { int mode = View.IMPORTANT_FOR_AUTOFILL_AUTO;