react-native-reanimated 3.0.0-rc.7 → 3.0.0-rc.8

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.
Files changed (177) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
  2. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
  4. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
  5. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +161 -165
  6. package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
  7. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
  8. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
  9. package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
  10. package/Common/cpp/SharedItems/Shareables.cpp +142 -0
  11. package/Common/cpp/SharedItems/Shareables.h +455 -0
  12. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
  13. package/Common/cpp/Tools/RuntimeDecorator.cpp +54 -26
  14. package/Common/cpp/Tools/RuntimeDecorator.h +11 -2
  15. package/Common/cpp/Tools/Scheduler.cpp +10 -0
  16. package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
  17. package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
  18. package/android/src/main/cpp/LayoutAnimations.h +4 -4
  19. package/android/src/main/cpp/NativeProxy.cpp +50 -63
  20. package/ios/native/NativeProxy.mm +26 -42
  21. package/lib/commonjs/createAnimatedComponent.js +7 -11
  22. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  23. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
  24. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  25. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
  26. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
  27. package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
  28. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
  29. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  30. package/lib/commonjs/reanimated2/commonTypes.js +7 -0
  31. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  32. package/lib/commonjs/reanimated2/core.js +111 -209
  33. package/lib/commonjs/reanimated2/core.js.map +1 -1
  34. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  35. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
  36. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  37. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
  38. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  39. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
  40. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  41. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +24 -50
  42. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  43. package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
  44. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
  45. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  46. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  47. package/lib/commonjs/reanimated2/jestUtils.js +8 -33
  48. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  49. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +16 -100
  50. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  51. package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
  52. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  53. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  54. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  55. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +91 -0
  56. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  57. package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
  58. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  59. package/lib/commonjs/reanimated2/mappers.js +186 -0
  60. package/lib/commonjs/reanimated2/mappers.js.map +1 -0
  61. package/lib/commonjs/reanimated2/mutables.js +173 -0
  62. package/lib/commonjs/reanimated2/mutables.js.map +1 -0
  63. package/lib/commonjs/reanimated2/shareables.js +153 -0
  64. package/lib/commonjs/reanimated2/shareables.js.map +1 -0
  65. package/lib/commonjs/reanimated2/threads.js +58 -0
  66. package/lib/commonjs/reanimated2/threads.js.map +1 -0
  67. package/lib/commonjs/reanimated2/time.js +55 -0
  68. package/lib/commonjs/reanimated2/time.js.map +1 -0
  69. package/lib/commonjs/reanimated2/valueSetter.js +81 -0
  70. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
  71. package/lib/module/createAnimatedComponent.js +7 -12
  72. package/lib/module/createAnimatedComponent.js.map +1 -1
  73. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
  74. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  75. package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
  76. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  77. package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
  78. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  79. package/lib/module/reanimated2/animation/util.js.map +1 -1
  80. package/lib/module/reanimated2/commonTypes.js +7 -0
  81. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  82. package/lib/module/reanimated2/core.js +66 -188
  83. package/lib/module/reanimated2/core.js.map +1 -1
  84. package/lib/module/reanimated2/globals.d.js.map +1 -1
  85. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
  86. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  87. package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
  88. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  89. package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
  90. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  91. package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -52
  92. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  93. package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
  94. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  95. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  96. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  97. package/lib/module/reanimated2/jestUtils.js +8 -31
  98. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  99. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +16 -95
  100. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  101. package/lib/module/reanimated2/js-reanimated/index.js +5 -0
  102. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  103. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  104. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  105. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +84 -0
  106. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  107. package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
  108. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  109. package/lib/module/reanimated2/mappers.js +173 -0
  110. package/lib/module/reanimated2/mappers.js.map +1 -0
  111. package/lib/module/reanimated2/mutables.js +149 -0
  112. package/lib/module/reanimated2/mutables.js.map +1 -0
  113. package/lib/module/reanimated2/shareables.js +133 -0
  114. package/lib/module/reanimated2/shareables.js.map +1 -0
  115. package/lib/module/reanimated2/threads.js +45 -0
  116. package/lib/module/reanimated2/threads.js.map +1 -0
  117. package/lib/module/reanimated2/time.js +37 -0
  118. package/lib/module/reanimated2/time.js.map +1 -0
  119. package/lib/module/reanimated2/valueSetter.js +66 -0
  120. package/lib/module/reanimated2/valueSetter.js.map +1 -0
  121. package/package.json +1 -1
  122. package/plugin.js +31 -15
  123. package/src/createAnimatedComponent.tsx +8 -24
  124. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +34 -53
  125. package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
  126. package/src/reanimated2/WorkletEventHandler.ts +4 -11
  127. package/src/reanimated2/animation/util.ts +1 -0
  128. package/src/reanimated2/commonTypes.ts +29 -4
  129. package/src/reanimated2/core.ts +103 -230
  130. package/src/reanimated2/globals.d.ts +26 -26
  131. package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
  132. package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
  133. package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
  134. package/src/reanimated2/hook/useAnimatedStyle.ts +26 -64
  135. package/src/reanimated2/hook/useSharedValue.ts +6 -3
  136. package/src/reanimated2/hook/utils.ts +1 -1
  137. package/src/reanimated2/interpolateColor.ts +2 -2
  138. package/src/reanimated2/jestUtils.ts +14 -29
  139. package/src/reanimated2/js-reanimated/JSReanimated.ts +19 -93
  140. package/src/reanimated2/js-reanimated/index.ts +4 -0
  141. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
  142. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  143. package/src/reanimated2/layoutReanimation/animationsManager.ts +94 -0
  144. package/src/reanimated2/layoutReanimation/index.ts +1 -1
  145. package/src/reanimated2/mappers.ts +179 -0
  146. package/src/reanimated2/mutables.ts +151 -0
  147. package/src/reanimated2/shareables.ts +121 -0
  148. package/src/reanimated2/threads.ts +46 -0
  149. package/src/reanimated2/time.ts +30 -0
  150. package/src/reanimated2/valueSetter.ts +64 -0
  151. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
  152. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
  153. package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
  154. package/Common/cpp/Registries/MapperRegistry.h +0 -29
  155. package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
  156. package/Common/cpp/Registries/WorkletsCache.h +0 -24
  157. package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
  158. package/Common/cpp/SharedItems/FrozenObject.h +0 -36
  159. package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
  160. package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
  161. package/Common/cpp/SharedItems/MutableValue.h +0 -54
  162. package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
  163. package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
  164. package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
  165. package/Common/cpp/SharedItems/RemoteObject.h +0 -35
  166. package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
  167. package/Common/cpp/SharedItems/ShareableValue.h +0 -63
  168. package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
  169. package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
  170. package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
  171. package/Common/cpp/Tools/Mapper.cpp +0 -86
  172. package/Common/cpp/Tools/Mapper.h +0 -51
  173. package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
  174. package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
  175. package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
  176. package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
  177. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
