Commit 2a3bcee
authored
fix:
## 📜 Description
Use `window` size instead of `screen`.
## 💡 Motivation and Context
Originally I added code in
#948
(used subscription on `screen` instead of `window`). In
#957
I realized that new approach has downsides and started to use
`layoutSubviews` method instead of subscription to events that apple
provides (and I kept using `screen` size as main source of truth).
However on iPad in multi-task/stage-manager mode screen size may not
reflect a real window size (because if window is floating it can be much
smaller than the screen).
So in this PR I'm refining solutions made in
#948
and
#957.
We still need to use `window` as main source of truth and we need to
read it in `layoutSubviews` because new dimensions may not be available
in events that we receive from notification center.
I tested repo provided in
#948
and
#957
and with new code they still seem to work well:
|948|957|
|----|----|
|<video
src="https://github.com/user-attachments/assets/80755323-dad0-49ef-8cde-916e1f3c525a">|<video
src="https://github.com/user-attachments/assets/72b7b9e9-f385-45df-824e-c392f60f1af7">|
Closes
#1045
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### JS
- read `window` dimensions instead of `screen`;
### iOS
- use `self.window` instead of `UIScreen.main`;
## 🤔 How Has This Been Tested?
Tested manually on iPad 11 Pro (m4, 16GB, iOS 18.5).
## 📸 Screenshots (if appropriate):
|Before|After|
|-------|-----|
|<img width="1668" height="2420" alt="image"
src="https://github.com/user-attachments/assets/d5ffe241-285a-44f5-869a-ac399308d281"
/>|<img width="1668" height="2420" alt="image"
src="https://github.com/user-attachments/assets/59e73c7d-0618-4140-bec7-4547d9d29a2a"
/>|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changedKeyboardExtender width on iPad in split mode (#1113)1 parent 77b3af5 commit 2a3bcee
File tree
8 files changed
+48
-14
lines changed- .github/workflows
- FabricExample/ios
- KeyboardControllerFabricExample.xcodeproj
- KeyboardControllerFabricExample
- example/ios
- KeyboardControllerExample.xcodeproj
- KeyboardControllerExample
- ios/views
- src/hooks/useWindowDimensions
8 files changed
+48
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
244 | 246 | | |
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
| 250 | + | |
| 251 | + | |
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
| |||
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
286 | 292 | | |
| 293 | + | |
| 294 | + | |
287 | 295 | | |
288 | 296 | | |
289 | 297 | | |
| |||
408 | 416 | | |
409 | 417 | | |
410 | 418 | | |
| 419 | + | |
| 420 | + | |
411 | 421 | | |
412 | 422 | | |
| 423 | + | |
413 | 424 | | |
414 | 425 | | |
415 | 426 | | |
| |||
435 | 446 | | |
436 | 447 | | |
437 | 448 | | |
| 449 | + | |
| 450 | + | |
438 | 451 | | |
| 452 | + | |
439 | 453 | | |
440 | 454 | | |
441 | 455 | | |
| |||
517 | 531 | | |
518 | 532 | | |
519 | 533 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 534 | + | |
524 | 535 | | |
525 | 536 | | |
526 | 537 | | |
| |||
600 | 611 | | |
601 | 612 | | |
602 | 613 | | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
| 614 | + | |
607 | 615 | | |
608 | 616 | | |
609 | 617 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
| 567 | + | |
| 568 | + | |
567 | 569 | | |
568 | 570 | | |
| 571 | + | |
569 | 572 | | |
570 | 573 | | |
571 | 574 | | |
| |||
588 | 591 | | |
589 | 592 | | |
590 | 593 | | |
| 594 | + | |
| 595 | + | |
591 | 596 | | |
| 597 | + | |
592 | 598 | | |
593 | 599 | | |
594 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
0 commit comments