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

font scale: setMaxContentSizeMultiplier doesn't work for RN.Text and RN.TextInput #783

Open
ohyeslk opened this issue Aug 23, 2018 · 10 comments · May be fixed by #1200
Open

font scale: setMaxContentSizeMultiplier doesn't work for RN.Text and RN.TextInput #783

ohyeslk opened this issue Aug 23, 2018 · 10 comments · May be fixed by #1200
Labels
feature request stale This ticket may be old, or may no longer be valid, and will be closed if no further activity occurs

Comments

@ohyeslk
Copy link

ohyeslk commented Aug 23, 2018

Hey,
In function setMaxContentSizeMultiplier(maxContentSizeMultiplier: number): void { },
it shouldn't use UIManager.setMaxContentSizeMultiplier, we should use AccessibilityManager.setAccessibilityContentSizeMultipliers in React Native.

Something like RN.NativeModules.AccessibilityManager.setAccessibilityContentSizeMultipliers(maxContentSizeMultiplier);

But the maxContentSizeMultiplier should be a dictionary like:
const fontSizeMultipliers = {
extraSmall: 0.823,
small: 0.882,
medium: 0.941,
large: 1.0,
extraLarge: 1.118,
extraExtraLarge: 1.235,
extraExtraExtraLarge: 1.353,
accessibilityMedium: 1.786,
accessibilityLarge: 2.143,
accessibilityExtraLarge: 2.643,
accessibilityExtraExtraLarge: 3.143,
accessibilityExtraExtraExtraLarge: 3.571,
};
Here's the reference:
https://snack.expo.io/ryOh1Migb

@erictraut
Copy link
Contributor

This feature (a maximum size multiplier) doesn't currently exist in React Native. It's a feature that the Skype team implemented in our own private fork of RN. We've been working on getting the change integrated into React Native proper. I'm not sure of the latest status of that effort.

@ohyeslk
Copy link
Author

ohyeslk commented Aug 23, 2018

I tried this function(max size multiplier) but it doesn't work. I thought it was exposed as accessibility large text, isn't it?

@erictraut
Copy link
Contributor

Font size multiplier is exposed, but there's currently no way to cap it to a maximum value.

@ohyeslk
Copy link
Author

ohyeslk commented Aug 23, 2018

I see. I want to limit the fontSizeMultipliers for thresholds. For example, make the ExtraExtraExtraLarge(3.571) to Large(2.143). Currently, it doesn't support it, right? But i feel like setMaxContentSizeMultiplier is build for it. It doesn't really work thought.

Something like this:
facebook/react-native#15433

@erictraut
Copy link
Contributor

Oh, interesting. I missed your reference before. It looks like FB added this support to RN.IOS at some point. It wasn't added to the documentation for AccessibilityManager, but I see it in the code. Unfortunately, I don't see any similar support exposed on RN.Android.

@rigdern, have you had any further conversations with FB on this topic?

@ohyeslk
Copy link
Author

ohyeslk commented Aug 24, 2018

On Android, there're not that much range of multipliers. I think this is only exposed for iOS to solve the accessibility's large text mode

@rigdern
Copy link
Contributor

rigdern commented Aug 24, 2018

For Skype, we had a problem where text could get too big as the user increased their system font scale setting. We considered using setAccessibilityContentSizeMultipliers but ultimately decided that building setMaxContentSizeMultiplier was a better solution for Skype. You can read more about setMaxContentSizeMultiplier in the ReactXP docs.

As Eric mentioned, setMaxContentSizeMultiplier isn't yet part of the official React Native GitHub project. We have custom React Native patches that add support for setMaxContentSizeMultiplier on iOS and Android. We're currently preparing to contribute this feature back to Facebook.

Adam Comella
Microsoft Corp.

@fbartho
Copy link
Contributor

fbartho commented Aug 9, 2020

I know it's been a while, but @rigdern do you think it would be possible to update the status of this ticket? -- I'm hoping that this is actually fixed now in react-native and we just need some PR for ReactXP.

My question above also goes for you @ohyeslk -- I'd love to figure out where we're at here!

@fbartho fbartho added the stale This ticket may be old, or may no longer be valid, and will be closed if no further activity occurs label Aug 9, 2020
@fbartho
Copy link
Contributor

fbartho commented Aug 10, 2020

I think this is partially implemented in or related to #1200 … does that sound right?

@rigdern
Copy link
Contributor

rigdern commented Aug 10, 2020

@fbartho Yes, maxFontSizeMultiplier is implemented in React Native (iOS, Android) and #1200 appears to expose it in ReactXP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request stale This ticket may be old, or may no longer be valid, and will be closed if no further activity occurs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants