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
@@ -6,7 +6,7 @@ import { Context, DependencyList } from './commonTypes';
6
6
  export interface ScrollHandler<TContext extends Context> extends WorkletFunction {
7
7
  (event: NativeScrollEvent, context?: TContext): void;
8
8
  }
9
- interface ScrollEvent extends NativeScrollEvent, NativeEvent<ScrollEvent> {
9
+ export interface ScrollEvent extends NativeScrollEvent, NativeEvent<ScrollEvent> {
10
10
  eventName: string;
11
11
  }
12
12
  export interface ScrollHandlers<TContext extends Context> {
@@ -18,4 +18,3 @@ export interface ScrollHandlers<TContext extends Context> {
18
18
  onMomentumEnd?: ScrollHandler<TContext>;
19
19
  }
20
20
  export declare function useAnimatedScrollHandler<TContext extends Context>(handlers: ScrollHandlers<TContext> | ScrollHandler<TContext>, dependencies?: DependencyList): RefObject<WorkletEventHandler<ScrollEvent>>;
21
- export {};
@@ -7,7 +7,7 @@ export declare enum SensorType {
7
7
  ROTATION = 5
8
8
  }
9
9
  export declare type SensorConfig = {
10
- interval: number;
10
+ interval: number | 'auto';
11
11
  };
12
12
  export declare type AnimatedSensor = {
13
13
  sensor: SensorValue3D | SensorValueRotation | null;
@@ -0,0 +1,7 @@
1
+ import { FrameInfo } from '../frameCallback/FrameCallbackRegistryUI';
2
+ export declare type FrameCallback = {
3
+ setActive: (isActive: boolean) => void;
4
+ isActive: boolean;
5
+ callbackId: number;
6
+ };
7
+ export declare function useFrameCallback(callback: (frameInfo: FrameInfo) => void, autostart?: boolean): FrameCallback;
@@ -0,0 +1,4 @@
1
+ import { RefObject } from 'react';
2
+ import type Animated from 'react-native-reanimated';
3
+ import { SharedValue } from '../commonTypes';
4
+ export declare function useScrollViewOffset(aref: RefObject<Animated.ScrollView>): SharedValue<number>;
@@ -5,7 +5,7 @@ declare global {
5
5
  }
6
6
  }
7
7
  }
8
- export declare const withReanimatedTimer: (animatonTest: any) => void;
8
+ export declare const withReanimatedTimer: (animationTest: any) => void;
9
9
  export declare const advanceAnimationByTime: (time?: number) => void;
10
10
  export declare const advanceAnimationByFrame: (count: any) => void;
11
11
  export declare const setUpTests: (userConfig?: {}) => void;
@@ -1,7 +1,7 @@
1
1
  import MapperRegistry from './MapperRegistry';
2
2
  import MutableValue from './MutableValue';
3
3
  import { NativeReanimated } from '../NativeReanimated/NativeReanimated';
4
- import { Timestamp, NestedObjectValues } from '../commonTypes';
4
+ import { Timestamp, NestedObjectValues, AnimatedKeyboardInfo } from '../commonTypes';
5
5
  export default class JSReanimated extends NativeReanimated {
6
6
  _valueSetter?: <T>(value: T) => void;
7
7
  _renderRequested: boolean;
@@ -27,4 +27,6 @@ export default class JSReanimated extends NativeReanimated {
27
27
  registerSensor(): number;
28
28
  unregisterSensor(): void;
29
29
  jestResetModule(): void;
30
+ subscribeForKeyboardEvents(_: AnimatedKeyboardInfo): number;
31
+ unsubscribeFromKeyboardEvents(_: number): void;
30
32
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: boolean;
2
+ export default _default;
@@ -4,4 +4,8 @@ export interface ComponentCoords {
4
4
  x: number;
5
5
  y: number;
6
6
  }
7
- export declare function getRelativeCoords(parentRef: RefObjectFunction<Component>, x: number, y: number): ComponentCoords;
7
+ /**
8
+ * Given an absolute position and a component ref, returns the relative
9
+ * position in the component's local coordinate space.
10
+ */
11
+ export declare function getRelativeCoords(parentRef: RefObjectFunction<Component>, absoluteX: number, absoluteY: number): ComponentCoords | null;
package/mock.js CHANGED
@@ -102,6 +102,7 @@ const Reanimated = {
102
102
  Text,
103
103
  Image,
104
104
  ScrollView: Animated.ScrollView,
105
+ FlatList: Animated.FlatList,
105
106
  Code,
106
107
 
107
108
  Clock: NOOP,
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "2.9.1",
3
+ "version": "2.11.0",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
- "start": "node node_modules/react-native/local-cli/cli.js start",
7
6
  "test": "yarn run format:js && yarn run lint:js && yarn run test:unit",
8
7
  "test:unit": "jest",
9
8
  "lint": "yarn lint:js && yarn lint:cpp && yarn lint:java",
@@ -51,6 +50,7 @@
51
50
  "!ios/build/",
52
51
  "!android/build/",
53
52
  "RNReanimated.podspec",
53
+ "scripts/reanimated_utils.rb",
54
54
  "README.md",
55
55
  "react-native-reanimated.d.ts",
56
56
  "mock.js",
@@ -74,7 +74,6 @@
74
74
  },
75
75
  "homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
76
76
  "dependencies": {
77
- "@babel/plugin-proposal-export-namespace-from": "^7.17.12",
78
77
  "@babel/plugin-transform-object-assign": "^7.16.7",
79
78
  "@babel/preset-typescript": "^7.16.7",
80
79
  "@types/invariant": "^2.2.35",
@@ -95,14 +94,14 @@
95
94
  "@react-native-community/bob": "^0.17.1",
96
95
  "@react-native-community/eslint-config": "^0.0.5",
97
96
  "@testing-library/jest-native": "^4.0.4",
98
- "@testing-library/react-hooks": "^5.0.3",
97
+ "@testing-library/react-hooks": "^8.0.0",
99
98
  "@testing-library/react-native": "^7.1.0",
100
99
  "@types/babel-types": "^7.0.11",
101
100
  "@types/babel__core": "^7.1.18",
102
101
  "@types/babel__generator": "^7.6.4",
103
102
  "@types/babel__traverse": "^7.14.2",
104
103
  "@types/jest": "^27.4.0",
105
- "@types/react-native": "^0.66.15",
104
+ "@types/react-native": "^0.69.5",
106
105
  "@typescript-eslint/eslint-plugin": "^5.11.0",
107
106
  "@typescript-eslint/parser": "^5.11.0",
108
107
  "babel-eslint": "^10.1.0",
@@ -122,11 +121,12 @@
122
121
  "lint-staged": "^11.2.0",
123
122
  "madge": "^5.0.1",
124
123
  "prettier": "^2.5.1",
125
- "react": "18.0.0",
126
- "react-native": "0.69.1",
124
+ "react": "17.0.2",
125
+ "react-native": "0.70.2",
126
+ "react-native-builder-bob": "^0.18.3",
127
127
  "react-native-codegen": "^0.0.7",
128
128
  "react-native-gesture-handler": "^1.6.1",
129
- "react-test-renderer": "18.0.0",
129
+ "react-test-renderer": "17.0.2",
130
130
  "release-it": "^13.7.2",
131
131
  "typescript": "^4.1.3"
132
132
  },
package/plugin.js CHANGED
@@ -7,6 +7,7 @@ const { transformSync } = require('@babel/core');
7
7
  * holds a map of function names as keys and array of argument indexes as values which should be automatically workletized(they have to be functions)(starting from 0)
8
8
  */
9
9
  const functionArgsToWorkletize = new Map([
10
+ ['useFrameCallback', [0]],
10
11
  ['useAnimatedStyle', [0]],
11
12
  ['useAnimatedProps', [0]],
12
13
  ['createAnimatedPropAdapter', [0]],
@@ -305,13 +306,14 @@ function buildWorkletString(t, fun, closureVariables, name) {
305
306
  },
306
307
  });
307
308
 
309
+ const expression = fun.program.body.find(
310
+ ({ type }) => type === 'ExpressionStatement'
311
+ ).expression;
312
+
308
313
  const workletFunction = t.functionExpression(
309
314
  t.identifier(name),
310
- fun.program.body[0].expression.params,
311
- prependClosureVariablesIfNecessary(
312
- closureVariables,
313
- fun.program.body[0].expression.body
314
- )
315
+ expression.params,
316
+ prependClosureVariablesIfNecessary(closureVariables, expression.body)
315
317
  );
316
318
 
317
319
  return generate(workletFunction, { compact: true }).code;
@@ -445,7 +447,7 @@ function makeWorklet(t, fun, state) {
445
447
  const workletHash = hash(funString);
446
448
 
447
449
  let location = state.file.opts.filename;
448
- if (state.opts.relativeSourceLocation) {
450
+ if (state.opts && state.opts.relativeSourceLocation) {
449
451
  const path = require('path');
450
452
  location = path.relative(state.cwd, location);
451
453
  }
@@ -756,16 +758,6 @@ function isPossibleOptimization(fun) {
756
758
  return flags;
757
759
  }
758
760
 
759
- const pluginProposalExportNamespaceFrom =
760
- require('@babel/plugin-proposal-export-namespace-from').default;
761
- const apiMock = {
762
- assertVersion: () => {
763
- // do nothing.
764
- },
765
- };
766
- const ExportNamedDeclarationFn =
767
- pluginProposalExportNamespaceFrom(apiMock).visitor.ExportNamedDeclaration;
768
-
769
761
  module.exports = function ({ types: t }) {
770
762
  return {
771
763
  pre() {
@@ -788,7 +780,6 @@ module.exports = function ({ types: t }) {
788
780
  processIfGestureHandlerEventCallbackFunctionNode(t, path, state);
789
781
  },
790
782
  },
791
- ExportNamedDeclaration: ExportNamedDeclarationFn,
792
783
  },
793
784
  };
794
785
  };
@@ -54,6 +54,8 @@ declare module 'react-native-reanimated' {
54
54
  import('./lib/types/lib/reanimated2/animation/index').StyleLayoutAnimation;
55
55
  export type Animation<T> =
56
56
  import('./lib/types/lib/reanimated2/commonTypes').Animation<T>;
57
+ export type MeasuredDimensions =
58
+ import('./lib/types/lib/reanimated2/commonTypes').MeasuredDimensions;
57
59
 
58
60
  namespace Animated {
59
61
  type Nullable<T> = T | null | undefined;
@@ -495,20 +497,80 @@ declare module 'react-native-reanimated' {
495
497
  }
496
498
 
497
499
  export type SensorConfig = {
498
- interval: number;
500
+ interval: number | 'auto';
499
501
  };
500
502
 
501
- export type AnimatedSensor = {
502
- sensor: SensorValue3D | SensorValueRotation | null;
503
+ export type Value3D = {
504
+ x: number;
505
+ y: number;
506
+ z: number;
507
+ };
508
+
509
+ export type SensorValue3D = SharedValue<Value3D>;
510
+
511
+ export type ValueRotation = {
512
+ qw: number;
513
+ qx: number;
514
+ qy: number;
515
+ qz: number;
516
+ yaw: number;
517
+ pitch: number;
518
+ roll: number;
519
+ };
520
+
521
+ export type SensorValueRotation = SharedValue<ValueRotation>;
522
+
523
+ export type AnimatedSensor<SensorValueType> = {
524
+ sensor: SensorValueType;
503
525
  unregister: () => void;
504
526
  isAvailable: boolean;
505
527
  config: SensorConfig;
506
528
  };
507
529
 
530
+ export function useAnimatedSensor(
531
+ sensorType: SensorType.ROTATION,
532
+ userConfig?: SensorConfig
533
+ ): AnimatedSensor<SensorValueRotation>;
534
+ export function useAnimatedSensor(
535
+ sensorType: Exclude<SensorType, SensorType.ROTATION>,
536
+ userConfig?: SensorConfig
537
+ ): AnimatedSensor<SensorValue3D>;
508
538
  export function useAnimatedSensor(
509
539
  sensorType: SensorType,
510
540
  userConfig?: SensorConfig
511
- ): AnimatedSensor;
541
+ ): AnimatedSensor<any>;
542
+
543
+ export type FrameCallback = {
544
+ setActive: (isActive: boolean) => void;
545
+ isActive: boolean;
546
+ callbackId: number;
547
+ };
548
+ export type FrameInfo = {
549
+ timestamp: number;
550
+ timeSincePreviousFrame: number | null;
551
+ timeSinceFirstFrame: number;
552
+ };
553
+ export function useFrameCallback(
554
+ callback: (frameInfo: FrameInfo) => void,
555
+ autostart?: boolean
556
+ ): FrameCallback;
557
+
558
+ export enum KeyboardState {
559
+ UNKNOWN = 0,
560
+ OPENING = 1,
561
+ OPEN = 2,
562
+ CLOSING = 3,
563
+ CLOSED = 4,
564
+ }
565
+ export type AnimatedKeyboardInfo = {
566
+ height: SharedValue<number>;
567
+ state: SharedValue<KeyboardState>;
568
+ };
569
+ export function useAnimatedKeyboard(): AnimatedKeyboardInfo;
570
+
571
+ export function useScrollViewOffset(
572
+ aref: RefObject<Animated.ScrollView>
573
+ ): SharedValue<number>;
512
574
 
513
575
  export interface ExitAnimationsValues {
514
576
  currentOriginX: number;
@@ -752,14 +814,7 @@ declare module 'react-native-reanimated' {
752
814
  export function defineAnimation<T>(starting: any, factory: () => T): number;
753
815
  export function measure<T extends Component>(
754
816
  ref: RefObject<T>
755
- ): {
756
- width: number;
757
- height: number;
758
- x: number;
759
- y: number;
760
- pageX: number;
761
- pageY: number;
762
- };
817
+ ): MeasuredDimensions | null;
763
818
 
764
819
  export function getRelativeCoords(
765
820
  ref: RefObject<Component>,
@@ -0,0 +1,65 @@
1
+ def try_to_parse_react_native_package_json(node_modules_dir)
2
+ react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json')
3
+ if !File.exists?(react_native_package_json_path)
4
+ return nil
5
+ end
6
+ return JSON.parse(File.read(react_native_package_json_path))
7
+ end
8
+
9
+ def find_config()
10
+ result = {
11
+ :is_reanimated_example_app => nil,
12
+ :react_native_version => nil,
13
+ :react_native_minor_version => nil,
14
+ :is_tvos_target => nil,
15
+ :react_native_node_modules_dir => nil,
16
+ :reanimated_node_modules_dir => nil,
17
+ :react_native_common_dir => nil,
18
+ }
19
+
20
+ react_native_node_modules_dir = File.join(File.dirname(`cd #{Pod::Config.instance.installation_root.to_s} && node --print "require.resolve('react-native/package.json')"`), '..')
21
+ react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir)
22
+
23
+ if react_native_json == nil
24
+ # user configuration, just in case
25
+ node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"]
26
+ react_native_json = try_to_parse_react_native_package_json(node_modules_dir)
27
+ end
28
+
29
+ if react_native_json == nil
30
+ raise '[RNReanimated] Unable to recognize your `react-native` version! Please set environmental variable with `react-native` locations: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install'
31
+ end
32
+
33
+ result[:is_reanimated_example_app] = ENV["REANIMATED_EXAMPLE_APP_NAME"] != nil
34
+ result[:is_tvos_target] = react_native_json['name'] == 'react-native-tvos'
35
+ result[:react_native_version] = react_native_json['version']
36
+ result[:react_native_minor_version] = react_native_json['version'].split('.')[1].to_i
37
+ result[:react_native_node_modules_dir] = File.expand_path(react_native_node_modules_dir)
38
+ result[:reanimated_node_modules_dir] = File.expand_path(File.join(__dir__, '..', '..'))
39
+ result[:react_native_common_dir] = File.join(react_native_node_modules_dir, 'react-native', 'ReactCommon')
40
+
41
+ return result
42
+ end
43
+
44
+ def assert_no_multiple_instances(react_native_info)
45
+ if react_native_info[:is_reanimated_example_app]
46
+ return
47
+ end
48
+
49
+ lib_instances_in_react_native_node_modules = %x[find #{react_native_info[:react_native_node_modules_dir]} -name "package.json" | grep "/react-native-reanimated/package.json"]
50
+ lib_instances_in_react_native_node_modules_array = lib_instances_in_react_native_node_modules.split("\n")
51
+ reanimated_instances = lib_instances_in_react_native_node_modules_array.length()
52
+ if react_native_info[:react_native_node_modules_dir] != react_native_info[:reanimated_node_modules_dir]
53
+ lib_instances_in_reanimated_node_modules = %x[find #{react_native_info[:reanimated_node_modules_dir]} -name "package.json" | grep "/react-native-reanimated/package.json"]
54
+ lib_instances_in_reanimated_node_modules_array = lib_instances_in_reanimated_node_modules.split("\n")
55
+ reanimated_instances += lib_instances_in_reanimated_node_modules_array.length()
56
+ end
57
+ if reanimated_instances > 1
58
+ parsed_location = ''
59
+ for location in lib_instances_in_react_native_node_modules_array + lib_instances_in_reanimated_node_modules_array
60
+ location['/package.json'] = ''
61
+ parsed_location += "- " + location + "\n"
62
+ end
63
+ raise "[Reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsed_location
64
+ end
65
+ end
package/src/index.ts CHANGED
@@ -1,7 +1,15 @@
1
- // tree-shaken side effects
2
- import './reanimated2/js-reanimated/global';
1
+ import * as Animated from './Animated';
2
+ import webGlobalIsInitialized from './reanimated2/js-reanimated/global';
3
+ if (!webGlobalIsInitialized) {
4
+ /*
5
+ `webGlobalIsInitialized` should always be `true`,
6
+ but we need to use `webGlobalIsInitialized` somewhere to ensure function execution,
7
+ in another way, the bundler can remove unused variables.
8
+ */
9
+ console.error('[Reanimated] Unable to initialize global objects for web.');
10
+ }
3
11
 
4
12
  // @ts-ignore backward compatibility with treeshaking
5
13
  export * from './reanimated1';
6
14
  export * from './reanimated2';
7
- export * as default from './Animated';
15
+ export default Animated;
@@ -0,0 +1,7 @@
1
+ // tree-shaken side effects
2
+ import './reanimated2/js-reanimated/global';
3
+
4
+ // @ts-ignore backward compatibility with treeshaking
5
+ export * from './reanimated1';
6
+ export * from './reanimated2';
7
+ export * as default from './Animated'; // If this line fails, you probably forgot some installation steps. Check out the installation guide here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ 1) 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) 2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache
@@ -23,7 +23,7 @@ interface HSV {
23
23
  }
24
24
 
25
25
  // var INTEGER = '[-+]?\\d+';
26
- const NUMBER = '[-+]?\\d*\\.?\\d+';
26
+ const NUMBER = '[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)';
27
27
  const PERCENTAGE = NUMBER + '%';
28
28
 
29
29
  function call(...args: unknown[]): string {
@@ -1,9 +1,8 @@
1
1
  /* global _WORKLET _measure _scrollTo _setGestureState */
2
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
- // @ts-nocheck
4
2
  import { Component } from 'react';
5
3
  import { findNodeHandle } from 'react-native';
6
- import { RefObjectFunction } from './commonTypes';
4
+ import { MeasuredDimensions } from './commonTypes';
5
+ import { RefObjectFunction } from './hook/commonTypes';
7
6
  import { shouldBeUseWeb } from './PlatformChecker';
8
7
 
9
8
  export function getTag(
@@ -12,40 +11,58 @@ export function getTag(
12
11
  return findNodeHandle(view);
13
12
  }
14
13
 
15
- export interface MeasuredDimensions {
16
- x: number;
17
- y: number;
18
- width: number;
19
- height: number;
20
- pageX: number;
21
- pageY: number;
22
- }
23
-
24
- const isNativeIndefined = shouldBeUseWeb();
14
+ const isNative = !shouldBeUseWeb();
25
15
 
26
16
  export function measure(
27
17
  animatedRef: RefObjectFunction<Component>
28
- ): MeasuredDimensions {
18
+ ): MeasuredDimensions | null {
29
19
  'worklet';
30
- if (!_WORKLET || isNativeIndefined) {
20
+ if (!isNative) {
31
21
  console.warn(
32
- '[reanimated.measure] method cannot be used for web or Chrome Debugger'
22
+ '[Reanimated] measure() cannot be used on web or Chrome Debugger'
33
23
  );
34
- return {
35
- x: NaN,
36
- y: NaN,
37
- width: NaN,
38
- height: NaN,
39
- pageX: NaN,
40
- pageY: NaN,
41
- };
24
+ return null;
42
25
  }
26
+
27
+ if (!_WORKLET) {
28
+ console.warn(
29
+ '[Reanimated] measure() was called from the main JS context. Measure is ' +
30
+ 'only available in the UI runtime. This may also happen if measure() ' +
31
+ 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +
32
+ 'calls the given worklet on the JS runtime during render. If you want to ' +
33
+ 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +
34
+ 'only be called on the UI runtime after the render has been completed.'
35
+ );
36
+ return null;
37
+ }
38
+
43
39
  const viewTag = animatedRef();
44
- const result = _measure(viewTag);
45
- if (result.x === -1234567) {
46
- throw new Error(`The view with tag ${viewTag} could not be measured`);
40
+ if (viewTag === -1) {
41
+ console.warn(
42
+ `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`
43
+ );
44
+ return null;
45
+ }
46
+
47
+ const measured = _measure(viewTag);
48
+ if (measured === null) {
49
+ console.warn(
50
+ `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \`LayoutMetrics\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`
51
+ );
52
+ return null;
53
+ } else if (measured.x === -1234567) {
54
+ console.warn(
55
+ `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response`
56
+ );
57
+ return null;
58
+ } else if (isNaN(measured.x)) {
59
+ console.warn(
60
+ `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \`collapsable={false}\` on this component.`
61
+ );
62
+ return null;
63
+ } else {
64
+ return measured;
47
65
  }
48
- return result;
49
66
  }
50
67
 
51
68
  export function scrollTo(
@@ -55,7 +72,7 @@ export function scrollTo(
55
72
  animated: boolean
56
73
  ): void {
57
74
  'worklet';
58
- if (!_WORKLET || isNativeIndefined) {
75
+ if (!_WORKLET || !isNative) {
59
76
  return;
60
77
  }
61
78
  const viewTag = animatedRef();
@@ -64,7 +81,7 @@ export function scrollTo(
64
81
 
65
82
  export function setGestureState(handlerTag: number, newState: number): void {
66
83
  'worklet';
67
- if (!_WORKLET || isNativeIndefined) {
84
+ if (!_WORKLET || !isNative) {
68
85
  console.warn(
69
86
  '[Reanimated] You can not use setGestureState in non-worklet function.'
70
87
  );