react-native-reanimated 2.4.1 → 2.7.0

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 (387) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +72 -0
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +30 -1
  3. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +64 -39
  4. package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
  5. package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -14
  6. package/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +41 -0
  7. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +14 -0
  8. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +14 -0
  9. package/Common/cpp/headers/SharedItems/MutableValue.h +4 -1
  10. package/Common/cpp/headers/SharedItems/ShareableValue.h +3 -0
  11. package/Common/cpp/headers/SharedItems/ValueWrapper.h +3 -0
  12. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +11 -0
  13. package/Common/cpp/headers/Tools/RuntimeDecorator.h +2 -0
  14. package/README.md +2 -2
  15. package/RNReanimated.podspec +15 -6
  16. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  17. package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
  18. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  19. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  20. package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
  21. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  22. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  23. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  24. package/android/.gradle/7.2/gc.properties +0 -0
  25. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  26. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  27. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  28. package/android/.gradle/checksums/checksums.lock +0 -0
  29. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  30. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  31. package/android/.gradle/vcs-1/gc.properties +0 -0
  32. package/android/CMakeLists.txt +198 -0
  33. package/android/README.md +15 -0
  34. package/android/build.gradle +676 -73
  35. package/android/empty.cpp +1 -0
  36. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  37. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  38. package/android/gradle.properties +25 -0
  39. package/android/gradlew +234 -0
  40. package/android/gradlew.bat +89 -0
  41. package/android/react-native-reanimated-64-hermes.aar +0 -0
  42. package/android/react-native-reanimated-64-jsc.aar +0 -0
  43. package/android/react-native-reanimated-65-hermes.aar +0 -0
  44. package/android/react-native-reanimated-65-jsc.aar +0 -0
  45. package/android/react-native-reanimated-66-hermes.aar +0 -0
  46. package/android/react-native-reanimated-66-jsc.aar +0 -0
  47. package/android/react-native-reanimated-67-hermes.aar +0 -0
  48. package/android/react-native-reanimated-67-jsc.aar +0 -0
  49. package/android/react-native-reanimated-68-hermes.aar +0 -0
  50. package/android/react-native-reanimated-68-jsc.aar +0 -0
  51. package/android/rnVersionPatch/62/layoutReanimation/ReanimatedNativeHierarchyManager.java +412 -0
  52. package/android/rnVersionPatch/62/layoutReanimation/ReanimatedUIImplementation.java +68 -0
  53. package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +68 -0
  54. package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +68 -0
  55. package/android/rnVersionPatch/65/.gitkeep +0 -0
  56. package/android/rnVersionPatch/66/.gitkeep +0 -0
  57. package/android/rnVersionPatch/67/.gitkeep +0 -0
  58. package/android/rnVersionPatch/68/.gitkeep +0 -0
  59. package/android/rnVersionPatch/backup/.gitkeep +0 -0
  60. package/android/settings.gradle +1 -0
  61. package/android/spotless.gradle +9 -0
  62. package/android/src/{AndroidManifest.xml → main/AndroidManifest.xml} +0 -0
  63. package/android/src/main/cpp/AndroidErrorHandler.cpp +42 -0
  64. package/android/src/main/cpp/AndroidLogger.cpp +27 -0
  65. package/android/src/main/cpp/AndroidScheduler.cpp +59 -0
  66. package/android/src/main/cpp/JNIHelper.cpp +59 -0
  67. package/android/src/main/cpp/LayoutAnimations.cpp +103 -0
  68. package/android/src/main/cpp/NativeProxy.cpp +327 -0
  69. package/android/src/main/cpp/OnLoad.cpp +17 -0
  70. package/android/src/main/cpp/TurboModule.cpp +44 -0
  71. package/android/src/main/cpp/headers/AndroidErrorHandler.h +30 -0
  72. package/android/src/main/cpp/headers/AndroidLogger.h +16 -0
  73. package/android/src/main/cpp/headers/AndroidScheduler.h +41 -0
  74. package/android/src/main/cpp/headers/JNIHelper.h +30 -0
  75. package/android/src/main/cpp/headers/LayoutAnimations.h +42 -0
  76. package/android/src/main/cpp/headers/NativeProxy.h +170 -0
  77. package/android/src/main/cpp/headers/TurboModule.h +70 -0
  78. package/android/src/main/java/com/facebook/react/uimanager/UIManagerReanimatedHelper.java +15 -0
  79. package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.java +5 -0
  80. package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +8 -0
  81. package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +43 -0
  82. package/android/src/main/java/com/swmansion/reanimated/MapUtils.java +26 -0
  83. package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +117 -0
  84. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +288 -0
  85. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +682 -0
  86. package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +29 -0
  87. package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +251 -0
  88. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +96 -0
  89. package/android/src/main/java/com/swmansion/reanimated/Scheduler.java +51 -0
  90. package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +11 -0
  91. package/android/src/main/java/com/swmansion/reanimated/Utils.java +32 -0
  92. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +524 -0
  93. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +56 -0
  94. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +11 -0
  95. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +410 -0
  96. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +68 -0
  97. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +292 -0
  98. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +121 -0
  99. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +12 -0
  100. package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +29 -0
  101. package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +87 -0
  102. package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +24 -0
  103. package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +49 -0
  104. package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +38 -0
  105. package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +73 -0
  106. package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +36 -0
  107. package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +41 -0
  108. package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +33 -0
  109. package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +83 -0
  110. package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +5 -0
  111. package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +20 -0
  112. package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +41 -0
  113. package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +139 -0
  114. package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +37 -0
  115. package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +377 -0
  116. package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +71 -0
  117. package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +153 -0
  118. package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +32 -0
  119. package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +40 -0
  120. package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +84 -0
  121. package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +40 -0
  122. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +41 -0
  123. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +40 -0
  124. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -0
  125. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +35 -0
  126. package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +84 -0
  127. package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +25 -0
  128. package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +86 -0
  129. package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +41 -0
  130. package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +161 -0
  131. package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
  132. package/ios/LayoutReanimation/REAAnimationsManager.m +16 -6
  133. package/ios/LayoutReanimation/REASnapshot.m +1 -1
  134. package/ios/LayoutReanimation/REAUIManager.h +1 -1
  135. package/ios/LayoutReanimation/REAUIManager.mm +4 -5
  136. package/ios/Nodes/REAAlwaysNode.h +1 -1
  137. package/ios/Nodes/REAAlwaysNode.m +5 -5
  138. package/ios/Nodes/REABezierNode.h +1 -1
  139. package/ios/Nodes/REABezierNode.m +4 -5
  140. package/ios/Nodes/REABlockNode.h +1 -1
  141. package/ios/Nodes/REABlockNode.m +2 -2
  142. package/ios/Nodes/REACallFuncNode.h +1 -1
  143. package/ios/Nodes/REACallFuncNode.m +5 -5
  144. package/ios/Nodes/REAClockNodes.h +1 -1
  145. package/ios/Nodes/REAClockNodes.m +4 -4
  146. package/ios/Nodes/REAConcatNode.h +1 -1
  147. package/ios/Nodes/REAConcatNode.m +3 -3
  148. package/ios/Nodes/REACondNode.h +1 -1
  149. package/ios/Nodes/REACondNode.m +3 -3
  150. package/ios/Nodes/READebugNode.h +1 -1
  151. package/ios/Nodes/READebugNode.m +3 -3
  152. package/ios/Nodes/REAEventNode.h +1 -2
  153. package/ios/Nodes/REAEventNode.m +3 -3
  154. package/ios/Nodes/REAFunctionNode.h +1 -1
  155. package/ios/Nodes/REAFunctionNode.m +3 -3
  156. package/ios/Nodes/REAJSCallNode.h +1 -1
  157. package/ios/Nodes/REAJSCallNode.m +3 -3
  158. package/ios/Nodes/REANode.m +2 -2
  159. package/ios/Nodes/REAOperatorNode.h +1 -1
  160. package/ios/Nodes/REAOperatorNode.m +2 -3
  161. package/ios/Nodes/REAParamNode.h +1 -1
  162. package/ios/Nodes/REAParamNode.m +4 -4
  163. package/ios/Nodes/REAPropsNode.h +1 -1
  164. package/ios/Nodes/REAPropsNode.m +4 -6
  165. package/ios/Nodes/REASetNode.h +1 -1
  166. package/ios/Nodes/REASetNode.m +4 -4
  167. package/ios/Nodes/REAStyleNode.h +1 -1
  168. package/ios/Nodes/REAStyleNode.m +2 -3
  169. package/ios/Nodes/REATransformNode.h +1 -1
  170. package/ios/Nodes/REATransformNode.m +2 -2
  171. package/ios/Nodes/REAValueNode.h +1 -3
  172. package/ios/Nodes/REAValueNode.m +1 -1
  173. package/ios/REAEventDispatcher.m +1 -1
  174. package/ios/REAModule.h +1 -1
  175. package/ios/REAModule.m +12 -14
  176. package/ios/REANodesManager.h +5 -3
  177. package/ios/REANodesManager.m +97 -27
  178. package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
  179. package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
  180. package/ios/Transitioning/REAAllTransitions.h +1 -1
  181. package/ios/Transitioning/REAAllTransitions.m +2 -3
  182. package/ios/Transitioning/REATransition.h +2 -3
  183. package/ios/Transitioning/REATransition.m +3 -4
  184. package/ios/Transitioning/REATransitionAnimation.m +1 -2
  185. package/ios/Transitioning/REATransitionManager.m +2 -4
  186. package/ios/Transitioning/REATransitionValues.m +2 -3
  187. package/ios/native/NativeMethods.h +1 -3
  188. package/ios/native/NativeMethods.mm +1 -1
  189. package/ios/native/NativeProxy.h +2 -2
  190. package/ios/native/NativeProxy.mm +86 -15
  191. package/ios/native/REAIOSErrorHandler.h +2 -4
  192. package/ios/native/REAIOSErrorHandler.mm +1 -1
  193. package/ios/native/REAIOSLogger.h +1 -3
  194. package/ios/native/REAIOSLogger.mm +1 -1
  195. package/ios/native/REAIOSScheduler.h +1 -3
  196. package/ios/native/REAIOSScheduler.mm +2 -2
  197. package/ios/native/REAInitializer.h +0 -7
  198. package/ios/native/REAInitializer.mm +2 -2
  199. package/ios/native/UIResponder+Reanimated.mm +3 -3
  200. package/ios/sensor/ReanimatedSensor.h +25 -0
  201. package/ios/sensor/ReanimatedSensor.m +217 -0
  202. package/ios/sensor/ReanimatedSensorContainer.h +12 -0
  203. package/ios/sensor/ReanimatedSensorContainer.m +40 -0
  204. package/ios/sensor/ReanimatedSensorType.h +7 -0
  205. package/lib/ConfigHelper.js +2 -3
  206. package/lib/createAnimatedComponent.js +3 -4
  207. package/lib/reanimated1/core/AnimatedFunction.js +1 -1
  208. package/lib/reanimated1/derived/interpolate.js +2 -4
  209. package/lib/reanimated2/Colors.js +2 -1
  210. package/lib/reanimated2/Easing.js +9 -3
  211. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +25 -12
  212. package/lib/reanimated2/NativeReanimated/index.js +0 -4
  213. package/lib/reanimated2/ViewDescriptorsSet.js +2 -2
  214. package/lib/reanimated2/animation/styleAnimation.js +2 -1
  215. package/lib/reanimated2/core.js +30 -60
  216. package/lib/reanimated2/globals.d.ts +7 -2
  217. package/lib/reanimated2/hook/index.js +1 -0
  218. package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
  219. package/lib/reanimated2/interpolateColor.js +11 -11
  220. package/lib/reanimated2/interpolation.js +1 -1
  221. package/lib/reanimated2/jestUtils.js +9 -4
  222. package/lib/reanimated2/js-reanimated/JSReanimated.js +23 -2
  223. package/lib/reanimated2/js-reanimated/index.js +3 -3
  224. package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
  225. package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +2 -1
  226. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +32 -42
  227. package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +20 -38
  228. package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +32 -44
  229. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
  230. package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
  231. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  232. package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +20 -36
  233. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +16 -20
  234. package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +8 -12
  235. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +32 -48
  236. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
  237. package/lib/reanimated2/mock.js +3 -2
  238. package/lib/types/lib/ConfigHelper.d.ts +12 -0
  239. package/lib/types/lib/ReanimatedEventEmitter.d.ts +3 -0
  240. package/lib/types/lib/ReanimatedModule.d.ts +2 -0
  241. package/lib/types/lib/ReanimatedModule.macos.d.ts +2 -0
  242. package/lib/types/lib/ReanimatedModule.native.d.ts +2 -0
  243. package/lib/types/lib/ReanimatedModule.windows.d.ts +2 -0
  244. package/lib/types/lib/ReanimatedModuleCompat.d.ts +14 -0
  245. package/lib/types/lib/createAnimatedComponent.d.ts +33 -0
  246. package/lib/types/lib/reanimated2/Bezier.d.ts +6 -0
  247. package/lib/types/lib/reanimated2/Colors.d.ts +31 -0
  248. package/lib/types/lib/reanimated2/Easing.d.ts +172 -0
  249. package/lib/types/lib/reanimated2/NativeMethods.d.ts +14 -0
  250. package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +20 -0
  251. package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +3 -0
  252. package/lib/types/lib/reanimated2/PlatformChecker.d.ts +5 -0
  253. package/lib/types/lib/reanimated2/PropAdapters.d.ts +4 -0
  254. package/lib/types/lib/reanimated2/UpdateProps.d.ts +9 -0
  255. package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +20 -0
  256. package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +13 -0
  257. package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +5 -0
  258. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +13 -0
  259. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +13 -0
  260. package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +27 -0
  261. package/lib/types/lib/reanimated2/animation/decay.d.ts +19 -0
  262. package/lib/types/lib/reanimated2/animation/delay.d.ts +7 -0
  263. package/lib/types/lib/reanimated2/animation/index.d.ts +9 -0
  264. package/lib/types/lib/reanimated2/animation/repeat.d.ts +12 -0
  265. package/lib/types/lib/reanimated2/animation/sequence.d.ts +7 -0
  266. package/lib/types/lib/reanimated2/animation/spring.d.ts +22 -0
  267. package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +7 -0
  268. package/lib/types/lib/reanimated2/animation/timing.d.ts +21 -0
  269. package/lib/types/lib/reanimated2/animation/util.d.ts +9 -0
  270. package/lib/types/lib/reanimated2/commonTypes.d.ts +79 -0
  271. package/lib/types/lib/reanimated2/component/FlatList.d.ts +9 -0
  272. package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +8 -0
  273. package/lib/types/lib/reanimated2/component/index.d.ts +9 -0
  274. package/lib/types/lib/reanimated2/core.d.ts +24 -0
  275. package/lib/types/lib/reanimated2/hook/Hooks.d.ts +5 -0
  276. package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +14 -0
  277. package/lib/types/lib/reanimated2/hook/index.d.ts +10 -0
  278. package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +35 -0
  279. package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +12 -0
  280. package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +3 -0
  281. package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +21 -0
  282. package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +20 -0
  283. package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +11 -0
  284. package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +4 -0
  285. package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +2 -0
  286. package/lib/types/lib/reanimated2/hook/utils.d.ts +28 -0
  287. package/lib/types/lib/reanimated2/index.d.ts +12 -0
  288. package/lib/types/lib/reanimated2/interpolateColor.d.ts +26 -0
  289. package/lib/types/lib/reanimated2/interpolation.d.ts +14 -0
  290. package/lib/types/lib/reanimated2/jestUtils.d.ts +12 -0
  291. package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +30 -0
  292. package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +14 -0
  293. package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +14 -0
  294. package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +14 -0
  295. package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +44 -0
  296. package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +15 -0
  297. package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +1 -0
  298. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +22 -0
  299. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +38 -0
  300. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +25 -0
  301. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +77 -0
  302. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +4 -0
  303. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +62 -0
  304. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +4 -0
  305. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +42 -0
  306. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +50 -0
  307. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +18 -0
  308. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +10 -0
  309. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +18 -0
  310. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +34 -0
  311. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +34 -0
  312. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +18 -0
  313. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +66 -0
  314. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +10 -0
  315. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +19 -0
  316. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +13 -0
  317. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +6 -0
  318. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +6 -0
  319. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +7 -0
  320. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +9 -0
  321. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +6 -0
  322. package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +4 -0
  323. package/lib/types/lib/reanimated2/mock.d.ts +55 -0
  324. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +1 -0
  325. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  326. package/lib/types/lib/reanimated2/utils.d.ts +7 -0
  327. package/lib/types/lib/setAndForwardRef.d.ts +40 -0
  328. package/lib/types/react-native-reanimated-tests.d.ts +1 -0
  329. package/mock.js +4 -4
  330. package/package.json +43 -39
  331. package/plugin.js +3 -12
  332. package/react-native-reanimated.d.ts +58 -32
  333. package/src/ConfigHelper.ts +4 -5
  334. package/src/createAnimatedComponent.tsx +4 -4
  335. package/src/reanimated1/core/AnimatedFunction.js +1 -1
  336. package/src/reanimated1/derived/interpolate.js +2 -4
  337. package/src/reanimated2/Colors.ts +2 -1
  338. package/src/reanimated2/Easing.ts +9 -3
  339. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +42 -15
  340. package/src/reanimated2/NativeReanimated/index.ts +0 -6
  341. package/src/reanimated2/ViewDescriptorsSet.ts +2 -3
  342. package/src/reanimated2/animation/index.ts +1 -0
  343. package/src/reanimated2/animation/styleAnimation.ts +10 -7
  344. package/src/reanimated2/animation/timing.ts +3 -1
  345. package/src/reanimated2/animation/util.ts +10 -11
  346. package/src/reanimated2/commonTypes.ts +20 -1
  347. package/src/reanimated2/component/FlatList.tsx +3 -2
  348. package/src/reanimated2/core.ts +34 -73
  349. package/src/reanimated2/globals.d.ts +7 -2
  350. package/src/reanimated2/hook/index.ts +1 -0
  351. package/src/reanimated2/hook/useAnimatedSensor.ts +91 -0
  352. package/src/reanimated2/hook/utils.ts +2 -1
  353. package/src/reanimated2/interpolateColor.ts +11 -11
  354. package/src/reanimated2/interpolation.ts +2 -6
  355. package/src/reanimated2/jestUtils.ts +20 -4
  356. package/src/reanimated2/js-reanimated/JSReanimated.ts +25 -2
  357. package/src/reanimated2/js-reanimated/index.ts +3 -3
  358. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +13 -0
  359. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -3
  360. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +51 -21
  361. package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +40 -10
  362. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +48 -12
  363. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +16 -4
  364. package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -2
  365. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +16 -4
  366. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +32 -8
  367. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -10
  368. package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +16 -4
  369. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +64 -16
  370. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -1
  371. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +26 -19
  372. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +2 -1
  373. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -1
  374. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -1
  375. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -1
  376. package/src/reanimated2/mock.ts +3 -2
  377. package/android/expo/linking.gradle +0 -46
  378. package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +0 -12
  379. package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +0 -26
  380. package/android/react-native-reanimated-63-hermes.aar +0 -0
  381. package/android/react-native-reanimated-63-jsc.aar +0 -0
  382. package/android/src/main/java/com/swmansion/reanimated/ReanimatedProxyPackage.java +0 -15
  383. package/expo-module.config.json +0 -3
  384. package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
  385. package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
  386. package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
  387. package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
