@@ -3,6 +3,7 @@ package com.ease
33import android.graphics.Color
44import com.facebook.react.bridge.Arguments
55import com.facebook.react.bridge.ReadableArray
6+ import com.facebook.react.bridge.ReadableMap
67import com.facebook.react.bridge.WritableMap
78import com.facebook.react.module.annotations.ReactModule
89import com.facebook.react.uimanager.PixelUtil
@@ -126,122 +127,11 @@ class EaseViewManager : ReactViewManager() {
126127 view.initialAnimateBorderRadius = PixelUtil .toPixelFromDIP(value)
127128 }
128129
129- // --- Transition config setters ---
130-
131- @ReactProp(name = " transitionType" )
132- fun setTransitionType (view : EaseView , value : String? ) {
133- view.transitionType = value ? : " timing"
134- }
135-
136- @ReactProp(name = " transitionDuration" , defaultInt = 300 )
137- fun setTransitionDuration (view : EaseView , value : Int ) {
138- view.transitionDuration = value
139- }
140-
141- @ReactProp(name = " transitionEasingBezier" )
142- fun setTransitionEasingBezier (view : EaseView , value : ReadableArray ? ) {
143- if (value != null && value.size() == 4 ) {
144- view.transitionEasingBezier = floatArrayOf(
145- value.getDouble(0 ).toFloat(),
146- value.getDouble(1 ).toFloat(),
147- value.getDouble(2 ).toFloat(),
148- value.getDouble(3 ).toFloat()
149- )
150- } else {
151- // Fallback: easeInOut
152- view.transitionEasingBezier = floatArrayOf(0.42f , 0f , 0.58f , 1.0f )
153- }
154- }
155-
156- @ReactProp(name = " transitionDamping" , defaultFloat = 15f )
157- fun setTransitionDamping (view : EaseView , value : Float ) {
158- view.transitionDamping = value
159- }
160-
161- @ReactProp(name = " transitionStiffness" , defaultFloat = 120f )
162- fun setTransitionStiffness (view : EaseView , value : Float ) {
163- view.transitionStiffness = value
164- }
165-
166- @ReactProp(name = " transitionMass" , defaultFloat = 1f )
167- fun setTransitionMass (view : EaseView , value : Float ) {
168- view.transitionMass = value
169- }
170-
171- @ReactProp(name = " transitionLoop" )
172- fun setTransitionLoop (view : EaseView , value : String? ) {
173- view.transitionLoop = value ? : " none"
174- }
175-
176- @ReactProp(name = " transitionDelay" , defaultInt = 0 )
177- fun setTransitionDelay (view : EaseView , value : Int ) {
178- view.transitionDelay = value.toLong()
179- }
180-
181- // --- Per-property transition arrays ---
182-
183- @ReactProp(name = " perPropertyTransitionTypes" )
184- fun setPerPropertyTransitionTypes (view : EaseView , value : ReadableArray ? ) {
185- if (value != null && value.size() == 10 ) {
186- view.perPropertyTransitionTypes = Array (10 ) { value.getString(it) ? : " " }
187- } else {
188- view.perPropertyTransitionTypes = null
189- }
190- }
191-
192- @ReactProp(name = " perPropertyTransitionDurations" )
193- fun setPerPropertyTransitionDurations (view : EaseView , value : ReadableArray ? ) {
194- if (value != null && value.size() == 10 ) {
195- view.perPropertyTransitionDurations = IntArray (10 ) { value.getInt(it) }
196- } else {
197- view.perPropertyTransitionDurations = null
198- }
199- }
200-
201- @ReactProp(name = " perPropertyTransitionDampings" )
202- fun setPerPropertyTransitionDampings (view : EaseView , value : ReadableArray ? ) {
203- if (value != null && value.size() == 10 ) {
204- view.perPropertyTransitionDampings = FloatArray (10 ) { value.getDouble(it).toFloat() }
205- } else {
206- view.perPropertyTransitionDampings = null
207- }
208- }
209-
210- @ReactProp(name = " perPropertyTransitionStiffnesses" )
211- fun setPerPropertyTransitionStiffnesses (view : EaseView , value : ReadableArray ? ) {
212- if (value != null && value.size() == 10 ) {
213- view.perPropertyTransitionStiffnesses = FloatArray (10 ) { value.getDouble(it).toFloat() }
214- } else {
215- view.perPropertyTransitionStiffnesses = null
216- }
217- }
218-
219- @ReactProp(name = " perPropertyTransitionMasses" )
220- fun setPerPropertyTransitionMasses (view : EaseView , value : ReadableArray ? ) {
221- if (value != null && value.size() == 10 ) {
222- view.perPropertyTransitionMasses = FloatArray (10 ) { value.getDouble(it).toFloat() }
223- } else {
224- view.perPropertyTransitionMasses = null
225- }
226- }
227-
228- @ReactProp(name = " perPropertyTransitionLoops" )
229- fun setPerPropertyTransitionLoops (view : EaseView , value : ReadableArray ? ) {
230- if (value != null && value.size() == 10 ) {
231- view.perPropertyTransitionLoops = Array (10 ) { value.getString(it) ? : " " }
232- } else {
233- view.perPropertyTransitionLoops = null
234- }
235- }
236-
237- @ReactProp(name = " perPropertyTransitionEasingBeziers" )
238- fun setPerPropertyTransitionEasingBeziers (view : EaseView , value : ReadableArray ? ) {
239- if (value != null && value.size() == 40 ) {
240- view.perPropertyTransitionEasingBeziers = FloatArray (40 ) { value.getDouble(it).toFloat() }
241- } else {
242- view.perPropertyTransitionEasingBeziers = null
243- }
130+ // --- Transitions config (single ReadableMap) ---
244131
132+ @ReactProp(name = " transitions" )
133+ fun setTransitions (view : EaseView , value : ReadableMap ? ) {
134+ view.setTransitionsFromMap(value)
245135 }
246136
247137 // --- Border radius ---
0 commit comments