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,14 +1,14 @@
|
|
|
1
1
|
#import "REAAnimationsManager.h"
|
|
2
2
|
#import <React/RCTComponentData.h>
|
|
3
|
-
#import <React/
|
|
3
|
+
#import <React/RCTTextView.h>
|
|
4
4
|
#import <React/UIView+Private.h>
|
|
5
|
+
#import <React/UIView+React.h>
|
|
5
6
|
#import "REAUIManager.h"
|
|
6
|
-
#import <React/RCTTextView.h>
|
|
7
7
|
|
|
8
8
|
@interface REAAnimationsManager ()
|
|
9
9
|
|
|
10
|
-
@property (atomic, nullable) void(^startAnimationForTag)(NSNumber *, NSString *, NSDictionary *, NSNumber*);
|
|
11
|
-
@property (atomic, nullable) void(^removeConfigForTag)(NSNumber *);
|
|
10
|
+
@property (atomic, nullable) void (^startAnimationForTag)(NSNumber *, NSString *, NSDictionary *, NSNumber *);
|
|
11
|
+
@property (atomic, nullable) void (^removeConfigForTag)(NSNumber *);
|
|
12
12
|
|
|
13
13
|
- (void)removeLeftovers;
|
|
14
14
|
- (void)scheduleCleaning;
|
|
@@ -16,29 +16,29 @@
|
|
|
16
16
|
@end
|
|
17
17
|
|
|
18
18
|
@implementation REAAnimationsManager {
|
|
19
|
-
RCTUIManager*
|
|
20
|
-
REAUIManager*
|
|
21
|
-
NSMutableDictionary<NSNumber*, NSNumber
|
|
22
|
-
NSMutableDictionary<NSNumber*, UIView
|
|
23
|
-
NSMutableSet<NSNumber
|
|
19
|
+
RCTUIManager *_uiManager;
|
|
20
|
+
REAUIManager *_reaUiManager;
|
|
21
|
+
NSMutableDictionary<NSNumber *, NSNumber *> *_states;
|
|
22
|
+
NSMutableDictionary<NSNumber *, UIView *> *_viewForTag;
|
|
23
|
+
NSMutableSet<NSNumber *> *_toRemove;
|
|
24
24
|
BOOL _cleaningScheduled;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
+ (NSArray *)layoutKeys
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
static NSArray *_array;
|
|
30
|
+
static dispatch_once_t onceToken;
|
|
31
|
+
dispatch_once(&onceToken, ^{
|
|
32
|
+
_array = @[ @"originX", @"originY", @"width", @"height" ];
|
|
33
|
+
});
|
|
34
|
+
return _array;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
- (instancetype)initWithUIManager:(RCTUIManager *)uiManager
|
|
38
38
|
{
|
|
39
39
|
if (self = [super init]) {
|
|
40
40
|
_uiManager = uiManager;
|
|
41
|
-
_reaUiManager = (REAUIManager*)uiManager;
|
|
41
|
+
_reaUiManager = (REAUIManager *)uiManager;
|
|
42
42
|
_states = [NSMutableDictionary new];
|
|
43
43
|
_viewForTag = [NSMutableDictionary new];
|
|
44
44
|
_toRemove = [NSMutableSet new];
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
_cleaningScheduled = false;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
- (void)setAnimationStartingBlock:
|
|
61
|
+
- (void)setAnimationStartingBlock:
|
|
62
|
+
(void (^)(NSNumber *tag, NSString *type, NSDictionary *yogaValues, NSNumber *depth))startAnimation
|
|
62
63
|
{
|
|
63
64
|
_startAnimationForTag = startAnimation;
|
|
64
65
|
}
|
|
@@ -70,11 +71,11 @@
|
|
|
70
71
|
|
|
71
72
|
- (void)scheduleCleaning
|
|
72
73
|
{
|
|
73
|
-
if(_cleaningScheduled) {
|
|
74
|
+
if (_cleaningScheduled) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
_cleaningScheduled = true;
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
__weak REAAnimationsManager *weakSelf = self;
|
|
79
80
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
80
81
|
self->_cleaningScheduled = false;
|
|
@@ -85,44 +86,44 @@
|
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
- (void)
|
|
89
|
+
- (void)findRoot:(UIView *)view roots:(NSMutableSet<NSNumber *> *)roots
|
|
89
90
|
{
|
|
90
|
-
UIView*
|
|
91
|
-
NSNumber*
|
|
91
|
+
UIView *currentView = view;
|
|
92
|
+
NSNumber *lastToRemoveTag = nil;
|
|
92
93
|
while (currentView != nil) {
|
|
93
94
|
ViewState state = [_states[currentView.reactTag] intValue];
|
|
94
|
-
if(state == Disappearing) {
|
|
95
|
+
if (state == Disappearing) {
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
if(state == ToRemove) {
|
|
98
|
+
if (state == ToRemove) {
|
|
98
99
|
lastToRemoveTag = currentView.reactTag;
|
|
99
100
|
}
|
|
100
101
|
currentView = currentView.superview;
|
|
101
102
|
}
|
|
102
|
-
if(lastToRemoveTag != nil) {
|
|
103
|
+
if (lastToRemoveTag != nil) {
|
|
103
104
|
[roots addObject:lastToRemoveTag];
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
- (BOOL)
|
|
108
|
+
- (BOOL)dfs:(UIView *)root view:(UIView *)view cands:(NSMutableSet<NSNumber *> *)cands
|
|
108
109
|
{
|
|
109
|
-
NSNumber*
|
|
110
|
+
NSNumber *tag = view.reactTag;
|
|
110
111
|
if (tag == nil) {
|
|
111
112
|
return true;
|
|
112
113
|
}
|
|
113
|
-
if(![cands containsObject:tag] && _states[tag] != nil) {
|
|
114
|
+
if (![cands containsObject:tag] && _states[tag] != nil) {
|
|
114
115
|
return true;
|
|
115
116
|
}
|
|
116
117
|
BOOL cannotStripe = false;
|
|
117
|
-
NSArray<UIView
|
|
118
|
-
for (UIView*
|
|
118
|
+
NSArray<UIView *> *toRemoveCopy = [view.reactSubviews copy];
|
|
119
|
+
for (UIView *child in toRemoveCopy) {
|
|
119
120
|
if (![view isKindOfClass:[RCTTextView class]]) {
|
|
120
121
|
cannotStripe |= [self dfs:root view:child cands:cands];
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
if(!cannotStripe) {
|
|
124
|
-
if(view.reactSuperview != nil) {
|
|
125
|
-
[_reaUiManager unregisterView:
|
|
124
|
+
if (!cannotStripe) {
|
|
125
|
+
if (view.reactSuperview != nil) {
|
|
126
|
+
[_reaUiManager unregisterView:view];
|
|
126
127
|
}
|
|
127
128
|
[_states removeObjectForKey:tag];
|
|
128
129
|
[_viewForTag removeObjectForKey:tag];
|
|
@@ -133,18 +134,18 @@
|
|
|
133
134
|
|
|
134
135
|
- (void)removeLeftovers
|
|
135
136
|
{
|
|
136
|
-
NSMutableSet<NSNumber
|
|
137
|
-
for(NSNumber*
|
|
138
|
-
UIView*
|
|
137
|
+
NSMutableSet<NSNumber *> *roots = [NSMutableSet new];
|
|
138
|
+
for (NSNumber *viewTag in _toRemove) {
|
|
139
|
+
UIView *view = _viewForTag[viewTag];
|
|
139
140
|
[self findRoot:view roots:roots];
|
|
140
141
|
}
|
|
141
|
-
for(NSNumber*
|
|
142
|
-
UIView*
|
|
142
|
+
for (NSNumber *viewTag in roots) {
|
|
143
|
+
UIView *view = _viewForTag[viewTag];
|
|
143
144
|
[self dfs:view view:view cands:_toRemove];
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
- (void)notifyAboutEnd:(NSNumber*)tag cancelled:(BOOL)cancelled
|
|
148
|
+
- (void)notifyAboutEnd:(NSNumber *)tag cancelled:(BOOL)cancelled
|
|
148
149
|
{
|
|
149
150
|
if (!cancelled) {
|
|
150
151
|
ViewState state = [_states[tag] intValue];
|
|
@@ -153,7 +154,7 @@
|
|
|
153
154
|
}
|
|
154
155
|
if (state == Disappearing) {
|
|
155
156
|
_states[tag] = [NSNumber numberWithInt:ToRemove];
|
|
156
|
-
if(tag != nil) {
|
|
157
|
+
if (tag != nil) {
|
|
157
158
|
[_toRemove addObject:tag];
|
|
158
159
|
}
|
|
159
160
|
[self scheduleCleaning];
|
|
@@ -161,7 +162,7 @@
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
- (void)notifyAboutProgress:(NSDictionary *)newStyle tag:(NSNumber*)tag
|
|
165
|
+
- (void)notifyAboutProgress:(NSDictionary *)newStyle tag:(NSNumber *)tag
|
|
165
166
|
{
|
|
166
167
|
if (_states[tag] == nil) {
|
|
167
168
|
return;
|
|
@@ -170,67 +171,69 @@
|
|
|
170
171
|
if (state == Inactive) {
|
|
171
172
|
_states[tag] = [NSNumber numberWithInt:Appearing];
|
|
172
173
|
}
|
|
173
|
-
|
|
174
|
-
NSMutableDictionary*
|
|
174
|
+
|
|
175
|
+
NSMutableDictionary *dataComponenetsByName = [_uiManager valueForKey:@"_componentDataByName"];
|
|
175
176
|
RCTComponentData *componentData = dataComponenetsByName[@"RCTView"];
|
|
176
177
|
[self setNewProps:[newStyle mutableCopy] forView:_viewForTag[tag] withComponentData:componentData];
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
- (void)setNewProps:(NSMutableDictionary *)newProps
|
|
180
|
+
- (void)setNewProps:(NSMutableDictionary *)newProps
|
|
181
|
+
forView:(UIView *)view
|
|
182
|
+
withComponentData:(RCTComponentData *)componentData
|
|
180
183
|
{
|
|
181
184
|
if (newProps[@"height"]) {
|
|
182
185
|
double height = [newProps[@"height"] doubleValue];
|
|
183
186
|
double oldHeight = view.bounds.size.height;
|
|
184
187
|
view.bounds = CGRectMake(0, 0, view.bounds.size.width, height);
|
|
185
|
-
view.center = CGPointMake(view.center.x, view.center.y - oldHeight/2.0 + view.bounds.size.height/2.0);
|
|
188
|
+
view.center = CGPointMake(view.center.x, view.center.y - oldHeight / 2.0 + view.bounds.size.height / 2.0);
|
|
186
189
|
[newProps removeObjectForKey:@"height"];
|
|
187
190
|
}
|
|
188
191
|
if (newProps[@"width"]) {
|
|
189
192
|
double width = [newProps[@"width"] doubleValue];
|
|
190
193
|
double oldWidth = view.bounds.size.width;
|
|
191
194
|
view.bounds = CGRectMake(0, 0, width, view.bounds.size.height);
|
|
192
|
-
view.center = CGPointMake(view.center.x + view.bounds.size.width/2.0 - oldWidth/2.0, view.center.y);
|
|
195
|
+
view.center = CGPointMake(view.center.x + view.bounds.size.width / 2.0 - oldWidth / 2.0, view.center.y);
|
|
193
196
|
[newProps removeObjectForKey:@"width"];
|
|
194
197
|
}
|
|
195
198
|
if (newProps[@"originX"]) {
|
|
196
199
|
double originX = [newProps[@"originX"] doubleValue];
|
|
197
|
-
view.center = CGPointMake(originX + view.bounds.size.width/2.0, view.center.y);
|
|
200
|
+
view.center = CGPointMake(originX + view.bounds.size.width / 2.0, view.center.y);
|
|
198
201
|
[newProps removeObjectForKey:@"originX"];
|
|
199
202
|
}
|
|
200
203
|
if (newProps[@"originY"]) {
|
|
201
204
|
double originY = [newProps[@"originY"] doubleValue];
|
|
202
|
-
view.center = CGPointMake(view.center.x, originY + view.bounds.size.height/2.0);
|
|
205
|
+
view.center = CGPointMake(view.center.x, originY + view.bounds.size.height / 2.0);
|
|
203
206
|
[newProps removeObjectForKey:@"originY"];
|
|
204
207
|
}
|
|
205
208
|
[componentData setProps:newProps forView:view];
|
|
206
209
|
}
|
|
207
210
|
|
|
208
|
-
- (NSDictionary*)
|
|
211
|
+
- (NSDictionary *)prepareDataForAnimatingWorklet:(NSMutableDictionary *)values
|
|
209
212
|
{
|
|
210
213
|
UIView *windowView = UIApplication.sharedApplication.keyWindow;
|
|
211
|
-
NSDictionary*
|
|
212
|
-
@"width": values[@"width"],
|
|
213
|
-
@"height": values[@"height"],
|
|
214
|
-
@"originX": values[@"originX"],
|
|
215
|
-
@"originY": values[@"originY"],
|
|
216
|
-
@"globalOriginX": values[@"globalOriginX"],
|
|
217
|
-
@"globalOriginY": values[@"globalOriginY"],
|
|
218
|
-
@"windowWidth": [NSNumber numberWithDouble:windowView.bounds.size.width],
|
|
219
|
-
@"windowHeight": [NSNumber numberWithDouble:windowView.bounds.size.height]
|
|
214
|
+
NSDictionary *preparedData = @{
|
|
215
|
+
@"width" : values[@"width"],
|
|
216
|
+
@"height" : values[@"height"],
|
|
217
|
+
@"originX" : values[@"originX"],
|
|
218
|
+
@"originY" : values[@"originY"],
|
|
219
|
+
@"globalOriginX" : values[@"globalOriginX"],
|
|
220
|
+
@"globalOriginY" : values[@"globalOriginY"],
|
|
221
|
+
@"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width],
|
|
222
|
+
@"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height]
|
|
220
223
|
};
|
|
221
224
|
return preparedData;
|
|
222
225
|
}
|
|
223
226
|
|
|
224
|
-
- (void)
|
|
227
|
+
- (void)onViewRemoval:(UIView *)view before:(REASnapshot *)before
|
|
225
228
|
{
|
|
226
|
-
NSNumber*
|
|
229
|
+
NSNumber *tag = view.reactTag;
|
|
227
230
|
ViewState state = [_states[tag] intValue];
|
|
228
|
-
if(state == Disappearing || state == ToRemove || tag == nil) {
|
|
231
|
+
if (state == Disappearing || state == ToRemove || tag == nil) {
|
|
229
232
|
return;
|
|
230
233
|
}
|
|
231
|
-
NSMutableDictionary<NSString*, NSObject
|
|
232
|
-
if(state == Inactive) {
|
|
233
|
-
if(startValues != nil) {
|
|
234
|
+
NSMutableDictionary<NSString *, NSObject *> *startValues = before.values;
|
|
235
|
+
if (state == Inactive) {
|
|
236
|
+
if (startValues != nil) {
|
|
234
237
|
_states[tag] = [NSNumber numberWithInt:ToRemove];
|
|
235
238
|
[_toRemove addObject:tag];
|
|
236
239
|
[self scheduleCleaning];
|
|
@@ -238,57 +241,58 @@
|
|
|
238
241
|
return;
|
|
239
242
|
}
|
|
240
243
|
_states[tag] = [NSNumber numberWithInt:Disappearing];
|
|
241
|
-
NSDictionary*
|
|
244
|
+
NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:startValues];
|
|
242
245
|
_startAnimationForTag(tag, @"exiting", preparedValues, @(0));
|
|
243
246
|
}
|
|
244
247
|
|
|
245
|
-
- (void)
|
|
248
|
+
- (void)onViewCreate:(UIView *)view after:(REASnapshot *)after
|
|
246
249
|
{
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
_reaUiManager.flushUiOperations();
|
|
251
|
+
NSNumber *tag = view.reactTag;
|
|
252
|
+
if (_states[tag] == nil) {
|
|
249
253
|
_states[tag] = [NSNumber numberWithInt:Inactive];
|
|
250
254
|
_viewForTag[tag] = view;
|
|
251
255
|
}
|
|
252
|
-
NSMutableDictionary*
|
|
256
|
+
NSMutableDictionary *targetValues = after.values;
|
|
253
257
|
ViewState state = [_states[tag] intValue];
|
|
254
|
-
if(state == Inactive) {
|
|
255
|
-
if(targetValues != nil) {
|
|
256
|
-
NSDictionary*
|
|
258
|
+
if (state == Inactive) {
|
|
259
|
+
if (targetValues != nil) {
|
|
260
|
+
NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:targetValues];
|
|
257
261
|
_startAnimationForTag(tag, @"entering", preparedValues, @(0));
|
|
258
262
|
}
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
265
|
}
|
|
262
266
|
|
|
263
|
-
- (void)
|
|
267
|
+
- (void)onViewUpdate:(UIView *)view before:(REASnapshot *)before after:(REASnapshot *)after
|
|
264
268
|
{
|
|
265
|
-
NSNumber*
|
|
266
|
-
NSMutableDictionary*
|
|
267
|
-
NSMutableDictionary*
|
|
269
|
+
NSNumber *tag = view.reactTag;
|
|
270
|
+
NSMutableDictionary *targetValues = after.values;
|
|
271
|
+
NSMutableDictionary *startValues = before.values;
|
|
268
272
|
if (_states[tag] == nil) {
|
|
269
273
|
return;
|
|
270
274
|
}
|
|
271
275
|
ViewState state = [_states[tag] intValue];
|
|
272
|
-
if(state == Disappearing || state == ToRemove || state == Inactive) {
|
|
276
|
+
if (state == Disappearing || state == ToRemove || state == Inactive) {
|
|
273
277
|
return;
|
|
274
278
|
}
|
|
275
|
-
if(state == Appearing) {
|
|
279
|
+
if (state == Appearing) {
|
|
276
280
|
BOOL doNotStartLayout = true;
|
|
277
|
-
for (NSString *
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
for (NSString *key in [[self class] layoutKeys]) {
|
|
282
|
+
if ([((NSNumber *)startValues[key]) doubleValue] != [((NSNumber *)targetValues[key]) doubleValue]) {
|
|
283
|
+
doNotStartLayout = false;
|
|
284
|
+
}
|
|
281
285
|
}
|
|
282
286
|
if (doNotStartLayout) {
|
|
283
287
|
return;
|
|
284
288
|
}
|
|
285
289
|
}
|
|
286
|
-
_states[view.reactTag] = [NSNumber numberWithInt:
|
|
287
|
-
NSDictionary*
|
|
288
|
-
NSDictionary*
|
|
289
|
-
NSMutableDictionary *
|
|
290
|
+
_states[view.reactTag] = [NSNumber numberWithInt:Layout];
|
|
291
|
+
NSDictionary *preparedStartValues = [self prepareDataForAnimatingWorklet:startValues];
|
|
292
|
+
NSDictionary *preparedTargetValues = [self prepareDataForAnimatingWorklet:targetValues];
|
|
293
|
+
NSMutableDictionary *preparedValues = [NSMutableDictionary new];
|
|
290
294
|
[preparedValues addEntriesFromDictionary:preparedTargetValues];
|
|
291
|
-
for (NSString*
|
|
295
|
+
for (NSString *key in preparedStartValues.allKeys) {
|
|
292
296
|
preparedValues[[NSString stringWithFormat:@"%@%@", @"b", key]] = preparedStartValues[key];
|
|
293
297
|
}
|
|
294
298
|
_startAnimationForTag(view.reactTag, @"layout", preparedValues, @(0));
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
5
5
|
|
|
6
6
|
@implementation REASnapshot {
|
|
7
|
-
UIView*
|
|
7
|
+
UIView *_view;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
- (instancetype)
|
|
10
|
+
- (instancetype)init:(UIView *)view
|
|
11
|
+
{
|
|
11
12
|
self = [super init];
|
|
12
13
|
_view = view;
|
|
13
14
|
UIView *windowView = UIApplication.sharedApplication.keyWindow;
|
|
@@ -15,11 +16,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
15
16
|
_values = [NSMutableDictionary new];
|
|
16
17
|
_values[@"width"] = [NSNumber numberWithDouble:(double)(view.bounds.size.width)];
|
|
17
18
|
_values[@"height"] = [NSNumber numberWithDouble:(double)(view.bounds.size.height)];
|
|
18
|
-
_values[@"originX"] = [NSNumber numberWithDouble:view.center.x - view.bounds.size.width/2.0];
|
|
19
|
-
_values[@"originY"] = [NSNumber numberWithDouble:view.center.y - view.bounds.size.height/2.0];
|
|
20
|
-
_values[@"globalOriginX"] = [NSNumber numberWithDouble:originFromRootPerspective.x - view.bounds.size.width/2.0];
|
|
21
|
-
_values[@"globalOriginY"] = [NSNumber numberWithDouble:originFromRootPerspective.y - view.bounds.size.height/2.0];
|
|
22
|
-
|
|
19
|
+
_values[@"originX"] = [NSNumber numberWithDouble:view.center.x - view.bounds.size.width / 2.0];
|
|
20
|
+
_values[@"originY"] = [NSNumber numberWithDouble:view.center.y - view.bounds.size.height / 2.0];
|
|
21
|
+
_values[@"globalOriginX"] = [NSNumber numberWithDouble:originFromRootPerspective.x - view.bounds.size.width / 2.0];
|
|
22
|
+
_values[@"globalOriginY"] = [NSNumber numberWithDouble:originFromRootPerspective.y - view.bounds.size.height / 2.0];
|
|
23
|
+
|
|
23
24
|
return self;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#import <React/RCTUIManager.h>
|
|
2
|
-
#import <React/RCTDefines.h>
|
|
3
1
|
#import <React/RCTBridge+Private.h>
|
|
2
|
+
#import <React/RCTDefines.h>
|
|
3
|
+
#import <React/RCTUIManager.h>
|
|
4
4
|
#import "REAAnimationsManager.h"
|
|
5
5
|
|
|
6
6
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -8,8 +8,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
8
8
|
@interface REAUIManager : RCTUIManager
|
|
9
9
|
@property BOOL blockSetter;
|
|
10
10
|
- (void)setBridge:(RCTBridge *)bridge;
|
|
11
|
-
- (void)setUp:(REAAnimationsManager*)
|
|
12
|
-
- (void)unregisterView:(id<RCTComponent>)
|
|
11
|
+
- (void)setUp:(REAAnimationsManager *)animationsManager;
|
|
12
|
+
- (void)unregisterView:(id<RCTComponent>)view;
|
|
13
13
|
@property (nonatomic, copy) void (^flushUiOperations)();
|
|
14
14
|
@end
|
|
15
15
|
|