Commit eb2dfbb
fix: handle broken measureInWindow (#1355)
## 📜 Description
Fixed broken `measureInWindow` measurements in react-native.
## 💡 Motivation and Context
The `measureInWindow` works unreliably in Fabric + formSheet Modal
(facebook/react-native#56062) or on Android with
edge-to-edge enabled
(facebook/react-native#56056)
Upstream fixes are available, but the problem is that it will require at
least RN 0.85+ to work properly. So in this PR we add internal function
that is capable of measuring given view. In future this functionality
can be removed, but for now this is critical to have it bundled within a
package.
Fixes
#1356
## 📢 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
- added `viewPositionInWindow` to `types`;
- added `viewPositionInWindow` to codegen;
- added `viewPositionInWindow` to bindings/module;
- use `viewPositionInWindow` instead of `measureInWindow`;
- added `viewPositionInWindow` to mocks;
### iOS
- implement `viewPositionInWindow`;
- make `activeWindow` objc available;
### Android
- implement `viewPositionInWindow`;
- add `uiManager` and `eventDispatcher` to `ReactContext` extensions;
## 🤔 How Has This Been Tested?
Tested manually on iPhone 17 Pro (iOS 26.2, simulator) and Pixel 9 Pro
(API 35, emulator).
## 📸 Screenshots (if appropriate):
### Android
#### Fabric
|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/afb99e51-043f-459c-90e3-7e1eb1e184ed">|<video
src="https://github.com/user-attachments/assets/8ea0d593-f7bd-47a5-9343-e2fd85f4af45">|
#### Paper
|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/702c7d88-755b-45f0-b39f-fe4aaa60ab2e">|<video
src="https://github.com/user-attachments/assets/f5346bbd-cc85-4a40-9cc5-9422931b04af">|
### iOS
#### Fabric
|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/49fb9ac6-15b8-4842-939c-4ec06a4e0c42">|<video
src="https://github.com/user-attachments/assets/b559a52a-0a91-48bc-911a-7125ce96e013">|
#### Paper
|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/c4d234a7-122a-4023-8d86-fad71ed043dc">|<video
src="https://github.com/user-attachments/assets/d5d48487-16ad-40c2-b6c6-fea85b563e20">|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
---------
Co-authored-by: thomasvo <thomas.vo@openspace.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: kirillzyusko <zyusko.kirik@gmail.com>1 parent f5dca3c commit eb2dfbb
13 files changed
Lines changed: 136 additions & 15 deletions
File tree
- FabricExample/ios
- android/src
- fabric/java/com/reactnativekeyboardcontroller
- main/java/com/reactnativekeyboardcontroller
- extensions
- modal
- modules
- paper/java/com/reactnativekeyboardcontroller
- ios
- extensions
- jest
- src
- components/KeyboardAvoidingView
- specs
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3184 | 3184 | | |
3185 | 3185 | | |
3186 | 3186 | | |
3187 | | - | |
| 3187 | + | |
3188 | 3188 | | |
3189 | 3189 | | |
3190 | 3190 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
6 | 18 | | |
7 | 19 | | |
8 | 20 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | 11 | | |
| 12 | + | |
15 | 13 | | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
| 29 | + | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
77 | 83 | | |
78 | 84 | | |
79 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
80 | 106 | | |
81 | 107 | | |
82 | 108 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
98 | 134 | | |
99 | 135 | | |
100 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
0 commit comments