@react-native-ohos/react-native-reanimated 4.0.2-beta.1 → 4.1.0-beta.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 (196) hide show
  1. package/CHANGELOG.md +1070 -0
  2. package/LICENSE +21 -0
  3. package/README.md +842 -0
  4. package/compatibility.json +20 -26
  5. package/harmony/reanimated/BuildProfile.ets +1 -1
  6. package/harmony/reanimated/index.ets +4 -2
  7. package/harmony/reanimated/oh-package-lock.json5 +1 -1
  8. package/harmony/reanimated/oh-package.json5 +1 -1
  9. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +23 -9
  10. package/harmony/reanimated/src/main/cpp/Common/NativeView/CMakeLists.txt +56 -0
  11. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/ComponentDescriptors.h +19 -0
  12. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryComponentDescriptor.h +30 -0
  13. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.cpp +15 -0
  14. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.h +41 -0
  15. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryState.h +30 -0
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -9
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -6
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +203 -150
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +1 -6
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +2 -7
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +0 -1
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +2 -18
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +11 -11
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +2 -6
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +4 -1
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -0
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +8 -0
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +27 -46
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +20 -20
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +2 -2
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +3 -3
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +10 -2
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +5 -3
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +20 -17
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +5 -8
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +33 -66
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +29 -22
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +14 -2
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +8 -2
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +50 -91
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +43 -18
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.cpp +63 -0
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.h +37 -0
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.cpp +100 -0
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.h +49 -0
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimation.h +13 -0
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimationFactory.h +32 -0
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpp +156 -0
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h +71 -0
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.cpp +141 -0
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h +104 -0
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp +97 -0
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.h +69 -0
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.cpp +89 -0
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.h +36 -0
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +12 -0
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +11 -2
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +3 -5
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +3 -3
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +1 -1
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +38 -37
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +3 -6
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +54 -32
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +5 -7
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +46 -46
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +8 -7
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +4 -57
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.cpp +23 -0
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +10 -8
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.cpp +77 -0
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h +38 -0
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +47 -68
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +21 -9
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +4 -1
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +35 -78
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +44 -13
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +13 -11
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +4 -0
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +7 -3
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +20 -27
  82. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +12 -9
  83. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
  84. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
  85. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +55 -46
  86. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +8 -5
  87. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +1 -2
  88. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +3 -2
  89. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +76 -71
  90. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +17 -14
  91. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +145 -273
  92. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +43 -44
  93. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +19 -19
  94. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +16 -12
  95. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +95 -114
  96. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +38 -25
  97. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +9 -34
  98. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +0 -10
  99. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.cpp +47 -0
  100. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.h +24 -0
  101. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.cpp +87 -0
  102. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.h +28 -0
  103. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.cpp +326 -0
  104. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.h +65 -0
  105. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.cpp +164 -0
  106. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.h +51 -0
  107. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +14 -66
  108. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +7 -18
  109. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.cpp +284 -0
  110. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.h +31 -0
  111. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +13 -132
  112. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +3 -21
  113. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/reversingShortening.h +43 -0
  114. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
  115. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.cpp +33 -0
  116. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.h +39 -0
  117. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +95 -0
  118. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +40 -0
  119. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +20 -23
  120. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
  121. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +26 -18
  122. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +4 -8
  123. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +16 -28
  124. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -4
  125. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -24
  126. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +17 -7
  127. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.cpp +152 -0
  128. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.h +86 -0
  129. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/PropsLayoutFilter.h +98 -0
  130. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +162 -28
  131. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +69 -11
  132. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +41 -17
  133. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +14 -3
  134. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/propNameFromString.h +130 -0
  135. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +1 -0
  136. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +5 -7
  137. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +7 -4
  138. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +52 -9
  139. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +174 -62
  140. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +12 -11
  141. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +251 -128
  142. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +23 -19
  143. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +34 -6
  144. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +71 -64
  145. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +938 -700
  146. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +123 -76
  147. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.cpp +313 -0
  148. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.h +18 -0
  149. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoSelector.h +41 -0
  150. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.cpp +113 -0
  151. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.h +73 -0
  152. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +4 -4
  153. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +23 -48
  154. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +13 -14
  155. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +20 -3
  156. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReaJSIUtils.h +227 -0
  157. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +51 -14
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.h +2 -5
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/SingleInstanceChecker.h +76 -0
  160. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.cpp +353 -0
  161. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.h +95 -0
  162. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.cpp +140 -0
  163. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.h +52 -0
  164. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.cpp +45 -0
  165. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.h +33 -0
  166. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryJSIBinder.h +20 -0
  167. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +112 -19
  168. package/harmony/reanimated/src/main/cpp/ReanimatedModule.h +4 -2
  169. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -1
  170. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.h +1 -1
  171. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +24 -1
  172. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.h +7 -2
  173. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +88 -57
  174. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +4 -2
  175. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +1 -1
  176. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +1 -1
  177. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.cpp +9 -7
  178. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +6 -5
  179. package/harmony/reanimated/src/main/cpp/TransformParser.h +1 -1
  180. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/EventEmitters.h +19 -0
  181. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/Props.h +31 -0
  182. package/harmony/reanimated/src/main/ets/KeyboardState.ts +11 -0
  183. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +119 -19
  184. package/harmony/reanimated/src/main/ets/{ReanimatedPackage.ts → ReanimatedPackage.ets} +4 -3
  185. package/harmony/reanimated.har +0 -0
  186. package/package.json +52 -24
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +0 -145
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +0 -47
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +0 -93
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +0 -36
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +0 -75
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +0 -45
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +0 -183
  194. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +0 -93
  195. package/harmony/reanimated/src/main/ets/AnimationManager.ts +0 -61
  196. /package/harmony/reanimated/{ts.ts → ts.ets} +0 -0
