Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Fix richtext multi-thread issue. (#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and doumafang committed Feb 28, 2019
1 parent 06c6e27 commit bf7e994
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ios/sdk/WeexSDK/Sources/Component/WXRichText.mm
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,18 @@ - (void)updateStyles:(NSDictionary *)styles {
if (styles[@"lineHeight"]) {
_lineHeight = [WXConvert CGFloat:styles[@"lineHeight"]] / 2;
}
[_styles addEntriesFromDictionary:styles];
[self syncTextStorageForView];

WXPerformBlockOnComponentThread(^{
[_styles addEntriesFromDictionary:styles];
[self syncTextStorageForView];
});
}

- (void)updateAttributes:(NSDictionary *)attributes {
_attributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[self syncTextStorageForView];
WXPerformBlockOnComponentThread(^{
_attributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[self syncTextStorageForView];
});
}

- (void)syncTextStorageForView {
Expand Down

0 comments on commit bf7e994

Please sign in to comment.