Skip to content

Commit

Permalink
Cancel fresco slideshow timers on unmount
Browse files Browse the repository at this point in the history
Reviewed By: oprisnik

Differential Revision: D57162106

fbshipit-source-id: fc590a41b3da776b0628355bcbfdec22f89c094b
  • Loading branch information
Connor Mathews authored and facebook-github-bot committed May 9, 2024
1 parent 2b854a6 commit cea406f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ object FrescoVitoSlideshowComponentSpec {

@JvmStatic
@OnUnmount
internal fun onUnmount(c: ComponentContext, slideshowDrawable: FrescoVitoSlideshowDrawable<*>) {
internal fun onUnmount(
c: ComponentContext,
slideshowDrawable: FrescoVitoSlideshowDrawable<*>,
@State(canUpdateLazily = true) timer: Timer,
) {
timer.cancel()
timer.purge()
FrescoVitoSlideshowComponent.lazyUpdateTimer(c, Timer("Fresco Vito slideshow timer"))
val controller = FrescoVitoProvider.getController()
controller.releaseImmediately(slideshowDrawable.previousImage)
controller.releaseImmediately(slideshowDrawable.currentImage)
Expand Down

0 comments on commit cea406f

Please sign in to comment.