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
package/ios/REANodesManager.m
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
#import <React/RCTConvert.h>
|
|
4
4
|
|
|
5
|
+
#import <React/RCTShadowView.h>
|
|
6
|
+
#import "Nodes/REAAlwaysNode.h"
|
|
7
|
+
#import "Nodes/REABezierNode.h"
|
|
8
|
+
#import "Nodes/REABlockNode.h"
|
|
9
|
+
#import "Nodes/REACallFuncNode.h"
|
|
10
|
+
#import "Nodes/REAClockNodes.h"
|
|
11
|
+
#import "Nodes/REAConcatNode.h"
|
|
12
|
+
#import "Nodes/REACondNode.h"
|
|
13
|
+
#import "Nodes/READebugNode.h"
|
|
14
|
+
#import "Nodes/REAEventNode.h"
|
|
15
|
+
#import "Nodes/REAFunctionNode.h"
|
|
16
|
+
#import "Nodes/REAJSCallNode.h"
|
|
5
17
|
#import "Nodes/REANode.h"
|
|
18
|
+
#import "Nodes/REAOperatorNode.h"
|
|
19
|
+
#import "Nodes/REAParamNode.h"
|
|
6
20
|
#import "Nodes/REAPropsNode.h"
|
|
21
|
+
#import "Nodes/REASetNode.h"
|
|
7
22
|
#import "Nodes/REAStyleNode.h"
|
|
8
23
|
#import "Nodes/REATransformNode.h"
|
|
9
24
|
#import "Nodes/REAValueNode.h"
|
|
10
|
-
#import "Nodes/REABlockNode.h"
|
|
11
|
-
#import "Nodes/REACondNode.h"
|
|
12
|
-
#import "Nodes/REAOperatorNode.h"
|
|
13
|
-
#import "Nodes/REASetNode.h"
|
|
14
|
-
#import "Nodes/READebugNode.h"
|
|
15
|
-
#import "Nodes/REAClockNodes.h"
|
|
16
|
-
#import "Nodes/REAJSCallNode.h"
|
|
17
|
-
#import "Nodes/REABezierNode.h"
|
|
18
|
-
#import "Nodes/REAEventNode.h"
|
|
19
25
|
#import "REAModule.h"
|
|
20
|
-
#import "Nodes/REAAlwaysNode.h"
|
|
21
|
-
#import "Nodes/REAConcatNode.h"
|
|
22
|
-
#import "Nodes/REAParamNode.h"
|
|
23
|
-
#import "Nodes/REAFunctionNode.h"
|
|
24
|
-
#import "Nodes/REACallFuncNode.h"
|
|
25
|
-
#import <React/RCTShadowView.h>
|
|
26
26
|
|
|
27
27
|
// Interface below has been added in order to use private methods of RCTUIManager,
|
|
28
28
|
// RCTUIManager#UpdateView is a React Method which is exported to JS but in
|
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
@interface RCTUIManager ()
|
|
34
34
|
|
|
35
|
-
- (void)updateView:(nonnull NSNumber *)reactTag
|
|
36
|
-
viewName:(NSString *)viewName
|
|
37
|
-
props:(NSDictionary *)props;
|
|
35
|
+
- (void)updateView:(nonnull NSNumber *)reactTag viewName:(NSString *)viewName props:(NSDictionary *)props;
|
|
38
36
|
|
|
39
37
|
- (void)setNeedsLayout;
|
|
40
38
|
|
|
@@ -84,13 +82,11 @@
|
|
|
84
82
|
|
|
85
83
|
@end
|
|
86
84
|
|
|
87
|
-
@interface REANodesManager() <RCTUIManagerObserver>
|
|
85
|
+
@interface REANodesManager () <RCTUIManagerObserver>
|
|
88
86
|
|
|
89
87
|
@end
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
@implementation REANodesManager
|
|
93
|
-
{
|
|
89
|
+
@implementation REANodesManager {
|
|
94
90
|
NSMutableDictionary<REANodeID, REANode *> *_nodes;
|
|
95
91
|
NSMapTable<NSString *, REANode *> *_eventMapping;
|
|
96
92
|
NSMutableArray<id<RCTEvent>> *_eventQueue;
|
|
@@ -105,8 +101,7 @@
|
|
|
105
101
|
volatile void (^_mounting)(void);
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
- (instancetype)initWithModule:(REAModule *)reanimatedModule
|
|
109
|
-
uiManager:(RCTUIManager *)uiManager
|
|
104
|
+
- (instancetype)initWithModule:(REAModule *)reanimatedModule uiManager:(RCTUIManager *)uiManager
|
|
110
105
|
{
|
|
111
106
|
if ((self = [super init])) {
|
|
112
107
|
_reanimatedModule = reanimatedModule;
|
|
@@ -119,8 +114,9 @@
|
|
|
119
114
|
_onAnimationCallbacks = [NSMutableArray new];
|
|
120
115
|
_operationsInBatch = [NSMutableArray new];
|
|
121
116
|
}
|
|
122
|
-
|
|
117
|
+
|
|
123
118
|
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
|
|
119
|
+
_displayLink.preferredFramesPerSecond = 120; // will fallback to 60 fps for devices without Pro Motion display
|
|
124
120
|
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
|
125
121
|
[_displayLink setPaused:true];
|
|
126
122
|
return self;
|
|
@@ -172,14 +168,14 @@
|
|
|
172
168
|
|
|
173
169
|
- (void)startUpdatingOnAnimationFrame
|
|
174
170
|
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
// Setting _currentAnimationTimestamp here is connected with manual triggering of performOperations
|
|
172
|
+
// in operationsBatchDidComplete. If new node has been created and clock has not been started,
|
|
173
|
+
// _displayLink won't be initialized soon enough and _displayLink.timestamp will be 0.
|
|
174
|
+
// However, CADisplayLink is using CACurrentMediaTime so if there's need to perform one more
|
|
175
|
+
// evaluation, it could be used it here. In usual case, CACurrentMediaTime is not being used in
|
|
176
|
+
// favor of setting it with _displayLink.timestamp in onAnimationFrame method.
|
|
177
|
+
_currentAnimationTimestamp = CACurrentMediaTime();
|
|
178
|
+
[_displayLink setPaused:false];
|
|
183
179
|
}
|
|
184
180
|
|
|
185
181
|
- (void)stopUpdatingOnAnimationFrame
|
|
@@ -217,7 +213,8 @@
|
|
|
217
213
|
}
|
|
218
214
|
}
|
|
219
215
|
|
|
220
|
-
- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
|
|
216
|
+
- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
|
|
217
|
+
{
|
|
221
218
|
RCTAssert(_mounting == nil, @"Mouting block is expected to not be set");
|
|
222
219
|
_mounting = block;
|
|
223
220
|
return YES;
|
|
@@ -234,7 +231,7 @@
|
|
|
234
231
|
|
|
235
232
|
BOOL trySynchronously = _tryRunBatchUpdatesSynchronously;
|
|
236
233
|
_tryRunBatchUpdatesSynchronously = NO;
|
|
237
|
-
|
|
234
|
+
|
|
238
235
|
__weak typeof(self) weakSelf = self;
|
|
239
236
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
240
237
|
RCTExecuteOnUIManagerQueue(^{
|
|
@@ -243,27 +240,27 @@
|
|
|
243
240
|
return;
|
|
244
241
|
}
|
|
245
242
|
BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands];
|
|
246
|
-
|
|
243
|
+
|
|
247
244
|
if (!canUpdateSynchronously) {
|
|
248
245
|
dispatch_semaphore_signal(semaphore);
|
|
249
246
|
}
|
|
250
|
-
|
|
247
|
+
|
|
251
248
|
for (int i = 0; i < copiedOperationsQueue.count; i++) {
|
|
252
249
|
copiedOperationsQueue[i](strongSelf.uiManager);
|
|
253
250
|
}
|
|
254
|
-
|
|
251
|
+
|
|
255
252
|
if (canUpdateSynchronously) {
|
|
256
253
|
[strongSelf.uiManager runSyncUIUpdatesWithObserver:self];
|
|
257
254
|
dispatch_semaphore_signal(semaphore);
|
|
258
255
|
}
|
|
259
|
-
//In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
|
|
260
|
-
//to observers because some components (e.g. TextInput) update their UIViews only on that event.
|
|
256
|
+
// In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
|
|
257
|
+
// to observers because some components (e.g. TextInput) update their UIViews only on that event.
|
|
261
258
|
[strongSelf.uiManager setNeedsLayout];
|
|
262
259
|
});
|
|
263
260
|
if (trySynchronously) {
|
|
264
261
|
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
|
265
262
|
}
|
|
266
|
-
|
|
263
|
+
|
|
267
264
|
if (_mounting) {
|
|
268
265
|
_mounting();
|
|
269
266
|
_mounting = nil;
|
|
@@ -273,9 +270,10 @@
|
|
|
273
270
|
}
|
|
274
271
|
|
|
275
272
|
- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)reactTag
|
|
276
|
-
viewName:(NSString *)
|
|
273
|
+
viewName:(NSString *)viewName
|
|
277
274
|
nativeProps:(NSMutableDictionary *)nativeProps
|
|
278
|
-
trySynchronously:(BOOL)trySync
|
|
275
|
+
trySynchronously:(BOOL)trySync
|
|
276
|
+
{
|
|
279
277
|
if (trySync) {
|
|
280
278
|
_tryRunBatchUpdatesSynchronously = YES;
|
|
281
279
|
}
|
|
@@ -284,49 +282,48 @@
|
|
|
284
282
|
}];
|
|
285
283
|
}
|
|
286
284
|
|
|
287
|
-
- (void)getValue:(REANodeID)nodeID
|
|
288
|
-
callback:(RCTResponseSenderBlock)callback
|
|
285
|
+
- (void)getValue:(REANodeID)nodeID callback:(RCTResponseSenderBlock)callback
|
|
289
286
|
{
|
|
290
287
|
id val = _nodes[nodeID].value;
|
|
291
288
|
if (val) {
|
|
292
|
-
callback(@[val]);
|
|
289
|
+
callback(@[ val ]);
|
|
293
290
|
} else {
|
|
294
291
|
// NULL is not an object and it's not possible to pass it as callback's argument
|
|
295
|
-
callback(@[[NSNull null]]);
|
|
292
|
+
callback(@[ [NSNull null] ]);
|
|
296
293
|
}
|
|
297
294
|
}
|
|
298
295
|
|
|
299
|
-
#pragma mark
|
|
296
|
+
#pragma mark-- Graph
|
|
300
297
|
|
|
301
|
-
- (void)createNode:(REANodeID)nodeID
|
|
302
|
-
config:(NSDictionary<NSString *, id> *)config
|
|
298
|
+
- (void)createNode:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
303
299
|
{
|
|
304
300
|
static NSDictionary *map;
|
|
305
301
|
static dispatch_once_t mapToken;
|
|
306
302
|
dispatch_once(&mapToken, ^{
|
|
307
|
-
map = @{
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
303
|
+
map = @{
|
|
304
|
+
@"props" : [REAPropsNode class],
|
|
305
|
+
@"style" : [REAStyleNode class],
|
|
306
|
+
@"transform" : [REATransformNode class],
|
|
307
|
+
@"value" : [REAValueNode class],
|
|
308
|
+
@"block" : [REABlockNode class],
|
|
309
|
+
@"cond" : [REACondNode class],
|
|
310
|
+
@"op" : [REAOperatorNode class],
|
|
311
|
+
@"set" : [REASetNode class],
|
|
312
|
+
@"debug" : [READebugNode class],
|
|
313
|
+
@"clock" : [REAClockNode class],
|
|
314
|
+
@"clockStart" : [REAClockStartNode class],
|
|
315
|
+
@"clockStop" : [REAClockStopNode class],
|
|
316
|
+
@"clockTest" : [REAClockTestNode class],
|
|
317
|
+
@"call" : [REAJSCallNode class],
|
|
318
|
+
@"bezier" : [REABezierNode class],
|
|
319
|
+
@"event" : [REAEventNode class],
|
|
320
|
+
@"always" : [REAAlwaysNode class],
|
|
321
|
+
@"concat" : [REAConcatNode class],
|
|
322
|
+
@"param" : [REAParamNode class],
|
|
323
|
+
@"func" : [REAFunctionNode class],
|
|
324
|
+
@"callfunc" : [REACallFuncNode class]
|
|
325
|
+
// @"listener": nil,
|
|
326
|
+
};
|
|
330
327
|
});
|
|
331
328
|
|
|
332
329
|
NSString *nodeType = [RCTConvert NSString:config[@"type"]];
|
|
@@ -378,9 +375,7 @@
|
|
|
378
375
|
[parentNode removeChild:childNode];
|
|
379
376
|
}
|
|
380
377
|
|
|
381
|
-
- (void)connectNodeToView:(REANodeID)nodeID
|
|
382
|
-
viewTag:(NSNumber *)viewTag
|
|
383
|
-
viewName:(NSString *)viewName
|
|
378
|
+
- (void)connectNodeToView:(REANodeID)nodeID viewTag:(NSNumber *)viewTag viewName:(NSString *)viewName
|
|
384
379
|
{
|
|
385
380
|
RCTAssertParam(nodeID);
|
|
386
381
|
REANode *node = _nodes[nodeID];
|
|
@@ -391,8 +386,7 @@
|
|
|
391
386
|
}
|
|
392
387
|
}
|
|
393
388
|
|
|
394
|
-
- (void)disconnectNodeFromView:(REANodeID)nodeID
|
|
395
|
-
viewTag:(NSNumber *)viewTag
|
|
389
|
+
- (void)disconnectNodeFromView:(REANodeID)nodeID viewTag:(NSNumber *)viewTag
|
|
396
390
|
{
|
|
397
391
|
RCTAssertParam(nodeID);
|
|
398
392
|
REANode *node = _nodes[nodeID];
|
|
@@ -403,36 +397,26 @@
|
|
|
403
397
|
}
|
|
404
398
|
}
|
|
405
399
|
|
|
406
|
-
- (void)attachEvent:(NSNumber *)viewTag
|
|
407
|
-
eventName:(NSString *)eventName
|
|
408
|
-
eventNodeID:(REANodeID)eventNodeID
|
|
400
|
+
- (void)attachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(REANodeID)eventNodeID
|
|
409
401
|
{
|
|
410
402
|
RCTAssertParam(eventNodeID);
|
|
411
403
|
REANode *eventNode = _nodes[eventNodeID];
|
|
412
404
|
RCTAssert([eventNode isKindOfClass:[REAEventNode class]], @"Event node is of an invalid type");
|
|
413
405
|
|
|
414
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
415
|
-
viewTag,
|
|
416
|
-
RCTNormalizeInputEventName(eventName)];
|
|
406
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeInputEventName(eventName)];
|
|
417
407
|
RCTAssert([_eventMapping objectForKey:key] == nil, @"Event handler already set for the given view and event type");
|
|
418
408
|
[_eventMapping setObject:eventNode forKey:key];
|
|
419
409
|
}
|
|
420
410
|
|
|
421
|
-
- (void)detachEvent:(NSNumber *)viewTag
|
|
422
|
-
eventName:(NSString *)eventName
|
|
423
|
-
eventNodeID:(REANodeID)eventNodeID
|
|
411
|
+
- (void)detachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(REANodeID)eventNodeID
|
|
424
412
|
{
|
|
425
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
426
|
-
viewTag,
|
|
427
|
-
RCTNormalizeInputEventName(eventName)];
|
|
413
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeInputEventName(eventName)];
|
|
428
414
|
[_eventMapping removeObjectForKey:key];
|
|
429
415
|
}
|
|
430
416
|
|
|
431
417
|
- (void)processEvent:(id<RCTEvent>)event
|
|
432
418
|
{
|
|
433
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
434
|
-
event.viewTag,
|
|
435
|
-
RCTNormalizeInputEventName(event.eventName)];
|
|
419
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeInputEventName(event.eventName)];
|
|
436
420
|
REAEventNode *eventNode = [_eventMapping objectForKey:key];
|
|
437
421
|
[eventNode processEvent:event];
|
|
438
422
|
}
|
|
@@ -465,18 +449,14 @@
|
|
|
465
449
|
|
|
466
450
|
- (void)dispatchEvent:(id<RCTEvent>)event
|
|
467
451
|
{
|
|
468
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
469
|
-
event.viewTag,
|
|
470
|
-
RCTNormalizeInputEventName(event.eventName)];
|
|
452
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeInputEventName(event.eventName)];
|
|
471
453
|
|
|
472
|
-
NSString *eventHash = [NSString stringWithFormat:@"%@%@",
|
|
473
|
-
event.viewTag,
|
|
474
|
-
event.eventName];
|
|
454
|
+
NSString *eventHash = [NSString stringWithFormat:@"%@%@", event.viewTag, event.eventName];
|
|
475
455
|
|
|
476
456
|
if (_eventHandler != nil) {
|
|
477
457
|
__weak REAEventHandler eventHandler = _eventHandler;
|
|
478
458
|
__weak typeof(self) weakSelf = self;
|
|
479
|
-
RCTExecuteOnMainQueue(^void(){
|
|
459
|
+
RCTExecuteOnMainQueue(^void() {
|
|
480
460
|
__typeof__(self) strongSelf = weakSelf;
|
|
481
461
|
if (strongSelf == nil) {
|
|
482
462
|
return;
|
|
@@ -506,8 +486,7 @@
|
|
|
506
486
|
}
|
|
507
487
|
}
|
|
508
488
|
|
|
509
|
-
- (void)configureProps:(NSSet<NSString *> *)nativeProps
|
|
510
|
-
uiProps:(NSSet<NSString *> *)uiProps
|
|
489
|
+
- (void)configureProps:(NSSet<NSString *> *)nativeProps uiProps:(NSSet<NSString *> *)uiProps
|
|
511
490
|
{
|
|
512
491
|
_uiProps = uiProps;
|
|
513
492
|
_nativeProps = nativeProps;
|
|
@@ -532,7 +511,7 @@
|
|
|
532
511
|
NSMutableDictionary *nativeProps = [NSMutableDictionary new];
|
|
533
512
|
NSMutableDictionary *jsProps = [NSMutableDictionary new];
|
|
534
513
|
|
|
535
|
-
void (^addBlock)(NSString *key, id obj, BOOL *
|
|
514
|
+
void (^addBlock)(NSString *key, id obj, BOOL *stop) = ^(NSString *key, id obj, BOOL *stop) {
|
|
536
515
|
if ([self.uiProps containsObject:key]) {
|
|
537
516
|
uiProps[key] = obj;
|
|
538
517
|
} else if ([self.nativeProps containsObject:key]) {
|
|
@@ -545,36 +524,33 @@
|
|
|
545
524
|
[props enumerateKeysAndObjectsUsingBlock:addBlock];
|
|
546
525
|
|
|
547
526
|
if (uiProps.count > 0) {
|
|
548
|
-
[self.uiManager
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
[self.reanimatedModule sendEventWithName:@"onReanimatedPropsChange"
|
|
558
|
-
body:@{@"viewTag": viewTag, @"props": jsProps }];
|
|
559
|
-
}
|
|
527
|
+
[self.uiManager synchronouslyUpdateViewOnUIThread:viewTag viewName:viewName props:uiProps];
|
|
528
|
+
}
|
|
529
|
+
if (nativeProps.count > 0) {
|
|
530
|
+
[self enqueueUpdateViewOnNativeThread:viewTag viewName:viewName nativeProps:nativeProps trySynchronously:YES];
|
|
531
|
+
}
|
|
532
|
+
if (jsProps.count > 0) {
|
|
533
|
+
[self.reanimatedModule sendEventWithName:@"onReanimatedPropsChange"
|
|
534
|
+
body:@{@"viewTag" : viewTag, @"props" : jsProps}];
|
|
535
|
+
}
|
|
560
536
|
}
|
|
561
537
|
|
|
562
|
-
- (NSString*)obtainProp:(nonnull NSNumber *)viewTag
|
|
563
|
-
propName:(nonnull NSString *)propName
|
|
538
|
+
- (NSString *)obtainProp:(nonnull NSNumber *)viewTag propName:(nonnull NSString *)propName
|
|
564
539
|
{
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
540
|
+
UIView *view = [self.uiManager viewForReactTag:viewTag];
|
|
541
|
+
|
|
542
|
+
NSString *result =
|
|
543
|
+
[NSString stringWithFormat:@"error: unknown propName %@, currently supported: opacity, zIndex", propName];
|
|
544
|
+
|
|
545
|
+
if ([propName isEqualToString:@"opacity"]) {
|
|
546
|
+
CGFloat alpha = view.alpha;
|
|
547
|
+
result = [@(alpha) stringValue];
|
|
548
|
+
} else if ([propName isEqualToString:@"zIndex"]) {
|
|
549
|
+
NSInteger zIndex = view.reactZIndex;
|
|
550
|
+
result = [@(zIndex) stringValue];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return result;
|
|
578
554
|
}
|
|
579
555
|
|
|
580
556
|
@end
|
package/ios/REAUtils.h
CHANGED
|
@@ -2,36 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
@implementation RCTConvert (REATransition)
|
|
4
4
|
|
|
5
|
-
RCT_ENUM_CONVERTER(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
RCT_ENUM_CONVERTER(
|
|
6
|
+
REATransitionType,
|
|
7
|
+
(@{
|
|
8
|
+
@"none" : @(REATransitionTypeNone),
|
|
9
|
+
@"group" : @(REATransitionTypeGroup),
|
|
10
|
+
@"in" : @(REATransitionTypeIn),
|
|
11
|
+
@"out" : @(REATransitionTypeOut),
|
|
12
|
+
@"change" : @(REATransitionTypeChange),
|
|
13
|
+
}),
|
|
14
|
+
REATransitionTypeNone,
|
|
15
|
+
integerValue)
|
|
12
16
|
|
|
13
|
-
RCT_ENUM_CONVERTER(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
RCT_ENUM_CONVERTER(
|
|
18
|
+
REATransitionAnimationType,
|
|
19
|
+
(@{
|
|
20
|
+
@"none" : @(REATransitionAnimationTypeNone),
|
|
21
|
+
@"fade" : @(REATransitionAnimationTypeFade),
|
|
22
|
+
@"scale" : @(REATransitionAnimationTypeScale),
|
|
23
|
+
@"slide-top" : @(REATransitionAnimationTypeSlideTop),
|
|
24
|
+
@"slide-bottom" : @(REATransitionAnimationTypeSlideBottom),
|
|
25
|
+
@"slide-right" : @(REATransitionAnimationTypeSlideRight),
|
|
26
|
+
@"slide-left" : @(REATransitionAnimationTypeSlideLeft)
|
|
27
|
+
}),
|
|
28
|
+
REATransitionAnimationTypeNone,
|
|
29
|
+
integerValue)
|
|
22
30
|
|
|
23
|
-
RCT_ENUM_CONVERTER(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
RCT_ENUM_CONVERTER(
|
|
32
|
+
REATransitionInterpolationType,
|
|
33
|
+
(@{
|
|
34
|
+
@"linear" : @(REATransitionInterpolationLinear),
|
|
35
|
+
@"easeIn" : @(REATransitionInterpolationEaseIn),
|
|
36
|
+
@"easeOut" : @(REATransitionInterpolationEaseOut),
|
|
37
|
+
@"easeInOut" : @(REATransitionInterpolationEaseInOut),
|
|
38
|
+
}),
|
|
39
|
+
REATransitionInterpolationLinear,
|
|
40
|
+
integerValue)
|
|
29
41
|
|
|
30
|
-
RCT_ENUM_CONVERTER(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
RCT_ENUM_CONVERTER(
|
|
43
|
+
REATransitionPropagationType,
|
|
44
|
+
(@{
|
|
45
|
+
@"none" : @(REATransitionPropagationNone),
|
|
46
|
+
@"top" : @(REATransitionPropagationTop),
|
|
47
|
+
@"bottom" : @(REATransitionPropagationBottom),
|
|
48
|
+
@"left" : @(REATransitionPropagationLeft),
|
|
49
|
+
@"right" : @(REATransitionPropagationRight)
|
|
50
|
+
}),
|
|
51
|
+
REATransitionPropagationNone,
|
|
52
|
+
integerValue)
|
|
37
53
|
@end
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
@interface REAVisibilityTransition : REATransition
|
|
10
10
|
@property (nonatomic) REATransitionAnimationType animationType;
|
|
11
|
-
- (REATransitionAnimation *)appearView:(UIView*)view inParent:(UIView*)parent;
|
|
12
|
-
- (REATransitionAnimation *)disappearView:(UIView*)view fromParent:(UIView*)parent;
|
|
11
|
+
- (REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent;
|
|
12
|
+
- (REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent;
|
|
13
13
|
- (instancetype)initWithConfig:(NSDictionary *)config;
|
|
14
14
|
@end
|
|
15
15
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#import <React/RCTViewManager.h>
|
|
2
2
|
|
|
3
|
-
#import "REAAllTransitions.h"
|
|
4
3
|
#import "RCTConvert+REATransition.h"
|
|
4
|
+
#import "REAAllTransitions.h"
|
|
5
5
|
|
|
6
6
|
@interface REASnapshotRemover : NSObject <CAAnimationDelegate>
|
|
7
7
|
@end
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
if (self = [super initWithConfig:config]) {
|
|
34
34
|
_sequence = [RCTConvert BOOL:config[@"sequence"]];
|
|
35
35
|
NSArray *transitions = [RCTConvert NSArray:config[@"transitions"]];
|
|
36
|
-
NSMutableArray<REATransition*> *inflated = [NSMutableArray new];
|
|
36
|
+
NSMutableArray<REATransition *> *inflated = [NSMutableArray new];
|
|
37
37
|
for (NSDictionary *transitionConfig in transitions) {
|
|
38
38
|
[inflated addObject:[REATransition inflate:transitionConfig]];
|
|
39
39
|
inflated.lastObject.parent = self;
|
|
@@ -51,9 +51,10 @@
|
|
|
51
51
|
return self;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
- (NSArray<REATransitionAnimation *> *)
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
- (NSArray<REATransitionAnimation *> *)
|
|
55
|
+
animationsForTransitioning:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)startValues
|
|
56
|
+
endValues:(NSMutableDictionary<NSNumber *, REATransitionValues *> *)endValues
|
|
57
|
+
forRoot:(UIView *)root
|
|
57
58
|
{
|
|
58
59
|
CFTimeInterval delay = self.delay;
|
|
59
60
|
NSMutableArray *animations = [NSMutableArray new];
|
|
@@ -74,7 +75,6 @@
|
|
|
74
75
|
|
|
75
76
|
@end
|
|
76
77
|
|
|
77
|
-
|
|
78
78
|
@implementation REAVisibilityTransition
|
|
79
79
|
|
|
80
80
|
- (instancetype)initWithConfig:(NSDictionary *)config
|
|
@@ -85,23 +85,19 @@
|
|
|
85
85
|
return self;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
- (REATransitionAnimation *)appearView:(UIView *)view
|
|
89
|
-
inParent:(UIView *)parent
|
|
90
|
-
forRoot:(UIView *)root
|
|
88
|
+
- (REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent forRoot:(UIView *)root
|
|
91
89
|
{
|
|
92
90
|
return nil;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
- (REATransitionAnimation *)disappearView:(UIView *)view
|
|
96
|
-
fromParent:(UIView *)parent
|
|
97
|
-
forRoot:(UIView *)root
|
|
93
|
+
- (REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent forRoot:(UIView *)root
|
|
98
94
|
{
|
|
99
95
|
return nil;
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
- (REATransitionAnimation *)animationForTransitioning:(REATransitionValues *)startValues
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
endValues:(REATransitionValues *)endValues
|
|
100
|
+
forRoot:(UIView *)root
|
|
105
101
|
{
|
|
106
102
|
BOOL isViewAppearing = (startValues == nil);
|
|
107
103
|
if (isViewAppearing && !IS_LAYOUT_ONLY(endValues.view)) {
|
|
@@ -123,7 +119,6 @@
|
|
|
123
119
|
|
|
124
120
|
@end
|
|
125
121
|
|
|
126
|
-
|
|
127
122
|
@implementation REAInTransition
|
|
128
123
|
- (instancetype)initWithConfig:(NSDictionary *)config
|
|
129
124
|
{
|
|
@@ -132,9 +127,7 @@
|
|
|
132
127
|
return self;
|
|
133
128
|
}
|
|
134
129
|
|
|
135
|
-
- (REATransitionAnimation *)appearView:(UIView *)view
|
|
136
|
-
inParent:(UIView *)parent
|
|
137
|
-
forRoot:(UIView *)root
|
|
130
|
+
- (REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent forRoot:(UIView *)root
|
|
138
131
|
{
|
|
139
132
|
CABasicAnimation *animation;
|
|
140
133
|
switch (self.animationType) {
|
|
@@ -186,7 +179,6 @@
|
|
|
186
179
|
}
|
|
187
180
|
@end
|
|
188
181
|
|
|
189
|
-
|
|
190
182
|
@implementation REAOutTransition
|
|
191
183
|
- (instancetype)initWithConfig:(NSDictionary *)config
|
|
192
184
|
{
|
|
@@ -195,9 +187,7 @@
|
|
|
195
187
|
return self;
|
|
196
188
|
}
|
|
197
189
|
|
|
198
|
-
- (REATransitionAnimation *)disappearView:(UIView *)view
|
|
199
|
-
fromParent:(UIView *)parent
|
|
200
|
-
forRoot:(UIView *)root
|
|
190
|
+
- (REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent forRoot:(UIView *)root
|
|
201
191
|
{
|
|
202
192
|
if (self.animationType == REATransitionAnimationTypeNone) {
|
|
203
193
|
return nil;
|
|
@@ -262,12 +252,11 @@
|
|
|
262
252
|
}
|
|
263
253
|
@end
|
|
264
254
|
|
|
265
|
-
|
|
266
255
|
@implementation REAChangeTransition
|
|
267
256
|
|
|
268
257
|
- (REATransitionAnimation *)animationForTransitioning:(REATransitionValues *)startValues
|
|
269
|
-
|
|
270
|
-
|
|
258
|
+
endValues:(REATransitionValues *)endValues
|
|
259
|
+
forRoot:(UIView *)root
|
|
271
260
|
{
|
|
272
261
|
if (startValues == nil || endValues == nil || endValues.view.window == nil) {
|
|
273
262
|
return nil;
|