Commit fe046dc
fix(style)(backgroundSize) - Passing unsupported backgroundSize on android causes crash (#55904)
Summary:
Below snippet would lead to divide by zero crash on android. Currently, "`cover` | `contain`" keywords are not supported for background size as these only work on actual images (`url()` syntax) and not on gradients. These keywords were supposed to be removed in this [commit](34c041c) and added later in this [PR](#54994)
```jsx
<View
style={{
experimental_backgroundImage: "radial-gradient(circle, #f093fb, #f5576c)",
experimental_backgroundSize: "cover",
width: 100,
height: 100
}}
/>;
```
## Changelog:
[ANDROID] [FIXED] - Unsupported background size value leading to crash
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: #55904
Test Plan: Tested the BackgroundImage example on RNTester.
Reviewed By: christophpurrer
Differential Revision: D95202400
Pulled By: NickGerleman
fbshipit-source-id: 287f4710c4afc031b7f5e080f544e8dadfc007d21 parent 540120a commit fe046dc
7 files changed
Lines changed: 53 additions & 69 deletions
File tree
- packages
- react-native
- Libraries/StyleSheet
- __tests__
- ReactAndroid/src/main/java/com/facebook/react
- uimanager/drawable
- views/view
- rn-tester/js/examples/BackgroundImage
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
433 | 430 | | |
434 | 431 | | |
435 | 432 | | |
| |||
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
789 | 786 | | |
790 | 787 | | |
791 | 788 | | |
| |||
Lines changed: 30 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
47 | 44 | | |
48 | | - | |
| 45 | + | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 50 | | |
62 | 51 | | |
63 | 52 | | |
| |||
111 | 100 | | |
112 | 101 | | |
113 | 102 | | |
114 | | - | |
| 103 | + | |
115 | 104 | | |
116 | | - | |
| 105 | + | |
117 | 106 | | |
118 | 107 | | |
119 | 108 | | |
| |||
125 | 114 | | |
126 | 115 | | |
127 | 116 | | |
128 | | - | |
| 117 | + | |
129 | 118 | | |
130 | | - | |
| 119 | + | |
131 | 120 | | |
132 | 121 | | |
133 | 122 | | |
134 | 123 | | |
135 | | - | |
| 124 | + | |
136 | 125 | | |
137 | | - | |
| 126 | + | |
138 | 127 | | |
139 | 128 | | |
140 | 129 | | |
| |||
172 | 161 | | |
173 | 162 | | |
174 | 163 | | |
175 | | - | |
| 164 | + | |
176 | 165 | | |
177 | 166 | | |
178 | 167 | | |
179 | | - | |
| 168 | + | |
180 | 169 | | |
181 | 170 | | |
182 | 171 | | |
| |||
214 | 203 | | |
215 | 204 | | |
216 | 205 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
220 | 211 | | |
221 | 212 | | |
222 | 213 | | |
223 | | - | |
| 214 | + | |
224 | 215 | | |
225 | 216 | | |
226 | 217 | | |
227 | | - | |
228 | | - | |
229 | 218 | | |
230 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
231 | 228 | | |
Lines changed: 7 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 67 | + | |
73 | 68 | | |
74 | 69 | | |
75 | 70 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | 364 | | |
366 | 365 | | |
367 | 366 | | |
| |||
373 | 372 | | |
374 | 373 | | |
375 | 374 | | |
376 | | - | |
377 | 375 | | |
378 | 376 | | |
379 | 377 | | |
| |||
386 | 384 | | |
387 | 385 | | |
388 | 386 | | |
389 | | - | |
390 | 387 | | |
391 | 388 | | |
392 | 389 | | |
| |||
401 | 398 | | |
402 | 399 | | |
403 | 400 | | |
404 | | - | |
405 | 401 | | |
406 | 402 | | |
407 | 403 | | |
| |||
0 commit comments