@react-native-ohos/react-native-reanimated 3.18.1-rc.6 → 4.0.0-rc.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 (275) hide show
  1. package/compatibility.json +161 -0
  2. package/harmony/reanimated/BuildProfile.ets +1 -1
  3. package/harmony/reanimated/build-profile.json5 +8 -1
  4. package/harmony/reanimated/oh-package.json5 +3 -2
  5. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
  6. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +11 -16
  7. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -4
  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 +93 -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 +44 -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 +110 -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 +51 -39
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +13 -15
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +0 -3
  160. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +22 -53
  161. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +12 -8
  162. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +46 -37
  163. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -10
  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 +4 -2
  171. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +62 -157
  172. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +38 -46
  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} +303 -276
  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 +5 -65
  180. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +52 -82
  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 +957 -552
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +87 -111
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +115 -163
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +38 -54
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +34 -36
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +8 -0
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +46 -58
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +5 -9
  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 +26 -57
  197. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +12 -33
  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 +3 -4
  200. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -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 +12 -1
  209. package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
  210. package/harmony/reanimated.har +0 -0
  211. package/package.json +36 -18
  212. package/scripts/deploy.js +191 -0
  213. package/scripts/set-reanimated-version.js +37 -0
  214. package/scripts/update-version.js +119 -0
  215. package/scripts/validate-react-native-version.js +46 -0
  216. package/scripts/validate-worklets-build.js +17 -0
  217. package/scripts/validate-worklets-version.js +79 -0
  218. package/scripts/worklets-version.json +4 -0
  219. package/LICENSE +0 -21
  220. package/README.OpenSource +0 -11
  221. package/README.md +0 -10
  222. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
  223. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
  224. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
  225. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
  226. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
  227. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
  228. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
  229. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
  230. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
  231. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
  232. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
  233. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
  234. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
  235. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
  236. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
  237. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
  238. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
  239. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
  240. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
  241. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
  242. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
  243. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
  244. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
  245. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
  246. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
  247. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
  248. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
  249. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
  250. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
  251. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
  252. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
  253. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
  254. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
  255. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
  256. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
  257. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
  258. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
  259. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
  260. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
  261. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
  262. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
  263. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
  264. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -155
  265. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
  266. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
  267. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -182
  268. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
  269. package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
  270. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
  271. package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
  272. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
  273. package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
  274. package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
  275. package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
