-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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. (#29882)
Summary: Fixes: #29455 Modal's onDismiss is not called on iOS. This issue occurred the commit bd2b7d6 and was fixed the commit 27a3248. However, the master and stable-0.63 branches do not have this modified commit applied to them. ## Changelog <!-- 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. Pull Request resolved: #29882 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. Reviewed By: shergin Differential Revision: D24648412 Pulled By: hramos fbshipit-source-id: acf28fef21420117c845d3aed97e47b5dd4e9390
- Loading branch information
1 parent
4700075
commit d85d5d2
Showing
7 changed files
with
113 additions
and
20 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 |
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