Permalink
Browse files

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
<TextInput
  placeholder="Hello"
  style={{ fontFamily: 'notoserif' }}
/>
```
Closes #12000

Reviewed By: hramos

Differential Revision: D4443713

fbshipit-source-id: e92c9822d9226681d7b00126dad95e5534c0c46e
  • Loading branch information...
janicduplessis authored and facebook-github-bot committed Jan 24, 2017
1 parent a116dbf commit 1100c40cb8e2dd51ae546e00d4f69e5b5bdae16d
@@ -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);
}

0 comments on commit 1100c40

Please sign in to comment.