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
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -1,5 +1,6 @@
1
1
  #include "AndroidErrorHandler.h"
2
2
  #include <fbjni/fbjni.h>
3
+ #include <exception>
3
4
  #include <string>
4
5
  #include "Logger.h"
5
6
 
@@ -17,11 +18,9 @@ void AndroidErrorHandler::raiseSpec() {
17
18
  return;
18
19
  }
19
20
 
20
- static const auto cls = javaClassStatic();
21
- static auto method = cls->getStaticMethod<void(std::string)>("raise");
22
- method(cls, error->message);
23
-
21
+ // mark error as handled before this method throws exception
24
22
  this->error->handled = true;
23
+ throw std::runtime_error(this->error->message);
25
24
  }
26
25
 
27
26
  std::shared_ptr<Scheduler> AndroidErrorHandler::getScheduler() {
@@ -11,15 +11,12 @@
11
11
 
12
12
  namespace reanimated {
13
13
 
14
- class AndroidErrorHandler : public JavaClass<AndroidErrorHandler>,
15
- public ErrorHandler {
14
+ class AndroidErrorHandler : public ErrorHandler {
16
15
  std::shared_ptr<ErrorWrapper> error;
17
16
  std::shared_ptr<Scheduler> scheduler;
18
17
  void raiseSpec() override;
19
18
 
20
19
  public:
21
- static auto constexpr kJavaDescriptor =
22
- "Lcom/swmansion/reanimated/AndroidErrorHandler;";
23
20
  explicit AndroidErrorHandler(std::shared_ptr<Scheduler> scheduler);
24
21
  std::shared_ptr<Scheduler> getScheduler() override;
25
22
  std::shared_ptr<ErrorWrapper> getError() override;
@@ -1,6 +1,9 @@
1
- #include "AndroidLogger.h"
2
1
  #include <android/log.h>
2
+ #include <memory>
3
+
4
+ #include "AndroidLogger.h"
3
5
  #include "Logger.h"
6
+
4
7
  #define APPNAME "NATIVE_REANIMATED"
5
8
 
6
9
  namespace reanimated {
@@ -7,8 +7,10 @@
7
7
  #include <memory>
8
8
  #include <string>
9
9
 
10
- #if FOR_HERMES
10
+ #if JS_RUNTIME_HERMES
11
11
  #include <hermes/hermes.h>
12
+ #elif JS_RUNTIME_V8
13
+ #include <v8runtime/V8RuntimeFactory.h>
12
14
  #else
13
15
  #include <jsi/JSCRuntime.h>
14
16
  #endif
@@ -38,10 +40,8 @@ NativeProxy::NativeProxy(
38
40
  layoutAnimations(std::move(_layoutAnimations)) {}
39
41
 
40
42
  NativeProxy::~NativeProxy() {
41
- runtime_->global().setProperty(
42
- *runtime_,
43
- jsi::PropNameID::forAscii(*runtime_, "__reanimatedModuleProxy"),
44
- jsi::Value::undefined());
43
+ // removed temporary, new event listener mechanism need fix on the RN side
44
+ // reactScheduler_->removeEventListener(eventListener_);
45
45
  }
46
46
 
47
47
  jni::local_ref<NativeProxy::jhybriddata> NativeProxy::initHybrid(
@@ -73,11 +73,10 @@ void NativeProxy::installJSIBindings() {
73
73
  };
74
74
 
75
75
  auto getCurrentTime = [this]() {
76
- auto method =
77
- javaPart_->getClass()->getMethod<local_ref<JString>()>("getUptime");
78
- local_ref<JString> output = method(javaPart_.get());
79
- return static_cast<double>(
80
- std::strtoll(output->toStdString().c_str(), NULL, 10));
76
+ static const auto method =
77
+ javaPart_->getClass()->getMethod<jlong()>("getCurrentTime");
78
+ jlong output = method(javaPart_.get());
79
+ return static_cast<double>(output);
81
80
  };
82
81
 
83
82
  auto requestRender = [this, getCurrentTime](
@@ -136,31 +135,44 @@ void NativeProxy::installJSIBindings() {
136
135
  auto setGestureStateFunction = [this](int handlerTag, int newState) -> void {
137
136
  setGestureState(handlerTag, newState);
138
137
  };
139
- #if FOR_HERMES
138
+
139
+ auto subscribeForKeyboardEventsFunction =
140
+ [this](std::function<void(int, int)> keyboardEventDataUpdater) -> int {
141
+ return subscribeForKeyboardEvents(std::move(keyboardEventDataUpdater));
142
+ };
143
+
144
+ auto unsubscribeFromKeyboardEventsFunction = [this](int listenerId) -> void {
145
+ unsubscribeFromKeyboardEvents(listenerId);
146
+ };
147
+
148
+ #if JS_RUNTIME_HERMES
140
149
  auto config =
141
150
  ::hermes::vm::RuntimeConfig::Builder().withEnableSampleProfiling(false);
142
151
  std::shared_ptr<jsi::Runtime> animatedRuntime =
143
152
  facebook::hermes::makeHermesRuntime(config.build());
153
+ #elif JS_RUNTIME_V8
154
+ auto config = std::make_unique<rnv8::V8RuntimeConfig>();
155
+ config->enableInspector = false;
156
+ config->appName = "reanimated";
157
+ std::shared_ptr<jsi::Runtime> animatedRuntime =
158
+ rnv8::createSharedV8Runtime(runtime_, std::move(config));
144
159
  #else
145
160
  std::shared_ptr<jsi::Runtime> animatedRuntime =
146
161
  facebook::jsc::makeJSCRuntime();
147
162
  #endif
148
- auto workletRuntimeValue = runtime_->global()
149
- .getProperty(*runtime_, "ArrayBuffer")
150
- .asObject(*runtime_)
151
- .asFunction(*runtime_)
152
- .callAsConstructor(*runtime_, {static_cast<double>(sizeof(void*))});
153
- uintptr_t* workletRuntimeData = reinterpret_cast<uintptr_t*>(
154
- workletRuntimeValue
155
- .getObject(*runtime_)
156
- .getArrayBuffer(*runtime_)
157
- .data(*runtime_));
163
+ auto workletRuntimeValue =
164
+ runtime_->global()
165
+ .getProperty(*runtime_, "ArrayBuffer")
166
+ .asObject(*runtime_)
167
+ .asFunction(*runtime_)
168
+ .callAsConstructor(*runtime_, {static_cast<double>(sizeof(void *))});
169
+ uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
170
+ workletRuntimeValue.getObject(*runtime_).getArrayBuffer(*runtime_).data(
171
+ *runtime_));
158
172
  workletRuntimeData[0] = reinterpret_cast<uintptr_t>(animatedRuntime.get());
159
173
 
160
174
  runtime_->global().setProperty(
161
- *runtime_,
162
- "_WORKLET_RUNTIME",
163
- workletRuntimeValue);
175
+ *runtime_, "_WORKLET_RUNTIME", workletRuntimeValue);
164
176
 
165
177
  std::shared_ptr<ErrorHandler> errorHandler =
166
178
  std::make_shared<AndroidErrorHandler>(scheduler_);
@@ -198,7 +210,10 @@ void NativeProxy::installJSIBindings() {
198
210
  registerSensorFunction,
199
211
  unregisterSensorFunction,
200
212
  setGestureStateFunction,
201
- configurePropsFunction};
213
+ configurePropsFunction,
214
+ subscribeForKeyboardEventsFunction,
215
+ unsubscribeFromKeyboardEventsFunction,
216
+ };
202
217
 
203
218
  auto module = std::make_shared<NativeReanimatedModule>(
204
219
  jsCallInvoker_,
@@ -337,12 +352,29 @@ void NativeProxy::configureProps(
337
352
  ReadableNativeArray::javaobject)>("configureProps");
338
353
  method(
339
354
  javaPart_.get(),
340
- ReadableNativeArray::newObjectCxxArgs(
341
- std::move(jsi::dynamicFromValue(rt, uiProps)))
355
+ ReadableNativeArray::newObjectCxxArgs(jsi::dynamicFromValue(rt, uiProps))
342
356
  .get(),
343
357
  ReadableNativeArray::newObjectCxxArgs(
344
- std::move(jsi::dynamicFromValue(rt, nativeProps)))
358
+ jsi::dynamicFromValue(rt, nativeProps))
359
+ .get());
360
+ }
361
+
362
+ int NativeProxy::subscribeForKeyboardEvents(
363
+ std::function<void(int, int)> keyboardEventDataUpdater) {
364
+ auto method = javaPart_->getClass()
365
+ ->getMethod<int(KeyboardEventDataUpdater::javaobject)>(
366
+ "subscribeForKeyboardEvents");
367
+ return method(
368
+ javaPart_.get(),
369
+ KeyboardEventDataUpdater::newObjectCxxArgs(
370
+ std::move(keyboardEventDataUpdater))
345
371
  .get());
346
372
  }
347
373
 
374
+ void NativeProxy::unsubscribeFromKeyboardEvents(int listenerId) {
375
+ auto method = javaPart_->getClass()->getMethod<void(int)>(
376
+ "unsubscribeFromKeyboardEvents");
377
+ method(javaPart_.get(), listenerId);
378
+ }
379
+
348
380
  } // namespace reanimated
@@ -118,6 +118,32 @@ class SensorSetter : public HybridClass<SensorSetter> {
118
118
  std::function<void(double[])> callback_;
119
119
  };
120
120
 
121
+ class KeyboardEventDataUpdater : public HybridClass<KeyboardEventDataUpdater> {
122
+ public:
123
+ static auto constexpr kJavaDescriptor =
124
+ "Lcom/swmansion/reanimated/NativeProxy$KeyboardEventDataUpdater;";
125
+
126
+ void keyboardEventDataUpdater(int keyboardState, int height) {
127
+ callback_(keyboardState, height);
128
+ }
129
+
130
+ static void registerNatives() {
131
+ javaClassStatic()->registerNatives({
132
+ makeNativeMethod(
133
+ "keyboardEventDataUpdater",
134
+ KeyboardEventDataUpdater::keyboardEventDataUpdater),
135
+ });
136
+ }
137
+
138
+ private:
139
+ friend HybridBase;
140
+
141
+ explicit KeyboardEventDataUpdater(std::function<void(int, int)> callback)
142
+ : callback_(std::move(callback)) {}
143
+
144
+ std::function<void(int, int)> callback_;
145
+ };
146
+
121
147
  class NativeProxy : public jni::HybridClass<NativeProxy> {
122
148
  public:
123
149
  static auto constexpr kJavaDescriptor =
@@ -160,6 +186,9 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
160
186
  jsi::Runtime &rt,
161
187
  const jsi::Value &uiProps,
162
188
  const jsi::Value &nativeProps);
189
+ int subscribeForKeyboardEvents(
190
+ std::function<void(int, int)> keyboardEventDataUpdater);
191
+ void unsubscribeFromKeyboardEvents(int listenerId);
163
192
 
164
193
  explicit NativeProxy(
165
194
  jni::alias_ref<NativeProxy::jhybridobject> jThis,
@@ -13,5 +13,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
13
13
  reanimated::AndroidScheduler::registerNatives();
14
14
  reanimated::LayoutAnimations::registerNatives();
15
15
  reanimated::SensorSetter::registerNatives();
16
+ reanimated::KeyboardEventDataUpdater::registerNatives();
16
17
  });
17
18
  }
@@ -16,6 +16,7 @@ import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
16
16
  import com.facebook.react.uimanager.UIManagerModule;
17
17
  import com.facebook.react.uimanager.events.RCTEventEmitter;
18
18
  import com.swmansion.common.GestureHandlerStateManager;
19
+ import com.swmansion.reanimated.keyboardObserver.ReanimatedKeyboardEventListener;
19
20
  import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
20
21
  import com.swmansion.reanimated.layoutReanimation.LayoutAnimations;
21
22
  import com.swmansion.reanimated.layoutReanimation.NativeMethodsHolder;
@@ -87,6 +88,18 @@ public class NativeProxy {
87
88
  public native void sensorSetter(float[] value);
88
89
  }
89
90
 
91
+ @DoNotStrip
92
+ public static class KeyboardEventDataUpdater {
93
+ @DoNotStrip private final HybridData mHybridData;
94
+
95
+ @DoNotStrip
96
+ private KeyboardEventDataUpdater(HybridData hybridData) {
97
+ mHybridData = hybridData;
98
+ }
99
+
100
+ public native void keyboardEventDataUpdater(int keyboardState, int height);
101
+ }
102
+
90
103
  @DoNotStrip
91
104
  @SuppressWarnings("unused")
92
105
  private final HybridData mHybridData;
@@ -96,6 +109,7 @@ public class NativeProxy {
96
109
  private Scheduler mScheduler = null;
97
110
  private ReanimatedSensorContainer reanimatedSensorContainer;
98
111
  private final GestureHandlerStateManager gestureHandlerStateManager;
112
+ private ReanimatedKeyboardEventListener reanimatedKeyboardEventListener;
99
113
  private Long firstUptime = SystemClock.uptimeMillis();
100
114
  private boolean slowAnimationsEnabled = false;
101
115
 
@@ -110,6 +124,7 @@ public class NativeProxy {
110
124
  mContext = new WeakReference<>(context);
111
125
  prepare(LayoutAnimations);
112
126
  reanimatedSensorContainer = new ReanimatedSensorContainer(mContext);
127
+ reanimatedKeyboardEventListener = new ReanimatedKeyboardEventListener(mContext);
113
128
  addDevMenuOption();
114
129
 
115
130
  GestureHandlerStateManager tempHandlerStateManager;
@@ -188,14 +203,13 @@ public class NativeProxy {
188
203
  }
189
204
 
190
205
  @DoNotStrip
191
- private String getUptime() {
206
+ private long getCurrentTime() {
192
207
  if (slowAnimationsEnabled) {
193
208
  final long ANIMATIONS_DRAG_FACTOR = 10;
194
- return Long.toString(
195
- this.firstUptime
196
- + (SystemClock.uptimeMillis() - this.firstUptime) / ANIMATIONS_DRAG_FACTOR);
209
+ return this.firstUptime
210
+ + (SystemClock.uptimeMillis() - this.firstUptime) / ANIMATIONS_DRAG_FACTOR;
197
211
  } else {
198
- return Long.toString(SystemClock.uptimeMillis());
212
+ return SystemClock.uptimeMillis();
199
213
  }
200
214
  }
201
215
 
@@ -237,6 +251,16 @@ public class NativeProxy {
237
251
  reanimatedSensorContainer.unregisterSensor(sensorId);
238
252
  }
239
253
 
254
+ @DoNotStrip
255
+ private int subscribeForKeyboardEvents(KeyboardEventDataUpdater keyboardEventDataUpdater) {
256
+ return reanimatedKeyboardEventListener.subscribeForKeyboardEvents(keyboardEventDataUpdater);
257
+ }
258
+
259
+ @DoNotStrip
260
+ private void unsubscribeFromKeyboardEvents(int listenerId) {
261
+ reanimatedKeyboardEventListener.unsubscribeFromKeyboardEvents(listenerId);
262
+ }
263
+
240
264
  public void onCatalystInstanceDestroy() {
241
265
  mScheduler.deactivate();
242
266
  mHybridData.resetNative();
@@ -1,5 +1,7 @@
1
1
  package com.swmansion.reanimated;
2
2
 
3
+ import static java.lang.Float.NaN;
4
+
3
5
  import android.util.SparseArray;
4
6
  import android.view.View;
5
7
  import com.facebook.react.bridge.Arguments;
@@ -83,7 +85,7 @@ public class NodesManager implements EventDispatcherListener {
83
85
  view = mUIManager.resolveView(viewTag);
84
86
  } catch (IllegalViewOperationException e) {
85
87
  e.printStackTrace();
86
- return (new float[] {});
88
+ return (new float[] {NaN, NaN, NaN, NaN, NaN, NaN});
87
89
  }
88
90
  return NativeMethodsHelper.measure(view);
89
91
  }
@@ -0,0 +1,166 @@
1
+ package com.swmansion.reanimated.keyboardObserver;
2
+
3
+ import android.os.Handler;
4
+ import android.os.Looper;
5
+ import android.view.View;
6
+ import android.widget.FrameLayout;
7
+ import androidx.annotation.NonNull;
8
+ import androidx.core.view.ViewCompat;
9
+ import androidx.core.view.WindowCompat;
10
+ import androidx.core.view.WindowInsetsAnimationCompat;
11
+ import androidx.core.view.WindowInsetsCompat;
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.uimanager.PixelUtil;
14
+ import com.swmansion.reanimated.BuildConfig;
15
+ import com.swmansion.reanimated.NativeProxy.KeyboardEventDataUpdater;
16
+ import java.lang.ref.WeakReference;
17
+ import java.util.HashMap;
18
+ import java.util.List;
19
+
20
+ public class ReanimatedKeyboardEventListener {
21
+ enum KeyboardState {
22
+ UNKNOWN(0),
23
+ OPENING(1),
24
+ OPEN(2),
25
+ CLOSING(3),
26
+ CLOSED(4);
27
+
28
+ private final int value;
29
+
30
+ KeyboardState(int value) {
31
+ this.value = value;
32
+ }
33
+
34
+ public int asInt() {
35
+ return value;
36
+ }
37
+ }
38
+
39
+ private final WeakReference<ReactApplicationContext> reactContext;
40
+ private int nextListenerId = 0;
41
+ private KeyboardState state;
42
+ private final HashMap<Integer, KeyboardEventDataUpdater> listeners = new HashMap<>();
43
+
44
+ public ReanimatedKeyboardEventListener(WeakReference<ReactApplicationContext> reactContext) {
45
+ this.reactContext = reactContext;
46
+ }
47
+
48
+ private View getRootView() {
49
+ return reactContext.get().getCurrentActivity().getWindow().getDecorView();
50
+ }
51
+
52
+ private void setupWindowInsets() {
53
+ View rootView = getRootView();
54
+ WindowCompat.setDecorFitsSystemWindows(
55
+ reactContext.get().getCurrentActivity().getWindow(), false);
56
+ ViewCompat.setOnApplyWindowInsetsListener(
57
+ rootView,
58
+ (v, insets) -> {
59
+ int paddingBottom = 0;
60
+ if (!BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
61
+ && BuildConfig.REACT_NATIVE_MINOR_VERSION < 70) {
62
+ paddingBottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
63
+ }
64
+ int paddingTop = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
65
+ View content =
66
+ rootView.getRootView().findViewById(com.swmansion.reanimated.R.id.action_bar_root);
67
+
68
+ FrameLayout.LayoutParams params =
69
+ new FrameLayout.LayoutParams(
70
+ FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
71
+ params.setMargins(0, paddingTop, 0, paddingBottom);
72
+ content.setLayoutParams(params);
73
+ return insets;
74
+ });
75
+ }
76
+
77
+ private void updateKeyboard(int keyboardHeight) {
78
+ for (KeyboardEventDataUpdater listener : listeners.values()) {
79
+ listener.keyboardEventDataUpdater(state.asInt(), keyboardHeight);
80
+ }
81
+ }
82
+
83
+ private class WindowInsetsCallback extends WindowInsetsAnimationCompat.Callback {
84
+ private int keyboardHeight = 0;
85
+
86
+ public WindowInsetsCallback() {
87
+ super(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_CONTINUE_ON_SUBTREE);
88
+ }
89
+
90
+ @NonNull
91
+ @Override
92
+ public WindowInsetsAnimationCompat.BoundsCompat onStart(
93
+ @NonNull WindowInsetsAnimationCompat animation,
94
+ @NonNull WindowInsetsAnimationCompat.BoundsCompat bounds) {
95
+ state = keyboardHeight == 0 ? KeyboardState.OPENING : KeyboardState.CLOSING;
96
+ updateKeyboard(keyboardHeight);
97
+ return super.onStart(animation, bounds);
98
+ }
99
+
100
+ @NonNull
101
+ @Override
102
+ public WindowInsetsCompat onProgress(
103
+ @NonNull WindowInsetsCompat insets,
104
+ @NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
105
+
106
+ keyboardHeight =
107
+ (int)
108
+ PixelUtil.toDIPFromPixel(
109
+ Math.max(
110
+ 0,
111
+ insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
112
+ - insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom));
113
+ updateKeyboard(keyboardHeight);
114
+ return insets;
115
+ }
116
+
117
+ @Override
118
+ public void onEnd(@NonNull WindowInsetsAnimationCompat animation) {
119
+ state = keyboardHeight == 0 ? KeyboardState.CLOSED : KeyboardState.OPEN;
120
+ updateKeyboard(keyboardHeight);
121
+ }
122
+ }
123
+
124
+ private void setUpCallbacks() {
125
+ View rootView = getRootView();
126
+ new Handler(Looper.getMainLooper()).post(this::setupWindowInsets);
127
+ ViewCompat.setWindowInsetsAnimationCallback(rootView, new WindowInsetsCallback());
128
+ }
129
+
130
+ public int subscribeForKeyboardEvents(KeyboardEventDataUpdater updater) {
131
+ int listenerId = nextListenerId++;
132
+ if (listeners.isEmpty()) {
133
+ setUpCallbacks();
134
+ }
135
+ listeners.put(listenerId, updater);
136
+ return listenerId;
137
+ }
138
+
139
+ private void bringBackWindowInsets() {
140
+ WindowCompat.setDecorFitsSystemWindows(
141
+ reactContext.get().getCurrentActivity().getWindow(), true);
142
+ ViewCompat.setOnApplyWindowInsetsListener(getRootView(), null);
143
+ ViewCompat.setWindowInsetsAnimationCallback(getRootView(), null);
144
+ View content =
145
+ getRootView().getRootView().findViewById(com.swmansion.reanimated.R.id.action_bar_root);
146
+
147
+ FrameLayout.LayoutParams params =
148
+ new FrameLayout.LayoutParams(
149
+ FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
150
+ params.setMargins(0, 0, 0, 0);
151
+ content.setLayoutParams(params);
152
+ }
153
+
154
+ private void removeCallbacks() {
155
+ View rootView = getRootView();
156
+ new Handler(Looper.getMainLooper()).post(this::bringBackWindowInsets);
157
+ ViewCompat.setWindowInsetsAnimationCallback(rootView, null);
158
+ }
159
+
160
+ public void unsubscribeFromKeyboardEvents(int listenerId) {
161
+ listeners.remove(listenerId);
162
+ if (listeners.isEmpty()) {
163
+ removeCallbacks();
164
+ }
165
+ }
166
+ }
@@ -229,24 +229,27 @@ public class AnimationsManager implements ViewHierarchyObserver {
229
229
  }
230
230
 
231
231
  private void removeLeftovers() {
232
- HashSet<Integer> roots = new HashSet<>();
233
- // go through ready to remove from bottom to top
234
- for (int tag : mToRemove) {
235
- View view = mViewForTag.get(tag);
236
- if (view == null) {
237
- try {
238
- view = mUIManager.resolveView(tag);
239
- mViewForTag.put(tag, view);
240
- } catch (IllegalViewOperationException ignored) {
241
- continue;
232
+ // mToRemove may be null if onCatalystInstanceDestroy was called first
233
+ if (mToRemove != null) {
234
+ HashSet<Integer> roots = new HashSet<>();
235
+ // go through ready to remove from bottom to top
236
+ for (int tag : mToRemove) {
237
+ View view = mViewForTag.get(tag);
238
+ if (view == null) {
239
+ try {
240
+ view = mUIManager.resolveView(tag);
241
+ mViewForTag.put(tag, view);
242
+ } catch (IllegalViewOperationException ignored) {
243
+ continue;
244
+ }
242
245
  }
246
+ findRoot(view, roots);
243
247
  }
244
- findRoot(view, roots);
245
- }
246
- for (int tag : roots) {
247
- View view = mViewForTag.get(tag);
248
- if (view != null) {
249
- dfs(view, view, mToRemove);
248
+ for (int tag : roots) {
249
+ View view = mViewForTag.get(tag);
250
+ if (view != null) {
251
+ dfs(view, view, mToRemove);
252
+ }
250
253
  }
251
254
  }
252
255
  }
@@ -23,7 +23,11 @@ public class ReanimatedSensor {
23
23
  sensorManager =
24
24
  (SensorManager) reactContext.get().getSystemService(reactContext.get().SENSOR_SERVICE);
25
25
  this.sensorType = sensorType;
26
- this.interval = interval;
26
+ if (interval == -1) {
27
+ this.interval = SensorManager.SENSOR_DELAY_UI;
28
+ } else {
29
+ this.interval = interval;
30
+ }
27
31
  }
28
32
 
29
33
  boolean initialize() {
@@ -3,7 +3,7 @@ package com.swmansion.reanimated.sensor;
3
3
  import android.hardware.Sensor;
4
4
 
5
5
  public enum ReanimatedSensorType {
6
- ACCELEROMETER(Sensor.TYPE_ACCELEROMETER),
6
+ ACCELEROMETER(Sensor.TYPE_LINEAR_ACCELERATION),
7
7
  GYROSCOPE(Sensor.TYPE_GYROSCOPE),
8
8
  GRAVITY(Sensor.TYPE_GRAVITY),
9
9
  MAGNETIC_FIELD(Sensor.TYPE_MAGNETIC_FIELD),
@@ -3,15 +3,27 @@
3
3
  #import <RNReanimated/REANodesManager.h>
4
4
  #import <RNReanimated/REATransitionManager.h>
5
5
 
6
+ #import "SingleInstanceChecker.h"
7
+
8
+ using namespace reanimated;
9
+
6
10
  typedef void (^AnimatedOperation)(REANodesManager *nodesManager);
7
11
 
8
12
  @implementation REAModule {
9
13
  NSMutableArray<AnimatedOperation> *_operations;
10
14
  REATransitionManager *_transitionManager;
15
+ #ifdef DEBUG
16
+ SingleInstanceChecker<REAModule> singleInstanceChecker_;
17
+ #endif
11
18
  }
12
19
 
13
20
  RCT_EXPORT_MODULE(ReanimatedModule);
14
21
 
22
+ + (BOOL)requiresMainQueueSetup
23
+ {
24
+ return YES;
25
+ }
26
+
15
27
  - (void)invalidate
16
28
  {
17
29
  _transitionManager = nil;