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
|
@@ -25,7 +25,12 @@ void EventHandlerRegistry::unregisterEventHandler(unsigned long id) {
|
|
|
25
25
|
void EventHandlerRegistry::processEvent(
|
|
26
26
|
jsi::Runtime &rt,
|
|
27
27
|
std::string eventName,
|
|
28
|
-
|
|
28
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
|
+
jsi::Value &eventPayload
|
|
30
|
+
#else
|
|
31
|
+
std::string eventPayload
|
|
32
|
+
#endif
|
|
33
|
+
/**/) {
|
|
29
34
|
std::vector<std::shared_ptr<WorkletEventHandler>> handlersForEvent;
|
|
30
35
|
{
|
|
31
36
|
const std::lock_guard<std::mutex> lock(instanceMutex);
|
|
@@ -36,6 +41,13 @@ void EventHandlerRegistry::processEvent(
|
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
}
|
|
44
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
45
|
+
eventPayload.asObject(rt).setProperty(
|
|
46
|
+
rt, "eventName", jsi::String::createFromUtf8(rt, eventName));
|
|
47
|
+
for (auto handler : handlersForEvent) {
|
|
48
|
+
handler->process(rt, eventPayload);
|
|
49
|
+
}
|
|
50
|
+
#else
|
|
39
51
|
// We receive here a JS Map with JSON as a value of NativeMap key
|
|
40
52
|
// { NativeMap: { "jsonProp": "json value" } }
|
|
41
53
|
// So we need to extract only JSON part
|
|
@@ -57,6 +69,7 @@ void EventHandlerRegistry::processEvent(
|
|
|
57
69
|
for (auto handler : handlersForEvent) {
|
|
58
70
|
handler->process(rt, eventObject);
|
|
59
71
|
}
|
|
72
|
+
#endif
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
bool EventHandlerRegistry::isAnyHandlerWaitingForEvent(std::string eventName) {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#include "NewestShadowNodesRegistry.h"
|
|
4
|
+
|
|
5
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
6
|
+
#include <react/renderer/core/ShadowNodeFragment.h>
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
namespace reanimated {
|
|
11
|
+
|
|
12
|
+
void NewestShadowNodesRegistry::set(
|
|
13
|
+
ShadowNode::Shared shadowNode,
|
|
14
|
+
Tag parentTag) {
|
|
15
|
+
map_[shadowNode->getTag()] = std::make_pair(shadowNode, parentTag);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
bool NewestShadowNodesRegistry::has(
|
|
19
|
+
const ShadowNode::Shared &shadowNode) const {
|
|
20
|
+
return map_.find(shadowNode->getTag()) != map_.cend();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ShadowNode::Shared NewestShadowNodesRegistry::get(Tag tag) const {
|
|
24
|
+
const auto it = map_.find(tag);
|
|
25
|
+
return it != map_.cend() ? it->second.first : nullptr;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void NewestShadowNodesRegistry::update(ShadowNode::Shared shadowNode) {
|
|
29
|
+
const auto it = map_.find(shadowNode->getTag());
|
|
30
|
+
react_native_assert(it != map_.cend());
|
|
31
|
+
it->second.first = shadowNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void NewestShadowNodesRegistry::remove(Tag tag) {
|
|
35
|
+
if (map_.find(tag) == map_.cend()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
auto shadowNode = map_[tag].first;
|
|
40
|
+
|
|
41
|
+
while (shadowNode != nullptr) {
|
|
42
|
+
bool hasAnyChildInMap = false;
|
|
43
|
+
for (const auto &child : shadowNode->getChildren()) {
|
|
44
|
+
if (has(child)) {
|
|
45
|
+
hasAnyChildInMap = true;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (hasAnyChildInMap) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
auto it = map_.find(shadowNode->getTag());
|
|
55
|
+
Tag parentTag = it->second.second;
|
|
56
|
+
map_.erase(it);
|
|
57
|
+
|
|
58
|
+
shadowNode = map_[parentTag].first;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
std::lock_guard<std::mutex> NewestShadowNodesRegistry::createLock() const {
|
|
63
|
+
return std::lock_guard<std::mutex>(mutex_);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
} // namespace reanimated
|
|
67
|
+
|
|
68
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#include <cxxabi.h>
|
|
2
|
+
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#include <react/renderer/uimanager/primitives.h>
|
|
5
|
+
#endif
|
|
6
|
+
|
|
2
7
|
#include "FrozenObject.h"
|
|
3
8
|
#include "MutableValue.h"
|
|
4
9
|
#include "MutableValueSetterProxy.h"
|
|
@@ -64,7 +69,7 @@ void ShareableValue::adapt(
|
|
|
64
69
|
jsi::Object hiddenProperty = hiddenValue.asObject(rt);
|
|
65
70
|
if (hiddenProperty.isHostObject<FrozenObject>(rt)) {
|
|
66
71
|
type = ValueType::FrozenObjectType;
|
|
67
|
-
if (object.hasProperty(rt, "
|
|
72
|
+
if (object.hasProperty(rt, "__workletHash") && object.isFunction(rt)) {
|
|
68
73
|
type = ValueType::WorkletFunctionType;
|
|
69
74
|
}
|
|
70
75
|
valueContainer = std::make_unique<FrozenObjectWrapper>(
|
|
@@ -99,7 +104,7 @@ void ShareableValue::adapt(
|
|
|
99
104
|
} else if (value.isObject()) {
|
|
100
105
|
auto object = value.asObject(rt);
|
|
101
106
|
if (object.isFunction(rt)) {
|
|
102
|
-
if (object.getProperty(rt, "
|
|
107
|
+
if (object.getProperty(rt, "__workletHash").isUndefined()) {
|
|
103
108
|
// not a worklet, we treat this as a host function
|
|
104
109
|
type = ValueType::HostFunctionType;
|
|
105
110
|
containsHostFunction = true;
|
|
@@ -157,6 +162,13 @@ void ShareableValue::adapt(
|
|
|
157
162
|
valueContainer =
|
|
158
163
|
std::make_unique<RemoteObjectWrapper>(std::make_shared<RemoteObject>(
|
|
159
164
|
rt, object, runtimeManager, runtimeManager->scheduler));
|
|
165
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
166
|
+
} else if (object.isHostObject<ShadowNodeWrapper>(rt)) {
|
|
167
|
+
type = ValueType::ShadowNodeType;
|
|
168
|
+
auto shadowNode = object.getHostObject<ShadowNodeWrapper>(rt)->shadowNode;
|
|
169
|
+
valueContainer = std::make_unique<ShadowNodeValueWrapper>(shadowNode);
|
|
170
|
+
adaptCache(rt, value);
|
|
171
|
+
#endif
|
|
160
172
|
} else {
|
|
161
173
|
// create frozen object based on a copy of a given object
|
|
162
174
|
type = ValueType::FrozenObjectType;
|
|
@@ -278,6 +290,12 @@ jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) {
|
|
|
278
290
|
auto &mutableObject = ValueWrapper::asMutableValue(valueContainer);
|
|
279
291
|
return createHost(rt, mutableObject);
|
|
280
292
|
}
|
|
293
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
294
|
+
case ValueType::ShadowNodeType: {
|
|
295
|
+
auto &shadowNode = ValueWrapper::asShadowNode(valueContainer);
|
|
296
|
+
return createHost(rt, std::make_shared<ShadowNodeWrapper>(shadowNode));
|
|
297
|
+
}
|
|
298
|
+
#endif
|
|
281
299
|
case ValueType::HostFunctionType: {
|
|
282
300
|
auto hostFunctionWrapper =
|
|
283
301
|
ValueWrapper::asHostFunctionWrapper(valueContainer);
|
|
@@ -25,7 +25,11 @@ void Mapper::execute(jsi::Runtime &rt) {
|
|
|
25
25
|
if (optimalizationLvl == 0) {
|
|
26
26
|
mapper->callWithThis(rt, *mapper); // call styleUpdater
|
|
27
27
|
} else {
|
|
28
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
|
+
jsi::Value newStyle = userUpdater->call(rt).asObject(rt);
|
|
30
|
+
#else
|
|
28
31
|
jsi::Object newStyle = userUpdater->call(rt).asObject(rt);
|
|
32
|
+
#endif
|
|
29
33
|
auto jsViewDescriptorArray = viewDescriptors->getValue(rt)
|
|
30
34
|
.getObject(rt)
|
|
31
35
|
.getProperty(rt, "value")
|
|
@@ -34,11 +38,16 @@ void Mapper::execute(jsi::Runtime &rt) {
|
|
|
34
38
|
for (int i = 0; i < jsViewDescriptorArray.length(rt); ++i) {
|
|
35
39
|
auto jsViewDescriptor =
|
|
36
40
|
jsViewDescriptorArray.getValueAtIndex(rt, i).getObject(rt);
|
|
37
|
-
|
|
41
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
42
|
+
updateProps(
|
|
43
|
+
rt, jsViewDescriptor.getProperty(rt, "shadowNodeWrapper"), newStyle);
|
|
44
|
+
#else
|
|
45
|
+
updateProps(
|
|
38
46
|
rt,
|
|
39
47
|
static_cast<int>(jsViewDescriptor.getProperty(rt, "tag").asNumber()),
|
|
40
48
|
jsViewDescriptor.getProperty(rt, "name"),
|
|
41
49
|
newStyle);
|
|
50
|
+
#endif
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
}
|
|
@@ -52,10 +61,20 @@ void Mapper::enableFastMode(
|
|
|
52
61
|
}
|
|
53
62
|
viewDescriptors = jsViewDescriptors;
|
|
54
63
|
this->optimalizationLvl = optimalizationLvl;
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
65
|
+
updateProps = [this](
|
|
66
|
+
jsi::Runtime &rt,
|
|
67
|
+
const jsi::Value &shadowNodeValue,
|
|
68
|
+
const jsi::Value &props) {
|
|
69
|
+
this->module->updateProps(rt, shadowNodeValue, props);
|
|
70
|
+
};
|
|
71
|
+
#else
|
|
72
|
+
// TODO: don't get public field, instead call this->module->updateProps
|
|
73
|
+
updateProps = module->updatePropsFunction;
|
|
74
|
+
#endif
|
|
75
|
+
jsi::Runtime &rt = *module->runtime;
|
|
57
76
|
userUpdater = std::make_shared<jsi::Function>(
|
|
58
|
-
updater->getValue(
|
|
77
|
+
updater->getValue(rt).asObject(rt).asFunction(rt));
|
|
59
78
|
}
|
|
60
79
|
|
|
61
80
|
Mapper::~Mapper() {
|
|
@@ -31,20 +31,6 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
31
31
|
rt, "_LABEL", jsi::String::createFromAscii(rt, label));
|
|
32
32
|
|
|
33
33
|
jsi::Object dummyGlobal(rt);
|
|
34
|
-
auto dummyFunction = [](jsi::Runtime &rt,
|
|
35
|
-
const jsi::Value &thisValue,
|
|
36
|
-
const jsi::Value *args,
|
|
37
|
-
size_t count) -> jsi::Value {
|
|
38
|
-
return jsi::Value::undefined();
|
|
39
|
-
};
|
|
40
|
-
jsi::Function __reanimatedWorkletInit = jsi::Function::createFromHostFunction(
|
|
41
|
-
rt,
|
|
42
|
-
jsi::PropNameID::forAscii(rt, "__reanimatedWorkletInit"),
|
|
43
|
-
1,
|
|
44
|
-
dummyFunction);
|
|
45
|
-
|
|
46
|
-
dummyGlobal.setProperty(
|
|
47
|
-
rt, "__reanimatedWorkletInit", __reanimatedWorkletInit);
|
|
48
34
|
rt.global().setProperty(rt, "global", dummyGlobal);
|
|
49
35
|
|
|
50
36
|
rt.global().setProperty(rt, "jsThis", jsi::Value::undefined());
|
|
@@ -104,10 +90,15 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
104
90
|
|
|
105
91
|
void RuntimeDecorator::decorateUIRuntime(
|
|
106
92
|
jsi::Runtime &rt,
|
|
107
|
-
const
|
|
108
|
-
const
|
|
93
|
+
const UpdatePropsFunction updateProps,
|
|
94
|
+
const MeasureFunction measure,
|
|
95
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
96
|
+
const RemoveShadowNodeFromRegistryFunction removeShadowNodeFromRegistry,
|
|
97
|
+
const DispatchCommandFunction dispatchCommand,
|
|
98
|
+
#else
|
|
109
99
|
const ScrollToFunction scrollTo,
|
|
110
|
-
|
|
100
|
+
#endif
|
|
101
|
+
const RequestFrameFunction requestFrame,
|
|
111
102
|
const TimeProviderFunction getCurrentTime,
|
|
112
103
|
const RegisterSensorFunction registerSensor,
|
|
113
104
|
const UnregisterSensorFunction unregisterSensor,
|
|
@@ -116,42 +107,79 @@ void RuntimeDecorator::decorateUIRuntime(
|
|
|
116
107
|
RuntimeDecorator::decorateRuntime(rt, "UI");
|
|
117
108
|
rt.global().setProperty(rt, "_UI", jsi::Value(true));
|
|
118
109
|
|
|
119
|
-
|
|
110
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
111
|
+
auto clb = [updateProps](
|
|
120
112
|
jsi::Runtime &rt,
|
|
121
113
|
const jsi::Value &thisValue,
|
|
122
114
|
const jsi::Value *args,
|
|
123
115
|
const size_t count) -> jsi::Value {
|
|
124
|
-
|
|
125
|
-
const jsi::Value *viewName = &args[1];
|
|
126
|
-
const auto params = args[2].asObject(rt);
|
|
127
|
-
updater(rt, viewTag, *viewName, params);
|
|
116
|
+
updateProps(rt, args[0], args[1]);
|
|
128
117
|
return jsi::Value::undefined();
|
|
129
118
|
};
|
|
130
|
-
jsi::Value
|
|
131
|
-
rt, jsi::PropNameID::forAscii(rt, "
|
|
132
|
-
rt.global().setProperty(rt, "
|
|
119
|
+
jsi::Value updatePropsHostFunction = jsi::Function::createFromHostFunction(
|
|
120
|
+
rt, jsi::PropNameID::forAscii(rt, "_updatePropsFabric"), 2, clb);
|
|
121
|
+
rt.global().setProperty(rt, "_updatePropsFabric", updatePropsHostFunction);
|
|
133
122
|
|
|
134
|
-
auto
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
std::make_shared<jsi::Function>(args[0].asObject(rt).asFunction(rt));
|
|
141
|
-
requestFrame([&rt, fun](double timestampMs) {
|
|
142
|
-
fun->call(rt, jsi::Value(timestampMs));
|
|
143
|
-
});
|
|
123
|
+
auto _removeShadowNodeFromRegistry = [removeShadowNodeFromRegistry](
|
|
124
|
+
jsi::Runtime &rt,
|
|
125
|
+
const jsi::Value &thisValue,
|
|
126
|
+
const jsi::Value *args,
|
|
127
|
+
const size_t count) -> jsi::Value {
|
|
128
|
+
removeShadowNodeFromRegistry(rt, args[0]);
|
|
144
129
|
return jsi::Value::undefined();
|
|
145
130
|
};
|
|
146
|
-
jsi::Value
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
jsi::Value removeShadowNodeFromRegistryHostFunction =
|
|
132
|
+
jsi::Function::createFromHostFunction(
|
|
133
|
+
rt,
|
|
134
|
+
jsi::PropNameID::forAscii(rt, "_removeShadowNodeFromRegistry"),
|
|
135
|
+
2,
|
|
136
|
+
_removeShadowNodeFromRegistry);
|
|
137
|
+
rt.global().setProperty(
|
|
138
|
+
rt,
|
|
139
|
+
"_removeShadowNodeFromRegistry",
|
|
140
|
+
removeShadowNodeFromRegistryHostFunction);
|
|
149
141
|
|
|
150
|
-
auto clb3 = [
|
|
142
|
+
auto clb3 = [dispatchCommand](
|
|
151
143
|
jsi::Runtime &rt,
|
|
152
144
|
const jsi::Value &thisValue,
|
|
153
145
|
const jsi::Value *args,
|
|
154
146
|
const size_t count) -> jsi::Value {
|
|
147
|
+
dispatchCommand(rt, args[0], args[1], args[2]);
|
|
148
|
+
return jsi::Value::undefined();
|
|
149
|
+
};
|
|
150
|
+
jsi::Value dispatchCommandHostFunction =
|
|
151
|
+
jsi::Function::createFromHostFunction(
|
|
152
|
+
rt, jsi::PropNameID::forAscii(rt, "_dispatchCommand"), 3, clb3);
|
|
153
|
+
rt.global().setProperty(rt, "_dispatchCommand", dispatchCommandHostFunction);
|
|
154
|
+
|
|
155
|
+
auto _measure = [measure](
|
|
156
|
+
jsi::Runtime &rt,
|
|
157
|
+
const jsi::Value &thisValue,
|
|
158
|
+
const jsi::Value *args,
|
|
159
|
+
const size_t count) -> jsi::Value {
|
|
160
|
+
return measure(rt, args[0]);
|
|
161
|
+
};
|
|
162
|
+
#else
|
|
163
|
+
auto clb = [updateProps](
|
|
164
|
+
jsi::Runtime &rt,
|
|
165
|
+
const jsi::Value &thisValue,
|
|
166
|
+
const jsi::Value *args,
|
|
167
|
+
const size_t count) -> jsi::Value {
|
|
168
|
+
const auto viewTag = args[0].asNumber();
|
|
169
|
+
const jsi::Value *viewName = &args[1];
|
|
170
|
+
const auto params = args[2].asObject(rt);
|
|
171
|
+
updateProps(rt, viewTag, *viewName, params);
|
|
172
|
+
return jsi::Value::undefined();
|
|
173
|
+
};
|
|
174
|
+
jsi::Value updatePropsHostFunction = jsi::Function::createFromHostFunction(
|
|
175
|
+
rt, jsi::PropNameID::forAscii(rt, "_updatePropsPaper"), 3, clb);
|
|
176
|
+
rt.global().setProperty(rt, "_updatePropsPaper", updatePropsHostFunction);
|
|
177
|
+
|
|
178
|
+
auto _scrollTo = [scrollTo](
|
|
179
|
+
jsi::Runtime &rt,
|
|
180
|
+
const jsi::Value &thisValue,
|
|
181
|
+
const jsi::Value *args,
|
|
182
|
+
const size_t count) -> jsi::Value {
|
|
155
183
|
int viewTag = static_cast<int>(args[0].asNumber());
|
|
156
184
|
double x = args[1].asNumber();
|
|
157
185
|
double y = args[2].asNumber();
|
|
@@ -160,14 +188,14 @@ void RuntimeDecorator::decorateUIRuntime(
|
|
|
160
188
|
return jsi::Value::undefined();
|
|
161
189
|
};
|
|
162
190
|
jsi::Value scrollToFunction = jsi::Function::createFromHostFunction(
|
|
163
|
-
rt, jsi::PropNameID::forAscii(rt, "_scrollTo"), 4,
|
|
191
|
+
rt, jsi::PropNameID::forAscii(rt, "_scrollTo"), 4, _scrollTo);
|
|
164
192
|
rt.global().setProperty(rt, "_scrollTo", scrollToFunction);
|
|
165
193
|
|
|
166
|
-
auto
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
auto _measure = [measure](
|
|
195
|
+
jsi::Runtime &rt,
|
|
196
|
+
const jsi::Value &thisValue,
|
|
197
|
+
const jsi::Value *args,
|
|
198
|
+
const size_t count) -> jsi::Value {
|
|
171
199
|
int viewTag = static_cast<int>(args[0].asNumber());
|
|
172
200
|
auto result = measure(viewTag);
|
|
173
201
|
jsi::Object resultObject(rt);
|
|
@@ -176,10 +204,28 @@ void RuntimeDecorator::decorateUIRuntime(
|
|
|
176
204
|
}
|
|
177
205
|
return resultObject;
|
|
178
206
|
};
|
|
207
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
208
|
+
|
|
179
209
|
jsi::Value measureFunction = jsi::Function::createFromHostFunction(
|
|
180
|
-
rt, jsi::PropNameID::forAscii(rt, "_measure"), 1,
|
|
210
|
+
rt, jsi::PropNameID::forAscii(rt, "_measure"), 1, _measure);
|
|
181
211
|
rt.global().setProperty(rt, "_measure", measureFunction);
|
|
182
212
|
|
|
213
|
+
auto clb2 = [requestFrame](
|
|
214
|
+
jsi::Runtime &rt,
|
|
215
|
+
const jsi::Value &thisValue,
|
|
216
|
+
const jsi::Value *args,
|
|
217
|
+
const size_t count) -> jsi::Value {
|
|
218
|
+
auto fun =
|
|
219
|
+
std::make_shared<jsi::Function>(args[0].asObject(rt).asFunction(rt));
|
|
220
|
+
requestFrame([&rt, fun](double timestampMs) {
|
|
221
|
+
fun->call(rt, jsi::Value(timestampMs));
|
|
222
|
+
});
|
|
223
|
+
return jsi::Value::undefined();
|
|
224
|
+
};
|
|
225
|
+
jsi::Value requestAnimationFrame = jsi::Function::createFromHostFunction(
|
|
226
|
+
rt, jsi::PropNameID::forAscii(rt, "requestAnimationFrame"), 1, clb2);
|
|
227
|
+
rt.global().setProperty(rt, "requestAnimationFrame", requestAnimationFrame);
|
|
228
|
+
|
|
183
229
|
auto clb6 = [getCurrentTime](
|
|
184
230
|
jsi::Runtime &rt,
|
|
185
231
|
const jsi::Value &thisValue,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
+
|
|
4
|
+
#ifdef ANDROID
|
|
5
|
+
#include <Binding.h>
|
|
6
|
+
#include <fbjni/fbjni.h>
|
|
7
|
+
#endif
|
|
8
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
9
|
+
|
|
10
|
+
#include <memory>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
using namespace facebook::react;
|
|
14
|
+
|
|
15
|
+
namespace reanimated {
|
|
16
|
+
|
|
17
|
+
struct UIManagerBindingPublic {
|
|
18
|
+
void *vtable;
|
|
19
|
+
std::shared_ptr<UIManager> uiManager_;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
struct UIManagerPublic {
|
|
23
|
+
void *vtable;
|
|
24
|
+
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
|
|
25
|
+
UIManagerDelegate *delegate_;
|
|
26
|
+
UIManagerAnimationDelegate *animationDelegate_{nullptr};
|
|
27
|
+
RuntimeExecutor const runtimeExecutor_{};
|
|
28
|
+
ShadowTreeRegistry shadowTreeRegistry_{};
|
|
29
|
+
BackgroundExecutor const backgroundExecutor_{};
|
|
30
|
+
ContextContainer::Shared contextContainer_;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
#ifdef ANDROID
|
|
34
|
+
struct BindingPublic : public jni::HybridClass<Binding>,
|
|
35
|
+
public SchedulerDelegate,
|
|
36
|
+
public LayoutAnimationStatusDelegate {
|
|
37
|
+
butter::shared_mutex installMutex_;
|
|
38
|
+
std::shared_ptr<FabricMountingManager> mountingManager_;
|
|
39
|
+
std::shared_ptr<facebook::react::Scheduler> scheduler_;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
struct SchedulerPublic : public UIManagerDelegate {
|
|
43
|
+
SchedulerDelegate *delegate_;
|
|
44
|
+
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
|
|
45
|
+
RuntimeExecutor runtimeExecutor_;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding);
|
|
49
|
+
#endif
|
|
50
|
+
|
|
51
|
+
std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
|
|
52
|
+
const UIManager *uiManager);
|
|
53
|
+
|
|
54
|
+
void UIManager_dispatchCommand(
|
|
55
|
+
const std::shared_ptr<UIManager> &uiManager,
|
|
56
|
+
const ShadowNode::Shared &shadowNode,
|
|
57
|
+
std::string const &commandName,
|
|
58
|
+
folly::dynamic const &args);
|
|
59
|
+
|
|
60
|
+
LayoutMetrics UIManager_getRelativeLayoutMetrics(
|
|
61
|
+
const std::shared_ptr<UIManager> &uiManager,
|
|
62
|
+
ShadowNode const &shadowNode,
|
|
63
|
+
ShadowNode const *ancestorShadowNode,
|
|
64
|
+
LayoutableShadowNode::LayoutInspectingPolicy policy);
|
|
65
|
+
|
|
66
|
+
SharedShadowNode UIManager_cloneNode(
|
|
67
|
+
const UIManager *uiManager,
|
|
68
|
+
const ShadowNode::Shared &shadowNode,
|
|
69
|
+
const SharedShadowNodeSharedList &children = nullptr,
|
|
70
|
+
const RawProps *rawProps = nullptr);
|
|
71
|
+
|
|
72
|
+
void UIManager_appendChild(
|
|
73
|
+
const ShadowNode::Shared &parentShadowNode,
|
|
74
|
+
const ShadowNode::Shared &childShadowNode);
|
|
75
|
+
|
|
76
|
+
} // namespace reanimated
|
|
77
|
+
|
|
78
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
+
|
|
4
|
+
#include <ReactCommon/RuntimeExecutor.h>
|
|
5
|
+
#include <jsi/jsi.h>
|
|
6
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
7
|
+
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
8
|
+
#include <react/renderer/uimanager/primitives.h>
|
|
9
|
+
|
|
10
|
+
#include <memory>
|
|
11
|
+
|
|
12
|
+
#include "NewestShadowNodesRegistry.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
using namespace react;
|
|
16
|
+
|
|
17
|
+
namespace reanimated {
|
|
18
|
+
|
|
19
|
+
class ReanimatedUIManagerBinding : public UIManagerBinding {
|
|
20
|
+
public:
|
|
21
|
+
static void createAndInstallIfNeeded(
|
|
22
|
+
jsi::Runtime &runtime,
|
|
23
|
+
RuntimeExecutor const &runtimeExecutor,
|
|
24
|
+
std::shared_ptr<UIManager> const &uiManager,
|
|
25
|
+
std::shared_ptr<NewestShadowNodesRegistry> const
|
|
26
|
+
&newestShadowNodesRegistry);
|
|
27
|
+
|
|
28
|
+
ReanimatedUIManagerBinding(
|
|
29
|
+
std::shared_ptr<UIManager> uiManager,
|
|
30
|
+
RuntimeExecutor runtimeExecutor,
|
|
31
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry);
|
|
32
|
+
|
|
33
|
+
~ReanimatedUIManagerBinding();
|
|
34
|
+
|
|
35
|
+
void invalidate() const;
|
|
36
|
+
|
|
37
|
+
jsi::Value get(jsi::Runtime &runtime, jsi::PropNameID const &name) override;
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
std::shared_ptr<UIManager> uiManager_;
|
|
41
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace reanimated
|
|
45
|
+
|
|
46
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
5
|
+
#include "NewestShadowNodesRegistry.h"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
4
8
|
#include <memory>
|
|
5
9
|
#include <string>
|
|
10
|
+
#include <unordered_set>
|
|
11
|
+
#include <utility>
|
|
6
12
|
#include <vector>
|
|
7
13
|
|
|
8
14
|
#include "AnimatedSensorModule.h"
|
|
@@ -34,8 +40,12 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
34
40
|
std::shared_ptr<Scheduler> scheduler,
|
|
35
41
|
std::shared_ptr<jsi::Runtime> rt,
|
|
36
42
|
std::shared_ptr<ErrorHandler> errorHandler,
|
|
43
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
44
|
+
// nothing
|
|
45
|
+
#else
|
|
37
46
|
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
38
47
|
propObtainer,
|
|
48
|
+
#endif
|
|
39
49
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
40
50
|
PlatformDepMethodsHolder platformDepMethodsHolder);
|
|
41
51
|
|
|
@@ -77,11 +87,48 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
77
87
|
const jsi::Value &nativeProps) override;
|
|
78
88
|
|
|
79
89
|
void onRender(double timestampMs);
|
|
90
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
91
|
+
void onEvent(std::string eventName, jsi::Value &&eventAsString);
|
|
92
|
+
#else
|
|
80
93
|
void onEvent(std::string eventName, std::string eventAsString);
|
|
94
|
+
#endif
|
|
81
95
|
bool isAnyHandlerWaitingForEvent(std::string eventName);
|
|
82
96
|
|
|
83
97
|
void maybeRequestRender();
|
|
84
|
-
|
|
98
|
+
UpdatePropsFunction updatePropsFunction;
|
|
99
|
+
|
|
100
|
+
bool handleEvent(
|
|
101
|
+
const std::string &eventName,
|
|
102
|
+
jsi::Value &&payload,
|
|
103
|
+
double currentTime);
|
|
104
|
+
|
|
105
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
106
|
+
bool handleRawEvent(const RawEvent &rawEvent, double currentTime);
|
|
107
|
+
|
|
108
|
+
void updateProps(
|
|
109
|
+
jsi::Runtime &rt,
|
|
110
|
+
const jsi::Value &shadowNodeValue,
|
|
111
|
+
const jsi::Value &props);
|
|
112
|
+
|
|
113
|
+
void removeShadowNodeFromRegistry(
|
|
114
|
+
jsi::Runtime &rt,
|
|
115
|
+
const jsi::Value &shadowNodeValue);
|
|
116
|
+
|
|
117
|
+
void performOperations();
|
|
118
|
+
|
|
119
|
+
void dispatchCommand(
|
|
120
|
+
jsi::Runtime &rt,
|
|
121
|
+
const jsi::Value &shadowNodeValue,
|
|
122
|
+
const jsi::Value &commandNameValue,
|
|
123
|
+
const jsi::Value &argsValue);
|
|
124
|
+
|
|
125
|
+
jsi::Value measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue);
|
|
126
|
+
|
|
127
|
+
void setUIManager(std::shared_ptr<UIManager> uiManager);
|
|
128
|
+
|
|
129
|
+
void setNewestShadowNodesRegistry(
|
|
130
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry);
|
|
131
|
+
#endif
|
|
85
132
|
|
|
86
133
|
jsi::Value registerSensor(
|
|
87
134
|
jsi::Runtime &rt,
|
|
@@ -91,6 +138,10 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
91
138
|
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
|
|
92
139
|
|
|
93
140
|
private:
|
|
141
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
142
|
+
bool isThereAnyLayoutProp(jsi::Runtime &rt, const jsi::Value &props);
|
|
143
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
144
|
+
|
|
94
145
|
std::shared_ptr<MapperRegistry> mapperRegistry;
|
|
95
146
|
std::shared_ptr<EventHandlerRegistry> eventHandlerRegistry;
|
|
96
147
|
std::function<void(FrameCallback &, jsi::Runtime &)> requestRender;
|
|
@@ -103,6 +154,25 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
103
154
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy;
|
|
104
155
|
AnimatedSensorModule animatedSensorModule;
|
|
105
156
|
ConfigurePropsFunction configurePropsPlatformFunction;
|
|
157
|
+
|
|
158
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
159
|
+
SynchronouslyUpdateUIPropsFunction synchronouslyUpdateUIPropsFunction;
|
|
160
|
+
|
|
161
|
+
std::shared_ptr<UIManager> uiManager_;
|
|
162
|
+
|
|
163
|
+
// After app reload, surfaceId on iOS is still 1 but on Android it's 11.
|
|
164
|
+
// We can store surfaceId of the most recent ShadowNode as a workaround.
|
|
165
|
+
SurfaceId surfaceId_ = -1;
|
|
166
|
+
|
|
167
|
+
std::vector<std::pair<ShadowNode::Shared, std::unique_ptr<jsi::Value>>>
|
|
168
|
+
operationsInBatch_; // TODO: refactor std::pair to custom struct
|
|
169
|
+
|
|
170
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
171
|
+
|
|
172
|
+
std::vector<Tag> tagsToRemove_; // from newestShadowNodesRegistry_
|
|
173
|
+
#endif
|
|
174
|
+
|
|
175
|
+
std::unordered_set<std::string> nativePropNames_; // filled by configureProps
|
|
106
176
|
};
|
|
107
177
|
|
|
108
178
|
} // namespace reanimated
|
|
@@ -27,10 +27,18 @@ class EventHandlerRegistry {
|
|
|
27
27
|
void registerEventHandler(std::shared_ptr<WorkletEventHandler> eventHandler);
|
|
28
28
|
void unregisterEventHandler(unsigned long id);
|
|
29
29
|
|
|
30
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
31
|
+
void processEvent(
|
|
32
|
+
jsi::Runtime &rt,
|
|
33
|
+
std::string eventName,
|
|
34
|
+
jsi::Value &eventPayload);
|
|
35
|
+
#else
|
|
30
36
|
void processEvent(
|
|
31
37
|
jsi::Runtime &rt,
|
|
32
38
|
std::string eventName,
|
|
33
39
|
std::string eventPayload);
|
|
40
|
+
#endif
|
|
41
|
+
|
|
34
42
|
bool isAnyHandlerWaitingForEvent(std::string eventName);
|
|
35
43
|
};
|
|
36
44
|
|