Commit 3afaff6
feat: refactor
Summary:
This PRs refactors `RCTKeyWindow()` to be more resilient and work in multi-window apps. After my recent PR got merged (facebook#41935) it significantly reduced the number of calls to `RCTKeyWindow()` and now it's called only when necessary. So this PR makes this function a bit more resource intensive but it guarantees that we will find current scene's key window.
This would also fix some brownfield scenarios where React Native is working in multi-window mode and in the future allow us to more easily adopt `UIWindowSceneDelegate`
bypass-github-export-checks
## Changelog:
[IOS] [CHANGED] - refactor `RCTKeyWindow` to be more resilient and work in multi-window apps
Pull Request resolved: facebook#42036
Test Plan:
Checkout RNTester example for Alerts and LoadingView.
https://github.com/facebook/react-native/assets/52801365/8cf4d698-db6d-4a12-8d8d-7a5acf34858b
Reviewed By: huntie
Differential Revision: D52431720
Pulled By: cipolleschi
fbshipit-source-id: 0d6ef1d46b2428c30c9f64dae66b95dbc69f0a3bRCTKeyWindow to be more resilient and work in multi-window apps (facebook#42036)1 parent ce00673 commit 3afaff6
File tree
3 files changed
+17
-32
lines changed- packages/react-native/React
- Base
- CoreModules
3 files changed
+17
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
569 | 576 | | |
570 | 577 | | |
| 578 | + | |
571 | 579 | | |
572 | 580 | | |
573 | 581 | | |
| |||
Lines changed: 1 addition & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 23 | + | |
34 | 24 | | |
35 | 25 | | |
36 | 26 | | |
| |||
65 | 55 | | |
66 | 56 | | |
67 | 57 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 58 | | |
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | | - | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | | - | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| |||
0 commit comments