Do not update loading banner message while hiding
Summary: This diff fixes an issue where the loading banner message could update while the banner hide animation is going, catching your eye for no reason. Changelog: [Fixed] [iOS] Do not update loading banner message while hiding Reviewed By: PeteTheHeat Differential Revision: D21280786 fbshipit-source-id: a10b33cd72f263d08eea6d8e94963514affbe24d
This commit is contained in:
Родитель
3729fe8de0
Коммит
131c497aa2
|
@ -31,6 +31,7 @@ using namespace facebook::react;
|
|||
UILabel *_label;
|
||||
UILabel *_host;
|
||||
NSDate *_showDate;
|
||||
BOOL _hiding;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
@ -85,7 +86,7 @@ RCT_EXPORT_MODULE()
|
|||
|
||||
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor
|
||||
{
|
||||
if (!RCTDevLoadingViewGetEnabled()) {
|
||||
if (!RCTDevLoadingViewGetEnabled() || self->_hiding) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,7 @@ RCT_EXPORT_METHOD(hide)
|
|||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self->_hiding = true;
|
||||
const NSTimeInterval MIN_PRESENTED_TIME = 0.6;
|
||||
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate];
|
||||
NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime);
|
||||
|
@ -173,6 +175,7 @@ RCT_EXPORT_METHOD(hide)
|
|||
self->_window.frame = windowFrame;
|
||||
self->_window.hidden = YES;
|
||||
self->_window = nil;
|
||||
self->_hiding = false;
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче