2017-09-21 21:46:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "RCTModalManager.h"
|
|
|
|
|
2017-09-23 17:34:27 +00:00
|
|
|
@interface RCTModalManager ()
|
|
|
|
|
|
|
|
@property BOOL shouldEmit;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2017-09-21 21:46:42 +00:00
|
|
|
@implementation RCTModalManager
|
|
|
|
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
|
|
|
|
- (NSArray<NSString *> *)supportedEvents
|
|
|
|
{
|
|
|
|
return @[ @"modalDismissed" ];
|
|
|
|
}
|
|
|
|
|
2017-09-23 17:34:27 +00:00
|
|
|
- (void)startObserving
|
|
|
|
{
|
|
|
|
_shouldEmit = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)stopObserving
|
|
|
|
{
|
|
|
|
_shouldEmit = NO;
|
|
|
|
}
|
|
|
|
|
2017-09-21 21:46:42 +00:00
|
|
|
- (void)modalDismissed:(NSNumber *)modalID
|
|
|
|
{
|
2017-09-23 17:34:27 +00:00
|
|
|
if (_shouldEmit) {
|
|
|
|
[self sendEventWithName:@"modalDismissed" body:@{ @"modalID": modalID }];
|
|
|
|
}
|
2017-09-21 21:46:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|