react-native-reanimated 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/Fabric/FabricUtils.h +1 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
- package/Common/cpp/SharedItems/Shareables.h +22 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
- package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
- package/RNReanimated.podspec +5 -2
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +18 -10
- package/android/src/main/cpp/NativeProxy.cpp +316 -337
- package/android/src/main/cpp/NativeProxy.h +53 -11
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
- package/ios/REANodesManager.h +1 -0
- package/ios/REANodesManager.mm +30 -4
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.mm +4 -1
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.mm +1 -1
- package/ios/native/REAInitializer.mm +1 -1
- package/ios/native/REAMessageThread.mm +2 -2
- package/lib/commonjs/Animated.js +0 -8
- package/lib/commonjs/Animated.js.map +1 -1
- package/lib/commonjs/ConfigHelper.js +8 -19
- package/lib/commonjs/ConfigHelper.js.map +1 -1
- package/lib/commonjs/createAnimatedComponent.js +20 -158
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/index.js +0 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +0 -7
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/reanimated2/Bezier.js +14 -34
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +60 -132
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/Easing.js +81 -34
- package/lib/commonjs/reanimated2/Easing.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
- package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/decay.js +7 -18
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -11
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/index.js +0 -8
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/spring.js +11 -23
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/timing.js +0 -11
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +11 -41
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +16 -23
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Image.js +0 -4
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
- package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Text.js +0 -4
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
- package/lib/commonjs/reanimated2/component/View.js +0 -4
- package/lib/commonjs/reanimated2/component/View.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +6 -48
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +3 -14
- package/lib/commonjs/reanimated2/errors.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -12
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +8 -39
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +0 -26
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +21 -43
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolation.js +14 -29
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +11 -44
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +26 -32
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +5 -15
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +2 -28
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/shareables.js +92 -49
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +42 -46
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +0 -5
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +6 -21
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/commonjs/setAndForwardRef.js +3 -3
- package/lib/commonjs/setAndForwardRef.js.map +1 -1
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +9 -15
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +20 -139
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js +14 -33
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +59 -109
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +37 -33
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeMethods.js +8 -15
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +12 -10
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js +3 -5
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/decay.js +7 -15
- package/lib/module/reanimated2/animation/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -9
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +6 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +3 -18
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +11 -21
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +0 -8
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +10 -33
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +12 -19
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +0 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -22
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +3 -13
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +3 -3
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/Hooks.js +3 -2
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +8 -21
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +23 -37
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +5 -34
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +13 -28
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +11 -35
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +2 -6
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +3 -9
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +26 -25
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +5 -15
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -19
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +96 -44
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +39 -33
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +0 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +6 -19
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/setAndForwardRef.js +3 -2
- package/lib/module/setAndForwardRef.js.map +1 -1
- package/package.json +46 -40
- package/plugin/.eslintrc.js +7 -0
- package/plugin/README.md +241 -0
- package/plugin/build/plugin.js +714 -0
- package/plugin/build/plugin.js.map +7 -0
- package/plugin/index.js +1 -807
- package/plugin/package.json +23 -0
- package/plugin/src/buildWorkletString.ts +213 -0
- package/plugin/src/commonObjects.ts +60 -0
- package/plugin/src/injectVersion.ts +37 -0
- package/plugin/src/makeWorklet.ts +375 -0
- package/plugin/src/plugin.ts +49 -0
- package/plugin/src/processForCalleesWorklets.ts +106 -0
- package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
- package/plugin/src/processIfWorkletFunction.ts +55 -0
- package/plugin/src/processIfWorkletNode.ts +44 -0
- package/plugin/src/processInlineStylesWarning.ts +129 -0
- package/plugin/src/processWorkletObjectMethod.ts +31 -0
- package/plugin/src/types.ts +15 -0
- package/plugin/src/utils.ts +6 -0
- package/plugin/tsconfig.json +15 -0
- package/plugin/yarn.lock +2193 -0
- package/react-native-reanimated.d.ts +1 -0
- package/scripts/reanimated_utils.rb +2 -2
- package/src/createAnimatedComponent.tsx +2 -3
- package/src/reanimated2/Easing.ts +19 -0
- package/src/reanimated2/NativeMethods.ts +9 -4
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
- package/src/reanimated2/UpdateProps.ts +2 -2
- package/src/reanimated2/animation/decay.ts +7 -1
- package/src/reanimated2/animation/styleAnimation.ts +5 -1
- package/src/reanimated2/core.ts +4 -4
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
- package/src/reanimated2/globals.d.ts +71 -112
- package/src/reanimated2/hook/commonTypes.ts +1 -1
- package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
- package/src/reanimated2/initializers.ts +11 -8
- package/src/reanimated2/jestUtils.ts +0 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
- package/src/reanimated2/js-reanimated/index.ts +1 -1
- package/src/reanimated2/mappers.ts +26 -4
- package/src/reanimated2/mock.ts +1 -0
- package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
- package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
- package/src/reanimated2/shareables.ts +107 -8
- package/src/reanimated2/threads.ts +36 -17
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
|
@@ -166,8 +166,8 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
166
166
|
jni::global_ref<NativeProxy::javaobject> javaPart_;
|
|
167
167
|
jsi::Runtime *runtime_;
|
|
168
168
|
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker_;
|
|
169
|
-
std::shared_ptr<NativeReanimatedModule>
|
|
170
|
-
jni::global_ref<LayoutAnimations::javaobject>
|
|
169
|
+
std::shared_ptr<NativeReanimatedModule> nativeReanimatedModule_;
|
|
170
|
+
jni::global_ref<LayoutAnimations::javaobject> layoutAnimations_;
|
|
171
171
|
std::shared_ptr<Scheduler> scheduler_;
|
|
172
172
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
173
173
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
@@ -188,22 +188,25 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
188
188
|
void installJSIBindings(
|
|
189
189
|
jni::alias_ref<JavaMessageQueueThread::javaobject> messageQueueThread);
|
|
190
190
|
#endif
|
|
191
|
+
PlatformDepMethodsHolder getPlatformDependentMethods();
|
|
192
|
+
void setGlobalProperties(
|
|
193
|
+
jsi::Runtime &jsRuntime,
|
|
194
|
+
const std::shared_ptr<jsi::Runtime> &reanimatedRuntime);
|
|
195
|
+
void setupLayoutAnimations();
|
|
196
|
+
|
|
197
|
+
double getCurrentTime();
|
|
191
198
|
bool isAnyHandlerWaitingForEvent(std::string);
|
|
192
199
|
void performOperations();
|
|
193
|
-
void requestRender(std::function<void(double)> onRender);
|
|
194
|
-
void registerEventHandler(
|
|
195
|
-
|
|
196
|
-
jni::alias_ref<react::WritableMap>)> handler);
|
|
200
|
+
void requestRender(std::function<void(double)> onRender, jsi::Runtime &rt);
|
|
201
|
+
void registerEventHandler();
|
|
202
|
+
void maybeFlushUIUpdatesQueue();
|
|
197
203
|
void setGestureState(int handlerTag, int newState);
|
|
198
204
|
int registerSensor(
|
|
199
205
|
int sensorType,
|
|
200
206
|
int interval,
|
|
207
|
+
int iosReferenceFrame,
|
|
201
208
|
std::function<void(double[], int)> setter);
|
|
202
209
|
void unregisterSensor(int sensorId);
|
|
203
|
-
void configureProps(
|
|
204
|
-
jsi::Runtime &rt,
|
|
205
|
-
const jsi::Value &uiProps,
|
|
206
|
-
const jsi::Value &nativeProps);
|
|
207
210
|
int subscribeForKeyboardEvents(
|
|
208
211
|
std::function<void(int, int)> keyboardEventDataUpdater,
|
|
209
212
|
bool isStatusBarTranslucent);
|
|
@@ -211,10 +214,49 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
211
214
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
212
215
|
// nothing
|
|
213
216
|
#else
|
|
214
|
-
|
|
217
|
+
jsi::Value
|
|
218
|
+
obtainProp(jsi::Runtime &rt, const int viewTag, const jsi::String &propName);
|
|
219
|
+
void configureProps(
|
|
220
|
+
jsi::Runtime &rt,
|
|
221
|
+
const jsi::Value &uiProps,
|
|
222
|
+
const jsi::Value &nativeProps);
|
|
223
|
+
void updateProps(
|
|
224
|
+
jsi::Runtime &rt,
|
|
225
|
+
int viewTag,
|
|
226
|
+
const jsi::Value &viewName,
|
|
227
|
+
const jsi::Object &props);
|
|
215
228
|
void scrollTo(int viewTag, double x, double y, bool animated);
|
|
216
229
|
std::vector<std::pair<std::string, double>> measure(int viewTag);
|
|
217
230
|
#endif
|
|
231
|
+
void handleEvent(
|
|
232
|
+
jni::alias_ref<JString> eventKey,
|
|
233
|
+
jni::alias_ref<react::WritableMap> event);
|
|
234
|
+
|
|
235
|
+
void progressLayoutAnimation(
|
|
236
|
+
int tag,
|
|
237
|
+
const jsi::Object &newProps,
|
|
238
|
+
bool isSharedTransition);
|
|
239
|
+
|
|
240
|
+
/***
|
|
241
|
+
* Wraps a method of `NativeProxy` in a function object capturing `this`
|
|
242
|
+
* @tparam TReturn return type of passed method
|
|
243
|
+
* @tparam TParams paramater types of passed method
|
|
244
|
+
* @param methodPtr pointer to method to be wrapped
|
|
245
|
+
* @return a function object with the same signature as the method, calling
|
|
246
|
+
* that method on `this`
|
|
247
|
+
*/
|
|
248
|
+
template <class TReturn, class... TParams>
|
|
249
|
+
std::function<TReturn(TParams...)> bindThis(
|
|
250
|
+
TReturn (NativeProxy::*methodPtr)(TParams...)) {
|
|
251
|
+
return [this, methodPtr](TParams &&...args) {
|
|
252
|
+
return (this->*methodPtr)(std::forward<TParams>(args)...);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
template <class Signature>
|
|
257
|
+
JMethod<Signature> getJniMethod(std::string const &methodName) {
|
|
258
|
+
return javaPart_->getClass()->getMethod<Signature>(methodName.c_str());
|
|
259
|
+
}
|
|
218
260
|
|
|
219
261
|
explicit NativeProxy(
|
|
220
262
|
jni::alias_ref<NativeProxy::jhybridobject> jThis,
|
|
@@ -39,11 +39,9 @@ public class NativeMethodsHelper {
|
|
|
39
39
|
public static void scrollTo(View view, double argX, double argY, boolean animated) {
|
|
40
40
|
int x = Math.round(PixelUtil.toPixelFromDIP(argX));
|
|
41
41
|
int y = Math.round(PixelUtil.toPixelFromDIP(argY));
|
|
42
|
-
boolean
|
|
42
|
+
boolean isHorizontal = view instanceof ReactHorizontalScrollView;
|
|
43
43
|
|
|
44
|
-
if (
|
|
45
|
-
horizontal = true;
|
|
46
|
-
} else {
|
|
44
|
+
if (!isHorizontal) {
|
|
47
45
|
if (view instanceof ReactSwipeRefreshLayout) {
|
|
48
46
|
view = findScrollView((ReactSwipeRefreshLayout) view);
|
|
49
47
|
}
|
|
@@ -56,17 +54,14 @@ public class NativeMethodsHelper {
|
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
if (animated) {
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
final View finalView = view;
|
|
58
|
+
if (isHorizontal) {
|
|
59
|
+
view.post(() -> ((ReactHorizontalScrollView) finalView).smoothScrollTo(x, y));
|
|
61
60
|
} else {
|
|
62
|
-
((ReactScrollView)
|
|
61
|
+
view.post(() -> ((ReactScrollView) finalView).smoothScrollTo(x, y));
|
|
63
62
|
}
|
|
64
63
|
} else {
|
|
65
|
-
|
|
66
|
-
((ReactHorizontalScrollView) view).scrollTo((int) x, (int) y);
|
|
67
|
-
} else {
|
|
68
|
-
((ReactScrollView) view).scrollTo((int) x, (int) y);
|
|
69
|
-
}
|
|
64
|
+
view.scrollTo(x, y);
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
|
|
@@ -36,6 +36,7 @@ import java.util.Queue;
|
|
|
36
36
|
import java.util.Set;
|
|
37
37
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
38
38
|
import java.util.concurrent.Semaphore;
|
|
39
|
+
import java.util.concurrent.TimeUnit;
|
|
39
40
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
40
41
|
import javax.annotation.Nullable;
|
|
41
42
|
|
|
@@ -163,6 +164,10 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
public boolean isAnimationRunning() {
|
|
168
|
+
return mCallbackPosted.get();
|
|
169
|
+
}
|
|
170
|
+
|
|
166
171
|
public void onHostResume() {
|
|
167
172
|
if (mCallbackPosted.getAndSet(false)) {
|
|
168
173
|
startUpdatingOnAnimationFrame();
|
|
@@ -183,7 +188,7 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
|
|
191
|
+
public void performOperations() {
|
|
187
192
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
188
193
|
mNativeProxy.performOperations();
|
|
189
194
|
} else if (!mOperationsInBatch.isEmpty()) {
|
|
@@ -218,13 +223,11 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
218
223
|
}
|
|
219
224
|
});
|
|
220
225
|
if (trySynchronously) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// noop
|
|
227
|
-
}
|
|
226
|
+
try {
|
|
227
|
+
semaphore.tryAcquire(16, TimeUnit.MILLISECONDS);
|
|
228
|
+
} catch (InterruptedException e) {
|
|
229
|
+
// if the thread is interruped we just continue and let the layout update happen
|
|
230
|
+
// asynchronously
|
|
228
231
|
}
|
|
229
232
|
}
|
|
230
233
|
}
|
|
@@ -88,39 +88,39 @@ public abstract class NativeProxyCommon {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
@DoNotStrip
|
|
91
|
-
|
|
91
|
+
public void requestRender(AnimationFrameCallback callback) {
|
|
92
92
|
mNodesManager.postOnAnimation(callback);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
@DoNotStrip
|
|
96
|
-
|
|
96
|
+
public void updateProps(int viewTag, Map<String, Object> props) {
|
|
97
97
|
mNodesManager.updateProps(viewTag, props);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
@DoNotStrip
|
|
101
|
-
|
|
101
|
+
public void synchronouslyUpdateUIProps(int viewTag, ReadableMap uiProps) {
|
|
102
102
|
mNodesManager.synchronouslyUpdateUIProps(viewTag, uiProps);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
@DoNotStrip
|
|
106
|
-
|
|
106
|
+
public String obtainProp(int viewTag, String propName) {
|
|
107
107
|
return mNodesManager.obtainProp(viewTag, propName);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
@DoNotStrip
|
|
111
|
-
|
|
111
|
+
public void scrollTo(int viewTag, double x, double y, boolean animated) {
|
|
112
112
|
mNodesManager.scrollTo(viewTag, x, y, animated);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
@DoNotStrip
|
|
116
|
-
|
|
116
|
+
public void setGestureState(int handlerTag, int newState) {
|
|
117
117
|
if (gestureHandlerStateManager != null) {
|
|
118
118
|
gestureHandlerStateManager.setGestureHandlerState(handlerTag, newState);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
@DoNotStrip
|
|
123
|
-
|
|
123
|
+
public long getCurrentTime() {
|
|
124
124
|
if (slowAnimationsEnabled) {
|
|
125
125
|
final long ANIMATIONS_DRAG_FACTOR = 10;
|
|
126
126
|
return this.firstUptime
|
|
@@ -131,12 +131,12 @@ public abstract class NativeProxyCommon {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
@DoNotStrip
|
|
134
|
-
|
|
134
|
+
public float[] measure(int viewTag) {
|
|
135
135
|
return mNodesManager.measure(viewTag);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
@DoNotStrip
|
|
139
|
-
|
|
139
|
+
public void configureProps(ReadableNativeArray uiProps, ReadableNativeArray nativeProps) {
|
|
140
140
|
Set<String> uiPropsSet = convertProps(uiProps);
|
|
141
141
|
Set<String> nativePropsSet = convertProps(nativeProps);
|
|
142
142
|
mNodesManager.configureProps(uiPropsSet, nativePropsSet);
|
|
@@ -152,31 +152,31 @@ public abstract class NativeProxyCommon {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
@DoNotStrip
|
|
155
|
-
|
|
155
|
+
public void registerEventHandler(EventHandler handler) {
|
|
156
156
|
handler.mCustomEventNamesResolver = mNodesManager.getEventNameResolver();
|
|
157
157
|
mNodesManager.registerEventHandler(handler);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
@DoNotStrip
|
|
161
|
-
|
|
161
|
+
public int registerSensor(int sensorType, int interval, SensorSetter setter) {
|
|
162
162
|
return reanimatedSensorContainer.registerSensor(
|
|
163
163
|
ReanimatedSensorType.getInstanceById(sensorType), interval, setter);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
@DoNotStrip
|
|
167
|
-
|
|
167
|
+
public void unregisterSensor(int sensorId) {
|
|
168
168
|
reanimatedSensorContainer.unregisterSensor(sensorId);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
@DoNotStrip
|
|
172
|
-
|
|
172
|
+
public int subscribeForKeyboardEvents(
|
|
173
173
|
KeyboardEventDataUpdater keyboardEventDataUpdater, boolean isStatusBarTranslucent) {
|
|
174
174
|
return reanimatedKeyboardEventListener.subscribeForKeyboardEvents(
|
|
175
175
|
keyboardEventDataUpdater, isStatusBarTranslucent);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
@DoNotStrip
|
|
179
|
-
|
|
179
|
+
public void unsubscribeFromKeyboardEvents(int listenerId) {
|
|
180
180
|
reanimatedKeyboardEventListener.unsubscribeFromKeyboardEvents(listenerId);
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -203,4 +203,11 @@ public abstract class NativeProxyCommon {
|
|
|
203
203
|
|
|
204
204
|
animationsManager.setNativeMethods(NativeProxy.createNativeMethodsHolder(layoutAnimations));
|
|
205
205
|
}
|
|
206
|
+
|
|
207
|
+
@DoNotStrip
|
|
208
|
+
void maybeFlushUIUpdatesQueue() {
|
|
209
|
+
if (!mNodesManager.isAnimationRunning()) {
|
|
210
|
+
mNodesManager.performOperations();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
206
213
|
}
|
|
@@ -2,14 +2,11 @@ package com.swmansion.reanimated;
|
|
|
2
2
|
|
|
3
3
|
import static com.swmansion.reanimated.Utils.simplifyStringNumbersList;
|
|
4
4
|
|
|
5
|
-
import android.util.Log;
|
|
6
|
-
|
|
7
5
|
import com.facebook.jni.HybridData;
|
|
8
6
|
import com.facebook.proguard.annotations.DoNotStrip;
|
|
9
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
8
|
import com.facebook.react.bridge.queue.MessageQueueThread;
|
|
11
9
|
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
|
|
12
|
-
import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
|
|
13
10
|
import com.swmansion.reanimated.layoutReanimation.LayoutAnimations;
|
|
14
11
|
import com.swmansion.reanimated.layoutReanimation.NativeMethodsHolder;
|
|
15
12
|
import com.swmansion.reanimated.nativeProxy.NativeProxyCommon;
|
package/ios/REANodesManager.h
CHANGED
package/ios/REANodesManager.mm
CHANGED
|
@@ -96,6 +96,8 @@ using namespace facebook::react;
|
|
|
96
96
|
BOOL _tryRunBatchUpdatesSynchronously;
|
|
97
97
|
REAEventHandler _eventHandler;
|
|
98
98
|
volatile void (^_mounting)(void);
|
|
99
|
+
NSObject *_syncLayoutUpdatesWaitLock;
|
|
100
|
+
volatile BOOL _syncLayoutUpdatesWaitTimedOut;
|
|
99
101
|
NSMutableDictionary<NSNumber *, ComponentUpdate *> *_componentUpdateBuffer;
|
|
100
102
|
NSMutableDictionary<NSNumber *, UIView *> *_viewRegistry;
|
|
101
103
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -123,6 +125,7 @@ using namespace facebook::react;
|
|
|
123
125
|
_operationsInBatch = [NSMutableDictionary new];
|
|
124
126
|
_componentUpdateBuffer = [NSMutableDictionary new];
|
|
125
127
|
_viewRegistry = [_uiManager valueForKey:@"_viewRegistry"];
|
|
128
|
+
_syncLayoutUpdatesWaitLock = [NSObject new];
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
|
|
@@ -241,8 +244,14 @@ using namespace facebook::react;
|
|
|
241
244
|
- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
|
|
242
245
|
{
|
|
243
246
|
RCTAssert(_mounting == nil, @"Mouting block is expected to not be set");
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
@synchronized(_syncLayoutUpdatesWaitLock) {
|
|
248
|
+
if (_syncLayoutUpdatesWaitTimedOut) {
|
|
249
|
+
return NO;
|
|
250
|
+
} else {
|
|
251
|
+
_mounting = block;
|
|
252
|
+
return YES;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
- (void)performOperations
|
|
@@ -260,6 +269,7 @@ using namespace facebook::react;
|
|
|
260
269
|
|
|
261
270
|
__weak __typeof__(self) weakSelf = self;
|
|
262
271
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
272
|
+
_syncLayoutUpdatesWaitTimedOut = NO;
|
|
263
273
|
RCTExecuteOnUIManagerQueue(^{
|
|
264
274
|
__typeof__(self) strongSelf = weakSelf;
|
|
265
275
|
if (strongSelf == nil) {
|
|
@@ -276,7 +286,7 @@ using namespace facebook::react;
|
|
|
276
286
|
}
|
|
277
287
|
|
|
278
288
|
if (canUpdateSynchronously) {
|
|
279
|
-
[strongSelf.uiManager runSyncUIUpdatesWithObserver:
|
|
289
|
+
[strongSelf.uiManager runSyncUIUpdatesWithObserver:strongSelf];
|
|
280
290
|
dispatch_semaphore_signal(semaphore);
|
|
281
291
|
}
|
|
282
292
|
// In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
|
|
@@ -284,7 +294,16 @@ using namespace facebook::react;
|
|
|
284
294
|
[strongSelf.uiManager setNeedsLayout];
|
|
285
295
|
});
|
|
286
296
|
if (trySynchronously) {
|
|
287
|
-
|
|
297
|
+
// The 16ms timeout here aims to match the frame duration. It may make sense to read that parameter
|
|
298
|
+
// from CADisplayLink but it is easier to hardcode it for the time being.
|
|
299
|
+
// The reason why we use frame duration here is that if takes longer than one frame to complete layout tasks
|
|
300
|
+
// there is no point of synchronizing layout with the UI interaction as we get that one frame delay anyways.
|
|
301
|
+
long result = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, 16 * NSEC_PER_MSEC));
|
|
302
|
+
if (result != 0) {
|
|
303
|
+
@synchronized(_syncLayoutUpdatesWaitLock) {
|
|
304
|
+
_syncLayoutUpdatesWaitTimedOut = YES;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
288
307
|
}
|
|
289
308
|
|
|
290
309
|
if (_mounting) {
|
|
@@ -494,4 +513,11 @@ using namespace facebook::react;
|
|
|
494
513
|
|
|
495
514
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
496
515
|
|
|
516
|
+
- (void)maybeFlushUIUpdatesQueue
|
|
517
|
+
{
|
|
518
|
+
if ([_displayLink isPaused]) {
|
|
519
|
+
[self performOperations];
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
497
523
|
@end
|
|
@@ -12,13 +12,11 @@ typedef NS_ENUM(NSUInteger, KeyboardState) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
@implementation REAKeyboardEventObserver {
|
|
15
|
+
UIView *_measuringView;
|
|
15
16
|
NSNumber *_nextListenerId;
|
|
16
17
|
NSMutableDictionary *_listeners;
|
|
17
|
-
CADisplayLink *
|
|
18
|
-
int _windowsCount;
|
|
19
|
-
UIView *_keyboardView;
|
|
18
|
+
CADisplayLink *_displayLink;
|
|
20
19
|
KeyboardState _state;
|
|
21
|
-
bool _shouldInvalidateDisplayLink;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
- (instancetype)init
|
|
@@ -27,52 +25,16 @@ typedef NS_ENUM(NSUInteger, KeyboardState) {
|
|
|
27
25
|
_listeners = [[NSMutableDictionary alloc] init];
|
|
28
26
|
_nextListenerId = @0;
|
|
29
27
|
_state = UNKNOWN;
|
|
30
|
-
_shouldInvalidateDisplayLink = false;
|
|
31
28
|
|
|
32
29
|
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
|
33
30
|
|
|
34
31
|
[notificationCenter addObserver:self
|
|
35
|
-
selector:@selector(
|
|
32
|
+
selector:@selector(cleanupListeners)
|
|
36
33
|
name:RCTBridgeDidInvalidateModulesNotification
|
|
37
34
|
object:nil];
|
|
38
35
|
return self;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
// copied from
|
|
42
|
-
// https://github.com/tonlabs/UIKit/blob/bd5651e4723d547bde0cb86ca1c27813cedab4a9/casts/keyboard/ios/UIKitKeyboardIosFrameListener.m
|
|
43
|
-
- (UIView *)findKeyboardView
|
|
44
|
-
{
|
|
45
|
-
for (UIWindow *window in [UIApplication.sharedApplication.windows objectEnumerator]) {
|
|
46
|
-
if ([window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")]) {
|
|
47
|
-
for (UIView *containerView in window.subviews) {
|
|
48
|
-
if ([containerView isKindOfClass:NSClassFromString(@"UIInputSetContainerView")]) {
|
|
49
|
-
for (UIView *hostView in containerView.subviews) {
|
|
50
|
-
if ([hostView isKindOfClass:NSClassFromString(@"UIInputSetHostView")]) {
|
|
51
|
-
return hostView;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return nil;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
- (UIView *)getKeyboardView
|
|
62
|
-
{
|
|
63
|
-
/**
|
|
64
|
-
* If the count of windows has changed it means there might be a new UITextEffectsWindow,
|
|
65
|
-
* thus we have to obtain a new `keyboardView`
|
|
66
|
-
*/
|
|
67
|
-
int windowsCount = [UIApplication.sharedApplication.windows count];
|
|
68
|
-
|
|
69
|
-
if (_keyboardView == nil || windowsCount != _windowsCount) {
|
|
70
|
-
_keyboardView = [self findKeyboardView];
|
|
71
|
-
_windowsCount = windowsCount;
|
|
72
|
-
}
|
|
73
|
-
return _keyboardView;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
38
|
#if TARGET_OS_TV
|
|
77
39
|
- (int)subscribeForKeyboardEvents:(KeyboardEventListenerBlock)listener
|
|
78
40
|
{
|
|
@@ -86,72 +48,61 @@ typedef NS_ENUM(NSUInteger, KeyboardState) {
|
|
|
86
48
|
}
|
|
87
49
|
#else
|
|
88
50
|
|
|
89
|
-
- (void)
|
|
51
|
+
- (void)runUpdater
|
|
90
52
|
{
|
|
91
|
-
if (!
|
|
92
|
-
|
|
93
|
-
|
|
53
|
+
if (!_displayLink) {
|
|
54
|
+
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateKeyboardFrame)];
|
|
55
|
+
_displayLink.preferredFramesPerSecond = 120; // will fallback to 60 fps for devices without Pro Motion display
|
|
56
|
+
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
|
94
57
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- (void)stopAnimation
|
|
98
|
-
{
|
|
58
|
+
_displayLink.paused = NO;
|
|
99
59
|
[self updateKeyboardFrame];
|
|
100
|
-
// there might be a case that keyboard will change height in the next frame
|
|
101
|
-
// (for example changing keyboard language so that suggestions appear)
|
|
102
|
-
// so we invalidate display link after we handle that in the next frame
|
|
103
|
-
_shouldInvalidateDisplayLink = true;
|
|
104
60
|
}
|
|
105
61
|
|
|
106
62
|
- (void)updateKeyboardFrame
|
|
107
63
|
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
64
|
+
BOOL isAnimatingKeyboardChange = _measuringView.layer.presentationLayer.animationKeys.count != 0;
|
|
65
|
+
CGRect measuringFrame =
|
|
66
|
+
isAnimatingKeyboardChange ? _measuringView.layer.presentationLayer.frame : _measuringView.frame;
|
|
67
|
+
CGFloat keyboardHeight = measuringFrame.size.height;
|
|
68
|
+
|
|
69
|
+
if (!isAnimatingKeyboardChange) {
|
|
70
|
+
// measuring view is no longer running an animation, we should settle in OPEN/CLOSE state
|
|
71
|
+
if (_state == OPENING || _state == CLOSING) {
|
|
72
|
+
_state = _state == OPENING ? OPEN : CLOSED;
|
|
73
|
+
}
|
|
74
|
+
// stop display link updates if no animation is running
|
|
75
|
+
_displayLink.paused = YES;
|
|
111
76
|
}
|
|
112
77
|
|
|
113
|
-
CGFloat keyboardHeight = [self computeKeyboardHeight:keyboardView];
|
|
114
78
|
for (NSString *key in _listeners.allKeys) {
|
|
115
79
|
((KeyboardEventListenerBlock)_listeners[key])(_state, keyboardHeight);
|
|
116
80
|
}
|
|
117
|
-
|
|
118
|
-
if (_shouldInvalidateDisplayLink) {
|
|
119
|
-
_shouldInvalidateDisplayLink = false;
|
|
120
|
-
[displayLink invalidate];
|
|
121
|
-
displayLink = nil;
|
|
122
|
-
}
|
|
123
81
|
}
|
|
124
82
|
|
|
125
|
-
- (
|
|
83
|
+
- (void)keyboardWillChangeFrame:(NSNotification *)notification
|
|
126
84
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
85
|
+
NSDictionary *userInfo = [notification userInfo];
|
|
86
|
+
CGRect beginFrame = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
|
87
|
+
CGRect endFrame = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
|
88
|
+
NSTimeInterval animationDuration = [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
|
89
|
+
CGSize windowSize = [[[UIApplication sharedApplication] delegate] window].frame.size;
|
|
132
90
|
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
_state = OPENING;
|
|
136
|
-
[self runAnimation];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
- (void)keyboardDidShow:(NSNotification *)notification
|
|
140
|
-
{
|
|
141
|
-
_state = OPEN;
|
|
142
|
-
[self stopAnimation];
|
|
143
|
-
}
|
|
91
|
+
CGFloat beginHeight = windowSize.height - beginFrame.origin.y;
|
|
92
|
+
CGFloat endHeight = windowSize.height - endFrame.origin.y;
|
|
144
93
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
_state
|
|
148
|
-
|
|
149
|
-
}
|
|
94
|
+
if (endHeight > 0 && _state != OPEN) {
|
|
95
|
+
_state = OPENING;
|
|
96
|
+
} else if (endHeight == 0 && _state != CLOSED) {
|
|
97
|
+
_state = CLOSING;
|
|
98
|
+
}
|
|
150
99
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
100
|
+
_measuringView.frame = CGRectMake(0, -1, 0, beginHeight);
|
|
101
|
+
[UIView animateWithDuration:animationDuration
|
|
102
|
+
animations:^{
|
|
103
|
+
self->_measuringView.frame = CGRectMake(0, -1, 0, endHeight);
|
|
104
|
+
}];
|
|
105
|
+
[self runUpdater];
|
|
155
106
|
}
|
|
156
107
|
|
|
157
108
|
- (int)subscribeForKeyboardEvents:(KeyboardEventListenerBlock)listener
|
|
@@ -159,34 +110,21 @@ typedef NS_ENUM(NSUInteger, KeyboardState) {
|
|
|
159
110
|
NSNumber *listenerId = [_nextListenerId copy];
|
|
160
111
|
_nextListenerId = [NSNumber numberWithInt:[_nextListenerId intValue] + 1];
|
|
161
112
|
RCTExecuteOnMainQueue(^() {
|
|
113
|
+
if (!self->_measuringView) {
|
|
114
|
+
self->_measuringView = [[UIView alloc] initWithFrame:CGRectMake(0, -1, 0, 0)];
|
|
115
|
+
UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window];
|
|
116
|
+
[keyWindow addSubview:self->_measuringView];
|
|
117
|
+
}
|
|
162
118
|
if ([self->_listeners count] == 0) {
|
|
163
119
|
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
|
164
120
|
|
|
165
121
|
[notificationCenter addObserver:self
|
|
166
|
-
selector:@selector(
|
|
167
|
-
name:
|
|
168
|
-
object:nil];
|
|
169
|
-
|
|
170
|
-
[notificationCenter addObserver:self
|
|
171
|
-
selector:@selector(keyboardWillShow:)
|
|
172
|
-
name:UIKeyboardWillShowNotification
|
|
173
|
-
object:nil];
|
|
174
|
-
|
|
175
|
-
[notificationCenter addObserver:self
|
|
176
|
-
selector:@selector(keyboardDidHide:)
|
|
177
|
-
name:UIKeyboardDidHideNotification
|
|
178
|
-
object:nil];
|
|
179
|
-
|
|
180
|
-
[notificationCenter addObserver:self
|
|
181
|
-
selector:@selector(keyboardDidShow:)
|
|
182
|
-
name:UIKeyboardDidShowNotification
|
|
122
|
+
selector:@selector(keyboardWillChangeFrame:)
|
|
123
|
+
name:UIKeyboardWillChangeFrameNotification
|
|
183
124
|
object:nil];
|
|
184
125
|
}
|
|
185
126
|
|
|
186
127
|
[self->_listeners setObject:listener forKey:listenerId];
|
|
187
|
-
if (self->_state == UNKNOWN) {
|
|
188
|
-
[self recognizeInitialKeyboardState];
|
|
189
|
-
}
|
|
190
128
|
});
|
|
191
129
|
return [listenerId intValue];
|
|
192
130
|
}
|
|
@@ -197,34 +135,17 @@ typedef NS_ENUM(NSUInteger, KeyboardState) {
|
|
|
197
135
|
NSNumber *_listenerId = [NSNumber numberWithInt:listenerId];
|
|
198
136
|
[self->_listeners removeObjectForKey:_listenerId];
|
|
199
137
|
if ([self->_listeners count] == 0) {
|
|
200
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:
|
|
201
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
|
202
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil];
|
|
203
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
- (void)recognizeInitialKeyboardState
|
|
209
|
-
{
|
|
210
|
-
RCTExecuteOnMainQueue(^() {
|
|
211
|
-
UIView *keyboardView = [self getKeyboardView];
|
|
212
|
-
if (keyboardView == nil) {
|
|
213
|
-
self->_state = CLOSED;
|
|
214
|
-
} else {
|
|
215
|
-
CGFloat keyboardHeight = [self computeKeyboardHeight:keyboardView];
|
|
216
|
-
self->_state = keyboardHeight == 0 ? CLOSED : OPEN;
|
|
138
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillChangeFrameNotification object:nil];
|
|
217
139
|
}
|
|
218
|
-
[self updateKeyboardFrame];
|
|
219
140
|
});
|
|
220
141
|
}
|
|
221
142
|
|
|
222
|
-
- (void)
|
|
143
|
+
- (void)cleanupListeners
|
|
223
144
|
{
|
|
224
145
|
RCTUnsafeExecuteOnMainQueueSync(^() {
|
|
225
146
|
[self->_listeners removeAllObjects];
|
|
226
|
-
[self->
|
|
227
|
-
self->
|
|
147
|
+
[self->_displayLink invalidate];
|
|
148
|
+
self->_displayLink = nil;
|
|
228
149
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
229
150
|
});
|
|
230
151
|
}
|