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

[ TextInput ][ Android ] style/fontFamily not updated on component re-render #17517

Closed
Fsarmento opened this issue Jan 10, 2018 · 5 comments
Closed
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Fsarmento
Copy link

Fsarmento commented Jan 10, 2018

Is this a bug report?

yes

Have you read the Contributing Guidelines?

yes

Environment

Environment:
OS: macOS High Sierra 10.13.2
Node: 8.4.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz => 0.48.4

Target Platform: Android (7.0.0)

Steps to Reproduce

Note: The issue only applies to Android. On iOS it has the expected behavior.

Consider the component above. When the component has no text, the placeholder should be visible with fontFamily bariol-regular. When the user starts typing, the inserted text should have fontFamily bariol-bold. When the user erases all the content of the TextInput, the placeholder should appear again with fontFamily: 'bariol-regular'.

const Input = ({ value, onChangeText, placeholder }) => {
  const fontFamily = value === '' ? { fontFamily: 'bariol-regular' } : { fontFamily: 'bariol-bold' };
  return (
      <TextInput
        placeholder={placeholder}
        placeholderTextColor={'#fff'}
        autoCorrect={false}
        style={[styles.inputStyle, fontFamily]}
        value={value}
        onChangeText={onChangeText}
        underlineColorAndroid={'transparent'}
      />
  );
};

Expected Behavior

  1. textInput is mounted: placeholder is visible with fontFamily: 'bariol-regular'
  2. user types some text: the new text is visible with fontFamily: 'bariol-bold'
  3. user deletes all the text: the placeholder is visible again with fontFamily: 'bariol-regular'

Actual Behavior

  1. textInput is mounted: as expected
  2. user types some text: as expected
  3. user deletes all the text: the placeholder is visible again with fontFamily: 'bariol-bold'

On step 3 the fontFamily is not updated.

Reproducible Demo

https://snack.expo.io/@fsarmento/inputtext-style-bug-report

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@Fsarmento
Copy link
Author

Still happening in the latest version of react-native

Environment:
OS: macOS High Sierra 10.13.3
Node: 8.4.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3

@andrewzey
Copy link

This is still happening

@Fsarmento
Copy link
Author

Still not fixed in 0.57.8 (#22644)

@WilliamIPark
Copy link

I'm getting this issue I believe. The font will be applied to the placeholder, but not the text that the user inputs.

"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",

@facebook facebook locked as resolved and limited conversation to collaborators Feb 24, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants