You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mo...@apache.org on 2019/04/01 02:46:32 UTC
[incubator-weex] branch master updated: [iOS] Support to use
loading-indicator separately.
This is an automated email from the ASF dual-hosted git repository.
moshen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new af516f2 [iOS] Support to use loading-indicator separately.
new 649d813 Merge pull request #2262 from sunshl/feature_loadingindicator_ios
af516f2 is described below
commit af516f2c11d2de55b09e2176976608d795ccb49e
Author: huanglei.hl <hu...@alibaba-inc.com>
AuthorDate: Thu Mar 28 18:15:40 2019 +0800
[iOS] Support to use loading-indicator separately.
* feature: Support to use loading-indicator separately. Use animating property to control.
* doc pr: apache/incubator-weex-site#363
* demo: http://dotwe.org/vue/15b0ac96db6e1837ef5c27c0345b7fb6
---
.../WeexSDK/Sources/Component/WXLoadingIndicator.m | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXLoadingIndicator.m b/ios/sdk/WeexSDK/Sources/Component/WXLoadingIndicator.m
index 3affb2b..c678ce3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXLoadingIndicator.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXLoadingIndicator.m
@@ -23,6 +23,7 @@
@implementation WXLoadingIndicator {
UIActivityIndicatorView *_indicator;
UIColor *_indicatorColor;
+ id _animating;
}
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance {
@@ -31,6 +32,9 @@
if (styles[@"color"]) {
_indicatorColor = [WXConvert UIColor:styles[@"color"]];
}
+ if (attributes[@"animating"]) {
+ _animating = attributes[@"animating"];
+ }
}
return self;
}
@@ -45,6 +49,13 @@
if (_indicatorColor) {
_indicator.color = _indicatorColor;
}
+ if (_animating) {
+ if ([WXConvert BOOL:_animating]) {
+ [_indicator startAnimating];
+ } else {
+ [_indicator stopAnimating];
+ }
+ }
}
- (void)updateStyles:(NSDictionary *)styles {
@@ -54,6 +65,19 @@
}
}
+- (void)updateAttributes:(NSDictionary *)attributes
+{
+ if (attributes[@"animating"]) {
+ _animating = attributes[@"animating"];
+
+ if ([WXConvert BOOL:_animating]) {
+ [_indicator startAnimating];
+ } else {
+ [_indicator stopAnimating];
+ }
+ }
+}
+
#pragma mark - lifeCircle
- (void)viewWillUnload {