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,16 +1,21 @@
|
|
|
1
1
|
#import "REAUIManager.h"
|
|
2
2
|
#import <Foundation/Foundation.h>
|
|
3
|
+
#include "FeaturesConfig.h"
|
|
3
4
|
#import "RCTComponentData.h"
|
|
4
|
-
#import "RCTUIManagerObserverCoordinator.h"
|
|
5
|
-
#import "RCTRootShadowView.h"
|
|
6
|
-
#import "RCTRootViewInternal.h"
|
|
7
5
|
#import "RCTLayoutAnimation.h"
|
|
8
6
|
#import "RCTLayoutAnimationGroup.h"
|
|
7
|
+
#import "RCTModalHostView.h"
|
|
8
|
+
#import "RCTRootShadowView.h"
|
|
9
|
+
#import "RCTRootViewInternal.h"
|
|
10
|
+
#import "RCTUIManagerObserverCoordinator.h"
|
|
9
11
|
#import "REAIOSScheduler.h"
|
|
10
12
|
#include "Scheduler.h"
|
|
13
|
+
|
|
14
|
+
#if __has_include(<RNScreens/RNSScreen.h>)
|
|
11
15
|
#import <RNScreens/RNSScreen.h>
|
|
16
|
+
#endif
|
|
12
17
|
|
|
13
|
-
@interface RCTUIManager(REA)
|
|
18
|
+
@interface RCTUIManager (REA)
|
|
14
19
|
- (void)_manageChildren:(NSNumber *)containerTag
|
|
15
20
|
moveFromIndices:(NSArray<NSNumber *> *)moveFromIndices
|
|
16
21
|
moveToIndices:(NSArray<NSNumber *> *)moveToIndices
|
|
@@ -26,32 +31,35 @@
|
|
|
26
31
|
@implementation REAUIManager
|
|
27
32
|
|
|
28
33
|
BOOL blockSetter = false;
|
|
29
|
-
NSMutableDictionary<NSNumber*, NSMutableSet<id<RCTComponent
|
|
30
|
-
NSMutableDictionary<NSNumber*, NSNumber
|
|
31
|
-
REAAnimationsManager*
|
|
34
|
+
NSMutableDictionary<NSNumber *, NSMutableSet<id<RCTComponent>> *> *_toBeRemovedRegister;
|
|
35
|
+
NSMutableDictionary<NSNumber *, NSNumber *> *_parentMapper;
|
|
36
|
+
REAAnimationsManager *_animationsManager;
|
|
32
37
|
std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
33
38
|
|
|
34
|
-
+ (NSString*)moduleName
|
|
39
|
+
+ (NSString *)moduleName
|
|
35
40
|
{
|
|
36
41
|
return NSStringFromClass([RCTUIManager class]);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
- (void)setBridge:(RCTBridge *)bridge
|
|
40
45
|
{
|
|
41
|
-
if(!_blockSetter) {
|
|
46
|
+
if (!_blockSetter) {
|
|
42
47
|
_blockSetter = true;
|
|
43
|
-
|
|
48
|
+
|
|
44
49
|
self.bridge = bridge;
|
|
50
|
+
[super setValue:bridge forKey:@"_bridge"];
|
|
45
51
|
[self setValue:[bridge.uiManager valueForKey:@"_shadowViewRegistry"] forKey:@"_shadowViewRegistry"];
|
|
46
52
|
[self setValue:[bridge.uiManager valueForKey:@"_viewRegistry"] forKey:@"_viewRegistry"];
|
|
47
53
|
[self setValue:[bridge.uiManager valueForKey:@"_nativeIDRegistry"] forKey:@"_nativeIDRegistry"];
|
|
48
|
-
[self setValue:[bridge.uiManager valueForKey:@"_shadowViewsWithUpdatedProps"]
|
|
49
|
-
|
|
54
|
+
[self setValue:[bridge.uiManager valueForKey:@"_shadowViewsWithUpdatedProps"]
|
|
55
|
+
forKey:@"_shadowViewsWithUpdatedProps"];
|
|
56
|
+
[self setValue:[bridge.uiManager valueForKey:@"_shadowViewsWithUpdatedChildren"]
|
|
57
|
+
forKey:@"_shadowViewsWithUpdatedChildren"];
|
|
50
58
|
[self setValue:[bridge.uiManager valueForKey:@"_pendingUIBlocks"] forKey:@"_pendingUIBlocks"];
|
|
51
59
|
[self setValue:[bridge.uiManager valueForKey:@"_rootViewTags"] forKey:@"_rootViewTags"];
|
|
52
60
|
[self setValue:[bridge.uiManager valueForKey:@"_observerCoordinator"] forKey:@"_observerCoordinator"];
|
|
53
61
|
[self setValue:[bridge.uiManager valueForKey:@"_componentDataByName"] forKey:@"_componentDataByName"];
|
|
54
|
-
|
|
62
|
+
|
|
55
63
|
_blockSetter = false;
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -64,26 +72,40 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
64
72
|
removeAtIndices:(NSArray<NSNumber *> *)removeAtIndices
|
|
65
73
|
registry:(NSMutableDictionary<NSNumber *, id<RCTComponent>> *)registry
|
|
66
74
|
{
|
|
75
|
+
if (!reanimated::FeaturesConfig::isLayoutAnimationEnabled()) {
|
|
76
|
+
[super _manageChildren:containerTag
|
|
77
|
+
moveFromIndices:moveFromIndices
|
|
78
|
+
moveToIndices:moveToIndices
|
|
79
|
+
addChildReactTags:addChildReactTags
|
|
80
|
+
addAtIndices:addAtIndices
|
|
81
|
+
removeAtIndices:removeAtIndices
|
|
82
|
+
registry:registry];
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Reanimated changes /start
|
|
67
87
|
BOOL isUIViewRegistry = ((id)registry == (id)[self valueForKey:@"_viewRegistry"]);
|
|
68
88
|
id<RCTComponent> container;
|
|
69
|
-
|
|
70
|
-
if(isUIViewRegistry) {
|
|
71
|
-
container = registry[containerTag];
|
|
72
|
-
for(id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
89
|
+
NSMutableArray<id<RCTComponent>> *permanentlyRemovedChildren;
|
|
90
|
+
if (isUIViewRegistry) {
|
|
91
|
+
container = registry[containerTag];
|
|
92
|
+
for (id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
73
93
|
[container removeReactSubview:toRemoveChild];
|
|
74
94
|
}
|
|
75
|
-
|
|
76
|
-
permanentlyRemovedChildren = [super _childrenToRemoveFromContainer:container
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
|
|
96
|
+
permanentlyRemovedChildren = (NSMutableArray *)[super _childrenToRemoveFromContainer:container
|
|
97
|
+
atIndices:removeAtIndices];
|
|
98
|
+
if (permanentlyRemovedChildren != nil) {
|
|
99
|
+
for (id<RCTComponent> permanentlyRemovedChild in permanentlyRemovedChildren) {
|
|
100
|
+
if (_toBeRemovedRegister[containerTag] == nil) {
|
|
80
101
|
_toBeRemovedRegister[containerTag] = [[NSMutableSet<id<RCTComponent>> alloc] init];
|
|
81
102
|
}
|
|
82
103
|
[_toBeRemovedRegister[containerTag] addObject:permanentlyRemovedChild];
|
|
83
104
|
}
|
|
84
105
|
}
|
|
85
106
|
}
|
|
86
|
-
|
|
107
|
+
// Reanimated changes /end
|
|
108
|
+
|
|
87
109
|
[super _manageChildren:containerTag
|
|
88
110
|
moveFromIndices:moveFromIndices
|
|
89
111
|
moveToIndices:moveToIndices
|
|
@@ -91,38 +113,52 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
91
113
|
addAtIndices:addAtIndices
|
|
92
114
|
removeAtIndices:removeAtIndices
|
|
93
115
|
registry:registry];
|
|
94
|
-
|
|
95
|
-
|
|
116
|
+
|
|
117
|
+
// Reanimated changes /start
|
|
118
|
+
if (isUIViewRegistry) {
|
|
96
119
|
NSMutableDictionary<NSNumber *, id<RCTComponent>> *viewRegistry = [self valueForKey:@"_viewRegistry"];
|
|
97
|
-
for(id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
120
|
+
for (id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
98
121
|
NSInteger lastIndex = [container reactSubviews].count - 1;
|
|
99
|
-
if(lastIndex < 0) {
|
|
122
|
+
if (lastIndex < 0) {
|
|
100
123
|
lastIndex = 0;
|
|
101
124
|
}
|
|
102
|
-
[
|
|
103
|
-
|
|
125
|
+
if ([toRemoveChild isKindOfClass:[RCTModalHostView class]]
|
|
126
|
+
#if __has_include(<RNScreens/RNSScreen.h>)
|
|
127
|
+
|| ([toRemoveChild isKindOfClass:[RNSScreenView class]])
|
|
128
|
+
#endif
|
|
129
|
+
) {
|
|
130
|
+
// we don't want layout animations when removing modals or Screens of native-stack since it brings buggy
|
|
131
|
+
// behavior
|
|
132
|
+
[_toBeRemovedRegister[container.reactTag] removeObject:toRemoveChild];
|
|
133
|
+
[permanentlyRemovedChildren removeObject:toRemoveChild];
|
|
134
|
+
|
|
135
|
+
} else {
|
|
136
|
+
[container insertReactSubview:toRemoveChild atIndex:lastIndex];
|
|
137
|
+
viewRegistry[toRemoveChild.reactTag] = toRemoveChild;
|
|
138
|
+
}
|
|
104
139
|
}
|
|
105
|
-
|
|
140
|
+
|
|
106
141
|
for (UIView *removedChild in permanentlyRemovedChildren) {
|
|
107
|
-
[self callAnimationForTree:
|
|
142
|
+
[self callAnimationForTree:removedChild parentTag:containerTag];
|
|
108
143
|
}
|
|
109
144
|
}
|
|
145
|
+
// Reanimated changes /end
|
|
110
146
|
}
|
|
111
147
|
|
|
112
|
-
- (void)
|
|
148
|
+
- (void)callAnimationForTree:(UIView *)view parentTag:(NSNumber *)parentTag
|
|
113
149
|
{
|
|
114
|
-
REASnapshot*
|
|
150
|
+
REASnapshot *snapshot = [[REASnapshot alloc] init:view];
|
|
115
151
|
_parentMapper[view.reactTag] = parentTag;
|
|
116
152
|
[_animationsManager onViewRemoval:view before:snapshot];
|
|
117
|
-
|
|
118
|
-
for(UIView*
|
|
153
|
+
|
|
154
|
+
for (UIView *subView in view.reactSubviews) {
|
|
119
155
|
[self callAnimationForTree:subView parentTag:view.reactTag];
|
|
120
156
|
}
|
|
121
157
|
}
|
|
122
158
|
|
|
123
159
|
// Overrided https://github.com/facebook/react-native/blob/v0.65.0/React/Modules/RCTUIManager.m#L530
|
|
124
160
|
- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView
|
|
125
|
-
{
|
|
161
|
+
{
|
|
126
162
|
NSHashTable<RCTShadowView *> *affectedShadowViews = [NSHashTable weakObjectsHashTable];
|
|
127
163
|
[rootShadowView layoutWithAffectedShadowViews:affectedShadowViews];
|
|
128
164
|
|
|
@@ -149,11 +185,12 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
149
185
|
for (RCTShadowView *shadowView in affectedShadowViews) {
|
|
150
186
|
reactTags[index] = shadowView.reactTag;
|
|
151
187
|
RCTLayoutMetrics layoutMetrics = shadowView.layoutMetrics;
|
|
152
|
-
frameDataArray[index++] = (RCTFrameData){
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
188
|
+
frameDataArray[index++] = (RCTFrameData){
|
|
189
|
+
layoutMetrics.frame,
|
|
190
|
+
layoutMetrics.layoutDirection,
|
|
191
|
+
shadowView.isNewView,
|
|
192
|
+
shadowView.superview.isNewView,
|
|
193
|
+
layoutMetrics.displayType};
|
|
157
194
|
}
|
|
158
195
|
}
|
|
159
196
|
|
|
@@ -179,7 +216,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
179
216
|
CGSize contentSize = shadowView.layoutMetrics.frame.size;
|
|
180
217
|
|
|
181
218
|
RCTExecuteOnMainQueue(^{
|
|
182
|
-
NSMutableDictionary<NSNumber *, UIView
|
|
219
|
+
NSMutableDictionary<NSNumber *, UIView *> *viewRegistry = [self valueForKey:@"_viewRegistry"];
|
|
183
220
|
UIView *view = viewRegistry[reactTag];
|
|
184
221
|
RCTAssert(view != nil, @"view (for ID %@) not found", reactTag);
|
|
185
222
|
|
|
@@ -231,8 +268,14 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
231
268
|
if (view.isHidden != isHidden) {
|
|
232
269
|
view.hidden = isHidden;
|
|
233
270
|
}
|
|
234
|
-
|
|
235
|
-
|
|
271
|
+
|
|
272
|
+
// Reanimated changes /start
|
|
273
|
+
REASnapshot *snapshotBefore;
|
|
274
|
+
if (reanimated::FeaturesConfig::isLayoutAnimationEnabled()) {
|
|
275
|
+
snapshotBefore = [[REASnapshot alloc] init:view];
|
|
276
|
+
}
|
|
277
|
+
// Reanimated changes /end
|
|
278
|
+
|
|
236
279
|
if (creatingLayoutAnimation) {
|
|
237
280
|
// Animate view creation
|
|
238
281
|
[view reactSetFrame:frame];
|
|
@@ -277,65 +320,68 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
277
320
|
[view reactSetFrame:frame];
|
|
278
321
|
completion(YES);
|
|
279
322
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
323
|
+
|
|
324
|
+
// Reanimated changes /start
|
|
325
|
+
if (reanimated::FeaturesConfig::isLayoutAnimationEnabled()) {
|
|
326
|
+
if (isNew) {
|
|
327
|
+
REASnapshot *snapshot = [[REASnapshot alloc] init:view];
|
|
328
|
+
[_animationsManager onViewCreate:view after:snapshot];
|
|
329
|
+
} else {
|
|
330
|
+
REASnapshot *snapshotAfter = [[REASnapshot alloc] init:view];
|
|
331
|
+
[_animationsManager onViewUpdate:view before:snapshotBefore after:snapshotAfter];
|
|
332
|
+
}
|
|
288
333
|
}
|
|
289
|
-
|
|
290
334
|
}
|
|
291
335
|
|
|
336
|
+
[_animationsManager removeLeftovers];
|
|
292
337
|
// Clean up
|
|
338
|
+
// uiManager->_layoutAnimationGroup = nil;
|
|
293
339
|
[uiManager setValue:nil forKey:@"_layoutAnimationGroup"];
|
|
340
|
+
// Reanimated changes /end
|
|
294
341
|
};
|
|
295
342
|
}
|
|
296
343
|
|
|
297
344
|
- (Class)class
|
|
298
345
|
{
|
|
299
|
-
|
|
346
|
+
return [RCTUIManager class];
|
|
300
347
|
}
|
|
301
348
|
|
|
302
349
|
+ (Class)class
|
|
303
350
|
{
|
|
304
|
-
|
|
351
|
+
return [RCTUIManager class];
|
|
305
352
|
}
|
|
306
353
|
|
|
307
|
-
- (void)setUp:(REAAnimationsManager*)
|
|
354
|
+
- (void)setUp:(REAAnimationsManager *)animationsManager
|
|
308
355
|
{
|
|
309
356
|
_animationsManager = animationsManager;
|
|
310
|
-
_toBeRemovedRegister = [[NSMutableDictionary<NSNumber*, NSMutableSet<id<RCTComponent
|
|
311
|
-
_parentMapper = [[NSMutableDictionary<NSNumber*, NSNumber*> alloc] init];
|
|
357
|
+
_toBeRemovedRegister = [[NSMutableDictionary<NSNumber *, NSMutableSet<id<RCTComponent>> *> alloc] init];
|
|
358
|
+
_parentMapper = [[NSMutableDictionary<NSNumber *, NSNumber *> alloc] init];
|
|
312
359
|
}
|
|
313
360
|
|
|
314
|
-
- (void)unregisterView:(id<RCTComponent>)
|
|
361
|
+
- (void)unregisterView:(id<RCTComponent>)view
|
|
315
362
|
{
|
|
316
|
-
NSNumber*
|
|
317
|
-
if(tag == nil) {
|
|
363
|
+
NSNumber *tag = _parentMapper[view.reactTag];
|
|
364
|
+
if (tag == nil) {
|
|
318
365
|
return;
|
|
319
366
|
}
|
|
320
|
-
|
|
367
|
+
|
|
321
368
|
[_toBeRemovedRegister[tag] removeObject:view];
|
|
322
|
-
if(_toBeRemovedRegister[tag].count == 0) {
|
|
369
|
+
if (_toBeRemovedRegister[tag].count == 0) {
|
|
323
370
|
[_toBeRemovedRegister removeObjectForKey:tag];
|
|
324
371
|
}
|
|
325
372
|
NSMutableDictionary<NSNumber *, id<RCTComponent>> *viewRegistry = [self valueForKey:@"_viewRegistry"];
|
|
326
373
|
[view.reactSuperview removeReactSubview:view];
|
|
327
374
|
id<RCTComponent> parentView = viewRegistry[tag];
|
|
328
|
-
|
|
375
|
+
@try {
|
|
376
|
+
[parentView removeReactSubview:view];
|
|
377
|
+
} @catch (id anException) {
|
|
378
|
+
}
|
|
379
|
+
#if __has_include(<RNScreens/RNSScreen.h>)
|
|
329
380
|
if ([view isKindOfClass:[RNSScreenView class]]) {
|
|
330
381
|
[parentView didUpdateReactSubviews];
|
|
331
382
|
}
|
|
383
|
+
#endif
|
|
332
384
|
[viewRegistry removeObjectForKey:view.reactTag];
|
|
333
385
|
}
|
|
334
386
|
|
|
335
|
-
- (void)batchDidComplete
|
|
336
|
-
{
|
|
337
|
-
self.flushUiOperations();
|
|
338
|
-
[super batchDidComplete];
|
|
339
|
-
}
|
|
340
|
-
|
|
341
387
|
@end
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#import "REAAlwaysNode.h"
|
|
2
|
-
#import "REAUtils.h"
|
|
3
|
-
#import "REANodesManager.h"
|
|
4
|
-
#import "REAStyleNode.h"
|
|
5
|
-
#import "REAModule.h"
|
|
6
|
-
#import <React/RCTLog.h>
|
|
7
2
|
#import <React/RCTConvert.h>
|
|
3
|
+
#import <React/RCTLog.h>
|
|
8
4
|
#import <React/RCTUIManager.h>
|
|
5
|
+
#import "REAModule.h"
|
|
6
|
+
#import "REANodesManager.h"
|
|
7
|
+
#import "REAStyleNode.h"
|
|
8
|
+
#import "REAUtils.h"
|
|
9
9
|
|
|
10
|
-
@implementation REAAlwaysNode
|
|
11
|
-
|
|
12
|
-
NSNumber * _nodeToBeEvaluated;
|
|
10
|
+
@implementation REAAlwaysNode {
|
|
11
|
+
NSNumber *_nodeToBeEvaluated;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
14
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
16
15
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
if ((self = [super initWithID:nodeID config:config])) {
|
|
17
|
+
_nodeToBeEvaluated = [RCTConvert NSNumber:config[@"what"]];
|
|
18
|
+
REA_LOG_ERROR_IF_NIL(
|
|
19
|
+
_nodeToBeEvaluated, @"Reanimated: First argument passed to always node is either of wrong type or is missing.");
|
|
20
|
+
}
|
|
21
|
+
return self;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
- (id)evaluate
|
|
@@ -33,4 +33,3 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@end
|
|
36
|
-
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#include <tgmath.h>
|
|
2
2
|
|
|
3
|
-
#import "REABezierNode.h"
|
|
4
|
-
#import "REAUtils.h"
|
|
5
|
-
#import "REANodesManager.h"
|
|
6
3
|
#import <React/RCTConvert.h>
|
|
7
4
|
#import <React/RCTLog.h>
|
|
5
|
+
#import "REABezierNode.h"
|
|
6
|
+
#import "REANodesManager.h"
|
|
7
|
+
#import "REAUtils.h"
|
|
8
8
|
|
|
9
9
|
#define EPS 1e-5
|
|
10
10
|
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
NSNumber *_inputNodeID;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
16
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
17
17
|
{
|
|
18
18
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
19
19
|
_inputNodeID = [RCTConvert NSNumber:config[@"input"]];
|
|
20
|
-
REA_LOG_ERROR_IF_NIL(
|
|
20
|
+
REA_LOG_ERROR_IF_NIL(
|
|
21
|
+
_inputNodeID, @"Reanimated: First argument passed to bezier node is either of wrong type or is missing.");
|
|
21
22
|
|
|
22
23
|
CGFloat mX1 = [config[@"mX1"] doubleValue];
|
|
23
24
|
CGFloat mY1 = [config[@"mY1"] doubleValue];
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
// Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
|
|
28
29
|
cx = 3.0 * mX1;
|
|
29
30
|
bx = 3.0 * (mX2 - mX1) - cx;
|
|
30
|
-
ax = 1.0 - cx -bx;
|
|
31
|
+
ax = 1.0 - cx - bx;
|
|
31
32
|
|
|
32
33
|
cy = 3.0 * mY1;
|
|
33
34
|
by = 3.0 * (mY2 - mY1) - cy;
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
// First try a few iterations of Newton's method -- normally very fast.
|
|
61
62
|
for (t2 = x, i = 0; i < 8; i++) {
|
|
62
63
|
x2 = [self sampleCurveX:t2] - x;
|
|
63
|
-
if (fabs
|
|
64
|
+
if (fabs(x2) < epsilon)
|
|
64
65
|
return t2;
|
|
65
66
|
d2 = [self sampleCurveDerivativeX:t2];
|
|
66
67
|
if (fabs(d2) < 1e-6)
|
package/ios/Nodes/REABlockNode.m
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
NSArray<NSNumber *> *_block;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
8
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
9
9
|
{
|
|
10
10
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
11
11
|
_block = config[@"block"];
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
#import "REACallFuncNode.h"
|
|
4
4
|
#import "REAFunctionNode.h"
|
|
5
|
-
#import "REAUtils.h"
|
|
6
|
-
#import "REAParamNode.h"
|
|
7
5
|
#import "REANodesManager.h"
|
|
6
|
+
#import "REAParamNode.h"
|
|
7
|
+
#import "REAUtils.h"
|
|
8
8
|
|
|
9
9
|
@implementation REACallFuncNode {
|
|
10
10
|
NSNumber *_whatNodeID;
|
|
11
11
|
NSArray<NSNumber *> *_args;
|
|
12
12
|
NSArray<NSNumber *> *_params;
|
|
13
|
-
NSString*
|
|
13
|
+
NSString *_prevCallID;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
16
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
17
17
|
{
|
|
18
18
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
19
19
|
_whatNodeID = config[@"what"];
|
|
20
|
-
REA_LOG_ERROR_IF_NIL(
|
|
20
|
+
REA_LOG_ERROR_IF_NIL(
|
|
21
|
+
_whatNodeID, @"Reanimated: First argument passed to callFunc node is either of wrong type or is missing.");
|
|
21
22
|
_args = config[@"args"];
|
|
22
23
|
_params = config[@"params"];
|
|
23
24
|
_prevCallID = NULL;
|
|
@@ -27,13 +28,14 @@
|
|
|
27
28
|
|
|
28
29
|
- (void)beginContext
|
|
29
30
|
{
|
|
30
|
-
// To ensure that functions can be called multiple times in the same animation frame
|
|
31
|
+
// To ensure that functions can be called multiple times in the same animation frame
|
|
31
32
|
// (functions might have different parameters and might be called multiple times)
|
|
32
33
|
// we inform the current update context about where we are called from by setting the
|
|
33
34
|
// current call id - this will ensure that memoization is correct for function nodes.
|
|
34
35
|
_prevCallID = self.updateContext.callID;
|
|
35
|
-
self.updateContext.callID =
|
|
36
|
-
|
|
36
|
+
self.updateContext.callID =
|
|
37
|
+
[NSString stringWithFormat:@"%@/%@", self.updateContext.callID, [self.nodeID stringValue]];
|
|
38
|
+
|
|
37
39
|
// A CallFuncNode has a reference to a function node which holds the node graph that should
|
|
38
40
|
// be updated. A Function node has a list of ParamNodes which are basically nodes that can
|
|
39
41
|
// reference other nodes. When we start a new function call we update the parameter nodes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#import "REAClockNodes.h"
|
|
2
|
-
#import "REAUtils.h"
|
|
3
|
-
#import "REANodesManager.h"
|
|
4
|
-
#import "REAParamNode.h"
|
|
5
2
|
#import <React/RCTConvert.h>
|
|
6
3
|
#import <React/RCTLog.h>
|
|
4
|
+
#import "REANodesManager.h"
|
|
5
|
+
#import "REAParamNode.h"
|
|
6
|
+
#import "REAUtils.h"
|
|
7
7
|
|
|
8
8
|
@interface REAClockNode ()
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
@implementation REAClockNode
|
|
15
15
|
|
|
16
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
16
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
17
17
|
{
|
|
18
18
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
19
19
|
_isRunning = NO;
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
- (void)start
|
|
25
25
|
{
|
|
26
|
-
if (_isRunning)
|
|
26
|
+
if (_isRunning)
|
|
27
|
+
return;
|
|
27
28
|
_isRunning = YES;
|
|
28
29
|
|
|
29
30
|
__block __weak void (^weak_animationClb)(CADisplayLink *displayLink);
|
|
@@ -31,7 +32,8 @@
|
|
|
31
32
|
__weak REAClockNode *weakSelf = self;
|
|
32
33
|
|
|
33
34
|
weak_animationClb = animationClb = ^(CADisplayLink *displayLink) {
|
|
34
|
-
if (!weakSelf.isRunning)
|
|
35
|
+
if (!weakSelf.isRunning)
|
|
36
|
+
return;
|
|
35
37
|
[weakSelf markUpdated];
|
|
36
38
|
[weakSelf.nodesManager postOnAnimation:weak_animationClb];
|
|
37
39
|
};
|
|
@@ -55,18 +57,19 @@
|
|
|
55
57
|
NSNumber *_clockNodeID;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
60
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
59
61
|
{
|
|
60
62
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
61
63
|
_clockNodeID = [RCTConvert NSNumber:config[@"clock"]];
|
|
62
|
-
REA_LOG_ERROR_IF_NIL(
|
|
64
|
+
REA_LOG_ERROR_IF_NIL(
|
|
65
|
+
_clockNodeID, @"Reanimated: First argument passed to clock node is either of wrong type or is missing.");
|
|
63
66
|
}
|
|
64
67
|
return self;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
- (REANode*)clockNode
|
|
70
|
+
- (REANode *)clockNode
|
|
68
71
|
{
|
|
69
|
-
return (REANode*)[self.nodesManager findNodeByID:_clockNodeID];
|
|
72
|
+
return (REANode *)[self.nodesManager findNodeByID:_clockNodeID];
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
@end
|
|
@@ -75,11 +78,11 @@
|
|
|
75
78
|
|
|
76
79
|
- (id)evaluate
|
|
77
80
|
{
|
|
78
|
-
REANode*
|
|
81
|
+
REANode *node = [self clockNode];
|
|
79
82
|
if ([node isKindOfClass:[REAParamNode class]]) {
|
|
80
|
-
[(REAParamNode*
|
|
83
|
+
[(REAParamNode *)node start];
|
|
81
84
|
} else {
|
|
82
|
-
[(REAClockNode*
|
|
85
|
+
[(REAClockNode *)node start];
|
|
83
86
|
}
|
|
84
87
|
return @(0);
|
|
85
88
|
}
|
|
@@ -90,27 +93,26 @@
|
|
|
90
93
|
|
|
91
94
|
- (id)evaluate
|
|
92
95
|
{
|
|
93
|
-
REANode*
|
|
96
|
+
REANode *node = [self clockNode];
|
|
94
97
|
if ([node isKindOfClass:[REAParamNode class]]) {
|
|
95
|
-
[(REAParamNode*
|
|
98
|
+
[(REAParamNode *)node stop];
|
|
96
99
|
} else {
|
|
97
|
-
[(REAClockNode*
|
|
100
|
+
[(REAClockNode *)node stop];
|
|
98
101
|
}
|
|
99
102
|
return @(0);
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
|
|
103
105
|
@end
|
|
104
106
|
|
|
105
107
|
@implementation REAClockTestNode
|
|
106
108
|
|
|
107
109
|
- (id)evaluate
|
|
108
110
|
{
|
|
109
|
-
REANode*
|
|
111
|
+
REANode *node = [self clockNode];
|
|
110
112
|
if ([node isKindOfClass:[REAParamNode class]]) {
|
|
111
|
-
return @(((REAParamNode*
|
|
113
|
+
return @(((REAParamNode *)node).isRunning ? 1 : 0);
|
|
112
114
|
}
|
|
113
|
-
return @([(REAClockNode*
|
|
115
|
+
return @([(REAClockNode *)node isRunning] ? 1 : 0);
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
@end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#import "REAConcatNode.h"
|
|
2
|
-
#import "REAValueNode.h"
|
|
3
2
|
#import "REANodesManager.h"
|
|
3
|
+
#import "REAValueNode.h"
|
|
4
4
|
|
|
5
5
|
@implementation REAConcatNode {
|
|
6
6
|
NSArray<NSNumber *> *_input;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
9
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
10
10
|
{
|
|
11
11
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
12
12
|
_input = config[@"input"];
|
package/ios/Nodes/REACondNode.m
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#import "REACondNode.h"
|
|
2
|
-
#import "REANodesManager.h"
|
|
3
2
|
#import <React/RCTConvert.h>
|
|
4
|
-
#import "REAUtils.h"
|
|
5
3
|
#import <React/RCTLog.h>
|
|
4
|
+
#import "REANodesManager.h"
|
|
5
|
+
#import "REAUtils.h"
|
|
6
6
|
|
|
7
7
|
@implementation REACondNode {
|
|
8
8
|
NSNumber *_condNodeID;
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
NSNumber *_elseBlockID;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
13
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
14
14
|
{
|
|
15
15
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
16
16
|
_condNodeID = [RCTConvert NSNumber:config[@"cond"]];
|
|
17
|
-
REA_LOG_ERROR_IF_NIL(
|
|
17
|
+
REA_LOG_ERROR_IF_NIL(
|
|
18
|
+
_condNodeID, @"Reanimated: First argument passed to cond node is either of wrong type or is missing.");
|
|
18
19
|
_ifBlockID = [RCTConvert NSNumber:config[@"ifBlock"]];
|
|
19
|
-
REA_LOG_ERROR_IF_NIL(
|
|
20
|
+
REA_LOG_ERROR_IF_NIL(
|
|
21
|
+
_ifBlockID, @"Reanimated: Second argument passed to cond node is either of wrong type or is missing.");
|
|
20
22
|
_elseBlockID = [RCTConvert NSNumber:config[@"elseBlock"]];
|
|
21
23
|
}
|
|
22
24
|
return self;
|
package/ios/Nodes/READebugNode.m
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#import "READebugNode.h"
|
|
2
|
-
#import "REAUtils.h"
|
|
3
|
-
#import "REANodesManager.h"
|
|
4
2
|
#import <React/RCTConvert.h>
|
|
5
3
|
#import <React/RCTLog.h>
|
|
4
|
+
#import "REANodesManager.h"
|
|
5
|
+
#import "REAUtils.h"
|
|
6
6
|
|
|
7
7
|
@implementation READebugNode {
|
|
8
8
|
NSNumber *_valueNodeID;
|
|
9
9
|
NSString *_message;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id> *)config
|
|
12
|
+
- (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
13
13
|
{
|
|
14
14
|
if ((self = [super initWithID:nodeID config:config])) {
|
|
15
15
|
_message = [RCTConvert NSString:config[@"message"]];
|
|
16
16
|
_valueNodeID = [RCTConvert NSNumber:config[@"value"]];
|
|
17
|
-
REA_LOG_ERROR_IF_NIL(
|
|
17
|
+
REA_LOG_ERROR_IF_NIL(
|
|
18
|
+
_valueNodeID, @"Reanimated: Second argument passed to debug node is either of wrong type or is missing.");
|
|
18
19
|
}
|
|
19
20
|
return self;
|
|
20
21
|
}
|