@@ -1,9 +1,12 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
5
  #include "ReanimatedSensor.h"
6
6
  #include "glog/logging.h"
7
+ #include <algorithm>
8
+ #include <cmath>
9
+ #include <string>
7
10
  #include <sensors/oh_sensor.h>
8
11
  #include <window_manager/oh_display_info.h>
9
12
  #include <window_manager/oh_display_manager.h>
@@ -52,52 +55,54 @@ void SensorDataCallbackImpl(Sensor_Event *event) {
52
55
  }
53
56
 
54
57
  switch (sensorType) {
55
- case SENSOR_TYPE_ACCELEROMETER: {
56
- double sendData[] = {
57
- data[0],
58
- data[1],
59
- data[2],
60
- };
61
- sensorInstance->runSensor(sendData);
62
- return;
63
- }
64
- case SENSOR_TYPE_GYROSCOPE: {
65
- double sendData[] = {
58
+ case SENSOR_TYPE_GYROSCOPE:
59
+ case SENSOR_TYPE_MAGNETIC_FIELD: {
60
+ std::array<double, 7> sendData = {
66
61
  data[0],
67
62
  data[1],
68
63
  data[2],
64
+ 0,
65
+ 0,
66
+ 0,
67
+ 0,
69
68
  };
70
69
  sensorInstance->runSensor(sendData);
71
70
  return;
72
71
  }
72
+ case SENSOR_TYPE_ACCELEROMETER:
73
+ case SENSOR_TYPE_LINEAR_ACCELERATION:
73
74
  case SENSOR_TYPE_GRAVITY: {
74
- double sendData[] = {
75
- data[0],
76
- data[1],
77
- data[2],
78
- };
79
- sensorInstance->runSensor(sendData);
80
- return;
81
- }
82
- case SENSOR_TYPE_MAGNETIC_FIELD: {
83
- double sendData[] = {
84
- data[0],
85
- data[1],
86
- data[2],
75
+ std::array<double, 7> sendData = {
76
+ -data[0],
77
+ -data[1],
78
+ -data[2],
79
+ 0,
80
+ 0,
81
+ 0,
82
+ 0,
87
83
  };
88
84
  sensorInstance->runSensor(sendData);
89
85
  return;
90
86
  }
91
87
  case SENSOR_TYPE_ROTATION_VECTOR: {
92
- double sendData[] = {
93
- data[0], // x
94
- data[1], // y
95
- data[2], // z
96
- data[3], // w
97
- // ios
98
- 0, // yaw
99
- 0, // pitch
100
- 0 // roll
88
+ double qx = data[0], qy = data[1], qz = data[2];
89
+ double qw = (length >= 4)
90
+ ? data[3]
91
+ : std::sqrt(std::max(0.0, 1.0 - qx * qx - qy * qy - qz * qz));
92
+ double xx = qx * qx, yy = qy * qy, zz = qz * qz;
93
+ double xy = qx * qy, xz = qx * qz, yz = qy * qz;
94
+ double wx = qw * qx, wy = qw * qy, wz = qw * qz;
95
+ double azimuth = std::atan2(2 * (xy - wz), 1 - 2 * (xx + zz));
96
+ double pitch = std::asin(std::clamp(-2 * (yz + wx), -1.0, 1.0));
97
+ double roll = std::atan2(-2 * (xz - wy), 1 - 2 * (xx + yy));
98
+ std::array<double, 7> sendData = {
99
+ qx, // qx
100
+ qz, // qy槽位放qz,对齐iOS参考系(同Android ReanimatedSensorListener.kt)
101
+ -qy, // qz槽位放-qy
102
+ qw, // qw
103
+ -azimuth, // yaw
104
+ -pitch, // pitch
105
+ roll // roll
101
106
  };
102
107
  sensorInstance->runSensor(sendData);
103
108
  return;
@@ -117,9 +122,10 @@ rnoh::ReanimatedSensor::ReanimatedSensor(int sensorType, int interval, int iosRe
117
122
  uint32_t refreshRate = 0;
118
123
  OH_NativeDisplayManager_GetDefaultDisplayRefreshRate(&refreshRate);
119
124
  if (refreshRate > 0) {
120
- interval_ = refreshRate * 1000000; // 120hz;
125
+ // 采样周期 = 1/刷新率,换算为纳秒(iOS侧为 1/maximumFramesPerSecond 秒)
126
+ interval_ = 1000000000 / refreshRate;
121
127
  } else {
122
- interval_ = 200000000;
128
+ interval_ = 16666667; // 查询失败时按60Hz周期兜底
123
129
  }
124
130
  } else {
125
131
  // js unit is milliseconds
@@ -131,7 +137,7 @@ rnoh::ReanimatedSensor::ReanimatedSensor(int sensorType, int interval, int iosRe
131
137
 
132
138
  void rnoh::ReanimatedSensor::castSensorType(int sensorType) {
133
139
  if (sensorType == 1) {
134
- sensorType_ = SENSOR_TYPE_ACCELEROMETER;
140
+ sensorType_ = SENSOR_TYPE_LINEAR_ACCELERATION;
135
141
  } else if (sensorType == 2) {
136
142
  sensorType_ = SENSOR_TYPE_GYROSCOPE;
137
143
  } else if (sensorType == 3) {
@@ -141,34 +147,44 @@ void rnoh::ReanimatedSensor::castSensorType(int sensorType) {
141
147
  } else if (sensorType == 5) {
142
148
  sensorType_ = SENSOR_TYPE_ROTATION_VECTOR;
143
149
  } else {
144
- throw std::invalid_argument("[ReanimatedSensor] Unknown sensorType: " + sensorType);
150
+ throw std::invalid_argument("[ReanimatedSensor] Unknown sensorType: " + std::to_string(sensorType));
145
151
  }
146
152
  }
147
153
 
148
154
  bool rnoh::ReanimatedSensor::initialize() {
149
155
  if (!isSupportSensor()) {
150
- LOG(ERROR) << "[ReanimatedSensor] is not support, sensorType:" << sensorType_;
151
- return false;
156
+ if (sensorType_ == SENSOR_TYPE_LINEAR_ACCELERATION) {
157
+ DLOG(WARNING) << "[ReanimatedSensor] linear acceleration not supported, fallback to accelerometer";
158
+ sensorType_ = SENSOR_TYPE_ACCELEROMETER;
159
+ }
160
+ if (!isSupportSensor()) {
161
+ DLOG(ERROR) << "[ReanimatedSensor] is not support, sensorType:" << sensorType_;
162
+ return false;
163
+ }
152
164
  }
153
165
  id_ = OH_Sensor_CreateSubscriptionId();
154
166
  if (id_ == nullptr) {
155
- LOG(ERROR) << "[ReanimatedSensor] create sensor id failed";
167
+ DLOG(ERROR) << "[ReanimatedSensor] create sensor id failed";
156
168
  return false;
157
169
  }
158
170
  int32_t res = OH_SensorSubscriptionId_SetType(id_, sensorType_);
159
171
  if (res != SENSOR_SUCCESS) {
160
- LOG(ERROR) << "[ReanimatedSensor] set sensor type failed ,sensorType:" << sensorType_;
172
+ OH_Sensor_DestroySubscriptionId(id_);
173
+ id_ = nullptr;
174
+ DLOG(ERROR) << "[ReanimatedSensor] set sensor type failed ,sensorType:" << sensorType_;
161
175
  return false;
162
176
  }
163
- auto attr = OH_Sensor_CreateSubscriptionAttribute();
164
- if (attr == nullptr) {
165
- LOG(ERROR) << "[ReanimatedSensor] create sensor attribute failed";
177
+ attr_ = OH_Sensor_CreateSubscriptionAttribute();
178
+ if (attr_ == nullptr) {
179
+ DLOG(ERROR) << "[ReanimatedSensor] create sensor attribute failed";
166
180
  return false;
167
181
  }
168
182
 
169
- res = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr, interval_);
183
+ res = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr_, interval_);
170
184
  if (res != SENSOR_SUCCESS) {
171
- LOG(ERROR) << "[ReanimatedSensor] set sensor Interval failed, interval_:" << interval_;
185
+ OH_Sensor_DestroySubscriptionAttribute(attr_);
186
+ attr_ = nullptr;
187
+ DLOG(ERROR) << "[ReanimatedSensor] set sensor Interval failed, interval_:" << interval_;
172
188
  return false;
173
189
  }
174
190
 
@@ -181,12 +197,16 @@ bool rnoh::ReanimatedSensor::initialize() {
181
197
 
182
198
  int32_t ret = OH_SensorSubscriber_SetCallback(subSensor_, SensorDataCallbackImpl);
183
199
  if (ret != SENSOR_SUCCESS) {
184
- LOG(ERROR) << "[ReanimatedSensor] set sensor callback failed";
200
+ OH_Sensor_DestroySubscriptionAttribute(attr_);
201
+ attr_ = nullptr;
202
+ DLOG(ERROR) << "[ReanimatedSensor] set sensor callback failed";
185
203
  return false;
186
204
  }
187
- Sensor_Result sensorRes = OH_Sensor_Subscribe(id_, attr, subSensor_);
205
+ Sensor_Result sensorRes = OH_Sensor_Subscribe(id_, attr_, subSensor_);
188
206
  if (sensorRes != SENSOR_SUCCESS) {
189
- LOG(ERROR) << "[ReanimatedSensor] on sensor subscribe failed";
207
+ OH_Sensor_DestroySubscriptionAttribute(attr_);
208
+ attr_ = nullptr;
209
+ DLOG(ERROR) << "[ReanimatedSensor] on sensor subscribe failed";
190
210
  return false;
191
211
  }
192
212
  return true;
@@ -214,14 +234,14 @@ bool rnoh::ReanimatedSensor::isSupportSensor() {
214
234
  return isSupport;
215
235
  }
216
236
 
217
- void rnoh::ReanimatedSensor::runSensor(double *value) {
218
- if (value && setter_ && runOnTheMainThread_) {
219
- runOnTheMainThread_([weakSelf = weak_from_this(), value]() {
237
+ void rnoh::ReanimatedSensor::runSensor(std::array<double, 7> value) {
238
+ if (setter_ && runOnTheMainThread_) {
239
+ runOnTheMainThread_([weakSelf = weak_from_this(), value = std::move(value)]() mutable {
220
240
  auto self = weakSelf.lock();
221
241
  if (!self) {
222
242
  return;
223
243
  }
224
- self->setter_(value, self->getInterfaceOrientation());
244
+ self->setter_(value.data(), self->getInterfaceOrientation());
225
245
  });
226
246
  }
227
247
  }
@@ -251,9 +271,20 @@ void rnoh::ReanimatedSensor::destroySensor() {
251
271
  std::lock_guard<std::mutex> lock(g_subscriberMapMutex_);
252
272
  for (auto it = g_sensorSubscriberMap_.begin(); it != g_sensorSubscriberMap_.end();) {
253
273
  if (it->second == this) {
254
- OH_Sensor_Unsubscribe(it->second->id_, it->second->subSensor_);
255
- OH_Sensor_DestroySubscriptionId(it->second->id_);
256
- OH_Sensor_DestroySubscriber(it->second->subSensor_);
274
+ if (it->second->id_ && it->second->subSensor_) {
275
+ OH_Sensor_Unsubscribe(it->second->id_, it->second->subSensor_);
276
+ }
277
+ if (it->second->id_ ) {
278
+ OH_Sensor_DestroySubscriptionId(it->second->id_);
279
+ }
280
+ if (it->second->subSensor_) {
281
+ OH_Sensor_DestroySubscriber(it->second->subSensor_);
282
+ }
283
+ if (it->second->attr_) {
284
+ OH_Sensor_DestroySubscriptionAttribute(it->second->attr_);
285
+ }
286
+ it->second->id_ = nullptr;
287
+ it->second->attr_ = nullptr;
257
288
  it->second->subSensor_ = nullptr;
258
289
  it = g_sensorSubscriberMap_.erase(it);
259
290
  } else {
@@ -1,9 +1,10 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
5
  #ifndef HARMONY_REANIMATEDSENSOR_H
6
6
  #define HARMONY_REANIMATEDSENSOR_H
7
+ #include <array>
7
8
  #include <functional>
8
9
  #include <mutex>
9
10
  #include <sensors/oh_sensor_type.h>
@@ -18,7 +19,7 @@ public:
18
19
  bool initialize();
19
20
  void cancel();
20
21
  void castSensorType(int sensorType);
21
- void runSensor(double *value);
22
+ void runSensor(std::array<double, 7> value);
22
23
  std::function<void(double[], int)> setter_;
23
24
  Sensor_Type sensorType_{SENSOR_TYPE_ACCELEROMETER};
24
25
 
@@ -30,6 +31,7 @@ private:
30
31
  int iosReferenceFrame_{-1};
31
32
  Sensor_Subscriber *subSensor_{nullptr};
32
33
  Sensor_SubscriptionId *id_{nullptr};
34
+ Sensor_SubscriptionAttribute *attr_{nullptr};
33
35
  std::function<void(TaskExecutor::Task &&)> runOnTheMainThread_;
34
36
  };
35
37
  } // namespace rnoh
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
@@ -13,11 +13,13 @@ void ReanimatedUIScheduler::scheduleOnUI(std::function<void()> job)
13
13
  job();
14
14
  return;
15
15
  }
16
-
17
- m_taskExecutor->runTask(TaskThread::MAIN, [weakSelf = weak_from_this(), job = std::move(job)]() {
18
- if (auto self = weakSelf.lock()) {
19
- job();
20
- }
21
- });
16
+ UIScheduler::scheduleOnUI(job);
17
+ if (!scheduledOnUI_.exchange(true)) {
18
+ m_taskExecutor->runTask(TaskThread::MAIN, [weakSelf = weak_from_this()]() {
19
+ if (auto self = weakSelf.lock()) {
20
+ self->triggerUI();
21
+ }
22
+ });
23
+ }
22
24
  }
23
25
  } // namespace rnoh
@@ -1,20 +1,21 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
5
  #pragma once
6
6
  #include <functional>
7
- //#include <UIScheduler.h>
8
7
  #include <memory>
9
8
  #include "RNOH/TaskExecutor/TaskExecutor.h"
9
+ #include "worklets/Tools/UIScheduler.h"
10
10
 
11
11
  namespace rnoh {
12
- class ReanimatedUIScheduler : public std::enable_shared_from_this<ReanimatedUIScheduler> { //, public worklets::UIScheduler
12
+ class ReanimatedUIScheduler : public std::enable_shared_from_this<ReanimatedUIScheduler>,
13
+ public worklets::UIScheduler {
13
14
  private:
14
15
  std::shared_ptr<TaskExecutor> m_taskExecutor;
15
16
 
16
17
  public:
17
18
  ReanimatedUIScheduler(std::shared_ptr<TaskExecutor> taskExecutor);
18
- void scheduleOnUI(std::function<void()> job) ; //override
19
+ void scheduleOnUI(std::function<void()> job) override;
19
20
  };
20
- } // namespace rnoh
21
+ } // namespace rnoh
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
@@ -0,0 +1,19 @@
1
+ #pragma once
2
+
3
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
4
+ // Use of this source code is governed by a MIT license that can be
5
+ // found in the LICENSE file.
6
+
7
+ #include <react/renderer/components/view/ViewEventEmitter.h>
8
+
9
+ namespace facebook {
10
+ namespace react {
11
+
12
+ class REASharedTransitionBoundaryEventEmitter final
13
+ : public ViewEventEmitter {
14
+ public:
15
+ using ViewEventEmitter::ViewEventEmitter;
16
+ };
17
+
18
+ } // namespace react
19
+ } // namespace facebook
@@ -0,0 +1,31 @@
1
+ #pragma once
2
+
3
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
4
+ // Use of this source code is governed by a MIT license that can be
5
+ // found in the LICENSE file.
6
+
7
+ #include <react/renderer/components/view/ViewProps.h>
8
+ #include <react/renderer/core/PropsParserContext.h>
9
+ #include <react/renderer/core/RawProps.h>
10
+ #include <react/renderer/core/propsConversions.h>
11
+
12
+ namespace facebook {
13
+ namespace react {
14
+
15
+ class REASharedTransitionBoundaryProps final : public ViewProps {
16
+ public:
17
+ REASharedTransitionBoundaryProps() = default;
18
+
19
+ REASharedTransitionBoundaryProps(
20
+ const PropsParserContext &context,
21
+ const REASharedTransitionBoundaryProps &sourceProps,
22
+ const RawProps &rawProps)
23
+ : ViewProps(context, sourceProps, rawProps) {
24
+ isActive = convertRawProp(context, rawProps, "isActive", sourceProps.isActive, false);
25
+ }
26
+
27
+ bool isActive{false};
28
+ };
29
+
30
+ } // namespace react
31
+ } // namespace facebook
@@ -0,0 +1,11 @@
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a MIT license that can be
3
+ // found in the LICENSE file.
4
+
5
+ export enum KeyboardState {
6
+ UNKNOWN = 0,
7
+ OPENING = 1,
8
+ OPEN = 2,
9
+ CLOSING = 3,
10
+ CLOSED = 4,
11
+ }
@@ -1,17 +1,19 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import { RNOHLogger, Tag, UITurboModule, UITurboModuleContext } from "@rnoh/react-native-openharmony/ts";
6
- import { window } from '@kit.ArkUI';
7
- import { AnimationManager } from './AnimationManager'
8
- import settings from '@ohos.settings';
9
- import { } from "@ohos.display"
6
+ import { Animator, AnimatorResult, window } from '@kit.ArkUI';
7
+ import { KeyboardState } from "./KeyboardState";
8
+ import deviceInfo from '@ohos.deviceInfo';
9
+ import { accessibility } from '@kit.AccessibilityKit';
10
10
 
11
11
  export class ReanimatedModule extends UITurboModule {
12
12
  static NAME = "ReanimatedModule"
13
13
  private logger: RNOHLogger
14
14
  private keyBordHeight = 0;
15
+ private currentAnimator: AnimatorResult | null = null;
16
+ private currentAnimatedHeight = 0;
15
17
 
16
18
  constructor(ctx: UITurboModuleContext) {
17
19
  super(ctx);
@@ -20,27 +22,99 @@ export class ReanimatedModule extends UITurboModule {
20
22
 
21
23
  public setViewProps(tag: Tag, props: Object) {
22
24
  this.ctx.descriptorRegistry.setAnimatedRawProps(tag, props);
23
-
24
25
  }
25
26
 
26
- public async subscribeKeyBordListeners() {
27
- const windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
27
+ public async subscribeKeyBordListeners(isStatusBarTranslucent: boolean, isNavigationBarTranslucent: boolean) {
28
+ //ignore isStatusBarTranslucent - those are Android only
29
+ let windowInstance: window.Window;
30
+ try {
31
+ windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
32
+ } catch (e: ESObject) {
33
+ this.logger.error(`subscribeKeyBordListeners failed: ${e?.message ?? e}`);
34
+ return;
35
+ }
36
+ const navIndicatorArea = windowInstance.getWindowAvoidArea(
37
+ window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR
38
+ );
39
+ const navIndicatorHeight = this.ctx.getUIContext().px2vp(
40
+ navIndicatorArea.bottomRect.height
41
+ );
42
+
43
+ const isEdgeToEdge = this.isEdgeToEdgeMode(windowInstance);
44
+ const effectiveNavBarTranslucent = isEdgeToEdge && isNavigationBarTranslucent;
45
+
28
46
  windowInstance.on('keyboardHeightChange', async (height) => {
29
- let keyBordHeight = this.ctx.getUIContext().px2vp(height);
30
- const animationManager = new AnimationManager();
31
- animationManager.setUpdateCallback((value, status) => {
47
+ let rawKeyboardHeight = this.ctx.getUIContext().px2vp(height);
48
+ //If the immersive mode is not enabled, then the area around the bottom navigation bar that needs to be avoided needs to be removed.
49
+ //If the immersive mode is enabled, the returned value will be the height of the current keyboard.
50
+ let keyBordHeight = effectiveNavBarTranslucent
51
+ ? rawKeyboardHeight
52
+ : Math.max(0, rawKeyboardHeight - navIndicatorHeight);
53
+
54
+ //Unchanged height, skip handle
55
+ if (Math.abs(keyBordHeight - this.currentAnimatedHeight) < 0.01) {
56
+ return;
57
+ }
58
+
59
+ const isOpening = keyBordHeight > this.keyBordHeight;
60
+
61
+ if (this.currentAnimator) {
62
+ this.currentAnimator.onFrame = null;
63
+ this.currentAnimator.onFinish = null;
64
+ this.currentAnimator.cancel();
65
+ this.currentAnimator = null;
66
+ }
67
+
68
+ this.currentAnimator = Animator.create({
69
+ duration: isOpening ? 480 : 350,
70
+ delay: 0,
71
+ //simulate the keyboard pop-up and retraction animations in harmony
72
+ easing: isOpening ? "cubic-bezier(0.2, 0.0, 0.1, 1.0)"
73
+ : "cubic-bezier(0.0, 0.0, 0.1, 1.0)",
74
+ fill: "forwards",
75
+ direction: "normal",
76
+ iterations: 1,
77
+ begin: this.currentAnimatedHeight,
78
+ end: keyBordHeight
79
+ }
80
+ )
81
+ this.currentAnimator.onFrame = (progress: number) => {
82
+ this.currentAnimatedHeight = progress;
83
+ if (Math.abs(progress - keyBordHeight) < 0.01) { //The final instruction is sent by "onFinish".
84
+ return;
85
+ }
86
+ let status = keyBordHeight > this.keyBordHeight ? KeyboardState.OPENING : KeyboardState.CLOSING;
32
87
  this.ctx.rnInstance.postMessageToCpp("REANIMATED_KEY_BOARD_CHANGE",
33
- { keyboardHeight: value, status: status.valueOf() });
34
- });
35
- animationManager.startAnimation(this.keyBordHeight, keyBordHeight, 200);
36
- this.keyBordHeight = keyBordHeight;
88
+ { keyboardHeight: progress, status: status.valueOf() });
89
+ }
90
+ this.currentAnimator.onFinish = () => {
91
+ this.currentAnimatedHeight = keyBordHeight;
92
+ let status = keyBordHeight > this.keyBordHeight ? KeyboardState.OPEN : KeyboardState.CLOSED;
93
+ this.keyBordHeight = keyBordHeight;
94
+ this.ctx.rnInstance.postMessageToCpp("REANIMATED_KEY_BOARD_CHANGE",
95
+ { keyboardHeight: keyBordHeight, status: status.valueOf() });
96
+ }
97
+ this.currentAnimator.play();
37
98
  })
38
99
  }
39
100
 
40
101
  public async unsubscribeKeyBordListeners() {
41
- const windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
42
- windowInstance.off('keyboardHeightChange', (v) => {
43
- })
102
+ let windowInstance: window.Window;
103
+ try {
104
+ windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
105
+ } catch (e: ESObject) {
106
+ this.logger.error(`unsubscribeKeyBordListeners failed: ${e?.message ?? e}`);
107
+ return;
108
+ }
109
+ windowInstance.off('keyboardHeightChange')
110
+ if (this.currentAnimator) {
111
+ this.currentAnimator.onFrame = null;
112
+ this.currentAnimator.onFinish = null;
113
+ this.currentAnimator.cancel();
114
+ this.currentAnimator = null;
115
+ }
116
+ this.keyBordHeight = 0;
117
+ this.currentAnimatedHeight = 0;
44
118
  }
45
119
 
46
120
  public setGestureHandlerState(handlerTag: Tag, newState: number) {
@@ -49,4 +123,30 @@ export class ReanimatedModule extends UITurboModule {
49
123
  module.setGestureHandlerState(handlerTag, newState);
50
124
  }
51
125
  }
52
- }
126
+
127
+ private isEdgeToEdgeMode(windowInstance: window.Window) {
128
+ let isLayoutFullScreen = false;
129
+ try {
130
+ const windowProperties = windowInstance.getWindowProperties();
131
+ isLayoutFullScreen = windowProperties.isLayoutFullScreen;
132
+ } catch (e: ESObject) {
133
+ isLayoutFullScreen = false;
134
+ }
135
+ return isLayoutFullScreen;
136
+ }
137
+
138
+ public isReducedMotionEnabled(): boolean {
139
+ try {
140
+ if (deviceInfo.sdkApiVersion >= 23) {
141
+ return (accessibility as ESObject).isAnimationReduceEnabledSync();
142
+ }
143
+ } catch (e) {
144
+ this.logger.warn(`isReducedMotionEnabled failed: ${JSON.stringify(e)}`);
145
+ }
146
+ return false;
147
+ }
148
+
149
+ __onDestroy__(): void {
150
+ this.unsubscribeKeyBordListeners();
151
+ }
152
+ }
@@ -1,10 +1,11 @@
1
- // Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
2
  // Use of this source code is governed by a MIT license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import { RNPackage, UITurboModuleContext, TurboModulesFactory } from "@rnoh/react-native-openharmony/ts";
5
+ import { UITurboModuleContext, TurboModulesFactory } from "@rnoh/react-native-openharmony/ts";
6
6
  import type { UITurboModule } from "@rnoh/react-native-openharmony/ts";
7
7
  import { ReanimatedModule } from './ReanimatedModule';
8
+ import { RNOHPackage } from '@rnoh/react-native-openharmony'
8
9
 
9
10
  class ReanimatedTurboModulesFactory extends TurboModulesFactory {
10
11
  createTurboModule(name: string): UITurboModule | null {
@@ -19,7 +20,7 @@ class ReanimatedTurboModulesFactory extends TurboModulesFactory {
19
20
  }
20
21
  }
21
22
 
22
- export class ReanimatedPackage extends RNPackage {
23
+ export class ReanimatedPackage extends RNOHPackage {
23
24
  createTurboModulesFactory(ctx: UITurboModuleContext): TurboModulesFactory {
24
25
  return new ReanimatedTurboModulesFactory(ctx);
25
26
  }
Binary file