@@ -13,10 +13,6 @@ jni::local_ref<LayoutAnimations::jhybriddata> LayoutAnimations::initHybrid(
13
13
  return makeCxxInstance(jThis);
14
14
  }
15
15
 
16
- void LayoutAnimations::setWeakUIRuntime(std::weak_ptr<jsi::Runtime> wrt) {
17
- this->weakUIRuntime = wrt;
18
- }
19
-
20
16
  void LayoutAnimations::setAnimationStartingBlock(
21
17
  AnimationStartingBlock animationStartingBlock) {
22
18
  this->animationStartingBlock_ = animationStartingBlock;
@@ -31,17 +27,12 @@ void LayoutAnimations::startAnimationForTag(
31
27
 
32
28
  void LayoutAnimations::progressLayoutAnimation(
33
29
  int tag,
34
- const jsi::Value &progress) {
35
- if (auto rt = this->weakUIRuntime.lock()) {
36
- static const auto method =
37
- javaPart_->getClass()
38
- ->getMethod<void(int, JMap<JString, JObject>::javaobject)>(
39
- "progressLayoutAnimation");
40
- method(
41
- javaPart_.get(),
42
- tag,
43
- JNIHelper::ConvertToPropsMap(*rt, progress.asObject(*rt)).get());
44
- }
30
+ const jni::local_ref<JNIHelper::PropsMap> &updates) {
31
+ static const auto method =
32
+ javaPart_->getClass()
33
+ ->getMethod<void(int, JMap<JString, JObject>::javaobject)>(
34
+ "progressLayoutAnimation");
35
+ method(javaPart_.get(), tag, updates.get());
45
36
  }
46
37
 
47
38
  void LayoutAnimations::endLayoutAnimation(
@@ -91,5 +82,4 @@ void LayoutAnimations::registerNatives() {
91
82
  LayoutAnimations::isLayoutAnimationEnabled),
92
83
  });
93
84
  }