@@ -0,0 +1,9 @@
1
+ import { NextAnimation, DelayAnimation, RepeatAnimation, SequenceAnimation, StyleLayoutAnimation } from './commonTypes';
2
+ import { AnimatedStyle, SharedValue, AnimatableValue, Animation, AnimationObject } from '../commonTypes';
3
+ export declare type UserUpdater = () => AnimatedStyle;
4
+ export declare function initialUpdaterRun<T>(updater: () => T): T;
5
+ declare type AnimationToDecoration<T extends AnimationObject | StyleLayoutAnimation> = T extends StyleLayoutAnimation ? Record<string, unknown> : T extends DelayAnimation ? NextAnimation<DelayAnimation> : T extends RepeatAnimation ? NextAnimation<RepeatAnimation> : T extends SequenceAnimation ? NextAnimation<SequenceAnimation> : AnimatableValue | T;
6
+ export declare function defineAnimation<T extends AnimationObject | StyleLayoutAnimation>(starting: AnimationToDecoration<T>, factory: () => T): T;
7
+ export declare function cancelAnimation<T>(sharedValue: SharedValue<T>): void;
8
+ export declare function withStartValue(startValue: AnimatableValue, animation: NextAnimation<AnimationObject>): Animation<AnimationObject>;
9
+ export {};
@@ -0,0 +1,79 @@
1
+ import { PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, TranslateXTransform, TranslateYTransform, SkewXTransform, SkewYTransform, MatrixTransform, ViewStyle, TextStyle } from 'react-native';
2
+ import { Context } from './hook/commonTypes';
3
+ export declare type TransformProperty = PerpectiveTransform | RotateTransform | RotateXTransform | RotateYTransform | RotateZTransform | ScaleTransform | ScaleXTransform | ScaleYTransform | TranslateXTransform | TranslateYTransform | SkewXTransform | SkewYTransform | MatrixTransform;
4
+ export interface StyleProps extends ViewStyle, TextStyle {
5
+ originX?: number;
6
+ originY?: number;
7
+ [key: string]: any;
8
+ }
9
+ export interface AnimatedStyle extends Record<string, Animation<AnimationObject>> {
10
+ [key: string]: any;
11
+ transform?: Array<Record<string, Animation<AnimationObject>>>;
12
+ }
13
+ export interface SharedValue<T> {
14
+ value: T;
15
+ }
16
+ export interface WorkletFunction {
17
+ _closure?: Context;
18
+ __workletHash?: number;
19
+ __optimalization?: number;
20
+ }
21
+ export interface BasicWorkletFunction<T> extends WorkletFunction {
22
+ (): T;
23
+ }
24
+ export interface BasicWorkletFunctionOptional<T> extends WorkletFunction {
25
+ (): Partial<T>;
26
+ }
27
+ export interface NativeEvent<T> {
28
+ nativeEvent: T;
29
+ }
30
+ export interface ComplexWorkletFunction<A extends any[], R> extends WorkletFunction {
31
+ (...args: A): R;
32
+ }
33
+ export interface NestedObject<T> {
34
+ [key: string]: NestedObjectValues<T>;
35
+ }
36
+ export declare type NestedObjectValues<T> = T | Array<NestedObjectValues<T>> | NestedObject<T>;
37
+ export interface AdapterWorkletFunction extends WorkletFunction {
38
+ (value: NestedObject<string | number | AnimationObject>): void;
39
+ }
40
+ export declare type AnimatableValue = number | string | Array<number>;
41
+ export interface AnimationObject {
42
+ [key: string]: any;
43
+ callback: AnimationCallback;
44
+ current?: AnimatableValue;
45
+ toValue?: AnimationObject['current'];
46
+ startValue?: AnimationObject['current'];
47
+ finished?: boolean;
48
+ strippedCurrent?: number;
49
+ cancelled?: boolean;
50
+ __prefix?: string;
51
+ __suffix?: string;
52
+ onFrame: (animation: any, timestamp: Timestamp) => boolean;
53
+ onStart: (nextAnimation: any, current: any, timestamp: Timestamp, previousAnimation: any) => void;
54
+ }
55
+ export interface Animation<T extends AnimationObject> extends AnimationObject {
56
+ onFrame: (animation: T, timestamp: Timestamp) => boolean;
57
+ onStart: (nextAnimation: T, current: T extends NumericAnimation ? number : AnimatableValue, timestamp: Timestamp, previousAnimation: T) => void;
58
+ }
59
+ export interface NumericAnimation {
60
+ current?: number;
61
+ }
62
+ export declare type AnimationCallback = (finished?: boolean, current?: AnimatableValue) => void;
63
+ export declare type Timestamp = number;
64
+ export declare type Value3D = {
65
+ x: number;
66
+ y: number;
67
+ z: number;
68
+ };
69
+ export declare type SensorValue3D = SharedValue<Value3D>;
70
+ export declare type ValueRotation = {
71
+ qw: number;
72
+ qx: number;
73
+ qy: number;
74
+ qz: number;
75
+ yaw: number;
76
+ pitch: number;
77
+ roll: number;
78
+ };
79
+ export declare type SensorValueRotation = SharedValue<ValueRotation>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { FlatListProps } from 'react-native';
3
+ import { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';
4
+ export interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
5
+ itemLayoutAnimation?: ILayoutAnimationBuilder;
6
+ }
7
+ declare type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatlistProps<T>>;
8
+ declare const ReanimatedFlatlist: ReanimatedFlatListFC;
9
+ export default ReanimatedFlatlist;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const WrappedComponents: {
3
+ View: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
4
+ Text: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
5
+ Image: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
6
+ ScrollView: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
7
+ };
8
+ export default WrappedComponents;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare const ReanimatedComponents: {
3
+ FlatList: import("react").FC<import("./FlatList").ReanimatedFlatlistProps<any>>;
4
+ View: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
5
+ Text: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
6
+ Image: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
7
+ ScrollView: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
8
+ };
9
+ export default ReanimatedComponents;
@@ -0,0 +1,24 @@
1
+ import { ComplexWorkletFunction, SharedValue, AnimationObject, AnimatableValue, Timestamp } from './commonTypes';
2
+ import { Descriptor } from './hook/commonTypes';
3
+ export declare type ReanimatedConsole = Pick<Console, 'debug' | 'log' | 'warn' | 'info' | 'error'>;
4
+ export declare type WorkletValue = (() => AnimationObject) | AnimationObject | AnimatableValue | Descriptor;
5
+ export declare const checkPluginState: (throwError: boolean) => boolean;
6
+ export declare const isConfigured: (throwError?: boolean) => boolean;
7
+ export declare const isConfiguredCheck: () => void;
8
+ export declare function requestFrame(frame: (timestamp: Timestamp) => void): void;
9
+ export declare function runOnUI<A extends any[], R>(worklet: ComplexWorkletFunction<A, R>): (...args: A) => void;
10
+ export declare function makeShareable<T>(value: T): T;
11
+ export declare function getViewProp<T>(viewTag: string, propName: string): Promise<T>;
12
+ export declare function getTimestamp(): number;
13
+ export declare function makeMutable<T>(value: T): SharedValue<T>;
14
+ export declare function makeRemote<T>(object?: {}): T;
15
+ export declare function startMapper(mapper: () => void, inputs?: any[], outputs?: any[], updater?: () => void, viewDescriptors?: Descriptor[] | SharedValue<Descriptor[]>): number;
16
+ export declare function stopMapper(mapperId: number): void;
17
+ export interface RunOnJSFunction<A extends any[], R> {
18
+ __callAsync?: (...args: A) => void;
19
+ (...args: A): R;
20
+ }
21
+ export declare function runOnJS<A extends any[], R>(fun: RunOnJSFunction<A, R>): () => void;
22
+ export declare function enableLayoutAnimations(flag: boolean, isCallByUser?: boolean): void;
23
+ export declare function configureProps(uiProps: string[], nativeProps: string[]): void;
24
+ export declare function jestResetJsReanimatedModule(): void;
@@ -0,0 +1,5 @@
1
+ import { DependencyList } from './commonTypes';
2
+ import { useAnimatedStyle } from './useAnimatedStyle';
3
+ export declare const useAnimatedProps: typeof useAnimatedStyle;
4
+ export declare function useWorkletCallback<A extends unknown[], R>(fun: (...args: A) => R, deps?: DependencyList): (...args: Parameters<typeof fun>) => R;
5
+ export { useEvent, useHandler } from './utils';
@@ -0,0 +1,14 @@
1
+ export declare type DependencyList = Array<unknown> | undefined;
2
+ export declare type Context = Record<string, unknown>;
3
+ export interface ContextWithDependencies<TContext extends Context> {
4
+ context: TContext;
5
+ savedDependencies: DependencyList;
6
+ }
7
+ export interface Descriptor {
8
+ tag: number;
9
+ name: string;
10
+ }
11
+ export interface RefObjectFunction<T> {
12
+ current: T | null;
13
+ (component?: T): number;
14
+ }
@@ -0,0 +1,10 @@
1
+ export { DependencyList, Context } from './commonTypes';
2
+ export { useAnimatedProps, useEvent, useHandler, useWorkletCallback, } from './Hooks';
3
+ export { useSharedValue } from './useSharedValue';
4
+ export { useAnimatedStyle, AnimatedStyleResult } from './useAnimatedStyle';
5
+ export { useAnimatedGestureHandler, GestureHandlerEvent, GestureHandlers, } from './useAnimatedGestureHandler';
6
+ export { useAnimatedReaction, AnimatedReactionWorkletFunction, } from './useAnimatedReaction';
7
+ export { useAnimatedRef } from './useAnimatedRef';
8
+ export { useAnimatedScrollHandler, ScrollHandler, ScrollHandlers, } from './useAnimatedScrollHandler';
9
+ export { useDerivedValue, DerivedValue } from './useDerivedValue';
10
+ export { useAnimatedSensor, SensorType } from './useAnimatedSensor';
@@ -0,0 +1,35 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { WorkletFunction } from '../commonTypes';
3
+ import WorkletEventHandler from '../WorkletEventHandler';
4
+ import { Context, DependencyList } from './commonTypes';
5
+ interface Handler<T, TContext extends Context> extends WorkletFunction {
6
+ (event: T, context: TContext, isCanceledOrFailed?: boolean): void;
7
+ }
8
+ export interface GestureHandlers<T, TContext extends Context> {
9
+ [key: string]: Handler<T, TContext> | undefined;
10
+ onStart?: Handler<T, TContext>;
11
+ onActive?: Handler<T, TContext>;
12
+ onEnd?: Handler<T, TContext>;
13
+ onFail?: Handler<T, TContext>;
14
+ onCancel?: Handler<T, TContext>;
15
+ onFinish?: Handler<T, TContext>;
16
+ }
17
+ export declare enum EventType {
18
+ UNDETERMINED = 0,
19
+ FAILED = 1,
20
+ BEGAN = 2,
21
+ CANCELLED = 3,
22
+ ACTIVE = 4,
23
+ END = 5
24
+ }
25
+ export interface GestureHandlerStateChangeNativeEvent {
26
+ handlerTag: number;
27
+ numberOfPointers: number;
28
+ state: EventType;
29
+ oldState: EventType;
30
+ }
31
+ export interface GestureHandlerEvent<T> extends GestureHandlerStateChangeNativeEvent {
32
+ nativeEvent: T;
33
+ }
34
+ export declare function useAnimatedGestureHandler<T extends GestureHandlerEvent<T>, TContext extends Context>(handlers: GestureHandlers<T, TContext>, dependencies?: DependencyList): MutableRefObject<WorkletEventHandler<T> | null> | ((e: T) => void);
35
+ export {};
@@ -0,0 +1,12 @@
1
+ import { BasicWorkletFunction, WorkletFunction } from '../commonTypes';
2
+ import { DependencyList } from './commonTypes';
3
+ export interface AnimatedReactionWorkletFunction<T> extends WorkletFunction {
4
+ (prepared: T, previous: T | null): void;
5
+ }
6
+ /**
7
+ * @param prepare - worklet used for data preparation for the second parameter
8
+ * @param react - worklet which takes data prepared by the one in the first parameter and performs certain actions
9
+ * the first worklet defines the inputs, in other words on which shared values change will it be called.
10
+ * the second one can modify any shared values but those which are mentioned in the first worklet. Beware of that, because this may result in endless loop and high cpu usage.
11
+ */
12
+ export declare function useAnimatedReaction<T>(prepare: BasicWorkletFunction<T>, react: AnimatedReactionWorkletFunction<T>, dependencies: DependencyList): void;
@@ -0,0 +1,3 @@
1
+ import { Component } from 'react';
2
+ import { RefObjectFunction } from './commonTypes';
3
+ export declare function useAnimatedRef<T extends Component>(): RefObjectFunction<T>;
@@ -0,0 +1,21 @@
1
+ import { RefObject } from 'react';
2
+ import { NativeScrollEvent } from 'react-native';
3
+ import { NativeEvent, WorkletFunction } from '../commonTypes';
4
+ import WorkletEventHandler from '../WorkletEventHandler';
5
+ import { Context, DependencyList } from './commonTypes';
6
+ export interface ScrollHandler<TContext extends Context> extends WorkletFunction {
7
+ (event: NativeScrollEvent, context?: TContext): void;
8
+ }
9
+ interface ScrollEvent extends NativeScrollEvent, NativeEvent<ScrollEvent> {
10
+ eventName: string;
11
+ }
12
+ export interface ScrollHandlers<TContext extends Context> {
13
+ [key: string]: ScrollHandler<TContext> | undefined;
14
+ onScroll?: ScrollHandler<TContext>;
15
+ onBeginDrag?: ScrollHandler<TContext>;
16
+ onEndDrag?: ScrollHandler<TContext>;
17
+ onMomentumBegin?: ScrollHandler<TContext>;
18
+ onMomentumEnd?: ScrollHandler<TContext>;
19
+ }
20
+ export declare function useAnimatedScrollHandler<TContext extends Context>(handlers: ScrollHandlers<TContext> | ScrollHandler<TContext>, dependencies?: DependencyList): RefObject<WorkletEventHandler<ScrollEvent>>;
21
+ export {};
@@ -0,0 +1,20 @@
1
+ import { SensorValue3D, SensorValueRotation } from '../commonTypes';
2
+ export declare enum SensorType {
3
+ ACCELEROMETER = 1,
4
+ GYROSCOPE = 2,
5
+ GRAVITY = 3,
6
+ MAGNETIC_FIELD = 4,
7
+ ROTATION = 5
8
+ }
9
+ export declare type SensorConfig = {
10
+ interval: number;
11
+ };
12
+ export declare type AnimatedSensor = {
13
+ sensor: SensorValue3D | SensorValueRotation | null;
14
+ unregister: () => void;
15
+ isAvailable: boolean;
16
+ config: {
17
+ interval: number;
18
+ };
19
+ };
20
+ export declare function useAnimatedSensor(sensorType: SensorType, userConfig?: SensorConfig): AnimatedSensor;
@@ -0,0 +1,11 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { DependencyList } from './commonTypes';
3
+ import { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';
4
+ import { AdapterWorkletFunction, AnimatedStyle, BasicWorkletFunction } from '../commonTypes';
5
+ export interface AnimatedStyleResult {
6
+ viewDescriptors: ViewDescriptorsSet;
7
+ initial: AnimatedStyle;
8
+ viewsRef: ViewRefSet<any>;
9
+ animatedStyle?: MutableRefObject<AnimatedStyle>;
10
+ }
11
+ export declare function useAnimatedStyle<T extends AnimatedStyle>(updater: BasicWorkletFunction<T>, dependencies?: DependencyList, adapters?: AdapterWorkletFunction | AdapterWorkletFunction[]): AnimatedStyleResult;
@@ -0,0 +1,4 @@
1
+ import { BasicWorkletFunction, SharedValue } from '../commonTypes';
2
+ import { DependencyList } from './commonTypes';
3
+ export declare type DerivedValue<T> = Readonly<SharedValue<T>>;
4
+ export declare function useDerivedValue<T>(processor: BasicWorkletFunction<T>, dependencies: DependencyList): DerivedValue<T>;
@@ -0,0 +1,2 @@
1
+ import { SharedValue } from '../commonTypes';
2
+ export declare function useSharedValue<T>(init: T): SharedValue<T>;
@@ -0,0 +1,28 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { AnimatedStyle, NativeEvent, NestedObjectValues, StyleProps, WorkletFunction, AnimationObject } from '../commonTypes';
3
+ import WorkletEventHandler from '../WorkletEventHandler';
4
+ import { Context, DependencyList } from './commonTypes';
5
+ interface Handler<T, TContext extends Context> extends WorkletFunction {
6
+ (event: T, context: TContext): void;
7
+ }
8
+ interface Handlers<T, TContext extends Context> {
9
+ [key: string]: Handler<T, TContext> | undefined;
10
+ }
11
+ export interface UseHandlerContext<TContext extends Context> {
12
+ context: TContext;
13
+ doDependenciesDiffer: boolean;
14
+ useWeb: boolean;
15
+ }
16
+ export declare function useEvent<T extends NativeEvent<T>>(handler: (event: T) => void, eventNames?: string[], rebuild?: boolean): MutableRefObject<WorkletEventHandler<T> | null>;
17
+ export declare function useHandler<T, TContext extends Context>(handlers: Handlers<T, TContext>, dependencies?: DependencyList): UseHandlerContext<TContext>;
18
+ export declare function buildWorkletsHash(handlers: Record<string, WorkletFunction> | Array<WorkletFunction>): string;
19
+ export declare function buildDependencies(dependencies: DependencyList, handlers: Record<string, WorkletFunction | undefined>): Array<unknown>;
20
+ export declare function areDependenciesEqual(nextDeps: DependencyList, prevDeps: DependencyList): boolean;
21
+ export declare function hasColorProps(updates: AnimatedStyle): boolean;
22
+ export declare function parseColors(updates: AnimatedStyle): void;
23
+ export declare function canApplyOptimalisation(upadterFn: WorkletFunction): number;
24
+ export declare function isAnimated(prop: NestedObjectValues<AnimationObject>): boolean;
25
+ export declare function styleDiff<T extends AnimatedStyle>(oldStyle: AnimatedStyle, newStyle: AnimatedStyle): Partial<T>;
26
+ export declare function getStyleWithoutAnimations(newStyle: AnimatedStyle): StyleProps;
27
+ export declare const validateAnimatedStyles: (styles: AnimatedStyle) => void;
28
+ export {};
@@ -0,0 +1,12 @@
1
+ export * from './core';
2
+ export * from './hook';
3
+ export * from './animation';
4
+ export * from './interpolation';
5
+ export * from './interpolateColor';
6
+ export * from './Easing';
7
+ export * from './NativeMethods';
8
+ export * from './Colors';
9
+ export * from './PropAdapters';
10
+ export * from './layoutReanimation';
11
+ export * from './utils';
12
+ export * from './commonTypes';
@@ -0,0 +1,26 @@
1
+ import { SharedValue } from './commonTypes';
2
+ interface InterpolateRGB {
3
+ r: number[];
4
+ g: number[];
5
+ b: number[];
6
+ a: number[];
7
+ }
8
+ interface InterpolateHSV {
9
+ h: number[];
10
+ s: number[];
11
+ v: number[];
12
+ }
13
+ export declare const interpolateColor: (value: number, inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: 'RGB' | 'HSV') => string | number;
14
+ export declare enum ColorSpace {
15
+ RGB = 0,
16
+ HSV = 1
17
+ }
18
+ export interface InterpolateConfig {
19
+ inputRange: readonly number[];
20
+ outputRange: readonly (string | number)[];
21
+ colorSpace: ColorSpace;
22
+ cache: SharedValue<InterpolateRGB | InterpolateHSV | null>;
23
+ }
24
+ export declare function useInterpolateConfig(inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: ColorSpace): SharedValue<InterpolateConfig>;
25
+ export declare const interpolateSharableColor: (value: number, interpolateConfig: SharedValue<InterpolateConfig>) => string | number;
26
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare enum Extrapolation {
2
+ IDENTITY = "identity",
3
+ CLAMP = "clamp",
4
+ EXTEND = "extend"
5
+ }
6
+ export interface InterpolatedNode {
7
+ __nodeId: number;
8
+ }
9
+ export interface ExtrapolationConfig {
10
+ extrapolateLeft?: Extrapolation | string;
11
+ extrapolateRight?: Extrapolation | string;
12
+ }
13
+ export declare type ExtrapolationType = ExtrapolationConfig | Extrapolation | string | undefined;
14
+ export declare function interpolate(x: number | InterpolatedNode, input: readonly number[], output: readonly number[], type?: ExtrapolationType): number;
@@ -0,0 +1,12 @@
1
+ declare global {
2
+ namespace jest {
3
+ interface Matchers<R> {
4
+ toHaveAnimatedStyle(style: Record<string, unknown>[] | Record<string, unknown>): R;
5
+ }
6
+ }
7
+ }
8
+ export declare const withReanimatedTimer: (animatonTest: any) => void;
9
+ export declare const advanceAnimationByTime: (time?: number) => void;
10
+ export declare const advanceAnimationByFrame: (count: any) => void;
11
+ export declare const setUpTests: (userConfig?: {}) => void;
12
+ export declare const getAnimatedStyle: (received: any) => {};
@@ -0,0 +1,30 @@
1
+ import MapperRegistry from './MapperRegistry';
2
+ import MutableValue from './MutableValue';
3
+ import { NativeReanimated } from '../NativeReanimated/NativeReanimated';
4
+ import { Timestamp, NestedObjectValues } from '../commonTypes';
5
+ export default class JSReanimated extends NativeReanimated {
6
+ _valueSetter?: <T>(value: T) => void;
7
+ _renderRequested: boolean;
8
+ _mapperRegistry: MapperRegistry<any>;
9
+ _frames: ((timestamp: Timestamp) => void)[];
10
+ timeProvider: {
11
+ now: () => number;
12
+ };
13
+ constructor();
14
+ pushFrame(frame: (timestamp: Timestamp) => void): void;
15
+ getTimestamp(): number;
16
+ maybeRequestRender(): void;
17
+ _onRender(timestampMs: number): void;
18
+ installCoreFunctions(valueSetter: <T>(value: T) => void): void;
19
+ makeShareable<T>(value: T): T;
20
+ makeMutable<T>(value: T): MutableValue<T>;
21
+ makeRemote<T>(object?: {}): T;
22
+ startMapper(mapper: () => void, inputs?: NestedObjectValues<MutableValue<unknown>>[], outputs?: NestedObjectValues<MutableValue<unknown>>[]): number;
23
+ stopMapper(mapperId: number): void;
24
+ registerEventHandler<T>(_: string, __: (event: T) => void): string;
25
+ unregisterEventHandler(_: string): void;
26
+ enableLayoutAnimations(): void;
27
+ registerSensor(): number;
28
+ unregisterSensor(): void;
29
+ jestResetModule(): void;
30
+ }
@@ -0,0 +1,14 @@
1
+ import { NestedObjectValues } from '../commonTypes';
2
+ import { JSReanimated } from './commonTypes';
3
+ import MutableValue from './MutableValue';
4
+ export default class Mapper<T> {
5
+ static MAPPER_ID: number;
6
+ id: number;
7
+ inputs: MutableValue<T>[];
8
+ outputs: MutableValue<T>[];
9
+ mapper: () => void;
10
+ dirty: boolean;
11
+ constructor(module: JSReanimated, mapper: () => void, inputs?: NestedObjectValues<MutableValue<T>>[], outputs?: NestedObjectValues<MutableValue<T>>[]);
12
+ execute(): void;
13
+ extractMutablesFromArray<T>(array: NestedObjectValues<MutableValue<T>>): MutableValue<T>[];
14
+ }
@@ -0,0 +1,14 @@
1
+ import { JSReanimated } from './commonTypes';
2
+ import Mapper from './Mapper';
3
+ export default class MapperRegistry<T> {
4
+ sortedMappers: Mapper<T>[];
5
+ mappers: Map<number, Mapper<T>>;
6
+ _module: JSReanimated;
7
+ updatedSinceLastExecute: boolean;
8
+ constructor(module: JSReanimated);
9
+ startMapper(mapper: Mapper<T>): number;
10
+ stopMapper(id: number): void;
11
+ execute(): void;
12
+ updateOrder(): void;
13
+ get needRunOnRender(): boolean;
14
+ }
@@ -0,0 +1,14 @@
1
+ export default class MutableValue<T> {
2
+ static MUTABLE_ID: number;
3
+ _id: number;
4
+ _value: T;
5
+ _setter: (value: T) => void;
6
+ _animation: null;
7
+ _listeners: (() => void)[];
8
+ constructor(value: T, setter: (value: T) => void);
9
+ get value(): T;
10
+ set value(nextValue: T);
11
+ _setValue(newValue: T): void;
12
+ addListener(listener: () => void): void;
13
+ _triggerListener(): void;
14
+ }
@@ -0,0 +1,44 @@
1
+ import { Timestamp, NestedObjectValues } from '../commonTypes';
2
+ import MutableValue from './MutableValue';
3
+ export interface Mapper<T> {
4
+ MAPPER_ID?: number;
5
+ id: number;
6
+ inputs: MutableValue<T>[];
7
+ outputs: MutableValue<T>[];
8
+ mapper: () => void;
9
+ dirty: boolean;
10
+ execute(): void;
11
+ extractMutablesFromArray<T>(array: NestedObjectValues<MutableValue<T>>): MutableValue<T>[];
12
+ }
13
+ export interface MapperRegistry<T> {
14
+ sortedMappers: Mapper<T>[];
15
+ mappers: Map<number, Mapper<T>>;
16
+ _module: JSReanimated;
17
+ updatedSinceLastExecute: boolean;
18
+ startMapper(mapper: Mapper<T>): number;
19
+ stopMapper(id: number): void;
20
+ execute(): void;
21
+ updateOrder(): void;
22
+ }
23
+ export interface JSReanimated {
24
+ _valueSetter?: <T>(value: T) => void;
25
+ _renderRequested: boolean;
26
+ _mapperRegistry: MapperRegistry<any>;
27
+ _frames: ((timestamp: Timestamp) => void)[];
28
+ timeProvider: {
29
+ now: () => number;
30
+ };
31
+ pushFrame(frame: (timestamp: Timestamp) => void): void;
32
+ getTimestamp(): number;
33
+ maybeRequestRender(): void;
34
+ _onRender(timestampMs: number): void;
35
+ installCoreFunctions(valueSetter: <T>(value: T) => void): void;
36
+ makeShareable<T>(value: T): T;
37
+ makeMutable<T>(value: T): MutableValue<T>;
38
+ makeRemote<T>(object: Record<string, any>): T;
39
+ startMapper(mapper: () => void, inputs: NestedObjectValues<MutableValue<unknown>>[], outputs: NestedObjectValues<MutableValue<unknown>>[]): number;
40
+ stopMapper(mapperId: number): void;
41
+ registerEventHandler<T>(_: string, __: (event: T) => void): string;
42
+ unregisterEventHandler(_: string): void;
43
+ enableLayoutAnimations(): void;
44
+ }
@@ -0,0 +1,15 @@
1
+ import JSReanimated from './JSReanimated';
2
+ import { AnimatedStyle, StyleProps } from '../commonTypes';
3
+ declare const reanimatedJS: JSReanimated;
4
+ interface JSReanimatedComponent {
5
+ previousStyle: StyleProps;
6
+ setNativeProps: (style: StyleProps) => void;
7
+ props: Record<string, string | number>;
8
+ _touchableNode: {
9
+ setAttribute: (key: string, props: unknown) => void;
10
+ };
11
+ }
12
+ export declare const _updatePropsJS: (updates: StyleProps | AnimatedStyle, viewRef: {
13
+ _component?: JSReanimatedComponent;
14
+ }) => void;
15
+ export default reanimatedJS;
@@ -0,0 +1,22 @@
1
+ import { EntryExitAnimationFunction, AnimationFunction, LayoutAnimationFunction } from './commonTypes';
2
+ export declare class BaseAnimationBuilder {
3
+ durationV?: number;
4
+ delayV?: number;
5
+ randomizeDelay: boolean;
6
+ callbackV?: (finished: boolean) => void;
7
+ static createInstance: () => BaseAnimationBuilder;
8
+ build: () => EntryExitAnimationFunction | LayoutAnimationFunction;
9
+ static duration(durationMs: number): BaseAnimationBuilder;
10
+ duration(durationMs: number): BaseAnimationBuilder;
11
+ static delay(delayMs: number): BaseAnimationBuilder;
12
+ delay(delayMs: number): BaseAnimationBuilder;
13
+ static withCallback(callback: (finished: boolean) => void): BaseAnimationBuilder;
14
+ withCallback(callback: (finsihed: boolean) => void): BaseAnimationBuilder;
15
+ static getDuration(): number;
16
+ getDuration(): number;
17
+ static randomDelay(): BaseAnimationBuilder;
18
+ randomDelay(): BaseAnimationBuilder;
19
+ getDelay(): number;
20
+ getDelayFunction(): AnimationFunction;
21
+ static build(): EntryExitAnimationFunction | LayoutAnimationFunction;
22
+ }
@@ -0,0 +1,38 @@
1
+ import { AnimationFunction, LayoutAnimationAndConfig } from './commonTypes';
2
+ import { EasingFn } from '../../Easing';
3
+ import { BaseAnimationBuilder } from './BaseAnimationBuilder';
4
+ import { StyleProps } from '../../commonTypes';
5
+ export declare class ComplexAnimationBuilder extends BaseAnimationBuilder {
6
+ easingV?: EasingFn;
7
+ rotateV?: string;
8
+ type?: AnimationFunction;
9
+ dampingV?: number;
10
+ massV?: number;
11
+ stiffnessV?: number;
12
+ overshootClampingV?: number;
13
+ restDisplacementThresholdV?: number;
14
+ restSpeedThresholdV?: number;
15
+ initialValues?: StyleProps;
16
+ static createInstance: () => ComplexAnimationBuilder;
17
+ static easing(easingFunction: EasingFn): ComplexAnimationBuilder;
18
+ easing(easingFunction: EasingFn): ComplexAnimationBuilder;
19
+ static rotate(degree: string): ComplexAnimationBuilder;
20
+ rotate(degree: string): ComplexAnimationBuilder;
21
+ static springify(): ComplexAnimationBuilder;
22
+ springify(): ComplexAnimationBuilder;
23
+ static damping(damping: number): ComplexAnimationBuilder;
24
+ damping(damping: number): ComplexAnimationBuilder;
25
+ static mass(mass: number): ComplexAnimationBuilder;
26
+ mass(mass: number): ComplexAnimationBuilder;
27
+ static stiffness(stiffness: number): ComplexAnimationBuilder;
28
+ stiffness(stiffness: number): ComplexAnimationBuilder;
29
+ static overshootClamping(overshootClamping: number): ComplexAnimationBuilder;
30
+ overshootClamping(overshootClamping: number): ComplexAnimationBuilder;
31
+ static restDisplacementThreshold(restDisplacementThreshold: number): ComplexAnimationBuilder;
32
+ restDisplacementThreshold(restDisplacementThreshold: number): ComplexAnimationBuilder;
33
+ static restSpeedThreshold(restSpeedThreshold: number): ComplexAnimationBuilder;
34
+ restSpeedThreshold(restSpeedThreshold: number): ComplexAnimationBuilder;
35
+ static withInitialValues(values: StyleProps): BaseAnimationBuilder;
36
+ withInitialValues(values: StyleProps): BaseAnimationBuilder;
37
+ getAnimationAndConfig(): LayoutAnimationAndConfig;
38
+ }
@@ -0,0 +1,25 @@
1
+ import { EasingFn } from '../../Easing';
2
+ import { EntryExitAnimationFunction, IEntryExitAnimationBuilder, KeyframeProps } from './commonTypes';
3
+ import { StyleProps } from '../../commonTypes';
4
+ export interface KeyframePoint {
5
+ duration: number;
6
+ value: number | string;
7
+ easing?: EasingFn;
8
+ }
9
+ export interface ParsedKeyframesDefinition {
10
+ initialValues: StyleProps;
11
+ keyframes: Record<string, KeyframePoint[]>;
12
+ }
13
+ export declare class Keyframe implements IEntryExitAnimationBuilder {
14
+ durationV?: number;
15
+ delayV?: number;
16
+ callbackV?: (finished: boolean) => void;
17
+ definitions: Record<string, KeyframeProps>;
18
+ constructor(definitions: Record<string, KeyframeProps>);
19
+ private parseDefinitions;
20
+ duration(durationMs: number): Keyframe;
21
+ delay(delayMs: number): Keyframe;
22
+ withCallback(callback: (finsihed: boolean) => void): Keyframe;
23
+ private getDelayFunction;
24
+ build: () => EntryExitAnimationFunction;
25
+ }