@react-native-ohos/react-native-reanimated 3.18.2-rc.2 → 4.0.1

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 (282) hide show
  1. package/compatibility.json +161 -0
  2. package/harmony/reanimated/BuildProfile.ets +1 -1
  3. package/harmony/reanimated/build-profile.json5 +18 -11
  4. package/harmony/reanimated/oh-package.json5 +12 -11
  5. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
  6. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +81 -86
  7. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +46 -47
  8. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +390 -0
  9. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +16 -0
  10. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +30 -0
  11. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.cpp +46 -0
  12. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.h +23 -0
  13. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.cpp +53 -0
  14. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.h +21 -0
  15. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.cpp +166 -0
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.h +71 -0
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.cpp +368 -0
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.h +53 -0
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.cpp +594 -0
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.h +67 -0
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.cpp +52 -0
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.h +26 -0
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.cpp +156 -0
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.h +76 -0
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +94 -0
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.h +33 -0
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.cpp +48 -0
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.h +31 -0
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +135 -0
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.h +61 -0
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +100 -0
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +45 -0
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.cpp +81 -0
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.h +53 -0
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +122 -0
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.h +38 -0
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +82 -0
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +63 -0
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +118 -0
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +174 -0
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +111 -0
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.cpp +196 -0
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.h +66 -0
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.cpp +134 -0
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +44 -0
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +174 -0
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +49 -0
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +45 -0
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +26 -0
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +90 -0
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +43 -0
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +17 -0
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +13 -0
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +127 -0
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +51 -0
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +145 -0
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +47 -0
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.cpp +69 -0
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.h +22 -0
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.cpp +66 -0
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.h +15 -0
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.cpp +28 -0
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.h +15 -0
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.cpp +13 -0
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.h +12 -0
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +157 -0
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +189 -0
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +76 -0
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +66 -0
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/configs.h +20 -0
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +136 -0
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +40 -0
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.cpp +38 -0
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h +24 -0
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.cpp +58 -0
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h +24 -0
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/blur.h +14 -0
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/brightness.h +14 -0
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/contrast.h +14 -0
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/dropShadow.h +17 -0
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/grayscale.h +14 -0
  82. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/hueRotate.h +14 -0
  83. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/invert.h +14 -0
  84. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/opacity.h +14 -0
  85. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/saturate.h +14 -0
  86. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/sepia.h +14 -0
  87. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +95 -0
  88. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +36 -0
  89. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.cpp +41 -0
  90. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.h +32 -0
  91. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +99 -0
  92. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +37 -0
  93. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +308 -0
  94. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +100 -0
  95. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.cpp +19 -0
  96. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +94 -0
  97. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.cpp +18 -0
  98. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h +43 -0
  99. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +26 -0
  100. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +103 -0
  101. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +42 -0
  102. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +224 -0
  103. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.h +52 -0
  104. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +218 -0
  105. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +89 -0
  106. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.cpp +149 -0
  107. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h +33 -0
  108. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +208 -0
  109. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.h +56 -0
  110. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.cpp +42 -0
  111. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.h +20 -0
  112. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.cpp +41 -0
  113. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.h +39 -0
  114. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.cpp +28 -0
  115. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.h +25 -0
  116. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.cpp +14 -0
  117. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.h +20 -0
  118. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.cpp +39 -0
  119. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.h +25 -0
  120. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +47 -0
  121. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h +43 -0
  122. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +70 -0
  123. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.h +40 -0
  124. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +146 -0
  125. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +71 -0
  126. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +155 -0
  127. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +53 -0
  128. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +170 -0
  129. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +67 -0
  130. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/KeyframeProgressProvider.h +12 -0
  131. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +41 -0
  132. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +31 -0
  133. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +193 -0
  134. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +77 -0
  135. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +340 -0
  136. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +80 -0
  137. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +45 -0
  138. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +29 -0
  139. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +167 -0
  140. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +51 -0
  141. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +61 -0
  142. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +33 -0
  143. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp +80 -0
  144. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.h +39 -0
  145. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +93 -0
  146. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +36 -0
  147. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +111 -0
  148. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +33 -0
  149. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +75 -0
  150. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +45 -0
  151. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.cpp +12 -0
  152. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.h +10 -0
  153. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.cpp +36 -0
  154. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.h +23 -0
  155. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +149 -0
  156. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +32 -0
  157. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +113 -101
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +49 -51
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +46 -49
  160. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +56 -96
  161. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +37 -33
  162. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +104 -95
  163. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +22 -29
  164. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -0
  165. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +25 -0
  166. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +160 -0
  167. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +71 -0
  168. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +161 -0
  169. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +65 -0
  170. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +11 -9
  171. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +137 -232
  172. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +82 -90
  173. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +79 -0
  174. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +81 -0
  175. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +864 -0
  176. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +214 -0
  177. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/{LayoutAnimationsProxy.cpp → LayoutAnimationsProxy_Legacy.cpp} +897 -870
  178. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +220 -0
  179. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +31 -91
  180. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +146 -176
  181. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.cpp +456 -0
  182. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.h +102 -0
  183. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +544 -0
  184. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.cpp +119 -0
  185. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.h +39 -0
  186. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +1380 -971
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +230 -252
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +183 -231
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +93 -109
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +54 -56
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +28 -20
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +58 -70
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +31 -35
  194. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.cpp +18 -0
  195. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.h +44 -0
  196. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +67 -98
  197. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +114 -135
  198. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +46 -0
  199. package/harmony/reanimated/src/main/cpp/Common/cpp/{worklets → reanimated}/Tools/ReanimatedVersion.h +18 -19
  200. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +63 -85
  201. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -0
  202. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +0 -3
  203. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +266 -0
  204. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
  205. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
  206. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
  207. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +3 -3
  208. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +5 -1
  209. package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
  210. package/harmony/reanimated/src/main/module.json5 +12 -12
  211. package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
  212. package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
  213. package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
  214. package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
  215. package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
  216. package/harmony/reanimated/ts.ts +6 -6
  217. package/harmony/reanimated.har +0 -0
  218. package/package.json +69 -50
  219. package/scripts/deploy.js +191 -0
  220. package/scripts/set-reanimated-version.js +37 -0
  221. package/scripts/update-version.js +119 -0
  222. package/scripts/validate-react-native-version.js +46 -0
  223. package/scripts/validate-worklets-build.js +17 -0
  224. package/scripts/validate-worklets-version.js +84 -0
  225. package/scripts/worklets-version.json +4 -0
  226. package/LICENSE +0 -21
  227. package/README.OpenSource +0 -11
  228. package/README.md +0 -10
  229. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
  230. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
  231. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
  232. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
  233. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
  234. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
  235. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
  236. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
  237. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
  238. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
  239. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
  240. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
  241. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
  242. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
  243. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
  244. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
  245. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
  246. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
  247. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
  248. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
  249. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
  250. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
  251. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
  252. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
  253. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
  254. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
  255. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
  256. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
  257. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
  258. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
  259. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
  260. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
  261. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
  262. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
  263. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
  264. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
  265. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
  266. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
  267. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
  268. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
  269. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
  270. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
  271. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -173
  272. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
  273. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
  274. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -189
  275. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
  276. package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
  277. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
  278. package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
  279. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
  280. package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
  281. package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
  282. package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