@@ -1,127 +0,0 @@
1
- #pragma once
2
-
3
- #include <worklets/Tools/Defs.h>
4
-
5
- // Only include this file in Hermes-enabled builds as some platforms (like tvOS)
6
- // don't support hermes and it causes the compilation to fail.
7
- #if JS_RUNTIME_HERMES
8
-
9
- #include <cxxreact/MessageQueueThread.h>
10
- #include <hermes/hermes.h>
11
- #include <jsi/decorator.h>
12
- #include <jsi/jsi.h>
13
-
14
- #include <atomic>
15
- #include <memory>
16
- #include <string>
17
- #include <thread>
18
-
19
- #if HERMES_ENABLE_DEBUGGER
20
- #include <hermes/inspector-modern/chrome/Registration.h>
21
- #endif // HERMES_ENABLE_DEBUGGER
22
-
23
- namespace worklets {
24
-
25
- using namespace facebook;
26
- using namespace react;
27
- #if HERMES_ENABLE_DEBUGGER
28
- using namespace facebook::hermes::inspector_modern;
29
- #endif // HERMES_ENABLE_DEBUGGER
30
-
31
- // ReentrancyCheck is copied from React Native
32
- // from ReactCommon/hermes/executor/HermesExecutorFactory.cpp
33
- // https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp
34
- struct ReanimatedReentrancyCheck {
35
- // This is effectively a very subtle and complex assert, so only
36
- // include it in builds which would include asserts.
37
- #ifndef NDEBUG
38
- ReanimatedReentrancyCheck() : tid(std::thread::id()), depth(0) {}
39
-
40
- void before() {
41
- std::thread::id this_id = std::this_thread::get_id();
42
- std::thread::id expected = std::thread::id();
43
-
44
- // A note on memory ordering: the main purpose of these checks is
45
- // to observe a before/before race, without an intervening after.
46
- // This will be detected by the compare_exchange_strong atomicity
47
- // properties, regardless of memory order.
48
- //
49
- // For everything else, it is easiest to think of 'depth' as a
50
- // proxy for any access made inside the VM. If access to depth
51
- // are reordered incorrectly, the same could be true of any other
52
- // operation made by the VM. In fact, using acquire/release
53
- // memory ordering could create barriers which mask a programmer
54
- // error. So, we use relaxed memory order, to avoid masking
55
- // actual ordering errors. Although, in practice, ordering errors
56
- // of this sort would be surprising, because the decorator would
57
- // need to call after() without before().
58
-
59
- if (tid.compare_exchange_strong(
60
- expected, this_id, std::memory_order_relaxed)) {
61
- // Returns true if tid and expected were the same. If they
62
- // were, then the stored tid referred to no thread, and we
63
- // atomically saved this thread's tid. Now increment depth.
64
- assert(depth == 0 && "[Reanimated] No thread id, but depth != 0");
65
- ++depth;
66
- } else if (expected == this_id) {
67
- // If the stored tid referred to a thread, expected was set to
68
- // that value. If that value is this thread's tid, that's ok,
69
- // just increment depth again.
70
- assert(depth != 0 && "[Reanimated] Thread id was set, but depth == 0");
71
- ++depth;
72
- } else {
73
- // The stored tid was some other thread. This indicates a bad
74
- // programmer error, where VM methods were called on two
75
- // different threads unsafely. Fail fast (and hard) so the
76
- // crash can be analyzed.
77
- __builtin_trap();
78
- }
79
- }
80
-
81
- void after() {
82
- assert(
83
- tid.load(std::memory_order_relaxed) == std::this_thread::get_id() &&
84
- "[Reanimated] No thread id in after()");
85
- if (--depth == 0) {
86
- // If we decremented depth to zero, store no-thread into tid.
87
- std::thread::id expected = std::this_thread::get_id();
88
- bool didWrite = tid.compare_exchange_strong(
89
- expected, std::thread::id(), std::memory_order_relaxed);
90
- assert(didWrite && "[Reanimated] Decremented to zero, but no tid write");
91
- }
92
- }
93
-
94
- std::atomic<std::thread::id> tid;
95
- // This is not atomic, as it is only written or read from the owning
96
- // thread.
97
- unsigned int depth;
98
- #endif // NDEBUG
99
- };
100
-
101
- // This is in fact a subclass of jsi::Runtime! WithRuntimeDecorator is a
102
- // template class that is a subclass of DecoratedRuntime which is also a
103
- // template class that then inherits its template, which in this case is
104
- // jsi::Runtime. So the inheritance is: ReanimatedHermesRuntime ->
105
- // WithRuntimeDecorator -> DecoratedRuntime -> jsi::Runtime You can find out
106
- // more about this in ReactCommon/jsi/jsi/Decorator.h or by following this link:
107
- // https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/jsi/jsi/decorator.h
108
- class ReanimatedHermesRuntime
109
- : public jsi::WithRuntimeDecorator<ReanimatedReentrancyCheck> {
110
- public:
111
- ReanimatedHermesRuntime(
112
- std::unique_ptr<facebook::hermes::HermesRuntime> runtime,
113
- const std::shared_ptr<MessageQueueThread> &jsQueue,
114
- const std::string &name);
115
- ~ReanimatedHermesRuntime();
116
-
117
- private:
118
- std::unique_ptr<facebook::hermes::HermesRuntime> runtime_;
119
- ReanimatedReentrancyCheck reentrancyCheck_;
120
- #if HERMES_ENABLE_DEBUGGER
121
- chrome::DebugSessionToken debugToken_;
122
- #endif // HERMES_ENABLE_DEBUGGER
123
- };
124
-
125
- } // namespace worklets
126
-
127
- #endif // JS_RUNTIME_HERMES
@@ -1,53 +0,0 @@
1
- #include <worklets/Tools/Defs.h>
2
- #include <worklets/WorkletRuntime/ReanimatedRuntime.h>
3
-
4
- #include <cxxreact/MessageQueueThread.h>
5
- #include <jsi/jsi.h>
6
-
7
- #include <memory>
8
- #include <utility>
9
-
10
- #if JS_RUNTIME_HERMES
11
- #include <worklets/WorkletRuntime/ReanimatedHermesRuntime.h>
12
- #elif JS_RUNTIME_V8
13
- #include <v8runtime/V8RuntimeFactory.h>
14
- #else
15
- #include <jsc/JSCRuntime.h>
16
- #endif // JS_RUNTIME
17
-
18
- namespace worklets {
19
-
20
- using namespace facebook;
21
- using namespace react;
22
-
23
- std::shared_ptr<jsi::Runtime> ReanimatedRuntime::make(
24
- jsi::Runtime &rnRuntime,
25
- const std::shared_ptr<MessageQueueThread> &jsQueue,
26
- const std::string &name) {
27
- (void)rnRuntime; // used only for V8
28
- #if JS_RUNTIME_HERMES
29
- // We don't call `jsQueue->quitSynchronous()` here, since it will be done
30
- // later in ReanimatedHermesRuntime
31
-
32
- auto runtime = facebook::hermes::makeHermesRuntime();
33
- return std::make_shared<ReanimatedHermesRuntime>(
34
- std::move(runtime), jsQueue, name);
35
- #elif JS_RUNTIME_V8
36
- // This is required by iOS, because there is an assertion in the destructor
37
- // that the thread was indeed `quit` before.
38
- jsQueue->quitSynchronous();
39
-
40
- auto config = std::make_unique<rnv8::V8RuntimeConfig>();
41
- config->enableInspector = false;
42
- config->appName = name;
43
- return rnv8::createSharedV8Runtime(&rnRuntime, std::move(config));
44
- #else
45
- // This is required by iOS, because there is an assertion in the destructor
46
- // that the thread was indeed `quit` before
47
- jsQueue->quitSynchronous();
48
-
49
- return facebook::jsc::makeJSCRuntime();
50
- #endif
51
- }
52
-
53
- } // namespace worklets
@@ -1,22 +0,0 @@
1
- #pragma once
2
-
3
- #include <cxxreact/MessageQueueThread.h>
4
- #include <jsi/jsi.h>
5
-
6
- #include <memory>
7
- #include <string>
8
-
9
- namespace worklets {
10
-
11
- using namespace facebook;
12
- using namespace react;
13
-
14
- class ReanimatedRuntime {
15
- public:
16
- static std::shared_ptr<jsi::Runtime> make(
17
- jsi::Runtime &rnRuntime,
18
- const std::shared_ptr<MessageQueueThread> &jsQueue,
19
- const std::string &name);
20
- };
21
-
22
- } // namespace worklets
@@ -1,191 +0,0 @@
1
- # Hermes Runtime initialization
2
-
3
- _Last updated_: 13/09/2022 by @Kwasow
4
-
5
- This document describes the current way of initializing Hermes and connecting
6
- it to the debugger. The work I did was mainly based on
7
-
8
- [HermesExecutorFactory.cpp](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp)
9
- from React Native.
10
-
11
- ## Runtime initialization
12
-
13
- If you take a look at `NativeProxy` (both on Android and iOS) you'll find
14
- that it only makes a call to `ReanimatedRuntime::make(jsQueue)`. This
15
- static function will return the correct runtime based on the user's configuration.
16
-
17
- The initialization process is pretty simple and has only been moved out of
18
- `NativeProxy` into `ReanimatedRuntime` without any major changes.
19
-
20
- ## Hermes runtime debugging
21
-
22
- To enable debugging on the Hermes runtime we need to do two things:
23
-
24
- 1. Include source maps in JavaScript files
25
-
26
- This part is done purely in JavaScript via the Babel plugin. The `makeWorklet`
27
- function received an AST tree, which is aware of the modifications it made to
28
- the code and therefore can generate the necessary source maps. It is important
29
- that when we want to create a string from the AST we use the `generate` function
30
- and enable source map generation so line mappings are not lost. Then when
31
- transforming that code (ex. with `transformSync`) we have to pass the source
32
- map as input so it can be updated.
33
-
34
- Source map settings should always be set to `inline` so they are automatically
35
- appended to the source code. The generated source map will be a base64 encoded
36
- json.
37
-
38
- A workletized function would look like this (after formattings):
39
-
40
- ```js
41
- function _f(number) {
42
- console.log(_WORKLET, number);
43
- }
44
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IkFBYXNCLFNBQUNBLEVBQUQsQ0FBQ0EsTUFBRCxFQUFvQjtBQUV0Q0MsU0FBTyxDQUFDQyxHQUFSRCxDQUFZRSxRQUFaRixFQUFzQkQsTUFBdEJDO0FBRmtCIiwibmFtZXMiOlsibnVtYmVyIiwiY29uc29sZSIsImxvZyIsIl9XT1JLTEVUIl0sInNvdXJjZXMiOlsiL1VzZXJzL2thcm9sL0dpdC9yZWFjdC1uYXRpdmUtcmVhbmltYXRlZC9GYWJyaWNFeGFtcGxlL3NyYy9Xb3JrbGV0RXhhbXBsZS50c3giXSwic291cmNlc0NvbnRlbnQiOlsiLyogZ2xvYmFsIF9XT1JLTEVUICovXG5pbXBvcnQgeyBCdXR0b24sIFZpZXcsIFN0eWxlU2hlZXQgfSBmcm9tICdyZWFjdC1uYXRpdmUnO1xuaW1wb3J0IHtcbiAgcnVuT25KUyxcbiAgcnVuT25VSSxcbiAgdXNlRGVyaXZlZFZhbHVlLFxuICB1c2VTaGFyZWRWYWx1ZSxcbn0gZnJvbSAncmVhY3QtbmF0aXZlLXJlYW5pbWF0ZWQnO1xuXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBXb3JrbGV0RXhhbXBsZSgpIHtcbiAgLy8gcnVuT25VSSBkZW1vXG4gIGNvbnN0IHNvbWVXb3JrbGV0ID0gKG51bWJlcjogbnVtYmVyKSA9PiB7XG4gICAgJ3dvcmtsZXQnO1xuICAgIGNvbnNvbGUubG9nKF9XT1JLTEVULCBudW1iZXIpOyAvLyBfV09SS0xFVCBzaG91bGQgYmUgdHJ1ZVxuICB9O1xuXG4gIGNvbnN0IGhhbmRsZVByZXNzMSA9ICgpID0+IHtcbiAgICBydW5PblVJKHNvbWVXb3JrbGV0KShNYXRoLnJhbmRvbSgpKTtcbiAgfTtcblxuICAvLyBydW5PbkpTIGRlbW9cbiAgY29uc3QgeCA9IHVzZVNoYXJlZFZhbHVlKDApO1xuXG4gIGNvbnN0IHNvbWVGdW5jdGlvbiA9IChudW1iZXI6IG51bWJlcikgPT4ge1xuICAgIGNvbnNvbGUubG9nKF9XT1JLTEVULCBudW1iZXIpOyAvLyBfV09SS0xFVCBzaG91bGQgYmUgZmFsc2VcbiAgfTtcblxuICB1c2VEZXJpdmVkVmFsdWUoKCkgPT4ge1xuICAgIHJ1bk9uSlMoc29tZUZ1bmN0aW9uKSh4LnZhbHVlKTtcbiAgfSk7XG5cbiAgY29uc3QgaGFuZGxlUHJlc3MyID0gKCkgPT4ge1xuICAgIHgudmFsdWUgPSBNYXRoLnJhbmRvbSgpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPFZpZXcgc3R5bGU9e3N0eWxlcy5jb250YWluZXJ9PlxuICAgICAgPEJ1dHRvbiBvblByZXNzPXtoYW5kbGVQcmVzczF9IHRpdGxlPVwicnVuT25VSSBkZW1vXCIgLz5cbiAgICAgIDxCdXR0b24gb25QcmVzcz17aGFuZGxlUHJlc3MyfSB0aXRsZT1cInJ1bk9uSlMgZGVtb1wiIC8+XG4gICAgPC9WaWV3PlxuICApO1xufVxuXG5jb25zdCBzdHlsZXMgPSBTdHlsZVNoZWV0LmNyZWF0ZSh7XG4gIGNvbnRhaW5lcjoge1xuICAgIGZsZXg6IDEsXG4gICAgYWxpZ25JdGVtczogJ2NlbnRlcicsXG4gICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxuICB9LFxufSk7XG4iXX0=
45
- ```
46
-
47
- And the base64 string after decoding is:
48
-
49
- ```json
50
- {
51
- "version": 3,
52
- "mappings": "AAasB,SAACA,EAAD,CAACA,MAAD,EAAoB;AAEtCC,SAAO,CAACC,GAARD,CAAYE,QAAZF,EAAsBD,MAAtBC;AAFkB",
53
- "names": ["number", "console", "log", "_WORKLET"],
54
- "sources": [
55
- "/Users/karol/Git/react-native-reanimated/FabricExample/src/WorkletExample.tsx"
56
- ],
57
- "sourcesContent": [
58
- "/* global _WORKLET */\nimport { Button, View, StyleSheet } from 'react-native';\nimport {\n runOnJS,\n runOnUI,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport React from 'react';\n\nexport default function WorkletExample() {\n // runOnUI demo\n const someWorklet = (number: number) => {\n 'worklet';\n console.log(_WORKLET, number); // _WORKLET should be true\n };\n\n const handlePress1 = () => {\n runOnUI(someWorklet)(Math.random());\n };\n\n // runOnJS demo\n const x = useSharedValue(0);\n\n const someFunction = (number: number) => {\n console.log(_WORKLET, number); // _WORKLET should be false\n };\n\n useDerivedValue(() => {\n runOnJS(someFunction)(x.value);\n });\n\n const handlePress2 = () => {\n x.value = Math.random();\n };\n\n return (\n <View style={styles.container}>\n <Button onPress={handlePress1} title=\"runOnUI demo\" />\n <Button onPress={handlePress2} title=\"runOnJS demo\" />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n"
59
- ]
60
- }
61
- ```
62
-
63
- We run jest tests in release mode, because source maps will contain absolute
64
- paths, which will be different on every machine and therefore would also alter
65
- worklet hashes. Running in release mode prevents this.
66
-
67
- 2. Enable debugging on the runtime object
68
-
69
- This is done by creating an adapter (`HermesExecutorRuntimeAdapter` inside of
70
- `ReanimatedHermesRuntime.cpp`) which holds the runtime and allows the debugger
71
- to communicate with it. The adapter is managed by a `Connection` (`ConnectionDemux`)
72
- object, but this is not important in our case. We just have to make a call
73
- to `facebook::hermes::inspector::chrome::enableDebugging()` and pass the adapter
74
- and runtime name as parameters.
75
-
76
- It is important to also `disableDebugging()` before the runtime is destroyed.
77
- Failing to do so will probably crash the app as the debugger will try to
78
- connect to a non-existent runtime.
79
-
80
- The runtime should also be destroyed before the Reanimated module, because
81
- otherwise there might be weird BAD_ACCESS errors when the gc gets it
82
- hand on the runtime.
83
-
84
- ## Metro endpoint
85
-
86
- Flipper and Chrome DevTools in general use the `localhost:8081/json` (where `8081`
87
- is the port metro is running on) endpoint of metro to get the list of debuggable
88
- targets (runtimes). For a normal React Native app the output would look something
89
- like this:
90
-
91
- ```json
92
- [
93
- {
94
- "id": "0-1",
95
- "description": "org.reactjs.native.example.FabricExample",
96
- "title": "Hermes React Native",
97
- "faviconUrl": "https://reactjs.org/favicon.ico",
98
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D1",
99
- "type": "node",
100
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=0&page=1",
101
- "vm": "Hermes"
102
- },
103
- {
104
- "id": "0--1",
105
- "description": "org.reactjs.native.example.FabricExample",
106
- "title": "React Native Experimental (Improved Chrome Reloads)",
107
- "faviconUrl": "https://reactjs.org/favicon.ico",
108
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D-1",
109
- "type": "node",
110
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=0&page=-1",
111
- "vm": "don't use"
112
- }
113
- ]
114
- ```
115
-
116
- For an Android app with Reanimated it should include the Reanimated runtime like
117
- this:
118
-
119
- ```json
120
- [
121
- {
122
- "id": "0-2",
123
- "description": "com.fabricexample",
124
- "title": "Reanimated Runtime",
125
- "faviconUrl": "https://reactjs.org/favicon.ico",
126
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D3",
127
- "type": "node",
128
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=1&page=2",
129
- "vm": "Hermes"
130
- },
131
- {
132
- "id": "0-1",
133
- "description": "com.fabricexample",
134
- "title": "Hermes React Native",
135
- "faviconUrl": "https://reactjs.org/favicon.ico",
136
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D2",
137
- "type": "node",
138
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=1&page=1",
139
- "vm": "Hermes"
140
- },
141
- {
142
- "id": "0--1",
143
- "description": "com.fabricexample",
144
- "title": "React Native Experimental (Improved Chrome Reloads)",
145
- "faviconUrl": "https://reactjs.org/favicon.ico",
146
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D-1",
147
- "type": "node",
148
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=1&page=-1",
149
- "vm": "don't use"
150
- },
151
- {
152
- "id": "0--2",
153
- "description": "com.fabricexample",
154
- "title": "Reanimated Runtime Experimental (Improved Chrome Reloads)",
155
- "faviconUrl": "https://reactjs.org/favicon.ico",
156
- "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D-2",
157
- "type": "node",
158
- "webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=1&page=-2",
159
- "vm": "don't use"
160
- }
161
- ]
162
- ```
163
-
164
- Runtimes with negative IDs are 'virtual' - they are just references to the real
165
- runtimes but their IDs don't change after a reload. If we were to connect to
166
- the normal runtime and reload the app it would crash, as the debugger would try
167
- to communicate with a non-existent runtime. These 'virtual' runtimes are made
168
- and managed by metro (PR: [facebook/metro#864](https://github.com/facebook/metro/pull/864)).
169
-
170
- ## Known issues
171
-
172
- **IFrame sandboxing**
173
-
174
- Source maps always define a `sources` array, which contain names of files used
175
- to generate the source map. For Chrome DevTools this is sufficient as it will
176
- read files from disk, but the `IFrame` interface used by Flipper is sandboxed
177
- and doesn't allow filesystem access. Therefore we also need to include the files
178
- content in the `sourcesContent` array.
179
-
180
- **Chrome version 105.0.5195.102 doesn't load source maps**
181
-
182
- This version of Chrome introduced a regression into DevTools that broke source
183
- maps loading for node.js apps. This issue is not caused by Reanimated in any
184
- way and should be fixed by Chrome developers in later versions.
185
-
186
- The issue was tracked here: https://bugs.chromium.org/p/chromium/issues/detail?id=1358497
187
-
188
- **App reloads don't work**
189
-
190
- On iOS the app will crash on every reload if a debugger is connected to the runtime.
191
- On Android it will also crash but only after a few reloads.
@@ -1,155 +0,0 @@
1
- #include <worklets/Tools/JSISerializer.h>
2
- #include <worklets/WorkletRuntime/ReanimatedRuntime.h>
3
- #include <worklets/WorkletRuntime/WorkletRuntime.h>
4
- #include <worklets/WorkletRuntime/WorkletRuntimeCollector.h>
5
- #include <worklets/WorkletRuntime/WorkletRuntimeDecorator.h>
6
-
7
- #include <jsi/decorator.h>
8
-
9
- namespace worklets {
10
-
11
- class AroundLock {
12
- const std::shared_ptr<std::recursive_mutex> mutex_;
13
-
14
- public:
15
- explicit AroundLock(const std::shared_ptr<std::recursive_mutex> &mutex)
16
- : mutex_(mutex) {}
17
-
18
- void before() const {
19
- mutex_->lock();
20
- }
21
-
22
- void after() const {
23
- mutex_->unlock();
24
- }
25
- };
26
-
27
- class LockableRuntime : public jsi::WithRuntimeDecorator<AroundLock> {
28
- AroundLock aroundLock_;
29
- std::shared_ptr<jsi::Runtime> runtime_;
30
-
31
- public:
32
- explicit LockableRuntime(
33
- std::shared_ptr<jsi::Runtime> &runtime,
34
- const std::shared_ptr<std::recursive_mutex> &runtimeMutex)
35
- : jsi::WithRuntimeDecorator<AroundLock>(*runtime, aroundLock_),
36
- aroundLock_(runtimeMutex),
37
- runtime_(std::move(runtime)) {}
38
- };
39
-
40
- static std::shared_ptr<jsi::Runtime> makeRuntime(
41
- jsi::Runtime &runtime,
42
- const std::shared_ptr<MessageQueueThread> &jsQueue,
43
- const std::string &name,
44
- const bool supportsLocking,
45
- const std::shared_ptr<std::recursive_mutex> &runtimeMutex) {
46
- auto reanimatedRuntime = ReanimatedRuntime::make(runtime, jsQueue, name);
47
- if (supportsLocking) {
48
- return std::make_shared<LockableRuntime>(reanimatedRuntime, runtimeMutex);
49
- } else {
50
- return reanimatedRuntime;
51
- }
52
- }
53
-
54
- WorkletRuntime::WorkletRuntime(
55
- jsi::Runtime &rnRuntime,
56
- const std::shared_ptr<MessageQueueThread> &jsQueue,
57
- const std::shared_ptr<JSScheduler> &jsScheduler,
58
- const std::string &name,
59
- const bool supportsLocking,
60
- const std::string &valueUnpackerCode)
61
- : runtimeMutex_(std::make_shared<std::recursive_mutex>()),
62
- runtime_(makeRuntime(
63
- rnRuntime,
64
- jsQueue,
65
- name,
66
- supportsLocking,
67
- runtimeMutex_)),
68
- #ifndef NDEBUG
69
- supportsLocking_(supportsLocking),
70
- #endif
71
- name_(name) {
72
- jsi::Runtime &rt = *runtime_;
73
- WorkletRuntimeCollector::install(rt);
74
- WorkletRuntimeDecorator::decorate(rt, name, jsScheduler);
75
-
76
- auto codeBuffer = std::make_shared<const jsi::StringBuffer>(
77
- "(" + valueUnpackerCode + "\n)");
78
- auto valueUnpacker = rt.evaluateJavaScript(codeBuffer, "valueUnpacker")
79
- .asObject(rt)
80
- .asFunction(rt);
81
- rt.global().setProperty(rt, "__valueUnpacker", valueUnpacker);
82
- }
83
-
84
- jsi::Value WorkletRuntime::executeSync(
85
- jsi::Runtime &rt,
86
- const jsi::Value &worklet) const {
87
- assert(
88
- supportsLocking_ &&
89
- ("[Reanimated] Runtime \"" + name_ + "\" doesn't support locking.")
90
- .c_str());
91
- auto shareableWorklet = extractShareableOrThrow<ShareableWorklet>(
92
- rt,
93
- worklet,
94
- "[Reanimated] Only worklets can be executed synchronously on UI runtime.");
95
- auto lock = std::unique_lock<std::recursive_mutex>(*runtimeMutex_);
96
- jsi::Runtime &uiRuntime = getJSIRuntime();
97
- auto result = runGuarded(shareableWorklet);
98
- auto shareableResult = extractShareableOrThrow(uiRuntime, result);
99
- lock.unlock();
100
- return shareableResult->toJSValue(rt);
101
- }
102
-
103
- jsi::Value WorkletRuntime::get(
104
- jsi::Runtime &rt,
105
- const jsi::PropNameID &propName) {
106
- auto name = propName.utf8(rt);
107
- if (name == "toString") {
108
- return jsi::Function::createFromHostFunction(
109
- rt,
110
- propName,
111
- 0,
112
- [weakThis = weak_from_this()](
113
- jsi::Runtime &rt, const jsi::Value &, const jsi::Value *, size_t)
114
- -> jsi::Value {
115
- auto strongThis = weakThis.lock();
116
- if (!strongThis) {
117
- return jsi::String::createFromUtf8(rt, "");
118
- }
119
-
120
- return jsi::String::createFromUtf8(rt, strongThis->toString());
121
- });
122
- }
123
- if (name == "name") {
124
- return jsi::String::createFromUtf8(rt, name_);
125
- }
126
- return jsi::Value::undefined();
127
- }
128
-
129
- std::vector<jsi::PropNameID> WorkletRuntime::getPropertyNames(
130
- jsi::Runtime &rt) {
131
- std::vector<jsi::PropNameID> result;
132
- result.push_back(jsi::PropNameID::forUtf8(rt, "toString"));
133
- result.push_back(jsi::PropNameID::forUtf8(rt, "name"));
134
- return result;
135
- }
136
-
137
- std::shared_ptr<WorkletRuntime> extractWorkletRuntime(
138
- jsi::Runtime &rt,
139
- const jsi::Value &value) {
140
- return value.getObject(rt).getHostObject<WorkletRuntime>(rt);
141
- }
142
-
143
- void scheduleOnRuntime(
144
- jsi::Runtime &rt,
145
- const jsi::Value &workletRuntimeValue,
146
- const jsi::Value &shareableWorkletValue) {
147
- auto workletRuntime = extractWorkletRuntime(rt, workletRuntimeValue);
148
- auto shareableWorklet = extractShareableOrThrow<ShareableWorklet>(
149
- rt,
150
- shareableWorkletValue,
151
- "[Reanimated] Function passed to `_scheduleOnRuntime` is not a shareable worklet. Please make sure that `processNestedWorklets` option in Reanimated Babel plugin is enabled.");
152
- workletRuntime->runAsyncGuarded(shareableWorklet);
153
- }
154
-
155
- } // namespace worklets
@@ -1,90 +0,0 @@
1
- #pragma once
2
-
3
- #include <cxxreact/MessageQueueThread.h>
4
- #include <jsi/jsi.h>
5
-
6
- #include <worklets/SharedItems/Shareables.h>
7
- #include <worklets/Tools/AsyncQueue.h>
8
- #include <worklets/Tools/JSScheduler.h>
9
-
10
- #include <memory>
11
- #include <string>
12
- #include <utility>
13
- #include <vector>
14
-
15
- using namespace facebook;
16
- using namespace react;
17
-
18
- namespace worklets {
19
-
20
- class WorkletRuntime : public jsi::HostObject,
21
- public std::enable_shared_from_this<WorkletRuntime> {
22
- public:
23
- explicit WorkletRuntime(
24
- jsi::Runtime &rnRuntime,
25
- const std::shared_ptr<MessageQueueThread> &jsQueue,
26
- const std::shared_ptr<JSScheduler> &jsScheduler,
27
- const std::string &name,
28
- const bool supportsLocking,
29
- const std::string &valueUnpackerCode);
30
-
31
- jsi::Runtime &getJSIRuntime() const {
32
- return *runtime_;
33
- }
34
-
35
- template <typename... Args>
36
- inline jsi::Value runGuarded(
37
- const std::shared_ptr<ShareableWorklet> &shareableWorklet,
38
- Args &&...args) const {
39
- jsi::Runtime &rt = *runtime_;
40
- return runOnRuntimeGuarded(
41
- rt, shareableWorklet->toJSValue(rt), std::forward<Args>(args)...);
42
- }
43
-
44
- void runAsyncGuarded(
45
- const std::shared_ptr<ShareableWorklet> &shareableWorklet) {
46
- if (queue_ == nullptr) {
47
- queue_ = std::make_shared<AsyncQueue>(name_);
48
- }
49
- queue_->push([=, weakThis = weak_from_this()] {
50
- auto strongThis = weakThis.lock();
51
- if (!strongThis) {
52
- return;
53
- }
54
-
55
- strongThis->runGuarded(shareableWorklet);
56
- });
57
- }
58
-
59
- jsi::Value executeSync(jsi::Runtime &rt, const jsi::Value &worklet) const;
60
-
61
- std::string toString() const {
62
- return "[WorkletRuntime \"" + name_ + "\"]";
63
- }
64
-
65
- jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override;
66
-
67
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
68
-
69
- private:
70
- const std::shared_ptr<std::recursive_mutex> runtimeMutex_;
71
- const std::shared_ptr<jsi::Runtime> runtime_;
72
- #ifndef NDEBUG
73
- const bool supportsLocking_;
74
- #endif
75
- const std::string name_;
76
- std::shared_ptr<AsyncQueue> queue_;
77
- };
78
-
79
- // This function needs to be non-inline to avoid problems with dynamic_cast on
80
- // Android
81
- std::shared_ptr<WorkletRuntime> extractWorkletRuntime(
82
- jsi::Runtime &rt,
83
- const jsi::Value &value);
84
-
85
- void scheduleOnRuntime(
86
- jsi::Runtime &rt,
87
- const jsi::Value &workletRuntimeValue,
88
- const jsi::Value &shareableWorkletValue);
89
-
90
- } // namespace worklets
@@ -1,36 +0,0 @@
1
- #pragma once
2
-
3
- #include <worklets/Registries/WorkletRuntimeRegistry.h>
4
-
5
- #include <jsi/jsi.h>
6
-
7
- #include <memory>
8
-
9
- namespace worklets {
10
-
11
- class WorkletRuntimeCollector : public jsi::HostObject {
12
- // When worklet runtime is created, we inject an instance of this class as a
13
- // `jsi::HostObject` into the global object. When worklet runtime is
14
- // terminated, the object is garbage-collected, which runs the C++ destructor.
15
- // In the destructor, we unregister the worklet runtime from the registry.
16
-
17
- public:
18
- explicit WorkletRuntimeCollector(jsi::Runtime &runtime) : runtime_(runtime) {
19
- WorkletRuntimeRegistry::registerRuntime(runtime_);
20
- }
21
-
22
- ~WorkletRuntimeCollector() {
23
- WorkletRuntimeRegistry::unregisterRuntime(runtime_);
24
- }
25
-
26
- static void install(jsi::Runtime &rt) {
27
- auto collector = std::make_shared<WorkletRuntimeCollector>(rt);
28
- auto object = jsi::Object::createFromHostObject(rt, collector);
29
- rt.global().setProperty(rt, "__workletRuntimeCollector", object);
30
- }
31
-
32
- private:
33
- jsi::Runtime &runtime_;
34
- };
35
-
36
- } // namespace worklets