react-native-reanimated 2.3.0-alpha.1 → 2.3.0-beta.2
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.
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +15 -8
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +170 -166
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +36 -34
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +13 -6
- package/Common/cpp/Registries/MapperRegistry.cpp +19 -15
- package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
- package/Common/cpp/SharedItems/FrozenObject.cpp +19 -8
- package/Common/cpp/SharedItems/MutableValue.cpp +38 -25
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +11 -7
- package/Common/cpp/SharedItems/RemoteObject.cpp +9 -5
- package/Common/cpp/SharedItems/ShareableValue.cpp +216 -143
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +36 -24
- package/Common/cpp/Tools/Mapper.cpp +41 -29
- package/Common/cpp/Tools/RuntimeDecorator.cpp +103 -84
- package/Common/cpp/Tools/Scheduler.cpp +14 -6
- package/Common/cpp/Tools/WorkletEventHandler.cpp +1 -1
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +45 -34
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +28 -16
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +14 -8
- package/Common/cpp/headers/Registries/MapperRegistry.h +4 -4
- package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
- package/Common/cpp/headers/SharedItems/FrozenObject.h +15 -11
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +6 -4
- package/Common/cpp/headers/SharedItems/MutableValue.h +21 -12
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +10 -7
- package/Common/cpp/headers/SharedItems/RemoteObject.h +16 -8
- package/Common/cpp/headers/SharedItems/RuntimeManager.h +39 -21
- package/Common/cpp/headers/SharedItems/ShareableValue.h +31 -27
- package/Common/cpp/headers/SharedItems/SharedParent.h +7 -4
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +80 -61
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +17 -19
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +18 -13
- package/Common/cpp/headers/Tools/Mapper.h +24 -18
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +12 -7
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -7
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +29 -23
- package/Common/cpp/headers/Tools/Scheduler.h +28 -33
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +9 -7
- package/Common/cpp/hidden_headers/Logger.h +14 -14
- package/Common/cpp/hidden_headers/LoggerInterface.h +8 -9
- package/Common/cpp/hidden_headers/SpeedChecker.h +7 -8
- package/README.md +1 -1
- package/RNReanimated.podspec +4 -4
- package/android/build.gradle +80 -3
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +19 -10
- package/ios/LayoutReanimation/REAAnimationsManager.m +195 -200
- package/ios/LayoutReanimation/REASnapshot.h +13 -0
- package/ios/LayoutReanimation/REASnapshot.m +29 -0
- package/ios/LayoutReanimation/REAUIManager.h +16 -0
- package/ios/LayoutReanimation/REAUIManager.mm +348 -0
- package/ios/Nodes/REAAlwaysNode.m +14 -15
- package/ios/Nodes/REABezierNode.m +8 -7
- package/ios/Nodes/REABlockNode.m +1 -1
- package/ios/Nodes/REACallFuncNode.h +0 -1
- package/ios/Nodes/REACallFuncNode.m +10 -8
- package/ios/Nodes/REAClockNodes.m +22 -20
- package/ios/Nodes/REAConcatNode.h +0 -1
- package/ios/Nodes/REAConcatNode.m +2 -2
- package/ios/Nodes/REACondNode.m +7 -5
- package/ios/Nodes/READebugNode.m +5 -4
- package/ios/Nodes/REAEventNode.m +1 -1
- package/ios/Nodes/REAFunctionNode.h +0 -1
- package/ios/Nodes/REAFunctionNode.m +2 -2
- package/ios/Nodes/REAJSCallNode.m +4 -5
- package/ios/Nodes/REANode.h +3 -4
- package/ios/Nodes/REANode.m +9 -11
- package/ios/Nodes/REAOperatorNode.m +68 -67
- package/ios/Nodes/REAParamNode.h +1 -3
- package/ios/Nodes/REAParamNode.m +15 -17
- package/ios/Nodes/REAPropsNode.h +1 -3
- package/ios/Nodes/REAPropsNode.m +19 -22
- package/ios/Nodes/REASetNode.h +0 -1
- package/ios/Nodes/REASetNode.m +7 -5
- package/ios/Nodes/REAStyleNode.h +0 -1
- package/ios/Nodes/REAStyleNode.m +2 -4
- package/ios/Nodes/REATransformNode.h +0 -1
- package/ios/Nodes/REATransformNode.m +3 -5
- package/ios/Nodes/REAValueNode.m +5 -7
- package/ios/REAEventDispatcher.m +3 -3
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +29 -40
- package/ios/REANodesManager.h +11 -19
- package/ios/REANodesManager.m +105 -130
- package/ios/REAUtils.h +5 -3
- package/ios/Transitioning/RCTConvert+REATransition.m +45 -29
- package/ios/Transitioning/REAAllTransitions.h +2 -2
- package/ios/Transitioning/REAAllTransitions.m +14 -25
- package/ios/Transitioning/REATransition.h +8 -7
- package/ios/Transitioning/REATransition.m +19 -16
- package/ios/Transitioning/REATransitionAnimation.h +1 -1
- package/ios/Transitioning/REATransitionAnimation.m +2 -3
- package/ios/Transitioning/REATransitionManager.m +3 -3
- package/ios/native/NativeMethods.h +15 -5
- package/ios/native/NativeProxy.h +4 -3
- package/ios/native/NativeProxy.mm +19 -5
- package/ios/native/REAIOSErrorHandler.h +13 -10
- package/ios/native/REAIOSLogger.h +8 -8
- package/ios/native/REAIOSScheduler.h +5 -5
- package/ios/native/REAIOSScheduler.mm +7 -5
- package/ios/native/REAInitializer.h +37 -0
- package/ios/native/REAInitializer.mm +63 -0
- package/ios/native/UIResponder+Reanimated.mm +9 -48
- package/lib/ConfigHelper.js +1 -0
- package/lib/ReanimatedModule.native.js +10 -2
- package/lib/createAnimatedComponent.js +64 -30
- package/lib/reanimated1/core/AnimatedAlways.js +1 -1
- package/lib/reanimated1/core/AnimatedBezier.js +1 -1
- package/lib/reanimated1/core/AnimatedBlock.js +1 -1
- package/lib/reanimated1/core/AnimatedCall.js +1 -1
- package/lib/reanimated1/core/AnimatedCallFunc.js +1 -1
- package/lib/reanimated1/core/AnimatedConcat.js +1 -1
- package/lib/reanimated1/core/AnimatedCond.js +1 -1
- package/lib/reanimated1/core/AnimatedDebug.js +1 -1
- package/lib/reanimated1/core/AnimatedEvent.js +1 -1
- package/lib/reanimated1/core/AnimatedFunction.js +1 -1
- package/lib/reanimated1/core/AnimatedOperator.js +1 -1
- package/lib/reanimated1/core/AnimatedParam.js +1 -1
- package/lib/reanimated1/core/AnimatedProps.js +2 -2
- package/lib/reanimated1/core/AnimatedSet.js +1 -1
- package/lib/reanimated1/core/AnimatedStartClock.js +1 -1
- package/lib/reanimated1/core/AnimatedStopClock.js +1 -1
- package/lib/reanimated1/core/AnimatedStyle.js +1 -1
- package/lib/reanimated1/core/AnimatedTransform.js +1 -1
- package/lib/reanimated1/core/Core.test.js +30 -0
- package/lib/reanimated1/core/InternalAnimatedValue.js +1 -1
- package/lib/reanimated1/core/__mocks__/AnimatedProps.js +1 -1
- package/lib/reanimated1/derived/interpolate.js +1 -1
- package/lib/reanimated2/Colors.js +16 -12
- package/lib/reanimated2/NativeMethods.js +3 -14
- package/lib/reanimated2/{NativeReanimated.native.js → NativeReanimated/NativeReanimated.js} +19 -24
- package/lib/reanimated2/NativeReanimated/index.js +15 -0
- package/lib/reanimated2/PlatformChecker.js +16 -0
- package/lib/reanimated2/PropAdapters.js +14 -4
- package/lib/reanimated2/UpdateProps.js +14 -11
- package/lib/reanimated2/ViewDescriptorsSet.js +73 -0
- package/lib/reanimated2/WorkletEventHandler.js +15 -13
- package/lib/reanimated2/animation/commonTypes.js +1 -0
- package/lib/reanimated2/animation/decay.js +71 -0
- package/lib/reanimated2/animation/delay.js +64 -0
- package/lib/reanimated2/animation/index.js +8 -0
- package/lib/reanimated2/animation/repeat.js +69 -0
- package/lib/reanimated2/animation/sequence.js +72 -0
- package/lib/reanimated2/animation/spring.js +101 -0
- package/lib/reanimated2/animation/styleAnimation.js +166 -0
- package/lib/reanimated2/animation/timing.js +64 -0
- package/lib/reanimated2/animation/util.js +157 -0
- package/lib/reanimated2/commonTypes.js +1 -0
- package/lib/reanimated2/core.js +35 -39
- package/lib/reanimated2/globals.d.ts +47 -1
- package/lib/reanimated2/hook/Hooks.js +9 -0
- package/lib/reanimated2/hook/commonTypes.js +1 -0
- package/lib/reanimated2/hook/index.js +8 -0
- package/lib/reanimated2/hook/useAnimatedGestureHandler.js +50 -0
- package/lib/reanimated2/hook/useAnimatedReaction.js +37 -0
- package/lib/reanimated2/hook/useAnimatedRef.js +25 -0
- package/lib/reanimated2/hook/useAnimatedScrollHandler.js +41 -0
- package/lib/reanimated2/hook/useAnimatedStyle.js +376 -0
- package/lib/reanimated2/hook/useDerivedValue.js +36 -0
- package/lib/reanimated2/hook/useSharedValue.js +17 -0
- package/lib/reanimated2/hook/utils.js +175 -0
- package/lib/reanimated2/index.js +3 -2
- package/lib/reanimated2/interpolation.js +95 -86
- package/lib/reanimated2/jestUtils.js +0 -12
- package/lib/reanimated2/js-reanimated/JSReanimated.js +9 -10
- package/lib/reanimated2/js-reanimated/index.js +57 -1
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +58 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +69 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +193 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +1 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +3 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +325 -207
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +36 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +235 -187
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +327 -269
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +146 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +85 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +119 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +289 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +159 -121
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +83 -65
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +371 -277
- package/lib/reanimated2/layoutReanimation/defaultAnimations/index.js +4 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +78 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +128 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +37 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +41 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +34 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +46 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +6 -0
- package/lib/reanimated2/layoutReanimation/index.js +3 -2
- package/lib/reanimated2/platform-specific/RNRenderer.web.js +2 -0
- package/lib/reanimated2/utils.js +9 -0
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
- package/package.json +21 -10
- package/plugin.js +244 -85
- package/react-native-reanimated.d.ts +531 -453
- package/src/ConfigHelper.js +1 -0
- package/src/ReanimatedModule.native.js +10 -2
- package/src/createAnimatedComponent.js +64 -30
- package/src/reanimated1/core/AnimatedAlways.js +1 -1
- package/src/reanimated1/core/AnimatedBezier.js +1 -1
- package/src/reanimated1/core/AnimatedBlock.js +1 -1
- package/src/reanimated1/core/AnimatedCall.js +1 -1
- package/src/reanimated1/core/AnimatedCallFunc.js +1 -1
- package/src/reanimated1/core/AnimatedConcat.js +1 -1
- package/src/reanimated1/core/AnimatedCond.js +1 -1
- package/src/reanimated1/core/AnimatedDebug.js +1 -1
- package/src/reanimated1/core/AnimatedEvent.js +1 -1
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/core/AnimatedOperator.js +1 -1
- package/src/reanimated1/core/AnimatedParam.js +1 -1
- package/src/reanimated1/core/AnimatedProps.js +2 -2
- package/src/reanimated1/core/AnimatedSet.js +1 -1
- package/src/reanimated1/core/AnimatedStartClock.js +1 -1
- package/src/reanimated1/core/AnimatedStopClock.js +1 -1
- package/src/reanimated1/core/AnimatedStyle.js +1 -1
- package/src/reanimated1/core/AnimatedTransform.js +1 -1
- package/src/reanimated1/core/Core.test.js +30 -0
- package/src/reanimated1/core/InternalAnimatedValue.js +1 -1
- package/src/reanimated1/core/__mocks__/AnimatedProps.js +1 -1
- package/src/reanimated1/derived/interpolate.js +1 -1
- package/src/reanimated2/Colors.ts +30 -27
- package/src/reanimated2/Easing.ts +3 -1
- package/src/reanimated2/NativeMethods.ts +26 -16
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +78 -0
- package/src/reanimated2/NativeReanimated/index.ts +18 -0
- package/src/reanimated2/PlatformChecker.ts +21 -0
- package/src/reanimated2/PropAdapters.ts +52 -34
- package/src/reanimated2/UpdateProps.ts +40 -20
- package/src/reanimated2/ViewDescriptorsSet.ts +108 -0
- package/src/reanimated2/WorkletEventHandler.ts +41 -23
- package/src/reanimated2/animation/commonTypes.ts +48 -0
- package/src/reanimated2/animation/decay.ts +141 -0
- package/src/reanimated2/animation/delay.ts +103 -0
- package/src/reanimated2/animation/index.ts +16 -0
- package/src/reanimated2/animation/repeat.ts +128 -0
- package/src/reanimated2/animation/sequence.ts +110 -0
- package/src/reanimated2/animation/spring.ts +165 -0
- package/src/reanimated2/animation/styleAnimation.ts +253 -0
- package/src/reanimated2/animation/timing.ts +109 -0
- package/src/reanimated2/animation/util.ts +242 -0
- package/src/reanimated2/commonTypes.ts +81 -0
- package/src/reanimated2/core.ts +128 -82
- package/src/reanimated2/globals.d.ts +47 -1
- package/src/reanimated2/hook/Hooks.ts +16 -0
- package/src/reanimated2/hook/commonTypes.ts +12 -0
- package/src/reanimated2/hook/index.ts +25 -0
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +110 -0
- package/src/reanimated2/hook/useAnimatedReaction.ts +49 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +34 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +83 -0
- package/src/reanimated2/hook/useAnimatedStyle.ts +538 -0
- package/src/reanimated2/hook/useDerivedValue.ts +48 -0
- package/src/reanimated2/hook/useSharedValue.ts +22 -0
- package/src/reanimated2/hook/utils.ts +259 -0
- package/src/reanimated2/index.ts +3 -2
- package/src/reanimated2/interpolation.ts +170 -101
- package/src/reanimated2/jestUtils.ts +0 -12
- package/src/reanimated2/js-reanimated/JSReanimated.ts +47 -22
- package/src/reanimated2/js-reanimated/Mapper.ts +1 -1
- package/src/reanimated2/js-reanimated/index.ts +71 -0
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +62 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +91 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +263 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +78 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +16 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +243 -121
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +43 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +95 -53
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +114 -64
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +179 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +93 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +132 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +333 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +84 -50
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +41 -23
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +234 -154
- package/src/reanimated2/layoutReanimation/defaultAnimations/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +104 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +213 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +60 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +58 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +41 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +78 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/index.ts +6 -0
- package/src/reanimated2/layoutReanimation/index.ts +3 -2
- package/src/reanimated2/platform-specific/RNRenderer.web.ts +2 -0
- package/src/reanimated2/utils.ts +21 -0
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAAnimationRootView.h +0 -12
- package/ios/LayoutReanimation/REAAnimationRootView.m +0 -16
- package/ios/LayoutReanimation/REAAnimationRootViewManager.h +0 -9
- package/ios/LayoutReanimation/REAAnimationRootViewManager.m +0 -49
- package/ios/LayoutReanimation/REAReactBatchObserver.h +0 -20
- package/ios/LayoutReanimation/REAReactBatchObserver.m +0 -125
- package/ios/LayoutReanimation/REASnapshooter.h +0 -19
- package/ios/LayoutReanimation/REASnapshooter.m +0 -64
- package/ios/LayoutReanimation/REAViewTraverser.h +0 -13
- package/ios/LayoutReanimation/REAViewTraverser.m +0 -40
- package/lib/reanimated2/Hooks.js +0 -732
- package/lib/reanimated2/NativeReanimated.js +0 -4
- package/lib/reanimated2/animations.js +0 -713
- package/lib/reanimated2/js-reanimated/index.web.js +0 -20
- package/lib/reanimated2/layoutReanimation/AnimatedRoot.js +0 -55
- package/lib/reanimated2/layoutReanimation/defaultAnimationsBuilder.js +0 -374
- package/src/reanimated2/Hooks.ts +0 -918
- package/src/reanimated2/NativeReanimated.native.ts +0 -61
- package/src/reanimated2/NativeReanimated.ts +0 -5
- package/src/reanimated2/animations.ts +0 -868
- package/src/reanimated2/js-reanimated/index.js +0 -0
- package/src/reanimated2/js-reanimated/index.web.ts +0 -29
- package/src/reanimated2/layoutReanimation/AnimatedRoot.tsx +0 -68
- package/src/reanimated2/layoutReanimation/defaultAnimationsBuilder.ts +0 -440
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
#include "LayoutAnimationsProxy.h"
|
|
2
|
+
#include "FrozenObject.h"
|
|
2
3
|
#include "MutableValue.h"
|
|
3
|
-
#include "ValueWrapper.h"
|
|
4
4
|
#include "ShareableValue.h"
|
|
5
|
-
#include "
|
|
5
|
+
#include "ValueWrapper.h"
|
|
6
6
|
|
|
7
7
|
namespace reanimated {
|
|
8
8
|
|
|
9
9
|
const long long idOffset = 1e9;
|
|
10
10
|
|
|
11
|
-
LayoutAnimationsProxy::LayoutAnimationsProxy(
|
|
12
|
-
|
|
11
|
+
LayoutAnimationsProxy::LayoutAnimationsProxy(
|
|
12
|
+
std::function<void(int, jsi::Object newProps)> _notifyAboutProgress,
|
|
13
|
+
std::function<void(int, bool)> _notifyAboutEnd)
|
|
14
|
+
: notifyAboutProgress(std::move(_notifyAboutProgress)),
|
|
15
|
+
notifyAboutEnd(std::move(_notifyAboutEnd)) {}
|
|
13
16
|
|
|
14
|
-
void LayoutAnimationsProxy::startObserving(
|
|
17
|
+
void LayoutAnimationsProxy::startObserving(
|
|
18
|
+
int tag,
|
|
19
|
+
std::shared_ptr<MutableValue> sv,
|
|
20
|
+
jsi::Runtime &rt) {
|
|
15
21
|
observedValues[tag] = sv;
|
|
16
|
-
sv->addListener(tag + idOffset, [sv, tag, this, &rt](){
|
|
17
|
-
std::shared_ptr<FrozenObject> newValue =
|
|
22
|
+
sv->addListener(tag + idOffset, [sv, tag, this, &rt]() {
|
|
23
|
+
std::shared_ptr<FrozenObject> newValue =
|
|
24
|
+
ValueWrapper::asFrozenObject(sv->value->valueContainer);
|
|
18
25
|
this->notifyAboutProgress(tag, newValue->shallowClone(rt));
|
|
19
26
|
});
|
|
20
27
|
}
|
|
@@ -33,4 +40,4 @@ void LayoutAnimationsProxy::notifyAboutCancellation(int tag) {
|
|
|
33
40
|
this->notifyAboutEnd(tag, false);
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
}
|
|
43
|
+
} // namespace reanimated
|
|
@@ -1,159 +1,165 @@
|
|
|
1
1
|
#include "NativeReanimatedModule.h"
|
|
2
|
-
#include "ShareableValue.h"
|
|
3
|
-
#include "MapperRegistry.h"
|
|
4
|
-
#include "Mapper.h"
|
|
5
|
-
#include "RuntimeDecorator.h"
|
|
6
|
-
#include "EventHandlerRegistry.h"
|
|
7
|
-
#include "WorkletEventHandler.h"
|
|
8
|
-
#include "FrozenObject.h"
|
|
9
2
|
#include <functional>
|
|
10
|
-
#include <thread>
|
|
11
3
|
#include <memory>
|
|
4
|
+
#include <thread>
|
|
5
|
+
#include "EventHandlerRegistry.h"
|
|
6
|
+
#include "FrozenObject.h"
|
|
12
7
|
#include "JSIStoreValueUser.h"
|
|
8
|
+
#include "Mapper.h"
|
|
9
|
+
#include "MapperRegistry.h"
|
|
13
10
|
#include "ReanimatedHiddenHeaders.h"
|
|
11
|
+
#include "RuntimeDecorator.h"
|
|
12
|
+
#include "ShareableValue.h"
|
|
13
|
+
#include "WorkletEventHandler.h"
|
|
14
14
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
|
-
namespace reanimated
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
res.push_back(mutableValue);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
case ValueType::FrozenArrayType:
|
|
32
|
-
for (auto &it : ValueWrapper::asFrozenArray(sv->valueContainer))
|
|
33
|
-
{
|
|
34
|
-
extractMutables(rt, it, res);
|
|
35
|
-
}
|
|
36
|
-
break;
|
|
37
|
-
case ValueType::RemoteObjectType:
|
|
38
|
-
case ValueType::FrozenObjectType:
|
|
39
|
-
for (auto &it : ValueWrapper::asFrozenObject(sv->valueContainer)->map)
|
|
40
|
-
{
|
|
41
|
-
extractMutables(rt, it.second, res);
|
|
17
|
+
namespace reanimated {
|
|
18
|
+
|
|
19
|
+
void extractMutables(
|
|
20
|
+
jsi::Runtime &rt,
|
|
21
|
+
std::shared_ptr<ShareableValue> sv,
|
|
22
|
+
std::vector<std::shared_ptr<MutableValue>> &res) {
|
|
23
|
+
switch (sv->type) {
|
|
24
|
+
case ValueType::MutableValueType: {
|
|
25
|
+
auto &mutableValue = ValueWrapper::asMutableValue(sv->valueContainer);
|
|
26
|
+
res.push_back(mutableValue);
|
|
27
|
+
break;
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
case ValueType::FrozenArrayType:
|
|
30
|
+
for (auto &it : ValueWrapper::asFrozenArray(sv->valueContainer)) {
|
|
31
|
+
extractMutables(rt, it, res);
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
case ValueType::RemoteObjectType:
|
|
35
|
+
case ValueType::FrozenObjectType:
|
|
36
|
+
for (auto &it : ValueWrapper::asFrozenObject(sv->valueContainer)->map) {
|
|
37
|
+
extractMutables(rt, it.second, res);
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
break;
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
std::vector<std::shared_ptr<MutableValue>> extractMutablesFromArray(
|
|
50
|
-
|
|
45
|
+
std::vector<std::shared_ptr<MutableValue>> extractMutablesFromArray(
|
|
46
|
+
jsi::Runtime &rt,
|
|
47
|
+
const jsi::Array &array,
|
|
48
|
+
NativeReanimatedModule *module) {
|
|
51
49
|
std::vector<std::shared_ptr<MutableValue>> res;
|
|
52
|
-
for (size_t i = 0, size = array.size(rt); i < size; i++)
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
for (size_t i = 0, size = array.size(rt); i < size; i++) {
|
|
51
|
+
auto shareable =
|
|
52
|
+
ShareableValue::adapt(rt, array.getValueAtIndex(rt, i), module);
|
|
55
53
|
extractMutables(rt, shareable, res);
|
|
56
54
|
}
|
|
57
55
|
return res;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
NativeReanimatedModule::NativeReanimatedModule(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
NativeReanimatedModule::NativeReanimatedModule(
|
|
59
|
+
std::shared_ptr<CallInvoker> jsInvoker,
|
|
60
|
+
std::shared_ptr<Scheduler> scheduler,
|
|
61
|
+
std::shared_ptr<jsi::Runtime> rt,
|
|
62
|
+
std::shared_ptr<ErrorHandler> errorHandler,
|
|
63
|
+
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
64
|
+
propObtainer,
|
|
65
|
+
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
66
|
+
PlatformDepMethodsHolder platformDepMethodsHolder)
|
|
67
|
+
: NativeReanimatedModuleSpec(jsInvoker),
|
|
68
|
+
RuntimeManager(rt, errorHandler, scheduler, RuntimeType::UI),
|
|
69
|
+
mapperRegistry(std::make_shared<MapperRegistry>()),
|
|
70
|
+
eventHandlerRegistry(std::make_shared<EventHandlerRegistry>()),
|
|
71
|
+
requestRender(platformDepMethodsHolder.requestRender),
|
|
72
|
+
propObtainer(propObtainer) {
|
|
75
73
|
auto requestAnimationFrame = [=](FrameCallback callback) {
|
|
76
74
|
frameCallbacks.push_back(callback);
|
|
77
75
|
maybeRequestRender();
|
|
78
76
|
};
|
|
79
|
-
|
|
77
|
+
|
|
80
78
|
this->layoutAnimationsProxy = layoutAnimationsProxy;
|
|
81
|
-
|
|
82
|
-
RuntimeDecorator::decorateUIRuntime(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
|
|
80
|
+
RuntimeDecorator::decorateUIRuntime(
|
|
81
|
+
*runtime,
|
|
82
|
+
platformDepMethodsHolder.updaterFunction,
|
|
83
|
+
requestAnimationFrame,
|
|
84
|
+
platformDepMethodsHolder.scrollToFunction,
|
|
85
|
+
platformDepMethodsHolder.measuringFunction,
|
|
86
|
+
platformDepMethodsHolder.getCurrentTime,
|
|
87
|
+
layoutAnimationsProxy);
|
|
88
|
+
onRenderCallback = [this](double timestampMs) {
|
|
90
89
|
this->renderRequested = false;
|
|
91
90
|
this->onRender(timestampMs);
|
|
92
91
|
};
|
|
93
92
|
updaterFunction = platformDepMethodsHolder.updaterFunction;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
void NativeReanimatedModule::installCoreFunctions(
|
|
97
|
-
|
|
95
|
+
void NativeReanimatedModule::installCoreFunctions(
|
|
96
|
+
jsi::Runtime &rt,
|
|
97
|
+
const jsi::Value &valueSetter) {
|
|
98
98
|
this->valueSetter = ShareableValue::adapt(rt, valueSetter, this);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
jsi::Value NativeReanimatedModule::makeShareable(
|
|
102
|
-
|
|
101
|
+
jsi::Value NativeReanimatedModule::makeShareable(
|
|
102
|
+
jsi::Runtime &rt,
|
|
103
|
+
const jsi::Value &value) {
|
|
103
104
|
return ShareableValue::adapt(rt, value, this)->getValue(rt);
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
jsi::Value NativeReanimatedModule::makeMutable(
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
jsi::Value NativeReanimatedModule::makeMutable(
|
|
108
|
+
jsi::Runtime &rt,
|
|
109
|
+
const jsi::Value &value) {
|
|
110
|
+
return ShareableValue::adapt(rt, value, this, ValueType::MutableValueType)
|
|
111
|
+
->getValue(rt);
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
jsi::Value NativeReanimatedModule::makeRemote(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
jsi::Value NativeReanimatedModule::makeRemote(
|
|
115
|
+
jsi::Runtime &rt,
|
|
116
|
+
const jsi::Value &value) {
|
|
117
|
+
return ShareableValue::adapt(rt, value, this, ValueType::RemoteObjectType)
|
|
118
|
+
->getValue(rt);
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
jsi::Value NativeReanimatedModule::startMapper(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const jsi::Value &name
|
|
124
|
-
)
|
|
125
|
-
{
|
|
122
|
+
jsi::Runtime &rt,
|
|
123
|
+
const jsi::Value &worklet,
|
|
124
|
+
const jsi::Value &inputs,
|
|
125
|
+
const jsi::Value &outputs,
|
|
126
|
+
const jsi::Value &updater,
|
|
127
|
+
const jsi::Value &viewDescriptors) {
|
|
126
128
|
static unsigned long MAPPER_ID = 1;
|
|
127
129
|
|
|
128
130
|
unsigned long newMapperId = MAPPER_ID++;
|
|
129
131
|
auto mapperShareable = ShareableValue::adapt(rt, worklet, this);
|
|
130
|
-
auto inputMutables =
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
auto inputMutables =
|
|
133
|
+
extractMutablesFromArray(rt, inputs.asObject(rt).asArray(rt), this);
|
|
134
|
+
auto outputMutables =
|
|
135
|
+
extractMutablesFromArray(rt, outputs.asObject(rt).asArray(rt), this);
|
|
136
|
+
|
|
133
137
|
int optimalizationLvl = 0;
|
|
134
|
-
auto optimalization =
|
|
135
|
-
|
|
138
|
+
auto optimalization =
|
|
139
|
+
updater.asObject(rt).getProperty(rt, "__optimalization");
|
|
140
|
+
if (optimalization.isNumber()) {
|
|
136
141
|
optimalizationLvl = optimalization.asNumber();
|
|
137
142
|
}
|
|
138
143
|
auto updaterSV = ShareableValue::adapt(rt, updater, this);
|
|
139
|
-
|
|
140
|
-
const std::string nameStr = name.asString(rt).utf8(rt);
|
|
144
|
+
auto viewDescriptorsSV = ShareableValue::adapt(rt, viewDescriptors, this);
|
|
141
145
|
|
|
142
146
|
scheduler->scheduleOnUI([=] {
|
|
143
|
-
auto mapperFunction =
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
auto mapperFunction =
|
|
148
|
+
mapperShareable->getValue(*runtime).asObject(*runtime).asFunction(
|
|
149
|
+
*runtime);
|
|
150
|
+
std::shared_ptr<jsi::Function> mapperFunctionPointer =
|
|
151
|
+
std::make_shared<jsi::Function>(std::move(mapperFunction));
|
|
152
|
+
|
|
146
153
|
std::shared_ptr<Mapper> mapperPointer = std::make_shared<Mapper>(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
);
|
|
154
|
+
this,
|
|
155
|
+
newMapperId,
|
|
156
|
+
mapperFunctionPointer,
|
|
157
|
+
inputMutables,
|
|
158
|
+
outputMutables);
|
|
159
|
+
if (optimalizationLvl > 0) {
|
|
160
|
+
mapperPointer->enableFastMode(
|
|
161
|
+
optimalizationLvl, updaterSV, viewDescriptorsSV);
|
|
162
|
+
}
|
|
157
163
|
mapperRegistry->startMapper(mapperPointer);
|
|
158
164
|
maybeRequestRender();
|
|
159
165
|
});
|
|
@@ -161,8 +167,9 @@ jsi::Value NativeReanimatedModule::startMapper(
|
|
|
161
167
|
return jsi::Value((double)newMapperId);
|
|
162
168
|
}
|
|
163
169
|
|
|
164
|
-
void NativeReanimatedModule::stopMapper(
|
|
165
|
-
|
|
170
|
+
void NativeReanimatedModule::stopMapper(
|
|
171
|
+
jsi::Runtime &rt,
|
|
172
|
+
const jsi::Value &mapperId) {
|
|
166
173
|
unsigned long id = mapperId.asNumber();
|
|
167
174
|
scheduler->scheduleOnUI([=] {
|
|
168
175
|
mapperRegistry->stopMapper(id);
|
|
@@ -170,8 +177,10 @@ void NativeReanimatedModule::stopMapper(jsi::Runtime &rt, const jsi::Value &mapp
|
|
|
170
177
|
});
|
|
171
178
|
}
|
|
172
179
|
|
|
173
|
-
jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
174
|
-
|
|
180
|
+
jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
181
|
+
jsi::Runtime &rt,
|
|
182
|
+
const jsi::Value &eventHash,
|
|
183
|
+
const jsi::Value &worklet) {
|
|
175
184
|
static unsigned long EVENT_HANDLER_ID = 1;
|
|
176
185
|
|
|
177
186
|
unsigned long newRegistrationId = EVENT_HANDLER_ID++;
|
|
@@ -179,37 +188,45 @@ jsi::Value NativeReanimatedModule::registerEventHandler(jsi::Runtime &rt, const
|
|
|
179
188
|
auto handlerShareable = ShareableValue::adapt(rt, worklet, this);
|
|
180
189
|
|
|
181
190
|
scheduler->scheduleOnUI([=] {
|
|
182
|
-
auto handlerFunction =
|
|
183
|
-
|
|
191
|
+
auto handlerFunction =
|
|
192
|
+
handlerShareable->getValue(*runtime).asObject(*runtime).asFunction(
|
|
193
|
+
*runtime);
|
|
194
|
+
auto handler = std::make_shared<WorkletEventHandler>(
|
|
195
|
+
newRegistrationId, eventName, std::move(handlerFunction));
|
|
184
196
|
eventHandlerRegistry->registerEventHandler(handler);
|
|
185
197
|
});
|
|
186
198
|
|
|
187
199
|
return jsi::Value((double)newRegistrationId);
|
|
188
200
|
}
|
|
189
201
|
|
|
190
|
-
void NativeReanimatedModule::unregisterEventHandler(
|
|
191
|
-
|
|
202
|
+
void NativeReanimatedModule::unregisterEventHandler(
|
|
203
|
+
jsi::Runtime &rt,
|
|
204
|
+
const jsi::Value ®istrationId) {
|
|
192
205
|
unsigned long id = registrationId.asNumber();
|
|
193
|
-
scheduler->scheduleOnUI(
|
|
194
|
-
|
|
195
|
-
});
|
|
206
|
+
scheduler->scheduleOnUI(
|
|
207
|
+
[=] { eventHandlerRegistry->unregisterEventHandler(id); });
|
|
196
208
|
}
|
|
197
209
|
|
|
198
|
-
jsi::Value NativeReanimatedModule::getViewProp(
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
jsi::Value NativeReanimatedModule::getViewProp(
|
|
211
|
+
jsi::Runtime &rt,
|
|
212
|
+
const jsi::Value &viewTag,
|
|
213
|
+
const jsi::Value &propName,
|
|
214
|
+
const jsi::Value &callback) {
|
|
201
215
|
const int viewTagInt = (int)viewTag.asNumber();
|
|
202
216
|
std::string propNameStr = propName.asString(rt).utf8(rt);
|
|
203
217
|
jsi::Function fun = callback.getObject(rt).asFunction(rt);
|
|
204
|
-
std::shared_ptr<jsi::Function> funPtr =
|
|
218
|
+
std::shared_ptr<jsi::Function> funPtr =
|
|
219
|
+
std::make_shared<jsi::Function>(std::move(fun));
|
|
205
220
|
|
|
206
221
|
scheduler->scheduleOnUI([&rt, viewTagInt, funPtr, this, propNameStr]() {
|
|
207
|
-
const jsi::String propNameValue =
|
|
222
|
+
const jsi::String propNameValue =
|
|
223
|
+
jsi::String::createFromUtf8(rt, propNameStr);
|
|
208
224
|
jsi::Value result = propObtainer(rt, viewTagInt, propNameValue);
|
|
209
225
|
std::string resultStr = result.asString(rt).utf8(rt);
|
|
210
226
|
|
|
211
227
|
scheduler->scheduleOnJS([&rt, resultStr, funPtr]() {
|
|
212
|
-
const jsi::String resultValue =
|
|
228
|
+
const jsi::String resultValue =
|
|
229
|
+
jsi::String::createFromUtf8(rt, resultStr);
|
|
213
230
|
funPtr->call(rt, resultValue);
|
|
214
231
|
});
|
|
215
232
|
});
|
|
@@ -217,72 +234,59 @@ jsi::Value NativeReanimatedModule::getViewProp(jsi::Runtime &rt, const jsi::Valu
|
|
|
217
234
|
return jsi::Value::undefined();
|
|
218
235
|
}
|
|
219
236
|
|
|
220
|
-
void NativeReanimatedModule::onEvent(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
maybeRequestRender();
|
|
229
|
-
}
|
|
237
|
+
void NativeReanimatedModule::onEvent(
|
|
238
|
+
std::string eventName,
|
|
239
|
+
std::string eventAsString) {
|
|
240
|
+
try {
|
|
241
|
+
eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString);
|
|
242
|
+
mapperRegistry->execute(*runtime);
|
|
243
|
+
if (mapperRegistry->needRunOnRender()) {
|
|
244
|
+
maybeRequestRender();
|
|
230
245
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
} catch (std::exception &e) {
|
|
247
|
+
std::string str = e.what();
|
|
248
|
+
this->errorHandler->setError(str);
|
|
249
|
+
this->errorHandler->raise();
|
|
250
|
+
} catch (...) {
|
|
251
|
+
std::string str = "OnEvent error";
|
|
252
|
+
this->errorHandler->setError(str);
|
|
253
|
+
this->errorHandler->raise();
|
|
239
254
|
}
|
|
240
255
|
}
|
|
241
256
|
|
|
242
|
-
bool NativeReanimatedModule::isAnyHandlerWaitingForEvent(
|
|
257
|
+
bool NativeReanimatedModule::isAnyHandlerWaitingForEvent(
|
|
258
|
+
std::string eventName) {
|
|
243
259
|
return eventHandlerRegistry->isAnyHandlerWaitingForEvent(eventName);
|
|
244
260
|
}
|
|
245
261
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
{
|
|
249
|
-
if (!renderRequested)
|
|
250
|
-
{
|
|
262
|
+
void NativeReanimatedModule::maybeRequestRender() {
|
|
263
|
+
if (!renderRequested) {
|
|
251
264
|
renderRequested = true;
|
|
252
265
|
requestRender(onRenderCallback, *this->runtime);
|
|
253
266
|
}
|
|
254
267
|
}
|
|
255
268
|
|
|
256
|
-
void NativeReanimatedModule::onRender(double timestampMs)
|
|
257
|
-
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
callback(timestampMs);
|
|
265
|
-
}
|
|
266
|
-
mapperRegistry->execute(*runtime);
|
|
269
|
+
void NativeReanimatedModule::onRender(double timestampMs) {
|
|
270
|
+
try {
|
|
271
|
+
std::vector<FrameCallback> callbacks = frameCallbacks;
|
|
272
|
+
frameCallbacks.clear();
|
|
273
|
+
for (auto &callback : callbacks) {
|
|
274
|
+
callback(timestampMs);
|
|
275
|
+
}
|
|
276
|
+
mapperRegistry->execute(*runtime);
|
|
267
277
|
|
|
268
|
-
if (mapperRegistry->needRunOnRender())
|
|
269
|
-
{
|
|
278
|
+
if (mapperRegistry->needRunOnRender()) {
|
|
270
279
|
maybeRequestRender();
|
|
271
280
|
}
|
|
272
|
-
} catch(std::exception &e) {
|
|
281
|
+
} catch (std::exception &e) {
|
|
273
282
|
std::string str = e.what();
|
|
274
283
|
this->errorHandler->setError(str);
|
|
275
284
|
this->errorHandler->raise();
|
|
276
|
-
} catch(...) {
|
|
285
|
+
} catch (...) {
|
|
277
286
|
std::string str = "OnRender error";
|
|
278
287
|
this->errorHandler->setError(str);
|
|
279
288
|
this->errorHandler->raise();
|
|
280
289
|
}
|
|
281
290
|
}
|
|
282
291
|
|
|
283
|
-
NativeReanimatedModule::~NativeReanimatedModule()
|
|
284
|
-
{
|
|
285
|
-
StoreUser::clearStore();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
292
|
} // namespace reanimated
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
namespace reanimated {
|
|
4
4
|
|
|
5
|
-
static jsi::Value
|
|
5
|
+
static jsi::Value
|
|
6
|
+
__hostFunction_NativeReanimatedModuleSpec_installCoreFunctions(
|
|
6
7
|
jsi::Runtime &rt,
|
|
7
8
|
TurboModule &turboModule,
|
|
8
9
|
const jsi::Value *args,
|
|
9
10
|
size_t count) {
|
|
10
11
|
static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
11
|
-
|
|
12
|
+
->installCoreFunctions(rt, std::move(args[0]));
|
|
12
13
|
return jsi::Value::undefined();
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -20,7 +21,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeShareable(
|
|
|
20
21
|
const jsi::Value *args,
|
|
21
22
|
size_t count) {
|
|
22
23
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
23
|
-
|
|
24
|
+
->makeShareable(rt, std::move(args[0]));
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeMutable(
|
|
@@ -29,7 +30,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeMutable(
|
|
|
29
30
|
const jsi::Value *args,
|
|
30
31
|
size_t count) {
|
|
31
32
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
32
|
-
|
|
33
|
+
->makeMutable(rt, std::move(args[0]));
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeRemote(
|
|
@@ -38,7 +39,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeRemote(
|
|
|
38
39
|
const jsi::Value *args,
|
|
39
40
|
size_t count) {
|
|
40
41
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
41
|
-
|
|
42
|
+
->makeRemote(rt, std::move(args[0]));
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
static jsi::Value __hostFunction_NativeReanimatedModuleSpec_startMapper(
|
|
@@ -47,13 +48,13 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_startMapper(
|
|
|
47
48
|
const jsi::Value *args,
|
|
48
49
|
size_t count) {
|
|
49
50
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
50
|
-
->startMapper(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
->startMapper(
|
|
52
|
+
rt,
|
|
53
|
+
std::move(args[0]),
|
|
54
|
+
std::move(args[1]),
|
|
55
|
+
std::move(args[2]),
|
|
56
|
+
std::move(args[3]),
|
|
57
|
+
std::move(args[4]));
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
static jsi::Value __hostFunction_NativeReanimatedModuleSpec_stopMapper(
|
|
@@ -66,7 +67,8 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_stopMapper(
|
|
|
66
67
|
return jsi::Value::undefined();
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
static jsi::Value
|
|
70
|
+
static jsi::Value
|
|
71
|
+
__hostFunction_NativeReanimatedModuleSpec_registerEventHandler(
|
|
70
72
|
jsi::Runtime &rt,
|
|
71
73
|
TurboModule &turboModule,
|
|
72
74
|
const jsi::Value *args,
|
|
@@ -75,7 +77,8 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_registerEventHandler
|
|
|
75
77
|
->registerEventHandler(rt, std::move(args[0]), std::move(args[1]));
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
static jsi::Value
|
|
80
|
+
static jsi::Value
|
|
81
|
+
__hostFunction_NativeReanimatedModuleSpec_unregisterEventHandler(
|
|
79
82
|
jsi::Runtime &rt,
|
|
80
83
|
TurboModule &turboModule,
|
|
81
84
|
const jsi::Value *args,
|
|
@@ -91,37 +94,36 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_getViewProp(
|
|
|
91
94
|
const jsi::Value *args,
|
|
92
95
|
size_t count) {
|
|
93
96
|
static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
->getViewProp(
|
|
98
|
+
rt, std::move(args[0]), std::move(args[1]), std::move(args[2]));
|
|
99
|
+
return jsi::Value::undefined();
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
102
|
+
NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
103
|
+
std::shared_ptr<CallInvoker> jsInvoker)
|
|
99
104
|
: TurboModule("NativeReanimated", jsInvoker) {
|
|
100
105
|
methodMap_["installCoreFunctions"] = MethodMetadata{
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
1, __hostFunction_NativeReanimatedModuleSpec_installCoreFunctions};
|
|
103
107
|
|
|
104
108
|
methodMap_["makeShareable"] = MethodMetadata{
|
|
105
109
|
1, __hostFunction_NativeReanimatedModuleSpec_makeShareable};
|
|
106
|
-
methodMap_["makeMutable"] =
|
|
107
|
-
1, __hostFunction_NativeReanimatedModuleSpec_makeMutable};
|
|
108
|
-
methodMap_["makeRemote"] =
|
|
109
|
-
1, __hostFunction_NativeReanimatedModuleSpec_makeRemote};
|
|
110
|
-
|
|
110
|
+
methodMap_["makeMutable"] =
|
|
111
|
+
MethodMetadata{1, __hostFunction_NativeReanimatedModuleSpec_makeMutable};
|
|
112
|
+
methodMap_["makeRemote"] =
|
|
113
|
+
MethodMetadata{1, __hostFunction_NativeReanimatedModuleSpec_makeRemote};
|
|
111
114
|
|
|
112
|
-
methodMap_["startMapper"] =
|
|
113
|
-
|
|
114
|
-
methodMap_["stopMapper"] =
|
|
115
|
-
|
|
115
|
+
methodMap_["startMapper"] =
|
|
116
|
+
MethodMetadata{5, __hostFunction_NativeReanimatedModuleSpec_startMapper};
|
|
117
|
+
methodMap_["stopMapper"] =
|
|
118
|
+
MethodMetadata{1, __hostFunction_NativeReanimatedModuleSpec_stopMapper};
|
|
116
119
|
|
|
117
120
|
methodMap_["registerEventHandler"] = MethodMetadata{
|
|
118
|
-
|
|
121
|
+
2, __hostFunction_NativeReanimatedModuleSpec_registerEventHandler};
|
|
119
122
|
methodMap_["unregisterEventHandler"] = MethodMetadata{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
methodMap_["getViewProp"] = MethodMetadata{
|
|
123
|
-
3, __hostFunction_NativeReanimatedModuleSpec_getViewProp};
|
|
124
|
-
}
|
|
123
|
+
1, __hostFunction_NativeReanimatedModuleSpec_unregisterEventHandler};
|
|
125
124
|
|
|
125
|
+
methodMap_["getViewProp"] =
|
|
126
|
+
MethodMetadata{3, __hostFunction_NativeReanimatedModuleSpec_getViewProp};
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
} // namespace reanimated
|