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/Android: Text Scale #30873

Closed
amarlette opened this issue Feb 3, 2021 · 3 comments
Closed

iOS/Android: Text Scale #30873

amarlette opened this issue Feb 3, 2021 · 3 comments
Labels
Accessibility Team - Evaluated Accessibility Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Platform: Android Android applications. Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@amarlette
Copy link

amarlette commented Feb 3, 2021

Requires API Proposal

This issue may require a new API, or a change to an existing API. An API proposal should be added and discussed before proceeding with implementation. The API proposal can be added in the comments of this issue or linked as a separate issue.

Description

Both iOS and Android allow users to change the current size of their font at a system level. Apps should respect this setting, and when rendering text via some custom manner (graphs, charts, image composition, etc.), may need to take it into account.

React Native version:

v0.63

Expected Behavior

Currently the AccessibilityInfo API has no method to detect the current font scale that a user has chosen. It should have a method that works on both iOS and Android. iOS and Android treat scaling differently, with iOS having named sizes, and Android using a multiplier, so this information may need to be normalized.

Android Details

The setting on Android may show named sizes or a slider of different multiplier values (depending on the device manufacturer). On the hood these are always treated as a multiplier. The current value can be queried using the Settings.System.FONT_SCALE property.

https://developer.android.com/reference/android/provider/Settings.System#FONT_SCALE

iOS Details

On iOS you can use the preferredContentSizeCategory property to query this value.
https://developer.apple.com/documentation/uikit/uitraitcollection/1771746-preferredcontentsizecategory

@blavalla blavalla added Platform: iOS iOS applications. Accessibility Team - Evaluated Good first issue Interested in collaborating? Take a stab at fixing one of these issues. labels Feb 19, 2021
@blavalla
Copy link
Contributor

This is definitely a "good first issue" on Android due to it's relatively simple multiplier that is returned, but on iOS the named sizes to not always impact all fonts in the same way, so it may be a bit trickier to know exactly how to map them to numbers.

@blavalla blavalla changed the title Android: Text Scale iOS/Android: Text Scale Feb 26, 2021
@grgr-dkrk
Copy link
Contributor

Currently, getting font scales seems to be supported by Dimensions.get('screen').FontScale and PixelRatio.getFontScale().
Does this need to be implemented?

#11008
#12268

@blavalla
Copy link
Contributor

@grgr-dkrk , good catch! These both return exactly what I was looking for.

@amarlette, we can close this one out.

Improved React Native Accessibility automation moved this from Backlog to Done Mar 29, 2021
@facebook facebook locked as resolved and limited conversation to collaborators Mar 29, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility Team - Evaluated Accessibility Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Platform: Android Android applications. Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Development

No branches or pull requests

4 participants