Skip to content

allowFontScaling is ignored on iOS when Fabric is enabled #34990

@amgleitman

Description

@amgleitman

Description

The allowFontScaling prop can normally be used to force text to stay the same size even when accessibility settings change the default font size. However, this property appears to have no effect when Fabric is enabled.

This was discovered when looking into implementing Dynamic Type ramps for Fabric as discussed in this proposal.

Version

main

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
    Memory: 148.70 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
    Watchman: 2022.09.19.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.0/14A309 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Check out the main branch of facebook/react-native. (In my case, I got a repro against commit 4664292.)
  2. Build RNTester and run it on an iOS simulator.
  3. In the launched Simulator, adjust the accessibility settings to use the largest text size possible.
  4. Look at the Text test page, specifically, the "This text will not scale..." paragraph in the section that talks about allowFontScaling.
  5. Repeat steps 2-4, but this time, set fabric_enabled = false in packages/rn-tester/Podfile.
  6. Compare the resulting screenshots.

Snack, code example, screenshot, or link to a repository

Screenshot with Fabric enabled:
(Unexpected behavior)
Screenshot with Fabric disabled:
(Expected behavior)
Screen Shot 2022-10-14 at 3 40 28 PM Screen Shot 2022-10-14 at 3 50 11 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: iOSiOS applications.Resolution: FixedA PR that fixes this issue has been merged.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions