@granite-js/lottie 1.0.15 → 1.0.17

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.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 98f8db8: Add duration prop support for Android native view
8
+
9
+ ## 1.0.16
10
+
3
11
  ## 1.0.15
4
12
 
5
13
  ## 1.0.14
@@ -91,7 +91,8 @@ data class GraniteLottieLoadConfig(
91
91
  var enableMergePaths: Boolean = false,
92
92
  var enableSafeMode: Boolean = false,
93
93
  var hardwareAcceleration: Boolean = false,
94
- var imageAssetsFolder: String? = null
94
+ var imageAssetsFolder: String? = null,
95
+ var duration: Float? = null
95
96
  )
96
97
 
97
98
  /**
@@ -154,6 +154,10 @@ class GraniteLottieView(context: Context) : FrameLayout(context), GraniteLottieL
154
154
  config.imageAssetsFolder = folder
155
155
  }
156
156
 
157
+ fun setDuration(duration: Double) {
158
+ config.duration = if (duration > 0) duration.toFloat() else null
159
+ }
160
+
157
161
  fun setColorFilters(filters: List<Map<String, Any>>?) {
158
162
  if (filters != null) {
159
163
  config.colorFilters = filters.mapNotNull { filter ->
@@ -112,6 +112,11 @@ class GraniteLottieViewManager : SimpleViewManager<GraniteLottieView>(),
112
112
  view.setCacheComposition(value)
113
113
  }
114
114
 
115
+ @ReactProp(name = "duration")
116
+ override fun setDuration(view: GraniteLottieView, value: Double) {
117
+ view.setDuration(value)
118
+ }
119
+
115
120
  // Filter props
116
121
  @ReactProp(name = "colorFilters")
117
122
  override fun setColorFilters(view: GraniteLottieView, value: ReadableArray?) {
@@ -49,6 +49,7 @@ export interface NativeProps extends ViewProps {
49
49
  // Animation control
50
50
  progress?: Float;
51
51
  speed?: Double;
52
+ duration?: Double;
52
53
  loop?: WithDefault<boolean, true>;
53
54
  autoPlay?: WithDefault<boolean, false>;
54
55
 
@@ -27,6 +27,7 @@ export interface NativeProps extends ViewProps {
27
27
  sourceDotLottieURI?: string;
28
28
  progress?: Float;
29
29
  speed?: Double;
30
+ duration?: Double;
30
31
  loop?: WithDefault<boolean, true>;
31
32
  autoPlay?: WithDefault<boolean, false>;
32
33
  resizeMode?: WithDefault<string, 'contain'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/lottie",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Pluggable Lottie animation component for React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/module/index.js",
@@ -49,6 +49,7 @@ export interface NativeProps extends ViewProps {
49
49
  // Animation control
50
50
  progress?: Float;
51
51
  speed?: Double;
52
+ duration?: Double;
52
53
  loop?: WithDefault<boolean, true>;
53
54
  autoPlay?: WithDefault<boolean, false>;
54
55