From 0de9e0104af72fe4c7dcf2bdfd1f52e531f69362 Mon Sep 17 00:00:00 2001 From: Robert Fleischmann Date: Tue, 6 Oct 2015 10:32:04 -0700 Subject: [PATCH] Provide default loading view for React views in Wilde Reviewed By: @javache Differential Revision: D2496540 fb-gh-sync-id: 31488a6d1fc1f679ab4361d6a8d48f19b2347703 --- React/Base/RCTRootView.m | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 15ed227af..ca2f75e3f 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -141,19 +141,23 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - (void)hideLoadingView { if (_loadingView.superview == self && _contentView.contentHasAppeared) { + if (_loadingViewFadeDuration > 0) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_loadingViewFadeDelay * NSEC_PER_SEC)), + dispatch_get_main_queue(), ^{ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_loadingViewFadeDelay * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - - [UIView transitionWithView:self - duration:_loadingViewFadeDuration - options:UIViewAnimationOptionTransitionCrossDissolve - animations:^{ - _loadingView.hidden = YES; - } completion:^(__unused BOOL finished) { - [_loadingView removeFromSuperview]; - }]; - }); + [UIView transitionWithView:self + duration:_loadingViewFadeDuration + options:UIViewAnimationOptionTransitionCrossDissolve + animations:^{ + _loadingView.hidden = YES; + } completion:^(__unused BOOL finished) { + [_loadingView removeFromSuperview]; + }]; + }); + } else { + _loadingView.hidden = YES; + [_loadingView removeFromSuperview]; + } } }