Skip to content

Commit 0cbb2d8

Browse files
tbobaalexbumbu
authored andcommitted
fix(iOS): Change retrieving window in FullWindowOverlay (software-mansion#2031)
## Description This PR is a follow up for the PR software-mansion#1526. Currently, in React Native there's `RCTKeyWindow()` method which goes through each window of `RCTSharedApplication()` and selects the window that is a key window of a given window. This is a better solution, since we don't rely on a single `keyWindow` from RCTSharedApplication. I've also added a support for Fabric. I've checked how does FullWindowOverlay work with the change and it works as usual. Closes software-mansion#1526. ## Changes - Changed the method of retrieving window from `delegate.window` to `RCTKeyWindow()` ## Test code and steps to reproduce You can run `Test1844` and check if FullWindowOverlay works correctly. ## Checklist - [X] Included code example that can be used to test this change - [X] Ensured that CI passes Co-authored-by: alexbumbu <alex.bumbu@gmail.com>
1 parent 26720fc commit 0cbb2d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ios/RNSFullWindowOverlay.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ - (RNSFullWindowOverlayContainer *)container
123123

124124
- (void)show
125125
{
126-
UIWindow *window = RCTSharedApplication().delegate.window;
126+
UIWindow *window = RCTKeyWindow();
127127
[window addSubview:_container];
128128
}
129129

@@ -156,7 +156,7 @@ - (void)didMoveToSuperview
156156
// so when the component gets recycled we need to add it back.
157157
- (void)maybeShow
158158
{
159-
UIWindow *window = RCTSharedApplication().delegate.window;
159+
UIWindow *window = RCTKeyWindow();
160160
if (![[window subviews] containsObject:self]) {
161161
[window addSubview:_container];
162162
}

0 commit comments

Comments
 (0)