Commit bfb3b70
Support clipping to children everywhere using ReactViewBackgroundManager (facebook#44734)
Summary:
Pull Request resolved: facebook#44734
Fixes facebook#44671
This integrates functionality for clipping content to padding box into `ReactViewBackgroundManager`, to be shared between several ViewManagers. In practice, this means:
1. `overflow: hidden` now works on `Text` and `TextInput`
2. ScrollView children are now clipped to the interior of borders, included curved ones via borderRadius
This will be made more generic, then start being used in ReactViewGroup, and eventually ReactImage. That abstraction will then hide away extra background management we will use for shadows.
Different places in code currently do clipping in any of `draw()`, `onDraw()`, or `dispatchDraw()`. The distinction between these, is that `draw()` allows code to run before drawing background even, `onDraw()` is invoked before drawing foreground, and `dispatchDraw()` is before drawing children. We don't want to clip out borders/shadows, but do want to clip foreground content like text, so I used `onDraw()` here.
Changelog:
[Android][Fixed] - Better overflow support for ScrollView, Text, TextInput
Reviewed By: rozele
Differential Revision: D57953429
fbshipit-source-id: ca3b788deb4b32706df7db958877d18f525c039c1 parent c9d7774 commit bfb3b70
File tree
8 files changed
+115
-27
lines changed- packages/react-native/ReactAndroid
- api
- src/main/java/com/facebook/react/views
- scroll
- textinput
- text
- view
8 files changed
+115
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6703 | 6703 | | |
6704 | 6704 | | |
6705 | 6705 | | |
6706 | | - | |
| 6706 | + | |
6707 | 6707 | | |
6708 | 6708 | | |
6709 | 6709 | | |
| |||
6832 | 6832 | | |
6833 | 6833 | | |
6834 | 6834 | | |
| 6835 | + | |
6835 | 6836 | | |
6836 | 6837 | | |
6837 | 6838 | | |
| |||
7383 | 7384 | | |
7384 | 7385 | | |
7385 | 7386 | | |
| 7387 | + | |
7386 | 7388 | | |
7387 | 7389 | | |
7388 | 7390 | | |
| |||
7408 | 7410 | | |
7409 | 7411 | | |
7410 | 7412 | | |
| 7413 | + | |
7411 | 7414 | | |
7412 | 7415 | | |
7413 | 7416 | | |
| |||
7687 | 7690 | | |
7688 | 7691 | | |
7689 | 7692 | | |
| 7693 | + | |
7690 | 7694 | | |
7691 | 7695 | | |
7692 | 7696 | | |
| |||
7719 | 7723 | | |
7720 | 7724 | | |
7721 | 7725 | | |
| 7726 | + | |
7722 | 7727 | | |
7723 | 7728 | | |
7724 | 7729 | | |
| |||
7804 | 7809 | | |
7805 | 7810 | | |
7806 | 7811 | | |
| 7812 | + | |
7807 | 7813 | | |
7808 | 7814 | | |
7809 | 7815 | | |
| |||
7912 | 7918 | | |
7913 | 7919 | | |
7914 | 7920 | | |
| 7921 | + | |
7915 | 7922 | | |
7916 | 7923 | | |
7917 | 7924 | | |
7918 | 7925 | | |
7919 | 7926 | | |
7920 | 7927 | | |
| 7928 | + | |
7921 | 7929 | | |
7922 | 7930 | | |
7923 | 7931 | | |
| |||
Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | 87 | | |
89 | 88 | | |
90 | 89 | | |
| |||
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 309 | + | |
| 310 | + | |
317 | 311 | | |
318 | 312 | | |
319 | 313 | | |
| |||
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | 86 | | |
88 | 87 | | |
89 | 88 | | |
| |||
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | 643 | | |
649 | 644 | | |
650 | 645 | | |
651 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
652 | 653 | | |
653 | 654 | | |
654 | 655 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
385 | 387 | | |
386 | 388 | | |
387 | 389 | | |
| |||
741 | 743 | | |
742 | 744 | | |
743 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
744 | 750 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
223 | 229 | | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
1226 | 1227 | | |
1227 | 1228 | | |
1228 | 1229 | | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
1229 | 1240 | | |
1230 | 1241 | | |
1231 | 1242 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1038 | 1038 | | |
1039 | 1039 | | |
1040 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1041 | 1046 | | |
1042 | 1047 | | |
1043 | 1048 | | |
| |||
Lines changed: 66 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
19 | 29 | | |
20 | | - | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
| 33 | + | |
23 | 34 | | |
24 | 35 | | |
25 | 36 | | |
| |||
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
31 | | - | |
| 42 | + | |
32 | 43 | | |
33 | 44 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
42 | | - | |
| 53 | + | |
43 | 54 | | |
44 | 55 | | |
45 | | - | |
| 56 | + | |
46 | 57 | | |
47 | 58 | | |
48 | 59 | | |
49 | | - | |
| 60 | + | |
50 | 61 | | |
51 | 62 | | |
52 | 63 | | |
53 | | - | |
| 64 | + | |
54 | 65 | | |
55 | 66 | | |
56 | 67 | | |
| |||
84 | 95 | | |
85 | 96 | | |
86 | 97 | | |
| 98 | + | |
| 99 | + | |
| 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 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
87 | 144 | | |
0 commit comments