You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement adjustsFontSizeToFit on Android (#26389)
Summary:
This adds support for `adjustsFontSizeToFit` and `minimumFontScale` on Android. The implementation tries to match closely the behaviour on iOS (hardcoded 4px min size for example). It uses a simpler linear algorithm for now, opened to improving it now if it is a deal breaker or in a follow up.
See https://twitter.com/janicduplessis/status/1171147709979516929 for a more detailed thread about the implementation
## Changelog
[Android] [Added] - Implement `adjustsFontSizeToFit` on Android
Pull Request resolved: #26389
Test Plan: Tested by adding the existing `adjustsFontSizeToFit` example from the iOS text page to android. Also added a case for limiting size by using `maxHeight` instead of `numberOfLines`.
Reviewed By: mdvacca
Differential Revision: D17285473
Pulled By: JoshuaGross
fbshipit-source-id: 43dbdb05e2d6418e9a390d11f921518bfa58e697
{'Add text to me to watch me shrink!'+' '+this.state.dynamicText}
144
+
</Text>
145
+
146
+
<Text
147
+
adjustsFontSizeToFit={true}
148
+
numberOfLines={4}
149
+
style={{fontSize: 20,marginVertical: 6}}>
150
+
{'Multiline text component shrinking is supported, watch as this reeeeaaaally loooooong teeeeeeext grooooows and then shriiiinks as you add text to me! ioahsdia soady auydoa aoisyd aosdy '+
{'Text limited by height, watch as this reeeeaaaally loooooong teeeeeeext grooooows and then shriiiinks as you add text to me! ioahsdia soady auydoa aoisyd aosdy '+
159
+
' '+
160
+
this.state.dynamicText}
161
+
</Text>
162
+
163
+
<Text
164
+
adjustsFontSizeToFit={true}
165
+
numberOfLines={1}
166
+
style={{marginVertical: 6}}>
167
+
<Textstyle={{fontSize: 14}}>
168
+
{'Differently sized nested elements will shrink together. '}
{'Text limited by height, watch as this reeeeaaaally loooooong teeeeeeext grooooows and then shriiiinks as you add text to me! ioahsdia soady auydoa aoisyd aosdy '+
0 commit comments