react-native/Libraries
Adam Comella 01d5eff425 iOS: Add a maxFontSizeMultiplier prop to <Text> and <TextInput> (#20915)
Summary:
**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 `maxFontSizeMultiplier`. 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 `maxFontSizeMultiplier`:
  - `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 `maxFontSizeMultiplier`, it inherits it from its parent).

Lastly, we've been using a version of this in Skype for several months.

**Release Notes**

[GENERAL] [ENHANCEMENT] [Text/TextInput] - Added maxFontSizeMultiplier prop to prevent some text from getting unusably large as user increases OS's font scale setting (iOS)

Adam Comella
Microsoft Corp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20915

Differential Revision: D9646739

Pulled By: shergin

fbshipit-source-id: c823f59c1e342c22d6297b88b2cb11c5a1f10310
2018-09-04 17:50:42 -07:00
..
ART RN: Move ART Canvas Workaround 2018-07-19 19:02:13 -07:00
ActionSheetIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Alert Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Animated Allow animating the elevation style (#20739) 2018-08-22 13:48:53 -07:00
AppState Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
BatchedBridge Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Blob Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
BugReporting Flow strictify possible files in RN core 2018-06-20 00:47:21 -07:00
CameraRoll Fix for crash when height or width is nil (#20454) 2018-07-30 11:17:08 -07:00
Color Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
Components iOS: Add a maxFontSizeMultiplier prop to <Text> and <TextInput> (#20915) 2018-09-04 17:50:42 -07:00
Core v0.79.1 in xplat/js 2018-08-18 22:19:34 -07:00
EventEmitter Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Experimental Deprecate View prop-type definitions 2018-08-22 18:31:36 -07:00
Geolocation Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Image Remove view configs from JS 2018-08-24 14:04:09 -07:00
Inspector Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Interaction Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
JSInspector Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
LayoutAnimation
Linking Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
LinkingIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Lists Deeply compare viewabilityConfigs to avoid triggering invariant unnecessarily 2018-08-24 14:32:07 -07:00
Modal Switch to Platform.isTV to pass Android Flow 2018-06-10 13:45:57 -07:00
NativeAnimation Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Network Add flow suppressions to xplat android 2018-08-13 11:16:41 -07:00
Performance Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
PermissionsAndroid Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
PushNotificationIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
RCTTest Deprecate View prop-type definitions 2018-08-22 18:31:36 -07:00
ReactNative Require that JS defined Component Attributes match Native ones in dev 2018-08-23 13:01:41 -07:00
Renderer Require all Android View Attributes are defined in flow prop types 2018-08-22 13:03:15 -07:00
Sample Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Settings Replace '@flow strict(-local)' with '@flow' in .android.js files 2018-08-08 10:48:19 -07:00
Share Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
Storage Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
StyleSheet Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
SurfaceBackedComponent Fabric: `bridge` prop was removed from RCTSurface interface 2018-08-01 15:32:01 -07:00
SurfaceHostingComponent
Text iOS: Add a maxFontSizeMultiplier prop to <Text> and <TextInput> (#20915) 2018-09-04 17:50:42 -07:00
Types Add onTextLayout to TextProps 2018-08-30 09:33:05 -07:00
Utilities Remove view configs from JS 2018-08-24 14:04:09 -07:00
Vibration Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
WebSocket - Correct fishhook import in RCTReconnectingWebSocket Fixes #16039 (#16271) 2018-06-28 11:49:32 -07:00
Wrapper
YellowBox Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
fishhook
polyfills make Object.assign polyfill conditional and spec compliant 2018-08-23 14:02:10 -07:00
react-native Deprecate View prop-type definitions 2018-08-22 18:31:36 -07:00
vendor Add flow strict typing to isEmpty 2018-08-09 10:47:58 -07:00
.npmignore
Promise.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
UTFSequence.js Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
promiseRejectionIsError.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00