@@ -1,199 +0,0 @@
1
- #pragma once
2
-
3
- #include <jsi/jsi.h>
4
- #include <sstream>
5
- #include <string>
6
- #include <tuple>
7
- #include <utility>
8
-
9
- using namespace facebook;
10
-
11
- namespace worklets::jsi_utils {
12
-
13
- // `get` functions take a pointer to `jsi::Value` and
14
- // call an appropriate method to cast to the native type
15
- template <typename T>
16
- inline T get(jsi::Runtime &rt, const jsi::Value *value);
17
-
18
- template <>
19
- inline double get<double>(jsi::Runtime &, const jsi::Value *value) {
20
- return value->asNumber();
21
- }
22
-
23
- template <>
24
- inline int get<int>(jsi::Runtime &, const jsi::Value *value) {
25
- return value->asNumber();
26
- }
27
-
28
- template <>
29
- inline bool get<bool>(jsi::Runtime &, const jsi::Value *value) {
30
- if (!value->isBool()) {
31
- throw jsi::JSINativeException("[Reanimated] Expected a boolean.");
32
- }
33
- return value->getBool();
34
- }
35
-
36
- template <>
37
- inline jsi::Object get<jsi::Object>(jsi::Runtime &rt, const jsi::Value *value) {
38
- return value->asObject(rt);
39
- }
40
-
41
- template <>
42
- inline jsi::Value const &get<jsi::Value const &>(
43
- jsi::Runtime &,
44
- const jsi::Value *value) {
45
- return *value;
46
- }
47
-
48
- // `convertArgs` functions take a variadic template parameter of target (C++)
49
- // argument types `Targs` and a `jsi::Value` array `args`, and converts `args`
50
- // to a tuple of typed C++ arguments to be passed to the native implementation.
51
- // This is accomplished by dispatching (at compile time) to the correct
52
- // implementation based on the first type of `Targs`, using SFINAE to select the
53
- // correct specialization, and concatenating with the result of recursion on the
54
- // rest of `Targs`
55
-
56
- // BEGIN implementations for `convertArgs` specializations.
57
- // specialization for empty `Targs` - returns an empty tuple
58
- template <typename... Args>
59
- inline std::enable_if_t<(sizeof...(Args) == 0), std::tuple<>> convertArgs(
60
- jsi::Runtime &,
61
- const jsi::Value *) {
62
- return std::make_tuple();
63
- }
64
-
65
- // calls `get<First>` on the first argument to retrieve the native type,
66
- // then calls recursively on the rest of `args`
67
- // and returns the concatenation of results
68
- template <typename T, typename... Rest>
69
- inline std::tuple<T, Rest...> convertArgs(
70
- jsi::Runtime &rt,
71
- const jsi::Value *args) {
72
- auto arg = std::tuple<T>(get<T>(rt, args));
73
- auto rest = convertArgs<Rest...>(rt, std::next(args));
74
- return std::tuple_cat(std::move(arg), std::move(rest));
75
- }
76
- // END implementations for `convertArgs` specializations.
77
-
78
- // returns a tuple with the result of casting `args` to appropriate
79
- // native C++ types needed to call `function`
80
- template <typename Ret, typename... Args>
81
- std::tuple<Args...> getArgsForFunction(
82
- std::function<Ret(Args...)>,
83
- jsi::Runtime &rt,
84
- const jsi::Value *args,
85
- const size_t count) {
86
- assert(sizeof...(Args) == count);
87
- return convertArgs<Args...>(rt, args);
88
- }
89
-
90
- // returns a tuple with the result of casting `args` to appropriate
91
- // native C++ types needed to call `function`,
92
- // passing `rt` as the first argument
93
- template <typename Ret, typename... Args>
94
- std::tuple<jsi::Runtime &, Args...> getArgsForFunction(
95
- std::function<Ret(jsi::Runtime &, Args...)>,
96
- jsi::Runtime &rt,
97
- const jsi::Value *args,
98
- const size_t count) {
99
- assert(sizeof...(Args) == count);
100
- return std::tuple_cat(std::tie(rt), convertArgs<Args...>(rt, args));
101
- }
102
-
103
- // calls `function` with `args`
104
- template <typename Ret, typename... Args>
105
- inline jsi::Value apply(
106
- std::function<Ret(Args...)> function,
107
- std::tuple<Args...> args) {
108
- return std::apply(function, std::move(args));
109
- }
110
-
111
- // calls string-returning `function` with `args`,
112
- // and returns the string
113
- template <typename... Args>
114
- inline jsi::Value apply(
115
- jsi::Runtime &rt,
116
- std::function<std::string(Args...)> function,
117
- std::tuple<Args...> args) {
118
- return jsi::String::createFromUtf8(rt, std::apply(function, std::move(args)));
119
- }
120
-
121
- // calls void-returning `function` with `args`,
122
- // and returns `undefined`
123
- template <typename... Args>
124
- inline jsi::Value apply(
125
- std::function<void(Args...)> function,
126
- std::tuple<Args...> args) {
127
- std::apply(function, std::move(args));
128
- return jsi::Value::undefined();
129
- }
130
-
131
- // returns a function with JSI calling convention
132
- // from a native function `function`
133
- template <typename Fun>
134
- jsi::HostFunctionType createHostFunction(Fun function) {
135
- return [function](
136
- jsi::Runtime &rt,
137
- const jsi::Value &,
138
- const jsi::Value *args,
139
- const size_t count) {
140
- auto argz = getArgsForFunction(function, rt, args, count);
141
- return apply(function, std::move(argz));
142
- };
143
- }
144
-
145
- // returns a function with JSI calling convention
146
- // from a native function `function` returning a string
147
- template <typename... Args>
148
- jsi::HostFunctionType createHostFunction(
149
- std::function<std::string(Args...)> function) {
150
- return [function](
151
- jsi::Runtime &rt,
152
- const jsi::Value &,
153
- const jsi::Value *args,
154
- const size_t count) {
155
- auto argz = getArgsForFunction(function, rt, args, count);
156
- return apply(rt, function, std::move(argz));
157
- };
158
- }
159
-
160
- // used to determine if `function<Ret(Args...)>`
161
- // takes `Runtime &` as its first argument
162
- template <typename... Args>
163
- struct takes_runtime {
164
- static constexpr size_t value = 0;
165
- };
166
-
167
- // specialization for `function<Ret(Runtime &, Rest...)`
168
- template <typename... Rest>
169
- struct takes_runtime<jsi::Runtime &, Rest...> {
170
- static constexpr size_t value = 1;
171
- };
172
-
173
- // creates a JSI compatible function from `function`
174
- // and installs it as a global function named `name`
175
- // in the `rt` JS runtime
176
- template <typename Ret, typename... Args>
177
- void installJsiFunction(
178
- jsi::Runtime &rt,
179
- std::string_view name,
180
- std::function<Ret(Args...)> function) {
181
- auto clb = createHostFunction(function);
182
- auto argsCount = sizeof...(Args) - takes_runtime<Args...>::value;
183
- jsi::Value jsiFunction = jsi::Function::createFromHostFunction(
184
- rt, jsi::PropNameID::forAscii(rt, name.data()), argsCount, clb);
185
- rt.global().setProperty(rt, name.data(), jsiFunction);
186
- }
187
-
188
- // this should take care of passing types convertible to `function`
189
- template <typename Fun>
190
- void installJsiFunction(jsi::Runtime &rt, std::string_view name, Fun function) {
191
- installJsiFunction(rt, name, std::function(std::forward<Fun>(function)));
192
- }
193
-
194
- jsi::Array convertStringToArray(
195
- jsi::Runtime &rt,
196
- const std::string &value,
197
- const unsigned int expectedSize);
198
-
199
- } // namespace worklets::jsi_utils
@@ -1,95 +0,0 @@
1
- #include <worklets/Tools/JSLogger.h>
2
- #include <worklets/Tools/ReanimatedVersion.h>
3
-
4
- #include <memory>
5
- #include <regex>
6
- #include <string>
7
-
8
- #ifdef REANIMATED_VERSION
9
- #define STRINGIZE(x) #x
10
- #define STRINGIZE2(x) STRINGIZE(x)
11
- #define REANIMATED_VERSION_STRING STRINGIZE2(REANIMATED_VERSION)
12
- #endif // REANIMATED_VERSION
13
-
14
- using namespace facebook;
15
-
16
- namespace worklets {
17
-
18
- std::string getReanimatedCppVersion() {
19
- return std::string(REANIMATED_VERSION_STRING);
20
- }
21
-
22
- void injectReanimatedCppVersion(jsi::Runtime &rnRuntime) {
23
- auto version = getReanimatedCppVersion();
24
- rnRuntime.global().setProperty(
25
- rnRuntime,
26
- "_REANIMATED_VERSION_CPP",
27
- jsi::String::createFromUtf8(rnRuntime, version));
28
- }
29
-
30
- #ifndef NDEBUG
31
- // This function is pretty much a copy of
32
- // `src/reanimated2/platform-specific/checkVersion.ts`.
33
- bool matchVersion(const std::string &version1, const std::string &version2) {
34
- std::regex pattern("^\\d+\\.\\d+\\.\\d+$");
35
- if (std::regex_match(version1, pattern) &&
36
- std::regex_match(version2, pattern)) {
37
- auto majorPattern = std::regex("^\\d+");
38
- auto major1 = std::regex_search(version1, majorPattern);
39
- auto major2 = std::regex_search(version2, majorPattern);
40
- if (major1 != major2) {
41
- return false;
42
- }
43
- auto minorPattern = std::regex("\\.\\d+\\.");
44
- auto minor1 = std::regex_search(version1, minorPattern);
45
- auto minor2 = std::regex_search(version2, minorPattern);
46
- if (minor1 != minor2) {
47
- return false;
48
- }
49
- return true;
50
- } else {
51
- return version1 == version2;
52
- }
53
- }
54
-
55
- void checkJSVersion(
56
- jsi::Runtime &rnRuntime,
57
- const std::shared_ptr<JSLogger> &jsLogger) {
58
- auto cppVersion = getReanimatedCppVersion();
59
-
60
- auto maybeJSVersion =
61
- rnRuntime.global().getProperty(rnRuntime, "_REANIMATED_VERSION_JS");
62
- if (maybeJSVersion.isUndefined()) {
63
- jsLogger->warnOnJS(
64
- std::string(
65
- "[Reanimated] C++ side failed to resolve JavaScript code version\n") +
66
- "See `https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#c-side-failed-to-resolve-javascript-code-version` for more details.");
67
- return;
68
- }
69
-
70
- auto jsVersion = maybeJSVersion.asString(rnRuntime).utf8(rnRuntime);
71
-
72
- if (!matchVersion(cppVersion, jsVersion)) {
73
- jsLogger->warnOnJS(
74
- std::string(
75
- "[Reanimated] Mismatch between C++ code version and JavaScript code version (") +
76
- cppVersion + " vs. " + jsVersion + " respectively).\n" +
77
- "See `https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#mismatch-between-c-code-version-and-javascript-code-version` for more details.");
78
- return;
79
- }
80
- }
81
- #else
82
- void checkJSVersion(
83
- jsi::Runtime &rnRuntime,
84
- const std::shared_ptr<worklets::JSLogger> &jsLogger) {
85
- // In release builds we don't check the version, hence
86
- // this function is a NOOP.
87
- }
88
-
89
- bool matchVersion(const std::string &version1, const std::string &version2) {
90
- // Stub implementation for release builds.
91
- return true;
92
- }
93
- #endif // NDEBUG
94
-
95
- }; // namespace worklets
@@ -1,72 +0,0 @@
1
- #pragma once
2
-
3
- #ifndef NDEBUG
4
-
5
- #include <cxxabi.h>
6
-
7
- #include <atomic>
8
- #include <cassert>
9
- #include <iostream>
10
- #include <string>
11
-
12
- #ifdef ANDROID
13
- #include <android/log.h>
14
- #endif // ANDROID
15
-
16
- namespace worklets {
17
-
18
- // This is a class that counts how many instances of a different class there
19
- // are. It is meant only to be used with classes that should only have one
20
- // instance.
21
-
22
- template <class T>
23
- class SingleInstanceChecker {
24
- public:
25
- SingleInstanceChecker();
26
- ~SingleInstanceChecker();
27
-
28
- private:
29
- void assertWithMessage(bool condition, std::string message) {
30
- if (!condition) {
31
- #ifdef ANDROID
32
- __android_log_print(
33
- ANDROID_LOG_WARN, "Reanimated", "%s", message.c_str());
34
- #else
35
- std::cerr << "[Reanimated] " << message << std::endl;
36
- #endif
37
-
38
- #ifdef IS_REANIMATED_EXAMPLE_APP
39
- assert(false);
40
- #endif
41
- }
42
- }
43
-
44
- // A static field will exist separately for every class template.
45
- // This has to be inline for automatic initialization.
46
- inline static std::atomic<int> instanceCount_;
47
- };
48
-
49
- template <class T>
50
- SingleInstanceChecker<T>::SingleInstanceChecker() {
51
- int status = 0;
52
- std::string className =
53
- __cxxabiv1::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
54
-
55
- // React Native can spawn up to two instances of a Native Module at the same
56
- // time. This happens during a reload when a new instance of React Native is
57
- // created while simultaneously the old one is torn down.
58
- instanceCount_++;
59
- assertWithMessage(
60
- instanceCount_ <= 2,
61
- "[Reanimated] More than two instances of " + className +
62
- " present. This may indicate a memory leak due to a retain cycle.");
63
- }
64
-
65
- template <class T>
66
- SingleInstanceChecker<T>::~SingleInstanceChecker() {
67
- instanceCount_--;
68
- }
69
-
70
- } // namespace worklets
71
-
72
- #endif // NDEBUG
@@ -1,49 +0,0 @@
1
- #pragma once
2
-
3
- #include <condition_variable>
4
- #include <mutex>
5
- #include <queue>
6
- #include <utility>
7
-
8
- namespace worklets {
9
-
10
- //
11
- // Copyright (c) 2013 Juan Palacios juan.palacios.puyana@gmail.com
12
- // Subject to the BSD 2-Clause License
13
- // - see < https://opensource.org/license/bsd-2-clause/ >
14
- //
15
- template <typename T>
16
- class ThreadSafeQueue {
17
- public:
18
- T pop() {
19
- std::unique_lock<std::mutex> mlock(mutex_);
20
- while (queue_.empty()) {
21
- cond_.wait(mlock);
22
- }
23
- const auto item = queue_.front();
24
- queue_.pop();
25
- return item;
26
- }
27
-
28
- void push(T &&item) {
29
- std::unique_lock<std::mutex> mlock(mutex_);
30
- queue_.push(std::move(item));
31
- mlock.unlock();
32
- cond_.notify_one();
33
- }
34
-
35
- bool empty() const {
36
- std::unique_lock<std::mutex> mlock(mutex_);
37
- const auto res = queue_.empty();
38
- mlock.unlock();
39
- cond_.notify_one();
40
- return res;
41
- }
42
-
43
- private:
44
- std::queue<T> queue_;
45
- mutable std::mutex mutex_;
46
- mutable std::condition_variable cond_;
47
- };
48
-
49
- } // namespace worklets
@@ -1,20 +0,0 @@
1
- #include <worklets/Tools/UIScheduler.h>
2
- #include <worklets/WorkletRuntime/ReanimatedRuntime.h>
3
-
4
- #include <utility>
5
-
6
- namespace worklets {
7
-
8
- void UIScheduler::scheduleOnUI(std::function<void()> job) {
9
- uiJobs_.push(std::move(job));
10
- }
11
-
12
- void UIScheduler::triggerUI() {
13
- scheduledOnUI_ = false;
14
- while (!uiJobs_.empty()) {
15
- const auto job = uiJobs_.pop();
16
- job();
17
- }
18
- }
19
-
20
- } // namespace worklets
@@ -1,22 +0,0 @@
1
- #pragma once
2
-
3
- #include <worklets/Tools/ThreadSafeQueue.h>
4
-
5
- #include <ReactCommon/CallInvoker.h>
6
-
7
- #include <atomic>
8
-
9
- namespace worklets {
10
-
11
- class UIScheduler {
12
- public:
13
- virtual void scheduleOnUI(std::function<void()> job);
14
- virtual void triggerUI();
15
- virtual ~UIScheduler() = default;
16
-
17
- protected:
18
- std::atomic<bool> scheduledOnUI_{false};
19
- ThreadSafeQueue<std::function<void()>> uiJobs_;
20
- };
21
-
22
- } // namespace worklets
@@ -1,29 +0,0 @@
1
- #include <worklets/Tools/WorkletEventHandler.h>
2
-
3
- namespace worklets {
4
-
5
- void WorkletEventHandler::process(
6
- const std::shared_ptr<WorkletRuntime> &workletRuntime,
7
- const double eventTimestamp,
8
- const jsi::Value &eventValue) const {
9
- workletRuntime->runGuarded(
10
- handlerFunction_, jsi::Value(eventTimestamp), eventValue);
11
- }
12
-
13
- uint64_t WorkletEventHandler::getHandlerId() const {
14
- return handlerId_;
15
- }
16
-
17
- const std::string &WorkletEventHandler::getEventName() const {
18
- return eventName_;
19
- }
20
-
21
- uint64_t WorkletEventHandler::getEmitterReactTag() const {
22
- return emitterReactTag_;
23
- }
24
-
25
- bool WorkletEventHandler::shouldIgnoreEmitterReactTag() const {
26
- return emitterReactTag_ == -1;
27
- }
28
-
29
- } // namespace worklets
@@ -1,41 +0,0 @@
1
- #pragma once
2
-
3
- #include <worklets/SharedItems/Shareables.h>
4
- #include <worklets/WorkletRuntime/WorkletRuntime.h>
5
-
6
- #include <jsi/jsi.h>
7
-
8
- #include <memory>
9
- #include <string>
10
-
11
- using namespace facebook;
12
-
13
- namespace worklets {
14
-
15
- class WorkletEventHandler {
16
- const uint64_t handlerId_;
17
- const uint64_t emitterReactTag_;
18
- const std::string eventName_;
19
- const std::shared_ptr<ShareableWorklet> handlerFunction_;
20
-
21
- public:
22
- WorkletEventHandler(
23
- const uint64_t handlerId,
24
- const std::string &eventName,
25
- const uint64_t emitterReactTag,
26
- const std::shared_ptr<ShareableWorklet> &handlerFunction)
27
- : handlerId_(handlerId),
28
- emitterReactTag_(emitterReactTag),
29
- eventName_(eventName),
30
- handlerFunction_(handlerFunction) {}
31
- void process(
32
- const std::shared_ptr<WorkletRuntime> &workletRuntime,
33
- double eventTimestamp,
34
- const jsi::Value &eventValue) const;
35
- uint64_t getHandlerId() const;
36
- const std::string &getEventName() const;
37
- uint64_t getEmitterReactTag() const;
38
- bool shouldIgnoreEmitterReactTag() const;
39
- };
40
-
41
- } // namespace worklets
@@ -1,16 +0,0 @@
1
- #include <worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h>
2
-
3
- namespace worklets {
4
-
5
- void RNRuntimeWorkletDecorator::decorate(
6
- jsi::Runtime &rnRuntime,
7
- const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy) {
8
- rnRuntime.global().setProperty(rnRuntime, "_WORKLET", false);
9
-
10
- rnRuntime.global().setProperty(
11
- rnRuntime,
12
- "__workletsModuleProxy",
13
- jsi::Object::createFromHostObject(rnRuntime, workletsModuleProxy));
14
- }
15
-
16
- } // namespace worklets
@@ -1,19 +0,0 @@
1
- #pragma once
2
-
3
- #include <jsi/jsi.h>
4
- #include <worklets/NativeModules/WorkletsModuleProxy.h>
5
- #include <memory>
6
-
7
- using namespace facebook;
8
-
9
- namespace worklets {
10
-
11
- class RNRuntimeWorkletDecorator {
12
- // TODO: Rename to `RNRuntimeWorkletsDecorator` or something more suitable.
13
- public:
14
- static void decorate(
15
- jsi::Runtime &rnRuntime,
16
- const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy);
17
- };
18
-
19
- } // namespace worklets
@@ -1,112 +0,0 @@
1
- #include <worklets/WorkletRuntime/ReanimatedHermesRuntime.h>
2
-
3
- // Only include this file in Hermes-enabled builds as some platforms (like tvOS)
4
- // don't support hermes and it causes the compilation to fail.
5
- #if JS_RUNTIME_HERMES
6
-
7
- #include <cxxreact/MessageQueueThread.h>
8
- #include <jsi/decorator.h>
9
- #include <jsi/jsi.h>
10
-
11
- #include <memory>
12
- #include <string>
13
- #include <utility>
14
-
15
- namespace worklets {
16
-
17
- using namespace facebook;
18
- using namespace react;
19
- #if HERMES_ENABLE_DEBUGGER
20
- using namespace facebook::hermes::inspector_modern;
21
- #endif // HERMES_ENABLE_DEBUGGER
22
-
23
- #if HERMES_ENABLE_DEBUGGER
24
-
25
- class HermesExecutorRuntimeAdapter : public RuntimeAdapter {
26
- public:
27
- explicit HermesExecutorRuntimeAdapter(
28
- facebook::hermes::HermesRuntime &hermesRuntime,
29
- const std::shared_ptr<MessageQueueThread> &thread)
30
- : hermesRuntime_(hermesRuntime), thread_(std::move(thread)) {}
31
-
32
- virtual ~HermesExecutorRuntimeAdapter() {
33
- // This is required by iOS, because there is an assertion in the destructor
34
- // that the thread was indeed `quit` before
35
- thread_->quitSynchronous();
36
- }
37
-
38
- facebook::hermes::HermesRuntime &getRuntime() override {
39
- return hermesRuntime_;
40
- }
41
-
42
- // This is not empty in the original implementation, but we decided to tickle
43
- // the runtime by running a small piece of code on every frame as using this
44
- // required us to hold a refernce to the runtime inside this adapter which
45
- // caused issues while reloading the app.
46
- void tickleJs() override {}
47
-
48
- public:
49
- facebook::hermes::HermesRuntime &hermesRuntime_;
50
- std::shared_ptr<MessageQueueThread> thread_;
51
- };
52
-
53
- #endif // HERMES_ENABLE_DEBUGGER
54
-
55
- ReanimatedHermesRuntime::ReanimatedHermesRuntime(
56
- std::unique_ptr<facebook::hermes::HermesRuntime> runtime,
57
- const std::shared_ptr<MessageQueueThread> &jsQueue,
58
- const std::string &name)
59
- : jsi::WithRuntimeDecorator<ReanimatedReentrancyCheck>(
60
- *runtime,
61
- reentrancyCheck_),
62
- runtime_(std::move(runtime)) {
63
- #if HERMES_ENABLE_DEBUGGER
64
- auto adapter =
65
- std::make_unique<HermesExecutorRuntimeAdapter>(*runtime_, jsQueue);
66
- debugToken_ = chrome::enableDebugging(std::move(adapter), name);
67
- #else
68
- // This is required by iOS, because there is an assertion in the destructor
69
- // that the thread was indeed `quit` before
70
- jsQueue->quitSynchronous();
71
- #endif // HERMES_ENABLE_DEBUGGER
72
-
73
- #ifndef NDEBUG
74
- facebook::hermes::HermesRuntime *wrappedRuntime = runtime_.get();
75
- jsi::Value evalWithSourceMap = jsi::Function::createFromHostFunction(
76
- *runtime_,
77
- jsi::PropNameID::forAscii(*runtime_, "evalWithSourceMap"),
78
- 3,
79
- [wrappedRuntime](
80
- jsi::Runtime &rt,
81
- const jsi::Value &thisValue,
82
- const jsi::Value *args,
83
- size_t count) -> jsi::Value {
84
- auto code = std::make_shared<const jsi::StringBuffer>(
85
- args[0].asString(rt).utf8(rt));
86
- std::string sourceURL;
87
- if (count > 1 && args[1].isString()) {
88
- sourceURL = args[1].asString(rt).utf8(rt);
89
- }
90
- std::shared_ptr<const jsi::Buffer> sourceMap;
91
- if (count > 2 && args[2].isString()) {
92
- sourceMap = std::make_shared<const jsi::StringBuffer>(
93
- args[2].asString(rt).utf8(rt));
94
- }
95
- return wrappedRuntime->evaluateJavaScriptWithSourceMap(
96
- code, sourceMap, sourceURL);
97
- });
98
- runtime_->global().setProperty(
99
- *runtime_, "evalWithSourceMap", evalWithSourceMap);
100
- #endif // NDEBUG
101
- }
102
-
103
- ReanimatedHermesRuntime::~ReanimatedHermesRuntime() {
104
- #if HERMES_ENABLE_DEBUGGER
105
- // We have to disable debugging before the runtime is destroyed.
106
- chrome::disableDebugging(debugToken_);
107
- #endif // HERMES_ENABLE_DEBUGGER
108
- }
109
-
110
- } // namespace worklets
111
-
112
- #endif // JS_RUNTIME_HERMES