react-native-reanimated 2.9.1 → 2.11.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 (257) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +7 -4
  2. package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +0 -0
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +2 -0
  4. package/Common/cpp/{headers/LayoutAnimations → LayoutAnimations}/LayoutAnimationsProxy.h +0 -0
  5. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +40 -0
  6. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +13 -0
  7. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +25 -0
  8. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +9 -1
  9. package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
  10. package/Common/cpp/Registries/MapperRegistry.cpp +3 -1
  11. package/Common/cpp/{headers/Registries → Registries}/MapperRegistry.h +0 -0
  12. package/Common/cpp/Registries/WorkletsCache.cpp +3 -0
  13. package/Common/cpp/{headers/Registries → Registries}/WorkletsCache.h +0 -0
  14. package/Common/cpp/{headers/SharedItems → SharedItems}/FrozenObject.h +0 -0
  15. package/Common/cpp/{headers/SharedItems → SharedItems}/HostFunctionHandler.h +0 -0
  16. package/Common/cpp/SharedItems/MutableValue.cpp +2 -0
  17. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValue.h +0 -0
  18. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValueSetterProxy.h +0 -0
  19. package/Common/cpp/{headers/SharedItems → SharedItems}/RemoteObject.h +0 -0
  20. package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +0 -0
  21. package/Common/cpp/SharedItems/ShareableValue.cpp +7 -2
  22. package/Common/cpp/{headers/SharedItems → SharedItems}/ShareableValue.h +0 -0
  23. package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
  24. package/Common/cpp/{headers/SharedItems → SharedItems}/ValueWrapper.h +0 -0
  25. package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
  26. package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
  27. package/Common/cpp/Tools/JSIStoreValueUser.cpp +2 -2
  28. package/Common/cpp/{headers/Tools → Tools}/JSIStoreValueUser.h +0 -0
  29. package/Common/cpp/{headers/Tools → Tools}/Mapper.h +0 -0
  30. package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +5 -0
  31. package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
  32. package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +0 -0
  33. package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
  34. package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
  35. package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
  36. package/RNReanimated.podspec +18 -58
  37. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  38. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  39. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  40. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  41. package/android/.gradle/{7.2 → 7.5.1}/dependencies-accessors/gc.properties +0 -0
  42. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  43. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  44. package/android/.gradle/{7.2 → 7.5.1}/fileChanges/last-build.bin +0 -0
  45. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  46. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  47. package/android/.gradle/{7.2 → 7.5.1}/fileHashes/resourceHashesCache.bin +0 -0
  48. package/android/.gradle/{7.2 → 7.5.1}/gc.properties +0 -0
  49. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  50. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  51. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  52. package/android/.gradle/file-system.probe +0 -0
  53. package/android/CMakeLists.txt +223 -113
  54. package/android/build.gradle +480 -195
  55. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  56. package/android/react-native-reanimated-66-hermes.aar +0 -0
  57. package/android/react-native-reanimated-66-jsc.aar +0 -0
  58. package/android/react-native-reanimated-67-hermes.aar +0 -0
  59. package/android/react-native-reanimated-67-jsc.aar +0 -0
  60. package/android/react-native-reanimated-68-hermes.aar +0 -0
  61. package/android/react-native-reanimated-68-jsc.aar +0 -0
  62. package/android/react-native-reanimated-69-hermes.aar +0 -0
  63. package/android/react-native-reanimated-69-jsc.aar +0 -0
  64. package/android/react-native-reanimated-70-hermes.aar +0 -0
  65. package/android/react-native-reanimated-70-jsc.aar +0 -0
  66. package/{lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts → android/rnVersionPatch/70/.gitkeep} +0 -0
  67. package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
  68. package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
  69. package/android/src/main/cpp/AndroidLogger.cpp +4 -1
  70. package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
  71. package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
  72. package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
  73. package/android/src/main/cpp/{headers/LayoutAnimations.h → LayoutAnimations.h} +0 -0
  74. package/android/src/main/cpp/NativeProxy.cpp +60 -28
  75. package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +29 -0
  76. package/android/src/main/cpp/OnLoad.cpp +1 -0
  77. package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
  78. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +29 -5
  79. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +3 -1
  80. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +166 -0
  81. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +19 -16
  82. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
  83. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +1 -1
  84. package/ios/{REAModule.m → REAModule.mm} +12 -0
  85. package/ios/REANodesManager.m +31 -8
  86. package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
  87. package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
  88. package/ios/native/NativeProxy.mm +24 -3
  89. package/ios/native/REAInitializer.h +2 -2
  90. package/ios/native/REAInitializer.mm +10 -14
  91. package/ios/native/UIResponder+Reanimated.mm +1 -1
  92. package/ios/sensor/ReanimatedSensor.m +26 -17
  93. package/lib/index.js +11 -3
  94. package/lib/index.web.js +6 -0
  95. package/lib/reanimated2/Colors.js +1 -1
  96. package/lib/reanimated2/NativeMethods.js +34 -17
  97. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +6 -0
  98. package/lib/reanimated2/animation/util.js +4 -1
  99. package/lib/reanimated2/commonTypes.js +8 -1
  100. package/lib/reanimated2/component/FlatList.js +5 -5
  101. package/lib/reanimated2/core.js +5 -4
  102. package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +32 -0
  103. package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +76 -0
  104. package/lib/reanimated2/globals.d.ts +5 -2
  105. package/lib/reanimated2/hook/index.js +3 -0
  106. package/lib/reanimated2/hook/useAnimatedKeyboard.js +31 -0
  107. package/lib/reanimated2/hook/useAnimatedSensor.js +3 -3
  108. package/lib/reanimated2/hook/useFrameCallback.js +23 -0
  109. package/lib/reanimated2/hook/useScrollViewOffset.js +26 -0
  110. package/lib/reanimated2/jestUtils.js +11 -3
  111. package/lib/reanimated2/js-reanimated/JSReanimated.js +7 -0
  112. package/lib/reanimated2/js-reanimated/global.js +33 -22
  113. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +1 -1
  114. package/lib/reanimated2/utils.js +10 -3
  115. package/lib/types/{lib/Animated.d.ts → Animated.d.ts} +0 -0
  116. package/lib/types/{lib/ConfigHelper.d.ts → ConfigHelper.d.ts} +0 -0
  117. package/lib/types/{lib/ReanimatedEventEmitter.d.ts → ReanimatedEventEmitter.d.ts} +0 -0
  118. package/lib/types/{lib/ReanimatedModule.d.ts → ReanimatedModule.d.ts} +0 -0
  119. package/lib/types/{lib/ReanimatedModule.macos.d.ts → ReanimatedModule.macos.d.ts} +0 -0
  120. package/lib/types/{lib/ReanimatedModule.native.d.ts → ReanimatedModule.native.d.ts} +0 -0
  121. package/lib/types/{lib/ReanimatedModule.windows.d.ts → ReanimatedModule.windows.d.ts} +0 -0
  122. package/lib/types/{lib/ReanimatedModuleCompat.d.ts → ReanimatedModuleCompat.d.ts} +0 -0
  123. package/lib/types/{lib/createAnimatedComponent.d.ts → createAnimatedComponent.d.ts} +0 -0
  124. package/lib/types/index.d.ts +4 -0
  125. package/lib/types/{lib/index.d.ts → index.web.d.ts} +0 -0
  126. package/lib/types/{lib/reanimated2 → reanimated2}/Bezier.d.ts +0 -0
  127. package/lib/types/{lib/reanimated2 → reanimated2}/Colors.d.ts +0 -0
  128. package/lib/types/{lib/reanimated2 → reanimated2}/Easing.d.ts +0 -0
  129. package/lib/types/{lib/reanimated2 → reanimated2}/NativeMethods.d.ts +3 -10
  130. package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/NativeReanimated.d.ts +3 -1
  131. package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/index.d.ts +0 -0
  132. package/lib/types/{lib/reanimated2 → reanimated2}/PlatformChecker.d.ts +0 -0
  133. package/lib/types/{lib/reanimated2 → reanimated2}/PropAdapters.d.ts +0 -0
  134. package/lib/types/{lib/reanimated2 → reanimated2}/UpdateProps.d.ts +0 -0
  135. package/lib/types/{lib/reanimated2 → reanimated2}/ViewDescriptorsSet.d.ts +0 -0
  136. package/lib/types/{lib/reanimated2 → reanimated2}/WorkletEventHandler.d.ts +0 -0
  137. package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/MutableValue.d.ts +0 -0
  138. package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
  139. package/lib/types/{lib/reanimated2 → reanimated2}/animation/commonTypes.d.ts +0 -0
  140. package/lib/types/{lib/reanimated2 → reanimated2}/animation/decay.d.ts +0 -0
  141. package/lib/types/{lib/reanimated2 → reanimated2}/animation/delay.d.ts +0 -0
  142. package/lib/types/{lib/reanimated2 → reanimated2}/animation/index.d.ts +0 -0
  143. package/lib/types/{lib/reanimated2 → reanimated2}/animation/repeat.d.ts +0 -0
  144. package/lib/types/{lib/reanimated2 → reanimated2}/animation/sequence.d.ts +0 -0
  145. package/lib/types/{lib/reanimated2 → reanimated2}/animation/spring.d.ts +0 -0
  146. package/lib/types/{lib/reanimated2 → reanimated2}/animation/styleAnimation.d.ts +0 -0
  147. package/lib/types/{lib/reanimated2 → reanimated2}/animation/timing.d.ts +0 -0
  148. package/lib/types/{lib/reanimated2 → reanimated2}/animation/util.d.ts +0 -0
  149. package/lib/types/{lib/reanimated2 → reanimated2}/commonTypes.d.ts +20 -0
  150. package/lib/types/{lib/reanimated2 → reanimated2}/component/FlatList.d.ts +2 -2
  151. package/lib/types/{lib/reanimated2 → reanimated2}/component/Image.d.ts +0 -0
  152. package/lib/types/{lib/reanimated2 → reanimated2}/component/ScrollView.d.ts +0 -0
  153. package/lib/types/{lib/reanimated2 → reanimated2}/component/Text.d.ts +0 -0
  154. package/lib/types/{lib/reanimated2 → reanimated2}/component/View.d.ts +0 -0
  155. package/lib/types/{lib/reanimated2 → reanimated2}/core.d.ts +0 -0
  156. package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +8 -0
  157. package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +6 -0
  158. package/lib/types/{lib/reanimated2 → reanimated2}/hook/Hooks.d.ts +0 -0
  159. package/lib/types/{lib/reanimated2 → reanimated2}/hook/commonTypes.d.ts +0 -0
  160. package/lib/types/{lib/reanimated2 → reanimated2}/hook/index.d.ts +4 -0
  161. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
  162. package/lib/types/reanimated2/hook/useAnimatedKeyboard.d.ts +2 -0
  163. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
  164. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedRef.d.ts +0 -0
  165. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.d.ts +1 -2
  166. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedSensor.d.ts +1 -1
  167. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
  168. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useDerivedValue.d.ts +0 -0
  169. package/lib/types/reanimated2/hook/useFrameCallback.d.ts +7 -0
  170. package/lib/types/reanimated2/hook/useScrollViewOffset.d.ts +4 -0
  171. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useSharedValue.d.ts +0 -0
  172. package/lib/types/{lib/reanimated2 → reanimated2}/hook/utils.d.ts +0 -0
  173. package/lib/types/{lib/reanimated2 → reanimated2}/index.d.ts +0 -0
  174. package/lib/types/{lib/reanimated2 → reanimated2}/interpolateColor.d.ts +0 -0
  175. package/lib/types/{lib/reanimated2 → reanimated2}/interpolation.d.ts +0 -0
  176. package/lib/types/{lib/reanimated2 → reanimated2}/jestUtils.d.ts +1 -1
  177. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/JSReanimated.d.ts +3 -1
  178. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/Mapper.d.ts +0 -0
  179. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
  180. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
  181. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
  182. package/lib/types/reanimated2/js-reanimated/global.d.ts +2 -0
  183. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/index.d.ts +0 -0
  184. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
  185. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
  186. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
  187. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
  188. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -0
  189. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
  190. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
  191. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
  192. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
  193. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
  194. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
  195. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
  196. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
  197. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
  198. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
  199. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
  200. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
  201. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
  202. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
  203. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
  204. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
  205. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
  206. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
  207. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
  208. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
  209. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/index.d.ts +0 -0
  210. package/lib/types/{lib/reanimated2 → reanimated2}/mock.d.ts +0 -0
  211. package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
  212. package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  213. package/lib/types/{lib/reanimated2 → reanimated2}/utils.d.ts +5 -1
  214. package/lib/types/{lib/setAndForwardRef.d.ts → setAndForwardRef.d.ts} +0 -0
  215. package/mock.js +1 -0
  216. package/package.json +8 -8
  217. package/plugin.js +8 -17
  218. package/react-native-reanimated.d.ts +67 -12
  219. package/scripts/reanimated_utils.rb +65 -0
  220. package/src/index.ts +11 -3
  221. package/src/index.web.ts +7 -0
  222. package/src/reanimated2/Colors.ts +1 -1
  223. package/src/reanimated2/NativeMethods.ts +47 -30
  224. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +9 -0
  225. package/src/reanimated2/animation/util.ts +8 -1
  226. package/src/reanimated2/commonTypes.ts +24 -0
  227. package/src/reanimated2/component/FlatList.tsx +29 -19
  228. package/src/reanimated2/core.ts +8 -8
  229. package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +40 -0
  230. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +115 -0
  231. package/src/reanimated2/globals.d.ts +5 -2
  232. package/src/reanimated2/hook/index.ts +4 -0
  233. package/src/reanimated2/hook/useAnimatedKeyboard.ts +35 -0
  234. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
  235. package/src/reanimated2/hook/useAnimatedSensor.ts +5 -5
  236. package/src/reanimated2/hook/useFrameCallback.ts +40 -0
  237. package/src/reanimated2/hook/useScrollViewOffset.ts +36 -0
  238. package/src/reanimated2/jestUtils.ts +11 -3
  239. package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
  240. package/src/reanimated2/js-reanimated/global.ts +41 -29
  241. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
  242. package/src/reanimated2/utils.ts +12 -5
  243. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  244. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  245. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  246. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  247. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  248. package/android/.gradle/checksums/checksums.lock +0 -0
  249. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  250. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  251. package/android/react-native-reanimated-65-hermes.aar +0 -0
  252. package/android/react-native-reanimated-65-jsc.aar +0 -0
  253. package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
  254. package/lib/reanimated2/__mocks__/NativeReanimated.native.js +0 -20
  255. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +0 -13
  256. package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -1
  257. package/lib/types/react-native-reanimated-tests.d.ts +0 -1
