react-native-reanimated 3.8.1 → 3.9.0-layout-animation-experimental
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/ShadowTreeCloner.cpp +5 -2
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +42 -32
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +5 -7
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +565 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +74 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +140 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +216 -58
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +32 -11
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -17
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -8
- package/Common/cpp/ReanimatedRuntime/RNRuntimeDecorator.cpp +3 -0
- package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +3 -4
- package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +8 -3
- package/Common/cpp/SharedItems/Shareables.cpp +31 -5
- package/Common/cpp/SharedItems/Shareables.h +18 -2
- package/Common/cpp/Tools/JSScheduler.cpp +29 -5
- package/Common/cpp/Tools/JSScheduler.h +21 -4
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -2
- package/Common/cpp/Tools/UIRuntimeDecorator.cpp +6 -0
- package/Common/cpp/Tools/UIRuntimeDecorator.h +1 -0
- package/android/CMakeLists.txt +3 -0
- package/android/build.gradle +17 -5
- package/android/src/main/cpp/NativeProxy.cpp +77 -12
- package/android/src/main/cpp/NativeProxy.h +35 -1
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +58 -19
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +7 -2
- package/android/src/{reactNativeVersionPatch/ReanimatedUIManager/latest → main/java}/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +5 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -6
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +18 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +105 -17
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +2 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeReanimatedModuleSpec.java +37 -0
- package/android/src/{main/java/com/swmansion/reanimated → reactNativeVersionPatch/ReanimatedUIManager/73/com/swmansion}/ReanimatedModule.java +4 -3
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/{70 → 73}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -22
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedModule.java +176 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -26
- package/android/src/{fabric/java → reactNativeVersionPatch/RuntimeExecutor/73}/com/swmansion/reanimated/NativeProxy.java +16 -4
- package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +143 -0
- package/apple/LayoutReanimation/REAAnimationsManager.h +3 -0
- package/apple/LayoutReanimation/REAAnimationsManager.m +11 -0
- package/apple/LayoutReanimation/REASharedTransitionManager.m +99 -23
- package/apple/LayoutReanimation/REASnapshot.h +1 -0
- package/apple/LayoutReanimation/REASnapshot.m +78 -37
- package/apple/REAModule.h +22 -2
- package/apple/REAModule.mm +97 -46
- package/apple/REANodesManager.h +3 -3
- package/apple/REANodesManager.mm +46 -22
- package/apple/native/NativeProxy.h +28 -2
- package/apple/native/NativeProxy.mm +65 -195
- package/apple/native/PlatformDepMethodsHolderImpl.h +59 -0
- package/apple/native/PlatformDepMethodsHolderImpl.mm +429 -0
- package/apple/sensor/ReanimatedSensor.m +5 -5
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +1 -1
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/animationBuilder.js.map +1 -1
- package/lib/module/createAnimatedComponent/InlinePropManager.js +4 -4
- package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +9 -6
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js +11 -0
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -0
- package/lib/module/createAnimatedComponent/PropsFilter.js +25 -9
- package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
- package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +83 -52
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js +37 -0
- package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -0
- package/lib/module/createAnimatedComponent/index.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/createAnimatedComponent/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/mock.js +3 -8
- package/lib/module/mock.js.map +1 -1
- package/lib/module/propsAllowlists.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +4 -11
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -7
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -13
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js +2 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +1 -1
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/PropsRegistry.js +1 -2
- package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
- package/lib/module/reanimated2/Sensor.js +2 -2
- package/lib/module/reanimated2/Sensor.js.map +1 -1
- package/lib/module/reanimated2/SensorContainer.js +2 -2
- package/lib/module/reanimated2/SensorContainer.js.map +1 -1
- package/lib/module/reanimated2/UpdateLayoutAnimations.js +30 -8
- package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/clamp.js.map +1 -1
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- 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 +1 -6
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +1 -5
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +8 -10
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +4 -1
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +22 -2
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +3 -1
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +1 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js +1 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/PerformanceMonitor.js +169 -0
- package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -0
- package/lib/module/reanimated2/component/ScrollView.js +1 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js +1 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js +1 -0
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -15
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +8 -8
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +33 -8
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/helperTypes.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 +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +12 -7
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +4 -5
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +3 -1
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +60 -16
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +2 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +1 -5
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +2 -6
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +1 -1
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/isSharedValue.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +3 -6
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +5 -9
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +2 -2
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +12 -11
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +12 -10
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- 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 +11 -4
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
- 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 +17 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
- 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/ProgressTransitionManager.js +16 -12
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +13 -7
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +2 -4
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -4
- 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.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/publicGlobals.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +11 -19
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js +20 -0
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js +41 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js +4 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/index.js +5 -0
- package/lib/module/reanimated2/screenTransition/index.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/presets.js +157 -0
- package/lib/module/reanimated2/screenTransition/presets.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js +62 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js +190 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -0
- package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +27 -10
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +9 -34
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/reanimated2/valueUnpacker.js +4 -3
- package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
- package/lib/module/specs/NativeReanimatedModule.js +5 -0
- package/lib/module/specs/NativeReanimatedModule.js.map +1 -0
- package/lib/typescript/ConfigHelper.d.ts +1 -0
- package/lib/typescript/createAnimatedComponent/InlinePropManager.d.ts +1 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.web.d.ts +6 -0
- package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +3 -0
- package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts +9 -0
- package/lib/typescript/reanimated2/NativeReanimated/NativeReanimated.d.ts +8 -13
- package/lib/typescript/reanimated2/UpdateLayoutAnimations.d.ts +12 -1
- package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
- package/lib/typescript/reanimated2/animation/util.d.ts +2 -0
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
- package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -0
- package/lib/typescript/reanimated2/core.d.ts +3 -4
- package/lib/typescript/reanimated2/hook/commonTypes.d.ts +6 -0
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
- package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +3 -1
- package/lib/typescript/reanimated2/index.d.ts +3 -0
- package/lib/typescript/reanimated2/js-reanimated/JSReanimated.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +2 -1
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +2 -2
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/screenTransition/RNScreensTurboModule.d.ts +2 -0
- package/lib/typescript/reanimated2/screenTransition/animationManager.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/commonTypes.d.ts +38 -0
- package/lib/typescript/reanimated2/screenTransition/index.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/presets.d.ts +11 -0
- package/lib/typescript/reanimated2/screenTransition/styleUpdater.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/swipeSimulator.d.ts +2 -0
- package/lib/typescript/specs/NativeReanimatedModule.d.ts +6 -0
- package/package.json +29 -17
- package/plugin/build/plugin.js +7 -2
- package/src/ConfigHelper.ts +1 -1
- package/src/createAnimatedComponent/InlinePropManager.ts +2 -2
- package/src/createAnimatedComponent/JSPropsUpdater.ts +7 -6
- package/src/createAnimatedComponent/JSPropsUpdater.web.ts +26 -0
- package/src/createAnimatedComponent/PropsFilter.tsx +31 -6
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +108 -60
- package/src/createAnimatedComponent/getViewInfo.ts +39 -0
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +33 -35
- package/src/reanimated2/PlatformChecker.ts +3 -2
- package/src/reanimated2/PropsRegistry.ts +1 -3
- package/src/reanimated2/UpdateLayoutAnimations.ts +53 -13
- package/src/reanimated2/WorkletEventHandler.ts +98 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -6
- package/src/reanimated2/animation/timing.ts +9 -1
- package/src/reanimated2/animation/util.ts +28 -3
- package/src/reanimated2/commonTypes.ts +4 -1
- package/src/reanimated2/component/PerformanceMonitor.tsx +216 -0
- package/src/reanimated2/core.ts +9 -31
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/fabricUtils.ts +43 -18
- package/src/reanimated2/globals.d.ts +11 -1
- package/src/reanimated2/hook/commonTypes.ts +10 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +20 -11
- package/src/reanimated2/hook/useEvent.ts +4 -4
- package/src/reanimated2/hook/useScrollViewOffset.ts +94 -23
- package/src/reanimated2/index.ts +11 -0
- package/src/reanimated2/js-reanimated/JSReanimated.ts +7 -7
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationsManager.ts +10 -2
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +17 -8
- package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +26 -7
- package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
- package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
- package/src/reanimated2/screenTransition/RNScreensTurboModule.ts +29 -0
- package/src/reanimated2/screenTransition/animationManager.ts +45 -0
- package/src/reanimated2/screenTransition/commonTypes.ts +63 -0
- package/src/reanimated2/screenTransition/index.ts +12 -0
- package/src/reanimated2/screenTransition/presets.ts +137 -0
- package/src/reanimated2/screenTransition/styleUpdater.ts +73 -0
- package/src/reanimated2/screenTransition/swipeSimulator.ts +238 -0
- package/src/reanimated2/shareables.ts +29 -6
- package/src/reanimated2/valueUnpacker.ts +10 -3
- package/src/specs/NativeReanimatedModule.ts +9 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +0 -16
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +0 -12
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import { TextInput, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useSharedValue, useAnimatedProps, useFrameCallback } from '../hook';
|
|
6
|
+
import { createAnimatedComponent } from '../../createAnimatedComponent';
|
|
7
|
+
import { addWhitelistedNativeProps } from '../../ConfigHelper';
|
|
8
|
+
function createCircularDoublesBuffer(size) {
|
|
9
|
+
'worklet';
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
next: 0,
|
|
13
|
+
buffer: new Float32Array(size),
|
|
14
|
+
size,
|
|
15
|
+
count: 0,
|
|
16
|
+
push(value) {
|
|
17
|
+
const oldValue = this.buffer[this.next];
|
|
18
|
+
const oldCount = this.count;
|
|
19
|
+
this.buffer[this.next] = value;
|
|
20
|
+
this.next = (this.next + 1) % this.size;
|
|
21
|
+
this.count = Math.min(this.size, this.count + 1);
|
|
22
|
+
return oldCount === this.size ? oldValue : null;
|
|
23
|
+
},
|
|
24
|
+
front() {
|
|
25
|
+
const notEmpty = this.count > 0;
|
|
26
|
+
if (notEmpty) {
|
|
27
|
+
const current = this.next - 1;
|
|
28
|
+
const index = current < 0 ? this.size - 1 : current;
|
|
29
|
+
return this.buffer[index];
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
},
|
|
33
|
+
back() {
|
|
34
|
+
const notEmpty = this.count > 0;
|
|
35
|
+
return notEmpty ? this.buffer[this.next] : null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const DEFAULT_BUFFER_SIZE = 60;
|
|
40
|
+
addWhitelistedNativeProps({
|
|
41
|
+
text: true
|
|
42
|
+
});
|
|
43
|
+
const AnimatedTextInput = createAnimatedComponent(TextInput);
|
|
44
|
+
function loopAnimationFrame(fn) {
|
|
45
|
+
let lastTime = 0;
|
|
46
|
+
function loop() {
|
|
47
|
+
requestAnimationFrame(time => {
|
|
48
|
+
if (lastTime > 0) {
|
|
49
|
+
fn(lastTime, time);
|
|
50
|
+
}
|
|
51
|
+
lastTime = time;
|
|
52
|
+
requestAnimationFrame(loop);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
loop();
|
|
56
|
+
}
|
|
57
|
+
function getFps(renderTimeInMs) {
|
|
58
|
+
'worklet';
|
|
59
|
+
|
|
60
|
+
return 1000 / renderTimeInMs;
|
|
61
|
+
}
|
|
62
|
+
function getTimeDelta(timestamp, previousTimestamp) {
|
|
63
|
+
'worklet';
|
|
64
|
+
|
|
65
|
+
return previousTimestamp !== null ? timestamp - previousTimestamp : 0;
|
|
66
|
+
}
|
|
67
|
+
function completeBufferRoutine(buffer, timestamp, previousTimestamp, totalRenderTime) {
|
|
68
|
+
'worklet';
|
|
69
|
+
|
|
70
|
+
timestamp = Math.round(timestamp);
|
|
71
|
+
previousTimestamp = Math.round(previousTimestamp) ?? timestamp;
|
|
72
|
+
const droppedTimestamp = buffer.push(timestamp);
|
|
73
|
+
const nextToDrop = buffer.back();
|
|
74
|
+
const delta = getTimeDelta(timestamp, previousTimestamp);
|
|
75
|
+
const droppedDelta = getTimeDelta(nextToDrop, droppedTimestamp);
|
|
76
|
+
totalRenderTime.value += delta - droppedDelta;
|
|
77
|
+
return getFps(totalRenderTime.value / buffer.count);
|
|
78
|
+
}
|
|
79
|
+
function JsPerformance() {
|
|
80
|
+
const jsFps = useSharedValue(null);
|
|
81
|
+
const totalRenderTime = useSharedValue(0);
|
|
82
|
+
const circularBuffer = useRef(createCircularDoublesBuffer(DEFAULT_BUFFER_SIZE));
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
loopAnimationFrame((_, timestamp) => {
|
|
85
|
+
timestamp = Math.round(timestamp);
|
|
86
|
+
const previousTimestamp = circularBuffer.current.front() ?? timestamp;
|
|
87
|
+
const currentFps = completeBufferRoutine(circularBuffer.current, timestamp, previousTimestamp, totalRenderTime);
|
|
88
|
+
|
|
89
|
+
// JS fps have to be measured every 2nd frame,
|
|
90
|
+
// thus 2x multiplication has to occur here
|
|
91
|
+
jsFps.value = (currentFps * 2).toFixed(0);
|
|
92
|
+
});
|
|
93
|
+
}, []);
|
|
94
|
+
const animatedProps = useAnimatedProps(() => {
|
|
95
|
+
const text = 'JS: ' + jsFps.value ?? 'N/A';
|
|
96
|
+
return {
|
|
97
|
+
text,
|
|
98
|
+
defaultValue: text
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
102
|
+
style: styles.container
|
|
103
|
+
}, /*#__PURE__*/React.createElement(AnimatedTextInput, {
|
|
104
|
+
style: styles.text,
|
|
105
|
+
animatedProps: animatedProps,
|
|
106
|
+
editable: false
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
function UiPerformance() {
|
|
110
|
+
const uiFps = useSharedValue(null);
|
|
111
|
+
const totalRenderTime = useSharedValue(0);
|
|
112
|
+
const circularBuffer = useSharedValue(null);
|
|
113
|
+
useFrameCallback(({
|
|
114
|
+
timestamp
|
|
115
|
+
}) => {
|
|
116
|
+
if (circularBuffer.value === null) {
|
|
117
|
+
circularBuffer.value = createCircularDoublesBuffer(DEFAULT_BUFFER_SIZE);
|
|
118
|
+
}
|
|
119
|
+
timestamp = Math.round(timestamp);
|
|
120
|
+
const previousTimestamp = circularBuffer.value.front() ?? timestamp;
|
|
121
|
+
const currentFps = completeBufferRoutine(circularBuffer.value, timestamp, previousTimestamp, totalRenderTime);
|
|
122
|
+
uiFps.value = currentFps.toFixed(0);
|
|
123
|
+
});
|
|
124
|
+
const animatedProps = useAnimatedProps(() => {
|
|
125
|
+
const text = 'UI: ' + uiFps.value ?? 'N/A';
|
|
126
|
+
return {
|
|
127
|
+
text,
|
|
128
|
+
defaultValue: text
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
132
|
+
style: styles.container
|
|
133
|
+
}, /*#__PURE__*/React.createElement(AnimatedTextInput, {
|
|
134
|
+
style: styles.text,
|
|
135
|
+
animatedProps: animatedProps,
|
|
136
|
+
editable: false
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
export function PerformanceMonitor() {
|
|
140
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
141
|
+
style: styles.monitor
|
|
142
|
+
}, /*#__PURE__*/React.createElement(JsPerformance, null), /*#__PURE__*/React.createElement(UiPerformance, null));
|
|
143
|
+
}
|
|
144
|
+
const styles = StyleSheet.create({
|
|
145
|
+
monitor: {
|
|
146
|
+
flexDirection: 'row',
|
|
147
|
+
position: 'absolute',
|
|
148
|
+
backgroundColor: '#0006',
|
|
149
|
+
zIndex: 1000
|
|
150
|
+
},
|
|
151
|
+
header: {
|
|
152
|
+
fontSize: 14,
|
|
153
|
+
color: '#ffff',
|
|
154
|
+
paddingHorizontal: 5
|
|
155
|
+
},
|
|
156
|
+
text: {
|
|
157
|
+
fontSize: 13,
|
|
158
|
+
color: '#ffff',
|
|
159
|
+
fontFamily: 'monospace',
|
|
160
|
+
paddingHorizontal: 3
|
|
161
|
+
},
|
|
162
|
+
container: {
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
flexDirection: 'row',
|
|
166
|
+
flexWrap: 'wrap'
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
//# sourceMappingURL=PerformanceMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","TextInput","StyleSheet","View","useSharedValue","useAnimatedProps","useFrameCallback","createAnimatedComponent","addWhitelistedNativeProps","createCircularDoublesBuffer","size","next","buffer","Float32Array","count","push","value","oldValue","oldCount","Math","min","front","notEmpty","current","index","back","DEFAULT_BUFFER_SIZE","text","AnimatedTextInput","loopAnimationFrame","fn","lastTime","loop","requestAnimationFrame","time","getFps","renderTimeInMs","getTimeDelta","timestamp","previousTimestamp","completeBufferRoutine","totalRenderTime","round","droppedTimestamp","nextToDrop","delta","droppedDelta","JsPerformance","jsFps","circularBuffer","_","currentFps","toFixed","animatedProps","defaultValue","createElement","style","styles","container","editable","UiPerformance","uiFps","PerformanceMonitor","monitor","create","flexDirection","position","backgroundColor","zIndex","header","fontSize","color","paddingHorizontal","fontFamily","alignItems","justifyContent","flexWrap"],"sources":["PerformanceMonitor.tsx"],"sourcesContent":["'use strict';\n\nimport React, { useEffect, useRef } from 'react';\nimport { TextInput, StyleSheet, View } from 'react-native';\n\nimport type { FrameInfo } from '../frameCallback';\nimport type { SharedValue } from '../commonTypes';\nimport { useSharedValue, useAnimatedProps, useFrameCallback } from '../hook';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport { addWhitelistedNativeProps } from '../../ConfigHelper';\n\ntype CircularBuffer = ReturnType<typeof createCircularDoublesBuffer>;\nfunction createCircularDoublesBuffer(size: number) {\n 'worklet';\n\n return {\n next: 0 as number,\n buffer: new Float32Array(size),\n size,\n count: 0 as number,\n\n push(value: number): number | null {\n const oldValue = this.buffer[this.next];\n const oldCount = this.count;\n this.buffer[this.next] = value;\n\n this.next = (this.next + 1) % this.size;\n this.count = Math.min(this.size, this.count + 1);\n return oldCount === this.size ? oldValue : null;\n },\n\n front(): number | null {\n const notEmpty = this.count > 0;\n if (notEmpty) {\n const current = this.next - 1;\n const index = current < 0 ? this.size - 1 : current;\n return this.buffer[index];\n }\n return null;\n },\n\n back(): number | null {\n const notEmpty = this.count > 0;\n return notEmpty ? this.buffer[this.next] : null;\n },\n };\n}\n\nconst DEFAULT_BUFFER_SIZE = 60;\naddWhitelistedNativeProps({ text: true });\nconst AnimatedTextInput = createAnimatedComponent(TextInput);\n\nfunction loopAnimationFrame(fn: (lastTime: number, time: number) => void) {\n let lastTime = 0;\n\n function loop() {\n requestAnimationFrame((time) => {\n if (lastTime > 0) {\n fn(lastTime, time);\n }\n lastTime = time;\n requestAnimationFrame(loop);\n });\n }\n\n loop();\n}\n\nfunction getFps(renderTimeInMs: number): number {\n 'worklet';\n return 1000 / renderTimeInMs;\n}\n\nfunction getTimeDelta(\n timestamp: number,\n previousTimestamp: number | null\n): number {\n 'worklet';\n return previousTimestamp !== null ? timestamp - previousTimestamp : 0;\n}\n\nfunction completeBufferRoutine(\n buffer: CircularBuffer,\n timestamp: number,\n previousTimestamp: number,\n totalRenderTime: SharedValue<number>\n): number {\n 'worklet';\n timestamp = Math.round(timestamp);\n previousTimestamp = Math.round(previousTimestamp) ?? timestamp;\n\n const droppedTimestamp = buffer.push(timestamp);\n const nextToDrop = buffer.back()!;\n\n const delta = getTimeDelta(timestamp, previousTimestamp);\n const droppedDelta = getTimeDelta(nextToDrop, droppedTimestamp);\n\n totalRenderTime.value += delta - droppedDelta;\n\n return getFps(totalRenderTime.value / buffer.count);\n}\n\nfunction JsPerformance() {\n const jsFps = useSharedValue<string | null>(null);\n const totalRenderTime = useSharedValue(0);\n const circularBuffer = useRef<CircularBuffer>(\n createCircularDoublesBuffer(DEFAULT_BUFFER_SIZE)\n );\n\n useEffect(() => {\n loopAnimationFrame((_, timestamp) => {\n timestamp = Math.round(timestamp);\n const previousTimestamp = circularBuffer.current.front() ?? timestamp;\n\n const currentFps = completeBufferRoutine(\n circularBuffer.current,\n timestamp,\n previousTimestamp,\n totalRenderTime\n );\n\n // JS fps have to be measured every 2nd frame,\n // thus 2x multiplication has to occur here\n jsFps.value = (currentFps * 2).toFixed(0);\n });\n }, []);\n\n const animatedProps = useAnimatedProps(() => {\n const text = 'JS: ' + jsFps.value ?? 'N/A';\n return { text, defaultValue: text };\n });\n\n return (\n <View style={styles.container}>\n <AnimatedTextInput\n style={styles.text}\n animatedProps={animatedProps}\n editable={false}\n />\n </View>\n );\n}\n\nfunction UiPerformance() {\n const uiFps = useSharedValue<string | null>(null);\n const totalRenderTime = useSharedValue(0);\n const circularBuffer = useSharedValue<CircularBuffer | null>(null);\n\n useFrameCallback(({ timestamp }: FrameInfo) => {\n if (circularBuffer.value === null) {\n circularBuffer.value = createCircularDoublesBuffer(DEFAULT_BUFFER_SIZE);\n }\n\n timestamp = Math.round(timestamp);\n const previousTimestamp = circularBuffer.value.front() ?? timestamp;\n\n const currentFps = completeBufferRoutine(\n circularBuffer.value,\n timestamp,\n previousTimestamp,\n totalRenderTime\n );\n\n uiFps.value = currentFps.toFixed(0);\n });\n\n const animatedProps = useAnimatedProps(() => {\n const text = 'UI: ' + uiFps.value ?? 'N/A';\n return { text, defaultValue: text };\n });\n\n return (\n <View style={styles.container}>\n <AnimatedTextInput\n style={styles.text}\n animatedProps={animatedProps}\n editable={false}\n />\n </View>\n );\n}\n\nexport function PerformanceMonitor() {\n return (\n <View style={styles.monitor}>\n <JsPerformance />\n <UiPerformance />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n monitor: {\n flexDirection: 'row',\n position: 'absolute',\n backgroundColor: '#0006',\n zIndex: 1000,\n },\n header: {\n fontSize: 14,\n color: '#ffff',\n paddingHorizontal: 5,\n },\n text: {\n fontSize: 13,\n color: '#ffff',\n fontFamily: 'monospace',\n paddingHorizontal: 3,\n },\n container: {\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n});\n"],"mappings":"AAAA,YAAY;;AAE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CAAC,CAAC;EAEF,oBACE7B,KAAA,CAAAyD,aAAA,CAACpD,IAAI;IAACqD,KAAK,EAAEC,MAAM,CAACC;EAAU,gBAC5B5D,KAAA,CAAAyD,aAAA,CAAC3B,iBAAiB;IAChB4B,KAAK,EAAEC,MAAM,CAAC9B,IAAK;IACnB0B,aAAa,EAAEA,aAAc;IAC7BM,QAAQ,EAAE;EAAM,CACjB,CACG,CAAC;AAEX;AAEA,OAAO,SAASG,kBAAkBA,CAAA,EAAG;EACnC,oBACEhE,KAAA,CAAAyD,aAAA,CAACpD,IAAI;IAACqD,KAAK,EAAEC,MAAM,CAACM;EAAQ,gBAC1BjE,KAAA,CAAAyD,aAAA,CAACR,aAAa,MAAE,CAAC,eACjBjD,KAAA,CAAAyD,aAAA,CAACK,aAAa,MAAE,CACZ,CAAC;AAEX;AAEA,MAAMH,MAAM,GAAGvD,UAAU,CAAC8D,MAAM,CAAC;EAC/BD,OAAO,EAAE;IACPE,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,UAAU;IACpBC,eAAe,EAAE,OAAO;IACxBC,MAAM,EAAE;EACV,CAAC;EACDC,MAAM,EAAE;IACNC,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAE,OAAO;IACdC,iBAAiB,EAAE;EACrB,CAAC;EACD7C,IAAI,EAAE;IACJ2C,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAE,OAAO;IACdE,UAAU,EAAE,WAAW;IACvBD,iBAAiB,EAAE;EACrB,CAAC;EACDd,SAAS,EAAE;IACTgB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBV,aAAa,EAAE,KAAK;IACpBW,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ import { useAnimatedRef, useScrollViewOffset } from '../hook';
|
|
|
8
8
|
|
|
9
9
|
// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,
|
|
10
10
|
// but not things like NativeMethods, etc. we need to add them manually by extending the type.
|
|
11
|
+
|
|
11
12
|
const AnimatedScrollViewComponent = createAnimatedComponent(ScrollView);
|
|
12
13
|
export const AnimatedScrollView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
13
14
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","ScrollView","createAnimatedComponent","useAnimatedRef","useScrollViewOffset","AnimatedScrollViewComponent","AnimatedScrollView","props","ref","scrollViewOffset","restProps","animatedRef","scrollEventThrottle","createElement"],"sources":["ScrollView.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type { ScrollViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { SharedValue } from '../commonTypes';\nimport type { AnimatedRef } from '../hook';\nimport { useAnimatedRef, useScrollViewOffset } from '../hook';\nimport type { AnimatedProps } from '../helperTypes';\n\nexport interface AnimatedScrollViewProps\n extends AnimatedProps<ScrollViewProps> {\n scrollViewOffset?: SharedValue<number>;\n}\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedScrollViewComplement extends ScrollView {\n getNode(): ScrollView;\n}\n\nconst AnimatedScrollViewComponent = createAnimatedComponent(ScrollView);\n\nexport const AnimatedScrollView = forwardRef(\n (props: AnimatedScrollViewProps, ref: ForwardedRef<AnimatedScrollView>) => {\n const { scrollViewOffset, ...restProps } = props;\n const animatedRef = (\n ref === null\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedRef<ScrollView>()\n : ref\n ) as AnimatedRef<AnimatedScrollView>;\n\n if (scrollViewOffset) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useScrollViewOffset(animatedRef, scrollViewOffset);\n }\n\n // Set default scrollEventThrottle, because user expects\n // to have continuous scroll events.\n // We set it to 1 so we have peace until\n // there are 960 fps screens.\n if (!('scrollEventThrottle' in restProps)) {\n restProps.scrollEventThrottle = 1;\n }\n\n return <AnimatedScrollViewComponent ref={animatedRef} {...restProps} />;\n }\n);\n\nexport type AnimatedScrollView = AnimatedScrollViewComplement &\n typeof AnimatedScrollViewComponent;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEb,OAAOQ,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,uBAAuB,QAAQ,+BAA+B;AAGvE,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,SAAS;;AAQ7D;AACA
|
|
1
|
+
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","ScrollView","createAnimatedComponent","useAnimatedRef","useScrollViewOffset","AnimatedScrollViewComponent","AnimatedScrollView","props","ref","scrollViewOffset","restProps","animatedRef","scrollEventThrottle","createElement"],"sources":["ScrollView.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type { ScrollViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { SharedValue } from '../commonTypes';\nimport type { AnimatedRef } from '../hook';\nimport { useAnimatedRef, useScrollViewOffset } from '../hook';\nimport type { AnimatedProps } from '../helperTypes';\n\nexport interface AnimatedScrollViewProps\n extends AnimatedProps<ScrollViewProps> {\n scrollViewOffset?: SharedValue<number>;\n}\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedScrollViewComplement extends ScrollView {\n getNode(): ScrollView;\n}\n\nconst AnimatedScrollViewComponent = createAnimatedComponent(ScrollView);\n\nexport const AnimatedScrollView = forwardRef(\n (props: AnimatedScrollViewProps, ref: ForwardedRef<AnimatedScrollView>) => {\n const { scrollViewOffset, ...restProps } = props;\n const animatedRef = (\n ref === null\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedRef<ScrollView>()\n : ref\n ) as AnimatedRef<AnimatedScrollView>;\n\n if (scrollViewOffset) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useScrollViewOffset(animatedRef, scrollViewOffset);\n }\n\n // Set default scrollEventThrottle, because user expects\n // to have continuous scroll events.\n // We set it to 1 so we have peace until\n // there are 960 fps screens.\n if (!('scrollEventThrottle' in restProps)) {\n restProps.scrollEventThrottle = 1;\n }\n\n return <AnimatedScrollViewComponent ref={animatedRef} {...restProps} />;\n }\n);\n\nexport type AnimatedScrollView = AnimatedScrollViewComplement &\n typeof AnimatedScrollViewComponent;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEb,OAAOQ,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,uBAAuB,QAAQ,+BAA+B;AAGvE,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,SAAS;;AAQ7D;AACA;;AAKA,MAAMC,2BAA2B,GAAGH,uBAAuB,CAACD,UAAU,CAAC;AAEvE,OAAO,MAAMK,kBAAkB,gBAAGN,UAAU,CAC1C,CAACO,KAA8B,EAAEC,GAAqC,KAAK;EACzE,MAAM;IAAEC,gBAAgB;IAAE,GAAGC;EAAU,CAAC,GAAGH,KAAK;EAChD,MAAMI,WAAW,GACfH,GAAG,KAAK,IAAI;EACR;EACAL,cAAc,CAAa,CAAC,GAC5BK,GAC8B;EAEpC,IAAIC,gBAAgB,EAAE;IACpB;IACAL,mBAAmB,CAACO,WAAW,EAAEF,gBAAgB,CAAC;EACpD;;EAEA;EACA;EACA;EACA;EACA,IAAI,EAAE,qBAAqB,IAAIC,SAAS,CAAC,EAAE;IACzCA,SAAS,CAACE,mBAAmB,GAAG,CAAC;EACnC;EAEA,oBAAOb,KAAA,CAAAc,aAAA,CAACR,2BAA2B,EAAApB,QAAA;IAACuB,GAAG,EAAEG;EAAY,GAAKD,SAAS,CAAG,CAAC;AACzE,CACF,CAAC","ignoreList":[]}
|
|
@@ -5,5 +5,6 @@ import { createAnimatedComponent } from '../../createAnimatedComponent';
|
|
|
5
5
|
|
|
6
6
|
// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,
|
|
7
7
|
// but not things like NativeMethods, etc. we need to add them manually by extending the type.
|
|
8
|
+
|
|
8
9
|
export const AnimatedText = createAnimatedComponent(Text);
|
|
9
10
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","createAnimatedComponent","AnimatedText"],"sources":["Text.ts"],"sourcesContent":["'use strict';\nimport { Text } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedTextComplement extends Text {\n getNode(): Text;\n}\n\nexport const AnimatedText = createAnimatedComponent(Text);\n\nexport type AnimatedText = typeof AnimatedText & AnimatedTextComplement;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;;AAEvE;AACA
|
|
1
|
+
{"version":3,"names":["Text","createAnimatedComponent","AnimatedText"],"sources":["Text.ts"],"sourcesContent":["'use strict';\nimport { Text } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedTextComplement extends Text {\n getNode(): Text;\n}\n\nexport const AnimatedText = createAnimatedComponent(Text);\n\nexport type AnimatedText = typeof AnimatedText & AnimatedTextComplement;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;;AAEvE;AACA;;AAKA,OAAO,MAAMC,YAAY,GAAGD,uBAAuB,CAACD,IAAI,CAAC","ignoreList":[]}
|
|
@@ -5,5 +5,6 @@ import { createAnimatedComponent } from '../../createAnimatedComponent';
|
|
|
5
5
|
|
|
6
6
|
// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,
|
|
7
7
|
// but not things like NativeMethods, etc. we need to add them manually by extending the type.
|
|
8
|
+
|
|
8
9
|
export const AnimatedView = createAnimatedComponent(View);
|
|
9
10
|
//# sourceMappingURL=View.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","createAnimatedComponent","AnimatedView"],"sources":["View.ts"],"sourcesContent":["'use strict';\nimport { View } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedViewComplement extends View {\n getNode(): View;\n}\n\nexport const AnimatedView = createAnimatedComponent(View);\n\nexport type AnimatedView = typeof AnimatedView & AnimatedViewComplement;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;;AAEvE;AACA
|
|
1
|
+
{"version":3,"names":["View","createAnimatedComponent","AnimatedView"],"sources":["View.ts"],"sourcesContent":["'use strict';\nimport { View } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedViewComplement extends View {\n getNode(): View;\n}\n\nexport const AnimatedView = createAnimatedComponent(View);\n\nexport type AnimatedView = typeof AnimatedView & AnimatedViewComplement;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,uBAAuB,QAAQ,+BAA+B;;AAEvE;AACA;;AAKA,OAAO,MAAMC,YAAY,GAAGD,uBAAuB,CAACD,IAAI,CAAC","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ export { runOnJS, runOnUI, executeOnUIRuntimeSync } from './threads';
|
|
|
10
10
|
export { createWorkletRuntime, runOnRuntime } from './runtimes';
|
|
11
11
|
export { makeShareable, makeShareableCloneRecursive } from './shareables';
|
|
12
12
|
export { makeMutable } from './mutables';
|
|
13
|
-
const IS_FABRIC = isFabric();
|
|
14
13
|
const SHOULD_BE_USE_WEB = shouldBeUseWeb();
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -35,14 +34,14 @@ if (SHOULD_BE_USE_WEB) {
|
|
|
35
34
|
global._log = console.log;
|
|
36
35
|
global._getAnimationTimestamp = () => performance.now();
|
|
37
36
|
}
|
|
38
|
-
export function getViewProp(viewTag, propName) {
|
|
39
|
-
if (
|
|
40
|
-
throw new Error('[Reanimated] `getViewProp`
|
|
37
|
+
export function getViewProp(viewTag, propName, component) {
|
|
38
|
+
if (isFabric() && !component) {
|
|
39
|
+
throw new Error('[Reanimated] Function `getViewProp` requires a component to be passed as an argument on Fabric.');
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
44
43
|
return new Promise((resolve, reject) => {
|
|
45
|
-
return NativeReanimatedModule.getViewProp(viewTag, propName, result => {
|
|
44
|
+
return NativeReanimatedModule.getViewProp(viewTag, propName, component, result => {
|
|
46
45
|
if (typeof result === 'string' && result.substr(0, 6) === 'error:') {
|
|
47
46
|
reject(result);
|
|
48
47
|
} else {
|
|
@@ -57,8 +56,7 @@ function getSensorContainer() {
|
|
|
57
56
|
}
|
|
58
57
|
return global.__sensorContainer;
|
|
59
58
|
}
|
|
60
|
-
export function registerEventHandler(eventHandler, eventName) {
|
|
61
|
-
let emitterReactTag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
59
|
+
export function registerEventHandler(eventHandler, eventName, emitterReactTag = -1) {
|
|
62
60
|
function handleAndFlushAnimationFrame(eventTimestamp, event) {
|
|
63
61
|
'worklet';
|
|
64
62
|
|
|
@@ -108,8 +106,7 @@ let featuresConfig = {
|
|
|
108
106
|
enableLayoutAnimations: false,
|
|
109
107
|
setByUser: false
|
|
110
108
|
};
|
|
111
|
-
export function enableLayoutAnimations(flag) {
|
|
112
|
-
let isCallByUser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
109
|
+
export function enableLayoutAnimations(flag, isCallByUser = true) {
|
|
113
110
|
if (isCallByUser) {
|
|
114
111
|
featuresConfig = {
|
|
115
112
|
enableLayoutAnimations: flag,
|
|
@@ -121,12 +118,6 @@ export function enableLayoutAnimations(flag) {
|
|
|
121
118
|
NativeReanimatedModule.enableLayoutAnimations(flag);
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
|
-
export function configureLayoutAnimations(viewTag, type, config) {
|
|
125
|
-
let sharedTransitionTag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
126
|
-
NativeReanimatedModule.configureLayoutAnimation(viewTag,
|
|
127
|
-
// On web this function is no-op, therefore we can cast viewTag to number
|
|
128
|
-
type, sharedTransitionTag, makeShareableCloneRecursive(config));
|
|
129
|
-
}
|
|
130
121
|
export function configureLayoutAnimationBatch(layoutAnimationsBatch) {
|
|
131
122
|
NativeReanimatedModule.configureLayoutAnimationBatch(layoutAnimationsBatch);
|
|
132
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimatedModule","isWeb","shouldBeUseWeb","isFabric","makeShareableCloneRecursive","initializeUIRuntime","SensorContainer","startMapper","stopMapper","runOnJS","runOnUI","executeOnUIRuntimeSync","createWorkletRuntime","runOnRuntime","makeShareable","makeMutable","IS_FABRIC","SHOULD_BE_USE_WEB","isReanimated3","isConfigured","global","_WORKLET","_log","console","log","_getAnimationTimestamp","performance","now","getViewProp","viewTag","propName","Error","Promise","resolve","reject","result","substr","getSensorContainer","__sensorContainer","registerEventHandler","eventHandler","eventName","emitterReactTag","arguments","length","undefined","handleAndFlushAnimationFrame","eventTimestamp","event","__frameTimestamp","__flushAnimationFrame","unregisterEventHandler","id","subscribeForKeyboardEvents","options","state","height","isStatusBarTranslucentAndroid","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","config","sensorContainer","initializeSensor","unregisterSensor","sensorId","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","sharedTransitionTag","configureLayoutAnimation","configureLayoutAnimationBatch","layoutAnimationsBatch","setShouldAnimateExitingForTag","shouldAnimate","jsiConfigureProps","uiProps","nativeProps","configureProps"],"sources":["core.ts"],"sourcesContent":["'use strict';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { isWeb, shouldBeUseWeb, isFabric } from './PlatformChecker';\nimport type {\n AnimatedKeyboardOptions,\n SensorConfig,\n SensorType,\n SharedValue,\n Value3D,\n ValueRotation,\n} from './commonTypes';\nimport { makeShareableCloneRecursive } from './shareables';\nimport type {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './layoutReanimation';\nimport { initializeUIRuntime } from './initializers';\nimport type {\n LayoutAnimationBatchItem,\n ProgressAnimationCallback,\n SharedTransitionAnimationsFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\nimport { SensorContainer } from './SensorContainer';\n\nexport { startMapper, stopMapper } from './mappers';\nexport { runOnJS, runOnUI, executeOnUIRuntimeSync } from './threads';\nexport { createWorkletRuntime, runOnRuntime } from './runtimes';\nexport type { WorkletRuntime } from './runtimes';\nexport { makeShareable, makeShareableCloneRecursive } from './shareables';\nexport { makeMutable } from './mutables';\n\nconst IS_FABRIC = isFabric();\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\n/**\n * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2 or 1\n */\nexport const isReanimated3 = () => true;\n\n// Superseded by check in `/src/threads.ts`.\n// Used by `react-navigation` to detect if using Reanimated 2 or 3.\n/**\n * @deprecated This function was superseded by other checks.\n * We keep it here for backward compatibility reasons.\n * If you need to check if you are using Reanimated 3 or Reanimated 2\n * please use `isReanimated3` function instead.\n * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2\n */\nexport const isConfigured = isReanimated3;\n\n// this is for web implementation\nif (SHOULD_BE_USE_WEB) {\n global._WORKLET = false;\n global._log = console.log;\n global._getAnimationTimestamp = () => performance.now();\n}\n\nexport function getViewProp<T>(viewTag: number, propName: string): Promise<T> {\n if (IS_FABRIC) {\n throw new Error(\n '[Reanimated] `getViewProp` is not supported on Fabric yet.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nfunction getSensorContainer(): SensorContainer {\n if (!global.__sensorContainer) {\n global.__sensorContainer = new SensorContainer();\n }\n return global.__sensorContainer;\n}\n\nexport function registerEventHandler<T>(\n eventHandler: (event: T) => void,\n eventName: string,\n emitterReactTag = -1\n): number {\n function handleAndFlushAnimationFrame(eventTimestamp: number, event: T) {\n 'worklet';\n global.__frameTimestamp = eventTimestamp;\n eventHandler(event);\n global.__flushAnimationFrame(eventTimestamp);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.registerEventHandler(\n makeShareableCloneRecursive(handleAndFlushAnimationFrame),\n eventName,\n emitterReactTag\n );\n}\n\nexport function unregisterEventHandler(id: number): void {\n return NativeReanimatedModule.unregisterEventHandler(id);\n}\n\nexport function subscribeForKeyboardEvents(\n eventHandler: (state: number, height: number) => void,\n options: AnimatedKeyboardOptions\n): number {\n // TODO: this should really go with the same code path as other events, that is\n // via registerEventHandler. For now we are copying the code from there.\n function handleAndFlushAnimationFrame(state: number, height: number) {\n 'worklet';\n const now = global._getAnimationTimestamp();\n global.__frameTimestamp = now;\n eventHandler(state, height);\n global.__flushAnimationFrame(now);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(handleAndFlushAnimationFrame),\n options.isStatusBarTranslucentAndroid ?? false\n );\n}\n\nexport function unsubscribeFromKeyboardEvents(listenerId: number): void {\n return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);\n}\n\nexport function registerSensor(\n sensorType: SensorType,\n config: SensorConfig,\n eventHandler: (\n data: Value3D | ValueRotation,\n orientationDegrees: number\n ) => void\n): number {\n const sensorContainer = getSensorContainer();\n return sensorContainer.registerSensor(\n sensorType,\n config,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function initializeSensor(\n sensorType: SensorType,\n config: SensorConfig\n): SharedValue<Value3D | ValueRotation> {\n const sensorContainer = getSensorContainer();\n return sensorContainer.initializeSensor(sensorType, config);\n}\n\nexport function unregisterSensor(sensorId: number): void {\n const sensorContainer = getSensorContainer();\n return sensorContainer.unregisterSensor(sensorId);\n}\n\nif (!isWeb()) {\n initializeUIRuntime();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimations(\n viewTag: number | HTMLElement,\n type: LayoutAnimationType,\n config:\n | LayoutAnimationFunction\n | Keyframe\n | SharedTransitionAnimationsFunction\n | ProgressAnimationCallback,\n sharedTransitionTag = ''\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag as number, // On web this function is no-op, therefore we can cast viewTag to number\n type,\n sharedTransitionTag,\n makeShareableCloneRecursive(config)\n );\n}\n\nexport function configureLayoutAnimationBatch(\n layoutAnimationsBatch: LayoutAnimationBatchItem[]\n): void {\n NativeReanimatedModule.configureLayoutAnimationBatch(layoutAnimationsBatch);\n}\n\nexport function setShouldAnimateExitingForTag(\n viewTag: number | HTMLElement,\n shouldAnimate: boolean\n) {\n NativeReanimatedModule.setShouldAnimateExitingForTag(\n viewTag as number,\n shouldAnimate\n );\n}\n\nexport function jsiConfigureProps(\n uiProps: string[],\n nativeProps: string[]\n): void {\n if (!SHOULD_BE_USE_WEB) {\n NativeReanimatedModule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,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAEnB,IAAI4B,YAAY,EAAE;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IAAI;MAC5BD,SAAS,EAAE;IACb,CAAC;IACDrE,sBAAsB,CAACoE,sBAAsB,CAACE,IAAI,CAAC;EACrD,CAAC,MAAM,IACL,CAACH,cAAc,CAACE,SAAS,IACzBF,cAAc,CAACC,sBAAsB,KAAKE,IAAI,EAC9C;IACAH,cAAc,CAACC,sBAAsB,GAAGE,IAAI;IAC5CtE,sBAAsB,CAACoE,sBAAsB,CAACE,IAAI,CAAC;EACrD;AACF;AAEA,OAAO,SAASE,yBAAyBA,CACvC3C,OAA6B,EAC7B4C,IAAyB,EACzBX,MAI6B,EAEvB;EAAA,IADNY,mBAAmB,GAAA/B,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAExB3C,sBAAsB,CAAC2E,wBAAwB,CAC7C9C,OAAO;EAAY;EACnB4C,IAAI,EACJC,mBAAmB,EACnBtE,2BAA2B,CAAC0D,MAAM,CAAC,CACpC;AACH;AAEA,OAAO,SAASc,6BAA6BA,CAC3CC,qBAAiD,EAC3C;EACN7E,sBAAsB,CAAC4E,6BAA6B,CAACC,qBAAqB,CAAC;AAC7E;AAEA,OAAO,SAASC,6BAA6BA,CAC3CjD,OAA6B,EAC7BkD,aAAsB,EACtB;EACA/E,sBAAsB,CAAC8E,6BAA6B,CAClDjD,OAAO,EACPkD,aAAa,CACd;AACH;AAEA,OAAO,SAASC,iBAAiBA,CAC/BC,OAAiB,EACjBC,WAAqB,EACf;EACN,IAAI,CAACjE,iBAAiB,EAAE;IACtBjB,sBAAsB,CAACmF,cAAc,CAACF,OAAO,EAAEC,WAAW,CAAC;EAC7D;AACF"}
|
|
1
|
+
{"version":3,"names":["NativeReanimatedModule","isWeb","shouldBeUseWeb","isFabric","makeShareableCloneRecursive","initializeUIRuntime","SensorContainer","startMapper","stopMapper","runOnJS","runOnUI","executeOnUIRuntimeSync","createWorkletRuntime","runOnRuntime","makeShareable","makeMutable","SHOULD_BE_USE_WEB","isReanimated3","isConfigured","global","_WORKLET","_log","console","log","_getAnimationTimestamp","performance","now","getViewProp","viewTag","propName","component","Error","Promise","resolve","reject","result","substr","getSensorContainer","__sensorContainer","registerEventHandler","eventHandler","eventName","emitterReactTag","handleAndFlushAnimationFrame","eventTimestamp","event","__frameTimestamp","__flushAnimationFrame","undefined","unregisterEventHandler","id","subscribeForKeyboardEvents","options","state","height","isStatusBarTranslucentAndroid","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","config","sensorContainer","initializeSensor","unregisterSensor","sensorId","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimationBatch","layoutAnimationsBatch","setShouldAnimateExitingForTag","shouldAnimate","jsiConfigureProps","uiProps","nativeProps","configureProps"],"sources":["core.ts"],"sourcesContent":["'use strict';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { isWeb, shouldBeUseWeb, isFabric } from './PlatformChecker';\nimport type {\n AnimatedKeyboardOptions,\n SensorConfig,\n SensorType,\n SharedValue,\n Value3D,\n ValueRotation,\n} from './commonTypes';\nimport { makeShareableCloneRecursive } from './shareables';\nimport { initializeUIRuntime } from './initializers';\nimport type { LayoutAnimationBatchItem } from './layoutReanimation/animationBuilder/commonTypes';\nimport { SensorContainer } from './SensorContainer';\n\nexport { startMapper, stopMapper } from './mappers';\nexport { runOnJS, runOnUI, executeOnUIRuntimeSync } from './threads';\nexport { createWorkletRuntime, runOnRuntime } from './runtimes';\nexport type { WorkletRuntime } from './runtimes';\nexport { makeShareable, makeShareableCloneRecursive } from './shareables';\nexport { makeMutable } from './mutables';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\n/**\n * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2 or 1\n */\nexport const isReanimated3 = () => true;\n\n// Superseded by check in `/src/threads.ts`.\n// Used by `react-navigation` to detect if using Reanimated 2 or 3.\n/**\n * @deprecated This function was superseded by other checks.\n * We keep it here for backward compatibility reasons.\n * If you need to check if you are using Reanimated 3 or Reanimated 2\n * please use `isReanimated3` function instead.\n * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2\n */\nexport const isConfigured = isReanimated3;\n\n// this is for web implementation\nif (SHOULD_BE_USE_WEB) {\n global._WORKLET = false;\n global._log = console.log;\n global._getAnimationTimestamp = () => performance.now();\n}\n\nexport function getViewProp<T>(\n viewTag: number,\n propName: string,\n component?: React.Component // required on Fabric\n): Promise<T> {\n if (isFabric() && !component) {\n throw new Error(\n '[Reanimated] Function `getViewProp` requires a component to be passed as an argument on Fabric.'\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n component,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nfunction getSensorContainer(): SensorContainer {\n if (!global.__sensorContainer) {\n global.__sensorContainer = new SensorContainer();\n }\n return global.__sensorContainer;\n}\n\nexport function registerEventHandler<T>(\n eventHandler: (event: T) => void,\n eventName: string,\n emitterReactTag = -1\n): number {\n function handleAndFlushAnimationFrame(eventTimestamp: number, event: T) {\n 'worklet';\n global.__frameTimestamp = eventTimestamp;\n eventHandler(event);\n global.__flushAnimationFrame(eventTimestamp);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.registerEventHandler(\n makeShareableCloneRecursive(handleAndFlushAnimationFrame),\n eventName,\n emitterReactTag\n );\n}\n\nexport function unregisterEventHandler(id: number): void {\n return NativeReanimatedModule.unregisterEventHandler(id);\n}\n\nexport function subscribeForKeyboardEvents(\n eventHandler: (state: number, height: number) => void,\n options: AnimatedKeyboardOptions\n): number {\n // TODO: this should really go with the same code path as other events, that is\n // via registerEventHandler. For now we are copying the code from there.\n function handleAndFlushAnimationFrame(state: number, height: number) {\n 'worklet';\n const now = global._getAnimationTimestamp();\n global.__frameTimestamp = now;\n eventHandler(state, height);\n global.__flushAnimationFrame(now);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(handleAndFlushAnimationFrame),\n options.isStatusBarTranslucentAndroid ?? false\n );\n}\n\nexport function unsubscribeFromKeyboardEvents(listenerId: number): void {\n return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);\n}\n\nexport function registerSensor(\n sensorType: SensorType,\n config: SensorConfig,\n eventHandler: (\n data: Value3D | ValueRotation,\n orientationDegrees: number\n ) => void\n): number {\n const sensorContainer = getSensorContainer();\n return sensorContainer.registerSensor(\n sensorType,\n config,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function initializeSensor(\n sensorType: SensorType,\n config: SensorConfig\n): SharedValue<Value3D | ValueRotation> {\n const sensorContainer = getSensorContainer();\n return sensorContainer.initializeSensor(sensorType, config);\n}\n\nexport function unregisterSensor(sensorId: number): void {\n const sensorContainer = getSensorContainer();\n return sensorContainer.unregisterSensor(sensorId);\n}\n\nif (!isWeb()) {\n initializeUIRuntime();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimationBatch(\n layoutAnimationsBatch: LayoutAnimationBatchItem[]\n): void {\n NativeReanimatedModule.configureLayoutAnimationBatch(layoutAnimationsBatch);\n}\n\nexport function setShouldAnimateExitingForTag(\n viewTag: number | HTMLElement,\n shouldAnimate: boolean\n) {\n NativeReanimatedModule.setShouldAnimateExitingForTag(\n viewTag as number,\n shouldAnimate\n );\n}\n\nexport function jsiConfigureProps(\n uiProps: string[],\n nativeProps: string[]\n): void {\n if (!SHOULD_BE_USE_WEB) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,OAAOA,sBAAsB,MAAM,oBAAoB;AACvD,SAASC,KAAK,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,mBAAmB;AASnE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,WAAW,EAAEC,UAAU,QAAQ,WAAW;AACnD,SAASC,OAAO,EAAEC,OAAO,EAAEC,sBAAsB,QAAQ,WAAW;AACpE,SAASC,oBAAoB,EAAEC,YAAY,QAAQ,YAAY;AAE/D,SAASC,aAAa,EAAEV,2BAA2B,QAAQ,cAAc;AACzE,SAASW,WAAW,QAAQ,YAAY;AAExC,MAAMC,iBAAiB,GAAGd,cAAc,CAAC,CAAC;;AAE1C;AACA;AACA;AACA,OAAO,MAAMe,aAAa,GAAGA,CAAA,KAAM,IAAI;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGD,aAAa;;AAEzC;AACA,IAAID,iBAAiB,EAAE;EACrBG,MAAM,CAACC,QAAQ,GAAG,KAAK;EACvBD,MAAM,CAACE,IAAI,GAAGC,OAAO,CAACC,GAAG;EACzBJ,MAAM,CAACK,sBAAsB,GAAG,MAAMC,WAAW,CAACC,GAAG,CAAC,CAAC;AACzD;AAEA,OAAO,SAASC,WAAWA,CACzBC,OAAe,EACfC,QAAgB,EAChBC,SAA2B,EACf;EACZ,IAAI3B,QAAQ,CAAC,CAAC,IAAI,C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EACZI,mBAAmB,CAAC,CAAC;AACvB;AAOA,IAAI4D,cAA8B,GAAG;EACnCC,sBAAsB,EAAE,KAAK;EAC7BC,SAAS,EAAE;AACb,CAAC;AAED,OAAO,SAASD,sBAAsBA,CACpCE,IAAa,EACbC,YAAY,GAAG,IAAI,EACb;EACN,IAAIA,YAAY,EAAE;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IAAI;MAC5BD,SAAS,EAAE;IACb,CAAC;IACDnE,sBAAsB,CAACkE,sBAAsB,CAACE,IAAI,CAAC;EACrD,CAAC,MAAM,IACL,CAACH,cAAc,CAACE,SAAS,IACzBF,cAAc,CAACC,sBAAsB,KAAKE,IAAI,EAC9C;IACAH,cAAc,CAACC,sBAAsB,GAAGE,IAAI;IAC5CpE,sBAAsB,CAACkE,sBAAsB,CAACE,IAAI,CAAC;EACrD;AACF;AAEA,OAAO,SAASE,6BAA6BA,CAC3CC,qBAAiD,EAC3C;EACNvE,sBAAsB,CAACsE,6BAA6B,CAACC,qBAAqB,CAAC;AAC7E;AAEA,OAAO,SAASC,6BAA6BA,CAC3C5C,OAA6B,EAC7B6C,aAAsB,EACtB;EACAzE,sBAAsB,CAACwE,6BAA6B,CAClD5C,OAAO,EACP6C,aACF,CAAC;AACH;AAEA,OAAO,SAASC,iBAAiBA,CAC/BC,OAAiB,EACjBC,WAAqB,EACf;EACN,IAAI,CAAC5D,iBAAiB,EAAE;IACtBhB,sBAAsB,CAAC6E,cAAc,CAACF,OAAO,EAAEC,WAAW,CAAC;EAC7D;AACF","ignoreList":[]}
|
|
@@ -5,8 +5,8 @@ export function registerWorkletStackDetails(hash, stackDetails) {
|
|
|
5
5
|
_workletStackDetails.set(hash, stackDetails);
|
|
6
6
|
}
|
|
7
7
|
function getBundleOffset(error) {
|
|
8
|
-
var _error$stack
|
|
9
|
-
const frame = (_error$stack = error.stack) === null || _error$stack === void 0
|
|
8
|
+
var _error$stack;
|
|
9
|
+
const frame = (_error$stack = error.stack) === null || _error$stack === void 0 || (_error$stack = _error$stack.split('\n')) === null || _error$stack === void 0 ? void 0 : _error$stack[0];
|
|
10
10
|
if (frame) {
|
|
11
11
|
const parsedFrame = /@([^@]+):(\d+):(\d+)/.exec(frame);
|
|
12
12
|
if (parsedFrame) {
|
|
@@ -19,7 +19,7 @@ function getBundleOffset(error) {
|
|
|
19
19
|
function processStack(stack) {
|
|
20
20
|
const workletStackEntries = stack.match(/worklet_(\d+):(\d+):(\d+)/g);
|
|
21
21
|
let result = stack;
|
|
22
|
-
workletStackEntries === null || workletStackEntries === void 0
|
|
22
|
+
workletStackEntries === null || workletStackEntries === void 0 || workletStackEntries.forEach(match => {
|
|
23
23
|
const [, hash, origLine, origCol] = match.split(/:|_/).map(Number);
|
|
24
24
|
const errorDetails = _workletStackDetails.get(hash);
|
|
25
25
|
if (!errorDetails) {
|
|
@@ -33,11 +33,10 @@ function processStack(stack) {
|
|
|
33
33
|
});
|
|
34
34
|
return result;
|
|
35
35
|
}
|
|
36
|
-
export function reportFatalErrorOnJS(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
36
|
+
export function reportFatalErrorOnJS({
|
|
37
|
+
message,
|
|
38
|
+
stack
|
|
39
|
+
}) {
|
|
41
40
|
const error = new Error();
|
|
42
41
|
error.message = message;
|
|
43
42
|
error.stack = stack ? processStack(stack) : undefined;
|
|
@@ -46,5 +45,6 @@ export function reportFatalErrorOnJS(_ref) {
|
|
|
46
45
|
error.jsEngine = 'reanimated';
|
|
47
46
|
// @ts-ignore the reportFatalError method is an internal method of ErrorUtils not exposed in the type definitions
|
|
48
47
|
global.ErrorUtils.reportFatalError(error);
|
|
48
|
+
console.error(error.stack);
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_workletStackDetails","Map","registerWorkletStackDetails","hash","stackDetails","set","getBundleOffset","error","_error$stack","
|
|
1
|
+
{"version":3,"names":["_workletStackDetails","Map","registerWorkletStackDetails","hash","stackDetails","set","getBundleOffset","error","_error$stack","frame","stack","split","parsedFrame","exec","file","line","col","Number","processStack","workletStackEntries","match","result","forEach","origLine","origCol","map","errorDetails","get","lineOffset","colOffset","bundleFile","bundleLine","bundleCol","replace","reportFatalErrorOnJS","message","Error","undefined","name","jsEngine","global","ErrorUtils","reportFatalError","console"],"sources":["errors.ts"],"sourcesContent":["'use strict';\nimport type { WorkletStackDetails } from './commonTypes';\n\nconst _workletStackDetails = new Map<number, WorkletStackDetails>();\n\nexport function registerWorkletStackDetails(\n hash: number,\n stackDetails: WorkletStackDetails\n) {\n _workletStackDetails.set(hash, stackDetails);\n}\n\nfunction getBundleOffset(error: Error): [string, number, number] {\n const frame = error.stack?.split('\\n')?.[0];\n if (frame) {\n const parsedFrame = /@([^@]+):(\\d+):(\\d+)/.exec(frame);\n if (parsedFrame) {\n const [, file, line, col] = parsedFrame;\n return [file, Number(line), Number(col)];\n }\n }\n return ['unknown', 0, 0];\n}\n\nfunction processStack(stack: string): string {\n const workletStackEntries = stack.match(/worklet_(\\d+):(\\d+):(\\d+)/g);\n let result = stack;\n workletStackEntries?.forEach((match) => {\n const [, hash, origLine, origCol] = match.split(/:|_/).map(Number);\n const errorDetails = _workletStackDetails.get(hash);\n if (!errorDetails) {\n return;\n }\n const [error, lineOffset, colOffset] = errorDetails;\n const [bundleFile, bundleLine, bundleCol] = getBundleOffset(error);\n const line = origLine + bundleLine + lineOffset;\n const col = origCol + bundleCol + colOffset;\n\n result = result.replace(match, `${bundleFile}:${line}:${col}`);\n });\n return result;\n}\n\nexport function reportFatalErrorOnJS({\n message,\n stack,\n}: {\n message: string;\n stack?: string;\n}) {\n const error = new Error();\n error.message = message;\n error.stack = stack ? processStack(stack) : undefined;\n error.name = 'ReanimatedError';\n // @ts-ignore React Native's ErrorUtils implementation extends the Error type with jsEngine field\n error.jsEngine = 'reanimated';\n // @ts-ignore the reportFatalError method is an internal method of ErrorUtils not exposed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AAoB,CAAC2B,GAAG,CAACxB,IAAI,CAAC;IACnD,IAAI,CAACuB,YAAY,EAAE;MACjB;IACF;IACA,MAAM,CAACnB,KAAK,EAAEqB,UAAU,EAAEC,SAAS,CAAC,GAAGH,YAAY;IACnD,MAAM,CAACI,UAAU,EAAEC,UAAU,EAAEC,SAAS,CAAC,GAAG1B,eAAe,CAACC,KAAK,CAAC;IAClE,MAAMQ,IAAI,GAAGQ,QAAQ,GAAGQ,UAAU,GAAGH,UAAU;IAC/C,MAAMZ,GAAG,GAAGQ,OAAO,GAAGQ,SAAS,GAAGH,SAAS;IAE3CR,MAAM,GAAGA,MAAM,CAACY,OAAO,CAACb,KAAK,EAAG,GAAEU,UAAW,IAAGf,IAAK,IAAGC,GAAI,EAAC,CAAC;EAChE,CAAC,CAAC;EACF,OAAOK,MAAM;AACf;AAEA,OAAO,SAASa,oBAAoBA,CAAC;EACnCC,OAAO;EACPzB;AAIF,CAAC,EAAE;EACD,MAAMH,KAAK,GAAG,IAAI6B,KAAK,CAAC,CAAC;EACzB7B,KAAK,CAAC4B,OAAO,GAAGA,OAAO;EACvB5B,KAAK,CAACG,KAAK,GAAGA,KAAK,GAAGQ,YAAY,CAACR,KAAK,CAAC,GAAG2B,SAAS;EACrD9B,KAAK,CAAC+B,IAAI,GAAG,iBAAiB;EAC9B;EACA/B,KAAK,CAACgC,QAAQ,GAAG,YAAY;EAC7B;EACAC,MAAM,CAACC,UAAU,CAACC,gBAAgB,CAACnC,KAAK,CAAC;EACzCoC,OAAO,CAACpC,KAAK,CAACA,KAAK,CAACG,KAAK,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/* eslint-disable
|
|
4
|
-
import { isFabric } from './PlatformChecker';
|
|
3
|
+
/* eslint-disable */
|
|
5
4
|
let findHostInstance_DEPRECATED;
|
|
5
|
+
let getInternalInstanceHandleFromPublicInstance;
|
|
6
6
|
export function getShadowNodeWrapperFromRef(ref) {
|
|
7
|
-
|
|
7
|
+
var _ref$getScrollRespond, _ref$getScrollRespond2, _ref$getNativeScrollR, _ref$__internalInstan;
|
|
8
|
+
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
9
|
+
if (findHostInstance_DEPRECATED === undefined) {
|
|
8
10
|
try {
|
|
9
|
-
findHostInstance_DEPRECATED =
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
-
require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
11
|
+
findHostInstance_DEPRECATED = require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
12
12
|
} catch (e) {
|
|
13
|
-
|
|
13
|
+
findHostInstance_DEPRECATED = _ref => null;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
|
17
|
+
try {
|
|
18
|
+
getInternalInstanceHandleFromPublicInstance = require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance').getInternalInstanceHandleFromPublicInstance ?? (_ref => _ref._internalInstanceHandle);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
getInternalInstanceHandleFromPublicInstance = _ref => _ref._internalInstanceHandle;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// taken from https://github.com/facebook/react-native/commit/803bb16531697233686efd475f004c1643e03617#diff-d8172256c6d63b5d32db10e54d7b10f37a26b337d5280d89f5bfd7bcea778292R196
|
|
25
|
+
// @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView
|
|
26
|
+
const scrollViewRef = ref === null || ref === void 0 || (_ref$getScrollRespond = ref.getScrollResponder) === null || _ref$getScrollRespond === void 0 || (_ref$getScrollRespond = _ref$getScrollRespond.call(ref)) === null || _ref$getScrollRespond === void 0 || (_ref$getScrollRespond2 = _ref$getScrollRespond.getNativeScrollRef) === null || _ref$getScrollRespond2 === void 0 ? void 0 : _ref$getScrollRespond2.call(_ref$getScrollRespond);
|
|
27
|
+
// @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView
|
|
28
|
+
const otherScrollViewRef = ref === null || ref === void 0 || (_ref$getNativeScrollR = ref.getNativeScrollRef) === null || _ref$getNativeScrollR === void 0 ? void 0 : _ref$getNativeScrollR.call(ref);
|
|
29
|
+
// @ts-ignore some weird stuff on RN 0.74 - see setNativeProps example
|
|
30
|
+
const textInputRef = ref === null || ref === void 0 || (_ref$__internalInstan = ref.__internalInstanceHandle) === null || _ref$__internalInstan === void 0 || (_ref$__internalInstan = _ref$__internalInstan.stateNode) === null || _ref$__internalInstan === void 0 ? void 0 : _ref$__internalInstan.node;
|
|
31
|
+
let resolvedRef;
|
|
32
|
+
if (scrollViewRef) {
|
|
33
|
+
resolvedRef = scrollViewRef.__internalInstanceHandle.stateNode.node;
|
|
34
|
+
} else if (otherScrollViewRef) {
|
|
35
|
+
resolvedRef = otherScrollViewRef.__internalInstanceHandle.stateNode.node;
|
|
36
|
+
} else if (textInputRef) {
|
|
37
|
+
resolvedRef = textInputRef;
|
|
38
|
+
} else {
|
|
39
|
+
resolvedRef = getInternalInstanceHandleFromPublicInstance(findHostInstance_DEPRECATED(ref)).stateNode.node;
|
|
40
|
+
}
|
|
41
|
+
return resolvedRef;
|
|
17
42
|
}
|
|
18
43
|
//# sourceMappingURL=fabricUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["findHostInstance_DEPRECATED","getInternalInstanceHandleFromPublicInstance","getShadowNodeWrapperFromRef","ref","_ref$getScrollRespond","_ref$getScrollRespond2","_ref$getNativeScrollR","_ref$__internalInstan","undefined","require","e","_ref","_internalInstanceHandle","scrollViewRef","getScrollResponder","call","getNativeScrollRef","otherScrollViewRef","textInputRef","__internalInstanceHandle","stateNode","node","resolvedRef"],"sources":["fabricUtils.ts"],"sourcesContent":["'use strict';\n/* eslint-disable */\n\nimport type { ShadowNodeWrapper } from './commonTypes';\n\nlet findHostInstance_DEPRECATED: (ref: unknown) => void;\nlet getInternalInstanceHandleFromPublicInstance: (ref: unknown) => {\n stateNode: { node: unknown };\n};\n\nexport function getShadowNodeWrapperFromRef(\n ref: React.Component\n): ShadowNodeWrapper {\n // load findHostInstance_DEPRECATED lazily because it may not be available before render\n if (findHostInstance_DEPRECATED === undefined) {\n try {\n findHostInstance_DEPRECATED =\n require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;\n } catch (e) {\n findHostInstance_DEPRECATED = (_ref: unknown) => null;\n }\n }\n\n if (getInternalInstanceHandleFromPublicInstance === undefined) {\n try {\n getInternalInstanceHandleFromPublicInstance =\n require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')\n .getInternalInstanceHandleFromPublicInstance ??\n ((_ref: any) => _ref._internalInstanceHandle);\n } catch (e) {\n getInternalInstanceHandleFromPublicInstance = (_ref: any) =>\n _ref._internalInstanceHandle;\n }\n }\n\n // taken from https://github.com/facebook/react-native/commit/803bb16531697233686efd475f004c1643e03617#diff-d8172256c6d63b5d32db10e54d7b10f37a26b337d5280d89f5bfd7bcea778292R196\n // @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView\n const scrollViewRef = ref?.getScrollResponder?.()?.getNativeScrollRef?.();\n // @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView\n const otherScrollViewRef = ref?.getNativeScrollRef?.();\n // @ts-ignore some weird stuff on RN 0.74 - see setNativeProps example\n const textInputRef = ref?.__internalInstanceHandle?.stateNode?.node;\n\n let resolvedRef;\n if (scrollViewRef) {\n resolvedRef = scrollViewRef.__internalInstanceHandle.stateNode.node;\n } else if (otherScrollViewRef) {\n resolvedRef = otherScrollViewRef.__internalInstanceHandle.stateNode.node;\n } else if (textInputRef) {\n resolvedRef = textInputRef;\n } else {\n resolvedRef = getInternalInstanceHandleFromPublicInstance(\n findHostInstance_DE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AAG,gBAAAI,qBAAA,GAAHJ,GAAG,CAAEgB,wBAAwB,cAAAZ,qBAAA,gBAAAA,qBAAA,GAA7BA,qBAAA,CAA+Ba,SAAS,cAAAb,qBAAA,uBAAxCA,qBAAA,CAA0Cc,IAAI;EAEnE,IAAIC,WAAW;EACf,IAAIT,aAAa,EAAE;IACjBS,WAAW,GAAGT,aAAa,CAACM,wBAAwB,CAACC,SAAS,CAACC,IAAI;EACrE,CAAC,MAAM,IAAIJ,kBAAkB,EAAE;IAC7BK,WAAW,GAAGL,kBAAkB,CAACE,wBAAwB,CAACC,SAAS,CAACC,IAAI;EAC1E,CAAC,MAAM,IAAIH,YAAY,EAAE;IACvBI,WAAW,GAAGJ,YAAY;EAC5B,CAAC,MAAM;IACLI,WAAW,GAAGrB,2CAA2C,CACvDD,2BAA2B,CAACG,GAAG,CACjC,CAAC,CAACiB,SAAS,CAACC,IAAI;EAClB;EAEA,OAAOC,WAAW;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getShadowNodeWrapperFromRef","Error"],"sources":["fabricUtils.web.ts"],"sourcesContent":["'use strict';\nexport function getShadowNodeWrapperFromRef() {\n throw new Error(\n '[Reanimated] Trying to call `getShadowNodeWrapperFromRef` on web.'\n );\n}\n"],"mappings":"AAAA,YAAY;;AACZ,OAAO,SAASA,2BAA2BA,CAAA,EAAG;EAC5C,MAAM,IAAIC,KAAK,CACb,
|
|
1
|
+
{"version":3,"names":["getShadowNodeWrapperFromRef","Error"],"sources":["fabricUtils.web.ts"],"sourcesContent":["'use strict';\nexport function getShadowNodeWrapperFromRef() {\n throw new Error(\n '[Reanimated] Trying to call `getShadowNodeWrapperFromRef` on web.'\n );\n}\n"],"mappings":"AAAA,YAAY;;AACZ,OAAO,SAASA,2BAA2BA,CAAA,EAAG;EAC5C,MAAM,IAAIC,KAAK,CACb,mEACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
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; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import { runOnUI } from '../core';
|
|
7
7
|
import { prepareUIRegistry } from './FrameCallbackRegistryUI';
|
|
8
8
|
export default class FrameCallbackRegistryJS {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
1
|
+
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","runOnUI","prepareUIRegistry","FrameCallbackRegistryJS","constructor","registerFrameCallback","callback","callbackId","nextCallbackId","global","_frameCallbackRegistry","unregisterFrameCallback","manageStateFrameCallback","state"],"sources":["FrameCallbackRegistryJS.ts"],"sourcesContent":["'use strict';\nimport { runOnUI } from '../core';\nimport type { FrameInfo } from './FrameCallbackRegistryUI';\nimport { prepareUIRegistry } from './FrameCallbackRegistryUI';\n\nexport default class FrameCallbackRegistryJS {\n private nextCallbackId = 0;\n\n constructor() {\n prepareUIRegistry();\n }\n\n registerFrameCallback(callback: (frameInfo: FrameInfo) => void): number {\n if (!callback) {\n return -1;\n }\n\n const callbackId = this.nextCallbackId;\n this.nextCallbackId++;\n\n runOnUI(() => {\n global._frameCallbackRegistry.registerFrameCallback(callback, callbackId);\n })();\n\n return callbackId;\n }\n\n unregisterFrameCallback(callbackId: number): void {\n runOnUI(() => {\n global._frameCallbackRegistry.unregisterFrameCallback(callbackId);\n })();\n }\n\n manageStateFrameCallback(callbackId: number, state: boolean): void {\n runOnUI(() => {\n global._frameCallbackRegistry.manageStateFrameCallback(callbackId, state);\n })();\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AACb,SAASW,OAAO,QAAQ,SAAS;AAEjC,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,eAAe,MAAMC,uBAAuB,CAAC;EAG3CC,WAAWA,CAAA,EAAG;IAAAxB,eAAA,yBAFW,CAAC;IAGxBsB,iBAAiB,CAAC,CAAC;EACrB;EAEAG,qBAAqBA,CAACC,QAAwC,EAAU;IACtE,IAAI,CAACA,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAMC,UAAU,GAAG,IAAI,CAACC,cAAc;IACtC,IAAI,CAACA,cAAc,EAAE;IAErBP,OAAO,CAAC,MAAM;MACZQ,MAAM,CAACC,sBAAsB,CAACL,qBAAqB,CAACC,QAAQ,EAAEC,UAAU,CAAC;IAC3E,CAAC,CAAC,CAAC,CAAC;IAEJ,OAAOA,UAAU;EACnB;EAEAI,uBAAuBA,CAACJ,UAAkB,EAAQ;IAChDN,OAAO,CAAC,MAAM;MACZQ,MAAM,CAACC,sBAAsB,CAACC,uBAAuB,CAACJ,UAAU,CAAC;IACnE,CAAC,CAAC,CAAC,CAAC;EACN;EAEAK,wBAAwBA,CAACL,UAAkB,EAAEM,KAAc,EAAQ;IACjEZ,OAAO,CAAC,MAAM;MACZQ,MAAM,CAACC,sBAAsB,CAACE,wBAAwB,CAACL,UAAU,EAAEM,KAAK,CAAC;IAC3E,CAAC,CAAC,CAAC,CAAC;EACN;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["runOnUIImmediately","prepareUIRegistry","frameCallbackRegistry","Map","activeFrameCallbacks","Set","previousFrameTimestamp","nextCallId","runCallbacks","callId","loop","timestamp","delta","forEach","callbackId","callbackDetails","get","startTime","callback","timeSincePreviousFrame","timeSinceFirstFrame","size","requestAnimationFrame","registerFrameCallback","set","unregisterFrameCallback","manageStateFrameCallback","delete","state","add","global","_frameCallbackRegistry"],"sources":["FrameCallbackRegistryUI.ts"],"sourcesContent":["'use strict';\nimport { runOnUIImmediately } from '../threads';\n\ntype CallbackDetails = {\n callback: (frameInfo: FrameInfo) => void;\n startTime: number | null;\n};\n\nexport type FrameInfo = {\n timestamp: number;\n timeSincePreviousFrame: number | null;\n timeSinceFirstFrame: number;\n};\n\nexport interface FrameCallbackRegistryUI {\n frameCallbackRegistry: Map<number, CallbackDetails>;\n activeFrameCallbacks: Set<number>;\n previousFrameTimestamp: number | null;\n runCallbacks: (callId: number) => void;\n nextCallId: number;\n registerFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) => void;\n unregisterFrameCallback: (callbackId: number) => void;\n manageStateFrameCallback: (callbackId: number, state: boolean) => void;\n}\n\nexport const prepareUIRegistry = runOnUIImmediately(() => {\n 'worklet';\n\n const frameCallbackRegistry: FrameCallbackRegistryUI = {\n frameCallbackRegistry: new Map<number, CallbackDetails>(),\n activeFrameCallbacks: new Set<number>(),\n previousFrameTimestamp: null,\n nextCallId: 0,\n\n runCallbacks(callId) {\n const loop = (timestamp: number) => {\n if (callId !== this.nextCallId) {\n return;\n }\n if (this.previousFrameTimestamp === null) {\n this.previousFrameTimestamp = timestamp;\n }\n\n const delta = timestamp - this.previousFrameTimestamp;\n\n this.activeFrameCallbacks.forEach((callbackId: number) => {\n const callbackDetails = this.frameCallbackRegistry.get(callbackId)!;\n\n const { startTime } = callbackDetails;\n\n if (startTime === null) {\n // First frame\n callbackDetails.startTime = timestamp;\n\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: null,\n timeSinceFirstFrame: 0,\n });\n } else {\n // Next frame\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: delta,\n timeSinceFirstFrame: timestamp - startTime,\n });\n }\n });\n\n if (this.activeFrameCallbacks.size > 0) {\n this.previousFrameTimestamp = timestamp;\n requestAnimationFrame(loop);\n } else {\n this.previousFrameTimestamp = null;\n }\n };\n\n // runCallback() should only be called after registering a callback,\n // so if there is only one active callback, then it means that there were\n // zero previously and the loop isn't running yet.\n if (this.activeFrameCallbacks.size === 1 && callId === this.nextCallId) {\n requestAnimationFrame(loop);\n }\n },\n\n registerFrameCallback(\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) {\n this.frameCallbackRegistry.set(callbackId, {\n callback,\n startTime: null,\n });\n },\n\n unregisterFrameCallback(callbackId: number) {\n this.manageStateFrameCallback(callbackId, false);\n this.frameCallbackRegistry.delete(callbackId);\n },\n\n manageStateFrameCallback(callbackId: number, state: boolean) {\n if (callbackId === -1) {\n return;\n }\n if (state) {\n this.activeFrameCallbacks.add(callbackId);\n this.runCallbacks(this.nextCallId);\n } else {\n const callback = this.frameCallbackRegistry.get(callbackId)!;\n callback.startTime = null;\n\n this.activeFrameCallbacks.delete(callbackId);\n if (this.activeFrameCallbacks.size === 0) {\n this.nextCallId += 1;\n }\n }\n },\n };\n\n global._frameCallbackRegistry = frameCallbackRegistry;\n});\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,kBAAkB,QAAQ,YAAY;AA2B/C,OAAO,MAAMC,iBAAiB,GAAGD,kBAAkB,CAAC,MAAM;EACxD,SAAS;;EAET,MAAME,qBAA8C,GAAG;IACrDA,qBAAqB,EAAE,IAAIC,GAAG,
|
|
1
|
+
{"version":3,"names":["runOnUIImmediately","prepareUIRegistry","frameCallbackRegistry","Map","activeFrameCallbacks","Set","previousFrameTimestamp","nextCallId","runCallbacks","callId","loop","timestamp","delta","forEach","callbackId","callbackDetails","get","startTime","callback","timeSincePreviousFrame","timeSinceFirstFrame","size","requestAnimationFrame","registerFrameCallback","set","unregisterFrameCallback","manageStateFrameCallback","delete","state","add","global","_frameCallbackRegistry"],"sources":["FrameCallbackRegistryUI.ts"],"sourcesContent":["'use strict';\nimport { runOnUIImmediately } from '../threads';\n\ntype CallbackDetails = {\n callback: (frameInfo: FrameInfo) => void;\n startTime: number | null;\n};\n\nexport type FrameInfo = {\n timestamp: number;\n timeSincePreviousFrame: number | null;\n timeSinceFirstFrame: number;\n};\n\nexport interface FrameCallbackRegistryUI {\n frameCallbackRegistry: Map<number, CallbackDetails>;\n activeFrameCallbacks: Set<number>;\n previousFrameTimestamp: number | null;\n runCallbacks: (callId: number) => void;\n nextCallId: number;\n registerFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) => void;\n unregisterFrameCallback: (callbackId: number) => void;\n manageStateFrameCallback: (callbackId: number, state: boolean) => void;\n}\n\nexport const prepareUIRegistry = runOnUIImmediately(() => {\n 'worklet';\n\n const frameCallbackRegistry: FrameCallbackRegistryUI = {\n frameCallbackRegistry: new Map<number, CallbackDetails>(),\n activeFrameCallbacks: new Set<number>(),\n previousFrameTimestamp: null,\n nextCallId: 0,\n\n runCallbacks(callId) {\n const loop = (timestamp: number) => {\n if (callId !== this.nextCallId) {\n return;\n }\n if (this.previousFrameTimestamp === null) {\n this.previousFrameTimestamp = timestamp;\n }\n\n const delta = timestamp - this.previousFrameTimestamp;\n\n this.activeFrameCallbacks.forEach((callbackId: number) => {\n const callbackDetails = this.frameCallbackRegistry.get(callbackId)!;\n\n const { startTime } = callbackDetails;\n\n if (startTime === null) {\n // First frame\n callbackDetails.startTime = timestamp;\n\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: null,\n timeSinceFirstFrame: 0,\n });\n } else {\n // Next frame\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: delta,\n timeSinceFirstFrame: timestamp - startTime,\n });\n }\n });\n\n if (this.activeFrameCallbacks.size > 0) {\n this.previousFrameTimestamp = timestamp;\n requestAnimationFrame(loop);\n } else {\n this.previousFrameTimestamp = null;\n }\n };\n\n // runCallback() should only be called after registering a callback,\n // so if there is only one active callback, then it means that there were\n // zero previously and the loop isn't running yet.\n if (this.activeFrameCallbacks.size === 1 && callId === this.nextCallId) {\n requestAnimationFrame(loop);\n }\n },\n\n registerFrameCallback(\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) {\n this.frameCallbackRegistry.set(callbackId, {\n callback,\n startTime: null,\n });\n },\n\n unregisterFrameCallback(callbackId: number) {\n this.manageStateFrameCallback(callbackId, false);\n this.frameCallbackRegistry.delete(callbackId);\n },\n\n manageStateFrameCallback(callbackId: number, state: boolean) {\n if (callbackId === -1) {\n return;\n }\n if (state) {\n this.activeFrameCallbacks.add(callbackId);\n this.runCallbacks(this.nextCallId);\n } else {\n const callback = this.frameCallbackRegistry.get(callbackId)!;\n callback.startTime = null;\n\n this.activeFrameCallbacks.delete(callbackId);\n if (this.activeFrameCallbacks.size === 0) {\n this.nextCallId += 1;\n }\n }\n },\n };\n\n global._frameCallbackRegistry = frameCallbackRegistry;\n});\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,kBAAkB,QAAQ,YAAY;AA2B/C,OAAO,MAAMC,iBAAiB,GAAGD,kBAAkB,CAAC,MAAM;EACxD,SAAS;;EAET,MAAME,qBAA8C,GAAG;IACrDA,qBAAqB,EAAE,IAAIC,GAAG,CAA0B,CAAC;IACzDC,oBAAoB,EAAE,IAAIC,GAAG,CAAS,CAAC;IACvCC,sBAAsB,EAAE,IAAI;IAC5BC,UAAU,EAAE,CAAC;IAEbC,YAAYA,CAACC,MAAM,EAAE;MACnB,MAAMC,IAAI,GAAIC,SAAiB,IAAK;QAClC,IAAIF,MAAM,KAAK,IAAI,CAACF,UAAU,EAAE;UAC9B;QACF;QACA,IAAI,IAAI,CAACD,sBAAsB,KAAK,IAAI,EAAE;UACxC,IAAI,CAACA,sBAAsB,GAAGK,SAAS;QACzC;QAEA,MAAMC,KAAK,GAAGD,SAAS,GAAG,IAAI,CAACL,sBAAsB;QAErD,IAAI,CAACF,oBAAoB,CAACS,OAAO,CAAEC,UAAkB,IAAK;UACxD,MAAMC,eAAe,GAAG,IAAI,CAACb,qBAAqB,CAACc,GAAG,CAACF,UAAU,CAAE;UAEnE,MAAM;YAAEG;UAAU,CAAC,GAAGF,eAAe;UAErC,IAAIE,SAAS,KAAK,IAAI,EAAE;YACtB;YACAF,eAAe,CAACE,SAAS,GAAGN,SAAS;YAErCI,eAAe,CAACG,QAAQ,CAAC;cACvBP,SAAS;cACTQ,sBAAsB,EAAE,IAAI;cAC5BC,mBAAmB,EAAE;YACvB,CAAC,CAAC;UACJ,CAAC,MAAM;YACL;YACAL,eAAe,CAACG,QAAQ,CAAC;cACvBP,SAAS;cACTQ,sBAAsB,EAAEP,KAAK;cAC7BQ,mBAAmB,EAAET,SAAS,GAAGM;YACnC,CAAC,CAAC;UACJ;QACF,CAAC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xC,IAAI,CAACd,UAAU,IAAI,CAAC;QACtB;MACF;IACF;EACF,CAAC;EAEDuB,MAAM,CAACC,sBAAsB,GAAG7B,qBAAqB;AACvD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type { FrameInfo } from './FrameCallbackRegistryUI';\n"],"mappings":"AAAA,YAAY"}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type { FrameInfo } from './FrameCallbackRegistryUI';\n"],"mappings":"AAAA,YAAY","ignoreList":[]}
|