You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/30 06:45:48 UTC
incubator-weex git commit: * [ios] update handle style method
Repository: incubator-weex
Updated Branches:
refs/heads/0.16-dev 5184544f7 -> 4d176e068
* [ios] update handle style method
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4d176e06
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4d176e06
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4d176e06
Branch: refs/heads/0.16-dev
Commit: 4d176e068e969df969a4530e01f1147764739582
Parents: 5184544
Author: acton393 <zh...@gmail.com>
Authored: Wed Aug 30 14:44:18 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Aug 30 14:44:18 2017 +0800
----------------------------------------------------------------------
.../Sources/Manager/WXComponentManager.h | 4 ++--
.../Sources/Manager/WXComponentManager.m | 23 +++++++++-----------
2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4d176e06/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
index 1af1834..729e6d7 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
@@ -184,9 +184,9 @@ extern void WXPerformBlockOnComponentThread(void (^block)());
/**
* @param styles a NSDictionary value, styles which will resolve
- * @param ref a NSString value, the component ref of target which you want to resolve
+ * @param component a WXComponent value, the target which you want to resolve
* @param isUpdateStyles a BOOL value, YES will udpate the component style property, NO will notifiy the lifeStyle of compoenent to handle, default value is NO.
* @abstract handleStyle will be add to a queue to be executed every frame, but handleStyleOnMainThread will switch to main thread and execute imediately, you can call this for your execution time sequence.
*/
-- (void)handleStyleOnMainThread:(NSDictionary*)styles forComponent:(NSString *)ref isUpdateStyles:(BOOL)isUpdateStyles;
+- (void)handleStyleOnMainThread:(NSDictionary*)styles forComponent:(WXComponent *)component isUpdateStyles:(BOOL)isUpdateStyles;
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4d176e06/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
index d66d74a..86ec447 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
@@ -426,24 +426,21 @@ static css_node_t * rootNodeGetChild(void *context, int i)
[self handleStyles:styles forComponent:ref isUpdateStyles:NO];
}
-- (void)handleStyleOnMainThread:(NSDictionary*)styles forComponent:(NSString *)ref isUpdateStyles:(BOOL)isUpdateStyles
+- (void)handleStyleOnMainThread:(NSDictionary*)styles forComponent:(WXComponent *)component isUpdateStyles:(BOOL)isUpdateStyles
{
WXAssertParam(styles);
- WXAssertParam(ref);
+ WXAssertParam(component);
+ WXAssertMainThread();
+
+ NSMutableDictionary *normalStyles = [NSMutableDictionary new];
+ NSMutableArray *resetStyles = [NSMutableArray new];
+ [self filterStyles:styles normalStyles:normalStyles resetStyles:resetStyles];
+
+ [component _updateStylesOnMainThread:normalStyles resetStyles:resetStyles];
+ [component readyToRender];
WXPerformBlockOnComponentThread(^{
- WXComponent *component = [_indexDict objectForKey:ref];
- WXAssertComponentExist(component);
-
- NSMutableDictionary *normalStyles = [NSMutableDictionary new];
- NSMutableArray *resetStyles = [NSMutableArray new];
- [self filterStyles:styles normalStyles:normalStyles resetStyles:resetStyles];
[component _updateStylesOnComponentThread:normalStyles resetStyles:resetStyles isUpdateStyles:isUpdateStyles];
- WXPerformBlockOnMainThread(^{
- [component _updateStylesOnMainThread:normalStyles resetStyles:resetStyles];
- [component readyToRender];
- });
-
});
}