mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
56e0309b78
Summary: Changelog: [internal] "onDismiss" event wasn't called in Fabric. This diff adds it. Paper implementation of Modal uses `RCTEventEmitter` instead of callback to deliver the event. To align better with Paper, Fabric will follow this pattern. Reviewed By: shergin Differential Revision: D26911312 fbshipit-source-id: b0de619c5a02c3378d1f7ac3ce1b705bb5fb634d
52 lines
813 B
Objective-C
52 lines
813 B
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTModalManager.h"
|
|
|
|
@interface RCTModalManager ()
|
|
|
|
@property BOOL shouldEmit;
|
|
|
|
@end
|
|
|
|
@implementation RCTModalManager
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
- (NSArray<NSString *> *)supportedEvents
|
|
{
|
|
return @[ @"modalDismissed" ];
|
|
}
|
|
|
|
- (void)startObserving
|
|
{
|
|
_shouldEmit = YES;
|
|
}
|
|
|
|
- (void)stopObserving
|
|
{
|
|
_shouldEmit = NO;
|
|
}
|
|
|
|
- (void)modalDismissed:(NSNumber *)modalID
|
|
{
|
|
if (_shouldEmit) {
|
|
[self sendEventWithName:@"modalDismissed" body:@{@"modalID" : modalID}];
|
|
}
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation RCTBridge (RCTDevSettings)
|
|
|
|
- (RCTModalManager *)modalManager
|
|
{
|
|
return [self moduleForClass:[RCTModalManager class]];
|
|
}
|
|
|
|
@end
|