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":["configureProps","jsiConfigureProps","UI_THREAD_PROPS_WHITELIST","opacity","transform","backgroundColor","borderRightColor","borderBottomColor","borderColor","borderEndColor","borderLeftColor","borderStartColor","borderTopColor","shadowOpacity","shadowRadius","scaleX","scaleY","translateX","translateY","NATIVE_THREAD_PROPS_WHITELIST","borderBottomWidth","borderEndWidth","borderLeftWidth","borderRightWidth","borderStartWidth","borderTopWidth","borderWidth","bottom","flex","flexGrow","flexShrink","height","left","margin","marginBottom","marginEnd","marginHorizontal","marginLeft","marginRight","marginStart","marginTop","marginVertical","maxHeight","maxWidth","minHeight","minWidth","padding","paddingBottom","paddingEnd","paddingHorizontal","paddingLeft","paddingRight","paddingStart","paddingTop","paddingVertical","right","start","top","width","zIndex","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderRadius","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","elevation","fontSize","lineHeight","textShadowRadius","letterSpacing","display","backfaceVisibility","overflow","resizeMode","fontStyle","fontWeight","textAlign","textDecorationLine","fontFamily","textAlignVertical","fontVariant","textDecorationStyle","textTransform","writingDirection","color","tintColor","shadowColor","placeholderTextColor","Object","keys","addWhitelistedNativeProps","props","oldSize","length","addWhitelistedUIProps","PROCESSED_VIEW_NAMES","Set","adaptViewConfig","viewConfig","viewName","uiViewClassName","validAttributes","has","propsToAdd","forEach","key","add"],"sources":["ConfigHelper.ts"],"sourcesContent":["import { configureProps as jsiConfigureProps } from './reanimated2/core';\n\n/**\n * Styles allowed to be direcly updated in UI thread\n */\nlet UI_THREAD_PROPS_WHITELIST: Record<string, boolean> = {\n opacity: true,\n transform: true,\n /* colors */\n backgroundColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderColor: true,\n borderEndColor: true,\n borderLeftColor: true,\n borderStartColor: true,\n borderTopColor: true,\n /* ios styles */\n shadowOpacity: true,\n shadowRadius: true,\n /* legacy android transform properties */\n scaleX: true,\n scaleY: true,\n translateX: true,\n translateY: true,\n};\n\n/**\n * Whitelist of view props that can be updated in native thread via UIManagerModule\n */\nlet NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {\n borderBottomWidth: true,\n borderEndWidth: true,\n borderLeftWidth: true,\n borderRightWidth: true,\n borderStartWidth: true,\n borderTopWidth: true,\n borderWidth: true,\n bottom: true,\n flex: true,\n flexGrow: true,\n flexShrink: true,\n height: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginEnd: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginStart: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n padding: true,\n paddingBottom: true,\n paddingEnd: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingStart: true,\n paddingTop: true,\n paddingVertical: true,\n right: true,\n start: true,\n top: true,\n width: true,\n zIndex: true,\n borderBottomEndRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomStartRadius: true,\n borderRadius: true,\n borderTopEndRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopStartRadius: true,\n elevation: true,\n fontSize: true,\n lineHeight: true,\n textShadowRadius: true,\n letterSpacing: true,\n /* strings */\n display: true,\n backfaceVisibility: true,\n overflow: true,\n resizeMode: true,\n fontStyle: true,\n fontWeight: true,\n textAlign: true,\n textDecorationLine: true,\n fontFamily: true,\n textAlignVertical: true,\n fontVariant: true,\n textDecorationStyle: true,\n textTransform: true,\n writingDirection: true,\n /* text color */\n color: true,\n tintColor: true,\n shadowColor: true,\n placeholderTextColor: true,\n};\n\nfunction configureProps(): void {\n jsiConfigureProps(\n Object.keys(UI_THREAD_PROPS_WHITELIST),\n Object.keys(NATIVE_THREAD_PROPS_WHITELIST)\n );\n}\n\nexport function addWhitelistedNativeProps(\n props: Record<string, boolean>\n): void {\n const oldSize = Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length;\n NATIVE_THREAD_PROPS_WHITELIST = {\n ...NATIVE_THREAD_PROPS_WHITELIST,\n ...props,\n };\n if (oldSize !== Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length) {\n configureProps();\n }\n}\n\nexport function addWhitelistedUIProps(props: Record<string, boolean>): void {\n const oldSize = Object.keys(UI_THREAD_PROPS_WHITELIST).length;\n UI_THREAD_PROPS_WHITELIST = { ...UI_THREAD_PROPS_WHITELIST, ...props };\n if (oldSize !== Object.keys(UI_THREAD_PROPS_WHITELIST).length) {\n configureProps();\n }\n}\n\nconst PROCESSED_VIEW_NAMES = new Set();\n\ninterface ViewConfig {\n uiViewClassName: string;\n validAttributes: Record<string, unknown>;\n}\n/**\n * updates UI props whitelist for given view host instance\n * this will work just once for every view name\n */\n\nexport function adaptViewConfig(viewConfig: ViewConfig): void {\n const viewName = viewConfig.uiViewClassName;\n const props = viewConfig.validAttributes;\n\n // update whitelist of UI props for this view name only once\n if (!PROCESSED_VIEW_NAMES.has(viewName)) {\n const propsToAdd: Record<string, boolean> = {};\n Object.keys(props).forEach((key) => {\n // we don't want to add native props as they affect layout\n // we also skip props which repeat here\n if (\n !(key in NATIVE_THREAD_PROPS_WHITELIST) &&\n !(key in UI_THREAD_PROPS_WHITELIST)\n ) {\n propsToAdd[key] = true;\n }\n });\n addWhitelistedUIProps(propsToAdd);\n\n PROCESSED_VIEW_NAMES.add(viewName);\n }\n}\n\nconfigureProps();\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,
|
|
1
|
+
{"version":3,"names":["configureProps","jsiConfigureProps","UI_THREAD_PROPS_WHITELIST","opacity","transform","backgroundColor","borderRightColor","borderBottomColor","borderColor","borderEndColor","borderLeftColor","borderStartColor","borderTopColor","shadowOpacity","shadowRadius","scaleX","scaleY","translateX","translateY","NATIVE_THREAD_PROPS_WHITELIST","borderBottomWidth","borderEndWidth","borderLeftWidth","borderRightWidth","borderStartWidth","borderTopWidth","borderWidth","bottom","flex","flexGrow","flexShrink","height","left","margin","marginBottom","marginEnd","marginHorizontal","marginLeft","marginRight","marginStart","marginTop","marginVertical","maxHeight","maxWidth","minHeight","minWidth","padding","paddingBottom","paddingEnd","paddingHorizontal","paddingLeft","paddingRight","paddingStart","paddingTop","paddingVertical","right","start","top","width","zIndex","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderRadius","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","elevation","fontSize","lineHeight","textShadowRadius","letterSpacing","display","backfaceVisibility","overflow","resizeMode","fontStyle","fontWeight","textAlign","textDecorationLine","fontFamily","textAlignVertical","fontVariant","textDecorationStyle","textTransform","writingDirection","color","tintColor","shadowColor","placeholderTextColor","Object","keys","addWhitelistedNativeProps","props","oldSize","length","addWhitelistedUIProps","PROCESSED_VIEW_NAMES","Set","adaptViewConfig","viewConfig","viewName","uiViewClassName","validAttributes","has","propsToAdd","forEach","key","add"],"sources":["ConfigHelper.ts"],"sourcesContent":["import { configureProps as jsiConfigureProps } from './reanimated2/core';\n\n/**\n * Styles allowed to be direcly updated in UI thread\n */\nlet UI_THREAD_PROPS_WHITELIST: Record<string, boolean> = {\n opacity: true,\n transform: true,\n /* colors */\n backgroundColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderColor: true,\n borderEndColor: true,\n borderLeftColor: true,\n borderStartColor: true,\n borderTopColor: true,\n /* ios styles */\n shadowOpacity: true,\n shadowRadius: true,\n /* legacy android transform properties */\n scaleX: true,\n scaleY: true,\n translateX: true,\n translateY: true,\n};\n\n/**\n * Whitelist of view props that can be updated in native thread via UIManagerModule\n */\nlet NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {\n borderBottomWidth: true,\n borderEndWidth: true,\n borderLeftWidth: true,\n borderRightWidth: true,\n borderStartWidth: true,\n borderTopWidth: true,\n borderWidth: true,\n bottom: true,\n flex: true,\n flexGrow: true,\n flexShrink: true,\n height: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginEnd: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginStart: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n padding: true,\n paddingBottom: true,\n paddingEnd: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingStart: true,\n paddingTop: true,\n paddingVertical: true,\n right: true,\n start: true,\n top: true,\n width: true,\n zIndex: true,\n borderBottomEndRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomStartRadius: true,\n borderRadius: true,\n borderTopEndRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopStartRadius: true,\n elevation: true,\n fontSize: true,\n lineHeight: true,\n textShadowRadius: true,\n letterSpacing: true,\n /* strings */\n display: true,\n backfaceVisibility: true,\n overflow: true,\n resizeMode: true,\n fontStyle: true,\n fontWeight: true,\n textAlign: true,\n textDecorationLine: true,\n fontFamily: true,\n textAlignVertical: true,\n fontVariant: true,\n textDecorationStyle: true,\n textTransform: true,\n writingDirection: true,\n /* text color */\n color: true,\n tintColor: true,\n shadowColor: true,\n placeholderTextColor: true,\n};\n\nfunction configureProps(): void {\n jsiConfigureProps(\n Object.keys(UI_THREAD_PROPS_WHITELIST),\n Object.keys(NATIVE_THREAD_PROPS_WHITELIST)\n );\n}\n\nexport function addWhitelistedNativeProps(\n props: Record<string, boolean>\n): void {\n const oldSize = Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length;\n NATIVE_THREAD_PROPS_WHITELIST = {\n ...NATIVE_THREAD_PROPS_WHITELIST,\n ...props,\n };\n if (oldSize !== Object.keys(NATIVE_THREAD_PROPS_WHITELIST).length) {\n configureProps();\n }\n}\n\nexport function addWhitelistedUIProps(props: Record<string, boolean>): void {\n const oldSize = Object.keys(UI_THREAD_PROPS_WHITELIST).length;\n UI_THREAD_PROPS_WHITELIST = { ...UI_THREAD_PROPS_WHITELIST, ...props };\n if (oldSize !== Object.keys(UI_THREAD_PROPS_WHITELIST).length) {\n configureProps();\n }\n}\n\nconst PROCESSED_VIEW_NAMES = new Set();\n\ninterface ViewConfig {\n uiViewClassName: string;\n validAttributes: Record<string, unknown>;\n}\n/**\n * updates UI props whitelist for given view host instance\n * this will work just once for every view name\n */\n\nexport function adaptViewConfig(viewConfig: ViewConfig): void {\n const viewName = viewConfig.uiViewClassName;\n const props = viewConfig.validAttributes;\n\n // update whitelist of UI props for this view name only once\n if (!PROCESSED_VIEW_NAMES.has(viewName)) {\n const propsToAdd: Record<string, boolean> = {};\n Object.keys(props).forEach((key) => {\n // we don't want to add native props as they affect layout\n // we also skip props which repeat here\n if (\n !(key in NATIVE_THREAD_PROPS_WHITELIST) &&\n !(key in UI_THREAD_PROPS_WHITELIST)\n ) {\n propsToAdd[key] = true;\n }\n });\n addWhitelistedUIProps(propsToAdd);\n\n PROCESSED_VIEW_NAMES.add(viewName);\n }\n}\n\nconfigureProps();\n"],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { findNodeHandle, Platform, StyleSheet } from 'react-native';
|
|
7
7
|
import WorkletEventHandler from './reanimated2/WorkletEventHandler';
|
|
@@ -19,28 +19,23 @@ import { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';
|
|
|
19
19
|
import updateProps from './reanimated2/UpdateProps';
|
|
20
20
|
import NativeReanimatedModule from './reanimated2/NativeReanimated';
|
|
21
21
|
import { isSharedValue } from './reanimated2';
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
function dummyListener() {
|
|
23
|
+
// empty listener we use to assign to listener properties for which animated
|
|
24
24
|
// event is used.
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
function maybeBuild(layoutAnimationOrBuilder) {
|
|
28
27
|
const isAnimationBuilder = value => 'build' in layoutAnimationOrBuilder && typeof layoutAnimationOrBuilder.build === 'function';
|
|
29
|
-
|
|
30
28
|
if (isAnimationBuilder(layoutAnimationOrBuilder)) {
|
|
31
29
|
return layoutAnimationOrBuilder.build();
|
|
32
30
|
} else {
|
|
33
31
|
return layoutAnimationOrBuilder;
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
function flattenArray(array) {
|
|
38
35
|
if (!Array.isArray(array)) {
|
|
39
36
|
return [array];
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
const resultArr = [];
|
|
43
|
-
|
|
44
39
|
const _flattenArray = arr => {
|
|
45
40
|
arr.forEach(item => {
|
|
46
41
|
if (Array.isArray(item)) {
|
|
@@ -50,24 +45,18 @@ function flattenArray(array) {
|
|
|
50
45
|
}
|
|
51
46
|
});
|
|
52
47
|
};
|
|
53
|
-
|
|
54
48
|
_flattenArray(array);
|
|
55
|
-
|
|
56
49
|
return resultArr;
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
function onlyAnimatedStyles(styles) {
|
|
60
52
|
return styles.filter(style => style === null || style === void 0 ? void 0 : style.viewDescriptors);
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
function isSameAnimatedStyle(style1, style2) {
|
|
64
55
|
// We cannot use equality check to compare useAnimatedStyle outputs directly.
|
|
65
56
|
// Instead, we can compare its viewsRefs.
|
|
66
57
|
return (style1 === null || style1 === void 0 ? void 0 : style1.viewsRef) === (style2 === null || style2 === void 0 ? void 0 : style2.viewsRef);
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
const isSameAnimatedProps = isSameAnimatedStyle;
|
|
70
|
-
|
|
71
60
|
const has = (key, x) => {
|
|
72
61
|
if (typeof x === 'function' || typeof x === 'object') {
|
|
73
62
|
if (x === null || x === undefined) {
|
|
@@ -76,42 +65,33 @@ const has = (key, x) => {
|
|
|
76
65
|
return key in x;
|
|
77
66
|
}
|
|
78
67
|
}
|
|
79
|
-
|
|
80
68
|
return false;
|
|
81
69
|
};
|
|
82
|
-
|
|
83
70
|
function isInlineStyleTransform(transform) {
|
|
84
71
|
if (!transform) {
|
|
85
72
|
return false;
|
|
86
73
|
}
|
|
87
|
-
|
|
88
74
|
return transform.some(t => hasInlineStyles(t));
|
|
89
75
|
}
|
|
90
|
-
|
|
91
76
|
function hasInlineStyles(style) {
|
|
92
77
|
if (!style) {
|
|
93
78
|
return false;
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
return Object.keys(style).some(key => {
|
|
97
81
|
const styleValue = style[key];
|
|
98
82
|
return isSharedValue(styleValue) || key === 'transform' && isInlineStyleTransform(styleValue);
|
|
99
83
|
});
|
|
100
84
|
}
|
|
101
|
-
|
|
102
85
|
function extractSharedValuesMapFromProps(props) {
|
|
103
86
|
const inlineProps = {};
|
|
104
|
-
|
|
105
87
|
for (const key in props) {
|
|
106
88
|
const value = props[key];
|
|
107
|
-
|
|
108
89
|
if (key === 'style') {
|
|
109
90
|
const styles = flattenArray(props.style ?? []);
|
|
110
91
|
styles.forEach(style => {
|
|
111
92
|
if (!style) {
|
|
112
93
|
return;
|
|
113
94
|
}
|
|
114
|
-
|
|
115
95
|
for (const [key, styleValue] of Object.entries(style)) {
|
|
116
96
|
if (isSharedValue(styleValue)) {
|
|
117
97
|
inlineProps[key] = styleValue;
|
|
@@ -124,27 +104,21 @@ function extractSharedValuesMapFromProps(props) {
|
|
|
124
104
|
inlineProps[key] = value;
|
|
125
105
|
}
|
|
126
106
|
}
|
|
127
|
-
|
|
128
107
|
return inlineProps;
|
|
129
108
|
}
|
|
130
|
-
|
|
131
109
|
function inlinePropsHasChanged(styles1, styles2) {
|
|
132
110
|
if (Object.keys(styles1).length !== Object.keys(styles2).length) {
|
|
133
111
|
return true;
|
|
134
112
|
}
|
|
135
|
-
|
|
136
113
|
for (const key of Object.keys(styles1)) {
|
|
137
114
|
if (styles1[key] !== styles2[key]) return true;
|
|
138
115
|
}
|
|
139
|
-
|
|
140
116
|
return false;
|
|
141
117
|
}
|
|
142
|
-
|
|
143
118
|
function getInlinePropsUpdate(inlineProps) {
|
|
144
119
|
'worklet';
|
|
145
120
|
|
|
146
121
|
const update = {};
|
|
147
|
-
|
|
148
122
|
for (const [key, styleValue] of Object.entries(inlineProps)) {
|
|
149
123
|
if (key === 'transform') {
|
|
150
124
|
update[key] = styleValue.map(transform => {
|
|
@@ -156,39 +130,25 @@ function getInlinePropsUpdate(inlineProps) {
|
|
|
156
130
|
update[key] = styleValue;
|
|
157
131
|
}
|
|
158
132
|
}
|
|
159
|
-
|
|
160
133
|
return update;
|
|
161
134
|
}
|
|
162
|
-
|
|
163
135
|
export default function createAnimatedComponent(Component, options) {
|
|
164
|
-
invariant(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, '
|
|
165
|
-
|
|
136
|
+
invariant(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, `Looks like you're passing a function component \`${Component.name}\` to \`createAnimatedComponent\` function which supports only class components. Please wrap your function component with \`React.forwardRef()\` or use a class component instead.`);
|
|
166
137
|
class AnimatedComponent extends React.Component {
|
|
167
138
|
constructor(props) {
|
|
168
139
|
super(props);
|
|
169
|
-
|
|
170
140
|
_defineProperty(this, "_styles", null);
|
|
171
|
-
|
|
172
141
|
_defineProperty(this, "_animatedProps", void 0);
|
|
173
|
-
|
|
174
142
|
_defineProperty(this, "_viewTag", -1);
|
|
175
|
-
|
|
176
143
|
_defineProperty(this, "_isFirstRender", true);
|
|
177
|
-
|
|
178
144
|
_defineProperty(this, "animatedStyle", {
|
|
179
145
|
value: {}
|
|
180
146
|
});
|
|
181
|
-
|
|
182
147
|
_defineProperty(this, "initialStyle", {});
|
|
183
|
-
|
|
184
148
|
_defineProperty(this, "_component", null);
|
|
185
|
-
|
|
186
149
|
_defineProperty(this, "_inlinePropsViewDescriptors", null);
|
|
187
|
-
|
|
188
150
|
_defineProperty(this, "_inlinePropsMapperId", null);
|
|
189
|
-
|
|
190
151
|
_defineProperty(this, "_inlineProps", {});
|
|
191
|
-
|
|
192
152
|
_defineProperty(this, "_setComponentRef", setAndForwardRef({
|
|
193
153
|
getForwardedRef: () => this.props.forwardedRef,
|
|
194
154
|
setLocalRef: ref => {
|
|
@@ -200,91 +160,69 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
200
160
|
exiting,
|
|
201
161
|
sharedTransitionTag
|
|
202
162
|
} = this.props;
|
|
203
|
-
|
|
204
163
|
if ((layout || entering || exiting || sharedTransitionTag) && tag != null) {
|
|
205
164
|
if (!shouldBeUseWeb()) {
|
|
206
165
|
enableLayoutAnimations(true, false);
|
|
207
166
|
}
|
|
208
|
-
|
|
209
167
|
if (layout) {
|
|
210
168
|
configureLayoutAnimations(tag, LayoutAnimationType.LAYOUT, maybeBuild(layout));
|
|
211
169
|
}
|
|
212
|
-
|
|
213
170
|
if (entering) {
|
|
214
171
|
configureLayoutAnimations(tag, LayoutAnimationType.ENTERING, maybeBuild(entering));
|
|
215
172
|
}
|
|
216
|
-
|
|
217
173
|
if (exiting) {
|
|
218
174
|
configureLayoutAnimations(tag, LayoutAnimationType.EXITING, maybeBuild(exiting));
|
|
219
175
|
}
|
|
220
|
-
|
|
221
176
|
if (sharedTransitionTag) {
|
|
222
177
|
const sharedElementTransition = this.props.sharedTransitionStyle ?? DefaultSharedTransition;
|
|
223
178
|
configureLayoutAnimations(tag, LayoutAnimationType.SHARED_ELEMENT_TRANSITION, maybeBuild(sharedElementTransition), sharedTransitionTag);
|
|
224
179
|
}
|
|
225
180
|
}
|
|
226
|
-
|
|
227
181
|
if (ref !== this._component) {
|
|
228
182
|
this._component = ref;
|
|
229
183
|
}
|
|
230
184
|
}
|
|
231
185
|
}));
|
|
232
|
-
|
|
233
186
|
if (isJest()) {
|
|
234
187
|
this.animatedStyle = {
|
|
235
188
|
value: {}
|
|
236
189
|
};
|
|
237
190
|
}
|
|
238
191
|
}
|
|
239
|
-
|
|
240
192
|
componentWillUnmount() {
|
|
241
193
|
this._detachNativeEvents();
|
|
242
|
-
|
|
243
194
|
this._detachStyles();
|
|
244
|
-
|
|
245
195
|
this._detachInlineProps();
|
|
246
196
|
}
|
|
247
|
-
|
|
248
197
|
componentDidMount() {
|
|
249
198
|
this._attachNativeEvents();
|
|
250
|
-
|
|
251
199
|
this._attachAnimatedStyles();
|
|
252
|
-
|
|
253
200
|
this._attachInlineProps();
|
|
254
201
|
}
|
|
255
|
-
|
|
256
202
|
_getEventViewRef() {
|
|
257
203
|
var _this$_component;
|
|
258
|
-
|
|
259
204
|
// Make sure to get the scrollable node for components that implement
|
|
260
205
|
// `ScrollResponder.Mixin`.
|
|
261
206
|
return (_this$_component = this._component) !== null && _this$_component !== void 0 && _this$_component.getScrollableNode ? this._component.getScrollableNode() : this._component;
|
|
262
207
|
}
|
|
263
|
-
|
|
264
208
|
_attachNativeEvents() {
|
|
265
209
|
const node = this._getEventViewRef();
|
|
266
|
-
|
|
267
210
|
const viewTag = findNodeHandle(options !== null && options !== void 0 && options.setNativeProps ? this : node);
|
|
268
|
-
|
|
269
211
|
for (const key in this.props) {
|
|
270
212
|
const prop = this.props[key];
|
|
271
|
-
|
|
272
213
|
if (has('current', prop) && prop.current instanceof WorkletEventHandler) {
|
|
273
214
|
prop.current.registerForEvents(viewTag, key);
|
|
274
215
|
}
|
|
275
216
|
}
|
|
276
217
|
}
|
|
277
|
-
|
|
278
218
|
_detachNativeEvents() {
|
|
279
219
|
for (const key in this.props) {
|
|
280
220
|
const prop = this.props[key];
|
|
281
|
-
|
|
282
221
|
if (has('current', prop) && prop.current instanceof WorkletEventHandler) {
|
|
283
222
|
prop.current.unregisterFromEvents();
|
|
284
223
|
}
|
|
285
224
|
}
|
|
286
225
|
}
|
|
287
|
-
|
|
288
226
|
_detachStyles() {
|
|
289
227
|
if (Platform.OS === 'web' && this._styles !== null) {
|
|
290
228
|
for (const style of this._styles) {
|
|
@@ -294,15 +232,12 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
294
232
|
}
|
|
295
233
|
} else if (this._viewTag !== -1 && this._styles !== null) {
|
|
296
234
|
var _this$props$animatedP;
|
|
297
|
-
|
|
298
235
|
for (const style of this._styles) {
|
|
299
236
|
style.viewDescriptors.remove(this._viewTag);
|
|
300
237
|
}
|
|
301
|
-
|
|
302
238
|
if ((_this$props$animatedP = this.props.animatedProps) !== null && _this$props$animatedP !== void 0 && _this$props$animatedP.viewDescriptors) {
|
|
303
239
|
this.props.animatedProps.viewDescriptors.remove(this._viewTag);
|
|
304
240
|
}
|
|
305
|
-
|
|
306
241
|
if (global._IS_FABRIC) {
|
|
307
242
|
const viewTag = this._viewTag;
|
|
308
243
|
runOnUI(() => {
|
|
@@ -313,31 +248,24 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
313
248
|
}
|
|
314
249
|
}
|
|
315
250
|
}
|
|
316
|
-
|
|
317
251
|
_reattachNativeEvents(prevProps) {
|
|
318
252
|
let viewTag;
|
|
319
|
-
|
|
320
253
|
for (const key in this.props) {
|
|
321
254
|
const prop = this.props[key];
|
|
322
|
-
|
|
323
255
|
if (has('current', prop) && prop.current instanceof WorkletEventHandler) {
|
|
324
256
|
if (viewTag === undefined) {
|
|
325
257
|
viewTag = prop.current.viewTag;
|
|
326
258
|
}
|
|
327
259
|
}
|
|
328
260
|
}
|
|
329
|
-
|
|
330
261
|
for (const key in prevProps) {
|
|
331
262
|
const prop = this.props[key];
|
|
332
|
-
|
|
333
263
|
if (has('current', prop) && prop.current instanceof WorkletEventHandler && prop.current.reattachNeeded) {
|
|
334
264
|
prop.current.unregisterFromEvents();
|
|
335
265
|
}
|
|
336
266
|
}
|
|
337
|
-
|
|
338
267
|
for (const key in this.props) {
|
|
339
268
|
const prop = this.props[key];
|
|
340
|
-
|
|
341
269
|
if (has('current', prop) && prop.current instanceof WorkletEventHandler && prop.current.reattachNeeded) {
|
|
342
270
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
343
271
|
prop.current.registerForEvents(viewTag, key);
|
|
@@ -345,25 +273,21 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
345
273
|
}
|
|
346
274
|
}
|
|
347
275
|
}
|
|
348
|
-
|
|
349
276
|
_updateFromNative(props) {
|
|
350
277
|
if (options !== null && options !== void 0 && options.setNativeProps) {
|
|
351
278
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
352
279
|
options.setNativeProps(this._component, props);
|
|
353
280
|
} else {
|
|
354
281
|
var _this$_component2, _this$_component2$set;
|
|
355
|
-
|
|
356
282
|
// eslint-disable-next-line no-unused-expressions
|
|
357
283
|
(_this$_component2 = this._component) === null || _this$_component2 === void 0 ? void 0 : (_this$_component2$set = _this$_component2.setNativeProps) === null || _this$_component2$set === void 0 ? void 0 : _this$_component2$set.call(_this$_component2, props);
|
|
358
284
|
}
|
|
359
285
|
}
|
|
360
|
-
|
|
361
286
|
_getViewInfo() {
|
|
362
287
|
let viewTag;
|
|
363
288
|
let viewName;
|
|
364
289
|
let shadowNodeWrapper = null;
|
|
365
290
|
let viewConfig;
|
|
366
|
-
|
|
367
291
|
if (Platform.OS === 'web') {
|
|
368
292
|
viewTag = findNodeHandle(this);
|
|
369
293
|
viewName = null;
|
|
@@ -371,29 +295,23 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
371
295
|
viewConfig = null;
|
|
372
296
|
} else {
|
|
373
297
|
var _hostInstance$viewCon;
|
|
374
|
-
|
|
375
298
|
// hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx
|
|
376
299
|
const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);
|
|
377
|
-
|
|
378
300
|
if (!hostInstance) {
|
|
379
301
|
throw new Error('Cannot find host instance for this component. Maybe it renders nothing?');
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
|
|
302
|
+
}
|
|
303
|
+
// we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146
|
|
383
304
|
viewTag = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance._nativeTag;
|
|
384
305
|
/**
|
|
385
306
|
* RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).
|
|
386
307
|
* The name we're looking for is in the field named uiViewClassName.
|
|
387
308
|
*/
|
|
388
|
-
|
|
389
309
|
viewName = hostInstance === null || hostInstance === void 0 ? void 0 : (_hostInstance$viewCon = hostInstance.viewConfig) === null || _hostInstance$viewCon === void 0 ? void 0 : _hostInstance$viewCon.uiViewClassName;
|
|
390
310
|
viewConfig = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig;
|
|
391
|
-
|
|
392
311
|
if (global._IS_FABRIC) {
|
|
393
312
|
shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
|
|
394
313
|
}
|
|
395
314
|
}
|
|
396
|
-
|
|
397
315
|
return {
|
|
398
316
|
viewTag,
|
|
399
317
|
viewName,
|
|
@@ -401,55 +319,47 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
401
319
|
viewConfig
|
|
402
320
|
};
|
|
403
321
|
}
|
|
404
|
-
|
|
405
322
|
_attachAnimatedStyles() {
|
|
406
323
|
var _this$props$animatedP2, _this$props$animatedP3;
|
|
407
|
-
|
|
408
324
|
const styles = this.props.style ? onlyAnimatedStyles(flattenArray(this.props.style)) : [];
|
|
409
325
|
const prevStyles = this._styles;
|
|
410
326
|
this._styles = styles;
|
|
411
327
|
const prevAnimatedProps = this._animatedProps;
|
|
412
328
|
this._animatedProps = this.props.animatedProps;
|
|
413
|
-
|
|
414
329
|
const {
|
|
415
330
|
viewTag,
|
|
416
331
|
viewName,
|
|
417
332
|
shadowNodeWrapper,
|
|
418
333
|
viewConfig
|
|
419
|
-
} = this._getViewInfo();
|
|
420
|
-
|
|
334
|
+
} = this._getViewInfo();
|
|
421
335
|
|
|
336
|
+
// update UI props whitelist for this view
|
|
422
337
|
const hasReanimated2Props = ((_this$props$animatedP2 = this.props.animatedProps) === null || _this$props$animatedP2 === void 0 ? void 0 : _this$props$animatedP2.viewDescriptors) || styles.length;
|
|
423
|
-
|
|
424
338
|
if (hasReanimated2Props && viewConfig) {
|
|
425
339
|
adaptViewConfig(viewConfig);
|
|
426
340
|
}
|
|
341
|
+
this._viewTag = viewTag;
|
|
427
342
|
|
|
428
|
-
|
|
429
|
-
|
|
343
|
+
// remove old styles
|
|
430
344
|
if (prevStyles) {
|
|
431
345
|
// in most of the cases, views have only a single animated style and it remains unchanged
|
|
432
346
|
const hasOneSameStyle = styles.length === 1 && prevStyles.length === 1 && isSameAnimatedStyle(styles[0], prevStyles[0]);
|
|
433
|
-
|
|
434
347
|
if (!hasOneSameStyle) {
|
|
435
348
|
// otherwise, remove each style that is not present in new styles
|
|
436
349
|
for (const prevStyle of prevStyles) {
|
|
437
350
|
const isPresent = styles.some(style => isSameAnimatedStyle(style, prevStyle));
|
|
438
|
-
|
|
439
351
|
if (!isPresent) {
|
|
440
352
|
prevStyle.viewDescriptors.remove(viewTag);
|
|
441
353
|
}
|
|
442
354
|
}
|
|
443
355
|
}
|
|
444
356
|
}
|
|
445
|
-
|
|
446
357
|
styles.forEach(style => {
|
|
447
358
|
style.viewDescriptors.add({
|
|
448
359
|
tag: viewTag,
|
|
449
360
|
name: viewName,
|
|
450
361
|
shadowNodeWrapper
|
|
451
362
|
});
|
|
452
|
-
|
|
453
363
|
if (isJest()) {
|
|
454
364
|
/**
|
|
455
365
|
* We need to connect Jest's TestObject instance whose contains just props object
|
|
@@ -457,18 +367,20 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
457
367
|
* We can't update props object directly because TestObject contains a copy of props - look at render function:
|
|
458
368
|
* const props = this._filterNonAnimatedProps(this.props);
|
|
459
369
|
*/
|
|
460
|
-
this.animatedStyle.value = {
|
|
370
|
+
this.animatedStyle.value = {
|
|
371
|
+
...this.animatedStyle.value,
|
|
461
372
|
...style.initial.value
|
|
462
373
|
};
|
|
463
374
|
style.animatedStyle.current = this.animatedStyle;
|
|
464
375
|
}
|
|
465
|
-
});
|
|
376
|
+
});
|
|
466
377
|
|
|
378
|
+
// detach old animatedProps
|
|
467
379
|
if (prevAnimatedProps && !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)) {
|
|
468
380
|
prevAnimatedProps.viewDescriptors.remove(viewTag);
|
|
469
|
-
}
|
|
470
|
-
|
|
381
|
+
}
|
|
471
382
|
|
|
383
|
+
// attach animatedProps property
|
|
472
384
|
if ((_this$props$animatedP3 = this.props.animatedProps) !== null && _this$props$animatedP3 !== void 0 && _this$props$animatedP3.viewDescriptors) {
|
|
473
385
|
this.props.animatedProps.viewDescriptors.add({
|
|
474
386
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -480,26 +392,21 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
480
392
|
});
|
|
481
393
|
}
|
|
482
394
|
}
|
|
483
|
-
|
|
484
395
|
_attachInlineProps() {
|
|
485
396
|
const newInlineProps = extractSharedValuesMapFromProps(this.props);
|
|
486
397
|
const hasChanged = inlinePropsHasChanged(newInlineProps, this._inlineProps);
|
|
487
|
-
|
|
488
398
|
if (hasChanged) {
|
|
489
399
|
if (!this._inlinePropsViewDescriptors) {
|
|
490
400
|
this._inlinePropsViewDescriptors = makeViewDescriptorsSet();
|
|
491
|
-
|
|
492
401
|
const {
|
|
493
402
|
viewTag,
|
|
494
403
|
viewName,
|
|
495
404
|
shadowNodeWrapper,
|
|
496
405
|
viewConfig
|
|
497
406
|
} = this._getViewInfo();
|
|
498
|
-
|
|
499
407
|
if (Object.keys(newInlineProps).length && viewConfig) {
|
|
500
408
|
adaptViewConfig(viewConfig);
|
|
501
409
|
}
|
|
502
|
-
|
|
503
410
|
this._inlinePropsViewDescriptors.add({
|
|
504
411
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
505
412
|
tag: viewTag,
|
|
@@ -509,7 +416,6 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
509
416
|
shadowNodeWrapper: shadowNodeWrapper
|
|
510
417
|
});
|
|
511
418
|
}
|
|
512
|
-
|
|
513
419
|
const sharableViewDescriptors = this._inlinePropsViewDescriptors.sharableViewDescriptors;
|
|
514
420
|
const maybeViewRef = NativeReanimatedModule.native ? undefined : {
|
|
515
421
|
items: new Set([this])
|
|
@@ -521,41 +427,30 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
521
427
|
const update = getInlinePropsUpdate(newInlineProps);
|
|
522
428
|
updateProps(sharableViewDescriptors, update, maybeViewRef);
|
|
523
429
|
};
|
|
524
|
-
|
|
525
430
|
this._inlineProps = newInlineProps;
|
|
526
|
-
|
|
527
431
|
if (this._inlinePropsMapperId) {
|
|
528
432
|
stopMapper(this._inlinePropsMapperId);
|
|
529
433
|
}
|
|
530
|
-
|
|
531
434
|
this._inlinePropsMapperId = null;
|
|
532
|
-
|
|
533
435
|
if (Object.keys(newInlineProps).length) {
|
|
534
436
|
this._inlinePropsMapperId = startMapper(updaterFunction, Object.values(newInlineProps));
|
|
535
437
|
}
|
|
536
438
|
}
|
|
537
439
|
}
|
|
538
|
-
|
|
539
440
|
_detachInlineProps() {
|
|
540
441
|
if (this._inlinePropsMapperId) {
|
|
541
442
|
stopMapper(this._inlinePropsMapperId);
|
|
542
443
|
}
|
|
543
444
|
}
|
|
544
|
-
|
|
545
445
|
componentDidUpdate(prevProps) {
|
|
546
446
|
this._reattachNativeEvents(prevProps);
|
|
547
|
-
|
|
548
447
|
this._attachAnimatedStyles();
|
|
549
|
-
|
|
550
448
|
this._attachInlineProps();
|
|
551
449
|
}
|
|
552
|
-
|
|
553
450
|
_filterNonAnimatedProps(inputProps) {
|
|
554
451
|
const props = {};
|
|
555
|
-
|
|
556
452
|
for (const key in inputProps) {
|
|
557
453
|
const value = inputProps[key];
|
|
558
|
-
|
|
559
454
|
if (key === 'style') {
|
|
560
455
|
const styleProp = inputProps.style;
|
|
561
456
|
const styles = flattenArray(styleProp ?? []);
|
|
@@ -563,27 +458,23 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
563
458
|
if (style && style.viewDescriptors) {
|
|
564
459
|
// this is how we recognize styles returned by useAnimatedStyle
|
|
565
460
|
style.viewsRef.add(this);
|
|
566
|
-
|
|
567
461
|
if (this._isFirstRender) {
|
|
568
|
-
this.initialStyle = {
|
|
462
|
+
this.initialStyle = {
|
|
463
|
+
...style.initial.value,
|
|
569
464
|
...initialUpdaterRun(style.initial.updater)
|
|
570
465
|
};
|
|
571
466
|
}
|
|
572
|
-
|
|
573
467
|
return this.initialStyle;
|
|
574
468
|
} else if (hasInlineStyles(style)) {
|
|
575
469
|
if (this._isFirstRender) {
|
|
576
470
|
return getInlinePropsUpdate(style);
|
|
577
471
|
}
|
|
578
|
-
|
|
579
472
|
const newStyle = {};
|
|
580
|
-
|
|
581
473
|
for (const [key, styleValue] of Object.entries(style)) {
|
|
582
474
|
if (!isSharedValue(styleValue) && !(key === 'transform' && isInlineStyleTransform(styleValue))) {
|
|
583
475
|
newStyle[key] = styleValue;
|
|
584
476
|
}
|
|
585
477
|
}
|
|
586
|
-
|
|
587
478
|
return newStyle;
|
|
588
479
|
} else {
|
|
589
480
|
return style;
|
|
@@ -592,11 +483,9 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
592
483
|
props[key] = StyleSheet.flatten(processedStyle);
|
|
593
484
|
} else if (key === 'animatedProps') {
|
|
594
485
|
const animatedProp = inputProps.animatedProps;
|
|
595
|
-
|
|
596
486
|
if (animatedProp.initial !== undefined) {
|
|
597
487
|
Object.keys(animatedProp.initial.value).forEach(key => {
|
|
598
488
|
var _animatedProp$initial, _animatedProp$viewsRe;
|
|
599
|
-
|
|
600
489
|
props[key] = (_animatedProp$initial = animatedProp.initial) === null || _animatedProp$initial === void 0 ? void 0 : _animatedProp$initial.value[key];
|
|
601
490
|
(_animatedProp$viewsRe = animatedProp.viewsRef) === null || _animatedProp$viewsRe === void 0 ? void 0 : _animatedProp$viewsRe.add(this);
|
|
602
491
|
});
|
|
@@ -617,21 +506,16 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
617
506
|
props[key] = value;
|
|
618
507
|
}
|
|
619
508
|
}
|
|
620
|
-
|
|
621
509
|
return props;
|
|
622
510
|
}
|
|
623
|
-
|
|
624
511
|
render() {
|
|
625
512
|
const props = this._filterNonAnimatedProps(this.props);
|
|
626
|
-
|
|
627
513
|
if (isJest()) {
|
|
628
514
|
props.animatedStyle = this.animatedStyle;
|
|
629
515
|
}
|
|
630
|
-
|
|
631
516
|
if (this._isFirstRender) {
|
|
632
517
|
this._isFirstRender = false;
|
|
633
518
|
}
|
|
634
|
-
|
|
635
519
|
const platformProps = Platform.select({
|
|
636
520
|
web: {},
|
|
637
521
|
default: {
|
|
@@ -642,11 +526,8 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
642
526
|
ref: this._setComponentRef
|
|
643
527
|
}, platformProps));
|
|
644
528
|
}
|
|
645
|
-
|
|
646
529
|
}
|
|
647
|
-
|
|
648
530
|
_defineProperty(AnimatedComponent, "displayName", void 0);
|
|
649
|
-
|
|
650
531
|
AnimatedComponent.displayName = `AnimatedComponent(${Component.displayName || Component.name || 'Component'})`;
|
|
651
532
|
return /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
652
533
|
return /*#__PURE__*/React.createElement(AnimatedComponent, _extends({}, props, ref === null ? null : {
|