Permalink
Browse files

Avoid oversending modalDismissed event

Reviewed By: shergin

Differential Revision: D5895366

fbshipit-source-id: 6d1ca424d2d43fadb48354a1cbad94714448a380
  • Loading branch information...
mmmulani authored and facebook-github-bot committed Sep 23, 2017
1 parent 49359e8 commit 9bf936ccba257ad7b0377442f324883ab9d436df
Showing with 19 additions and 1 deletion.
  1. +19 −1 React/Views/RCTModalManager.m
@@ -9,6 +9,12 @@
#import "RCTModalManager.h"
@interface RCTModalManager ()
@property BOOL shouldEmit;
@end
@implementation RCTModalManager
RCT_EXPORT_MODULE();
@@ -18,9 +24,21 @@ @implementation RCTModalManager
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

0 comments on commit 9bf936c

Please sign in to comment.