@granite-js/lottie 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @granite-js/lottie
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b77824: fix(android): add resource dispose logic for LottieProvider
8
+
9
+ ## 1.0.4
10
+
3
11
  ## 1.0.3
4
12
 
5
13
  ### Patch Changes
@@ -208,6 +208,13 @@ class BuiltInLottieProvider : GraniteLottieProvider {
208
208
  animationViews[view]?.cancelAnimation()
209
209
  }
210
210
 
211
+ override fun disposeView(view: View) {
212
+ animationViews[view]?.cancelAnimation()
213
+ animationViews[view]?.removeAllAnimatorListeners()
214
+ animationViews.remove(view)
215
+ listeners.remove(view)
216
+ }
217
+
211
218
  // Private helpers
212
219
 
213
220
  private fun setupAnimatorListener(lottieView: LottieAnimationView, view: View) {
@@ -190,4 +190,5 @@ interface GraniteLottieProvider {
190
190
  * Cancel any ongoing load operation
191
191
  */
192
192
  fun cancelLoad(view: View)
193
+ fun disposeView(view: View)
193
194
  }
@@ -202,6 +202,10 @@ class GraniteLottieView(context: Context) : FrameLayout(context), GraniteLottieL
202
202
  containerView?.let { provider?.reset(it) }
203
203
  }
204
204
 
205
+ fun dispose() {
206
+ containerView?.let { provider?.disposeView(it) }
207
+ }
208
+
205
209
  private fun loadAnimation() {
206
210
  isLoaded = false
207
211
  val p = provider ?: return
@@ -165,6 +165,11 @@ class GraniteLottieViewManager : SimpleViewManager<GraniteLottieView>(),
165
165
  view.reset()
166
166
  }
167
167
 
168
+ override fun onDropViewInstance(view: GraniteLottieView) {
169
+ view.dispose()
170
+ super.onDropViewInstance(view)
171
+ }
172
+
168
173
  companion object {
169
174
  const val NAME = "GraniteLottieView"
170
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/lottie",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Pluggable Lottie animation component for React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/module/index.js",