Browse files

iOS: Add getContentSizeMultiplier & event

Corresponding Android PR: #11008

This gives apps the ability to find out the current scaling factor for fonts on the device. An event was also added so that apps can find out when this value changes.

**Test plan (required)**

Verified that the getter and the event work properly in a test app. Also, this change is used in my team's app.

Adam Comella
Microsoft Corp.
Closes #11010

Differential Revision: D4207620

Pulled By: ericvicenti

fbshipit-source-id: b3f6f4a412557ba97e1f5fb63446c7ff9a2ff753
  • Loading branch information...
rigdern authored and Facebook Github Bot committed Nov 19, 2016
1 parent a78ee43 commit eddc2c90f693739273583b74fc70148182b9f143
Showing with 9 additions and 0 deletions.
  1. +9 −0 React/Modules/RCTUIManager.m
@@ -240,6 +240,10 @@ @implementation RCTUIManager
- (void)didReceiveNewContentSizeMultiplier
// Report the event across the bridge.
[_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateContentSizeMultiplier"
body:@([_bridge.accessibilityManager multiplier])];
dispatch_async(RCTGetUIManagerQueue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
@@ -1565,6 +1569,11 @@ static void RCTMeasureLayout(RCTShadowView *view,
RCT_EXPORT_METHOD(getContentSizeMultiplier:(nonnull RCTResponseSenderBlock)callback)
- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(UIView *view))completion

0 comments on commit eddc2c9

Please sign in to comment.