mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Avoid oversending modalDismissed event
Reviewed By: shergin Differential Revision: D5895366 fbshipit-source-id: 6d1ca424d2d43fadb48354a1cbad94714448a380
This commit is contained in:
parent
49359e879b
commit
9bf936ccba
@ -9,6 +9,12 @@
|
||||
|
||||
#import "RCTModalManager.h"
|
||||
|
||||
@interface RCTModalManager ()
|
||||
|
||||
@property BOOL shouldEmit;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTModalManager
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
@ -18,9 +24,21 @@ RCT_EXPORT_MODULE();
|
||||
return @[ @"modalDismissed" ];
|
||||
}
|
||||
|
||||
- (void)startObserving
|
||||
{
|
||||
_shouldEmit = YES;
|
||||
}
|
||||
|
||||
- (void)stopObserving
|
||||
{
|
||||
_shouldEmit = NO;
|
||||
}
|
||||
|
||||
- (void)modalDismissed:(NSNumber *)modalID
|
||||
{
|
||||
[self sendEventWithName:@"modalDismissed" body:@{ @"modalID": modalID }];
|
||||
if (_shouldEmit) {
|
||||
[self sendEventWithName:@"modalDismissed" body:@{ @"modalID": modalID }];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user