94
-
95
85
  }; // namespace reanimated
@@ -14,7 +14,7 @@ using namespace facebook;
14
14
  class LayoutAnimations : public jni::HybridClass<LayoutAnimations> {
15
15
  using AnimationStartingBlock = std::function<
16
16
  void(int, alias_ref<JString>, alias_ref<JMap<jstring, jstring>>)>;
17
- using HasAnimationBlock = std::function<bool(int, std::string)>;
17
+ using HasAnimationBlock = std::function<bool(int, const std::string &)>;
18
18
  using ClearAnimationConfigBlock = std::function<void(int)>;
19
19
 
20
20
  public:
@@ -31,20 +31,20 @@ class LayoutAnimations : public jni::HybridClass<LayoutAnimations> {
31
31
  bool hasAnimationForTag(int tag, std::string type);
32
32
  bool isLayoutAnimationEnabled();
33
33
 
34
- void setWeakUIRuntime(std::weak_ptr<jsi::Runtime> wrt);
35
34
  void setAnimationStartingBlock(AnimationStartingBlock animationStartingBlock);
36
35
  void setHasAnimationBlock(HasAnimationBlock hasAnimationBlock);
37
36
  void setClearAnimationConfigBlock(
38
37
  ClearAnimationConfigBlock clearAnimationConfigBlock);
39
38
 
40
- void progressLayoutAnimation(int tag, const jsi::Value &progress);
39
+ void progressLayoutAnimation(
40
+ int tag,
41
+ const jni::local_ref<JNIHelper::PropsMap> &updates);
41
42
  void endLayoutAnimation(int tag, bool cancelled, bool removeView);
42
43
  void clearAnimationConfigForTag(int tag);
43
44
 
44
45
  private:
45
46
  friend HybridBase;
46
47
  jni::global_ref<LayoutAnimations::javaobject> javaPart_;
47
- std::weak_ptr<jsi::Runtime> weakUIRuntime;
48
48
  AnimationStartingBlock animationStartingBlock_;
49
49
  HasAnimationBlock hasAnimationBlock_;
50
50
  ClearAnimationConfigBlock clearAnimationConfigBlock_;
@@ -11,7 +11,7 @@
11
11
 
12
12
  #include "AndroidErrorHandler.h"
13
13
  #include "AndroidScheduler.h"
14
- #include "LayoutAnimationsProxy.h"
14
+ #include "LayoutAnimationsManager.h"
15
15
  #include "NativeProxy.h"
16
16
  #include "PlatformDepMethodsHolder.h"
17
17
  #include "ReanimatedRuntime.h"
@@ -237,11 +237,12 @@ void NativeProxy::installJSIBindings(
237
237
 
238
238
  std::shared_ptr<ErrorHandler> errorHandler =
239
239
  std::make_shared<AndroidErrorHandler>(scheduler_);
240
+ std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
240
241
 
241
- // Layout Animations Start
242
-
243
- auto progressLayoutAnimation = [this](int tag, jsi::Value progress) {
244
- this->layoutAnimations->cthis()->progressLayoutAnimation(tag, progress);
242
+ auto progressLayoutAnimation = [this, wrt](
243
+ int tag, const jsi::Object &newProps) {
244
+ auto newPropsJNI = JNIHelper::ConvertToPropsMap(*wrt.lock(), newProps);
245
+ this->layoutAnimations->cthis()->progressLayoutAnimation(tag, newPropsJNI);
245
246
  };
246
247
 
247
248
  auto endLayoutAnimation = [this](int tag, bool isCancelled, bool removeView) {
@@ -249,62 +250,6 @@ void NativeProxy::installJSIBindings(
249
250
  tag, isCancelled, removeView);
250
251
  };
251
252
 
252
- std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy =
253
- std::make_shared<LayoutAnimationsProxy>(
254
- progressLayoutAnimation, endLayoutAnimation, errorHandler);
255
- std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
256
- std::weak_ptr<LayoutAnimationsProxy> weakLayoutAnimationsProxy =
257
- layoutAnimationsProxy;
258
- layoutAnimations->cthis()->setWeakUIRuntime(wrt);
259
- std::weak_ptr<ErrorHandler> weakErrorHandler = errorHandler;
260
-
261
- layoutAnimations->cthis()->setAnimationStartingBlock(
262
- [wrt, weakLayoutAnimationsProxy, weakErrorHandler](
263
- int tag,
264
- alias_ref<JString> type,
265
- alias_ref<JMap<jstring, jstring>> values) {
266
- auto runtime = wrt.lock();
267
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
268
- if (!runtime || !layoutAnimationsProxy) {
269
- return;
270
- }
271
- auto &rt = *runtime;
272
- jsi::Object yogaValues(rt);
273
- for (const auto &entry : *values) {
274
- try {
275
- auto key =
276
- jsi::String::createFromAscii(rt, entry.first->toStdString());
277
- auto value = stod(entry.second->toStdString());
278
- yogaValues.setProperty(rt, key, value);
279
- } catch (std::invalid_argument e) {
280
- if (auto errorHandler = weakErrorHandler.lock()) {
281
- errorHandler->setError("Failed to convert value to number");
282
- errorHandler->raise();
283
- }
284
- }
285
- }
286
-
287
- layoutAnimationsProxy->startLayoutAnimation(
288
- *runtime, tag, type->toStdString(), yogaValues);
289
- });
290
-
291
- layoutAnimations->cthis()->setHasAnimationBlock(
292
- [weakLayoutAnimationsProxy](int tag, std::string type) {
293
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
294
- return layoutAnimationsProxy &&
295
- layoutAnimationsProxy->hasLayoutAnimation(tag, type);
296
- });
297
-
298
- layoutAnimations->cthis()->setClearAnimationConfigBlock(
299
- [weakLayoutAnimationsProxy](int tag) {
300
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
301
- if (layoutAnimationsProxy) {
302
- layoutAnimationsProxy->clearLayoutAnimationConfig(tag);
303
- }
304
- });
305
-
306
- // Layout Animations End
307
-
308
253
  PlatformDepMethodsHolder platformDepMethodsHolder = {
309
254
  requestRender,
310
255
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -316,6 +261,8 @@ void NativeProxy::installJSIBindings(
316
261
  configurePropsFunction,
317
262
  #endif
318
263
  getCurrentTime,
264
+ progressLayoutAnimation,
265
+ endLayoutAnimation,
319
266
  registerSensorFunction,
320
267
  unregisterSensorFunction,
321
268
  setGestureStateFunction,
@@ -333,12 +280,13 @@ void NativeProxy::installJSIBindings(
333
280
  #else
334
281
  propObtainer,
335
282
  #endif
336
- layoutAnimationsProxy,
337
283
  platformDepMethodsHolder);
338
284
 
339
- _nativeReanimatedModule = module;
285
+ scheduler_->setRuntimeManager(module);
340
286
 
287
+ _nativeReanimatedModule = module;
341
288
  std::weak_ptr<NativeReanimatedModule> weakModule = module;
289
+
342
290
  #ifdef RCT_NEW_ARCH_ENABLED
343
291
  this->registerEventHandler([weakModule, getCurrentTime](
344
292
  std::string eventName,
@@ -390,6 +338,45 @@ void NativeProxy::installJSIBindings(
390
338
  // reactScheduler_ = binding->getScheduler();
391
339
  // reactScheduler_->addEventListener(eventListener_);
392
340
 
341
+ std::weak_ptr<ErrorHandler> weakErrorHandler = errorHandler;
342
+
343
+ layoutAnimations->cthis()->setAnimationStartingBlock(
344
+ [wrt, weakModule, weakErrorHandler](
345
+ int tag,
346
+ alias_ref<JString> type,
347
+ alias_ref<JMap<jstring, jstring>> values) {
348
+ auto &rt = *wrt.lock();
349
+ jsi::Object yogaValues(rt);
350
+ for (const auto &entry : *values) {
351
+ try {
352
+ auto key =
353
+ jsi::String::createFromAscii(rt, entry.first->toStdString());
354
+ auto value = stod(entry.second->toStdString());
355
+ yogaValues.setProperty(rt, key, value);
356
+ } catch (std::invalid_argument e) {
357
+ if (auto errorHandler = weakErrorHandler.lock()) {
358
+ errorHandler->setError("Failed to convert value to number");
359
+ errorHandler->raise();
360
+ }
361
+ }
362
+ }
363
+
364
+ weakModule.lock()->layoutAnimationsManager().startLayoutAnimation(
365
+ rt, tag, type->toStdString(), yogaValues);
366
+ });
367
+
368
+ layoutAnimations->cthis()->setHasAnimationBlock(
369
+ [weakModule](int tag, const std::string &type) {
370
+ return weakModule.lock()->layoutAnimationsManager().hasLayoutAnimation(
371
+ tag, type);
372
+ });
373
+
374
+ layoutAnimations->cthis()->setClearAnimationConfigBlock(
375
+ [weakModule](int tag) {
376
+ weakModule.lock()->layoutAnimationsManager().clearLayoutAnimationConfig(
377
+ tag);
378
+ });
379
+
393
380
  runtime_->global().setProperty(
394
381
  *runtime_,
395
382
  jsi::PropNameID::forAscii(*runtime_, "__reanimatedModuleProxy"),
@@ -1,4 +1,3 @@
1
- #import <RNReanimated/LayoutAnimationsProxy.h>
2
1
  #import <RNReanimated/NativeMethods.h>
3
2
  #import <RNReanimated/NativeProxy.h>
4
3
  #import <RNReanimated/REAAnimationsManager.h>
@@ -229,8 +228,14 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
229
228
  [nodesManager synchronouslyUpdateViewOnUIThread:viewTag props:uiProps];
230
229
  };
231
230
 
232
- auto layoutAnimationsProxy = std::make_shared<LayoutAnimationsProxy>(
233
- [](int tag, jsi::Object newStyle) {}, [](int tag, bool isCancelled, bool removeView) {}, errorHandler);
231
+ auto progressLayoutAnimation = [=](int tag, const jsi::Object &newStyle) {
232
+ // noop
233
+ };
234
+
235
+ auto endLayoutAnimation = [=](int tag, bool isCancelled, bool removeView) {
236
+ // noop
237
+ };
238
+
234
239
  #else
235
240
  // Layout Animations start
236
241
  __block std::weak_ptr<Scheduler> weakScheduler = scheduler;
@@ -247,19 +252,15 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
247
252
  [reaUiManagerNoCast setUp:animationsManager];
248
253
 
249
254
  __weak REAAnimationsManager *weakAnimationsManager = animationsManager;
250
- auto progressLayoutAnimation = [weakAnimationsManager, animatedRuntime](int tag, jsi::Object newStyle) {
251
- REAAnimationsManager *animationsManager = weakAnimationsManager;
252
- if (animationsManager) {
253
- NSDictionary *propsDict = convertJSIObjectToNSDictionary(*animatedRuntime, newStyle);
254
- [animationsManager progressLayoutAnimationWithStyle:propsDict forTag:@(tag)];
255
- }
255
+ std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
256
+
257
+ auto progressLayoutAnimation = [=](int tag, const jsi::Object &newStyle) {
258
+ NSDictionary *propsDict = convertJSIObjectToNSDictionary(*wrt.lock(), newStyle);
259
+ [weakAnimationsManager progressLayoutAnimationWithStyle:propsDict forTag:@(tag)];
256
260
  };
257
261
 
258
- auto endLayoutAnimation = [weakAnimationsManager](int tag, bool isCancelled, bool removeView) {
259
- REAAnimationsManager *animationsManager = weakAnimationsManager;
260
- if (animationsManager) {
261
- [animationsManager endLayoutAnimationForTag:@(tag) cancelled:isCancelled removeView:removeView];
262
- }
262
+ auto endLayoutAnimation = [=](int tag, bool isCancelled, bool removeView) {
263
+ [weakAnimationsManager endLayoutAnimationForTag:@(tag) cancelled:isCancelled removeView:removeView];
263
264
  };
264
265
 
265
266
  auto configurePropsFunction = [reanimatedModule](
@@ -269,11 +270,6 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
269
270
  [reanimatedModule.nodesManager configureUiProps:uiPropsSet andNativeProps:nativePropsSet];
270
271
  };
271
272
 
272
- auto layoutAnimationsProxy =
273
- std::make_shared<LayoutAnimationsProxy>(progressLayoutAnimation, endLayoutAnimation, errorHandler);
274
- auto weakLayoutAnimationsProxy = std::weak_ptr(layoutAnimationsProxy);
275
- std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
276
-
277
273
  // Layout Animations end
278
274
  #endif
279
275
 
@@ -318,6 +314,8 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
318
314
  configurePropsFunction,
319
315
  #endif
320
316
  getCurrentTime,
317
+ progressLayoutAnimation,
318
+ endLayoutAnimation,
321
319
  registerSensorFunction,
322
320
  unregisterSensorFunction,
323
321
  setGestureStateFunction,
@@ -335,7 +333,6 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
335
333
  #else
336
334
  propObtainer,
337
335
  #endif
338
- layoutAnimationsProxy,
339
336
  platformDepMethodsHolder);
340
337
 
341
338
  scheduler->setRuntimeManager(module);
@@ -372,8 +369,8 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
372
369
  }];
373
370
  #endif
374
371
 
375
- #ifdef RCT_NEW_ARCH_ENABLED
376
372
  std::weak_ptr<NativeReanimatedModule> weakModule = module; // to avoid retain cycle
373
+ #ifdef RCT_NEW_ARCH_ENABLED
377
374
  [reanimatedModule.nodesManager registerPerformOperations:^() {
378
375
  if (auto module = weakModule.lock()) {
379
376
  module->performOperations();
@@ -383,37 +380,24 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
383
380
  // Layout Animation callbacks setup
384
381
  [animationsManager setAnimationStartingBlock:^(
385
382
  NSNumber *_Nonnull tag, NSString *type, NSDictionary *_Nonnull values, NSNumber *depth) {
386
- std::shared_ptr<jsi::Runtime> runtime = wrt.lock();
387
- if (runtime == nullptr) {
388
- return;
389
- }
390
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
391
- if (layoutAnimationsProxy == nullptr) {
392
- return;
393
- }
394
- jsi::Object yogaValues(*runtime);
383
+ jsi::Runtime &rt = *wrt.lock();
384
+ jsi::Object yogaValues(rt);
395
385
  for (NSString *key in values.allKeys) {
396
386
  NSNumber *value = values[key];
397
- yogaValues.setProperty(*runtime, [key UTF8String], [value doubleValue]);
387
+ yogaValues.setProperty(rt, [key UTF8String], [value doubleValue]);
398
388
  }
399
389
 
400
- layoutAnimationsProxy->startLayoutAnimation(*runtime, [tag intValue], std::string([type UTF8String]), yogaValues);
390
+ weakModule.lock()->layoutAnimationsManager().startLayoutAnimation(
391
+ rt, [tag intValue], std::string([type UTF8String]), yogaValues);
401
392
  }];
402
393
 
403
394
  [animationsManager setHasAnimationBlock:^(NSNumber *_Nonnull tag, NSString *_Nonnull type) {
404
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
405
- if (layoutAnimationsProxy == nullptr) {
406
- return false;
407
- }
408
- return layoutAnimationsProxy->hasLayoutAnimation([tag intValue], std::string([type UTF8String]));
395
+ return weakModule.lock()->layoutAnimationsManager().hasLayoutAnimation(
396
+ [tag intValue], std::string([type UTF8String]));
409
397
  }];
410
398
 
411
399
  [animationsManager setAnimationRemovingBlock:^(NSNumber *_Nonnull tag) {
412
- auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
413
- if (layoutAnimationsProxy == nullptr) {
414
- return;
415
- }
416
- layoutAnimationsProxy->clearLayoutAnimationConfig([tag intValue]);
400
+ weakModule.lock()->layoutAnimationsManager().clearLayoutAnimationConfig([tag intValue]);
417
401
  }];
418
402
  #endif
419
403
 
@@ -13,7 +13,7 @@ var _WorkletEventHandler = _interopRequireDefault(require("./reanimated2/Worklet
13
13
 
14
14
  var _setAndForwardRef = _interopRequireDefault(require("./setAndForwardRef"));
15
15
 
16
- require("./reanimated2/layoutReanimation/LayoutAnimationRepository");
16
+ require("./reanimated2/layoutReanimation/animationsManager");
17
17
 
18
18
  var _invariant = _interopRequireDefault(require("invariant"));
19
19
 
@@ -29,6 +29,8 @@ var _animation = require("./reanimated2/animation");
29
29
 
30
30
  var _fabricUtils = require("./reanimated2/fabricUtils");
31
31
 
32
+ var _shareables = require("./reanimated2/shareables");
33
+
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
35
 
34
36
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -116,8 +118,6 @@ function createAnimatedComponent(Component, options) {
116
118
 
117
119
  _defineProperty(this, "initialStyle", {});
118
120
 
119
- _defineProperty(this, "sv", void 0);
120
-
121
121
  _defineProperty(this, "_component", null);
122
122
 
123
123
  _defineProperty(this, "_setComponentRef", (0, _setAndForwardRef.default)({
@@ -137,15 +137,15 @@ function createAnimatedComponent(Component, options) {
137
137
  }
138
138
 
139
139
  if (layout) {
140
- (0, _core.configureLayoutAnimations)(tag, 'layout', maybeBuild(layout), this.sv);
140
+ (0, _core.configureLayoutAnimations)(tag, 'layout', maybeBuild(layout));
141
141
  }
142
142
 
143
143
  if (entering) {
144
- (0, _core.configureLayoutAnimations)(tag, 'entering', maybeBuild(entering), this.sv);
144
+ (0, _core.configureLayoutAnimations)(tag, 'entering', maybeBuild(entering));
145
145
  }
146
146
 
147
147
  if (exiting) {
148
- (0, _core.configureLayoutAnimations)(tag, 'exiting', maybeBuild(exiting), this.sv);
148
+ (0, _core.configureLayoutAnimations)(tag, 'exiting', maybeBuild(exiting));
149
149
  }
150
150
  }
151
151
 
@@ -160,16 +160,12 @@ function createAnimatedComponent(Component, options) {
160
160
  value: {}
161
161
  };
162
162
  }
163
-
164
- this.sv = (0, _core.makeMutable)({});
165
163
  }
166
164
 
167
165
  componentWillUnmount() {
168
166
  this._detachNativeEvents();
169
167
 
170
168
  this._detachStyles();
171
-
172
- this.sv = null;
173
169
  }
174
170
 
175
171
  componentDidMount() {
@@ -315,7 +311,7 @@ function createAnimatedComponent(Component, options) {
315
311
  }
316
312
 
317
313
  if (global._IS_FABRIC) {
318
- shadowNodeWrapper = (0, _fabricUtils.getShadowNodeWrapperFromRef)(this);
314
+ shadowNodeWrapper = (0, _shareables.makeShareableShadowNodeWrapper)((0, _fabricUtils.getShadowNodeWrapperFromRef)(this));
319
315
  }
320
316
  }
321
317
 
@@ -1 +1 @@
1
- {"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","sv","_component","isJest","animatedStyle","makeMutable","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n 'layout',\n maybeBuild(layout),\n this.sv\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n 'entering',\n maybeBuild(entering),\n this.sv\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n 'exiting',\n maybeBuild(exiting),\n this.sv\n );\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AAgBA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,wBAAD,CAAtB,EAAkD;IAChD,OAAOA,wBAAwB,CAACG,KAAzB,EAAP;EACD,CAFD,MAEO;IACL,OAAOH,wBAAP;EACD;AACF;;AAGD,SAASI,YAAT,CAAyBC,KAAzB,EAAqD;EACnD,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd,C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GAAG1D,qBAAA,CAAS2D,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;;MAIA,oBACE,6BAAC,SAAD,eAAe7F,KAAf;QAAsB,GAAG,EAAE,KAAK8F;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EA/WD;;EAV4D,gBAQxD5F,iBARwD;;EA4X9DA,iBAAiB,CAACkG,WAAlB,GAAiC,qBAC/BvG,SAAS,CAACuG,WAAV,IAAyBvG,SAAS,CAAC2E,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAOrE,cAAA,CAAMkG,UAAN,CAA4B,CAAChG,KAAD,EAAQK,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACML,KADN,EAEOK,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
1
+ {"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","_component","isJest","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","makeShareableShadowNodeWrapper","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport { makeShareableShadowNodeWrapper } from './reanimated2/shareables';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = makeShareableShadowNodeWrapper(\n getShadowNodeWrapperFromRef(this)\n );\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(tag, 'layout', maybeBuild(layout));\n }\n if (entering) {\n configureLayoutAnimations(tag, 'entering', maybeBuild(entering));\n }\n if (exiting) {\n configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting));\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />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