react-native: [Bug]: maxFontSizeMultiplier is not being respected
Description
The maxFontSizeMultiplier prop is not being respected for Text and TextInput components. When accessibility settings are changed to increase the display text, the font size increases beyond the multiplier set.
Steps to reproduce
- Init a new project from the CLI template
- Add a few Text/TextInput components to the screen
- Prevent some from scaling and allow others to scale with the maxFontSizeMultiplier prop passed
- Change OS accessibility settings from display text size and observe bug
React Native Version
0.76.1
Affected Platforms
Runtime - Android, Runtime - iOS
Areas
Fabric - The New Renderer
Output of npx react-native info
System:
OS: macOS 15.0.1
CPU: (12) arm64 Apple M3 Pro
Memory: 107.84 MB / 36.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.1.0
path: /opt/homebrew/bin/node
Yarn:
version: 4.5.1
path: /opt/homebrew/bin/yarn
npm:
version: 10.9.0
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.10.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/craig/.rvm/gems/ruby-3.3.5/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK:
API Levels:
- "23"
- "24"
- "25"
- "26"
- "27"
- "28"
- "29"
- "30"
- "31"
- "33"
- "34"
- "35"
Build Tools:
- 28.0.3
- 29.0.2
- 29.0.3
- 30.0.1
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
- 35.0.0
System Images:
- android-28 | Google Play Intel x86 Atom
- android-29 | Google APIs Intel x86 Atom
- android-29 | Google Play Intel x86 Atom
- android-30 | Google APIs Intel x86 Atom
- android-30 | Google APIs Intel x86_64 Atom
- android-30 | Google Play Intel x86 Atom
- android-30 | Google Play Intel x86 Atom_64
- android-33 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12550806
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 3.3.5
path: /Users/craig/.rvm/rubies/ruby-3.3.5/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.0
wanted: 15.0.0
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.1
wanted: 0.76.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
No logs
Reproducer
https://github.com/mysport12/maxFontSizeMultiplierBug
Screenshots and Videos
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 26 (15 by maintainers)
Commits related to this issue
- Fix support for maxFontSizeMultiplier prop in new architecture (#47499) — committed to RickardZrinski/react-native by RickardZrinski 2 years ago
- Fix support for maxFontSizeMultiplier prop in new architecture (#47499) — committed to RickardZrinski/react-native by RickardZrinski 2 years ago
- Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in new architecture (#47614) Summary: The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New... — committed to facebook/react-native by RickardZrinski 2 years ago
- Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in new architecture (#47614) Summary: The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New... — committed to facebook/react-native by RickardZrinski 2 years ago
- Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in new architecture (#47614) Summary: The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New... — committed to facebook/react-native by RickardZrinski 2 years ago
- Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in new architecture (#47614) Summary: The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New... — committed to facebook/react-native by RickardZrinski 2 years ago
- feat: font scale props (#1129) Refactor date-field / picker-field element to delegate to underlying components that render `Text` components the responsibility to extract their props and styles from ... — committed to Instawork/hyperview by flochtililoch 2 years ago
- Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in new architecture (#47614) Summary: The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New... — committed to linhandev/react-native-core by RickardZrinski 2 years ago
Everything is working on Android and iOS, except that there is some weirdness happening on the new architecture with reapplying changes made in Settings when switching back to the app (e.g. you’ve changed font size in accessibility settings but you need to restart the app for it to apply).
I don’t think this issue is specific to my PR but rather a general issue in the new architecture. Though I’ll need to verify that to be sure.
Edit: yeah, the reapplying of settings is a general issue on the new architecture. On iOS you can switch back and forth to your app after changing Settings and usually after the second roundtrip it gets applied. On Android it does apply after returning from Settings, but line height (seemingly) is messed up until you restart the app. I should probably open an issue on this…
I’ve added support (https://github.com/RickardZrinski/react-native/commit/140d9eb985cb161f3550d277e16a6b00d96235f2) and hoping to open a pull request tomorrow. Just need to do some more manual testing / compare with the old architecture and do some screenshots for the PR.
Edit: still working on it 😃
Apologies - YES, it works in 0.76.7. I had killed and re-opened - but I resolved it by making a fresh development build (I use expo).
yes. I believe we shipped the fix on 0.75, 0.76 and 0.78-rc. 0.77 will arrive next week with the fix.
I’m trying to landing the changes… 🤞
No problem! Time off is time off.
I’ve updated the PR based on the feedback. Hope all is good now.
Yes, I can confirm it is working on 0.76.1 with the legacy arch.
+1 This a big hit to accessibility for our app. It is nixing all of our
maxFontSizeMultiplieradjustments.No worries! Completely understand how busy everyone is with the holiday season, new arch rollout, etc. Just hoping to keep this on the radar for a 0.76.X/0.77.X pick.
I would assume the React Native team are just busy and/or it needs to go through some internal testing at Meta. I’ve synced with the latest changes on main now so we’ll see if the test suite passes again.
The settings issue isn’t a blocker. I can’t find the specific GitHub issue now but it’s been confirmed as an issue with the new architecture. It’s been documented by others as well.
@cipolleschi Anything else I need to do for it to get merged?