Provide default loading view for React views in Wilde

Reviewed By: @javache

Differential Revision: D2496540

fb-gh-sync-id: 31488a6d1fc1f679ab4361d6a8d48f19b2347703
This commit is contained in:
Robert Fleischmann 2015-10-06 10:32:04 -07:00 committed by facebook-github-bot-7
parent 9e81dec5e4
commit 0de9e0104a
1 changed files with 16 additions and 12 deletions

View File

@ -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];
}
}
}