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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
1
|
#import <QuartzCore/QuartzCore.h>
|
|
3
2
|
#import <React/RCTView.h>
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
4
|
|
|
5
5
|
#import "REATransitionAnimation.h"
|
|
6
6
|
#import "REATransitionValues.h"
|
|
@@ -53,12 +53,13 @@ typedef NS_ENUM(NSInteger, REATransitionPropagationType) {
|
|
|
53
53
|
- (void)playInRoot:(UIView *)root;
|
|
54
54
|
- (REATransitionValues *)findStartValuesForKey:(NSNumber *)key;
|
|
55
55
|
- (REATransitionValues *)findEndValuesForKey:(NSNumber *)key;
|
|
56
|
-
- (REATransitionAnimation *)animationForTransitioning:(REATransitionValues*)startValues
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- (NSArray<REATransitionAnimation
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
- (REATransitionAnimation *)animationForTransitioning:(REATransitionValues *)startValues
|
|
57
|
+
endValues:(REATransitionValues *)endValues
|
|
58
|
+
forRoot:(UIView *)root;
|
|
59
|
+
- (NSArray<REATransitionAnimation *> *)
|
|
60
|
+
animationsForTransitioning:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)startValues
|
|
61
|
+
endValues:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)endValues
|
|
62
|
+
forRoot:(UIView *)root;
|
|
62
63
|
|
|
63
64
|
+ (REATransition *)inflate:(NSDictionary *)config;
|
|
64
65
|
@end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
1
|
#import <QuartzCore/QuartzCore.h>
|
|
3
2
|
#import <React/RCTConvert.h>
|
|
4
3
|
#import <React/RCTViewManager.h>
|
|
4
|
+
#import <UIKit/UIKit.h>
|
|
5
5
|
|
|
6
|
+
#import "RCTConvert+REATransition.h"
|
|
6
7
|
#import "REATransition.h"
|
|
7
8
|
#import "REATransitionValues.h"
|
|
8
|
-
#import "RCTConvert+REATransition.h"
|
|
9
9
|
|
|
10
10
|
#define DEFAULT_PROPAGATION_SPEED 3
|
|
11
11
|
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
@interface REAVisibilityTransition : REATransition
|
|
19
19
|
@property (nonatomic) REATransitionAnimationType animationType;
|
|
20
|
-
- (REATransitionAnimation *)appearView:(UIView*)view inParent:(UIView*)parent;
|
|
21
|
-
- (REATransitionAnimation *)disappearView:(UIView*)view fromParent:(UIView*)parent;
|
|
20
|
+
- (REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent;
|
|
21
|
+
- (REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent;
|
|
22
22
|
- (instancetype)initWithConfig:(NSDictionary *)config;
|
|
23
23
|
@end
|
|
24
24
|
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
|
|
37
37
|
@implementation REATransition {
|
|
38
38
|
__weak UIView *_root;
|
|
39
|
-
NSMutableDictionary<NSNumber*, REATransitionValues*> *_startValues;
|
|
40
|
-
NSMutableDictionary<NSNumber*, REATransitionValues*> *_endValues;
|
|
39
|
+
NSMutableDictionary<NSNumber *, REATransitionValues *> *_startValues;
|
|
40
|
+
NSMutableDictionary<NSNumber *, REATransitionValues *> *_endValues;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
+ (REATransition *)inflate:(NSDictionary *)config
|
|
@@ -70,7 +70,9 @@
|
|
|
70
70
|
return self;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
- (void)captureRecursiveIn:(UIView *)view
|
|
73
|
+
- (void)captureRecursiveIn:(UIView *)view
|
|
74
|
+
to:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)map
|
|
75
|
+
forRoot:(UIView *)root
|
|
74
76
|
{
|
|
75
77
|
NSNumber *tag = view.reactTag;
|
|
76
78
|
if (tag != nil) {
|
|
@@ -91,9 +93,7 @@
|
|
|
91
93
|
{
|
|
92
94
|
_endValues = [NSMutableDictionary new];
|
|
93
95
|
[self captureRecursiveIn:root to:_endValues forRoot:root];
|
|
94
|
-
NSArray *animations = [self animationsForTransitioning:_startValues
|
|
95
|
-
endValues:_endValues
|
|
96
|
-
forRoot:root];
|
|
96
|
+
NSArray *animations = [self animationsForTransitioning:_startValues endValues:_endValues forRoot:root];
|
|
97
97
|
for (REATransitionAnimation *animation in animations) {
|
|
98
98
|
[animation play];
|
|
99
99
|
}
|
|
@@ -164,15 +164,16 @@
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
- (REATransitionAnimation *)animationForTransitioning:(REATransitionValues *)startValues
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
endValues:(REATransitionValues *)endValues
|
|
168
|
+
forRoot:(UIView *)root
|
|
169
169
|
{
|
|
170
170
|
return nil;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
- (NSArray<REATransitionAnimation
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
- (NSArray<REATransitionAnimation *> *)
|
|
174
|
+
animationsForTransitioning:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)startValues
|
|
175
|
+
endValues:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)endValues
|
|
176
|
+
forRoot:(UIView *)root
|
|
176
177
|
{
|
|
177
178
|
NSMutableArray *animations = [NSMutableArray new];
|
|
178
179
|
[startValues enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, REATransitionValues *startValue, BOOL *stop) {
|
|
@@ -182,7 +183,9 @@
|
|
|
182
183
|
animation.animation.timingFunction = self.mediaTiming;
|
|
183
184
|
animation.animation.duration = self.duration;
|
|
184
185
|
[animation delayBy:self.delay];
|
|
185
|
-
CFTimeInterval propagationDelay = [self propagationDelayForTransitioning:startValue
|
|
186
|
+
CFTimeInterval propagationDelay = [self propagationDelayForTransitioning:startValue
|
|
187
|
+
endValues:endValue
|
|
188
|
+
forRoot:root];
|
|
186
189
|
[animation delayBy:propagationDelay];
|
|
187
190
|
// animation.animation.duration -= propagationDelay;
|
|
188
191
|
[animations addObject:animation];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
+ (REATransitionAnimation *)transitionWithAnimation:(CAAnimation *)animation
|
|
10
10
|
layer:(CALayer *)layer
|
|
11
|
-
andKeyPath:(NSString*)keyPath;
|
|
11
|
+
andKeyPath:(NSString *)keyPath;
|
|
12
12
|
- (void)play;
|
|
13
13
|
- (void)delayBy:(CFTimeInterval)delay;
|
|
14
14
|
- (CFTimeInterval)finishTime;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
#import "REATransitionAnimation.h"
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
#define DEFAULT_DURATION 0.25
|
|
7
6
|
|
|
8
7
|
#if TARGET_IPHONE_SIMULATOR
|
|
@@ -31,7 +30,7 @@ CGFloat SimAnimationDragCoefficient()
|
|
|
31
30
|
|
|
32
31
|
+ (REATransitionAnimation *)transitionWithAnimation:(CAAnimation *)animation
|
|
33
32
|
layer:(CALayer *)layer
|
|
34
|
-
andKeyPath:(NSString*)keyPath;
|
|
33
|
+
andKeyPath:(NSString *)keyPath;
|
|
35
34
|
{
|
|
36
35
|
REATransitionAnimation *anim = [REATransitionAnimation new];
|
|
37
36
|
anim.animation = animation;
|
|
@@ -47,7 +46,7 @@ CGFloat SimAnimationDragCoefficient()
|
|
|
47
46
|
it calls mach_absolute_time() which is based on the last time the device booted
|
|
48
47
|
which might cause the delay
|
|
49
48
|
*/
|
|
50
|
-
if (_delay > 0){
|
|
49
|
+
if (_delay > 0) {
|
|
51
50
|
_animation.beginTime = CACurrentMediaTime() + _delay * SimAnimationDragCoefficient();
|
|
52
51
|
}
|
|
53
52
|
_animation.duration = self.duration * SimAnimationDragCoefficient();
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
- (void)uiManagerWillPerformMounting:(RCTUIManager *)manager
|
|
37
37
|
{
|
|
38
|
-
[manager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
38
|
+
[manager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
39
39
|
[_pendingTransition playInRoot:_pendingTransitionRoot];
|
|
40
40
|
_pendingTransitionRoot = nil;
|
|
41
41
|
_pendingTransition = nil;
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
- (void)animateNextTransitionInRoot:(NSNumber *)reactTag withConfig:(NSDictionary *)config
|
|
46
46
|
{
|
|
47
47
|
[_uiManager.observerCoordinator addObserver:self];
|
|
48
|
-
[_uiManager prependUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
48
|
+
[_uiManager prependUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
49
49
|
UIView *view = viewRegistry[reactTag];
|
|
50
50
|
NSArray *transitionConfigs = [RCTConvert NSArray:config[@"transitions"]];
|
|
51
51
|
for (id transitionConfig in transitionConfigs) {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
}];
|
|
56
56
|
__weak id weakSelf = self;
|
|
57
|
-
[_uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
57
|
+
[_uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
58
58
|
[uiManager.observerCoordinator removeObserver:weakSelf];
|
|
59
59
|
}];
|
|
60
60
|
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <vector>
|
|
3
|
-
#import <string>
|
|
4
2
|
#import <React/RCTUIManager.h>
|
|
3
|
+
#include <string>
|
|
4
|
+
#import <string>
|
|
5
|
+
#include <utility>
|
|
6
|
+
#include <vector>
|
|
7
|
+
#import <vector>
|
|
8
|
+
#import "RNGestureHandlerStateManager.h"
|
|
5
9
|
|
|
6
10
|
namespace reanimated {
|
|
7
11
|
|
|
8
|
-
std::vector<std::pair<std::string,double>> measure(
|
|
9
|
-
|
|
12
|
+
std::vector<std::pair<std::string, double>> measure(
|
|
13
|
+
int viewTag,
|
|
14
|
+
RCTUIManager *uiManager);
|
|
15
|
+
void scrollTo(
|
|
16
|
+
int scrollViewTag,
|
|
17
|
+
RCTUIManager *uiManager,
|
|
18
|
+
double x,
|
|
19
|
+
double y,
|
|
20
|
+
bool animated);
|
|
21
|
+
void setGestureState(
|
|
22
|
+
id<RNGestureHandlerStateManager> gestureHandlerStateManager,
|
|
23
|
+
int handlerTag,
|
|
24
|
+
int newState);
|
|
10
25
|
|
|
11
|
-
}
|
|
26
|
+
} // namespace reanimated
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#import "NativeMethods.h"
|
|
2
|
-
#import <React/RCTScrollView.h>
|
|
3
2
|
#import <React/RCTEventDispatcher.h>
|
|
3
|
+
#import <React/RCTScrollView.h>
|
|
4
4
|
|
|
5
5
|
namespace reanimated {
|
|
6
6
|
|
|
7
|
-
std::vector<std::pair<std::string,double>> measure(int viewTag, RCTUIManager *uiManager)
|
|
7
|
+
std::vector<std::pair<std::string, double>> measure(int viewTag, RCTUIManager *uiManager)
|
|
8
|
+
{
|
|
8
9
|
UIView *view = [uiManager viewForReactTag:@(viewTag)];
|
|
9
10
|
|
|
10
11
|
UIView *rootView = view;
|
|
@@ -17,7 +18,7 @@ std::vector<std::pair<std::string,double>> measure(int viewTag, RCTUIManager *ui
|
|
|
17
18
|
rootView = rootView.superview;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
if (rootView == nil
|
|
21
|
+
if (rootView == nil) {
|
|
21
22
|
return std::vector<std::pair<std::string, double>>(1, std::make_pair("x", -1234567.0));
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -36,11 +37,18 @@ std::vector<std::pair<std::string,double>> measure(int viewTag, RCTUIManager *ui
|
|
|
36
37
|
return result;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
void scrollTo(int scrollViewTag, RCTUIManager *uiManager, double x, double y, bool animated)
|
|
41
|
+
{
|
|
41
42
|
UIView *view = [uiManager viewForReactTag:@(scrollViewTag)];
|
|
42
|
-
RCTScrollView *scrollView = (RCTScrollView *)
|
|
43
|
+
RCTScrollView *scrollView = (RCTScrollView *)view;
|
|
43
44
|
[scrollView scrollToOffset:(CGPoint){(CGFloat)x, (CGFloat)y} animated:animated];
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
void setGestureState(id<RNGestureHandlerStateManager> gestureHandlerStateManager, int handlerTag, int newState)
|
|
48
|
+
{
|
|
49
|
+
if (gestureHandlerStateManager != nil) {
|
|
50
|
+
[gestureHandlerStateManager setGestureState:newState forHandler:handlerTag];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
}
|
package/ios/native/NativeProxy.h
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#import <React/RCTEventDispatcher.h>
|
|
2
2
|
|
|
3
3
|
#if __cplusplus
|
|
4
|
-
|
|
5
4
|
#import <RNReanimated/NativeReanimatedModule.h>
|
|
5
|
+
#include <memory>
|
|
6
6
|
|
|
7
7
|
namespace reanimated {
|
|
8
8
|
|
|
9
|
-
std::shared_ptr<reanimated::NativeReanimatedModule> createReanimatedModule(
|
|
9
|
+
std::shared_ptr<reanimated::NativeReanimatedModule> createReanimatedModule(
|
|
10
|
+
RCTBridge *bridge,
|
|
11
|
+
std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
|
|
10
12
|
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
#import "REAIOSScheduler.h"
|
|
3
|
-
#import "REAIOSErrorHandler.h"
|
|
4
|
-
#import "REAModule.h"
|
|
5
|
-
#import "REANodesManager.h"
|
|
6
|
-
#import "NativeMethods.h"
|
|
7
|
-
#import <folly/json.h>
|
|
1
|
+
|
|
8
2
|
#import <React/RCTFollyConvert.h>
|
|
9
3
|
#import <React/RCTUIManager.h>
|
|
4
|
+
#import <folly/json.h>
|
|
5
|
+
|
|
10
6
|
#import "LayoutAnimationsProxy.h"
|
|
7
|
+
#import "NativeMethods.h"
|
|
8
|
+
#import "NativeProxy.h"
|
|
11
9
|
#import "REAAnimationsManager.h"
|
|
10
|
+
#import "REAIOSErrorHandler.h"
|
|
11
|
+
#import "REAIOSScheduler.h"
|
|
12
|
+
#import "REAModule.h"
|
|
13
|
+
#import "REANodesManager.h"
|
|
12
14
|
#import "REAUIManager.h"
|
|
15
|
+
#import "RNGestureHandlerStateManager.h"
|
|
13
16
|
|
|
14
17
|
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
15
18
|
#import <reacthermes/HermesExecutorFactory.h>
|
|
@@ -24,7 +27,6 @@ namespace reanimated {
|
|
|
24
27
|
using namespace facebook;
|
|
25
28
|
using namespace react;
|
|
26
29
|
|
|
27
|
-
|
|
28
30
|
// COPIED FROM RCTTurboModule.mm
|
|
29
31
|
static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value);
|
|
30
32
|
|
|
@@ -49,15 +51,13 @@ static NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const
|
|
|
49
51
|
return [result copy];
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
static NSArray *
|
|
53
|
-
convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value)
|
|
54
|
+
static NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value)
|
|
54
55
|
{
|
|
55
56
|
size_t size = value.size(runtime);
|
|
56
57
|
NSMutableArray *result = [NSMutableArray new];
|
|
57
58
|
for (size_t i = 0; i < size; i++) {
|
|
58
59
|
// Insert kCFNull when it's `undefined` value to preserve the indices.
|
|
59
|
-
[result
|
|
60
|
-
addObject:convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i)) ?: (id)kCFNull];
|
|
60
|
+
[result addObject:convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i)) ?: (id)kCFNull];
|
|
61
61
|
}
|
|
62
62
|
return [result copy];
|
|
63
63
|
}
|
|
@@ -87,18 +87,23 @@ static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &v
|
|
|
87
87
|
throw std::runtime_error("Unsupported jsi::jsi::Value kind");
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
91
|
-
|
|
90
|
+
std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
91
|
+
RCTBridge *bridge,
|
|
92
|
+
std::shared_ptr<CallInvoker> jsInvoker)
|
|
93
|
+
{
|
|
92
94
|
REAModule *reanimatedModule = [bridge moduleForClass:[REAModule class]];
|
|
93
95
|
|
|
94
|
-
auto propUpdater = [reanimatedModule](
|
|
95
|
-
|
|
96
|
+
auto propUpdater = [reanimatedModule](
|
|
97
|
+
jsi::Runtime &rt, int viewTag, const jsi::Value &viewName, const jsi::Object &props) -> void {
|
|
98
|
+
NSString *nsViewName = [NSString stringWithCString:viewName.asString(rt).utf8(rt).c_str()
|
|
99
|
+
encoding:[NSString defaultCStringEncoding]];
|
|
96
100
|
|
|
97
101
|
NSDictionary *propsDict = convertJSIObjectToNSDictionary(rt, props);
|
|
98
|
-
[reanimatedModule.nodesManager updateProps:propsDict
|
|
102
|
+
[reanimatedModule.nodesManager updateProps:propsDict
|
|
103
|
+
ofViewWithTag:[NSNumber numberWithInt:viewTag]
|
|
104
|
+
withName:nsViewName];
|
|
99
105
|
};
|
|
100
106
|
|
|
101
|
-
|
|
102
107
|
RCTUIManager *uiManager = reanimatedModule.nodesManager.uiManager;
|
|
103
108
|
auto measuringFunction = [uiManager](int viewTag) -> std::vector<std::pair<std::string, double>> {
|
|
104
109
|
return measure(viewTag, uiManager);
|
|
@@ -108,11 +113,18 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(std::shared_ptr<C
|
|
|
108
113
|
scrollTo(viewTag, uiManager, x, y, animated);
|
|
109
114
|
};
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
id<RNGestureHandlerStateManager> gestureHandlerStateManager = [bridge moduleForName:@"RNGestureHandlerModule"];
|
|
117
|
+
auto setGestureStateFunction = [gestureHandlerStateManager](int handlerTag, int newState) {
|
|
118
|
+
setGestureState(gestureHandlerStateManager, handlerTag, newState);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
auto propObtainer = [reanimatedModule](
|
|
122
|
+
jsi::Runtime &rt, const int viewTag, const jsi::String &propName) -> jsi::Value {
|
|
123
|
+
NSString *propNameConverted = [NSString stringWithFormat:@"%s", propName.utf8(rt).c_str()];
|
|
124
|
+
std::string resultStr = std::string([[reanimatedModule.nodesManager obtainProp:[NSNumber numberWithInt:viewTag]
|
|
125
|
+
propName:propNameConverted] UTF8String]);
|
|
126
|
+
jsi::Value val = jsi::String::createFromUtf8(rt, resultStr);
|
|
127
|
+
return val;
|
|
116
128
|
};
|
|
117
129
|
|
|
118
130
|
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
@@ -128,13 +140,13 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(std::shared_ptr<C
|
|
|
128
140
|
std::shared_ptr<NativeReanimatedModule> module;
|
|
129
141
|
|
|
130
142
|
__block std::weak_ptr<Scheduler> weakScheduler = scheduler;
|
|
131
|
-
((REAUIManager*)uiManager).flushUiOperations = ^void() {
|
|
143
|
+
((REAUIManager *)uiManager).flushUiOperations = ^void() {
|
|
132
144
|
std::shared_ptr<Scheduler> scheduler = weakScheduler.lock();
|
|
133
145
|
if (scheduler != nullptr) {
|
|
134
146
|
scheduler->triggerUI();
|
|
135
147
|
}
|
|
136
148
|
};
|
|
137
|
-
|
|
149
|
+
|
|
138
150
|
auto requestRender = [reanimatedModule, &module](std::function<void(double)> onRender, jsi::Runtime &rt) {
|
|
139
151
|
[reanimatedModule.nodesManager postOnAnimation:^(CADisplayLink *displayLink) {
|
|
140
152
|
double frameTimestamp = displayLink.targetTimestamp * 1000;
|
|
@@ -146,80 +158,89 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(std::shared_ptr<C
|
|
|
146
158
|
}];
|
|
147
159
|
};
|
|
148
160
|
|
|
149
|
-
auto getCurrentTime = []() {
|
|
150
|
-
|
|
151
|
-
};
|
|
152
|
-
|
|
161
|
+
auto getCurrentTime = []() { return CACurrentMediaTime() * 1000; };
|
|
162
|
+
|
|
153
163
|
// Layout Animations start
|
|
154
|
-
REAUIManager*
|
|
155
|
-
RCTUIManager*
|
|
164
|
+
REAUIManager *reaUiManagerNoCast = [bridge moduleForClass:[REAUIManager class]];
|
|
165
|
+
RCTUIManager *reaUiManager = reaUiManagerNoCast;
|
|
156
166
|
REAAnimationsManager *animationsManager = [[REAAnimationsManager alloc] initWithUIManager:reaUiManager];
|
|
157
167
|
[reaUiManagerNoCast setUp:animationsManager];
|
|
158
|
-
|
|
168
|
+
|
|
159
169
|
auto notifyAboutProgress = [=](int tag, jsi::Object newStyle) {
|
|
160
170
|
if (animationsManager) {
|
|
161
171
|
NSDictionary *propsDict = convertJSIObjectToNSDictionary(*animatedRuntime, newStyle);
|
|
162
|
-
[animationsManager notifyAboutProgress:propsDict tag:[NSNumber numberWithInt:
|
|
172
|
+
[animationsManager notifyAboutProgress:propsDict tag:[NSNumber numberWithInt:tag]];
|
|
163
173
|
}
|
|
164
174
|
};
|
|
165
|
-
|
|
175
|
+
|
|
166
176
|
auto notifyAboutEnd = [=](int tag, bool isCancelled) {
|
|
167
177
|
if (animationsManager) {
|
|
168
|
-
[animationsManager notifyAboutEnd:[NSNumber numberWithInt:
|
|
178
|
+
[animationsManager notifyAboutEnd:[NSNumber numberWithInt:tag] cancelled:isCancelled];
|
|
169
179
|
}
|
|
170
180
|
};
|
|
171
|
-
|
|
172
|
-
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy =
|
|
181
|
+
|
|
182
|
+
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy =
|
|
183
|
+
std::make_shared<LayoutAnimationsProxy>(notifyAboutProgress, notifyAboutEnd);
|
|
173
184
|
std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
|
|
174
|
-
[animationsManager setAnimationStartingBlock:^(
|
|
185
|
+
[animationsManager setAnimationStartingBlock:^(
|
|
186
|
+
NSNumber *_Nonnull tag, NSString *type, NSDictionary *_Nonnull values, NSNumber *depth) {
|
|
175
187
|
std::shared_ptr<jsi::Runtime> rt = wrt.lock();
|
|
176
188
|
if (wrt.expired()) {
|
|
177
189
|
return;
|
|
178
190
|
}
|
|
179
191
|
jsi::Object yogaValues(*rt);
|
|
180
192
|
for (NSString *key in values.allKeys) {
|
|
181
|
-
NSNumber*
|
|
193
|
+
NSNumber *value = values[key];
|
|
182
194
|
yogaValues.setProperty(*rt, [key UTF8String], [value doubleValue]);
|
|
183
195
|
}
|
|
184
|
-
|
|
185
|
-
jsi::Value layoutAnimationRepositoryAsValue =
|
|
196
|
+
|
|
197
|
+
jsi::Value layoutAnimationRepositoryAsValue =
|
|
198
|
+
rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository");
|
|
186
199
|
if (!layoutAnimationRepositoryAsValue.isUndefined()) {
|
|
187
|
-
jsi::Function startAnimationForTag =
|
|
188
|
-
|
|
200
|
+
jsi::Function startAnimationForTag =
|
|
201
|
+
layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "startAnimationForTag");
|
|
202
|
+
startAnimationForTag.call(
|
|
203
|
+
*rt,
|
|
204
|
+
jsi::Value([tag intValue]),
|
|
205
|
+
jsi::String::createFromAscii(*rt, std::string([type UTF8String])),
|
|
206
|
+
yogaValues,
|
|
207
|
+
jsi::Value([depth intValue]));
|
|
189
208
|
}
|
|
190
209
|
}];
|
|
191
210
|
|
|
192
|
-
|
|
193
|
-
[animationsManager setRemovingConfigBlock:^(NSNumber* _Nonnull tag) {
|
|
211
|
+
[animationsManager setRemovingConfigBlock:^(NSNumber *_Nonnull tag) {
|
|
194
212
|
std::shared_ptr<jsi::Runtime> rt = wrt.lock();
|
|
195
213
|
if (wrt.expired()) {
|
|
196
214
|
return;
|
|
197
215
|
}
|
|
198
|
-
jsi::Value layoutAnimationRepositoryAsValue =
|
|
216
|
+
jsi::Value layoutAnimationRepositoryAsValue =
|
|
217
|
+
rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository");
|
|
199
218
|
if (!layoutAnimationRepositoryAsValue.isUndefined()) {
|
|
200
|
-
jsi::Function removeConfig =
|
|
219
|
+
jsi::Function removeConfig =
|
|
220
|
+
layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "removeConfig");
|
|
201
221
|
removeConfig.call(*rt, jsi::Value([tag intValue]));
|
|
202
222
|
}
|
|
203
223
|
}];
|
|
204
|
-
|
|
224
|
+
|
|
205
225
|
// Layout Animations end
|
|
206
|
-
|
|
226
|
+
|
|
207
227
|
PlatformDepMethodsHolder platformDepMethodsHolder = {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
228
|
+
requestRender,
|
|
229
|
+
propUpdater,
|
|
230
|
+
scrollToFunction,
|
|
231
|
+
measuringFunction,
|
|
232
|
+
getCurrentTime,
|
|
233
|
+
setGestureStateFunction,
|
|
213
234
|
};
|
|
214
235
|
|
|
215
|
-
module = std::make_shared<NativeReanimatedModule>(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
236
|
+
module = std::make_shared<NativeReanimatedModule>(
|
|
237
|
+
jsInvoker,
|
|
238
|
+
scheduler,
|
|
239
|
+
animatedRuntime,
|
|
240
|
+
errorHandler,
|
|
241
|
+
propObtainer,
|
|
242
|
+
layoutAnimationsProxy,
|
|
243
|
+
platformDepMethodsHolder);
|
|
223
244
|
|
|
224
245
|
scheduler->setRuntimeManager(module);
|
|
225
246
|
|
|
@@ -227,7 +248,7 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(std::shared_ptr<C
|
|
|
227
248
|
std::string eventNameString([eventName UTF8String]);
|
|
228
249
|
std::string eventAsString = folly::toJson(convertIdToFollyDynamic([event arguments][2]));
|
|
229
250
|
|
|
230
|
-
eventAsString = "{ NativeMap:"
|
|
251
|
+
eventAsString = "{ NativeMap:" + eventAsString + "}";
|
|
231
252
|
jsi::Object global = module->runtime->global();
|
|
232
253
|
jsi::String eventTimestampName = jsi::String::createFromAscii(*module->runtime, "_eventTimestamp");
|
|
233
254
|
global.setProperty(*module->runtime, eventTimestampName, CACurrentMediaTime() * 1000);
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
3
5
|
#include "ErrorHandler.h"
|
|
4
6
|
#include "Scheduler.h"
|
|
5
7
|
|
|
6
8
|
namespace reanimated {
|
|
7
9
|
|
|
8
10
|
class REAIOSErrorHandler : public ErrorHandler {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
std::shared_ptr<Scheduler> scheduler;
|
|
12
|
+
void raiseSpec() override;
|
|
13
|
+
std::shared_ptr<ErrorWrapper> error;
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
REAIOSErrorHandler(std::shared_ptr<Scheduler> scheduler);
|
|
17
|
+
std::shared_ptr<Scheduler> getScheduler() override;
|
|
18
|
+
std::shared_ptr<ErrorWrapper> getError() override;
|
|
19
|
+
void setError(std::string message) override;
|
|
20
|
+
virtual ~REAIOSErrorHandler() {}
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
}
|
|
23
|
+
} // namespace reanimated
|
|
@@ -2,31 +2,35 @@
|
|
|
2
2
|
#import <Foundation/Foundation.h>
|
|
3
3
|
#import <React/RCTLog.h>
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
namespace reanimated {
|
|
7
6
|
|
|
8
|
-
REAIOSErrorHandler::REAIOSErrorHandler(std::shared_ptr<Scheduler> scheduler)
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
REAIOSErrorHandler::REAIOSErrorHandler(std::shared_ptr<Scheduler> scheduler)
|
|
8
|
+
{
|
|
9
|
+
this->scheduler = scheduler;
|
|
10
|
+
error = std::make_shared<ErrorWrapper>();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
void REAIOSErrorHandler::raiseSpec()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
void REAIOSErrorHandler::raiseSpec()
|
|
14
|
+
{
|
|
15
|
+
if (error->handled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
RCTLogError(@(error->message.c_str()));
|
|
19
|
+
this->error->handled = true;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
std::shared_ptr<Scheduler> REAIOSErrorHandler::getScheduler()
|
|
22
|
-
|
|
22
|
+
std::shared_ptr<Scheduler> REAIOSErrorHandler::getScheduler()
|
|
23
|
+
{
|
|
24
|
+
return this->scheduler;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
std::shared_ptr<ErrorWrapper> REAIOSErrorHandler::getError()
|
|
26
|
-
|
|
27
|
+
std::shared_ptr<ErrorWrapper> REAIOSErrorHandler::getError()
|
|
28
|
+
{
|
|
29
|
+
return this->error;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
void REAIOSErrorHandler::setError(std::string message)
|
|
32
|
+
void REAIOSErrorHandler::setError(std::string message)
|
|
33
|
+
{
|
|
30
34
|
if (error->handled) {
|
|
31
35
|
error->message = message;
|
|
32
36
|
error->handled = false;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "ReanimatedHiddenHeaders.h"
|
|
4
3
|
#include <stdio.h>
|
|
4
|
+
#include "ReanimatedHiddenHeaders.h"
|
|
5
5
|
|
|
6
6
|
namespace reanimated {
|
|
7
7
|
|
|
8
8
|
class REAIOSLogger : public LoggerInterface {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
public:
|
|
10
|
+
void log(const char *str) override;
|
|
11
|
+
void log(double d) override;
|
|
12
|
+
void log(int i) override;
|
|
13
|
+
void log(bool b) override;
|
|
14
|
+
virtual ~REAIOSLogger() {}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
}
|
|
17
|
+
} // namespace reanimated
|