-
Notifications
You must be signed in to change notification settings - Fork 25k
Closed
Labels
Needs: Triage 🔍Platform: AndroidAndroid applications.Android applications.Resolution: FixedA PR that fixes this issue has been merged.A PR that fixes this issue has been merged.
Description
Description
On Android devices, large Text components will sometimes fail to apply the fontSize property of nested Text component's styles, resulting in text rendering with the parent's font size.

These lines of text all have the same style, but render at different sizes.
(Haven't tested whether this applies to things besides fontSize. When scrolling through the text, the bug seems periodic, happening to the last few Texts out of every group of some larger number.)
Version
0.67.3 (originally observed on 0.64.1)
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.22000
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 2.65 GB / 15.76 GB
Binaries:
Node: 17.7.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio: 16.10.31402.337 (Visual Studio Community 2019), 15.9.28307.1033 (Visual Studio Community 2017)
Languages:
Java: 1.8.0_282 - C:\Program Files\OpenJDK\openjdk-8u282-b08\bin\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.3 => 0.67.3
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
- Render a large number of
Textcomponents, each with their ownstyleprops includingfontSizevalues, inside aTextcomponent with a differentfontSize - Deploy your app to an Android device
- Observe that some of the text is rendered with the wrong font size
Snack, code example, screenshot, or link to a repository
https://snack.expo.dev/IbMg-oQqi
Measures the height of various Texts using onLayout events, then computes how far off the height of a large nested Text is from its expected height. Constants at the top of the file:
USE_DIFFERENT_HEIGHTS: If true, the newlines in between phrases will be rendered at a smaller font size. Seems to make the bug happen at lower phrase counts, but isn't required.NUM_PHRASES: The number of phrases to render. On my test phone and on the Snack Android device, 52 seems to be the minimum number to reproduce withUSE_DIFFERENT_HEIGHTSoff, 37 with it on. Use higher values like 200 to see the periodic effect mentioned earlier.THROW_IF_WRONG_HEIGHT: If true, throws an error if the height is too far from the expected value. Otherwise, justconsole.logs about it.
fai9al7dad
Metadata
Metadata
Assignees
Labels
Needs: Triage 🔍Platform: AndroidAndroid applications.Android applications.Resolution: FixedA PR that fixes this issue has been merged.A PR that fixes this issue has been merged.