You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/06/13 09:00:04 UTC

incubator-weex git commit: [WEEX-440][iOS] Hide loading when the list are less than screen height. Avoid UI blink when loading finished.

Repository: incubator-weex
Updated Branches:
  refs/heads/master 8a0f304fc -> 0eb7683f8


[WEEX-440][iOS] Hide loading when the list are less than screen height. Avoid UI blink when loading finished.


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/0eb7683f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/0eb7683f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/0eb7683f

Branch: refs/heads/master
Commit: 0eb7683f8258691930017f4fe3fb79edeeedf6db
Parents: 8a0f304
Author: Xiaomin <ca...@yahoo.com>
Authored: Thu Jun 7 15:58:20 2018 +0800
Committer: Adam Feng <cx...@gmail.com>
Committed: Wed Jun 13 16:58:45 2018 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXLoadingComponent.mm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0eb7683f/ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm
index 388548f..a9f90fa 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXLoadingComponent.mm
@@ -78,10 +78,8 @@
 - (void)viewDidLoad
 {
     _initFinished = YES;
-    
-    if (!_displayState) {
-        [_indicator.view setHidden:YES];
-    }
+
+    [self setDisplay];
 }
 
 - (void)addEvent:(NSString *)eventName
@@ -115,12 +113,20 @@
     CGPoint contentOffset = [scrollerProtocol contentOffset];
     if (_displayState) {
         contentOffset.y = [scrollerProtocol contentSize].height - scroller.calculatedFrame.size.height + self.calculatedFrame.size.height;
+        self.view.hidden = NO;
         [_indicator start];
     } else {
         contentOffset.y = contentOffset.y - self.calculatedFrame.size.height;
         [_indicator stop];
+        self.view.hidden = YES;
+    }
+    if (contentOffset.y > 0) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [UIView animateWithDuration:0.25 animations:^{
+                [scrollerProtocol setContentOffset:contentOffset animated:NO];
+            } completion:nil];
+        });
     }
-    [scrollerProtocol setContentOffset:contentOffset animated:YES];
 }
 
 - (void)_insertSubcomponent:(WXComponent *)subcomponent atIndex:(NSInteger)index