@@ -11,10 +11,13 @@ if (global._setGlobalConsole === undefined) {
11
11
  const testWorklet = () => {
12
12
  'worklet';
13
13
  };
14
+ const throwUninitializedReanimatedException = () => {
15
+ throw new Error("Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache");
16
+ };
14
17
  export const checkPluginState = (throwError = true) => {
15
18
  if (!testWorklet.__workletHash && !shouldBeUseWeb()) {
16
19
  if (throwError) {
17
- throw new Error("Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?");
20
+ throwUninitializedReanimatedException();
18
21
  }
19
22
  return false;
20
23
  }
@@ -24,9 +27,7 @@ export const isConfigured = (throwError = false) => {
24
27
  return checkPluginState(throwError);
25
28
  };
26
29
  export const isConfiguredCheck = () => {
27
- if (!isConfigured(true)) {
28
- throw new Error('If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation');
29
- }
30
+ checkPluginState(true);
30
31
  };
31
32
  function pushFrame(frame) {
32
33
  NativeReanimatedModule.pushFrame(frame);
@@ -0,0 +1,32 @@
1
+ import { runOnUI } from '../core';
2
+ import { prepareUIRegistry } from './FrameCallbackRegistryUI';
3
+ export default class FrameCallbackRegistryJS {
4
+ constructor() {
5
+ this.nextCallbackId = 0;
6
+ prepareUIRegistry();
7
+ }
8
+ registerFrameCallback(callback) {
9
+ if (!callback) {
10
+ return -1;
11
+ }
12
+ const callbackId = this.nextCallbackId;
13
+ this.nextCallbackId++;
14
+ runOnUI(() => {
15
+ 'worklet';
16
+ global._frameCallbackRegistry.registerFrameCallback(callback, callbackId);
17
+ })();
18
+ return callbackId;
19
+ }
20
+ unregisterFrameCallback(callbackId) {
21
+ runOnUI(() => {
22
+ 'worklet';
23
+ global._frameCallbackRegistry.unregisterFrameCallback(callbackId);
24
+ })();
25
+ }
26
+ manageStateFrameCallback(callbackId, state) {
27
+ runOnUI(() => {
28
+ 'worklet';
29
+ global._frameCallbackRegistry.manageStateFrameCallback(callbackId, state);
30
+ })();
31
+ }
32
+ }
@@ -0,0 +1,76 @@
1
+ import { runOnUI } from '../core';
2
+ export const prepareUIRegistry = runOnUI(() => {
3
+ 'worklet';
4
+ const frameCallbackRegistry = {
5
+ frameCallbackRegistry: new Map(),
6
+ activeFrameCallbacks: new Set(),
7
+ previousFrameTimestamp: null,
8
+ runCallbacks() {
9
+ const loop = (timestamp) => {
10
+ if (this.previousFrameTimestamp === null) {
11
+ this.previousFrameTimestamp = timestamp;
12
+ }
13
+ const delta = timestamp - this.previousFrameTimestamp;
14
+ this.activeFrameCallbacks.forEach((callbackId) => {
15
+ const callbackDetails = this.frameCallbackRegistry.get(callbackId);
16
+ const { startTime } = callbackDetails;
17
+ if (startTime === null) {
18
+ // First frame
19
+ callbackDetails.startTime = timestamp;
20
+ callbackDetails.callback({
21
+ timestamp,
22
+ timeSincePreviousFrame: null,
23
+ timeSinceFirstFrame: 0,
24
+ });
25
+ }
26
+ else {
27
+ // Next frame
28
+ callbackDetails.callback({
29
+ timestamp,
30
+ timeSincePreviousFrame: delta,
31
+ timeSinceFirstFrame: timestamp - startTime,
32
+ });
33
+ }
34
+ });
35
+ if (this.activeFrameCallbacks.size > 0) {
36
+ this.previousFrameTimestamp = timestamp;
37
+ requestAnimationFrame(loop);
38
+ }
39
+ else {
40
+ this.previousFrameTimestamp = null;
41
+ }
42
+ };
43
+ // runCallback() should only be called after registering a callback,
44
+ // so if there is only one active callback, then it means that there were
45
+ // zero previously and the loop isn't running yet.
46
+ if (this.activeFrameCallbacks.size === 1) {
47
+ requestAnimationFrame(loop);
48
+ }
49
+ },
50
+ registerFrameCallback(callback, callbackId) {
51
+ this.frameCallbackRegistry.set(callbackId, {
52
+ callback: callback,
53
+ startTime: null,
54
+ });
55
+ },
56
+ unregisterFrameCallback(callbackId) {
57
+ this.manageStateFrameCallback(callbackId, false);
58
+ this.frameCallbackRegistry.delete(callbackId);
59
+ },
60
+ manageStateFrameCallback(callbackId, state) {
61
+ if (callbackId === -1) {
62
+ return;
63
+ }
64
+ if (state) {
65
+ this.activeFrameCallbacks.add(callbackId);
66
+ this.runCallbacks();
67
+ }
68
+ else {
69
+ const callback = this.frameCallbackRegistry.get(callbackId);
70
+ callback.startTime = null;
71
+ this.activeFrameCallbacks.delete(callbackId);
72
+ }
73
+ },
74
+ };
75
+ global._frameCallbackRegistry = frameCallbackRegistry;
76
+ });
@@ -1,5 +1,6 @@
1
1
  import { AnimatedStyle, StyleProps } from './commonTypes';
2
2
  import { ReanimatedConsole } from './core';
3
+ import FrameCallbackRegistryUI from './frameCallback/FrameCallbackRegistryUI';
3
4
  import { MeasuredDimensions } from './NativeMethods';
4
5
  import { NativeReanimated } from './NativeReanimated/NativeReanimated';
5
6
  declare global {
@@ -19,7 +20,7 @@ declare global {
19
20
  name: string,
20
21
  updates: StyleProps | AnimatedStyle
21
22
  ) => void;
22
- const _measure: (viewTag: number) => MeasuredDimensions;
23
+ const _measure: (viewTag: number) => MeasuredDimensions | null;
23
24
  const _scrollTo: (
24
25
  viewTag: number,
25
26
  x: number,
@@ -30,6 +31,7 @@ declare global {
30
31
  const ReanimatedDataMock: {
31
32
  now: () => number;
32
33
  };
34
+ const _frameCallbackRegistry: FrameCallbackRegistryUI;
33
35
  namespace NodeJS {
34
36
  interface Global {
35
37
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
@@ -38,7 +40,7 @@ declare global {
38
40
  _WORKLET: boolean;
39
41
  __reanimatedModuleProxy: NativeReanimated;
40
42
  _frameTimestamp: number | null;
41
- _measure: () => MeasuredDimensions;
43
+ _measure: () => MeasuredDimensions | null;
42
44
  _scrollTo: () => void;
43
45
  _chronoNow: () => number;
44
46
  performance: { now: () => number };
@@ -55,6 +57,7 @@ declare global {
55
57
  ReanimatedDataMock: {
56
58
  now: () => number;
57
59
  };
60
+ _frameCallbackRegistry: FrameCallbackRegistryUI;
58
61
  }
59
62
  }
60
63
  }
@@ -7,3 +7,6 @@ export { useAnimatedRef } from './useAnimatedRef';
7
7
  export { useAnimatedScrollHandler, } from './useAnimatedScrollHandler';
8
8
  export { useDerivedValue } from './useDerivedValue';
9
9
  export { useAnimatedSensor, SensorType } from './useAnimatedSensor';
10
+ export { useFrameCallback } from './useFrameCallback';
11
+ export { useAnimatedKeyboard } from './useAnimatedKeyboard';
12
+ export { useScrollViewOffset } from './useScrollViewOffset';
@@ -0,0 +1,31 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import NativeReanimated from '../NativeReanimated';
3
+ import { makeMutable } from '../core';
4
+ import { KeyboardState } from '../commonTypes';
5
+ export function useAnimatedKeyboard() {
6
+ const ref = useRef(null);
7
+ const listenerId = useRef(-1);
8
+ const isSubscribed = useRef(false);
9
+ if (ref.current === null) {
10
+ const keyboardEventData = {
11
+ state: makeMutable(KeyboardState.UNKNOWN),
12
+ height: makeMutable(0),
13
+ };
14
+ listenerId.current =
15
+ NativeReanimated.subscribeForKeyboardEvents(keyboardEventData);
16
+ ref.current = keyboardEventData;
17
+ isSubscribed.current = true;
18
+ }
19
+ useEffect(() => {
20
+ if (isSubscribed.current === false && ref.current !== null) {
21
+ // subscribe again after Fast Refresh
22
+ listenerId.current = NativeReanimated.subscribeForKeyboardEvents(ref.current);
23
+ isSubscribed.current = true;
24
+ }
25
+ return () => {
26
+ NativeReanimated.unsubscribeFromKeyboardEvents(listenerId.current);
27
+ isSubscribed.current = false;
28
+ };
29
+ }, []);
30
+ return ref.current;
31
+ }
@@ -21,7 +21,7 @@ export function useAnimatedSensor(sensorType, userConfig) {
21
21
  },
22
22
  });
23
23
  if (ref.current.sensor === null) {
24
- ref.current.config = Object.assign({ interval: 10 }, userConfig);
24
+ ref.current.config = Object.assign({ interval: 'auto' }, userConfig);
25
25
  let sensorData;
26
26
  if (sensorType === SensorType.ROTATION) {
27
27
  sensorData = {
@@ -44,8 +44,8 @@ export function useAnimatedSensor(sensorType, userConfig) {
44
44
  ref.current.sensor = makeMutable(sensorData);
45
45
  }
46
46
  useEffect(() => {
47
- ref.current.config = Object.assign({ interval: 10 }, userConfig);
48
- const id = NativeReanimated.registerSensor(sensorType, ref.current.config.interval, ref.current.sensor);
47
+ ref.current.config = Object.assign({ interval: 'auto' }, userConfig);
48
+ const id = NativeReanimated.registerSensor(sensorType, ref.current.config.interval === 'auto' ? -1 : ref.current.config.interval, ref.current.sensor);
49
49
  if (id !== -1) {
50
50
  // if sensor is available
51
51
  ref.current.unregister = () => NativeReanimated.unregisterSensor(id);
@@ -0,0 +1,23 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import FrameCallbackRegistryJS from '../frameCallback/FrameCallbackRegistryJS';
3
+ const frameCallbackRegistry = new FrameCallbackRegistryJS();
4
+ export function useFrameCallback(callback, autostart = true) {
5
+ const ref = useRef({
6
+ setActive: (isActive) => {
7
+ frameCallbackRegistry.manageStateFrameCallback(ref.current.callbackId, isActive);
8
+ ref.current.isActive = isActive;
9
+ },
10
+ isActive: autostart,
11
+ callbackId: -1,
12
+ });
13
+ useEffect(() => {
14
+ ref.current.callbackId =
15
+ frameCallbackRegistry.registerFrameCallback(callback);
16
+ ref.current.setActive(ref.current.isActive);
17
+ return () => {
18
+ frameCallbackRegistry.unregisterFrameCallback(ref.current.callbackId);
19
+ ref.current.callbackId = -1;
20
+ };
21
+ }, [callback, autostart]);
22
+ return ref.current;
23
+ }
@@ -0,0 +1,26 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { findNodeHandle } from 'react-native';
3
+ import { useEvent, useSharedValue } from '.';
4
+ const subscribeForEvents = [
5
+ 'onScroll',
6
+ 'onScrollBeginDrag',
7
+ 'onScrollEndDrag',
8
+ 'onMomentumScrollBegin',
9
+ 'onMomentumScrollEnd',
10
+ ];
11
+ export function useScrollViewOffset(aref) {
12
+ const offsetRef = useRef(useSharedValue(0));
13
+ const event = useEvent((event) => {
14
+ 'worklet';
15
+ offsetRef.current.value =
16
+ event.contentOffset.x === 0
17
+ ? event.contentOffset.y
18
+ : event.contentOffset.x;
19
+ }, subscribeForEvents);
20
+ useEffect(() => {
21
+ var _a;
22
+ const viewTag = findNodeHandle(aref.current);
23
+ (_a = event.current) === null || _a === void 0 ? void 0 : _a.registerForEvents(viewTag);
24
+ }, [aref.current]);
25
+ return offsetRef.current;
26
+ }
@@ -127,9 +127,9 @@ const tickTravel = () => {
127
127
  currentTimestamp += frameTime;
128
128
  jest.advanceTimersByTime(frameTime);
129
129
  };
130
- export const withReanimatedTimer = (animatonTest) => {
130
+ export const withReanimatedTimer = (animationTest) => {
131
131
  beforeTest();
132
- animatonTest();
132
+ animationTest();
133
133
  afterTest();
134
134
  };
135
135
  export const advanceAnimationByTime = (time = frameTime) => {
@@ -145,7 +145,15 @@ export const advanceAnimationByFrame = (count) => {
145
145
  jest.advanceTimersByTime(frameTime);
146
146
  };
147
147
  export const setUpTests = (userConfig = {}) => {
148
- const expect = require('expect');
148
+ let expect;
149
+ try {
150
+ expect = require('expect');
151
+ }
152
+ catch (_) {
153
+ // for Jest in version 28+
154
+ const { expect: expectModule } = require('@jest/globals');
155
+ expect = expectModule;
156
+ }
149
157
  require('setimmediate');
150
158
  frameTime = Math.round(1000 / config.fps);
151
159
  config = Object.assign(Object.assign({}, config), userConfig);
@@ -96,4 +96,11 @@ export default class JSReanimated extends NativeReanimated {
96
96
  throw Error('This method can be only use in Jest testing.');
97
97
  }
98
98
  }
99
+ subscribeForKeyboardEvents(_) {
100
+ console.warn('[Reanimated] useAnimatedKeyboard is not available on web yet.');
101
+ return -1;
102
+ }
103
+ unsubscribeFromKeyboardEvents(_) {
104
+ // noop
105
+ }
99
106
  }
@@ -1,25 +1,36 @@
1
1
  // In order to keep bundle size down, we treat this file as a polyfill for Web.
2
2
  import { shouldBeUseWeb } from '../PlatformChecker';
3
- if (shouldBeUseWeb()) {
4
- global._frameTimestamp = null;
5
- global._setGlobalConsole = (_val) => {
6
- // noop
7
- };
8
- global._measure = () => {
9
- console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
10
- return {
11
- x: 0,
12
- y: 0,
13
- width: 0,
14
- height: 0,
15
- pageX: 0,
16
- pageY: 0,
3
+ const initializeGlobalsForWeb = () => {
4
+ if (shouldBeUseWeb()) {
5
+ global._frameTimestamp = null;
6
+ global._setGlobalConsole = (_val) => {
7
+ // noop
17
8
  };
18
- };
19
- global._scrollTo = () => {
20
- console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
21
- };
22
- global._setGestureState = () => {
23
- console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
24
- };
25
- }
9
+ global._measure = () => {
10
+ console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
11
+ return {
12
+ x: 0,
13
+ y: 0,
14
+ width: 0,
15
+ height: 0,
16
+ pageX: 0,
17
+ pageY: 0,
18
+ };
19
+ };
20
+ global._scrollTo = () => {
21
+ console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
22
+ };
23
+ global._setGestureState = () => {
24
+ console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
25
+ };
26
+ }
27
+ return true;
28
+ };
29
+ /*
30
+ If a file doesn't export anything, tree shaking doesn't pack
31
+ it into the JS bundle. In effect, the code inside of this file
32
+ will never execute. That is why we wrapped initialization code
33
+ into a function, and we call this one during creating
34
+ the module export object.
35
+ */
36
+ export default initializeGlobalsForWeb();
@@ -5,7 +5,7 @@ import { ColorProperties } from '../UpdateProps';
5
5
  import { processColor } from '../Colors';
6
6
  runOnUI(() => {
7
7
  'worklet';
8
- const configs = {};
8
+ const configs = Object.create(null);
9
9
  const enteringAnimationForTag = {};
10
10
  global.LayoutAnimationRepository = {
11
11
  configs,
@@ -1,9 +1,16 @@
1
1
  import { measure } from './NativeMethods';
2
- export function getRelativeCoords(parentRef, x, y) {
2
+ /**
3
+ * Given an absolute position and a component ref, returns the relative
4
+ * position in the component's local coordinate space.
5
+ */
6
+ export function getRelativeCoords(parentRef, absoluteX, absoluteY) {
3
7
  'worklet';
4
8
  const parentCoords = measure(parentRef);
9
+ if (parentCoords === null) {
10
+ return null;
11
+ }
5
12
  return {
6
- x: x - parentCoords.x,
7
- y: y - parentCoords.y,
13
+ x: absoluteX - parentCoords.x,
14
+ y: absoluteY - parentCoords.y,
8
15
  };
9
16
  }
File without changes
@@ -0,0 +1,4 @@
1
+ import * as Animated from './Animated';
2
+ export * from './reanimated1';
3
+ export * from './reanimated2';
4
+ export default Animated;
File without changes
@@ -1,14 +1,7 @@
1
1
  import { Component } from 'react';
2
- import { RefObjectFunction } from './commonTypes';
2
+ import { MeasuredDimensions } from './commonTypes';
3
+ import { RefObjectFunction } from './hook/commonTypes';
3
4
  export declare function getTag(view: null | number | React.Component<any, any> | React.ComponentClass<any>): null | number;
4
- export interface MeasuredDimensions {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- pageX: number;
10
- pageY: number;
11
- }
12
- export declare function measure(animatedRef: RefObjectFunction<Component>): MeasuredDimensions;
5
+ export declare function measure(animatedRef: RefObjectFunction<Component>): MeasuredDimensions | null;
13
6
  export declare function scrollTo(animatedRef: RefObjectFunction<Component>, x: number, y: number, animated: boolean): void;
14
7
  export declare function setGestureState(handlerTag: number, newState: number): void;
@@ -1,4 +1,4 @@
1
- import { SharedValue, SensorValue3D, SensorValueRotation } from '../commonTypes';
1
+ import { SharedValue, SensorValue3D, SensorValueRotation, AnimatedKeyboardInfo } from '../commonTypes';
2
2
  import { Descriptor } from '../hook/commonTypes';
3
3
  export declare class NativeReanimated {
4
4
  native: boolean;
@@ -17,4 +17,6 @@ export declare class NativeReanimated {
17
17
  getViewProp<T>(viewTag: string, propName: string, callback?: (result: T) => void): Promise<T>;
18
18
  enableLayoutAnimations(flag: boolean): void;
19
19
  configureProps(uiProps: string[], nativeProps: string[]): void;
20
+ subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number;
21
+ unsubscribeFromKeyboardEvents(listenerId: number): void;
20
22
  }
@@ -77,3 +77,23 @@ export declare type ValueRotation = {
77
77
  roll: number;
78
78
  };
79
79
  export declare type SensorValueRotation = SharedValue<ValueRotation>;
80
+ export declare type ShadowNodeWrapper = object;
81
+ export declare enum KeyboardState {
82
+ UNKNOWN = 0,
83
+ OPENING = 1,
84
+ OPEN = 2,
85
+ CLOSING = 3,
86
+ CLOSED = 4
87
+ }
88
+ export declare type AnimatedKeyboardInfo = {
89
+ height: SharedValue<number>;
90
+ state: SharedValue<KeyboardState>;
91
+ };
92
+ export interface MeasuredDimensions {
93
+ x: number;
94
+ y: number;
95
+ width: number;
96
+ height: number;
97
+ pageX: number;
98
+ pageY: number;
99
+ }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { FlatListProps } from 'react-native';
3
3
  import { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';
4
- export interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
4
+ export interface ReanimatedFlatListProps<ItemT> extends FlatListProps<ItemT> {
5
5
  itemLayoutAnimation?: ILayoutAnimationBuilder;
6
6
  }
7
- declare type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatlistProps<T>>;
7
+ declare type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatListProps<T>>;
8
8
  declare const ReanimatedFlatlist: ReanimatedFlatListFC;
9
9
  export default ReanimatedFlatlist;
@@ -0,0 +1,8 @@
1
+ import { FrameInfo } from './FrameCallbackRegistryUI';
2
+ export default class FrameCallbackRegistryJS {
3
+ private nextCallbackId;
4
+ constructor();
5
+ registerFrameCallback(callback: (frameInfo: FrameInfo) => void): number;
6
+ unregisterFrameCallback(callbackId: number): void;
7
+ manageStateFrameCallback(callbackId: number, state: boolean): void;
8
+ }
@@ -0,0 +1,6 @@
1
+ export declare type FrameInfo = {
2
+ timestamp: number;
3
+ timeSincePreviousFrame: number | null;
4
+ timeSinceFirstFrame: number;
5
+ };
6
+ export declare const prepareUIRegistry: () => void;
@@ -8,3 +8,7 @@ export { useAnimatedRef } from './useAnimatedRef';
8
8
  export { useAnimatedScrollHandler, ScrollHandler, ScrollHandlers, } from './useAnimatedScrollHandler';
9
9
  export { useDerivedValue, DerivedValue } from './useDerivedValue';
10
10
  export { useAnimatedSensor, SensorType } from './useAnimatedSensor';
11
+ export { useFrameCallback } from './useFrameCallback';
12
+ export type { FrameCallback } from './useFrameCallback';
13
+ export { useAnimatedKeyboard } from './useAnimatedKeyboard';
14
+ export { useScrollViewOffset } from './useScrollViewOffset';
@@ -0,0 +1,2 @@
1
+ import { AnimatedKeyboardInfo } from '../commonTypes';
2
+ export declare function useAnimatedKeyboard(): AnimatedKeyboardInfo;