Repository navigation
Commit 3ea1b38
authored
fix(macos): animated images (GIF) freeze on first frame (#3168)
### Summary:
Fixes #3165.
On macOS, animated GIFs in `<Image>` show only their first frame.
`RCTUIImageViewAnimated` gets its display link from
`+[RCTDisplayWeakRefreshable displayLinkWithWeakRefreshable:]`,
which makes a weak proxy the link's target. On iOS that is needed
because `CADisplayLink` retains its target. On macOS,
`RCTPlatformDisplayLink` holds its target weakly, so nothing owns the
proxy. It is freed as soon as the method
returns, and the link's ticks go to `nil`.
**Fix:** on macOS, make the view itself the link's target. The link
already holds it weakly, so there is no retain
cycle. iOS is unchanged.
### Testing:
RNTester (macOS, Fabric) → Image → Animated GIF. On `main` that example
is hidden by an RNTester bug that #3164 fixes.
https://github.com/user-attachments/assets/4f4e561c-89f3-4082-ae1f-22136c16e6a8
- Before: the GIF stays on its first frame. After: it animates.1 parent b55c746 commit 3ea1b38
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
0 commit comments