Commit 8143e0f
authored
fix: Android crash on empty CSS strokeDasharray from the default keyframe endpoint (#9845)
## Summary
Animating `strokeDasharray` with an implicit default keyframe endpoint
ships an empty array to react-native-svg (the default
`SVGStrokeDashArray()` serializes to `[]`), which crashes Android's
`DashPathEffect` - it requires at least 2 intervals. #9719 does not
cover this case because 0 is an even length.
Per CSS, the initial `stroke-dasharray` is `none` (a solid stroke), so
serialize the empty array as `null`, which react-native-svg renders as a
solid stroke.
## Test plan
Open the CSS app > Animated Properties > SVG > Stroke on Android.
Before: a release build crashes within seconds of opening the screen.
After: all examples render correctly and survive restart + scroll soaks.
Recordings below.1 parent 284b983 commit 8143e0f
2 files changed
Lines changed: 11 additions & 0 deletions
File tree
- packages/react-native-reanimated/Common/cpp/reanimated/CSS/svg/values
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
0 commit comments