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] Incorrect bold font processing #88

Open
ivankdev opened this issue Oct 20, 2020 · 7 comments
Open

[Android] Incorrect bold font processing #88

ivankdev opened this issue Oct 20, 2020 · 7 comments

Comments

@ivankdev
Copy link

ivankdev commented Oct 20, 2020

Preconditions:

Platform: Android

"react-native": "0.63.3", 
"react-native-parsed-text": "^0.0.22",

Issue:

Could someone explain this behavior? And how could we fix it?

code:

 <ParsedText style={{fontSize: 50, fontFamily: Nobblee.Bold}}>
    {'HELLO'}
 </ParsedText>

result (as expected)
Screenshot 2020-10-20 at 23 27 33


code:

 <ParsedText style={{fontSize: 50, fontFamily: Nobblee.Bold}} parse={[]}>
    {'HELLO'}
 </ParsedText>

result (as NOT expected)
Screenshot 2020-10-20 at 23 26 51

And this happens for any array of parse param. BUT SHOULD NOT!
I configured some banch of parse templates, but usual text is affected because of this.
Any clues?


I've put this font here as well
EENobblee-Bold.ttf.zip

@ivankdev
Copy link
Author

@fbartho, anyone? any clues?

@fbartho
Copy link
Contributor

fbartho commented Oct 22, 2020

@Aviemore no idea! -- this is super interesting. It might be a bug in how the top level text object is built. I would expect those two cases to be the same.

I would try to compare the Component tree in both cases (using the Inspector).

I suspect something different is happening in parse() here:

return textExtraction.parse().map((props, index) => {

@miamiappmachine
Copy link

Same issue here, hates any font beyond a regular weight. Bold, semibold, all act the same on Android

@fbartho
Copy link
Contributor

fbartho commented Apr 13, 2021

@miamiappmachine Have you tried to use the inspector to understand what's happening to the Text / Font Styling?

@miamiappmachine
Copy link

Bizarrely I can't even select it on the element inspector in Android. No problem at all to select it on iOS (where it works perfectly)

@fbartho
Copy link
Contributor

fbartho commented Apr 13, 2021

That is indeed super strange. Maybe React-Native Android no longer supports Nested <Text> objects? This is the type of platform-specific difference that has cropped up in the past (Shadows are different on iOS vs Android, <Image> can be embedded in one of the <Text> implementations but not the other…)

Please do report back what you found. I would totally accept a PR if you find the root issue! -- My team's apps no longer use this library (this was previously used by our Chat code, but we now have a Vendor for that, and that vendor doesn't use this library).

So while I'm happy to help review code, and find a fix, I don't have an experimental test-bed actively set up.

@miamiappmachine
Copy link

Hey all - problem solved. Patch file attached.

react-native-parsed-text+0.0.22.patch.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants