react-native-reanimated 2.3.0-alpha.3 → 2.3.0-beta.4
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 +176 -154
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +49 -33
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -7
- package/Common/cpp/Registries/MapperRegistry.cpp +24 -20
- package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
- package/Common/cpp/SharedItems/FrozenObject.cpp +17 -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 +211 -160
- package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +25 -6
- package/Common/cpp/Tools/Mapper.cpp +30 -30
- package/Common/cpp/Tools/RuntimeDecorator.cpp +124 -86
- package/Common/cpp/Tools/Scheduler.cpp +6 -5
- package/Common/cpp/Tools/WorkletEventHandler.cpp +4 -2
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +50 -31
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +34 -16
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +15 -8
- package/Common/cpp/headers/Registries/MapperRegistry.h +5 -4
- package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
- package/Common/cpp/headers/SharedItems/FrozenObject.h +19 -11
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +8 -4
- package/Common/cpp/headers/SharedItems/MutableValue.h +23 -12
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +12 -7
- package/Common/cpp/headers/SharedItems/RemoteObject.h +19 -8
- package/Common/cpp/headers/SharedItems/RuntimeManager.h +26 -25
- package/Common/cpp/headers/SharedItems/ShareableValue.h +32 -27
- package/Common/cpp/headers/SharedItems/SharedParent.h +10 -7
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +95 -72
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +18 -19
- package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +13 -16
- package/Common/cpp/headers/Tools/Mapper.h +19 -16
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +17 -7
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -11
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +36 -27
- package/Common/cpp/headers/Tools/Scheduler.h +30 -35
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +11 -8
- 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 +24 -6
- package/android/build.gradle +38 -29
- 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/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +10 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +91 -87
- package/ios/LayoutReanimation/REASnapshot.h +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +8 -7
- package/ios/LayoutReanimation/REAUIManager.h +4 -4
- package/ios/LayoutReanimation/REAUIManager.mm +116 -70
- 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 +4 -4
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +29 -38
- package/ios/REANodesManager.h +11 -19
- package/ios/REANodesManager.m +106 -130
- package/ios/REAUtils.h +5 -3
- package/ios/RNGestureHandlerStateManager.h +5 -0
- 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 +20 -5
- package/ios/native/NativeMethods.mm +14 -6
- package/ios/native/NativeProxy.h +4 -2
- package/ios/native/NativeProxy.mm +84 -63
- package/ios/native/REAIOSErrorHandler.h +13 -10
- package/ios/native/REAIOSErrorHandler.mm +19 -15
- package/ios/native/REAIOSLogger.h +8 -8
- package/ios/native/REAIOSLogger.mm +10 -6
- package/ios/native/REAIOSScheduler.h +5 -5
- package/ios/native/REAIOSScheduler.mm +17 -10
- package/ios/native/REAInitializer.h +5 -7
- package/ios/native/REAInitializer.mm +43 -31
- package/ios/native/UIResponder+Reanimated.mm +2 -2
- package/lib/Animated.js +9 -1
- package/lib/ConfigHelper.js +121 -138
- package/lib/ReanimatedEventEmitter.js +0 -1
- package/lib/ReanimatedModule.js +0 -1
- package/lib/ReanimatedModule.macos.js +0 -1
- package/lib/ReanimatedModule.native.js +5 -6
- package/lib/ReanimatedModule.windows.js +0 -1
- package/lib/ReanimatedModuleCompat.js +64 -35
- package/lib/createAnimatedComponent.js +468 -487
- package/lib/index.js +9 -1
- package/lib/reanimated2/NativeMethods.js +7 -12
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +37 -0
- package/lib/reanimated2/NativeReanimated/index.js +15 -0
- package/lib/reanimated2/PropAdapters.js +0 -1
- package/lib/reanimated2/UpdateProps.js +6 -7
- package/lib/reanimated2/ViewDescriptorsSet.js +4 -4
- package/lib/reanimated2/WorkletEventHandler.js +15 -13
- package/lib/reanimated2/animation/delay.js +8 -2
- package/lib/reanimated2/animation/spring.js +2 -0
- package/lib/reanimated2/animation/styleAnimation.js +7 -3
- package/lib/reanimated2/animation/util.js +25 -2
- package/lib/reanimated2/core.js +41 -17
- package/lib/reanimated2/globals.d.ts +21 -1
- package/lib/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/reanimated2/hook/useAnimatedStyle.js +3 -3
- package/lib/reanimated2/index.js +1 -0
- package/lib/reanimated2/interpolation.js +95 -87
- package/lib/reanimated2/js-reanimated/JSReanimated.js +13 -10
- package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
- package/lib/reanimated2/js-reanimated/index.js +10 -8
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +33 -2
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +27 -124
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +1 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +115 -45
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +7 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +21 -21
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +25 -25
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +19 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +5 -5
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +17 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +19 -19
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +33 -33
- 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 +1 -0
- package/lib/reanimated2/mock.js +3 -1
- package/lib/reanimated2/utils.js +9 -0
- package/lib/setAndForwardRef.js +14 -48
- 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/mock.js +1 -1
- package/package.json +28 -17
- package/plugin.js +220 -39
- package/react-native-reanimated.d.ts +542 -547
- package/src/Animated.js +9 -1
- package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
- package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
- package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
- package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
- package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
- package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
- package/src/ReanimatedModuleCompat.ts +51 -0
- package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +285 -126
- package/src/reanimated2/NativeMethods.ts +34 -13
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +72 -0
- package/src/reanimated2/NativeReanimated/index.ts +18 -0
- package/src/reanimated2/PropAdapters.ts +0 -1
- package/src/reanimated2/UpdateProps.ts +31 -15
- package/src/reanimated2/ViewDescriptorsSet.ts +15 -12
- package/src/reanimated2/WorkletEventHandler.ts +41 -23
- package/src/reanimated2/animation/commonTypes.ts +4 -4
- package/src/reanimated2/animation/decay.ts +2 -2
- package/src/reanimated2/animation/delay.ts +11 -5
- package/src/reanimated2/animation/index.ts +7 -7
- package/src/reanimated2/animation/repeat.ts +4 -4
- package/src/reanimated2/animation/sequence.ts +2 -2
- package/src/reanimated2/animation/spring.ts +6 -5
- package/src/reanimated2/animation/styleAnimation.ts +27 -15
- package/src/reanimated2/animation/timing.ts +5 -5
- package/src/reanimated2/animation/util.ts +47 -8
- package/src/reanimated2/commonTypes.ts +3 -0
- package/src/reanimated2/core.ts +80 -34
- package/src/reanimated2/globals.d.ts +21 -1
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -1
- package/src/reanimated2/hook/useAnimatedRef.ts +13 -15
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -3
- package/src/reanimated2/hook/useAnimatedStyle.ts +7 -7
- package/src/reanimated2/hook/utils.ts +4 -3
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/interpolation.ts +170 -103
- package/src/reanimated2/js-reanimated/JSReanimated.ts +37 -23
- package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
- package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
- package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
- package/src/reanimated2/js-reanimated/index.ts +31 -14
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +75 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +29 -159
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -9
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -5
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +162 -82
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +7 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +32 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +38 -38
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +34 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +26 -26
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +28 -28
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +50 -50
- 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 +1 -0
- package/src/reanimated2/mock.ts +3 -1
- package/src/reanimated2/utils.ts +21 -0
- package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
- package/lib/reanimated2/NativeReanimated.js +0 -48
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.js +0 -55
- package/lib/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.js +0 -165
- package/src/ReanimatedModuleCompat.js +0 -37
- package/src/reanimated2/NativeReanimated.ts +0 -70
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +0 -41
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.ts +0 -82
- package/src/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.ts +0 -217
|
@@ -5,20 +5,24 @@ namespace reanimated {
|
|
|
5
5
|
|
|
6
6
|
std::unique_ptr<LoggerInterface> Logger::instance = std::make_unique<REAIOSLogger>();
|
|
7
7
|
|
|
8
|
-
void REAIOSLogger::log(const char*
|
|
8
|
+
void REAIOSLogger::log(const char *str)
|
|
9
|
+
{
|
|
9
10
|
NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]);
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
void REAIOSLogger::log(double d)
|
|
13
|
+
void REAIOSLogger::log(double d)
|
|
14
|
+
{
|
|
13
15
|
NSLog(@"%lf", d);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
void REAIOSLogger::log(int i)
|
|
17
|
-
|
|
18
|
+
void REAIOSLogger::log(int i)
|
|
19
|
+
{
|
|
20
|
+
NSLog(@"%i", i);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
void REAIOSLogger::log(bool b)
|
|
21
|
-
|
|
23
|
+
void REAIOSLogger::log(bool b)
|
|
24
|
+
{
|
|
25
|
+
const char *str = (b) ? "true" : "false";
|
|
22
26
|
NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]);
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#import <React/RCTUIManager.h>
|
|
4
|
+
#import <ReactCommon/CallInvoker.h>
|
|
3
5
|
#include <stdio.h>
|
|
6
|
+
#include <memory>
|
|
4
7
|
#include "Scheduler.h"
|
|
5
|
-
#import <ReactCommon/CallInvoker.h>
|
|
6
|
-
#import <React/RCTUIManager.h>
|
|
7
8
|
|
|
8
|
-
namespace reanimated
|
|
9
|
-
{
|
|
9
|
+
namespace reanimated {
|
|
10
10
|
|
|
11
11
|
using namespace facebook;
|
|
12
12
|
using namespace react;
|
|
13
13
|
|
|
14
14
|
class REAIOSScheduler : public Scheduler {
|
|
15
|
-
|
|
15
|
+
public:
|
|
16
16
|
REAIOSScheduler(std::shared_ptr<CallInvoker> jsInvoker);
|
|
17
17
|
void scheduleOnUI(std::function<void()> job) override;
|
|
18
18
|
virtual ~REAIOSScheduler();
|
|
@@ -6,36 +6,43 @@ namespace reanimated {
|
|
|
6
6
|
using namespace facebook;
|
|
7
7
|
using namespace react;
|
|
8
8
|
|
|
9
|
-
REAIOSScheduler::REAIOSScheduler(std::shared_ptr<CallInvoker> jsInvoker)
|
|
9
|
+
REAIOSScheduler::REAIOSScheduler(std::shared_ptr<CallInvoker> jsInvoker)
|
|
10
|
+
{
|
|
10
11
|
this->jsCallInvoker_ = jsInvoker;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
void REAIOSScheduler::scheduleOnUI(std::function<void()> job)
|
|
14
|
+
void REAIOSScheduler::scheduleOnUI(std::function<void()> job)
|
|
15
|
+
{
|
|
14
16
|
if (runtimeManager.lock() == nullptr) {
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
if([NSThread isMainThread]) {
|
|
19
|
-
if (runtimeManager.lock())
|
|
20
|
+
if ([NSThread isMainThread]) {
|
|
21
|
+
if (runtimeManager.lock()) {
|
|
22
|
+
job();
|
|
23
|
+
}
|
|
20
24
|
return;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
Scheduler::scheduleOnUI(job);
|
|
24
|
-
if([NSThread isMainThread]) {
|
|
25
|
-
if (runtimeManager.lock())
|
|
28
|
+
if ([NSThread isMainThread]) {
|
|
29
|
+
if (runtimeManager.lock()) {
|
|
30
|
+
triggerUI();
|
|
31
|
+
}
|
|
26
32
|
return;
|
|
27
33
|
}
|
|
28
|
-
|
|
34
|
+
|
|
29
35
|
if (!this->scheduledOnUI) {
|
|
30
36
|
__block std::weak_ptr<RuntimeManager> blockRuntimeManager = runtimeManager;
|
|
31
37
|
|
|
32
38
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
33
|
-
if (blockRuntimeManager.lock())
|
|
39
|
+
if (blockRuntimeManager.lock()) {
|
|
40
|
+
triggerUI();
|
|
41
|
+
}
|
|
34
42
|
});
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
REAIOSScheduler::~REAIOSScheduler(){
|
|
39
|
-
}
|
|
46
|
+
REAIOSScheduler::~REAIOSScheduler() {}
|
|
40
47
|
|
|
41
48
|
}
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
|
-
#import <React/RCTCxxBridgeDelegate.h>
|
|
10
9
|
#import <RNReanimated/NativeProxy.h>
|
|
10
|
+
#import <RNReanimated/REAEventDispatcher.h>
|
|
11
11
|
#import <RNReanimated/REAModule.h>
|
|
12
|
-
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
13
12
|
#import <React/RCTBridge+Private.h>
|
|
14
13
|
#import <React/RCTCxxBridgeDelegate.h>
|
|
15
|
-
#import <
|
|
14
|
+
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
16
15
|
#import <jsireact/JSIExecutor.h>
|
|
17
16
|
|
|
18
17
|
#if RNVERSION >= 64
|
|
@@ -31,9 +30,8 @@ using namespace facebook;
|
|
|
31
30
|
using namespace react;
|
|
32
31
|
|
|
33
32
|
JSIExecutor::RuntimeInstaller REAJSIExecutorRuntimeInstaller(
|
|
34
|
-
RCTBridge*
|
|
35
|
-
JSIExecutor::RuntimeInstaller runtimeInstallerToWrap
|
|
36
|
-
);
|
|
33
|
+
RCTBridge *bridge,
|
|
34
|
+
JSIExecutor::RuntimeInstaller runtimeInstallerToWrap);
|
|
37
35
|
|
|
38
|
-
}
|
|
36
|
+
} // namespace reanimated
|
|
39
37
|
NS_ASSUME_NONNULL_END
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#import "REAInitializer.h"
|
|
2
2
|
#import "REAUIManager.h"
|
|
3
3
|
|
|
4
|
-
@interface RCTEventDispatcher(Reanimated)
|
|
4
|
+
@interface RCTEventDispatcher (Reanimated)
|
|
5
5
|
|
|
6
|
-
- (void)setBridge:(RCTBridge*)bridge;
|
|
6
|
+
- (void)setBridge:(RCTBridge *)bridge;
|
|
7
7
|
|
|
8
8
|
@end
|
|
9
9
|
|
|
@@ -13,42 +13,54 @@ using namespace facebook;
|
|
|
13
13
|
using namespace react;
|
|
14
14
|
|
|
15
15
|
JSIExecutor::RuntimeInstaller REAJSIExecutorRuntimeInstaller(
|
|
16
|
-
RCTBridge*
|
|
16
|
+
RCTBridge *bridge,
|
|
17
17
|
JSIExecutor::RuntimeInstaller runtimeInstallerToWrap)
|
|
18
18
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
[bridge moduleForClass:[RCTUIManager class]];
|
|
20
|
+
REAUIManager *reaUiManager = [REAUIManager new];
|
|
21
|
+
[reaUiManager setBridge:bridge];
|
|
22
|
+
RCTUIManager *uiManager = reaUiManager;
|
|
23
|
+
[bridge updateModuleWithInstance:uiManager];
|
|
24
|
+
|
|
25
|
+
[bridge moduleForClass:[RCTEventDispatcher class]];
|
|
26
|
+
RCTEventDispatcher *eventDispatcher = [REAEventDispatcher new];
|
|
27
|
+
#if RNVERSION >= 66
|
|
28
|
+
RCTCallableJSModules *callableJSModules = [RCTCallableJSModules new];
|
|
29
|
+
[bridge setValue:callableJSModules forKey:@"_callableJSModules"];
|
|
30
|
+
[callableJSModules setBridge:bridge];
|
|
31
|
+
[eventDispatcher setValue:callableJSModules forKey:@"_callableJSModules"];
|
|
32
|
+
[eventDispatcher setValue:bridge forKey:@"_bridge"];
|
|
33
|
+
[eventDispatcher initialize];
|
|
34
|
+
#else
|
|
35
|
+
[eventDispatcher setBridge:bridge];
|
|
36
|
+
#endif
|
|
37
|
+
[bridge updateModuleWithInstance:eventDispatcher];
|
|
38
|
+
const auto runtimeInstaller = [bridge, runtimeInstallerToWrap](facebook::jsi::Runtime &runtime) {
|
|
39
|
+
if (!bridge) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
34
42
|
#if RNVERSION >= 63
|
|
35
|
-
auto reanimatedModule = reanimated::createReanimatedModule(bridge.jsCallInvoker);
|
|
43
|
+
auto reanimatedModule = reanimated::createReanimatedModule(bridge, bridge.jsCallInvoker);
|
|
36
44
|
#else
|
|
37
45
|
auto callInvoker = std::make_shared<react::BridgeJSCallInvoker>(bridge.reactInstance);
|
|
38
|
-
auto reanimatedModule = reanimated::createReanimatedModule(callInvoker);
|
|
46
|
+
auto reanimatedModule = reanimated::createReanimatedModule(bridge, callInvoker);
|
|
39
47
|
#endif
|
|
40
|
-
runtime.global().setProperty(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
runtimeInstallerToWrap(runtime);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return runtimeInstaller;
|
|
49
|
-
}
|
|
48
|
+
runtime.global().setProperty(
|
|
49
|
+
runtime,
|
|
50
|
+
"_WORKLET_RUNTIME",
|
|
51
|
+
static_cast<double>(
|
|
52
|
+
reinterpret_cast<std::uintptr_t>(reanimatedModule->runtime.get())));
|
|
50
53
|
|
|
54
|
+
runtime.global().setProperty(
|
|
55
|
+
runtime,
|
|
56
|
+
jsi::PropNameID::forAscii(runtime, "__reanimatedModuleProxy"),
|
|
57
|
+
jsi::Object::createFromHostObject(runtime, reanimatedModule));
|
|
51
58
|
|
|
59
|
+
if (runtimeInstallerToWrap) {
|
|
60
|
+
runtimeInstallerToWrap(runtime);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return runtimeInstaller;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
}
|
package/lib/Animated.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Image, ScrollView, Text, View } from 'react-native';
|
|
1
|
+
import { Image, ScrollView, Text, View, LogBox } from 'react-native';
|
|
2
2
|
import createAnimatedComponent from './createAnimatedComponent';
|
|
3
3
|
import {
|
|
4
4
|
addWhitelistedNativeProps,
|
|
@@ -23,3 +23,11 @@ const Animated = {
|
|
|
23
23
|
export * from './reanimated2';
|
|
24
24
|
export * from './reanimated1';
|
|
25
25
|
export default Animated;
|
|
26
|
+
|
|
27
|
+
// I think we can ignore this message as long as Gesture Handler doesn't
|
|
28
|
+
// try to load the Reanimated module. I figured it should be here instead of
|
|
29
|
+
// RNGH because this prevents the message from being displayed for all
|
|
30
|
+
// versions of RNGH.
|
|
31
|
+
LogBox.ignoreLogs([
|
|
32
|
+
'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
|
|
33
|
+
]);
|
package/lib/ConfigHelper.js
CHANGED
|
@@ -1,163 +1,146 @@
|
|
|
1
1
|
import ReanimatedModule from './ReanimatedModule';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Styles allowed to be direcly updated in UI thread
|
|
5
4
|
*/
|
|
6
5
|
let UI_THREAD_PROPS_WHITELIST = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
opacity: true,
|
|
7
|
+
transform: true,
|
|
8
|
+
/* colors */
|
|
9
|
+
backgroundColor: true,
|
|
10
|
+
borderRightColor: true,
|
|
11
|
+
borderBottomColor: true,
|
|
12
|
+
borderColor: true,
|
|
13
|
+
borderEndColor: true,
|
|
14
|
+
borderLeftColor: true,
|
|
15
|
+
borderStartColor: true,
|
|
16
|
+
borderTopColor: true,
|
|
17
|
+
/* ios styles */
|
|
18
|
+
shadowOpacity: true,
|
|
19
|
+
shadowRadius: true,
|
|
20
|
+
/* legacy android transform properties */
|
|
21
|
+
scaleX: true,
|
|
22
|
+
scaleY: true,
|
|
23
|
+
translateX: true,
|
|
24
|
+
translateY: true,
|
|
26
25
|
};
|
|
27
|
-
|
|
28
26
|
/**
|
|
29
27
|
* Whitelist of view props that can be updated in native thread via UIManagerModule
|
|
30
28
|
*/
|
|
31
29
|
let NATIVE_THREAD_PROPS_WHITELIST = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
30
|
+
borderBottomWidth: true,
|
|
31
|
+
borderEndWidth: true,
|
|
32
|
+
borderLeftWidth: true,
|
|
33
|
+
borderRightWidth: true,
|
|
34
|
+
borderStartWidth: true,
|
|
35
|
+
borderTopWidth: true,
|
|
36
|
+
borderWidth: true,
|
|
37
|
+
bottom: true,
|
|
38
|
+
flex: true,
|
|
39
|
+
flexGrow: true,
|
|
40
|
+
flexShrink: true,
|
|
41
|
+
height: true,
|
|
42
|
+
left: true,
|
|
43
|
+
margin: true,
|
|
44
|
+
marginBottom: true,
|
|
45
|
+
marginEnd: true,
|
|
46
|
+
marginHorizontal: true,
|
|
47
|
+
marginLeft: true,
|
|
48
|
+
marginRight: true,
|
|
49
|
+
marginStart: true,
|
|
50
|
+
marginTop: true,
|
|
51
|
+
marginVertical: true,
|
|
52
|
+
maxHeight: true,
|
|
53
|
+
maxWidth: true,
|
|
54
|
+
minHeight: true,
|
|
55
|
+
minWidth: true,
|
|
56
|
+
padding: true,
|
|
57
|
+
paddingBottom: true,
|
|
58
|
+
paddingEnd: true,
|
|
59
|
+
paddingHorizontal: true,
|
|
60
|
+
paddingLeft: true,
|
|
61
|
+
paddingRight: true,
|
|
62
|
+
paddingStart: true,
|
|
63
|
+
paddingTop: true,
|
|
64
|
+
paddingVertical: true,
|
|
65
|
+
right: true,
|
|
66
|
+
start: true,
|
|
67
|
+
top: true,
|
|
68
|
+
width: true,
|
|
69
|
+
zIndex: true,
|
|
70
|
+
borderBottomEndRadius: true,
|
|
71
|
+
borderBottomLeftRadius: true,
|
|
72
|
+
borderBottomRightRadius: true,
|
|
73
|
+
borderBottomStartRadius: true,
|
|
74
|
+
borderRadius: true,
|
|
75
|
+
borderTopEndRadius: true,
|
|
76
|
+
borderTopLeftRadius: true,
|
|
77
|
+
borderTopRightRadius: true,
|
|
78
|
+
borderTopStartRadius: true,
|
|
79
|
+
opacity: true,
|
|
80
|
+
elevation: true,
|
|
81
|
+
fontSize: true,
|
|
82
|
+
lineHeight: true,
|
|
83
|
+
textShadowRadius: true,
|
|
84
|
+
letterSpacing: true,
|
|
85
|
+
/* strings */
|
|
86
|
+
display: true,
|
|
87
|
+
backfaceVisibility: true,
|
|
88
|
+
overflow: true,
|
|
89
|
+
resizeMode: true,
|
|
90
|
+
fontStyle: true,
|
|
91
|
+
fontWeight: true,
|
|
92
|
+
textAlign: true,
|
|
93
|
+
textDecorationLine: true,
|
|
94
|
+
fontFamily: true,
|
|
95
|
+
textAlignVertical: true,
|
|
96
|
+
fontVariant: true,
|
|
97
|
+
textDecorationStyle: true,
|
|
98
|
+
textTransform: true,
|
|
99
|
+
writingDirection: true,
|
|
100
|
+
/* text color */
|
|
101
|
+
color: true,
|
|
102
|
+
tintColor: true,
|
|
103
|
+
shadowColor: true,
|
|
104
|
+
placeholderTextColor: true,
|
|
107
105
|
};
|
|
108
|
-
|
|
109
106
|
function configureProps() {
|
|
110
|
-
|
|
111
|
-
Object.keys(NATIVE_THREAD_PROPS_WHITELIST),
|
|
112
|
-
Object.keys(UI_THREAD_PROPS_WHITELIST)
|
|
113
|
-
);
|
|
107
|
+
ReanimatedModule.configureProps(Object.keys(NATIVE_THREAD_PROPS_WHITELIST), Object.keys(UI_THREAD_PROPS_WHITELIST));
|
|
114
108
|
}
|
|
115
|
-
|
|
116
109
|
export function addWhitelistedNativeProps(props) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (oldSize !== Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length) {
|
|
123
|
-
configureProps();
|
|
124
|
-
}
|
|
110
|
+
const oldSize = Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length;
|
|
111
|
+
NATIVE_THREAD_PROPS_WHITELIST = Object.assign(Object.assign({}, NATIVE_THREAD_PROPS_WHITELIST), props);
|
|
112
|
+
if (oldSize !== Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length) {
|
|
113
|
+
configureProps();
|
|
114
|
+
}
|
|
125
115
|
}
|
|
126
|
-
|
|
127
116
|
export function addWhitelistedUIProps(props) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
const oldSize = Object.keys(UI_THREAD_PROPS_WHITELIST).length;
|
|
118
|
+
UI_THREAD_PROPS_WHITELIST = Object.assign(Object.assign({}, UI_THREAD_PROPS_WHITELIST), props);
|
|
119
|
+
if (oldSize !== Object.keys(UI_THREAD_PROPS_WHITELIST).length) {
|
|
120
|
+
configureProps();
|
|
121
|
+
}
|
|
133
122
|
}
|
|
134
|
-
|
|
135
123
|
const PROCESSED_VIEW_NAMES = new Set();
|
|
136
124
|
/**
|
|
137
125
|
* updates UI props whitelist for given view host instance
|
|
138
126
|
* this will work just once for every view name
|
|
139
127
|
*/
|
|
140
128
|
export function adaptViewConfig(viewConfig) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
propsToAdd
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
addWhitelistedUIProps(propsToAdd);
|
|
158
|
-
|
|
159
|
-
PROCESSED_VIEW_NAMES.add(viewName);
|
|
160
|
-
}
|
|
129
|
+
const viewName = viewConfig.uiViewClassName;
|
|
130
|
+
const props = viewConfig.validAttributes;
|
|
131
|
+
// update whitelist of UI props for this view name only once
|
|
132
|
+
if (!PROCESSED_VIEW_NAMES.has(viewName)) {
|
|
133
|
+
const propsToAdd = {};
|
|
134
|
+
Object.keys(props).forEach((key) => {
|
|
135
|
+
// we don't want to add native props as they affect layout
|
|
136
|
+
// we also skip props which repeat here
|
|
137
|
+
if (!(key in NATIVE_THREAD_PROPS_WHITELIST) &&
|
|
138
|
+
!(key in UI_THREAD_PROPS_WHITELIST)) {
|
|
139
|
+
propsToAdd[key] = true;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
addWhitelistedUIProps(propsToAdd);
|
|
143
|
+
PROCESSED_VIEW_NAMES.add(viewName);
|
|
144
|
+
}
|
|
161
145
|
}
|
|
162
|
-
|
|
163
146
|
configureProps();
|
package/lib/ReanimatedModule.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
import ReanimatedModuleCompat from './ReanimatedModuleCompat';
|
|
3
3
|
import { nativeShouldBeMock } from './reanimated2/PlatformChecker';
|
|
4
|
-
|
|
5
4
|
let exportedModule;
|
|
6
5
|
if (nativeShouldBeMock()) {
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
exportedModule = ReanimatedModuleCompat;
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
const { ReanimatedModule } = NativeModules;
|
|
10
|
+
exportedModule = ReanimatedModule;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
export default exportedModule;
|