Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANDROID] fontFamily, fontStyle and fontWeight support for TextInput #6564

Closed

Conversation

brunobar79
Copy link
Contributor

fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true} it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

screen shot 2016-03-21 at 6 21 05 pm

Demo after the fix:

5ux4bpjfwh

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @dmmiller, @mkonicek and @kmagiera to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Mar 21, 2016
@brunobar79 brunobar79 changed the title fontFamily support for TextInput secureTextEntry={true} [ANDROID] fontFamily support for TextInput secureTextEntry={true} Mar 21, 2016
@dmmiller
Copy link

Again, please update the TextExample to show this being used please.

@brunobar79 brunobar79 changed the title [ANDROID] fontFamily support for TextInput secureTextEntry={true} [ANDROID] fontFamily, fontStyle and fontWeight support for TextInput secureTextEntry={true} Mar 21, 2016
@facebook-github-bot
Copy link
Contributor

@brunobar79 updated the pull request.

@facebook-github-bot
Copy link
Contributor

@brunobar79 updated the pull request.

@facebook-github-bot
Copy link
Contributor

@brunobar79 updated the pull request.

@brunobar79
Copy link
Contributor Author

@dmmiller TextInputExample updated (see gif above). Also added support for fontWeight and fontStyle, which it's all related to TypeFace. If you think this is ok I'll do the same with the color PR

@facebook-github-bot
Copy link
Contributor

@brunobar79 updated the pull request.

@dmmiller
Copy link

Now that 2a2ba4b has landed, can you rebase since I think this uses the same example and then we can try landing this one?

@dmmiller
Copy link

Do we not support font family/weight/style for normal text input? Or do we but because of the way secure entry works we need to do this additionally?

@brunobar79
Copy link
Contributor Author

@dmmiller You're right! There's no support for fontFamily, fontStyle or fontWeight on regular text inputs.
I just took out the secureTextEntry prop and it's not working on the latest master:

screen shot 2016-03-21 at 5 53 57 pm

I'm gonna rename this PR and make it for TextInput in general, and I'll update the examples.

@brunobar79
Copy link
Contributor Author

@bestander I just found the issue and finally got it working on android 4.4.2.

It was crashing on view.getTypeface().getStyle() cause view.getTypeface() returns null when there's no fontFamily or style previously set on Android 4.

Here you can see it working on android 4 and 6 after my last commit.

screen shot 2016-04-28 at 2 15 01 pm

}

Typeface currentTypeface = view.getTypeface();
if(currentTypeface == null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could you add spaces before and after () please

@bestander
Copy link
Contributor

@brunobar79, great, thanks a lot.
Let's merge it then after the tests pass :)
Could you fix just a few nits style-wise please?

@brunobar79
Copy link
Contributor Author

@bestander it should be good now.

@ghost
Copy link

ghost commented Apr 28, 2016

@brunobar79 updated the pull request.

@bestander
Copy link
Contributor

Travis build fail can be ignored, infra

@bestander
Copy link
Contributor

@facebook-github-bot shipit

@ghost ghost added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Apr 28, 2016
@ghost
Copy link

ghost commented Apr 28, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in 41e89b4 Apr 28, 2016
ide pushed a commit to expo/react-native that referenced this pull request May 5, 2016
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes facebook#6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
ide pushed a commit to expo/react-native that referenced this pull request May 6, 2016
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes facebook#6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
ptmt pushed a commit to ptmt/react-native that referenced this pull request May 9, 2016
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes facebook#6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
zebulgar pushed a commit to nightingale/react-native that referenced this pull request Jun 18, 2016
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes facebook#6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
samerce pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
Summary:
fontFamily, fontWeight and fontStyle properties are being ignored for TextInput.

There's an additional issue that happens when you add secureTextEntry={true}  it overrides the current font preferences (because it defaults to monospace) so we have to reapply it.
Master right now:

![screen shot 2016-03-21 at 6 21 05 pm](https://cloud.githubusercontent.com/assets/1247834/13936110/c25ffea8-ef91-11e5-8d71-1b0a55184e24.png)

Demo after the fix:

![5ux4bpjfwh](https://cloud.githubusercontent.com/assets/1247834/13935865/0f2ca8be-ef90-11e5-82c7-d5a2dd33b70e.gif)
Closes facebook#6564

Differential Revision: D3081623

Pulled By: bestander

fb-gh-sync-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
fbshipit-source-id: 329cac6755b5a0dd549e546768f39efa7b7f4daa
@Creemli
Copy link

Creemli commented Jul 4, 2017

Custom fontfamily is not supported for placeholder text

@harveyconnor
Copy link

I'm getting this in RN 0.63.3

@metalpapa
Copy link

metalpapa commented Oct 19, 2020

i have RN updated an i have this same issue

@Eramirez06
Copy link

i'm getting this too

@hoangnv98
Copy link

when i set SecureTextEntry={true} , fontFamily show different fontFamily i change

@hemang-thakkar
Copy link

I m seeing this issue too.
image

@ahummel25
Copy link

Also getting this in RN 0.63.3. Please reopen this.

@harveyconnor
Copy link

Please re-open @shergin @hramos

@carlosdaniiel07
Copy link

This solved for me (0.63.3):

#30123 (comment)

@kindacoder
Copy link

same issue 0.64.0

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.