Skip to content

Commit 131c497

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
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
1 parent 3729fe8 commit 131c497

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

React/CoreModules/RCTDevLoadingView.mm

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ @implementation RCTDevLoadingView {
3131
UILabel *_label;
3232
UILabel *_host;
3333
NSDate *_showDate;
34+
BOOL _hiding;
3435
}
3536

3637
@synthesize bridge = _bridge;
@@ -85,7 +86,7 @@ - (NSString *)getTextForHost
8586

8687
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor
8788
{
88-
if (!RCTDevLoadingViewGetEnabled()) {
89+
if (!RCTDevLoadingViewGetEnabled() || self->_hiding) {
8990
return;
9091
}
9192

@@ -159,6 +160,7 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
159160
}
160161

161162
dispatch_async(dispatch_get_main_queue(), ^{
163+
self->_hiding = true;
162164
const NSTimeInterval MIN_PRESENTED_TIME = 0.6;
163165
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate];
164166
NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime);
@@ -173,6 +175,7 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
173175
self->_window.frame = windowFrame;
174176
self->_window.hidden = YES;
175177
self->_window = nil;
178+
self->_hiding = false;
176179
}];
177180
});
178181
}

0 commit comments

Comments
 (0)