forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cannot working Modal's onDismiss
Summary: Fixes: facebook#29455 Modal's onDismiss is not called on iOS. This issue occurred the commit facebook@bd2b7d6 and was fixed the commit facebook@27a3248. However, the master and stable-0.63 branches do not have this modified commit applied to them. <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Modal's onDismiss prop will now be called successfully. Test Plan: Tested on iOS with this change: 1. Set function Modal's onDismiss prop. 1. Set Modal's visible props is true. (show Modal) 1. Set Modal's visible props is false. (close Modal) 1. The set function in onDismiss is called.
- Loading branch information
Showing
5 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* 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 <UIKit/UIKit.h> | ||
|
||
#import <React/RCTBridgeModule.h> | ||
#import <React/RCTEventEmitter.h> | ||
|
||
@interface RCTModalManager : RCTEventEmitter <RCTBridgeModule> | ||
|
||
- (void)modalDismissed:(NSNumber *)modalID; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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 |