react-native-reanimated 3.0.2 → 3.1.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.h +1 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
- package/Common/cpp/SharedItems/Shareables.h +22 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
- package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
- package/RNReanimated.podspec +5 -2
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +18 -10
- package/android/src/main/cpp/NativeProxy.cpp +316 -337
- package/android/src/main/cpp/NativeProxy.h +53 -11
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
- package/ios/REANodesManager.h +1 -0
- package/ios/REANodesManager.mm +30 -4
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.mm +4 -1
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.mm +1 -1
- package/ios/native/REAInitializer.mm +1 -1
- package/ios/native/REAMessageThread.mm +2 -2
- package/lib/commonjs/Animated.js +0 -8
- package/lib/commonjs/Animated.js.map +1 -1
- package/lib/commonjs/ConfigHelper.js +8 -19
- package/lib/commonjs/ConfigHelper.js.map +1 -1
- package/lib/commonjs/createAnimatedComponent.js +20 -158
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/index.js +0 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +0 -7
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/reanimated2/Bezier.js +14 -34
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +60 -132
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/Easing.js +81 -34
- package/lib/commonjs/reanimated2/Easing.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
- package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/decay.js +7 -18
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -11
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/index.js +0 -8
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/spring.js +11 -23
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/timing.js +0 -11
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +11 -41
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +16 -23
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Image.js +0 -4
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
- package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Text.js +0 -4
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
- package/lib/commonjs/reanimated2/component/View.js +0 -4
- package/lib/commonjs/reanimated2/component/View.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +6 -48
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +3 -14
- package/lib/commonjs/reanimated2/errors.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -12
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +8 -39
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +0 -26
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +21 -43
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolation.js +14 -29
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +11 -44
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +26 -32
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +5 -15
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +2 -28
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/shareables.js +92 -49
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +42 -46
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +0 -5
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +6 -21
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/commonjs/setAndForwardRef.js +3 -3
- package/lib/commonjs/setAndForwardRef.js.map +1 -1
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +9 -15
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +20 -139
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js +14 -33
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +59 -109
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +37 -33
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeMethods.js +8 -15
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +12 -10
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js +3 -5
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/decay.js +7 -15
- package/lib/module/reanimated2/animation/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -9
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +6 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +3 -18
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +11 -21
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +0 -8
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +10 -33
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +12 -19
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +0 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -22
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +3 -13
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +3 -3
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/Hooks.js +3 -2
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +8 -21
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +23 -37
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +5 -34
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +13 -28
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +11 -35
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +2 -6
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +3 -9
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +26 -25
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +5 -15
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -19
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +96 -44
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +39 -33
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +0 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +6 -19
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/setAndForwardRef.js +3 -2
- package/lib/module/setAndForwardRef.js.map +1 -1
- package/package.json +46 -40
- package/plugin/.eslintrc.js +7 -0
- package/plugin/README.md +241 -0
- package/plugin/build/plugin.js +714 -0
- package/plugin/build/plugin.js.map +7 -0
- package/plugin/index.js +1 -807
- package/plugin/package.json +23 -0
- package/plugin/src/buildWorkletString.ts +213 -0
- package/plugin/src/commonObjects.ts +60 -0
- package/plugin/src/injectVersion.ts +37 -0
- package/plugin/src/makeWorklet.ts +375 -0
- package/plugin/src/plugin.ts +49 -0
- package/plugin/src/processForCalleesWorklets.ts +106 -0
- package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
- package/plugin/src/processIfWorkletFunction.ts +55 -0
- package/plugin/src/processIfWorkletNode.ts +44 -0
- package/plugin/src/processInlineStylesWarning.ts +129 -0
- package/plugin/src/processWorkletObjectMethod.ts +31 -0
- package/plugin/src/types.ts +15 -0
- package/plugin/src/utils.ts +6 -0
- package/plugin/tsconfig.json +15 -0
- package/plugin/yarn.lock +2193 -0
- package/react-native-reanimated.d.ts +1 -0
- package/scripts/reanimated_utils.rb +2 -2
- package/src/createAnimatedComponent.tsx +2 -3
- package/src/reanimated2/Easing.ts +19 -0
- package/src/reanimated2/NativeMethods.ts +9 -4
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
- package/src/reanimated2/UpdateProps.ts +2 -2
- package/src/reanimated2/animation/decay.ts +7 -1
- package/src/reanimated2/animation/styleAnimation.ts +5 -1
- package/src/reanimated2/core.ts +4 -4
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
- package/src/reanimated2/globals.d.ts +71 -112
- package/src/reanimated2/hook/commonTypes.ts +1 -1
- package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
- package/src/reanimated2/initializers.ts +11 -8
- package/src/reanimated2/jestUtils.ts +0 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
- package/src/reanimated2/js-reanimated/index.ts +1 -1
- package/src/reanimated2/mappers.ts +26 -4
- package/src/reanimated2/mock.ts +1 -0
- package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
- package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
- package/src/reanimated2/shareables.ts +107 -8
- package/src/reanimated2/threads.ts +36 -17
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["findNodeHandle","isChromeDebugger","isWeb","shouldBeUseWeb","getTag","view","isNative","measure","animatedRef","element","viewportOffset","getBoundingClientRect","width","offsetWidth","height","offsetHeight","x","offsetLeft","y","offsetTop","pageX","left","pageY","top","_animatedRef","console","warn","_WORKLET","viewTag","measured","_measure","isNaN","dispatchCommand","commandName","args","shadowNodeWrapper","_dispatchCommand","scrollTo","animated","global","_IS_FABRIC","_scrollTo","_x","_y","setGestureState","handlerTag","newState","_setGestureState"],"sources":["NativeMethods.ts"],"sourcesContent":["/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */\nimport { Component } from 'react';\nimport { findNodeHandle } from 'react-native';\nimport { MeasuredDimensions } from './commonTypes';\nimport { RefObjectFunction } from './hook/commonTypes';\nimport { isChromeDebugger, isWeb, shouldBeUseWeb } from './PlatformChecker';\n\nexport function getTag(\n view: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number {\n return findNodeHandle(view);\n}\n\nconst isNative = !shouldBeUseWeb();\n\nexport let measure: (\n animatedRef: RefObjectFunction<Component>\n) => MeasuredDimensions | null;\n\nif (isWeb()) {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n const element = animatedRef() as unknown as HTMLElement; // TODO: fix typing of animated refs on web\n const viewportOffset = element.getBoundingClientRect();\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop,\n pageX: viewportOffset.left,\n pageY: viewportOffset.top,\n };\n };\n} else if (isChromeDebugger()) {\n measure = (_animatedRef: RefObjectFunction<Component>) => {\n console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');\n return null;\n };\n} else {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n 'worklet';\n if (!_WORKLET) {\n console.warn(\n '[Reanimated] measure() was called from the main JS context. Measure is ' +\n 'only available in the UI runtime. This may also happen if measure() ' +\n 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +\n 'calls the given worklet on the JS runtime during render. If you want to ' +\n 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +\n 'only be called on the UI runtime after the render has been completed.'\n );\n return null;\n }\n\n const viewTag = animatedRef();\n if (viewTag === -1) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n }\n\n const measured = _measure(viewTag);\n if (measured === null) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \\`LayoutMetrics\\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n } else if (measured.x === -1234567) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`\n );\n return null;\n } else if (isNaN(measured.x)) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \\`collapsable={false}\\` on this component.`\n );\n return null;\n } else {\n return measured;\n }\n };\n}\n\nexport function dispatchCommand(\n animatedRef: RefObjectFunction<Component>,\n commandName: string,\n args: Array<unknown>\n): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n return;\n }\n const shadowNodeWrapper = animatedRef();\n _dispatchCommand(shadowNodeWrapper, commandName, args);\n}\n\nexport let scrollTo: (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n) => void;\n\nif (isWeb()) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n const element = animatedRef() as unknown as HTMLElement;\n // @ts-ignore same call as in react-native-web\n element.scrollTo({ x, y, animated });\n };\n} else if (isNative && global._IS_FABRIC) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);\n };\n} else if (isNative) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n const viewTag = animatedRef();\n _scrollTo(viewTag, x, y, animated);\n };\n} else {\n scrollTo = (\n _animatedRef: RefObjectFunction<Component>,\n _x: number,\n _y: number\n ) => {\n // no-op\n };\n}\n\nexport function setGestureState(handlerTag: number, newState: number): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n console.warn(\n '[Reanimated] You can not use setGestureState in non-worklet function.'\n );\n return;\n }\n _setGestureState(handlerTag, newState);\n}\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"names":["findNodeHandle","isChromeDebugger","isWeb","shouldBeUseWeb","getTag","view","isNative","measure","animatedRef","element","viewportOffset","getBoundingClientRect","width","offsetWidth","height","offsetHeight","x","offsetLeft","y","offsetTop","pageX","left","pageY","top","_animatedRef","console","warn","_WORKLET","viewTag","measured","_measure","isNaN","dispatchCommand","commandName","args","shadowNodeWrapper","_dispatchCommand","scrollTo","animated","global","_IS_FABRIC","_scrollTo","_x","_y","setGestureState","handlerTag","newState","_setGestureState"],"sources":["NativeMethods.ts"],"sourcesContent":["/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */\nimport { Component } from 'react';\nimport { findNodeHandle } from 'react-native';\nimport { MeasuredDimensions, ShadowNodeWrapper } from './commonTypes';\nimport { RefObjectFunction } from './hook/commonTypes';\nimport { isChromeDebugger, isWeb, shouldBeUseWeb } from './PlatformChecker';\n\nexport function getTag(\n view: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number {\n return findNodeHandle(view);\n}\n\nconst isNative = !shouldBeUseWeb();\n\nexport let measure: (\n animatedRef: RefObjectFunction<Component>\n) => MeasuredDimensions | null;\n\nif (isWeb()) {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n const element = animatedRef() as unknown as HTMLElement; // TODO: fix typing of animated refs on web\n const viewportOffset = element.getBoundingClientRect();\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop,\n pageX: viewportOffset.left,\n pageY: viewportOffset.top,\n };\n };\n} else if (isChromeDebugger()) {\n measure = (_animatedRef: RefObjectFunction<Component>) => {\n console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');\n return null;\n };\n} else {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n 'worklet';\n if (!_WORKLET) {\n console.warn(\n '[Reanimated] measure() was called from the main JS context. Measure is ' +\n 'only available in the UI runtime. This may also happen if measure() ' +\n 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +\n 'calls the given worklet on the JS runtime during render. If you want to ' +\n 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +\n 'only be called on the UI runtime after the render has been completed.'\n );\n return null;\n }\n\n const viewTag = animatedRef();\n if (viewTag === -1) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n }\n\n const measured = _measure(viewTag);\n if (measured === null) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \\`LayoutMetrics\\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n } else if (measured.x === -1234567) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`\n );\n return null;\n } else if (isNaN(measured.x)) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \\`collapsable={false}\\` on this component.`\n );\n return null;\n } else {\n return measured;\n }\n };\n}\n\nexport function dispatchCommand(\n animatedRef: RefObjectFunction<Component>,\n commandName: string,\n args: Array<unknown>\n): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n return;\n }\n\n // dispatchCommand works only on Fabric where animatedRef returns\n // an object (ShadowNodeWrapper) and not a number\n const shadowNodeWrapper = animatedRef() as ShadowNodeWrapper;\n _dispatchCommand!(shadowNodeWrapper, commandName, args);\n}\n\nexport let scrollTo: (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n) => void;\n\nif (isWeb()) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n const element = animatedRef() as unknown as HTMLElement;\n // @ts-ignore same call as in react-native-web\n element.scrollTo({ x, y, animated });\n };\n} else if (isNative && global._IS_FABRIC) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);\n };\n} else if (isNative) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n // Calling animatedRef on Paper returns a number (nativeTag)\n const viewTag = animatedRef() as number;\n _scrollTo(viewTag, x, y, animated);\n };\n} else {\n scrollTo = (\n _animatedRef: RefObjectFunction<Component>,\n _x: number,\n _y: number\n ) => {\n // no-op\n };\n}\n\nexport function setGestureState(handlerTag: number, newState: number): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n console.warn(\n '[Reanimated] You can not use setGestureState in non-worklet function.'\n );\n return;\n }\n _setGestureState(handlerTag, newState);\n}\n"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,cAAc;AAG7C,SAASC,gBAAgB,EAAEC,KAAK,EAAEC,cAAc,QAAQ,mBAAmB;AAE3E,OAAO,SAASC,MAAMA,CACpBC,IAA2E,EAC5D;EACf,OAAOL,cAAc,CAACK,IAAI,CAAC;AAC7B;AAEA,MAAMC,QAAQ,GAAG,CAACH,cAAc,EAAE;AAElC,OAAO,IAAII,OAEmB;AAE9B,IAAIL,KAAK,EAAE,EAAE;EACXK,OAAO,GAAIC,WAAyC,IAAK;IACvD,MAAMC,OAAO,GAAGD,WAAW,EAA4B,CAAC,CAAC;IACzD,MAAME,cAAc,GAAGD,OAAO,CAACE,qBAAqB,EAAE;IACtD,OAAO;MACLC,KAAK,EAAEH,OAAO,CAACI,WAAW;MAC1BC,MAAM,EAAEL,OAAO,CAACM,YAAY;MAC5BC,CAAC,EAAEP,OAAO,CAACQ,UAAU;MACrBC,CAAC,EAAET,OAAO,CAACU,SAAS;MACpBC,KAAK,EAAEV,cAAc,CAACW,IAAI;MAC1BC,KAAK,EAAEZ,cAAc,CAACa;IACxB,CAAC;EACH,CAAC;AACH,CAAC,MAAM,IAAItB,gBAAgB,EAAE,EAAE;EAC7BM,OAAO,GAAIiB,YAA0C,IAAK;IACxDC,OAAO,CAACC,IAAI,CAAC,6DAA6D,CAAC;IAC3E,OAAO,IAAI;EACb,CAAC;AACH,C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if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { NativeModules } from 'react-native';
|
|
4
|
-
import {
|
|
5
|
+
import { checkCppVersion } from '../platform-specific/checkCppVersion';
|
|
5
6
|
export class NativeReanimated {
|
|
6
7
|
constructor() {
|
|
7
8
|
let native = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8
|
-
|
|
9
9
|
_defineProperty(this, "native", void 0);
|
|
10
|
-
|
|
11
10
|
_defineProperty(this, "InnerNativeModule", void 0);
|
|
12
|
-
|
|
13
11
|
if (global.__reanimatedModuleProxy === undefined && native) {
|
|
14
12
|
const {
|
|
15
13
|
ReanimatedModule
|
|
16
14
|
} = NativeModules;
|
|
17
15
|
ReanimatedModule === null || ReanimatedModule === void 0 ? void 0 : ReanimatedModule.installTurboModule();
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
21
18
|
this.native = native;
|
|
22
|
-
|
|
23
19
|
if (native) {
|
|
24
20
|
if (this.InnerNativeModule === undefined) {
|
|
25
21
|
console.error(`[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\n\
|
|
@@ -28,74 +24,56 @@ export class NativeReanimated {
|
|
|
28
24
|
- running in a brownfield app without manually initializing the native library`);
|
|
29
25
|
return;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
|
-
checkVersion();
|
|
27
|
+
checkCppVersion();
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
installCoreFunctions(callGuard, valueUnpacker) {
|
|
37
31
|
return this.InnerNativeModule.installCoreFunctions(callGuard, valueUnpacker);
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
makeShareableClone(value, shouldPersistRemote) {
|
|
41
34
|
return this.InnerNativeModule.makeShareableClone(value, shouldPersistRemote);
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
makeSynchronizedDataHolder(valueRef) {
|
|
45
37
|
return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
getDataSynchronously(ref) {
|
|
49
40
|
return this.InnerNativeModule.getDataSynchronously(ref);
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
updateDataSynchronously(ref, value) {
|
|
53
43
|
this.InnerNativeModule.updateDataSynchronously(ref, value);
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
scheduleOnUI(shareable) {
|
|
57
46
|
return this.InnerNativeModule.scheduleOnUI(shareable);
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
registerSensor(sensorType, interval, iosReferenceFrame, handler) {
|
|
61
49
|
return this.InnerNativeModule.registerSensor(sensorType, interval, iosReferenceFrame, handler);
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
unregisterSensor(sensorId) {
|
|
65
52
|
return this.InnerNativeModule.unregisterSensor(sensorId);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
registerEventHandler(eventHash, eventHandler) {
|
|
69
55
|
return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
unregisterEventHandler(id) {
|
|
73
58
|
return this.InnerNativeModule.unregisterEventHandler(id);
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
getViewProp(viewTag, propName, callback) {
|
|
77
61
|
return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
configureLayoutAnimation(viewTag, type, sharedTransitionTag, config) {
|
|
81
64
|
this.InnerNativeModule.configureLayoutAnimation(viewTag, type, sharedTransitionTag, config);
|
|
82
65
|
}
|
|
83
|
-
|
|
84
66
|
enableLayoutAnimations(flag) {
|
|
85
67
|
this.InnerNativeModule.enableLayoutAnimations(flag);
|
|
86
68
|
}
|
|
87
|
-
|
|
88
69
|
configureProps(uiProps, nativeProps) {
|
|
89
70
|
this.InnerNativeModule.configureProps(uiProps, nativeProps);
|
|
90
71
|
}
|
|
91
|
-
|
|
92
72
|
subscribeForKeyboardEvents(handler, isStatusBarTranslucent) {
|
|
93
73
|
return this.InnerNativeModule.subscribeForKeyboardEvents(handler, isStatusBarTranslucent);
|
|
94
74
|
}
|
|
95
|
-
|
|
96
75
|
unsubscribeFromKeyboardEvents(listenerId) {
|
|
97
76
|
this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);
|
|
98
77
|
}
|
|
99
|
-
|
|
100
78
|
}
|
|
101
79
|
//# sourceMappingURL=NativeReanimated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","
|
|
1
|
+
{"version":3,"names":["NativeModules","checkCppVersion","NativeReanimated","constructor","native","arguments","length","undefined","_defineProperty","global","__reanimatedModuleProxy","ReanimatedModule","installTurboModule","InnerNativeModule","console","error","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","value","shouldPersistRemote","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","iosReferenceFrame","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","sharedTransitionTag","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","isStatusBarTranslucent","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n ShareableRef,\n ShareableSyncDataHolderRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from '../layoutReanimation';\nimport { checkCppVersion } from '../platform-specific/checkCppVersion';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n if (this.InnerNativeModule === undefined) {\n console.error(\n `[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\\n\\\n - not rebuilding the app after installing or upgrading Reanimated\\n\\\n - trying to run Reanimated on an unsupported platform\\n\\\n - running in a brownfield app without manually initializing the native library`\n );\n return;\n }\n checkCppVersion();\n }\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(\n value: T,\n shouldPersistRemote: boolean\n ): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(\n value,\n shouldPersistRemote\n );\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n iosReferenceFrame: number,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n handler\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: LayoutAnimationType,\n sharedTransitionTag: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\n config\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(\n handler: ShareableRef<number>,\n isStatusBarTranslucent: boolean\n ): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(\n handler,\n isStatusBarTranslucent\n );\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,cAAc;AAW5C,SAASC,eAAe,QAAQ,sCAAsC;AAEtE,OAAO,MAAMC,gBAAgB,CAAC;EAI5BC,WAAWA,C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BA,CACxBrB,OAA6B,EAC7BsB,sBAA+B,EACvB;IACR,OAAO,IAAI,CAAC1C,iBAAiB,CAACyC,0BAA0B,CACtDrB,OAAO,EACPsB,sBAAsB,CACvB;EACH;EAEAC,6BAA6BA,CAACC,UAAkB,EAAQ;IACtD,IAAI,CAAC5C,iBAAiB,CAAC2C,6BAA6B,CAACC,UAAU,CAAC;EAClE;AACF"}
|
|
@@ -2,12 +2,10 @@ import reanimatedJS from '../js-reanimated';
|
|
|
2
2
|
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
3
3
|
import { NativeReanimated } from './NativeReanimated';
|
|
4
4
|
let exportedModule;
|
|
5
|
-
|
|
6
5
|
if (shouldBeUseWeb()) {
|
|
7
6
|
exportedModule = reanimatedJS;
|
|
8
7
|
} else {
|
|
9
8
|
exportedModule = new NativeReanimated();
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
export default exportedModule;
|
|
13
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["reanimatedJS","shouldBeUseWeb","NativeReanimated","exportedModule"],"sources":["index.ts"],"sourcesContent":["import reanimatedJS from '../js-reanimated';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { NativeReanimated } from './NativeReanimated';\n\nlet exportedModule;\nif (shouldBeUseWeb()) {\n exportedModule = reanimatedJS;\n} else {\n exportedModule = new NativeReanimated();\n}\n\nexport default exportedModule as NativeReanimated;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["reanimatedJS","shouldBeUseWeb","NativeReanimated","exportedModule"],"sources":["index.ts"],"sourcesContent":["import reanimatedJS from '../js-reanimated';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { NativeReanimated } from './NativeReanimated';\n\nlet exportedModule;\nif (shouldBeUseWeb()) {\n exportedModule = reanimatedJS;\n} else {\n exportedModule = new NativeReanimated();\n}\n\nexport default exportedModule as NativeReanimated;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,kBAAkB;AAC3C,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,IAAIC,cAAc;AAClB,IAAIF,cAAc,EAAE,EAAE;EACpBE,cAAc,GAAGH,YAAY;AAC/B,CAAC,MAAM;EACLG,cAAc,GAAG,IAAID,gBAAgB,EAAE;AACzC;AAEA,eAAeC,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","shouldBeUseWeb","nativeShouldBeMock"],"sources":["PlatformChecker.ts"],"sourcesContent":["import { Platform } from 'react-native';\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\nexport function isChromeDebugger(): boolean {\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger();\n}\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","shouldBeUseWeb","nativeShouldBeMock"],"sources":["PlatformChecker.ts"],"sourcesContent":["import { Platform } from 'react-native';\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\nexport function isChromeDebugger(): boolean {\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger();\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,MAAMA,CAAA,EAAY;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc;AACrC;AAEA,OAAO,SAASC,gBAAgBA,CAAA,EAAY;EAC1C,OAAO,CAAEC,MAAM,CAASC,kBAAkB,IAAKD,MAAM,CAASE,aAAa;AAC7E;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOT,QAAQ,CAACU,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,OAAOV,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAII,KAAK,EAAE;AAClD;AAEA,OAAO,SAASG,kBAAkBA,CAAA,EAAG;EACnC,OAAOX,MAAM,EAAE,IAAII,gBAAgB,EAAE;AACvC"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { addWhitelistedNativeProps } from '../ConfigHelper';
|
|
2
2
|
export function createAnimatedPropAdapter(adapter, nativeProps) {
|
|
3
|
-
const nativePropsToAdd = {};
|
|
4
|
-
|
|
3
|
+
const nativePropsToAdd = {};
|
|
4
|
+
// eslint-disable-next-line no-unused-expressions
|
|
5
5
|
nativeProps === null || nativeProps === void 0 ? void 0 : nativeProps.forEach(prop => {
|
|
6
6
|
nativePropsToAdd[prop] = true;
|
|
7
7
|
});
|
|
8
8
|
addWhitelistedNativeProps(nativePropsToAdd);
|
|
9
9
|
return adapter;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ADAPTERS
|
|
11
13
|
|
|
12
14
|
export const SVGAdapter = createAnimatedPropAdapter(props => {
|
|
13
15
|
'worklet';
|
|
14
16
|
|
|
15
|
-
const keys = Object.keys(props);
|
|
16
|
-
|
|
17
|
+
const keys = Object.keys(props);
|
|
18
|
+
// transform
|
|
17
19
|
if (keys.includes('transform')) {
|
|
18
20
|
if (Array.isArray(props.transform)) {
|
|
19
21
|
// case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200
|
|
20
22
|
if (props.transform.length !== 6) {
|
|
21
23
|
throw new Error(`invalid transform length of ${props.transform.length}, should be 6`);
|
|
22
24
|
}
|
|
23
|
-
|
|
24
25
|
const transform = props.transform;
|
|
25
26
|
const x = props.x ?? 0;
|
|
26
27
|
const y = props.y ?? 0;
|
|
@@ -40,14 +41,15 @@ export const SVGAdapter = createAnimatedPropAdapter(props => {
|
|
|
40
41
|
translateY: parseFloat(arr[1])
|
|
41
42
|
}];
|
|
42
43
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
44
|
+
}
|
|
45
|
+
// todo: other props
|
|
45
46
|
});
|
|
47
|
+
|
|
46
48
|
export const TextInputAdapter = createAnimatedPropAdapter(props => {
|
|
47
49
|
'worklet';
|
|
48
50
|
|
|
49
|
-
const keys = Object.keys(props);
|
|
50
|
-
|
|
51
|
+
const keys = Object.keys(props);
|
|
52
|
+
// convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878
|
|
51
53
|
if (keys.includes('value')) {
|
|
52
54
|
props.text = props.value;
|
|
53
55
|
delete props.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["addWhitelistedNativeProps","createAnimatedPropAdapter","adapter","nativeProps","nativePropsToAdd","forEach","prop","SVGAdapter","props","keys","Object","includes","Array","isArray","transform","length","Error","x","y","translateX","translateY","arr","replace","split","parseFloat","TextInputAdapter","text","value"],"sources":["PropAdapters.ts"],"sourcesContent":["import { addWhitelistedNativeProps } from '../ConfigHelper';\nimport { AdapterWorkletFunction } from './commonTypes';\n\nexport function createAnimatedPropAdapter(\n adapter: AdapterWorkletFunction,\n nativeProps?: string[]\n): AdapterWorkletFunction {\n const nativePropsToAdd: { [key: string]: boolean } = {};\n // eslint-disable-next-line no-unused-expressions\n nativeProps?.forEach((prop) => {\n nativePropsToAdd[prop] = true;\n });\n addWhitelistedNativeProps(nativePropsToAdd);\n return adapter;\n}\n\n// ADAPTERS\n\nexport const SVGAdapter: AdapterWorkletFunction = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // transform\n if (keys.includes('transform')) {\n if (Array.isArray(props.transform)) {\n // case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200\n if (props.transform.length !== 6) {\n throw new Error(\n `invalid transform length of ${props.transform.length}, should be 6`\n );\n }\n const transform: number[] = props.transform as number[];\n const x: number = (props.x as number) ?? 0;\n const y: number = (props.y as number) ?? 0;\n props.transform = [\n { translateX: transform[0] * x + transform[2] * y + transform[4] },\n { translateY: transform[1] * x + transform[3] * y + transform[5] },\n ];\n } else if (typeof props.transform === 'string') {\n // case of string 'translate(translateX translateY)'\n // todo: handle other cases of transform string like here https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/lib/extract/extractTransform.ts#L184\n const transform: string = props.transform as string;\n const arr = transform\n .replace('translate(', '')\n .replace(')', '')\n .split(' ');\n props.transform = [\n { translateX: parseFloat(arr[0]) },\n { translateY: parseFloat(arr[1]) },\n ];\n }\n }\n // todo: other props\n }\n);\n\nexport const TextInputAdapter = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878\n if (keys.includes('value')) {\n props.text = props.value;\n delete props.value;\n }\n },\n ['text']\n);\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"names":["addWhitelistedNativeProps","createAnimatedPropAdapter","adapter","nativeProps","nativePropsToAdd","forEach","prop","SVGAdapter","props","keys","Object","includes","Array","isArray","transform","length","Error","x","y","translateX","translateY","arr","replace","split","parseFloat","TextInputAdapter","text","value"],"sources":["PropAdapters.ts"],"sourcesContent":["import { addWhitelistedNativeProps } from '../ConfigHelper';\nimport { AdapterWorkletFunction } from './commonTypes';\n\nexport function createAnimatedPropAdapter(\n adapter: AdapterWorkletFunction,\n nativeProps?: string[]\n): AdapterWorkletFunction {\n const nativePropsToAdd: { [key: string]: boolean } = {};\n // eslint-disable-next-line no-unused-expressions\n nativeProps?.forEach((prop) => {\n nativePropsToAdd[prop] = true;\n });\n addWhitelistedNativeProps(nativePropsToAdd);\n return adapter;\n}\n\n// ADAPTERS\n\nexport const SVGAdapter: AdapterWorkletFunction = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // transform\n if (keys.includes('transform')) {\n if (Array.isArray(props.transform)) {\n // case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200\n if (props.transform.length !== 6) {\n throw new Error(\n `invalid transform length of ${props.transform.length}, should be 6`\n );\n }\n const transform: number[] = props.transform as number[];\n const x: number = (props.x as number) ?? 0;\n const y: number = (props.y as number) ?? 0;\n props.transform = [\n { translateX: transform[0] * x + transform[2] * y + transform[4] },\n { translateY: transform[1] * x + transform[3] * y + transform[5] },\n ];\n } else if (typeof props.transform === 'string') {\n // case of string 'translate(translateX translateY)'\n // todo: handle other cases of transform string like here https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/lib/extract/extractTransform.ts#L184\n const transform: string = props.transform as string;\n const arr = transform\n .replace('translate(', '')\n .replace(')', '')\n .split(' ');\n props.transform = [\n { translateX: parseFloat(arr[0]) },\n { translateY: parseFloat(arr[1]) },\n ];\n }\n }\n // todo: other props\n }\n);\n\nexport const TextInputAdapter = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878\n if (keys.includes('value')) {\n props.text = props.value;\n delete props.value;\n }\n },\n ['text']\n);\n"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,iBAAiB;AAG3D,OAAO,SAASC,yBAAyBA,CACvCC,OAA+B,EAC/BC,WAAsB,EACE;EACxB,MAAMC,gBAA4C,GAAG,CAAC,CAAC;EACvD;EACAD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,OAAO,CAAEC,IAAI,IAAK;IAC7BF,gBAAgB,CAACE,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EACFN,yBAAyB,CAACI,gBAAgB,CAAC;EAC3C,OAAOF,OAAO;AAChB;;AAEA;;AAEA,OAAO,MAAMK,UAAkC,GAAGN,yBAAyB,CACxEO,KAAK,IAAK;EACT,SAAS;;EACT,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC;EAC/B;EACA,IAAIC,IAAI,CAACE,QAAQ,CAAC,WAAW,CAAC,EAAE;IAC9B,IAAIC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACM,SAAS,CAAC,EAAE;MAClC;MACA,IAAIN,KAAK,CAACM,SAAS,CAACC,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM,IAAIC,KAAK,CACZ,+BAA8BR,KAAK,CAACM,SAAS,CAACC,MAAO,eAAc,CACrE;MACH;MACA,MAAMD,SAAmB,GAAGN,KAAK,CAACM,SAAqB;MACvD,MAAMG,CAAS,GAAIT,KAAK,CAACS,CAAC,IAAe,CAAC;MAC1C,MAAMC,CAAS,GAAIV,KAAK,CAACU,CAAC,IAAe,CAAC;MAC1CV,KAAK,CAACM,SAAS,GAAG,CAChB;QAAEK,UAAU,EAAEL,SAAS,CAAC,CAAC,CAAC,GAAGG,CAAC,GAAGH,SAAS,CAAC,CAAC,CAAC,GAAGI,CAAC,GAAGJ,SAAS,CAAC,CAAC;MAAE,CAAC,EAClE;QAAEM,UAAU,EAAEN,SAAS,CAAC,CAAC,CAAC,GAAGG,CAAC,GAAGH,SAAS,CAAC,CAAC,CAAC,GAAGI,CAAC,GAAGJ,SAAS,CAAC,CAAC;MAAE,CAAC,CACnE;IACH,CAAC,MAAM,IAAI,OAAON,KAAK,CAACM,SAAS,KAAK,QAAQ,EAAE;MAC9C;MACA;MACA,MAAMA,SAAiB,GAAGN,KAAK,CAACM,SAAmB;MACnD,MAAMO,GAAG,GAAGP,SAAS,CAClBQ,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CACzBA,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAChBC,KAAK,CAAC,GAAG,CAAC;MACbf,KAAK,CAACM,SAAS,GAAG,CAChB;QAAEK,UAAU,EAAEK,UAAU,CAACH,GAAG,CAAC,CAAC,CAAC;MAAE,CAAC,EAClC;QAAED,UAAU,EAAEI,UAAU,CAACH,GAAG,CAAC,CAAC,CAAC;MAAE,CAAC,CACnC;IACH;EACF;EACA;AACF,CAAC,CACF;;AAED,OAAO,MAAMI,gBAAgB,GAAGxB,yBAAyB,CACtDO,KAAK,IAAK;EACT,SAAS;;EACT,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC;EAC/B;EACA,IAAIC,IAAI,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IAC1BH,KAAK,CAACkB,IAAI,GAAGlB,KAAK,CAACmB,KAAK;IACxB,OAAOnB,KAAK,CAACmB,KAAK;EACpB;AACF,CAAC,EACD,CAAC,MAAM,CAAC,CACT"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* global _updatePropsPaper _updatePropsFabric */
|
|
2
|
+
|
|
2
3
|
import { processColor } from './Colors';
|
|
3
4
|
import { makeShareable, isConfigured } from './core';
|
|
4
5
|
import { _updatePropsJS } from './js-reanimated';
|
|
@@ -7,7 +8,6 @@ import { shouldBeUseWeb } from './PlatformChecker';
|
|
|
7
8
|
export const colorProps = ['backgroundColor', 'borderBottomColor', 'borderColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'borderStartColor', 'borderEndColor', 'color', 'shadowColor', 'textDecorationColor', 'tintColor', 'textShadowColor', 'overlayColor'];
|
|
8
9
|
export const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
|
|
9
10
|
let updatePropsByPlatform;
|
|
10
|
-
|
|
11
11
|
if (shouldBeUseWeb()) {
|
|
12
12
|
updatePropsByPlatform = (_, updates, maybeViewRef) => {
|
|
13
13
|
'worklet';
|
|
@@ -28,7 +28,6 @@ if (shouldBeUseWeb()) {
|
|
|
28
28
|
updates[key] = processColor(updates[key]);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
31
|
viewDescriptors.value.forEach(viewDescriptor => {
|
|
33
32
|
_updatePropsFabric(viewDescriptor.shadowNodeWrapper, updates);
|
|
34
33
|
});
|
|
@@ -42,20 +41,19 @@ if (shouldBeUseWeb()) {
|
|
|
42
41
|
updates[key] = processColor(updates[key]);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
viewDescriptors.value.forEach(viewDescriptor => {
|
|
47
45
|
_updatePropsPaper(viewDescriptor.tag, viewDescriptor.name || 'RCTView', updates);
|
|
48
46
|
});
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
export const updateProps = updatePropsByPlatform;
|
|
54
51
|
export const updatePropsJestWrapper = (viewDescriptors, updates, maybeViewRef, animatedStyle, adapters) => {
|
|
55
52
|
adapters.forEach(adapter => {
|
|
56
53
|
adapter(updates);
|
|
57
54
|
});
|
|
58
|
-
animatedStyle.current.value = {
|
|
55
|
+
animatedStyle.current.value = {
|
|
56
|
+
...animatedStyle.current.value,
|
|
59
57
|
...updates
|
|
60
58
|
};
|
|
61
59
|
updateProps(viewDescriptors, updates, maybeViewRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processColor","makeShareable","isConfigured","_updatePropsJS","shouldBeUseWeb","colorProps","ColorProperties","updatePropsByPlatform","_","updates","maybeViewRef","items","forEach","item","global","_IS_FABRIC","viewDescriptors","key","indexOf","value","viewDescriptor","_updatePropsFabric","shadowNodeWrapper","_updatePropsPaper","tag","name","updateProps","updatePropsJestWrapper","animatedStyle","adapters","adapter","current"],"sources":["UpdateProps.ts"],"sourcesContent":["/* global _updatePropsPaper _updatePropsFabric */\nimport { MutableRefObject } from 'react';\nimport { processColor } from './Colors';\nimport { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';\nimport { makeShareable, isConfigured } from './core';\nimport { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport { ViewRefSet } from './ViewDescriptorsSet';\n\n// copied from react-native/Libraries/Components/View/ReactNativeStyleAttributes\nexport const colorProps = [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderTopColor',\n 'borderStartColor',\n 'borderEndColor',\n 'color',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'textShadowColor',\n 'overlayColor',\n];\n\nexport const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);\n\nlet updatePropsByPlatform;\nif (shouldBeUseWeb()) {\n updatePropsByPlatform = (\n _: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _) => {\n _updatePropsJS(updates, item);\n });\n }\n };\n} else {\n if (global._IS_FABRIC) {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsFabric(viewDescriptor.shadowNodeWrapper, updates);\n });\n };\n } else {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsPaper(\n viewDescriptor.tag,\n viewDescriptor.name || 'RCTView',\n updates\n );\n });\n };\n }\n}\n\nexport const updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n) => void = updatePropsByPlatform;\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: ((updates: AnimatedStyle) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"names":["processColor","makeShareable","isConfigured","_updatePropsJS","shouldBeUseWeb","colorProps","ColorProperties","updatePropsByPlatform","_","updates","maybeViewRef","items","forEach","item","global","_IS_FABRIC","viewDescriptors","key","indexOf","value","viewDescriptor","_updatePropsFabric","shadowNodeWrapper","_updatePropsPaper","tag","name","updateProps","updatePropsJestWrapper","animatedStyle","adapters","adapter","current"],"sources":["UpdateProps.ts"],"sourcesContent":["/* global _updatePropsPaper _updatePropsFabric */\nimport { MutableRefObject } from 'react';\nimport { processColor } from './Colors';\nimport { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';\nimport { makeShareable, isConfigured } from './core';\nimport { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport { ViewRefSet } from './ViewDescriptorsSet';\n\n// copied from react-native/Libraries/Components/View/ReactNativeStyleAttributes\nexport const colorProps = [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderTopColor',\n 'borderStartColor',\n 'borderEndColor',\n 'color',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'textShadowColor',\n 'overlayColor',\n];\n\nexport const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);\n\nlet updatePropsByPlatform;\nif (shouldBeUseWeb()) {\n updatePropsByPlatform = (\n _: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _) => {\n _updatePropsJS(updates, item);\n });\n }\n };\n} else {\n if (global._IS_FABRIC) {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsFabric!(viewDescriptor.shadowNodeWrapper, updates);\n });\n };\n } else {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsPaper!(\n viewDescriptor.tag,\n viewDescriptor.name || 'RCTView',\n updates\n );\n });\n };\n }\n}\n\nexport const updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n) => void = updatePropsByPlatform;\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: ((updates: AnimatedStyle) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n"],"mappings":"AAAA;;AAEA,SAASA,YAAY,QAAQ,UAAU;AAEvC,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;AAEpD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAGlD;AACA,OAAO,MAAMC,UAAU,GAAG,CACxB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,cAAc,CACf;AAED,OAAO,MAAMC,eAAe,GAAG,CAACJ,YAAY,EAAE,GAAG,EAAE,GAAGD,aAAa,CAACI,UAAU,CAAC;AAE/E,IAAIE,qBAAqB;AACzB,IAAIH,cAAc,EAAE,EAAE;EACpBG,qBAAqB,GAAGA,CACtBC,CAA4B,EAC5BC,OAAmC,EACnCC,YAAyC,KAChC;IACT,SAAS;;IACT,IAAIA,YAAY,EAAE;MAChBA,YAAY,CAACC,KAAK,CAACC,OAAO,CAAC,CAACC,IAAI,EAAEL,CAAC,KAAK;QACtCL,cAAc,CAACM,OAAO,EAAEI,IAAI,CAAC;MAC/B,CAAC,CAAC;IACJ;EACF,CAAC;AACH,CAAC,MAAM;EACL,IAAIC,MAAM,CAACC,UAAU,EAAE;IACrBR,q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CAACZ,KAAK,GAAG;IAC5B,GAAGS,aAAa,CAACG,OAAO,CAACZ,KAAK;IAC9B,GAAGV;EACL,CAAC;EAEDiB,WAAW,CAACV,eAAe,EAAEP,OAAO,EAAEC,YAAY,CAAC;AACrD,CAAC;AAED,eAAegB,WAAW"}
|
|
@@ -9,13 +9,11 @@ export function makeViewDescriptorsSet() {
|
|
|
9
9
|
'worklet';
|
|
10
10
|
|
|
11
11
|
const index = descriptors.findIndex(descriptor => descriptor.tag === item.tag);
|
|
12
|
-
|
|
13
12
|
if (index !== -1) {
|
|
14
13
|
descriptors[index] = item;
|
|
15
14
|
} else {
|
|
16
15
|
descriptors.push(item);
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
return descriptors;
|
|
20
18
|
});
|
|
21
19
|
},
|
|
@@ -24,11 +22,9 @@ export function makeViewDescriptorsSet() {
|
|
|
24
22
|
'worklet';
|
|
25
23
|
|
|
26
24
|
const index = descriptors.findIndex(descriptor => descriptor.tag === viewTag);
|
|
27
|
-
|
|
28
25
|
if (index !== -1) {
|
|
29
26
|
descriptors.splice(index, 1);
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
return descriptors;
|
|
33
29
|
});
|
|
34
30
|
}
|
|
@@ -37,7 +33,6 @@ export function makeViewDescriptorsSet() {
|
|
|
37
33
|
}
|
|
38
34
|
export function makeViewsRefSet() {
|
|
39
35
|
const ref = useRef(null);
|
|
40
|
-
|
|
41
36
|
if (ref.current === null) {
|
|
42
37
|
const data = {
|
|
43
38
|
items: new Set(),
|
|
@@ -51,7 +46,6 @@ export function makeViewsRefSet() {
|
|
|
51
46
|
};
|
|
52
47
|
ref.current = data;
|
|
53
48
|
}
|
|
54
|
-
|
|
55
49
|
return ref.current;
|
|
56
50
|
}
|
|
57
51
|
//# sourceMappingURL=ViewDescriptorsSet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","makeMutable","makeViewDescriptorsSet","sharableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const sharableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n sharableViewDescriptors,\n add: (item: Descriptor) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n });\n },\n\n remove: (viewTag: number) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n });\n },\n };\n return data;\n}\n\nexport function makeViewsRefSet<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"names":["useRef","makeMutable","makeViewDescriptorsSet","sharableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const sharableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n sharableViewDescriptors,\n add: (item: Descriptor) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n });\n },\n\n remove: (viewTag: number) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n });\n },\n };\n return data;\n}\n\nexport function makeViewsRefSet<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,WAAW,QAAQ,QAAQ;AAgBpC,OAAO,SAASC,sBAAsBA,CAAA,EAAuB;EAC3D,MAAMC,uBAAuB,GAAGF,WAAW,CAAe,EAAE,CAAC;EAC7D,MAAMG,IAAwB,GAAG;IAC/BD,uBAAuB;IACvBE,GAAG,EAAGC,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CAACjB,IAAI,CAAC;MACzB;IACF,CAAC;IACDY,GAAG,CAACC,OAAO,GAAGf,IAAI;EACpB;EAEA,OAAOc,GAAG,CAACC,OAAO;AACpB"}
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import NativeReanimatedModule from './NativeReanimated';
|
|
4
5
|
import { registerEventHandler, unregisterEventHandler } from './core';
|
|
5
|
-
|
|
6
6
|
function jsListener(eventName, handler) {
|
|
7
7
|
return evt => {
|
|
8
|
-
handler({
|
|
8
|
+
handler({
|
|
9
|
+
...evt.nativeEvent,
|
|
9
10
|
eventName
|
|
10
11
|
});
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
|
|
14
14
|
export default class WorkletEventHandler {
|
|
15
15
|
constructor(worklet) {
|
|
16
16
|
let eventNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
17
|
-
|
|
18
17
|
_defineProperty(this, "worklet", void 0);
|
|
19
|
-
|
|
20
18
|
_defineProperty(this, "eventNames", void 0);
|
|
21
|
-
|
|
22
19
|
_defineProperty(this, "reattachNeeded", void 0);
|
|
23
|
-
|
|
24
20
|
_defineProperty(this, "listeners", void 0);
|
|
25
|
-
|
|
26
21
|
_defineProperty(this, "viewTag", void 0);
|
|
27
|
-
|
|
28
22
|
_defineProperty(this, "registrations", void 0);
|
|
29
|
-
|
|
30
23
|
this.worklet = worklet;
|
|
31
24
|
this.eventNames = eventNames;
|
|
32
25
|
this.reattachNeeded = false;
|
|
33
26
|
this.listeners = {};
|
|
34
27
|
this.viewTag = undefined;
|
|
35
28
|
this.registrations = [];
|
|
36
|
-
|
|
37
29
|
if (!NativeReanimatedModule.native) {
|
|
38
30
|
this.listeners = eventNames.reduce((acc, eventName) => {
|
|
39
31
|
acc[eventName] = jsListener(eventName, worklet);
|
|
@@ -41,25 +33,20 @@ export default class WorkletEventHandler {
|
|
|
41
33
|
}, {});
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
updateWorklet(newWorklet) {
|
|
46
37
|
this.worklet = newWorklet;
|
|
47
38
|
this.reattachNeeded = true;
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
registerForEvents(viewTag, fallbackEventName) {
|
|
51
41
|
this.viewTag = viewTag;
|
|
52
42
|
this.registrations = this.eventNames.map(eventName => registerEventHandler(viewTag + eventName, this.worklet));
|
|
53
|
-
|
|
54
43
|
if (this.registrations.length === 0 && fallbackEventName) {
|
|
55
44
|
this.registrations.push(registerEventHandler(viewTag + fallbackEventName, this.worklet));
|
|
56
45
|
}
|
|
57
46
|
}
|
|
58
|
-
|
|
59
47
|
unregisterFromEvents() {
|
|
60
48
|
this.registrations.forEach(id => unregisterEventHandler(id));
|
|
61
49
|
this.registrations = [];
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
}
|
|
65
52
|
//# sourceMappingURL=WorkletEventHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimatedModule","registerEventHandler","unregisterEventHandler","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","
|
|
1
|
+
{"version":3,"names":["NativeReanimatedModule","registerEventHandler","unregisterEventHandler","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","arguments","length","undefined","_defineProperty","reattachNeeded","listeners","viewTag","registrations","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","push","unregisterFromEvents","forEach","id"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["import { NativeEvent } from './commonTypes';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { registerEventHandler, unregisterEventHandler } from './core';\n\nfunction jsListener<T extends NativeEvent<T>>(\n eventName: string,\n handler: (event: T) => void\n) {\n return (evt: T) => {\n handler({ ...evt.nativeEvent, eventName });\n };\n}\n\nexport default class WorkletEventHandler<T extends NativeEvent<T>> {\n worklet: (event: T) => void;\n eventNames: string[];\n reattachNeeded: boolean;\n listeners: Record<string, (event: T) => void>;\n viewTag: number | undefined;\n registrations: string[];\n constructor(worklet: (event: T) => void, eventNames: string[] = []) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.reattachNeeded = false;\n this.listeners = {};\n this.viewTag = undefined;\n this.registrations = [];\n\n if (!NativeReanimatedModule.native) {\n this.listeners = eventNames.reduce(\n (acc: Record<string, (event: T) => void>, eventName: string) => {\n acc[eventName] = jsListener(eventName, worklet);\n return acc;\n },\n {}\n );\n }\n }\n\n updateWorklet(newWorklet: (event: T) => void): void {\n this.worklet = newWorklet;\n this.reattachNeeded = true;\n }\n\n registerForEvents(viewTag: number, fallbackEventName?: string): void {\n this.viewTag = viewTag;\n this.registrations = this.eventNames.map((eventName) =>\n registerEventHandler(viewTag + eventName, this.worklet)\n );\n if (this.registrations.length === 0 && fallbackEventName) {\n this.registrations.push(\n registerEventHandler(viewTag + fallbackEventName, this.worklet)\n );\n }\n }\n\n unregisterFromEvents(): void {\n this.registrations.forEach((id) => unregisterEventHandler(id));\n this.registrations = [];\n }\n}\n"],"mappings":";;;AACA,OAAOA,sBAAsB,MAAM,oBAAoB;AACvD,SAASC,oBAAoB,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