Skip to content

[iOS] adjustsFontSizeToFit different behaviour on new architecture #42044

Closed

Description

@samuelscheit

Description

The new architecture behaves differently for Text components with adjustsFontSizeToFit in comparison to the old architecture.
The old architecture text is capped at 15px (but would shrink, if the space wouldn't fit).
The new architecture isn't capped and the text grows as big as it fits.
The bug doesn't occur on android.

Steps to reproduce

Run the following react-native app on the old and new architecture

function App() {
  return (
    <SafeAreaView>
      <Text
        style={{fontSize: 15}}
        minimumFontScale={1}
        maxFontSizeMultiplier={1}>
        without adjustsFontSizeToFit
      </Text>
      <Text
        style={{fontSize: 15}}
        adjustsFontSizeToFit
        minimumFontScale={0.5}
        maxFontSizeMultiplier={1.5}>
        min 0.5, max: 1.5
      </Text>
      <Text
        style={{fontSize: 15}}
        adjustsFontSizeToFit
        minimumFontScale={1}
        maxFontSizeMultiplier={1}>
        min 1, max: 1
      </Text>
    </SafeAreaView>
  );
}

React Native Version

0.73.1

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.2
  CPU: (20) arm64 Apple M1 Ultra
  Memory: 405.34 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v18.17.1/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/opt/ruby/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - visionOS 1.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 15.1/15C5028h
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2
    path: /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

-

Reproducer

https://snack.expo.dev/2qB26Vtg9

Screenshots and Videos

iOS

left old architecture | right new architecture

Android (is Working correctly)

left old architecture | right new architecture

Activity

  1. added
    Type: New Architecture
    Issue: Author Provided Repro
    on Dec 27, 2023
  2. fabOnReact commented on Jan 16, 2024

    @fabOnReact
    Contributor

    Do you still experience this issue? If yes, I will publish the fix in the react-native-improved package https://github.com/fabriziobertoglio1987/react-native-improved. Thanks a lot

  3. cortinico commented on Mar 25, 2024

    @cortinico
    Contributor

    Related to #43104

  4. cortinico commented on Apr 17, 2024

    @cortinico
    Contributor

    Fixed by #44075

  5. changed the title [-]adjustsFontSizeToFit different behaviour on new architecture[/-] [+][iOS] adjustsFontSizeToFit different behaviour on new architecture[/+] on Apr 18, 2024
  6. cortinico commented on Apr 18, 2024

    @cortinico
    Contributor

    Fixed by #44075

    Actually not as this is iOS and not Android

  7. added
    Resolution: Fixed
    on Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Author Provided ReproResolution: FixedType: New Architecture

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions