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

iOS: Add a maxFontSizeMultiplier prop to <Text> and <TextInput> #20915

Closed

Commits on Aug 30, 2018

  1. iOS: Add a maxContentSizeMultiplier prop to <Text> and <TextInput>

    **Motivation**
    
    Whenever a user changes the system font size to its maximum allowable setting, React Native apps that allow font scaling can become unusable because the text gets too big. Experimenting with a native app like iMessage on iOS, the font size used for non-body text (e.g. header, navigational elements) is capped while the body text (e.g. text in the message bubbles) is allowed to grow.
    
    This PR introduces a new prop on `<Text>` and `<TextInput>` called `maxContentSizeMultiplier`. This enables devs to set the maximum allowed text scale factor on a Text/TextInput. The default is 0 which means no limit.
    
    Another PR will add this feature to Android.
    
    **Test Plan**
    
    I created a test app which utilizes all categories of values of `maxContentSizeMultiplier`:
      - `undefined`: inherit from parent
      - `0`: no limit
      - `1`, `1.2`: fixed limits
    
    I tried this with `Text`, `TextInput` with `value`, and `TextInput` with children. For `Text`, I also verified that nesting works properly (if a child `Text` doesn't specify `maxContentSizeMultiplier`, it inherits it from its parent).
    
    Lastly, we've been using a version of this in Skype for several months.
    Adam Comella committed Aug 30, 2018
    Configuration menu
    Copy the full SHA
    0370c5d View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2018

  1. Inline defaultMaxContentSizeMultiplier

    Adam Comella committed Sep 4, 2018
    Configuration menu
    Copy the full SHA
    ab7ea6a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cd1c24b View commit details
    Browse the repository at this point in the history