Skip to content

Commit 218832b

Browse files
Merge pull request #13 from mrichie/master
prevent multiple Toast overlaps in iOS - testing it now
2 parents e6c1c89 + 654dccb commit 218832b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ios/Toast+UIView.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
static const NSString * CSToastTimerKey = @"CSToastTimerKey";
4747
static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
4848

49+
static UIView *prevToast = NULL;
50+
4951
@interface UIView (ToastPrivate)
5052

5153
- (void)hideToast:(UIView *)toast;
@@ -91,6 +93,10 @@ - (void)showToast:(UIView *)toast {
9193
}
9294

9395
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point {
96+
if(prevToast){
97+
[self hideToast:prevToast];
98+
}
99+
prevToast = toast;
94100
toast.center = [self centerPointForPosition:point withToast:toast];
95101
toast.alpha = 0.0;
96102

0 commit comments

Comments
 (0)