Skip to content

Commit cff522d

Browse files
Mehdi Mulanifacebook-github-bot
Mehdi Mulani
authored andcommitted
Dirty text shadow nodes on UIManager queue after multiplier changes
Summary: Letting them fire on whatever queue we get the notification from throws an assert. Reviewed By: shergin Differential Revision: D7002789 fbshipit-source-id: 669474af1a07f0df6784b69b54afe0152c1ba3c4
1 parent b48f7e5 commit cff522d

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Libraries/Text/Text/RCTTextViewManager.m

+9-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import <React/RCTShadowView+Layout.h>
1414
#import <React/RCTShadowView.h>
1515
#import <React/RCTUIManager.h>
16+
#import <React/RCTUIManagerUtils.h>
1617
#import <React/RCTUIManagerObserverCoordinator.h>
1718

1819
#import "RCTTextShadowView.h"
@@ -83,12 +84,15 @@ - (void)handleDidUpdateMultiplierNotification
8384
{
8485
CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier;
8586

86-
for (RCTTextShadowView *shadowView in _shadowViews) {
87-
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
88-
[shadowView dirtyLayout];
89-
}
87+
NSHashTable<RCTTextShadowView *> *shadowViews = _shadowViews;
88+
RCTExecuteOnUIManagerQueue(^{
89+
for (RCTTextShadowView *shadowView in shadowViews) {
90+
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
91+
[shadowView dirtyLayout];
92+
}
9093

91-
[self.bridge.uiManager setNeedsLayout];
94+
[self.bridge.uiManager setNeedsLayout];
95+
});
9296
}
9397

9498
@end

Libraries/Text/TextInput/RCTBaseTextInputViewManager.m

+9-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import <React/RCTShadowView+Layout.h>
1717
#import <React/RCTShadowView.h>
1818
#import <React/RCTUIManager.h>
19+
#import <React/RCTUIManagerUtils.h>
1920
#import <React/RCTUIManagerObserverCoordinator.h>
2021

2122
#import "RCTBaseTextInputShadowView.h"
@@ -109,12 +110,15 @@ - (void)handleDidUpdateMultiplierNotification
109110
{
110111
CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier;
111112

112-
for (RCTBaseTextInputShadowView *shadowView in _shadowViews) {
113-
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
114-
[shadowView dirtyLayout];
115-
}
113+
NSHashTable<RCTBaseTextInputShadowView *> *shadowViews = _shadowViews;
114+
RCTExecuteOnUIManagerQueue(^{
115+
for (RCTBaseTextInputShadowView *shadowView in shadowViews) {
116+
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
117+
[shadowView dirtyLayout];
118+
}
116119

117-
[self.bridge.uiManager setNeedsLayout];
120+
[self.bridge.uiManager setNeedsLayout];
121+
});
118122
}
119123

120124
@end

0 commit comments

Comments
 (0)