-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Picker (or TextInput) fontFamily breaks another component fontFamily #881
Comments
There must be some race condition because I have two almost exactly the same apps. Here it works http://github.com/este/este, but in another private repo, when I add font family, completely another component will lose it. |
As I debug it, it seems fontFamily is somehow incorrectly cached when I slightly change a definition for a picker, it works. |
Just investigated the same behavior exists for TextInput. |
Trying to isolate in glitch, without a success so far :-/ |
I can't tell what you're trying to do in that glitch |
Demonstrate a bug of course. I am using fairly complex setup: http://github.com/este/este |
Anytime I set fontFamily for more components, one of them will lose it. It's happening I don't know why. Trying to isolate as much app code as possible. |
Picker doesn't support font family. See https://necolas.github.io/react-native-web/storybook/ |
I just tried to replace const StyleSheet = {
create: styles => styles,
}; And bug disappeared. Maybe I am doing something wrong. |
It seems to be related to StyleSheet, not picker. Now I am investigating the same issue with TextInput. |
Btw, so Picker fontSize isn't possible to set for web? It makes sense if RN does not support it. |
It's definitely related to |
@necolas OK, It's time to give up it. Whenever I set a font family to TextInput, Text will lose it. There is definitely a bug in RNW StyleSheet. This is workaround I am going to use because don't know RNW source enough to be able to fix it. textInput: StyleSheet.create({
input: {
color: colors[textColor],
fontFamily: fontFamily + ' ',
marginBottom: rhythm(1),
},
}), |
And this is not something you can reproduce in a simple test case? I'm not asking you to fix it at this stage. Are you mixing RNW with CSS from somewhere else? |
No, because there is probably some race condition. As I wrote, I have two almost the same apps, it works in first and doesn't in second. |
I had a look at https://github.com/este/este/blob/79fac538e710050893f4328eb0e4024bd833ce57/themes/theme.js This is not needed because it's handled within RNW when you use the This is not a valid style definition: https://github.com/este/este/blob/79fac538e710050893f4328eb0e4024bd833ce57/themes/theme.js#L55-L58 |
@necolas If it was my fault, please tell me where I shall send some bitcoins. |
Let me know if editing that este code doesn't resolve the issue |
@necolas What's wrong with that? It's normal style definition. color and fontFamily. |
As for "This is not needed because it's handled within RNW when you use the System font-family" How is it related? I suppose it's perfect valid case to set custom fontFamily even similar to System. Am I wrong? |
Sorry, I was confused by the way you've defined the styles in another object.
Sure |
As for "Are you mixing RNW with CSS from somewhere else?" I used Next.js example. Nothing more I am aware of. |
I guess there is something wrong with a cache. Este example works well, but the same Este app with less / different order components breaks fontFamily. I had the same issue when I tried to put styles to anchor manually instead of using Text with role prop which should work even it's not needed. |
@necolas Not sure how the last commit should fix it. I tried fontFamily Arial with the same result. |
Last commit is unrelated. Without a test case or running example I can't help |
I hope it's broken only for fontFamily. I will keep you informed. |
Hmm, I think I know where is the problem. When I add fontFamily to TextInput, Text font inherit became stronger than fontFamily. That's weird. @necolas Any idea why it can happen? I will repeat it to be clear: When I add the same fontFamily as Text has to TextInput, Text will render with incorrect CSS specificity. |
Thank you a lot for your hard super awesome work. RNW is gold. |
Bug
When I set Picker a fontFamily, completely another component will lost its fontFamily style.
I will try to make and demo, meanwhile, some users can have a similar problem so I created an issue.
Btw, the bug I reported is still there: I updated an issue.
#879
Also, this is very probably related: #860 (comment)
The text was updated successfully, but these errors were encountered: