-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
conditional fontFamily switches once but doesn't switch back on TextInput #27585
Comments
Your style logic looks incorrect.
an empty string will resolve to true. Try: |
@safaiyeh my logic is correct. An empty string will not resolve to true. Feel free to play with the logic anyway you want; i already have, it's not going to get it to work. |
UPDATE: problem also appears to be affecting fontWeight. I've tested it with fontSize today and it doesn't seem to affect size; although the response is less than ideal in case the fontSize changes aggressively. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
problem still exists. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Hi,
I'm trying to conditionally control the fontFamily of a TextInput component based on the length of text entered inside it. When text has zero length, i would like to use one font family, and when it has length, i want to use another. This is to style the placeholder text differently from the inputted text.
When the TextInput first renders, it renders correctly, and once i start typing inside it, it successfully switches from one font family to another. However, if i delete what i wrote, it doesn't switch back the font family.
React Native version:
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Memory: 719.39 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.12.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 25.0.2, 26.0.2, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
{fontFamily: YOUR_INPUT_VALUE ? 'ONE_FONT_FAMILY' : 'ANOTHER_FONT_FAMILY'}
Describe what you expected to happen:
For the font family to switch back to initial value after emptying the component.
code example:
Haven't tested on iOS. This is a problem i'm having on Android.
The text was updated successfully, but these errors were encountered: