Commit 83bfcef
authored
Fix an issue where resizing scroll views could result in their content offset being changed erroneously (#557)
### Bug
https://github.com/user-attachments/assets/7f93f74d-0b54-4131-ac52-8970ec623452
### Notes
🐛 If you have a partial modal (or any other modal that resizes), and you
resize the modal while the keyboard is focused and scrolled away from
the top, to be taller (eg by adding content), the scroll view within
would jump up towards the top.
Westin and I had dug in a while ago and thought it was just a UIKit bug,
but it turns out it's an order of operations thing: You need to apply
the new `contentSize` to the scroll view before you make its frame
taller, otherwise UIKit's automatic `contentOffset` adjustment kicks you
back towards the top.
To fix this, I've added a `applyBeforeLayout` addition to
`ViewDescription.Config`, which will be applied before the
`LayoutAttributes` (except on initial view allocation – we still apply
the attributes first so the view's properties are sensical).1 parent 2334742 commit 83bfcef
File tree
5 files changed
+84
-17
lines changed- BlueprintUICommonControls/Sources
- BlueprintUI
- Sources
- BlueprintView
- ViewDescription
- Tests
5 files changed
+84
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
712 | 713 | | |
713 | 714 | | |
714 | 715 | | |
| |||
729 | 730 | | |
730 | 731 | | |
731 | 732 | | |
| 733 | + | |
| 734 | + | |
732 | 735 | | |
733 | 736 | | |
734 | 737 | | |
| |||
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
109 | 120 | | |
110 | 121 | | |
111 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
112 | 127 | | |
113 | 128 | | |
114 | 129 | | |
| |||
154 | 169 | | |
155 | 170 | | |
156 | 171 | | |
157 | | - | |
| 172 | + | |
158 | 173 | | |
159 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
160 | 178 | | |
161 | 179 | | |
162 | 180 | | |
| |||
201 | 219 | | |
202 | 220 | | |
203 | 221 | | |
| 222 | + | |
204 | 223 | | |
205 | 224 | | |
206 | 225 | | |
| |||
217 | 236 | | |
218 | 237 | | |
219 | 238 | | |
220 | | - | |
| 239 | + | |
| 240 | + | |
221 | 241 | | |
222 | 242 | | |
223 | 243 | | |
224 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
225 | 257 | | |
226 | 258 | | |
227 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
34 | 52 | | |
35 | 53 | | |
36 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
62 | 88 | | |
63 | 89 | | |
64 | 90 | | |
| |||
346 | 372 | | |
347 | 373 | | |
348 | 374 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | 375 | | |
359 | 376 | | |
360 | 377 | | |
| |||
363 | 380 | | |
364 | 381 | | |
365 | 382 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | 383 | | |
371 | 384 | | |
372 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
0 commit comments