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,18 +1,17 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "NativeReanimatedModuleSpec.h"
|
|
4
|
-
#include "Scheduler.h"
|
|
5
|
-
#include "ErrorHandler.h"
|
|
6
|
-
#include "RuntimeDecorator.h"
|
|
7
|
-
#include "PlatformDepMethodsHolder.h"
|
|
8
3
|
#include <unistd.h>
|
|
9
4
|
#include <memory>
|
|
10
5
|
#include <vector>
|
|
11
|
-
#include "
|
|
6
|
+
#include "ErrorHandler.h"
|
|
12
7
|
#include "LayoutAnimationsProxy.h"
|
|
8
|
+
#include "NativeReanimatedModuleSpec.h"
|
|
9
|
+
#include "PlatformDepMethodsHolder.h"
|
|
10
|
+
#include "RuntimeDecorator.h"
|
|
11
|
+
#include "RuntimeManager.h"
|
|
12
|
+
#include "Scheduler.h"
|
|
13
13
|
|
|
14
|
-
namespace reanimated
|
|
15
|
-
{
|
|
14
|
+
namespace reanimated {
|
|
16
15
|
|
|
17
16
|
using FrameCallback = std::function<void(double)>;
|
|
18
17
|
|
|
@@ -21,41 +20,51 @@ class MutableValue;
|
|
|
21
20
|
class MapperRegistry;
|
|
22
21
|
class EventHandlerRegistry;
|
|
23
22
|
|
|
24
|
-
class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
25
|
-
{
|
|
23
|
+
class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
24
|
+
public RuntimeManager {
|
|
26
25
|
friend ShareableValue;
|
|
27
26
|
friend MutableValue;
|
|
28
|
-
|
|
29
|
-
public:
|
|
30
|
-
NativeReanimatedModule(std::shared_ptr<CallInvoker> jsInvoker,
|
|
31
|
-
std::shared_ptr<Scheduler> scheduler,
|
|
32
|
-
std::shared_ptr<jsi::Runtime> rt,
|
|
33
|
-
std::shared_ptr<ErrorHandler> errorHandler,
|
|
34
|
-
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)> propObtainer,
|
|
35
|
-
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
36
|
-
PlatformDepMethodsHolder platformDepMethodsHolder);
|
|
37
27
|
|
|
38
|
-
|
|
28
|
+
public:
|
|
29
|
+
NativeReanimatedModule(
|
|
30
|
+
std::shared_ptr<CallInvoker> jsInvoker,
|
|
31
|
+
std::shared_ptr<Scheduler> scheduler,
|
|
32
|
+
std::shared_ptr<jsi::Runtime> rt,
|
|
33
|
+
std::shared_ptr<ErrorHandler> errorHandler,
|
|
34
|
+
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
35
|
+
propObtainer,
|
|
36
|
+
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
37
|
+
PlatformDepMethodsHolder platformDepMethodsHolder);
|
|
39
38
|
|
|
40
|
-
void installCoreFunctions(jsi::Runtime &rt, const jsi::Value &valueSetter)
|
|
39
|
+
void installCoreFunctions(jsi::Runtime &rt, const jsi::Value &valueSetter)
|
|
40
|
+
override;
|
|
41
41
|
|
|
42
42
|
jsi::Value makeShareable(jsi::Runtime &rt, const jsi::Value &value) override;
|
|
43
43
|
jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) override;
|
|
44
44
|
jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) override;
|
|
45
45
|
|
|
46
|
-
jsi::Value startMapper(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
jsi::Value startMapper(
|
|
47
|
+
jsi::Runtime &rt,
|
|
48
|
+
const jsi::Value &worklet,
|
|
49
|
+
const jsi::Value &inputs,
|
|
50
|
+
const jsi::Value &outputs,
|
|
51
|
+
const jsi::Value &updater,
|
|
52
|
+
const jsi::Value &viewDescriptors) override;
|
|
53
53
|
void stopMapper(jsi::Runtime &rt, const jsi::Value &mapperId) override;
|
|
54
54
|
|
|
55
|
-
jsi::Value registerEventHandler(
|
|
56
|
-
|
|
55
|
+
jsi::Value registerEventHandler(
|
|
56
|
+
jsi::Runtime &rt,
|
|
57
|
+
const jsi::Value &eventHash,
|
|
58
|
+
const jsi::Value &worklet) override;
|
|
59
|
+
void unregisterEventHandler(
|
|
60
|
+
jsi::Runtime &rt,
|
|
61
|
+
const jsi::Value ®istrationId) override;
|
|
57
62
|
|
|
58
|
-
jsi::Value getViewProp(
|
|
63
|
+
jsi::Value getViewProp(
|
|
64
|
+
jsi::Runtime &rt,
|
|
65
|
+
const jsi::Value &viewTag,
|
|
66
|
+
const jsi::Value &propName,
|
|
67
|
+
const jsi::Value &callback) override;
|
|
59
68
|
|
|
60
69
|
void onRender(double timestampMs);
|
|
61
70
|
void onEvent(std::string eventName, std::string eventAsString);
|
|
@@ -63,14 +72,16 @@ public:
|
|
|
63
72
|
|
|
64
73
|
void maybeRequestRender();
|
|
65
74
|
UpdaterFunction updaterFunction;
|
|
66
|
-
|
|
75
|
+
|
|
76
|
+
private:
|
|
67
77
|
std::shared_ptr<MapperRegistry> mapperRegistry;
|
|
68
78
|
std::shared_ptr<EventHandlerRegistry> eventHandlerRegistry;
|
|
69
|
-
std::function<void(FrameCallback&, jsi::Runtime&)> requestRender;
|
|
79
|
+
std::function<void(FrameCallback &, jsi::Runtime &)> requestRender;
|
|
70
80
|
std::shared_ptr<jsi::Value> dummyEvent;
|
|
71
81
|
std::vector<FrameCallback> frameCallbacks;
|
|
72
82
|
bool renderRequested = false;
|
|
73
|
-
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
83
|
+
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
84
|
+
propObtainer;
|
|
74
85
|
std::function<void(double)> onRenderCallback;
|
|
75
86
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy;
|
|
76
87
|
};
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
#include <vector>
|
|
6
6
|
|
|
7
7
|
#ifdef ONANDROID
|
|
8
|
-
|
|
8
|
+
#include "TurboModule.h"
|
|
9
9
|
#else
|
|
10
|
-
|
|
10
|
+
#include <ReactCommon/TurboModule.h>
|
|
11
11
|
#endif
|
|
12
12
|
|
|
13
13
|
#include <ReactCommon/CallInvoker.h>
|
|
@@ -15,37 +15,49 @@
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
using namespace react;
|
|
17
17
|
|
|
18
|
-
namespace reanimated
|
|
19
|
-
{
|
|
18
|
+
namespace reanimated {
|
|
20
19
|
|
|
21
20
|
class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
22
21
|
protected:
|
|
23
22
|
NativeReanimatedModuleSpec(std::shared_ptr<CallInvoker> jsInvoker);
|
|
24
23
|
|
|
25
24
|
public:
|
|
26
|
-
virtual void installCoreFunctions(
|
|
25
|
+
virtual void installCoreFunctions(
|
|
26
|
+
jsi::Runtime &rt,
|
|
27
|
+
const jsi::Value &valueSetter) = 0;
|
|
27
28
|
|
|
28
29
|
// SharedValue
|
|
29
|
-
virtual jsi::Value makeShareable(
|
|
30
|
+
virtual jsi::Value makeShareable(
|
|
31
|
+
jsi::Runtime &rt,
|
|
32
|
+
const jsi::Value &value) = 0;
|
|
30
33
|
virtual jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) = 0;
|
|
31
34
|
virtual jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) = 0;
|
|
32
35
|
|
|
33
36
|
// mappers
|
|
34
|
-
virtual jsi::Value startMapper(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
virtual jsi::Value startMapper(
|
|
38
|
+
jsi::Runtime &rt,
|
|
39
|
+
const jsi::Value &worklet,
|
|
40
|
+
const jsi::Value &inputs,
|
|
41
|
+
const jsi::Value &outputs,
|
|
42
|
+
const jsi::Value &updater,
|
|
43
|
+
const jsi::Value &viewDescriptors) = 0;
|
|
41
44
|
virtual void stopMapper(jsi::Runtime &rt, const jsi::Value &mapperId) = 0;
|
|
42
45
|
|
|
43
46
|
// events
|
|
44
|
-
virtual jsi::Value registerEventHandler(
|
|
45
|
-
|
|
47
|
+
virtual jsi::Value registerEventHandler(
|
|
48
|
+
jsi::Runtime &rt,
|
|
49
|
+
const jsi::Value &eventHash,
|
|
50
|
+
const jsi::Value &worklet) = 0;
|
|
51
|
+
virtual void unregisterEventHandler(
|
|
52
|
+
jsi::Runtime &rt,
|
|
53
|
+
const jsi::Value ®istrationId) = 0;
|
|
46
54
|
|
|
47
55
|
// views
|
|
48
|
-
virtual jsi::Value getViewProp(
|
|
56
|
+
virtual jsi::Value getViewProp(
|
|
57
|
+
jsi::Runtime &rt,
|
|
58
|
+
const jsi::Value &viewTag,
|
|
59
|
+
const jsi::Value &propName,
|
|
60
|
+
const jsi::Value &callback) = 0;
|
|
49
61
|
};
|
|
50
62
|
|
|
51
63
|
} // namespace reanimated
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
4
|
#include <map>
|
|
5
|
+
#include <mutex>
|
|
5
6
|
#include <set>
|
|
6
|
-
#include <unordered_map>
|
|
7
7
|
#include <string>
|
|
8
|
-
#include <
|
|
9
|
-
#include <
|
|
8
|
+
#include <unordered_map>
|
|
9
|
+
#include <vector>
|
|
10
10
|
|
|
11
11
|
using namespace facebook;
|
|
12
12
|
|
|
@@ -15,16 +15,22 @@ namespace reanimated {
|
|
|
15
15
|
class WorkletEventHandler;
|
|
16
16
|
|
|
17
17
|
class EventHandlerRegistry {
|
|
18
|
-
std::map<
|
|
18
|
+
std::map<
|
|
19
|
+
std::string,
|
|
20
|
+
std::unordered_map<unsigned long, std::shared_ptr<WorkletEventHandler>>>
|
|
21
|
+
eventMappings;
|
|
19
22
|
std::map<unsigned long, std::shared_ptr<WorkletEventHandler>> eventHandlers;
|
|
20
23
|
std::mutex instanceMutex;
|
|
21
24
|
|
|
22
|
-
public:
|
|
25
|
+
public:
|
|
23
26
|
void registerEventHandler(std::shared_ptr<WorkletEventHandler> eventHandler);
|
|
24
27
|
void unregisterEventHandler(unsigned long id);
|
|
25
28
|
|
|
26
|
-
void processEvent(
|
|
29
|
+
void processEvent(
|
|
30
|
+
jsi::Runtime &rt,
|
|
31
|
+
std::string eventName,
|
|
32
|
+
std::string eventPayload);
|
|
27
33
|
bool isAnyHandlerWaitingForEvent(std::string eventName);
|
|
28
34
|
};
|
|
29
35
|
|
|
30
|
-
}
|
|
36
|
+
} // namespace reanimated
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <vector>
|
|
4
|
-
#include <unordered_map>
|
|
5
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include <unordered_map>
|
|
5
|
+
#include <vector>
|
|
6
6
|
|
|
7
7
|
using namespace facebook;
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ class MapperRegistry {
|
|
|
16
16
|
void updateOrder();
|
|
17
17
|
bool updatedSinceLastExecute = false;
|
|
18
18
|
|
|
19
|
-
public:
|
|
19
|
+
public:
|
|
20
20
|
void startMapper(std::shared_ptr<Mapper> mapper);
|
|
21
21
|
void stopMapper(unsigned long id);
|
|
22
22
|
|
|
@@ -25,4 +25,4 @@ public:
|
|
|
25
25
|
bool needRunOnRender();
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
}
|
|
28
|
+
} // namespace reanimated
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <stdio.h>
|
|
4
|
-
#include <unordered_map>
|
|
5
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include <stdio.h>
|
|
6
5
|
#include <memory>
|
|
6
|
+
#include <unordered_map>
|
|
7
7
|
|
|
8
|
-
namespace reanimated
|
|
9
|
-
{
|
|
8
|
+
namespace reanimated {
|
|
10
9
|
|
|
11
10
|
using namespace facebook;
|
|
12
11
|
|
|
13
12
|
class FrozenObject;
|
|
14
13
|
|
|
15
14
|
class WorkletsCache {
|
|
16
|
-
private:
|
|
15
|
+
private:
|
|
17
16
|
std::unordered_map<long long, std::shared_ptr<jsi::Function>> worklets;
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
std::shared_ptr<jsi::Function> getFunction(
|
|
20
|
+
jsi::Runtime &rt,
|
|
21
|
+
std::shared_ptr<reanimated::FrozenObject> frozenObj);
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
} // namespace reanimated
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "WorkletsCache.h"
|
|
4
|
-
#include "SharedParent.h"
|
|
5
|
-
#include "RuntimeManager.h"
|
|
6
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include "RuntimeManager.h"
|
|
5
|
+
#include "SharedParent.h"
|
|
6
|
+
#include "WorkletsCache.h"
|
|
7
7
|
|
|
8
8
|
using namespace facebook;
|
|
9
9
|
|
|
@@ -11,18 +11,22 @@ namespace reanimated {
|
|
|
11
11
|
|
|
12
12
|
class FrozenObject : public jsi::HostObject {
|
|
13
13
|
friend WorkletsCache;
|
|
14
|
-
friend void extractMutables(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
friend void extractMutables(
|
|
15
|
+
jsi::Runtime &rt,
|
|
16
|
+
std::shared_ptr<ShareableValue> sv,
|
|
17
|
+
std::vector<std::shared_ptr<MutableValue>> &res);
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
private:
|
|
19
20
|
std::unordered_map<std::string, std::shared_ptr<ShareableValue>> map;
|
|
21
|
+
std::vector<std::string> namesOrder;
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
public:
|
|
24
|
+
FrozenObject(
|
|
25
|
+
jsi::Runtime &rt,
|
|
26
|
+
const jsi::Object &object,
|
|
27
|
+
RuntimeManager *runtimeManager);
|
|
24
28
|
jsi::Object shallowClone(jsi::Runtime &rt);
|
|
25
29
|
bool containsHostFunction = false;
|
|
26
30
|
};
|
|
27
31
|
|
|
28
|
-
}
|
|
32
|
+
} // namespace reanimated
|
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
4
|
|
|
5
|
+
using namespace facebook;
|
|
6
|
+
|
|
5
7
|
namespace reanimated {
|
|
6
8
|
|
|
7
9
|
struct HostFunctionHandler : jsi::HostObject {
|
|
8
10
|
std::shared_ptr<jsi::Function> pureFunction;
|
|
9
11
|
std::string functionName;
|
|
10
12
|
jsi::Runtime *hostRuntime;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
jsi::HostObject a;
|
|
14
|
+
|
|
13
15
|
HostFunctionHandler(std::shared_ptr<jsi::Function> f, jsi::Runtime &rt) {
|
|
14
16
|
pureFunction = f;
|
|
15
17
|
functionName = f->getProperty(rt, "name").asString(rt).utf8(rt);
|
|
16
18
|
hostRuntime = &rt;
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
|
|
19
21
|
std::shared_ptr<jsi::Function> getPureFunction() {
|
|
20
22
|
return pureFunction;
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
}
|
|
26
|
+
} // namespace reanimated
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "SharedParent.h"
|
|
4
|
-
#include "MutableValueSetterProxy.h"
|
|
5
|
-
#include <mutex>
|
|
6
3
|
#include <jsi/jsi.h>
|
|
7
4
|
#include <map>
|
|
5
|
+
#include <mutex>
|
|
8
6
|
#include "JSIStoreValueUser.h"
|
|
9
|
-
#include "RuntimeManager.h"
|
|
10
7
|
#include "LayoutAnimationsProxy.h"
|
|
8
|
+
#include "MutableValueSetterProxy.h"
|
|
9
|
+
#include "RuntimeManager.h"
|
|
10
|
+
#include "SharedParent.h"
|
|
11
11
|
|
|
12
12
|
using namespace facebook;
|
|
13
13
|
|
|
14
14
|
namespace reanimated {
|
|
15
15
|
|
|
16
|
-
class MutableValue : public jsi::HostObject,
|
|
17
|
-
|
|
16
|
+
class MutableValue : public jsi::HostObject,
|
|
17
|
+
public std::enable_shared_from_this<MutableValue>,
|
|
18
|
+
public StoreUser {
|
|
19
|
+
private:
|
|
18
20
|
friend MutableValueSetterProxy;
|
|
19
21
|
RuntimeManager *runtimeManager;
|
|
20
22
|
friend LayoutAnimationsProxy;
|
|
@@ -26,15 +28,22 @@ private:
|
|
|
26
28
|
void setValue(jsi::Runtime &rt, const jsi::Value &newValue);
|
|
27
29
|
jsi::Value getValue(jsi::Runtime &rt);
|
|
28
30
|
|
|
29
|
-
public:
|
|
30
|
-
MutableValue(
|
|
31
|
+
public:
|
|
32
|
+
MutableValue(
|
|
33
|
+
jsi::Runtime &rt,
|
|
34
|
+
const jsi::Value &initial,
|
|
35
|
+
RuntimeManager *runtimeManager,
|
|
36
|
+
std::shared_ptr<Scheduler> s);
|
|
31
37
|
|
|
32
|
-
public:
|
|
33
|
-
void
|
|
38
|
+
public:
|
|
39
|
+
void
|
|
40
|
+
set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value);
|
|
34
41
|
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name);
|
|
35
42
|
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt);
|
|
36
|
-
unsigned long addListener(
|
|
43
|
+
unsigned long addListener(
|
|
44
|
+
unsigned long listenerId,
|
|
45
|
+
std::function<void()> listener);
|
|
37
46
|
void removeListener(unsigned long listenerId);
|
|
38
47
|
};
|
|
39
48
|
|
|
40
|
-
}
|
|
49
|
+
} // namespace reanimated
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "SharedParent.h"
|
|
4
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include "SharedParent.h"
|
|
5
5
|
|
|
6
6
|
using namespace facebook;
|
|
7
7
|
|
|
8
8
|
namespace reanimated {
|
|
9
9
|
|
|
10
|
-
class MutableValueSetterProxy: public jsi::HostObject {
|
|
11
|
-
private:
|
|
10
|
+
class MutableValueSetterProxy : public jsi::HostObject {
|
|
11
|
+
private:
|
|
12
12
|
friend MutableValue;
|
|
13
13
|
std::shared_ptr<MutableValue> mutableValue;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
MutableValueSetterProxy(std::shared_ptr<MutableValue> mutableValue)
|
|
17
|
+
: mutableValue(std::move(mutableValue)) {}
|
|
18
|
+
void
|
|
19
|
+
set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value);
|
|
17
20
|
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name);
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
}
|
|
23
|
+
} // namespace reanimated
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "SharedParent.h"
|
|
4
3
|
#include "FrozenObject.h"
|
|
5
4
|
#include "JSIStoreValueUser.h"
|
|
5
|
+
#include "SharedParent.h"
|
|
6
6
|
|
|
7
7
|
using namespace facebook;
|
|
8
8
|
|
|
9
9
|
namespace reanimated {
|
|
10
10
|
|
|
11
|
-
class RemoteObject: public jsi::HostObject, public StoreUser {
|
|
12
|
-
private:
|
|
11
|
+
class RemoteObject : public jsi::HostObject, public StoreUser {
|
|
12
|
+
private:
|
|
13
13
|
std::weak_ptr<jsi::Value> backing;
|
|
14
14
|
std::unique_ptr<FrozenObject> initializer;
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
public:
|
|
16
17
|
void maybeInitializeOnWorkletRuntime(jsi::Runtime &rt);
|
|
17
|
-
RemoteObject(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
RemoteObject(
|
|
19
|
+
jsi::Runtime &rt,
|
|
20
|
+
jsi::Object &object,
|
|
21
|
+
RuntimeManager *runtimeManager,
|
|
22
|
+
std::shared_ptr<Scheduler> s)
|
|
23
|
+
: StoreUser(s, *runtimeManager),
|
|
24
|
+
initializer(
|
|
25
|
+
std::make_unique<FrozenObject>(rt, object, runtimeManager)) {}
|
|
26
|
+
void
|
|
27
|
+
set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value);
|
|
20
28
|
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name);
|
|
21
29
|
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt);
|
|
22
30
|
};
|
|
23
31
|
|
|
24
|
-
}
|
|
32
|
+
} // namespace reanimated
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <memory>
|
|
4
5
|
#include "ErrorHandler.h"
|
|
6
|
+
#include "JSIStoreValueUser.h"
|
|
7
|
+
#include "RuntimeDecorator.h"
|
|
5
8
|
#include "Scheduler.h"
|
|
9
|
+
#include "ShareableValue.h"
|
|
6
10
|
#include "WorkletsCache.h"
|
|
7
|
-
#include "RuntimeDecorator.h"
|
|
8
|
-
#include <jsi/jsi.h>
|
|
9
|
-
#include <memory>
|
|
10
11
|
|
|
11
12
|
namespace reanimated {
|
|
12
13
|
|
|
@@ -16,24 +17,28 @@ using namespace facebook;
|
|
|
16
17
|
A class that manages a jsi::Runtime apart from the React-JS runtime.
|
|
17
18
|
*/
|
|
18
19
|
class RuntimeManager {
|
|
19
|
-
public:
|
|
20
|
+
public:
|
|
20
21
|
RuntimeManager(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
22
|
+
std::shared_ptr<jsi::Runtime> runtime,
|
|
23
|
+
std::shared_ptr<ErrorHandler> errorHandler,
|
|
24
|
+
std::shared_ptr<Scheduler> scheduler,
|
|
25
|
+
RuntimeType runtimeType = RuntimeType::Worklet)
|
|
26
|
+
: runtime(runtime),
|
|
27
|
+
errorHandler(errorHandler),
|
|
28
|
+
scheduler(scheduler),
|
|
29
|
+
workletsCache(std::make_unique<WorkletsCache>()),
|
|
30
|
+
storeUserData(std::make_shared<StaticStoreUser>()) {
|
|
31
31
|
RuntimeDecorator::registerRuntime(this->runtime.get(), runtimeType);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
virtual ~RuntimeManager() {
|
|
35
|
+
clearStore();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public:
|
|
34
39
|
/**
|
|
35
|
-
Holds the jsi::Function worklet that is responsible for updating values in
|
|
36
|
-
Can be null.
|
|
40
|
+
Holds the jsi::Function worklet that is responsible for updating values in
|
|
41
|
+
JS. Can be null.
|
|
37
42
|
*/
|
|
38
43
|
std::shared_ptr<ShareableValue> valueSetter;
|
|
39
44
|
/**
|
|
@@ -45,13 +50,26 @@ public:
|
|
|
45
50
|
*/
|
|
46
51
|
std::shared_ptr<ErrorHandler> errorHandler;
|
|
47
52
|
/**
|
|
48
|
-
Holds the Scheduler that is responsible for scheduling work on the UI- or
|
|
53
|
+
Holds the Scheduler that is responsible for scheduling work on the UI- or
|
|
54
|
+
React-JS Thread.
|
|
49
55
|
*/
|
|
50
56
|
std::shared_ptr<Scheduler> scheduler;
|
|
51
57
|
/**
|
|
52
|
-
Holds a list of adapted Worklets which are cached to avoid unneccessary
|
|
58
|
+
Holds a list of adapted Worklets which are cached to avoid unneccessary
|
|
59
|
+
recreation.
|
|
53
60
|
*/
|
|
54
61
|
std::unique_ptr<WorkletsCache> workletsCache;
|
|
62
|
+
/**
|
|
63
|
+
Holds the JSI-Value Store where JSI::Values are cached on a
|
|
64
|
+
per-RuntimeManager basis.
|
|
65
|
+
*/
|
|
66
|
+
std::shared_ptr<StaticStoreUser> storeUserData;
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
void clearStore() {
|
|
70
|
+
const std::lock_guard<std::recursive_mutex> lock(storeUserData->storeMutex);
|
|
71
|
+
storeUserData->store.clear();
|
|
72
|
+
}
|
|
55
73
|
};
|
|
56
74
|
|
|
57
|
-
}
|
|
75
|
+
} // namespace reanimated
|