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
This commit is contained in:
Mehdi Mulani 2018-02-16 12:08:57 -08:00 committed by Facebook Github Bot
parent b48f7e5605
commit cff522d283
2 changed files with 18 additions and 10 deletions

View File

@ -13,6 +13,7 @@
#import <React/RCTShadowView+Layout.h>
#import <React/RCTShadowView.h>
#import <React/RCTUIManager.h>
#import <React/RCTUIManagerUtils.h>
#import <React/RCTUIManagerObserverCoordinator.h>
#import "RCTTextShadowView.h"
@ -83,12 +84,15 @@ RCT_EXPORT_VIEW_PROPERTY(selectable, BOOL)
{
CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier;
for (RCTTextShadowView *shadowView in _shadowViews) {
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
[shadowView dirtyLayout];
}
NSHashTable<RCTTextShadowView *> *shadowViews = _shadowViews;
RCTExecuteOnUIManagerQueue(^{
for (RCTTextShadowView *shadowView in shadowViews) {
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
[shadowView dirtyLayout];
}
[self.bridge.uiManager setNeedsLayout];
[self.bridge.uiManager setNeedsLayout];
});
}
@end

View File

@ -16,6 +16,7 @@
#import <React/RCTShadowView+Layout.h>
#import <React/RCTShadowView.h>
#import <React/RCTUIManager.h>
#import <React/RCTUIManagerUtils.h>
#import <React/RCTUIManagerObserverCoordinator.h>
#import "RCTBaseTextInputShadowView.h"
@ -109,12 +110,15 @@ RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTBubblingEventBlock)
{
CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier;
for (RCTBaseTextInputShadowView *shadowView in _shadowViews) {
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
[shadowView dirtyLayout];
}
NSHashTable<RCTBaseTextInputShadowView *> *shadowViews = _shadowViews;
RCTExecuteOnUIManagerQueue(^{
for (RCTBaseTextInputShadowView *shadowView in shadowViews) {
shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier;
[shadowView dirtyLayout];
}
[self.bridge.uiManager setNeedsLayout];
[self.bridge.uiManager setNeedsLayout];
});
}
@end