react-native-reanimated 2.3.0-alpha.1 → 2.3.0-beta.2
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 +170 -166
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +36 -34
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +13 -6
- package/Common/cpp/Registries/MapperRegistry.cpp +19 -15
- package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
- package/Common/cpp/SharedItems/FrozenObject.cpp +19 -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 +216 -143
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +36 -24
- package/Common/cpp/Tools/Mapper.cpp +41 -29
- package/Common/cpp/Tools/RuntimeDecorator.cpp +103 -84
- package/Common/cpp/Tools/Scheduler.cpp +14 -6
- package/Common/cpp/Tools/WorkletEventHandler.cpp +1 -1
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +45 -34
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +28 -16
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +14 -8
- package/Common/cpp/headers/Registries/MapperRegistry.h +4 -4
- package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
- package/Common/cpp/headers/SharedItems/FrozenObject.h +15 -11
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +6 -4
- package/Common/cpp/headers/SharedItems/MutableValue.h +21 -12
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +10 -7
- package/Common/cpp/headers/SharedItems/RemoteObject.h +16 -8
- package/Common/cpp/headers/SharedItems/RuntimeManager.h +39 -21
- package/Common/cpp/headers/SharedItems/ShareableValue.h +31 -27
- package/Common/cpp/headers/SharedItems/SharedParent.h +7 -4
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +80 -61
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +17 -19
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +18 -13
- package/Common/cpp/headers/Tools/Mapper.h +24 -18
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +12 -7
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -7
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +29 -23
- package/Common/cpp/headers/Tools/Scheduler.h +28 -33
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +9 -7
- 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 +4 -4
- package/android/build.gradle +80 -3
- 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/ios/LayoutReanimation/REAAnimationsManager.h +19 -10
- package/ios/LayoutReanimation/REAAnimationsManager.m +195 -200
- package/ios/LayoutReanimation/REASnapshot.h +13 -0
- package/ios/LayoutReanimation/REASnapshot.m +29 -0
- package/ios/LayoutReanimation/REAUIManager.h +16 -0
- package/ios/LayoutReanimation/REAUIManager.mm +348 -0
- 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 +3 -3
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +29 -40
- package/ios/REANodesManager.h +11 -19
- package/ios/REANodesManager.m +105 -130
- package/ios/REAUtils.h +5 -3
- 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 +15 -5
- package/ios/native/NativeProxy.h +4 -3
- package/ios/native/NativeProxy.mm +19 -5
- package/ios/native/REAIOSErrorHandler.h +13 -10
- package/ios/native/REAIOSLogger.h +8 -8
- package/ios/native/REAIOSScheduler.h +5 -5
- package/ios/native/REAIOSScheduler.mm +7 -5
- package/ios/native/REAInitializer.h +37 -0
- package/ios/native/REAInitializer.mm +63 -0
- package/ios/native/UIResponder+Reanimated.mm +9 -48
- package/lib/ConfigHelper.js +1 -0
- package/lib/ReanimatedModule.native.js +10 -2
- package/lib/createAnimatedComponent.js +64 -30
- package/lib/reanimated1/core/AnimatedAlways.js +1 -1
- package/lib/reanimated1/core/AnimatedBezier.js +1 -1
- package/lib/reanimated1/core/AnimatedBlock.js +1 -1
- package/lib/reanimated1/core/AnimatedCall.js +1 -1
- package/lib/reanimated1/core/AnimatedCallFunc.js +1 -1
- package/lib/reanimated1/core/AnimatedConcat.js +1 -1
- package/lib/reanimated1/core/AnimatedCond.js +1 -1
- package/lib/reanimated1/core/AnimatedDebug.js +1 -1
- package/lib/reanimated1/core/AnimatedEvent.js +1 -1
- package/lib/reanimated1/core/AnimatedFunction.js +1 -1
- package/lib/reanimated1/core/AnimatedOperator.js +1 -1
- package/lib/reanimated1/core/AnimatedParam.js +1 -1
- package/lib/reanimated1/core/AnimatedProps.js +2 -2
- package/lib/reanimated1/core/AnimatedSet.js +1 -1
- package/lib/reanimated1/core/AnimatedStartClock.js +1 -1
- package/lib/reanimated1/core/AnimatedStopClock.js +1 -1
- package/lib/reanimated1/core/AnimatedStyle.js +1 -1
- package/lib/reanimated1/core/AnimatedTransform.js +1 -1
- package/lib/reanimated1/core/Core.test.js +30 -0
- package/lib/reanimated1/core/InternalAnimatedValue.js +1 -1
- package/lib/reanimated1/core/__mocks__/AnimatedProps.js +1 -1
- package/lib/reanimated1/derived/interpolate.js +1 -1
- package/lib/reanimated2/Colors.js +16 -12
- package/lib/reanimated2/NativeMethods.js +3 -14
- package/lib/reanimated2/{NativeReanimated.native.js → NativeReanimated/NativeReanimated.js} +19 -24
- package/lib/reanimated2/NativeReanimated/index.js +15 -0
- package/lib/reanimated2/PlatformChecker.js +16 -0
- package/lib/reanimated2/PropAdapters.js +14 -4
- package/lib/reanimated2/UpdateProps.js +14 -11
- package/lib/reanimated2/ViewDescriptorsSet.js +73 -0
- package/lib/reanimated2/WorkletEventHandler.js +15 -13
- package/lib/reanimated2/animation/commonTypes.js +1 -0
- package/lib/reanimated2/animation/decay.js +71 -0
- package/lib/reanimated2/animation/delay.js +64 -0
- package/lib/reanimated2/animation/index.js +8 -0
- package/lib/reanimated2/animation/repeat.js +69 -0
- package/lib/reanimated2/animation/sequence.js +72 -0
- package/lib/reanimated2/animation/spring.js +101 -0
- package/lib/reanimated2/animation/styleAnimation.js +166 -0
- package/lib/reanimated2/animation/timing.js +64 -0
- package/lib/reanimated2/animation/util.js +157 -0
- package/lib/reanimated2/commonTypes.js +1 -0
- package/lib/reanimated2/core.js +35 -39
- package/lib/reanimated2/globals.d.ts +47 -1
- package/lib/reanimated2/hook/Hooks.js +9 -0
- package/lib/reanimated2/hook/commonTypes.js +1 -0
- package/lib/reanimated2/hook/index.js +8 -0
- package/lib/reanimated2/hook/useAnimatedGestureHandler.js +50 -0
- package/lib/reanimated2/hook/useAnimatedReaction.js +37 -0
- package/lib/reanimated2/hook/useAnimatedRef.js +25 -0
- package/lib/reanimated2/hook/useAnimatedScrollHandler.js +41 -0
- package/lib/reanimated2/hook/useAnimatedStyle.js +376 -0
- package/lib/reanimated2/hook/useDerivedValue.js +36 -0
- package/lib/reanimated2/hook/useSharedValue.js +17 -0
- package/lib/reanimated2/hook/utils.js +175 -0
- package/lib/reanimated2/index.js +3 -2
- package/lib/reanimated2/interpolation.js +95 -86
- package/lib/reanimated2/jestUtils.js +0 -12
- package/lib/reanimated2/js-reanimated/JSReanimated.js +9 -10
- package/lib/reanimated2/js-reanimated/index.js +57 -1
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +58 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +69 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +193 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +1 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +3 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +325 -207
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +36 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +235 -187
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +327 -269
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +146 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +85 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +119 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +289 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +159 -121
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +83 -65
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +371 -277
- package/lib/reanimated2/layoutReanimation/defaultAnimations/index.js +4 -0
- 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 +3 -2
- package/lib/reanimated2/platform-specific/RNRenderer.web.js +2 -0
- package/lib/reanimated2/utils.js +9 -0
- 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/package.json +21 -10
- package/plugin.js +244 -85
- package/react-native-reanimated.d.ts +531 -453
- package/src/ConfigHelper.js +1 -0
- package/src/ReanimatedModule.native.js +10 -2
- package/src/createAnimatedComponent.js +64 -30
- package/src/reanimated1/core/AnimatedAlways.js +1 -1
- package/src/reanimated1/core/AnimatedBezier.js +1 -1
- package/src/reanimated1/core/AnimatedBlock.js +1 -1
- package/src/reanimated1/core/AnimatedCall.js +1 -1
- package/src/reanimated1/core/AnimatedCallFunc.js +1 -1
- package/src/reanimated1/core/AnimatedConcat.js +1 -1
- package/src/reanimated1/core/AnimatedCond.js +1 -1
- package/src/reanimated1/core/AnimatedDebug.js +1 -1
- package/src/reanimated1/core/AnimatedEvent.js +1 -1
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/core/AnimatedOperator.js +1 -1
- package/src/reanimated1/core/AnimatedParam.js +1 -1
- package/src/reanimated1/core/AnimatedProps.js +2 -2
- package/src/reanimated1/core/AnimatedSet.js +1 -1
- package/src/reanimated1/core/AnimatedStartClock.js +1 -1
- package/src/reanimated1/core/AnimatedStopClock.js +1 -1
- package/src/reanimated1/core/AnimatedStyle.js +1 -1
- package/src/reanimated1/core/AnimatedTransform.js +1 -1
- package/src/reanimated1/core/Core.test.js +30 -0
- package/src/reanimated1/core/InternalAnimatedValue.js +1 -1
- package/src/reanimated1/core/__mocks__/AnimatedProps.js +1 -1
- package/src/reanimated1/derived/interpolate.js +1 -1
- package/src/reanimated2/Colors.ts +30 -27
- package/src/reanimated2/Easing.ts +3 -1
- package/src/reanimated2/NativeMethods.ts +26 -16
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +78 -0
- package/src/reanimated2/NativeReanimated/index.ts +18 -0
- package/src/reanimated2/PlatformChecker.ts +21 -0
- package/src/reanimated2/PropAdapters.ts +52 -34
- package/src/reanimated2/UpdateProps.ts +40 -20
- package/src/reanimated2/ViewDescriptorsSet.ts +108 -0
- package/src/reanimated2/WorkletEventHandler.ts +41 -23
- package/src/reanimated2/animation/commonTypes.ts +48 -0
- package/src/reanimated2/animation/decay.ts +141 -0
- package/src/reanimated2/animation/delay.ts +103 -0
- package/src/reanimated2/animation/index.ts +16 -0
- package/src/reanimated2/animation/repeat.ts +128 -0
- package/src/reanimated2/animation/sequence.ts +110 -0
- package/src/reanimated2/animation/spring.ts +165 -0
- package/src/reanimated2/animation/styleAnimation.ts +253 -0
- package/src/reanimated2/animation/timing.ts +109 -0
- package/src/reanimated2/animation/util.ts +242 -0
- package/src/reanimated2/commonTypes.ts +81 -0
- package/src/reanimated2/core.ts +128 -82
- package/src/reanimated2/globals.d.ts +47 -1
- package/src/reanimated2/hook/Hooks.ts +16 -0
- package/src/reanimated2/hook/commonTypes.ts +12 -0
- package/src/reanimated2/hook/index.ts +25 -0
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +110 -0
- package/src/reanimated2/hook/useAnimatedReaction.ts +49 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +34 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +83 -0
- package/src/reanimated2/hook/useAnimatedStyle.ts +538 -0
- package/src/reanimated2/hook/useDerivedValue.ts +48 -0
- package/src/reanimated2/hook/useSharedValue.ts +22 -0
- package/src/reanimated2/hook/utils.ts +259 -0
- package/src/reanimated2/index.ts +3 -2
- package/src/reanimated2/interpolation.ts +170 -101
- package/src/reanimated2/jestUtils.ts +0 -12
- package/src/reanimated2/js-reanimated/JSReanimated.ts +47 -22
- package/src/reanimated2/js-reanimated/Mapper.ts +1 -1
- package/src/reanimated2/js-reanimated/index.ts +71 -0
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +62 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +91 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +263 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +78 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +16 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +243 -121
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +43 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +95 -53
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +114 -64
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +179 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +93 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +132 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +333 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +84 -50
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +41 -23
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +234 -154
- package/src/reanimated2/layoutReanimation/defaultAnimations/index.ts +4 -0
- 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 +3 -2
- package/src/reanimated2/platform-specific/RNRenderer.web.ts +2 -0
- package/src/reanimated2/utils.ts +21 -0
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAAnimationRootView.h +0 -12
- package/ios/LayoutReanimation/REAAnimationRootView.m +0 -16
- package/ios/LayoutReanimation/REAAnimationRootViewManager.h +0 -9
- package/ios/LayoutReanimation/REAAnimationRootViewManager.m +0 -49
- package/ios/LayoutReanimation/REAReactBatchObserver.h +0 -20
- package/ios/LayoutReanimation/REAReactBatchObserver.m +0 -125
- package/ios/LayoutReanimation/REASnapshooter.h +0 -19
- package/ios/LayoutReanimation/REASnapshooter.m +0 -64
- package/ios/LayoutReanimation/REAViewTraverser.h +0 -13
- package/ios/LayoutReanimation/REAViewTraverser.m +0 -40
- package/lib/reanimated2/Hooks.js +0 -732
- package/lib/reanimated2/NativeReanimated.js +0 -4
- package/lib/reanimated2/animations.js +0 -713
- package/lib/reanimated2/js-reanimated/index.web.js +0 -20
- package/lib/reanimated2/layoutReanimation/AnimatedRoot.js +0 -55
- package/lib/reanimated2/layoutReanimation/defaultAnimationsBuilder.js +0 -374
- package/src/reanimated2/Hooks.ts +0 -918
- package/src/reanimated2/NativeReanimated.native.ts +0 -61
- package/src/reanimated2/NativeReanimated.ts +0 -5
- package/src/reanimated2/animations.ts +0 -868
- package/src/reanimated2/js-reanimated/index.js +0 -0
- package/src/reanimated2/js-reanimated/index.web.ts +0 -29
- package/src/reanimated2/layoutReanimation/AnimatedRoot.tsx +0 -68
- package/src/reanimated2/layoutReanimation/defaultAnimationsBuilder.ts +0 -440
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,7 +114,7 @@
|
|
|
119
114
|
_onAnimationCallbacks = [NSMutableArray new];
|
|
120
115
|
_operationsInBatch = [NSMutableArray new];
|
|
121
116
|
}
|
|
122
|
-
|
|
117
|
+
|
|
123
118
|
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
|
|
124
119
|
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
|
125
120
|
[_displayLink setPaused:true];
|
|
@@ -172,14 +167,14 @@
|
|
|
172
167
|
|
|
173
168
|
- (void)startUpdatingOnAnimationFrame
|
|
174
169
|
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
170
|
+
// Setting _currentAnimationTimestamp here is connected with manual triggering of performOperations
|
|
171
|
+
// in operationsBatchDidComplete. If new node has been created and clock has not been started,
|
|
172
|
+
// _displayLink won't be initialized soon enough and _displayLink.timestamp will be 0.
|
|
173
|
+
// However, CADisplayLink is using CACurrentMediaTime so if there's need to perform one more
|
|
174
|
+
// evaluation, it could be used it here. In usual case, CACurrentMediaTime is not being used in
|
|
175
|
+
// favor of setting it with _displayLink.timestamp in onAnimationFrame method.
|
|
176
|
+
_currentAnimationTimestamp = CACurrentMediaTime();
|
|
177
|
+
[_displayLink setPaused:false];
|
|
183
178
|
}
|
|
184
179
|
|
|
185
180
|
- (void)stopUpdatingOnAnimationFrame
|
|
@@ -217,7 +212,8 @@
|
|
|
217
212
|
}
|
|
218
213
|
}
|
|
219
214
|
|
|
220
|
-
- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
|
|
215
|
+
- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
|
|
216
|
+
{
|
|
221
217
|
RCTAssert(_mounting == nil, @"Mouting block is expected to not be set");
|
|
222
218
|
_mounting = block;
|
|
223
219
|
return YES;
|
|
@@ -234,7 +230,7 @@
|
|
|
234
230
|
|
|
235
231
|
BOOL trySynchronously = _tryRunBatchUpdatesSynchronously;
|
|
236
232
|
_tryRunBatchUpdatesSynchronously = NO;
|
|
237
|
-
|
|
233
|
+
|
|
238
234
|
__weak typeof(self) weakSelf = self;
|
|
239
235
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
240
236
|
RCTExecuteOnUIManagerQueue(^{
|
|
@@ -243,27 +239,27 @@
|
|
|
243
239
|
return;
|
|
244
240
|
}
|
|
245
241
|
BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands];
|
|
246
|
-
|
|
242
|
+
|
|
247
243
|
if (!canUpdateSynchronously) {
|
|
248
244
|
dispatch_semaphore_signal(semaphore);
|
|
249
245
|
}
|
|
250
|
-
|
|
246
|
+
|
|
251
247
|
for (int i = 0; i < copiedOperationsQueue.count; i++) {
|
|
252
248
|
copiedOperationsQueue[i](strongSelf.uiManager);
|
|
253
249
|
}
|
|
254
|
-
|
|
250
|
+
|
|
255
251
|
if (canUpdateSynchronously) {
|
|
256
252
|
[strongSelf.uiManager runSyncUIUpdatesWithObserver:self];
|
|
257
253
|
dispatch_semaphore_signal(semaphore);
|
|
258
254
|
}
|
|
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.
|
|
255
|
+
// In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
|
|
256
|
+
// to observers because some components (e.g. TextInput) update their UIViews only on that event.
|
|
261
257
|
[strongSelf.uiManager setNeedsLayout];
|
|
262
258
|
});
|
|
263
259
|
if (trySynchronously) {
|
|
264
260
|
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
|
265
261
|
}
|
|
266
|
-
|
|
262
|
+
|
|
267
263
|
if (_mounting) {
|
|
268
264
|
_mounting();
|
|
269
265
|
_mounting = nil;
|
|
@@ -273,9 +269,10 @@
|
|
|
273
269
|
}
|
|
274
270
|
|
|
275
271
|
- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)reactTag
|
|
276
|
-
viewName:(NSString *)
|
|
272
|
+
viewName:(NSString *)viewName
|
|
277
273
|
nativeProps:(NSMutableDictionary *)nativeProps
|
|
278
|
-
trySynchronously:(BOOL)trySync
|
|
274
|
+
trySynchronously:(BOOL)trySync
|
|
275
|
+
{
|
|
279
276
|
if (trySync) {
|
|
280
277
|
_tryRunBatchUpdatesSynchronously = YES;
|
|
281
278
|
}
|
|
@@ -284,49 +281,48 @@
|
|
|
284
281
|
}];
|
|
285
282
|
}
|
|
286
283
|
|
|
287
|
-
- (void)getValue:(REANodeID)nodeID
|
|
288
|
-
callback:(RCTResponseSenderBlock)callback
|
|
284
|
+
- (void)getValue:(REANodeID)nodeID callback:(RCTResponseSenderBlock)callback
|
|
289
285
|
{
|
|
290
286
|
id val = _nodes[nodeID].value;
|
|
291
287
|
if (val) {
|
|
292
|
-
callback(@[val]);
|
|
288
|
+
callback(@[ val ]);
|
|
293
289
|
} else {
|
|
294
290
|
// NULL is not an object and it's not possible to pass it as callback's argument
|
|
295
|
-
callback(@[[NSNull null]]);
|
|
291
|
+
callback(@[ [NSNull null] ]);
|
|
296
292
|
}
|
|
297
293
|
}
|
|
298
294
|
|
|
299
|
-
#pragma mark
|
|
295
|
+
#pragma mark-- Graph
|
|
300
296
|
|
|
301
|
-
- (void)createNode:(REANodeID)nodeID
|
|
302
|
-
config:(NSDictionary<NSString *, id> *)config
|
|
297
|
+
- (void)createNode:(REANodeID)nodeID config:(NSDictionary<NSString *, id> *)config
|
|
303
298
|
{
|
|
304
299
|
static NSDictionary *map;
|
|
305
300
|
static dispatch_once_t mapToken;
|
|
306
301
|
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
|
-
|
|
302
|
+
map = @{
|
|
303
|
+
@"props" : [REAPropsNode class],
|
|
304
|
+
@"style" : [REAStyleNode class],
|
|
305
|
+
@"transform" : [REATransformNode class],
|
|
306
|
+
@"value" : [REAValueNode class],
|
|
307
|
+
@"block" : [REABlockNode class],
|
|
308
|
+
@"cond" : [REACondNode class],
|
|
309
|
+
@"op" : [REAOperatorNode class],
|
|
310
|
+
@"set" : [REASetNode class],
|
|
311
|
+
@"debug" : [READebugNode class],
|
|
312
|
+
@"clock" : [REAClockNode class],
|
|
313
|
+
@"clockStart" : [REAClockStartNode class],
|
|
314
|
+
@"clockStop" : [REAClockStopNode class],
|
|
315
|
+
@"clockTest" : [REAClockTestNode class],
|
|
316
|
+
@"call" : [REAJSCallNode class],
|
|
317
|
+
@"bezier" : [REABezierNode class],
|
|
318
|
+
@"event" : [REAEventNode class],
|
|
319
|
+
@"always" : [REAAlwaysNode class],
|
|
320
|
+
@"concat" : [REAConcatNode class],
|
|
321
|
+
@"param" : [REAParamNode class],
|
|
322
|
+
@"func" : [REAFunctionNode class],
|
|
323
|
+
@"callfunc" : [REACallFuncNode class]
|
|
324
|
+
// @"listener": nil,
|
|
325
|
+
};
|
|
330
326
|
});
|
|
331
327
|
|
|
332
328
|
NSString *nodeType = [RCTConvert NSString:config[@"type"]];
|
|
@@ -378,9 +374,7 @@
|
|
|
378
374
|
[parentNode removeChild:childNode];
|
|
379
375
|
}
|
|
380
376
|
|
|
381
|
-
- (void)connectNodeToView:(REANodeID)nodeID
|
|
382
|
-
viewTag:(NSNumber *)viewTag
|
|
383
|
-
viewName:(NSString *)viewName
|
|
377
|
+
- (void)connectNodeToView:(REANodeID)nodeID viewTag:(NSNumber *)viewTag viewName:(NSString *)viewName
|
|
384
378
|
{
|
|
385
379
|
RCTAssertParam(nodeID);
|
|
386
380
|
REANode *node = _nodes[nodeID];
|
|
@@ -391,8 +385,7 @@
|
|
|
391
385
|
}
|
|
392
386
|
}
|
|
393
387
|
|
|
394
|
-
- (void)disconnectNodeFromView:(REANodeID)nodeID
|
|
395
|
-
viewTag:(NSNumber *)viewTag
|
|
388
|
+
- (void)disconnectNodeFromView:(REANodeID)nodeID viewTag:(NSNumber *)viewTag
|
|
396
389
|
{
|
|
397
390
|
RCTAssertParam(nodeID);
|
|
398
391
|
REANode *node = _nodes[nodeID];
|
|
@@ -403,36 +396,26 @@
|
|
|
403
396
|
}
|
|
404
397
|
}
|
|
405
398
|
|
|
406
|
-
- (void)attachEvent:(NSNumber *)viewTag
|
|
407
|
-
eventName:(NSString *)eventName
|
|
408
|
-
eventNodeID:(REANodeID)eventNodeID
|
|
399
|
+
- (void)attachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(REANodeID)eventNodeID
|
|
409
400
|
{
|
|
410
401
|
RCTAssertParam(eventNodeID);
|
|
411
402
|
REANode *eventNode = _nodes[eventNodeID];
|
|
412
403
|
RCTAssert([eventNode isKindOfClass:[REAEventNode class]], @"Event node is of an invalid type");
|
|
413
404
|
|
|
414
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
415
|
-
viewTag,
|
|
416
|
-
RCTNormalizeInputEventName(eventName)];
|
|
405
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeInputEventName(eventName)];
|
|
417
406
|
RCTAssert([_eventMapping objectForKey:key] == nil, @"Event handler already set for the given view and event type");
|
|
418
407
|
[_eventMapping setObject:eventNode forKey:key];
|
|
419
408
|
}
|
|
420
409
|
|
|
421
|
-
- (void)detachEvent:(NSNumber *)viewTag
|
|
422
|
-
eventName:(NSString *)eventName
|
|
423
|
-
eventNodeID:(REANodeID)eventNodeID
|
|
410
|
+
- (void)detachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(REANodeID)eventNodeID
|
|
424
411
|
{
|
|
425
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
426
|
-
viewTag,
|
|
427
|
-
RCTNormalizeInputEventName(eventName)];
|
|
412
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeInputEventName(eventName)];
|
|
428
413
|
[_eventMapping removeObjectForKey:key];
|
|
429
414
|
}
|
|
430
415
|
|
|
431
416
|
- (void)processEvent:(id<RCTEvent>)event
|
|
432
417
|
{
|
|
433
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
434
|
-
event.viewTag,
|
|
435
|
-
RCTNormalizeInputEventName(event.eventName)];
|
|
418
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeInputEventName(event.eventName)];
|
|
436
419
|
REAEventNode *eventNode = [_eventMapping objectForKey:key];
|
|
437
420
|
[eventNode processEvent:event];
|
|
438
421
|
}
|
|
@@ -465,18 +448,14 @@
|
|
|
465
448
|
|
|
466
449
|
- (void)dispatchEvent:(id<RCTEvent>)event
|
|
467
450
|
{
|
|
468
|
-
NSString *key = [NSString stringWithFormat:@"%@%@",
|
|
469
|
-
event.viewTag,
|
|
470
|
-
RCTNormalizeInputEventName(event.eventName)];
|
|
451
|
+
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeInputEventName(event.eventName)];
|
|
471
452
|
|
|
472
|
-
NSString *eventHash = [NSString stringWithFormat:@"%@%@",
|
|
473
|
-
event.viewTag,
|
|
474
|
-
event.eventName];
|
|
453
|
+
NSString *eventHash = [NSString stringWithFormat:@"%@%@", event.viewTag, event.eventName];
|
|
475
454
|
|
|
476
455
|
if (_eventHandler != nil) {
|
|
477
456
|
__weak REAEventHandler eventHandler = _eventHandler;
|
|
478
457
|
__weak typeof(self) weakSelf = self;
|
|
479
|
-
RCTExecuteOnMainQueue(^void(){
|
|
458
|
+
RCTExecuteOnMainQueue(^void() {
|
|
480
459
|
__typeof__(self) strongSelf = weakSelf;
|
|
481
460
|
if (strongSelf == nil) {
|
|
482
461
|
return;
|
|
@@ -506,8 +485,7 @@
|
|
|
506
485
|
}
|
|
507
486
|
}
|
|
508
487
|
|
|
509
|
-
- (void)configureProps:(NSSet<NSString *> *)nativeProps
|
|
510
|
-
uiProps:(NSSet<NSString *> *)uiProps
|
|
488
|
+
- (void)configureProps:(NSSet<NSString *> *)nativeProps uiProps:(NSSet<NSString *> *)uiProps
|
|
511
489
|
{
|
|
512
490
|
_uiProps = uiProps;
|
|
513
491
|
_nativeProps = nativeProps;
|
|
@@ -532,7 +510,7 @@
|
|
|
532
510
|
NSMutableDictionary *nativeProps = [NSMutableDictionary new];
|
|
533
511
|
NSMutableDictionary *jsProps = [NSMutableDictionary new];
|
|
534
512
|
|
|
535
|
-
void (^addBlock)(NSString *key, id obj, BOOL *
|
|
513
|
+
void (^addBlock)(NSString *key, id obj, BOOL *stop) = ^(NSString *key, id obj, BOOL *stop) {
|
|
536
514
|
if ([self.uiProps containsObject:key]) {
|
|
537
515
|
uiProps[key] = obj;
|
|
538
516
|
} else if ([self.nativeProps containsObject:key]) {
|
|
@@ -545,36 +523,33 @@
|
|
|
545
523
|
[props enumerateKeysAndObjectsUsingBlock:addBlock];
|
|
546
524
|
|
|
547
525
|
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
|
-
}
|
|
526
|
+
[self.uiManager synchronouslyUpdateViewOnUIThread:viewTag viewName:viewName props:uiProps];
|
|
527
|
+
}
|
|
528
|
+
if (nativeProps.count > 0) {
|
|
529
|
+
[self enqueueUpdateViewOnNativeThread:viewTag viewName:viewName nativeProps:nativeProps trySynchronously:YES];
|
|
530
|
+
}
|
|
531
|
+
if (jsProps.count > 0) {
|
|
532
|
+
[self.reanimatedModule sendEventWithName:@"onReanimatedPropsChange"
|
|
533
|
+
body:@{@"viewTag" : viewTag, @"props" : jsProps}];
|
|
534
|
+
}
|
|
560
535
|
}
|
|
561
536
|
|
|
562
|
-
- (NSString*)obtainProp:(nonnull NSNumber *)viewTag
|
|
563
|
-
propName:(nonnull NSString *)propName
|
|
537
|
+
- (NSString *)obtainProp:(nonnull NSNumber *)viewTag propName:(nonnull NSString *)propName
|
|
564
538
|
{
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
539
|
+
UIView *view = [self.uiManager viewForReactTag:viewTag];
|
|
540
|
+
|
|
541
|
+
NSString *result =
|
|
542
|
+
[NSString stringWithFormat:@"error: unknown propName %@, currently supported: opacity, zIndex", propName];
|
|
543
|
+
|
|
544
|
+
if ([propName isEqualToString:@"opacity"]) {
|
|
545
|
+
CGFloat alpha = view.alpha;
|
|
546
|
+
result = [@(alpha) stringValue];
|
|
547
|
+
} else if ([propName isEqualToString:@"zIndex"]) {
|
|
548
|
+
NSInteger zIndex = view.reactZIndex;
|
|
549
|
+
result = [@(zIndex) stringValue];
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return result;
|
|
578
553
|
}
|
|
579
554
|
|
|
580
555
|
@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;
|