react-native-reanimated 2.6.0 → 3.0.0-rc.0
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/Fabric/FabricUtils.cpp +128 -0
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +197 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +311 -6
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -1
- package/Common/cpp/Registries/NewestShadowNodesRegistry.cpp +68 -0
- package/Common/cpp/SharedItems/ShareableValue.cpp +20 -2
- package/Common/cpp/Tools/Mapper.cpp +23 -4
- package/Common/cpp/Tools/RuntimeDecorator.cpp +92 -46
- package/Common/cpp/Tools/Scheduler.cpp +4 -0
- package/Common/cpp/headers/Fabric/FabricUtils.h +78 -0
- package/Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h +46 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +72 -2
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +8 -0
- package/Common/cpp/headers/Registries/NewestShadowNodesRegistry.h +41 -0
- package/Common/cpp/headers/SharedItems/SharedParent.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +25 -0
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +5 -0
- package/Common/cpp/headers/Tools/Mapper.h +1 -1
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +43 -8
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +8 -3
- package/README.md +4 -0
- package/RNReanimated.podspec +22 -11
- package/android/CMakeLists.txt +139 -27
- package/android/build.gradle +86 -209
- package/android/local.properties +1 -0
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +310 -0
- package/android/src/fabric/java/com/swmansion/reanimated/ReaCompatibility.java +25 -0
- package/android/src/main/cpp/NativeProxy.cpp +196 -41
- package/android/src/main/cpp/headers/NativeProxy.h +45 -7
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +13 -245
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +0 -125
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +2 -1
- package/android/src/{main → paper}/java/com/swmansion/reanimated/NativeProxy.java +26 -10
- package/android/src/paper/java/com/swmansion/reanimated/ReaCompatibility.java +17 -0
- package/ios/Fabric/REAInitializerRCTFabricSurface.h +12 -0
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +73 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +1 -1
- package/ios/LayoutReanimation/REAUIManager.h +1 -1
- package/ios/LayoutReanimation/REAUIManager.mm +4 -5
- package/ios/REAEventDispatcher.m +1 -2
- package/ios/REAModule.h +10 -1
- package/ios/REAModule.mm +284 -0
- package/ios/REANodesManager.h +27 -52
- package/ios/{REANodesManager.m → REANodesManager.mm} +92 -226
- package/ios/native/NativeMethods.h +1 -3
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.h +2 -2
- package/ios/native/NativeProxy.mm +162 -32
- package/ios/native/REAIOSErrorHandler.h +2 -4
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.h +1 -3
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.h +1 -3
- package/ios/native/REAIOSScheduler.mm +2 -2
- package/ios/native/REAInitializer.h +0 -7
- package/ios/native/REAInitializer.mm +14 -6
- package/ios/native/UIResponder+Reanimated.h +3 -1
- package/ios/native/UIResponder+Reanimated.mm +6 -4
- package/ios/sensor/ReanimatedSensor.h +1 -1
- package/ios/sensor/ReanimatedSensor.m +1 -1
- package/ios/sensor/ReanimatedSensorContainer.h +1 -1
- package/ios/sensor/ReanimatedSensorContainer.m +2 -2
- package/lib/Animated.js +0 -13
- package/lib/ConfigHelper.js +0 -1
- package/lib/createAnimatedComponent.js +30 -169
- package/lib/index.js +0 -13
- package/lib/reanimated2/Easing.js +8 -44
- package/lib/reanimated2/NativeMethods.js +20 -3
- package/lib/reanimated2/UpdateProps.js +25 -10
- package/lib/reanimated2/core.js +4 -37
- package/lib/reanimated2/fabricUtils.js +18 -0
- package/lib/reanimated2/globals.d.ts +18 -3
- package/lib/reanimated2/hook/useAnimatedRef.js +6 -2
- package/lib/reanimated2/hook/utils.js +0 -5
- package/lib/reanimated2/interpolateColor.js +5 -2
- package/lib/reanimated2/interpolation.js +0 -15
- package/lib/reanimated2/js-reanimated/index.js +3 -0
- package/lib/types/{lib/ConfigHelper.d.ts → ConfigHelper.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedEventEmitter.d.ts → ReanimatedEventEmitter.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.d.ts → ReanimatedModule.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.macos.d.ts → ReanimatedModule.macos.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.native.d.ts → ReanimatedModule.native.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.windows.d.ts → ReanimatedModule.windows.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModuleCompat.d.ts → ReanimatedModuleCompat.d.ts} +0 -0
- package/lib/types/{lib/createAnimatedComponent.d.ts → createAnimatedComponent.d.ts} +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Bezier.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Colors.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Easing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeMethods.d.ts +2 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/NativeReanimated.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PlatformChecker.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PropAdapters.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/UpdateProps.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/ViewDescriptorsSet.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/WorkletEventHandler.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.native.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/decay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/delay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/repeat.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/sequence.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/spring.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/styleAnimation.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/timing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/util.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/commonTypes.d.ts +2 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/component/FlatList.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/WrappedComponents.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/core.d.ts +0 -0
- package/lib/types/reanimated2/fabricUtils.d.ts +4 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/Hooks.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/commonTypes.d.ts +2 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/index.d.ts +1 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.d.ts +2 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedRef.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.d.ts +2 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedSensor.d.ts +1 -3
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useDerivedValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useSharedValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/utils.d.ts +2 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolateColor.d.ts +5 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolation.d.ts +1 -4
- package/lib/types/{lib/reanimated2 → reanimated2}/jestUtils.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/JSReanimated.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/Mapper.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/mock.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/utils.d.ts +0 -0
- package/lib/types/{lib/setAndForwardRef.d.ts → setAndForwardRef.d.ts} +0 -0
- package/package.json +10 -10
- package/plugin.js +29 -33
- package/react-native-reanimated.d.ts +15 -3
- package/src/Animated.js +0 -13
- package/src/ConfigHelper.ts +0 -1
- package/src/createAnimatedComponent.tsx +37 -197
- package/src/reanimated2/Easing.ts +8 -55
- package/src/reanimated2/NativeMethods.ts +39 -7
- package/src/reanimated2/UpdateProps.ts +38 -19
- package/src/reanimated2/commonTypes.ts +4 -2
- package/src/reanimated2/component/FlatList.tsx +8 -5
- package/src/reanimated2/core.ts +7 -48
- package/src/reanimated2/fabricUtils.ts +27 -0
- package/src/reanimated2/globals.d.ts +18 -3
- package/src/reanimated2/hook/commonTypes.ts +4 -2
- package/src/reanimated2/hook/index.ts +1 -1
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +2 -2
- package/src/reanimated2/hook/useAnimatedRef.ts +8 -3
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +1 -3
- package/src/reanimated2/hook/utils.ts +2 -11
- package/src/reanimated2/interpolateColor.ts +6 -2
- package/src/reanimated2/interpolation.ts +1 -26
- package/src/reanimated2/js-reanimated/index.ts +5 -0
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +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/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +0 -11
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +0 -29
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +0 -87
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +0 -24
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +0 -49
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +0 -38
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +0 -73
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +0 -36
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +0 -33
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +0 -83
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +0 -5
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +0 -20
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +0 -139
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +0 -37
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +0 -377
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +0 -71
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +0 -153
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +0 -32
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +0 -40
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +0 -84
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +0 -40
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +0 -84
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +0 -25
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +0 -86
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +0 -161
- package/ios/Nodes/REAAlwaysNode.h +0 -4
- package/ios/Nodes/REAAlwaysNode.m +0 -35
- package/ios/Nodes/REABezierNode.h +0 -5
- package/ios/Nodes/REABezierNode.m +0 -104
- package/ios/Nodes/REABlockNode.h +0 -5
- package/ios/Nodes/REABlockNode.m +0 -25
- package/ios/Nodes/REACallFuncNode.h +0 -6
- package/ios/Nodes/REACallFuncNode.m +0 -69
- package/ios/Nodes/REAClockNodes.h +0 -19
- package/ios/Nodes/REAClockNodes.m +0 -118
- package/ios/Nodes/REAConcatNode.h +0 -5
- package/ios/Nodes/REAConcatNode.m +0 -32
- package/ios/Nodes/REACondNode.h +0 -5
- package/ios/Nodes/REACondNode.m +0 -36
- package/ios/Nodes/READebugNode.h +0 -5
- package/ios/Nodes/READebugNode.m +0 -30
- package/ios/Nodes/REAEventNode.h +0 -9
- package/ios/Nodes/REAEventNode.m +0 -35
- package/ios/Nodes/REAFunctionNode.h +0 -6
- package/ios/Nodes/REAFunctionNode.m +0 -24
- package/ios/Nodes/REAJSCallNode.h +0 -5
- package/ios/Nodes/REAJSCallNode.m +0 -30
- package/ios/Nodes/REANode.h +0 -40
- package/ios/Nodes/REANode.m +0 -155
- package/ios/Nodes/REAOperatorNode.h +0 -5
- package/ios/Nodes/REAOperatorNode.m +0 -115
- package/ios/Nodes/REAParamNode.h +0 -10
- package/ios/Nodes/REAParamNode.m +0 -79
- package/ios/Nodes/REAPropsNode.h +0 -9
- package/ios/Nodes/REAPropsNode.m +0 -98
- package/ios/Nodes/REASetNode.h +0 -5
- package/ios/Nodes/REASetNode.m +0 -34
- package/ios/Nodes/REAStyleNode.h +0 -5
- package/ios/Nodes/REAStyleNode.m +0 -28
- package/ios/Nodes/REATransformNode.h +0 -5
- package/ios/Nodes/REATransformNode.m +0 -36
- package/ios/Nodes/REAValueNode.h +0 -11
- package/ios/Nodes/REAValueNode.m +0 -26
- package/ios/REAModule.m +0 -185
- package/ios/Transitioning/RCTConvert+REATransition.h +0 -12
- package/ios/Transitioning/RCTConvert+REATransition.m +0 -53
- package/ios/Transitioning/REAAllTransitions.h +0 -26
- package/ios/Transitioning/REAAllTransitions.m +0 -297
- package/ios/Transitioning/REATransition.h +0 -65
- package/ios/Transitioning/REATransition.m +0 -211
- package/ios/Transitioning/REATransitionAnimation.h +0 -17
- package/ios/Transitioning/REATransitionAnimation.m +0 -80
- package/ios/Transitioning/REATransitionManager.h +0 -9
- package/ios/Transitioning/REATransitionManager.m +0 -62
- package/ios/Transitioning/REATransitionValues.h +0 -15
- package/ios/Transitioning/REATransitionValues.m +0 -26
- package/lib/reanimated1/Easing.js +0 -231
- package/lib/reanimated1/SpringConfig.js +0 -79
- package/lib/reanimated1/Transitioning.js +0 -158
- package/lib/reanimated1/animations/Animation.js +0 -32
- package/lib/reanimated1/animations/SpringUtils.js +0 -199
- package/lib/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
- package/lib/reanimated1/animations/decay.js +0 -54
- package/lib/reanimated1/animations/spring.js +0 -198
- package/lib/reanimated1/animations/timing.js +0 -74
- package/lib/reanimated1/base.js +0 -13
- package/lib/reanimated1/core/AnimatedAlways.js +0 -33
- package/lib/reanimated1/core/AnimatedBezier.js +0 -150
- package/lib/reanimated1/core/AnimatedBlock.js +0 -52
- package/lib/reanimated1/core/AnimatedCall.js +0 -55
- package/lib/reanimated1/core/AnimatedCallFunc.js +0 -72
- package/lib/reanimated1/core/AnimatedClock.js +0 -90
- package/lib/reanimated1/core/AnimatedClockTest.js +0 -22
- package/lib/reanimated1/core/AnimatedCode.js +0 -32
- package/lib/reanimated1/core/AnimatedConcat.js +0 -32
- package/lib/reanimated1/core/AnimatedCond.js +0 -57
- package/lib/reanimated1/core/AnimatedDebug.js +0 -62
- package/lib/reanimated1/core/AnimatedEvent.js +0 -126
- package/lib/reanimated1/core/AnimatedFunction.js +0 -55
- package/lib/reanimated1/core/AnimatedNode.js +0 -223
- package/lib/reanimated1/core/AnimatedOperator.js +0 -103
- package/lib/reanimated1/core/AnimatedParam.js +0 -88
- package/lib/reanimated1/core/AnimatedProps.js +0 -108
- package/lib/reanimated1/core/AnimatedSet.js +0 -38
- package/lib/reanimated1/core/AnimatedStartClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStopClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStyle.js +0 -78
- package/lib/reanimated1/core/AnimatedTransform.js +0 -78
- package/lib/reanimated1/core/AnimatedValue.js +0 -38
- package/lib/reanimated1/core/Core.test.js +0 -30
- package/lib/reanimated1/core/InternalAnimatedValue.js +0 -87
- package/lib/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
- package/lib/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
- package/lib/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
- package/lib/reanimated1/derived/acc.js +0 -11
- package/lib/reanimated1/derived/color.js +0 -47
- package/lib/reanimated1/derived/diff.js +0 -16
- package/lib/reanimated1/derived/diffClamp.js +0 -11
- package/lib/reanimated1/derived/evaluateOnce.js +0 -35
- package/lib/reanimated1/derived/index.js +0 -8
- package/lib/reanimated1/derived/interpolate.js +0 -152
- package/lib/reanimated1/derived/interpolateColors.js +0 -62
- package/lib/reanimated1/derived/onChange.js +0 -14
- package/lib/reanimated1/derived/useCode.js +0 -41
- package/lib/reanimated1/index.js +0 -53
- package/lib/reanimated1/operators.js +0 -35
- package/lib/reanimated1/useValue.js +0 -10
- package/lib/reanimated1/val.js +0 -3
- package/lib/types/react-native-reanimated-tests.d.ts +0 -1
- package/src/reanimated1/Easing.js +0 -231
- package/src/reanimated1/SpringConfig.js +0 -79
- package/src/reanimated1/Transitioning.js +0 -158
- package/src/reanimated1/animations/Animation.js +0 -32
- package/src/reanimated1/animations/SpringUtils.js +0 -199
- package/src/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
- package/src/reanimated1/animations/decay.js +0 -54
- package/src/reanimated1/animations/spring.js +0 -198
- package/src/reanimated1/animations/timing.js +0 -74
- package/src/reanimated1/base.js +0 -13
- package/src/reanimated1/core/AnimatedAlways.js +0 -33
- package/src/reanimated1/core/AnimatedBezier.js +0 -150
- package/src/reanimated1/core/AnimatedBlock.js +0 -52
- package/src/reanimated1/core/AnimatedCall.js +0 -55
- package/src/reanimated1/core/AnimatedCallFunc.js +0 -72
- package/src/reanimated1/core/AnimatedClock.js +0 -90
- package/src/reanimated1/core/AnimatedClockTest.js +0 -22
- package/src/reanimated1/core/AnimatedCode.js +0 -32
- package/src/reanimated1/core/AnimatedConcat.js +0 -32
- package/src/reanimated1/core/AnimatedCond.js +0 -57
- package/src/reanimated1/core/AnimatedDebug.js +0 -62
- package/src/reanimated1/core/AnimatedEvent.js +0 -126
- package/src/reanimated1/core/AnimatedFunction.js +0 -55
- package/src/reanimated1/core/AnimatedNode.js +0 -223
- package/src/reanimated1/core/AnimatedOperator.js +0 -103
- package/src/reanimated1/core/AnimatedParam.js +0 -88
- package/src/reanimated1/core/AnimatedProps.js +0 -108
- package/src/reanimated1/core/AnimatedSet.js +0 -38
- package/src/reanimated1/core/AnimatedStartClock.js +0 -30
- package/src/reanimated1/core/AnimatedStopClock.js +0 -30
- package/src/reanimated1/core/AnimatedStyle.js +0 -78
- package/src/reanimated1/core/AnimatedTransform.js +0 -78
- package/src/reanimated1/core/AnimatedValue.js +0 -38
- package/src/reanimated1/core/Core.test.js +0 -30
- package/src/reanimated1/core/InternalAnimatedValue.js +0 -87
- package/src/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
- package/src/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
- package/src/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
- package/src/reanimated1/derived/acc.js +0 -11
- package/src/reanimated1/derived/color.js +0 -47
- package/src/reanimated1/derived/diff.js +0 -16
- package/src/reanimated1/derived/diffClamp.js +0 -11
- package/src/reanimated1/derived/evaluateOnce.js +0 -35
- package/src/reanimated1/derived/index.js +0 -8
- package/src/reanimated1/derived/interpolate.js +0 -152
- package/src/reanimated1/derived/interpolateColors.js +0 -62
- package/src/reanimated1/derived/onChange.js +0 -14
- package/src/reanimated1/derived/useCode.js +0 -41
- package/src/reanimated1/index.js +0 -53
- package/src/reanimated1/operators.js +0 -35
- package/src/reanimated1/useValue.js +0 -10
- package/src/reanimated1/val.js +0 -3
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#include <JFabricUIManager.h>
|
|
5
|
+
#endif
|
|
6
|
+
|
|
3
7
|
#include <ReactCommon/CallInvokerHolder.h>
|
|
4
8
|
#include <fbjni/fbjni.h>
|
|
5
9
|
#include <jsi/jsi.h>
|
|
@@ -128,27 +132,48 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
128
132
|
jni::alias_ref<facebook::react::CallInvokerHolder::javaobject>
|
|
129
133
|
jsCallInvokerHolder,
|
|
130
134
|
jni::alias_ref<AndroidScheduler::javaobject> scheduler,
|
|
131
|
-
jni::alias_ref<LayoutAnimations::javaobject> layoutAnimations
|
|
135
|
+
jni::alias_ref<LayoutAnimations::javaobject> layoutAnimations
|
|
136
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
137
|
+
,
|
|
138
|
+
jni::alias_ref<facebook::react::JFabricUIManager::javaobject>
|
|
139
|
+
fabricUIManager
|
|
140
|
+
#endif
|
|
141
|
+
/**/);
|
|
132
142
|
static void registerNatives();
|
|
133
143
|
|
|
144
|
+
~NativeProxy();
|
|
145
|
+
|
|
134
146
|
private:
|
|
135
147
|
friend HybridBase;
|
|
136
148
|
jni::global_ref<NativeProxy::javaobject> javaPart_;
|
|
137
149
|
jsi::Runtime *runtime_;
|
|
138
150
|
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker_;
|
|
139
151
|
std::shared_ptr<NativeReanimatedModule> _nativeReanimatedModule;
|
|
140
|
-
std::shared_ptr<Scheduler> scheduler_;
|
|
141
152
|
jni::global_ref<LayoutAnimations::javaobject> layoutAnimations;
|
|
142
|
-
|
|
153
|
+
std::shared_ptr<Scheduler> scheduler_;
|
|
154
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
155
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
156
|
+
|
|
157
|
+
// removed temporary, new event listener mechanism need fix on the RN side
|
|
158
|
+
// std::shared_ptr<facebook::react::Scheduler> reactScheduler_;
|
|
159
|
+
// std::shared_ptr<EventListener> eventListener_;
|
|
160
|
+
#endif
|
|
161
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
162
|
+
void installJSIBindings(
|
|
163
|
+
jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager);
|
|
164
|
+
void synchronouslyUpdateUIProps(
|
|
165
|
+
jsi::Runtime &rt,
|
|
166
|
+
Tag viewTag,
|
|
167
|
+
const jsi::Value &uiProps);
|
|
168
|
+
#else
|
|
143
169
|
void installJSIBindings();
|
|
170
|
+
#endif
|
|
144
171
|
bool isAnyHandlerWaitingForEvent(std::string);
|
|
172
|
+
void performOperations();
|
|
145
173
|
void requestRender(std::function<void(double)> onRender);
|
|
146
174
|
void registerEventHandler(
|
|
147
175
|
std::function<void(std::string, std::string)> handler);
|
|
148
|
-
void updateProps(jsi::Runtime &rt, int viewTag, const jsi::Object &props);
|
|
149
|
-
void scrollTo(int viewTag, double x, double y, bool animated);
|
|
150
176
|
void setGestureState(int handlerTag, int newState);
|
|
151
|
-
std::vector<std::pair<std::string, double>> measure(int viewTag);
|
|
152
177
|
int registerSensor(
|
|
153
178
|
int sensorType,
|
|
154
179
|
int interval,
|
|
@@ -158,13 +183,26 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
158
183
|
jsi::Runtime &rt,
|
|
159
184
|
const jsi::Value &uiProps,
|
|
160
185
|
const jsi::Value &nativeProps);
|
|
186
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
187
|
+
// nothing
|
|
188
|
+
#else
|
|
189
|
+
void updateProps(jsi::Runtime &rt, int viewTag, const jsi::Object &props);
|
|
190
|
+
void scrollTo(int viewTag, double x, double y, bool animated);
|
|
191
|
+
std::vector<std::pair<std::string, double>> measure(int viewTag);
|
|
192
|
+
#endif
|
|
161
193
|
|
|
162
194
|
explicit NativeProxy(
|
|
163
195
|
jni::alias_ref<NativeProxy::jhybridobject> jThis,
|
|
164
196
|
jsi::Runtime *rt,
|
|
165
197
|
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker,
|
|
166
198
|
std::shared_ptr<Scheduler> scheduler,
|
|
167
|
-
jni::global_ref<LayoutAnimations::javaobject> _layoutAnimations
|
|
199
|
+
jni::global_ref<LayoutAnimations::javaobject> _layoutAnimations
|
|
200
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
201
|
+
,
|
|
202
|
+
jni::alias_ref<facebook::react::JFabricUIManager::javaobject>
|
|
203
|
+
fabricUIManager
|
|
204
|
+
#endif
|
|
205
|
+
/**/);
|
|
168
206
|
};
|
|
169
207
|
|
|
170
208
|
} // namespace reanimated
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
package com.swmansion.reanimated;
|
|
2
2
|
|
|
3
|
-
import android.util.SparseArray;
|
|
4
3
|
import android.view.View;
|
|
5
4
|
import com.facebook.react.bridge.Arguments;
|
|
6
|
-
import com.facebook.react.bridge.Callback;
|
|
7
5
|
import com.facebook.react.bridge.GuardedRunnable;
|
|
8
|
-
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
|
9
6
|
import com.facebook.react.bridge.JavaOnlyMap;
|
|
10
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
8
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -28,30 +25,8 @@ import com.facebook.react.uimanager.events.Event;
|
|
|
28
25
|
import com.facebook.react.uimanager.events.EventDispatcherListener;
|
|
29
26
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
30
27
|
import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
|
|
31
|
-
import com.swmansion.reanimated.nodes.AlwaysNode;
|
|
32
|
-
import com.swmansion.reanimated.nodes.BezierNode;
|
|
33
|
-
import com.swmansion.reanimated.nodes.BlockNode;
|
|
34
|
-
import com.swmansion.reanimated.nodes.CallFuncNode;
|
|
35
|
-
import com.swmansion.reanimated.nodes.ClockNode;
|
|
36
|
-
import com.swmansion.reanimated.nodes.ClockOpNode;
|
|
37
|
-
import com.swmansion.reanimated.nodes.ConcatNode;
|
|
38
|
-
import com.swmansion.reanimated.nodes.CondNode;
|
|
39
|
-
import com.swmansion.reanimated.nodes.DebugNode;
|
|
40
|
-
import com.swmansion.reanimated.nodes.EventNode;
|
|
41
|
-
import com.swmansion.reanimated.nodes.FunctionNode;
|
|
42
|
-
import com.swmansion.reanimated.nodes.JSCallNode;
|
|
43
|
-
import com.swmansion.reanimated.nodes.Node;
|
|
44
|
-
import com.swmansion.reanimated.nodes.NoopNode;
|
|
45
|
-
import com.swmansion.reanimated.nodes.OperatorNode;
|
|
46
|
-
import com.swmansion.reanimated.nodes.ParamNode;
|
|
47
|
-
import com.swmansion.reanimated.nodes.PropsNode;
|
|
48
|
-
import com.swmansion.reanimated.nodes.SetNode;
|
|
49
|
-
import com.swmansion.reanimated.nodes.StyleNode;
|
|
50
|
-
import com.swmansion.reanimated.nodes.TransformNode;
|
|
51
|
-
import com.swmansion.reanimated.nodes.ValueNode;
|
|
52
28
|
import java.util.ArrayList;
|
|
53
29
|
import java.util.Collections;
|
|
54
|
-
import java.util.HashMap;
|
|
55
30
|
import java.util.LinkedList;
|
|
56
31
|
import java.util.List;
|
|
57
32
|
import java.util.Map;
|
|
@@ -64,8 +39,6 @@ import javax.annotation.Nullable;
|
|
|
64
39
|
|
|
65
40
|
public class NodesManager implements EventDispatcherListener {
|
|
66
41
|
|
|
67
|
-
private static final Double ZERO = Double.valueOf(0);
|
|
68
|
-
|
|
69
42
|
public void scrollTo(int viewTag, double x, double y, boolean animated) {
|
|
70
43
|
View view;
|
|
71
44
|
try {
|
|
@@ -92,28 +65,23 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
92
65
|
void onAnimationFrame(double timestampMs);
|
|
93
66
|
}
|
|
94
67
|
|
|
95
|
-
private AnimationsManager mAnimationManager
|
|
96
|
-
private final SparseArray<Node> mAnimatedNodes = new SparseArray<>();
|
|
97
|
-
private final Map<String, EventNode> mEventMapping = new HashMap<>();
|
|
68
|
+
private AnimationsManager mAnimationManager;
|
|
98
69
|
private final UIImplementation mUIImplementation;
|
|
99
70
|
private final DeviceEventManagerModule.RCTDeviceEventEmitter mEventEmitter;
|
|
100
71
|
private final ReactChoreographer mReactChoreographer;
|
|
101
72
|
private final GuardedFrameCallback mChoreographerCallback;
|
|
102
73
|
protected final UIManagerModule.CustomEventNamesResolver mCustomEventNamesResolver;
|
|
103
74
|
private final AtomicBoolean mCallbackPosted = new AtomicBoolean();
|
|
104
|
-
private final NoopNode mNoopNode;
|
|
105
75
|
private final ReactContext mContext;
|
|
106
76
|
private final UIManagerModule mUIManager;
|
|
107
|
-
|
|
77
|
+
private ReactApplicationContext mReactApplicationContext;
|
|
108
78
|
private RCTEventEmitter mCustomEventHandler;
|
|
109
79
|
private List<OnAnimationFrame> mFrameCallbacks = new ArrayList<>();
|
|
110
80
|
private ConcurrentLinkedQueue<CopiedEvent> mEventQueue = new ConcurrentLinkedQueue<>();
|
|
111
|
-
private boolean mWantRunUpdates;
|
|
112
|
-
|
|
113
81
|
public double currentFrameTimeMs;
|
|
114
|
-
public final UpdateContext updateContext;
|
|
115
82
|
public Set<String> uiProps = Collections.emptySet();
|
|
116
83
|
public Set<String> nativeProps = Collections.emptySet();
|
|
84
|
+
private ReaCompatibility compatibility;
|
|
117
85
|
|
|
118
86
|
public NativeProxy getNativeProxy() {
|
|
119
87
|
return mNativeProxy;
|
|
@@ -137,8 +105,11 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
137
105
|
}
|
|
138
106
|
|
|
139
107
|
public void initWithContext(ReactApplicationContext reactApplicationContext) {
|
|
108
|
+
mReactApplicationContext = reactApplicationContext;
|
|
140
109
|
mNativeProxy = new NativeProxy(reactApplicationContext);
|
|
141
110
|
mAnimationManager.setScheduler(getNativeProxy().getScheduler());
|
|
111
|
+
compatibility = new ReaCompatibility(reactApplicationContext);
|
|
112
|
+
compatibility.registerFabricEventListener(this);
|
|
142
113
|
}
|
|
143
114
|
|
|
144
115
|
private final class NativeUpdateOperation {
|
|
@@ -157,7 +128,6 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
157
128
|
public NodesManager(ReactContext context) {
|
|
158
129
|
mContext = context;
|
|
159
130
|
mUIManager = context.getNativeModule(UIManagerModule.class);
|
|
160
|
-
updateContext = new UpdateContext();
|
|
161
131
|
mUIImplementation = mUIManager.getUIImplementation();
|
|
162
132
|
mCustomEventNamesResolver = mUIManager.getDirectEventNamesResolver();
|
|
163
133
|
mEventEmitter = context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
|
|
@@ -171,8 +141,6 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
171
141
|
}
|
|
172
142
|
};
|
|
173
143
|
|
|
174
|
-
mNoopNode = new NoopNode(this);
|
|
175
|
-
|
|
176
144
|
// We register as event listener at the end, because we pass `this` and we haven't finished
|
|
177
145
|
// contructing an object yet.
|
|
178
146
|
// This lead to a crash described in
|
|
@@ -214,7 +182,9 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
214
182
|
}
|
|
215
183
|
|
|
216
184
|
private void performOperations() {
|
|
217
|
-
if (
|
|
185
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
186
|
+
mNativeProxy.performOperations();
|
|
187
|
+
} else if (!mOperationsInBatch.isEmpty()) {
|
|
218
188
|
final Queue<NativeUpdateOperation> copiedOperationsQueue = mOperationsInBatch;
|
|
219
189
|
mOperationsInBatch = new LinkedList<>();
|
|
220
190
|
final boolean trySynchronously = mTryRunBatchUpdatesSynchronously;
|
|
@@ -274,13 +244,9 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
274
244
|
}
|
|
275
245
|
}
|
|
276
246
|
|
|
277
|
-
if (mWantRunUpdates) {
|
|
278
|
-
Node.runUpdates(updateContext);
|
|
279
|
-
}
|
|
280
247
|
performOperations();
|
|
281
248
|
|
|
282
249
|
mCallbackPosted.set(false);
|
|
283
|
-
mWantRunUpdates = false;
|
|
284
250
|
|
|
285
251
|
if (!mFrameCallbacks.isEmpty() || !mEventQueue.isEmpty()) {
|
|
286
252
|
// enqueue next frame
|
|
@@ -288,153 +254,6 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
288
254
|
}
|
|
289
255
|
}
|
|
290
256
|
|
|
291
|
-
/**
|
|
292
|
-
* Null-safe way of getting node's value. If node is not present we return 0. This also matches
|
|
293
|
-
* iOS behavior when the app won't just crash.
|
|
294
|
-
*/
|
|
295
|
-
public Object getNodeValue(int nodeID) {
|
|
296
|
-
Node node = mAnimatedNodes.get(nodeID);
|
|
297
|
-
if (node != null) {
|
|
298
|
-
return node.value();
|
|
299
|
-
}
|
|
300
|
-
return ZERO;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Null-safe way of getting node reference. This method always returns non-null instance. If the
|
|
305
|
-
* node is not present we try to return a "no-op" node that allows for "set" calls and always
|
|
306
|
-
* returns 0 as a value.
|
|
307
|
-
*/
|
|
308
|
-
public <T extends Node> T findNodeById(int id, Class<T> type) {
|
|
309
|
-
Node node = mAnimatedNodes.get(id);
|
|
310
|
-
if (node == null) {
|
|
311
|
-
if (type == Node.class || type == ValueNode.class) {
|
|
312
|
-
return (T) mNoopNode;
|
|
313
|
-
}
|
|
314
|
-
throw new IllegalArgumentException(
|
|
315
|
-
"Requested node with id " + id + " of type " + type + " cannot be found");
|
|
316
|
-
}
|
|
317
|
-
if (type.isInstance(node)) {
|
|
318
|
-
return (T) node;
|
|
319
|
-
}
|
|
320
|
-
throw new IllegalArgumentException(
|
|
321
|
-
"Node with id "
|
|
322
|
-
+ id
|
|
323
|
-
+ " is of incompatible type "
|
|
324
|
-
+ node.getClass()
|
|
325
|
-
+ ", requested type was "
|
|
326
|
-
+ type);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
public void createNode(int nodeID, ReadableMap config) {
|
|
330
|
-
if (mAnimatedNodes.get(nodeID) != null) {
|
|
331
|
-
throw new JSApplicationIllegalArgumentException(
|
|
332
|
-
"Animated node with ID " + nodeID + " already exists");
|
|
333
|
-
}
|
|
334
|
-
String type = config.getString("type");
|
|
335
|
-
final Node node;
|
|
336
|
-
if ("props".equals(type)) {
|
|
337
|
-
node = new PropsNode(nodeID, config, this, mUIImplementation);
|
|
338
|
-
} else if ("style".equals(type)) {
|
|
339
|
-
node = new StyleNode(nodeID, config, this);
|
|
340
|
-
} else if ("transform".equals(type)) {
|
|
341
|
-
node = new TransformNode(nodeID, config, this);
|
|
342
|
-
} else if ("value".equals(type)) {
|
|
343
|
-
node = new ValueNode(nodeID, config, this);
|
|
344
|
-
} else if ("block".equals(type)) {
|
|
345
|
-
node = new BlockNode(nodeID, config, this);
|
|
346
|
-
} else if ("cond".equals(type)) {
|
|
347
|
-
node = new CondNode(nodeID, config, this);
|
|
348
|
-
} else if ("op".equals(type)) {
|
|
349
|
-
node = new OperatorNode(nodeID, config, this);
|
|
350
|
-
} else if ("set".equals(type)) {
|
|
351
|
-
node = new SetNode(nodeID, config, this);
|
|
352
|
-
} else if ("debug".equals(type)) {
|
|
353
|
-
node = new DebugNode(nodeID, config, this);
|
|
354
|
-
} else if ("clock".equals(type)) {
|
|
355
|
-
node = new ClockNode(nodeID, config, this);
|
|
356
|
-
} else if ("clockStart".equals(type)) {
|
|
357
|
-
node = new ClockOpNode.ClockStartNode(nodeID, config, this);
|
|
358
|
-
} else if ("clockStop".equals(type)) {
|
|
359
|
-
node = new ClockOpNode.ClockStopNode(nodeID, config, this);
|
|
360
|
-
} else if ("clockTest".equals(type)) {
|
|
361
|
-
node = new ClockOpNode.ClockTestNode(nodeID, config, this);
|
|
362
|
-
} else if ("call".equals(type)) {
|
|
363
|
-
node = new JSCallNode(nodeID, config, this);
|
|
364
|
-
} else if ("bezier".equals(type)) {
|
|
365
|
-
node = new BezierNode(nodeID, config, this);
|
|
366
|
-
} else if ("event".equals(type)) {
|
|
367
|
-
node = new EventNode(nodeID, config, this);
|
|
368
|
-
} else if ("always".equals(type)) {
|
|
369
|
-
node = new AlwaysNode(nodeID, config, this);
|
|
370
|
-
} else if ("concat".equals(type)) {
|
|
371
|
-
node = new ConcatNode(nodeID, config, this);
|
|
372
|
-
} else if ("param".equals(type)) {
|
|
373
|
-
node = new ParamNode(nodeID, config, this);
|
|
374
|
-
} else if ("func".equals(type)) {
|
|
375
|
-
node = new FunctionNode(nodeID, config, this);
|
|
376
|
-
} else if ("callfunc".equals(type)) {
|
|
377
|
-
node = new CallFuncNode(nodeID, config, this);
|
|
378
|
-
} else {
|
|
379
|
-
throw new JSApplicationIllegalArgumentException("Unsupported node type: " + type);
|
|
380
|
-
}
|
|
381
|
-
mAnimatedNodes.put(nodeID, node);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
public void dropNode(int tag) {
|
|
385
|
-
Node node = mAnimatedNodes.get(tag);
|
|
386
|
-
if (node != null) {
|
|
387
|
-
node.onDrop();
|
|
388
|
-
}
|
|
389
|
-
mAnimatedNodes.remove(tag);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
public void connectNodes(int parentID, int childID) {
|
|
393
|
-
Node parentNode = mAnimatedNodes.get(parentID);
|
|
394
|
-
Node childNode = mAnimatedNodes.get(childID);
|
|
395
|
-
if (childNode == null) {
|
|
396
|
-
throw new JSApplicationIllegalArgumentException(
|
|
397
|
-
"Animated node with ID " + childID + " does not exists");
|
|
398
|
-
}
|
|
399
|
-
parentNode.addChild(childNode);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public void disconnectNodes(int parentID, int childID) {
|
|
403
|
-
Node parentNode = mAnimatedNodes.get(parentID);
|
|
404
|
-
Node childNode = mAnimatedNodes.get(childID);
|
|
405
|
-
if (childNode == null) {
|
|
406
|
-
throw new JSApplicationIllegalArgumentException(
|
|
407
|
-
"Animated node with ID " + childID + " does not exists");
|
|
408
|
-
}
|
|
409
|
-
parentNode.removeChild(childNode);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
public void connectNodeToView(int nodeID, int viewTag) {
|
|
413
|
-
Node node = mAnimatedNodes.get(nodeID);
|
|
414
|
-
if (node == null) {
|
|
415
|
-
throw new JSApplicationIllegalArgumentException(
|
|
416
|
-
"Animated node with ID " + nodeID + " does not exists");
|
|
417
|
-
}
|
|
418
|
-
if (!(node instanceof PropsNode)) {
|
|
419
|
-
throw new JSApplicationIllegalArgumentException(
|
|
420
|
-
"Animated node connected to view should be" + "of type " + PropsNode.class.getName());
|
|
421
|
-
}
|
|
422
|
-
((PropsNode) node).connectToView(viewTag);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
public void disconnectNodeFromView(int nodeID, int viewTag) {
|
|
426
|
-
Node node = mAnimatedNodes.get(nodeID);
|
|
427
|
-
if (node == null) {
|
|
428
|
-
throw new JSApplicationIllegalArgumentException(
|
|
429
|
-
"Animated node with ID " + nodeID + " does not exists");
|
|
430
|
-
}
|
|
431
|
-
if (!(node instanceof PropsNode)) {
|
|
432
|
-
throw new JSApplicationIllegalArgumentException(
|
|
433
|
-
"Animated node connected to view should be" + "of type " + PropsNode.class.getName());
|
|
434
|
-
}
|
|
435
|
-
((PropsNode) node).disconnectFromView(viewTag);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
257
|
public void enqueueUpdateViewOnNativeThread(
|
|
439
258
|
int viewTag, WritableMap nativeProps, boolean trySynchronously) {
|
|
440
259
|
if (trySynchronously) {
|
|
@@ -443,41 +262,11 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
443
262
|
mOperationsInBatch.add(new NativeUpdateOperation(viewTag, nativeProps));
|
|
444
263
|
}
|
|
445
264
|
|
|
446
|
-
public void attachEvent(int viewTag, String eventName, int eventNodeID) {
|
|
447
|
-
String key = viewTag + eventName;
|
|
448
|
-
|
|
449
|
-
EventNode node = (EventNode) mAnimatedNodes.get(eventNodeID);
|
|
450
|
-
if (node == null) {
|
|
451
|
-
throw new JSApplicationIllegalArgumentException(
|
|
452
|
-
"Event node " + eventNodeID + " does not exists");
|
|
453
|
-
}
|
|
454
|
-
if (mEventMapping.containsKey(key)) {
|
|
455
|
-
throw new JSApplicationIllegalArgumentException(
|
|
456
|
-
"Event handler already set for the given view and event type");
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
mEventMapping.put(key, node);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
public void detachEvent(int viewTag, String eventName, int eventNodeID) {
|
|
463
|
-
String key = viewTag + eventName;
|
|
464
|
-
mEventMapping.remove(key);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
265
|
public void configureProps(Set<String> uiPropsSet, Set<String> nativePropsSet) {
|
|
468
266
|
uiProps = uiPropsSet;
|
|
469
267
|
nativeProps = nativePropsSet;
|
|
470
268
|
}
|
|
471
269
|
|
|
472
|
-
public void getValue(int nodeID, Callback callback) {
|
|
473
|
-
callback.invoke(mAnimatedNodes.get(nodeID).value());
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
public void postRunUpdatesAfterAnimation() {
|
|
477
|
-
mWantRunUpdates = true;
|
|
478
|
-
startUpdatingOnAnimationFrame();
|
|
479
|
-
}
|
|
480
|
-
|
|
481
270
|
public void postOnAnimation(OnAnimationFrame onAnimationFrame) {
|
|
482
271
|
mFrameCallbacks.add(onAnimationFrame);
|
|
483
272
|
startUpdatingOnAnimationFrame();
|
|
@@ -511,33 +300,15 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
511
300
|
// If the event has a different name in native, convert it to it's JS name.
|
|
512
301
|
String eventName = mCustomEventNamesResolver.resolveCustomEventName(event.getEventName());
|
|
513
302
|
int viewTag = event.getViewTag();
|
|
514
|
-
String key = viewTag + eventName;
|
|
515
|
-
|
|
516
303
|
if (mCustomEventHandler != null) {
|
|
517
304
|
event.dispatch(mCustomEventHandler);
|
|
518
305
|
}
|
|
519
|
-
|
|
520
|
-
if (!mEventMapping.isEmpty()) {
|
|
521
|
-
EventNode node = mEventMapping.get(key);
|
|
522
|
-
if (node != null) {
|
|
523
|
-
event.dispatch(node);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
306
|
}
|
|
527
307
|
|
|
528
308
|
private void handleEvent(int targetTag, String eventName, @Nullable WritableMap event) {
|
|
529
309
|
if (mCustomEventHandler != null) {
|
|
530
310
|
mCustomEventHandler.receiveEvent(targetTag, eventName, event);
|
|
531
311
|
}
|
|
532
|
-
|
|
533
|
-
String key = targetTag + eventName;
|
|
534
|
-
|
|
535
|
-
if (!mEventMapping.isEmpty()) {
|
|
536
|
-
EventNode node = mEventMapping.get(key);
|
|
537
|
-
if (node != null) {
|
|
538
|
-
node.receiveEvent(targetTag, eventName, event);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
312
|
}
|
|
542
313
|
|
|
543
314
|
public UIManagerModule.CustomEventNamesResolver getEventNameResolver() {
|
|
@@ -552,13 +323,6 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
552
323
|
mEventEmitter.emit(name, body);
|
|
553
324
|
}
|
|
554
325
|
|
|
555
|
-
public void setValue(int nodeID, Double newValue) {
|
|
556
|
-
Node node = mAnimatedNodes.get(nodeID);
|
|
557
|
-
if (node != null) {
|
|
558
|
-
((ValueNode) node).setValue(newValue);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
326
|
public void updateProps(int viewTag, Map<String, Object> props) {
|
|
563
327
|
// TODO: update PropsNode to use this method instead of its own way of updating props
|
|
564
328
|
boolean hasUIProps = false;
|
|
@@ -600,6 +364,10 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
600
364
|
}
|
|
601
365
|
}
|
|
602
366
|
|
|
367
|
+
public void synchronouslyUpdateUIProps(int viewTag, ReadableMap uiProps) {
|
|
368
|
+
compatibility.synchronouslyUpdateUIProps(viewTag, uiProps);
|
|
369
|
+
}
|
|
370
|
+
|
|
603
371
|
public String obtainProp(int viewTag, String propName) {
|
|
604
372
|
View view = mUIManager.resolveView(viewTag);
|
|
605
373
|
String result =
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
package com.swmansion.reanimated;
|
|
2
2
|
|
|
3
3
|
import android.util.Log;
|
|
4
|
-
import com.facebook.react.bridge.Callback;
|
|
5
4
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
6
5
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
6
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
7
|
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
10
8
|
import com.facebook.react.module.annotations.ReactModule;
|
|
11
9
|
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
|
12
10
|
import com.facebook.react.uimanager.UIBlock;
|
|
13
11
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
14
12
|
import com.facebook.react.uimanager.UIManagerModuleListener;
|
|
15
|
-
import com.swmansion.reanimated.transitions.TransitionModule;
|
|
16
13
|
import java.util.ArrayList;
|
|
17
14
|
import javax.annotation.Nullable;
|
|
18
15
|
|
|
@@ -27,11 +24,7 @@ public class ReanimatedModule extends ReactContextBaseJavaModule
|
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
private ArrayList<UIThreadOperation> mOperations = new ArrayList<>();
|
|
30
|
-
|
|
31
27
|
private @Nullable NodesManager mNodesManager;
|
|
32
|
-
private @Nullable TransitionModule mTransitionManager;
|
|
33
|
-
|
|
34
|
-
private UIManagerModule mUIManager;
|
|
35
28
|
|
|
36
29
|
public ReanimatedModule(ReactApplicationContext reactContext) {
|
|
37
30
|
super(reactContext);
|
|
@@ -43,9 +36,6 @@ public class ReanimatedModule extends ReactContextBaseJavaModule
|
|
|
43
36
|
UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
|
|
44
37
|
reactCtx.addLifecycleEventListener(this);
|
|
45
38
|
uiManager.addUIManagerListener(this);
|
|
46
|
-
mTransitionManager = new TransitionModule(uiManager);
|
|
47
|
-
|
|
48
|
-
mUIManager = uiManager;
|
|
49
39
|
}
|
|
50
40
|
|
|
51
41
|
@Override
|
|
@@ -115,121 +105,6 @@ public class ReanimatedModule extends ReactContextBaseJavaModule
|
|
|
115
105
|
}
|
|
116
106
|
}
|
|
117
107
|
|
|
118
|
-
@ReactMethod
|
|
119
|
-
public void animateNextTransition(int tag, ReadableMap config) {
|
|
120
|
-
mTransitionManager.animateNextTransition(tag, config);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@ReactMethod
|
|
124
|
-
public void createNode(final int tag, final ReadableMap config) {
|
|
125
|
-
mOperations.add(
|
|
126
|
-
new UIThreadOperation() {
|
|
127
|
-
@Override
|
|
128
|
-
public void execute(NodesManager nodesManager) {
|
|
129
|
-
nodesManager.createNode(tag, config);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@ReactMethod
|
|
135
|
-
public void dropNode(final int tag) {
|
|
136
|
-
mOperations.add(
|
|
137
|
-
new UIThreadOperation() {
|
|
138
|
-
@Override
|
|
139
|
-
public void execute(NodesManager nodesManager) {
|
|
140
|
-
nodesManager.dropNode(tag);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@ReactMethod
|
|
146
|
-
public void connectNodes(final int parentID, final int childID) {
|
|
147
|
-
mOperations.add(
|
|
148
|
-
new UIThreadOperation() {
|
|
149
|
-
@Override
|
|
150
|
-
public void execute(NodesManager nodesManager) {
|
|
151
|
-
nodesManager.connectNodes(parentID, childID);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
@ReactMethod
|
|
157
|
-
public void disconnectNodes(final int parentID, final int childID) {
|
|
158
|
-
mOperations.add(
|
|
159
|
-
new UIThreadOperation() {
|
|
160
|
-
@Override
|
|
161
|
-
public void execute(NodesManager nodesManager) {
|
|
162
|
-
nodesManager.disconnectNodes(parentID, childID);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
@ReactMethod
|
|
168
|
-
public void connectNodeToView(final int nodeID, final int viewTag) {
|
|
169
|
-
mOperations.add(
|
|
170
|
-
new UIThreadOperation() {
|
|
171
|
-
@Override
|
|
172
|
-
public void execute(NodesManager nodesManager) {
|
|
173
|
-
nodesManager.connectNodeToView(nodeID, viewTag);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
@ReactMethod
|
|
179
|
-
public void disconnectNodeFromView(final int nodeID, final int viewTag) {
|
|
180
|
-
mOperations.add(
|
|
181
|
-
new UIThreadOperation() {
|
|
182
|
-
@Override
|
|
183
|
-
public void execute(NodesManager nodesManager) {
|
|
184
|
-
nodesManager.disconnectNodeFromView(nodeID, viewTag);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@ReactMethod
|
|
190
|
-
public void attachEvent(final int viewTag, final String eventName, final int eventNodeID) {
|
|
191
|
-
mOperations.add(
|
|
192
|
-
new UIThreadOperation() {
|
|
193
|
-
@Override
|
|
194
|
-
public void execute(NodesManager nodesManager) {
|
|
195
|
-
nodesManager.attachEvent(viewTag, eventName, eventNodeID);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
@ReactMethod
|
|
201
|
-
public void detachEvent(final int viewTag, final String eventName, final int eventNodeID) {
|
|
202
|
-
mOperations.add(
|
|
203
|
-
new UIThreadOperation() {
|
|
204
|
-
@Override
|
|
205
|
-
public void execute(NodesManager nodesManager) {
|
|
206
|
-
nodesManager.detachEvent(viewTag, eventName, eventNodeID);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
@ReactMethod
|
|
212
|
-
public void getValue(final int nodeID, final Callback callback) {
|
|
213
|
-
mOperations.add(
|
|
214
|
-
new UIThreadOperation() {
|
|
215
|
-
@Override
|
|
216
|
-
public void execute(NodesManager nodesManager) {
|
|
217
|
-
nodesManager.getValue(nodeID, callback);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
@ReactMethod
|
|
223
|
-
public void setValue(final int nodeID, final Double newValue) {
|
|
224
|
-
mOperations.add(
|
|
225
|
-
new UIThreadOperation() {
|
|
226
|
-
@Override
|
|
227
|
-
public void execute(NodesManager nodesManager) {
|
|
228
|
-
nodesManager.setValue(nodeID, newValue);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
108
|
@ReactMethod
|
|
234
109
|
public void addListener(String eventName) {
|
|
235
110
|
// Keep: Required for RN built in Event Emitter Calls.
|
package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.swmansion.reanimated.layoutReanimation;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
3
4
|
import android.util.DisplayMetrics;
|
|
4
5
|
import android.util.Log;
|
|
5
6
|
import android.view.View;
|
|
@@ -368,12 +369,18 @@ public class AnimationsManager implements ViewHierarchyObserver {
|
|
|
368
369
|
preparedValues.put(key, PixelUtil.toDIPFromPixel((int) values.get(key)));
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
DisplayMetrics
|
|
372
|
-
mContext.getCurrentActivity()
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
373
|
+
Activity currentActivity = mContext.getCurrentActivity();
|
|
374
|
+
if (currentActivity != null) {
|
|
375
|
+
currentActivity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
|
376
|
+
int height = displayMetrics.heightPixels;
|
|
377
|
+
int width = displayMetrics.widthPixels;
|
|
378
|
+
preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(width));
|
|
379
|
+
preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(height));
|
|
380
|
+
} else {
|
|
381
|
+
preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(0));
|
|
382
|
+
preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(0));
|
|
383
|
+
}
|
|
377
384
|
return preparedValues;
|
|
378
385
|
}
|
|
379
386
|
|
package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java
CHANGED
|
@@ -3,13 +3,14 @@ package com.swmansion.reanimated.layoutReanimation;
|
|
|
3
3
|
import com.facebook.jni.HybridData;
|
|
4
4
|
import com.facebook.proguard.annotations.DoNotStrip;
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.soloader.SoLoader;
|
|
6
7
|
import com.swmansion.reanimated.ReanimatedModule;
|
|
7
8
|
import java.lang.ref.WeakReference;
|
|
8
9
|
import java.util.Map;
|
|
9
10
|
|
|
10
11
|
public class LayoutAnimations {
|
|
11
12
|
static {
|
|
12
|
-
|
|
13
|
+
SoLoader.loadLibrary("reanimated");
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
@DoNotStrip
|