From c9080f5409278e12d3c293b2ce43c9e34290aac4 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Tue, 24 Jan 2017 11:14:27 -0800 Subject: [PATCH] Fix TextInput placeholder font when using custom fonts. Fixes #4600 Summary: When using a TextInput with a custom font, the placeholder didn't use that font. This is because ReactTextInputManager didn't use ReactFontManager to create the TypeFace which handles custom fonts. **Test plan** Tested in UI explorer by reproducing the bug with and testing that the custom font gets applied properly after the fix. ``` js ``` Closes https://github.com/facebook/react-native/pull/12000 Reviewed By: hramos Differential Revision: D4443713 fbshipit-source-id: e92c9822d9226681d7b00126dad95e5534c0c46e --- .../react/views/textinput/ReactTextInputManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 a09d9802af59a0..d7dc063d38b1e3 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 @@ -49,6 +49,7 @@ import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper; import com.facebook.react.views.text.DefaultStyleValuesUtil; +import com.facebook.react.views.text.ReactFontManager; import com.facebook.react.views.text.ReactTextUpdate; import com.facebook.react.views.text.ReactTextView; import com.facebook.react.views.text.TextInlineImageSpan; @@ -190,7 +191,10 @@ public void setFontFamily(ReactEditText view, String fontFamily) { if (view.getTypeface() != null) { style = view.getTypeface().getStyle(); } - Typeface newTypeface = Typeface.create(fontFamily, style); + Typeface newTypeface = ReactFontManager.getInstance().getTypeface( + fontFamily, + style, + view.getContext().getAssets()); view.setTypeface(newTypeface); }