react-native-reanimated 2.4.0 → 2.6.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/AnimatedSensor/AnimatedSensorModule.cpp +72 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +30 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +64 -39
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -0
- package/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +41 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +14 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +14 -0
- package/Common/cpp/headers/SharedItems/MutableValue.h +4 -1
- package/Common/cpp/headers/SharedItems/ShareableValue.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +3 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +11 -0
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +2 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/RNReanimated.podspec +15 -6
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/CMakeLists.txt +198 -0
- package/android/README.md +15 -0
- package/android/build.gradle +676 -73
- package/android/empty.cpp +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +25 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedNativeHierarchyManager.java +412 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/settings.gradle +1 -0
- package/android/spotless.gradle +9 -0
- package/android/src/{AndroidManifest.xml → main/AndroidManifest.xml} +0 -0
- package/android/src/main/cpp/AndroidErrorHandler.cpp +42 -0
- package/android/src/main/cpp/AndroidLogger.cpp +27 -0
- package/android/src/main/cpp/AndroidScheduler.cpp +59 -0
- package/android/src/main/cpp/JNIHelper.cpp +59 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +103 -0
- package/android/src/main/cpp/NativeProxy.cpp +327 -0
- package/android/src/main/cpp/OnLoad.cpp +17 -0
- package/android/src/main/cpp/TurboModule.cpp +44 -0
- package/android/src/main/cpp/headers/AndroidErrorHandler.h +30 -0
- package/android/src/main/cpp/headers/AndroidLogger.h +16 -0
- package/android/src/main/cpp/headers/AndroidScheduler.h +41 -0
- package/android/src/main/cpp/headers/JNIHelper.h +30 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +42 -0
- package/android/src/main/cpp/headers/NativeProxy.h +170 -0
- package/android/src/main/cpp/headers/TurboModule.h +70 -0
- package/android/src/main/java/com/facebook/react/uimanager/UIManagerReanimatedHelper.java +15 -0
- package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +8 -0
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +43 -0
- package/android/src/main/java/com/swmansion/reanimated/MapUtils.java +26 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +117 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +285 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +682 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +251 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +96 -0
- package/android/src/main/java/com/swmansion/reanimated/Scheduler.java +51 -0
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +517 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +56 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +410 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +292 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +121 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +12 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +87 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +24 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +49 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +38 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +73 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +36 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +33 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +83 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +20 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +139 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +37 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +377 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +71 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +153 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +25 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +86 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +161 -0
- package/ios/LayoutReanimation/REAAnimationsManager.m +14 -4
- package/ios/REAModule.m +8 -9
- package/ios/REANodesManager.h +4 -1
- package/ios/REANodesManager.m +76 -4
- package/ios/native/NativeProxy.mm +76 -4
- package/ios/sensor/ReanimatedSensor.h +25 -0
- package/ios/sensor/ReanimatedSensor.m +217 -0
- package/ios/sensor/ReanimatedSensorContainer.h +12 -0
- package/ios/sensor/ReanimatedSensorContainer.m +40 -0
- package/ios/sensor/ReanimatedSensorType.h +7 -0
- package/lib/{src/Animated.js → Animated.js} +0 -0
- package/lib/{src/ConfigHelper.js → ConfigHelper.js} +2 -2
- package/lib/{src/ReanimatedEventEmitter.js → ReanimatedEventEmitter.js} +0 -0
- package/lib/{src/ReanimatedModule.js → ReanimatedModule.js} +0 -0
- package/lib/{src/ReanimatedModule.macos.js → ReanimatedModule.macos.js} +0 -0
- package/lib/{src/ReanimatedModule.native.js → ReanimatedModule.native.js} +0 -0
- package/lib/{src/ReanimatedModule.windows.js → ReanimatedModule.windows.js} +0 -0
- package/lib/{src/ReanimatedModuleCompat.js → ReanimatedModuleCompat.js} +0 -0
- package/lib/{src/__mocks__ → __mocks__}/ReanimatedEventEmitter.js +0 -0
- package/lib/{src/__mocks__ → __mocks__}/ReanimatedModule.native.js +0 -0
- package/lib/{src/createAnimatedComponent.js → createAnimatedComponent.js} +3 -4
- package/lib/{src/index.js → index.js} +0 -0
- package/lib/{src/reanimated1 → reanimated1}/Easing.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/SpringConfig.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/Transitioning.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/Animation.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/SpringUtils.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/backwardCompatibleAnimWrapper.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/decay.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/spring.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/timing.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/base.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedAlways.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedBezier.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedBlock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCall.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCallFunc.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedClockTest.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedConcat.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCond.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedDebug.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedEvent.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedFunction.js +1 -1
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedNode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedOperator.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedParam.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedProps.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedSet.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStartClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStopClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStyle.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedTransform.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/Core.test.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/InternalAnimatedValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/__mocks__/AnimatedProps.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/createEventObjectProxyPolyfill.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/__mocks__/evaluateOnce.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/acc.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/color.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/diff.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/diffClamp.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/evaluateOnce.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/index.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/interpolate.js +2 -4
- package/lib/{src/reanimated1 → reanimated1}/derived/interpolateColors.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/onChange.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/useCode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/index.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/operators.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/useValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/val.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/Bezier.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/Colors.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/Easing.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/NativeMethods.js +0 -0
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +50 -0
- package/lib/{src/reanimated2 → reanimated2}/NativeReanimated/index.js +0 -4
- package/lib/{src/reanimated2 → reanimated2}/PlatformChecker.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/PropAdapters.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/UpdateProps.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/ViewDescriptorsSet.js +2 -2
- package/lib/{src/reanimated2 → reanimated2}/WorkletEventHandler.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/MutableValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/NativeReanimated.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/NativeReanimated.native.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/decay.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/delay.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/repeat.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/sequence.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/spring.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/styleAnimation.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/animation/timing.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/util.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/FlatList.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/WrappedComponents.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/core.js +30 -24
- package/lib/{src/reanimated2 → reanimated2}/globals.d.ts +6 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/Hooks.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/index.js +1 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedReaction.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedRef.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.js +0 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedStyle.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useDerivedValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useSharedValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/utils.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/interpolateColor.js +11 -11
- package/lib/{src/reanimated2 → reanimated2}/interpolation.js +1 -1
- package/lib/{src/reanimated2 → reanimated2}/jestUtils.js +9 -4
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/JSReanimated.js +23 -2
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/Mapper.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/MutableValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/index.js +3 -3
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.js +32 -42
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.js +20 -38
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.js +32 -44
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.js +20 -36
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.js +16 -20
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.js +8 -12
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.js +32 -48
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/mock.js +3 -2
- package/lib/{src/reanimated2 → reanimated2}/platform-specific/RNRenderer.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/platform-specific/RNRenderer.web.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/utils.js +0 -0
- package/lib/{src/setAndForwardRef.js → setAndForwardRef.js} +0 -0
- package/lib/types/lib/ConfigHelper.d.ts +12 -0
- package/lib/types/lib/ReanimatedEventEmitter.d.ts +3 -0
- package/lib/types/lib/ReanimatedModule.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.macos.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.native.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.windows.d.ts +2 -0
- package/lib/types/lib/ReanimatedModuleCompat.d.ts +14 -0
- package/lib/types/lib/createAnimatedComponent.d.ts +33 -0
- package/lib/types/lib/reanimated2/Bezier.d.ts +6 -0
- package/lib/types/lib/reanimated2/Colors.d.ts +31 -0
- package/lib/types/lib/reanimated2/Easing.d.ts +172 -0
- package/lib/types/lib/reanimated2/NativeMethods.d.ts +14 -0
- package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +20 -0
- package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +3 -0
- package/lib/types/lib/reanimated2/PlatformChecker.d.ts +5 -0
- package/lib/types/lib/reanimated2/PropAdapters.d.ts +4 -0
- package/lib/types/lib/reanimated2/UpdateProps.d.ts +9 -0
- package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +20 -0
- package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +5 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +13 -0
- package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +27 -0
- package/lib/types/lib/reanimated2/animation/decay.d.ts +19 -0
- package/lib/types/lib/reanimated2/animation/delay.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/animation/repeat.d.ts +12 -0
- package/lib/types/lib/reanimated2/animation/sequence.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/spring.d.ts +22 -0
- package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/timing.d.ts +21 -0
- package/lib/types/lib/reanimated2/animation/util.d.ts +9 -0
- package/lib/types/lib/reanimated2/commonTypes.d.ts +80 -0
- package/lib/types/lib/reanimated2/component/FlatList.d.ts +9 -0
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +8 -0
- package/lib/types/lib/reanimated2/component/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/core.d.ts +24 -0
- package/lib/types/lib/reanimated2/hook/Hooks.d.ts +5 -0
- package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +14 -0
- package/lib/types/lib/reanimated2/hook/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +35 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +12 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +3 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +21 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +20 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +11 -0
- package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +4 -0
- package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +2 -0
- package/lib/types/lib/reanimated2/hook/utils.d.ts +28 -0
- package/lib/types/lib/reanimated2/index.d.ts +12 -0
- package/lib/types/lib/reanimated2/interpolateColor.d.ts +26 -0
- package/lib/types/lib/reanimated2/interpolation.d.ts +14 -0
- package/lib/types/lib/reanimated2/jestUtils.d.ts +12 -0
- package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +30 -0
- package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +44 -0
- package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +15 -0
- package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +1 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +22 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +38 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +25 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +77 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +62 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +42 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +50 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +66 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +19 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +13 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +7 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +9 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/mock.d.ts +55 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +1 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/utils.d.ts +7 -0
- package/lib/types/lib/setAndForwardRef.d.ts +40 -0
- package/lib/types/react-native-reanimated-tests.d.ts +1 -0
- package/mock.js +5 -4
- package/package.json +44 -38
- package/plugin.js +3 -0
- package/react-native-reanimated.d.ts +64 -34
- package/src/ConfigHelper.ts +4 -4
- package/src/createAnimatedComponent.tsx +4 -4
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/derived/interpolate.js +2 -4
- package/src/reanimated2/Colors.ts +2 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +42 -15
- package/src/reanimated2/NativeReanimated/index.ts +0 -6
- package/src/reanimated2/ViewDescriptorsSet.ts +2 -3
- package/src/reanimated2/animation/index.ts +1 -0
- package/src/reanimated2/animation/styleAnimation.ts +10 -7
- package/src/reanimated2/animation/timing.ts +3 -1
- package/src/reanimated2/animation/util.ts +10 -11
- package/src/reanimated2/commonTypes.ts +20 -0
- package/src/reanimated2/component/FlatList.tsx +3 -2
- package/src/reanimated2/core.ts +34 -26
- package/src/reanimated2/globals.d.ts +6 -0
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +91 -0
- package/src/reanimated2/hook/utils.ts +2 -1
- package/src/reanimated2/interpolateColor.ts +11 -11
- package/src/reanimated2/interpolation.ts +2 -6
- package/src/reanimated2/jestUtils.ts +20 -4
- package/src/reanimated2/js-reanimated/JSReanimated.ts +25 -2
- package/src/reanimated2/js-reanimated/index.ts +3 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +13 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -3
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +51 -21
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +40 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +48 -12
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +32 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +64 -16
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +26 -19
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -1
- package/src/reanimated2/mock.ts +3 -2
- package/android/expo/linking.gradle +0 -46
- package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +0 -12
- package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +0 -26
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedProxyPackage.java +0 -15
- package/expo-module.config.json +0 -3
- package/lib/src/reanimated2/NativeReanimated/NativeReanimated.js +0 -37
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
package com.swmansion.reanimated.layoutReanimation;
|
|
2
|
+
|
|
3
|
+
import android.os.Build;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
import android.view.View;
|
|
6
|
+
import android.view.ViewGroup;
|
|
7
|
+
import androidx.annotation.Nullable;
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
9
|
+
import com.facebook.react.bridge.UiThreadUtil;
|
|
10
|
+
import com.facebook.react.uimanager.IllegalViewOperationException;
|
|
11
|
+
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
|
12
|
+
import com.facebook.react.uimanager.RootViewManager;
|
|
13
|
+
import com.facebook.react.uimanager.ViewAtIndex;
|
|
14
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
15
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.ViewManagerRegistry;
|
|
17
|
+
import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController;
|
|
18
|
+
import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
|
|
19
|
+
import com.swmansion.reanimated.ReanimatedModule;
|
|
20
|
+
import java.lang.ref.WeakReference;
|
|
21
|
+
import java.lang.reflect.Field;
|
|
22
|
+
import java.lang.reflect.Modifier;
|
|
23
|
+
import java.util.ArrayList;
|
|
24
|
+
import java.util.HashMap;
|
|
25
|
+
import java.util.HashSet;
|
|
26
|
+
import java.util.Set;
|
|
27
|
+
|
|
28
|
+
class ReaLayoutAnimator extends LayoutAnimationController {
|
|
29
|
+
private AnimationsManager mAnimationsManager = null;
|
|
30
|
+
private volatile boolean mInitialized = false;
|
|
31
|
+
private ReactApplicationContext mContext;
|
|
32
|
+
private WeakReference<NativeViewHierarchyManager> mWeakNativeViewHierarchyManage =
|
|
33
|
+
new WeakReference<>(null);
|
|
34
|
+
|
|
35
|
+
ReaLayoutAnimator(
|
|
36
|
+
ReactApplicationContext context, NativeViewHierarchyManager nativeViewHierarchyManager) {
|
|
37
|
+
mContext = context;
|
|
38
|
+
mWeakNativeViewHierarchyManage = new WeakReference<>(nativeViewHierarchyManager);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public void maybeInit() {
|
|
42
|
+
if (!mInitialized) {
|
|
43
|
+
mInitialized = true;
|
|
44
|
+
ReanimatedModule reanimatedModule = mContext.getNativeModule(ReanimatedModule.class);
|
|
45
|
+
mAnimationsManager = reanimatedModule.getNodesManager().getAnimationsManager();
|
|
46
|
+
mAnimationsManager.setReanimatedNativeHierarchyManager(
|
|
47
|
+
(ReanimatedNativeHierarchyManager) mWeakNativeViewHierarchyManage.get());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public boolean shouldAnimateLayout(View viewToAnimate) {
|
|
52
|
+
if (!isLayoutAnimationEnabled()) {
|
|
53
|
+
return super.shouldAnimateLayout(viewToAnimate);
|
|
54
|
+
}
|
|
55
|
+
// if view parent is null, skip animation: view have been clipped, we don't want animation to
|
|
56
|
+
// resume when view is re-attached to parent, which is the standard android animation behavior.
|
|
57
|
+
// If there's a layout handling animation going on, it should be animated nonetheless since the
|
|
58
|
+
// ongoing animation needs to be updated.
|
|
59
|
+
if (viewToAnimate == null) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return (viewToAnimate.getParent() != null);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Update layout of given view, via immediate update or animation depending on the current batch
|
|
67
|
+
* layout animation configuration supplied during initialization. Handles create and update
|
|
68
|
+
* animations.
|
|
69
|
+
*
|
|
70
|
+
* @param view the view to update layout of
|
|
71
|
+
* @param x the new X position for the view
|
|
72
|
+
* @param y the new Y position for the view
|
|
73
|
+
* @param width the new width value for the view
|
|
74
|
+
* @param height the new height value for the view
|
|
75
|
+
*/
|
|
76
|
+
public void applyLayoutUpdate(View view, int x, int y, int width, int height) {
|
|
77
|
+
if (!isLayoutAnimationEnabled()) {
|
|
78
|
+
super.applyLayoutUpdate(view, x, y, width, height);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
UiThreadUtil.assertOnUiThread();
|
|
82
|
+
maybeInit();
|
|
83
|
+
// Determine which animation to use : if view is initially invisible, use create animation,
|
|
84
|
+
// otherwise use update animation. This approach is easier than maintaining a list of tags
|
|
85
|
+
// for recently created views.
|
|
86
|
+
if (view.getWidth() == 0 || view.getHeight() == 0) {
|
|
87
|
+
view.layout(x, y, x + width, y + height);
|
|
88
|
+
if (view.getId() != -1) {
|
|
89
|
+
mAnimationsManager.onViewCreate(
|
|
90
|
+
view,
|
|
91
|
+
(ViewGroup) view.getParent(),
|
|
92
|
+
new Snapshot(view, mWeakNativeViewHierarchyManage.get()));
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
Snapshot before = new Snapshot(view, mWeakNativeViewHierarchyManage.get());
|
|
96
|
+
view.layout(x, y, x + width, y + height);
|
|
97
|
+
Snapshot after = new Snapshot(view, mWeakNativeViewHierarchyManage.get());
|
|
98
|
+
mAnimationsManager.onViewUpdate(view, before, after);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Animate a view deletion using the layout animation configuration supplied during
|
|
104
|
+
* initialization.
|
|
105
|
+
*
|
|
106
|
+
* @param view The view to animate.
|
|
107
|
+
* @param listener Called once the animation is finished, should be used to completely remove the
|
|
108
|
+
* view.
|
|
109
|
+
*/
|
|
110
|
+
public void deleteView(final View view, final LayoutAnimationListener listener) {
|
|
111
|
+
if (!isLayoutAnimationEnabled()) {
|
|
112
|
+
super.deleteView(view, listener);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
UiThreadUtil.assertOnUiThread();
|
|
116
|
+
NativeViewHierarchyManager nativeViewHierarchyManager = mWeakNativeViewHierarchyManage.get();
|
|
117
|
+
ViewManager viewManager;
|
|
118
|
+
try {
|
|
119
|
+
viewManager = nativeViewHierarchyManager.resolveViewManager(view.getId());
|
|
120
|
+
} catch (IllegalViewOperationException e) {
|
|
121
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
122
|
+
e.printStackTrace();
|
|
123
|
+
super.deleteView(view, listener);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// we don't want layout animations in native-stack since it is currently buggy there
|
|
127
|
+
// so we check if it is a (grand)child of ScreenStack
|
|
128
|
+
if (viewManager.getName().equals("RNSScreen")
|
|
129
|
+
&& view.getParent() != null
|
|
130
|
+
&& view.getParent().getParent() instanceof View) {
|
|
131
|
+
// we check grandparent of Screen since the parent is a ScreenStackFragment
|
|
132
|
+
View screenParentView = (View) view.getParent().getParent();
|
|
133
|
+
ViewManager screenParentViewManager;
|
|
134
|
+
try {
|
|
135
|
+
screenParentViewManager =
|
|
136
|
+
nativeViewHierarchyManager.resolveViewManager(screenParentView.getId());
|
|
137
|
+
} catch (IllegalViewOperationException e) {
|
|
138
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
139
|
+
e.printStackTrace();
|
|
140
|
+
super.deleteView(view, listener);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
String parentName = screenParentViewManager.getName();
|
|
144
|
+
if (parentName.equals("RNSScreenStack")) {
|
|
145
|
+
super.deleteView(view, listener);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
maybeInit();
|
|
150
|
+
Snapshot before = new Snapshot(view, mWeakNativeViewHierarchyManage.get());
|
|
151
|
+
mAnimationsManager.onViewRemoval(
|
|
152
|
+
view, (ViewGroup) view.getParent(), before, () -> listener.onAnimationEnd());
|
|
153
|
+
if (viewManager instanceof ViewGroupManager) {
|
|
154
|
+
ViewGroupManager vgm = (ViewGroupManager) viewManager;
|
|
155
|
+
for (int i = 0; i < vgm.getChildCount((ViewGroup) view); ++i) {
|
|
156
|
+
dfs(vgm.getChildAt((ViewGroup) view, i), nativeViewHierarchyManager);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private void dfs(View view, NativeViewHierarchyManager nativeViewHierarchyManager) {
|
|
162
|
+
int tag = view.getId();
|
|
163
|
+
if (tag == -1) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
ViewManager vm = null;
|
|
167
|
+
try {
|
|
168
|
+
vm = nativeViewHierarchyManager.resolveViewManager(tag);
|
|
169
|
+
Snapshot before = new Snapshot(view, mWeakNativeViewHierarchyManage.get());
|
|
170
|
+
mAnimationsManager.onViewRemoval(
|
|
171
|
+
view,
|
|
172
|
+
(ViewGroup) view.getParent(),
|
|
173
|
+
before,
|
|
174
|
+
() -> {
|
|
175
|
+
ReanimatedNativeHierarchyManager reanimatedNativeHierarchyManager =
|
|
176
|
+
(ReanimatedNativeHierarchyManager) nativeViewHierarchyManager;
|
|
177
|
+
reanimatedNativeHierarchyManager.publicDropView(view);
|
|
178
|
+
});
|
|
179
|
+
} catch (IllegalViewOperationException e) {
|
|
180
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
181
|
+
e.printStackTrace();
|
|
182
|
+
}
|
|
183
|
+
if (vm instanceof ViewGroupManager) {
|
|
184
|
+
ViewGroupManager vgm = (ViewGroupManager) vm;
|
|
185
|
+
for (int i = 0; i < vgm.getChildCount((ViewGroup) view); ++i) {
|
|
186
|
+
dfs(vgm.getChildAt((ViewGroup) view, i), nativeViewHierarchyManager);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public boolean isLayoutAnimationEnabled() {
|
|
192
|
+
maybeInit();
|
|
193
|
+
return mAnimationsManager.isLayoutAnimationEnabled();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager {
|
|
198
|
+
private final HashMap<Integer, ArrayList<View>> toBeRemoved = new HashMap<>();
|
|
199
|
+
private final HashMap<Integer, Runnable> cleanerCallback = new HashMap<>();
|
|
200
|
+
private LayoutAnimationController mReaLayoutAnimator = null;
|
|
201
|
+
private HashMap<Integer, Set<Integer>> mPendingDeletionsForTag = new HashMap<>();
|
|
202
|
+
private boolean initOk = true;
|
|
203
|
+
|
|
204
|
+
public ReanimatedNativeHierarchyManager(
|
|
205
|
+
ViewManagerRegistry viewManagers, ReactApplicationContext reactContext) {
|
|
206
|
+
super(viewManagers);
|
|
207
|
+
|
|
208
|
+
mReaLayoutAnimator = new ReaLayoutAnimator(reactContext, this);
|
|
209
|
+
|
|
210
|
+
Class clazz = this.getClass().getSuperclass();
|
|
211
|
+
if (clazz == null) {
|
|
212
|
+
Log.e("reanimated", "unable to resolve super class of ReanimatedNativeHierarchyManager");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
try {
|
|
217
|
+
Field layoutAnimatorField = clazz.getDeclaredField("mLayoutAnimator");
|
|
218
|
+
layoutAnimatorField.setAccessible(true);
|
|
219
|
+
|
|
220
|
+
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
221
|
+
try {
|
|
222
|
+
// accessFlags is supported only by API >=23
|
|
223
|
+
Field modifiersField = Field.class.getDeclaredField("accessFlags");
|
|
224
|
+
modifiersField.setAccessible(true);
|
|
225
|
+
modifiersField.setInt(
|
|
226
|
+
layoutAnimatorField, layoutAnimatorField.getModifiers() & ~Modifier.FINAL);
|
|
227
|
+
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
228
|
+
e.printStackTrace();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
layoutAnimatorField.set(this, mReaLayoutAnimator);
|
|
232
|
+
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
233
|
+
initOk = false;
|
|
234
|
+
e.printStackTrace();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
try {
|
|
238
|
+
Field pendingTagsField = clazz.getDeclaredField("mPendingDeletionsForTag");
|
|
239
|
+
pendingTagsField.setAccessible(true);
|
|
240
|
+
|
|
241
|
+
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
242
|
+
try {
|
|
243
|
+
// accessFlags is supported only by API >=23
|
|
244
|
+
Field pendingTagsFieldModifiers = Field.class.getDeclaredField("accessFlags");
|
|
245
|
+
pendingTagsFieldModifiers.setAccessible(true);
|
|
246
|
+
pendingTagsFieldModifiers.setInt(
|
|
247
|
+
pendingTagsField, pendingTagsField.getModifiers() & ~Modifier.FINAL);
|
|
248
|
+
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
249
|
+
e.printStackTrace();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
pendingTagsField.set(this, mPendingDeletionsForTag);
|
|
253
|
+
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
254
|
+
initOk = false;
|
|
255
|
+
e.printStackTrace();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (initOk) {
|
|
259
|
+
setLayoutAnimationEnabled(true);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public ReanimatedNativeHierarchyManager(
|
|
264
|
+
ViewManagerRegistry viewManagers, RootViewManager manager) {
|
|
265
|
+
super(viewManagers, manager);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
private boolean isLayoutAnimationDisabled() {
|
|
269
|
+
return !initOk || !((ReaLayoutAnimator) mReaLayoutAnimator).isLayoutAnimationEnabled();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
public synchronized void updateLayout(
|
|
273
|
+
int parentTag, int tag, int x, int y, int width, int height) {
|
|
274
|
+
super.updateLayout(parentTag, tag, x, y, width, height);
|
|
275
|
+
if (isLayoutAnimationDisabled()) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
View viewToUpdate = this.resolveView(tag);
|
|
280
|
+
ViewManager viewManager = this.resolveViewManager(tag);
|
|
281
|
+
String viewManagerName = viewManager.getName();
|
|
282
|
+
View container = resolveView(parentTag);
|
|
283
|
+
if (container != null
|
|
284
|
+
&& viewManagerName.equals("RNSScreen")
|
|
285
|
+
&& this.mReaLayoutAnimator != null) {
|
|
286
|
+
this.mReaLayoutAnimator.applyLayoutUpdate(
|
|
287
|
+
viewToUpdate,
|
|
288
|
+
(int) container.getX(),
|
|
289
|
+
(int) container.getY(),
|
|
290
|
+
container.getWidth(),
|
|
291
|
+
container.getHeight());
|
|
292
|
+
}
|
|
293
|
+
} catch (IllegalViewOperationException e) {
|
|
294
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
295
|
+
e.printStackTrace();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// @Override
|
|
300
|
+
public synchronized void manageChildren(
|
|
301
|
+
int tag,
|
|
302
|
+
@Nullable int[] indicesToRemove,
|
|
303
|
+
@Nullable ViewAtIndex[] viewsToAdd,
|
|
304
|
+
@Nullable int[] tagsToDelete) {
|
|
305
|
+
int[] mock = new int[] {};
|
|
306
|
+
if (isLayoutAnimationDisabled()) {
|
|
307
|
+
super.manageChildren(tag, indicesToRemove, viewsToAdd, tagsToDelete, mock);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
ViewGroup viewGroup;
|
|
311
|
+
ViewGroupManager viewGroupManager;
|
|
312
|
+
try {
|
|
313
|
+
viewGroup = (ViewGroup) resolveView(tag);
|
|
314
|
+
viewGroupManager = (ViewGroupManager) resolveViewManager(tag);
|
|
315
|
+
} catch (IllegalViewOperationException e) {
|
|
316
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
317
|
+
e.printStackTrace();
|
|
318
|
+
super.manageChildren(tag, indicesToRemove, viewsToAdd, tagsToDelete, mock);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// we don't want layout animations in native-stack since it is currently buggy there
|
|
323
|
+
if (viewGroupManager.getName().equals("RNSScreenStack")) {
|
|
324
|
+
super.manageChildren(tag, indicesToRemove, viewsToAdd, tagsToDelete, mock);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (toBeRemoved.containsKey(tag)) {
|
|
329
|
+
ArrayList<View> childrenToBeRemoved = toBeRemoved.get(tag);
|
|
330
|
+
HashSet<Integer> tagsToRemove = new HashSet<Integer>();
|
|
331
|
+
for (View childToRemove : childrenToBeRemoved) {
|
|
332
|
+
tagsToRemove.add(childToRemove.getId());
|
|
333
|
+
}
|
|
334
|
+
while (viewGroupManager.getChildCount(viewGroup) != 0) {
|
|
335
|
+
View child =
|
|
336
|
+
viewGroupManager.getChildAt(viewGroup, viewGroupManager.getChildCount(viewGroup) - 1);
|
|
337
|
+
if (tagsToRemove.contains(child.getId())) {
|
|
338
|
+
viewGroupManager.removeViewAt(viewGroup, viewGroupManager.getChildCount(viewGroup) - 1);
|
|
339
|
+
} else {
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (tagsToDelete != null) {
|
|
345
|
+
if (!toBeRemoved.containsKey(tag)) {
|
|
346
|
+
toBeRemoved.put(tag, new ArrayList<>());
|
|
347
|
+
}
|
|
348
|
+
ArrayList<View> toBeRemovedChildren = toBeRemoved.get(tag);
|
|
349
|
+
for (Integer childtag : tagsToDelete) {
|
|
350
|
+
View view;
|
|
351
|
+
try {
|
|
352
|
+
view = resolveView(childtag);
|
|
353
|
+
} catch (IllegalViewOperationException e) {
|
|
354
|
+
// (IllegalViewOperationException) == (vm == null)
|
|
355
|
+
e.printStackTrace();
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
toBeRemovedChildren.add(view);
|
|
359
|
+
cleanerCallback.put(
|
|
360
|
+
view.getId(),
|
|
361
|
+
new Runnable() {
|
|
362
|
+
@Override
|
|
363
|
+
public void run() {
|
|
364
|
+
toBeRemovedChildren.remove(view);
|
|
365
|
+
viewGroupManager.removeView(viewGroup, view);
|
|
366
|
+
} // It's far from optimal but let's leave it as it is for now
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// mPendingDeletionsForTag is modify by React
|
|
372
|
+
if (mPendingDeletionsForTag != null) {
|
|
373
|
+
Set<Integer> pendingTags = mPendingDeletionsForTag.get(tag);
|
|
374
|
+
if (pendingTags != null) {
|
|
375
|
+
pendingTags.clear();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
super.manageChildren(tag, indicesToRemove, viewsToAdd, mock, mock);
|
|
380
|
+
if (toBeRemoved.containsKey(tag)) {
|
|
381
|
+
ArrayList<View> childrenToBeRemoved = toBeRemoved.get(tag);
|
|
382
|
+
for (View child : childrenToBeRemoved) {
|
|
383
|
+
viewGroupManager.addView(viewGroup, child, viewGroupManager.getChildCount(viewGroup));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
ViewAtIndex[] mock2 = new ViewAtIndex[] {};
|
|
387
|
+
super.manageChildren(tag, mock, mock2, tagsToDelete, mock);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
public void publicDropView(View view) {
|
|
391
|
+
dropView(view);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@Override
|
|
395
|
+
protected synchronized void dropView(View view) {
|
|
396
|
+
if (isLayoutAnimationDisabled()) {
|
|
397
|
+
super.dropView(view);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (toBeRemoved.containsKey(view.getId())) {
|
|
401
|
+
toBeRemoved.remove(view.getId());
|
|
402
|
+
}
|
|
403
|
+
if (cleanerCallback.containsKey(view.getId())) {
|
|
404
|
+
Runnable runnable = cleanerCallback.get(view.getId());
|
|
405
|
+
cleanerCallback.remove(view.getId());
|
|
406
|
+
runnable.run();
|
|
407
|
+
}
|
|
408
|
+
// childrens' callbacks should be cleaned by former publicDropView calls as Animation Manager
|
|
409
|
+
// stripes views from bottom to top
|
|
410
|
+
super.dropView(view);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.facebook.react.uimanager;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
6
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
7
|
+
import com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
public class ReanimatedUIImplementation extends UIImplementation {
|
|
11
|
+
public ReanimatedUIImplementation(
|
|
12
|
+
ReactApplicationContext reactContext,
|
|
13
|
+
UIManagerModule.ViewManagerResolver viewManagerResolver,
|
|
14
|
+
EventDispatcher eventDispatcher,
|
|
15
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
16
|
+
this(
|
|
17
|
+
reactContext,
|
|
18
|
+
new ViewManagerRegistry(viewManagerResolver),
|
|
19
|
+
eventDispatcher,
|
|
20
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public ReanimatedUIImplementation(
|
|
24
|
+
ReactApplicationContext reactContext,
|
|
25
|
+
List<ViewManager> viewManagerList,
|
|
26
|
+
EventDispatcher eventDispatcher,
|
|
27
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
28
|
+
this(
|
|
29
|
+
reactContext,
|
|
30
|
+
new ViewManagerRegistry(viewManagerList),
|
|
31
|
+
eventDispatcher,
|
|
32
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public ReanimatedUIImplementation(
|
|
36
|
+
ReactApplicationContext reactContext,
|
|
37
|
+
ViewManagerRegistry viewManagerRegistry,
|
|
38
|
+
EventDispatcher eventDispatcher,
|
|
39
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
40
|
+
super(
|
|
41
|
+
reactContext,
|
|
42
|
+
viewManagerRegistry,
|
|
43
|
+
new UIViewOperationQueue(
|
|
44
|
+
reactContext,
|
|
45
|
+
new ReanimatedNativeHierarchyManager(viewManagerRegistry, reactContext),
|
|
46
|
+
minTimeLeftInFrameForNonBatchedOperationMs),
|
|
47
|
+
eventDispatcher);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Invoked when there is a mutation in a node tree.
|
|
52
|
+
*
|
|
53
|
+
* @param tag react tag of the node we want to manage
|
|
54
|
+
* @param indicesToRemove ordered (asc) list of indicies at which view should be removed
|
|
55
|
+
* @param viewsToAdd ordered (asc based on mIndex property) list of tag-index pairs that represent
|
|
56
|
+
* a view which should be added at the specified index
|
|
57
|
+
* @param tagsToDelete list of tags corresponding to views that should be removed
|
|
58
|
+
*/
|
|
59
|
+
public void manageChildren(
|
|
60
|
+
int viewTag,
|
|
61
|
+
@Nullable ReadableArray moveFrom,
|
|
62
|
+
@Nullable ReadableArray moveTo,
|
|
63
|
+
@Nullable ReadableArray addChildTags,
|
|
64
|
+
@Nullable ReadableArray addAtIndices,
|
|
65
|
+
@Nullable ReadableArray removeFrom) {
|
|
66
|
+
super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.facebook.react.uimanager;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
6
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
7
|
+
import com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
public class ReanimatedUIImplementation extends UIImplementation {
|
|
11
|
+
public ReanimatedUIImplementation(
|
|
12
|
+
ReactApplicationContext reactContext,
|
|
13
|
+
UIManagerModule.ViewManagerResolver viewManagerResolver,
|
|
14
|
+
EventDispatcher eventDispatcher,
|
|
15
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
16
|
+
this(
|
|
17
|
+
reactContext,
|
|
18
|
+
new ViewManagerRegistry(viewManagerResolver),
|
|
19
|
+
eventDispatcher,
|
|
20
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public ReanimatedUIImplementation(
|
|
24
|
+
ReactApplicationContext reactContext,
|
|
25
|
+
List<ViewManager> viewManagerList,
|
|
26
|
+
EventDispatcher eventDispatcher,
|
|
27
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
28
|
+
this(
|
|
29
|
+
reactContext,
|
|
30
|
+
new ViewManagerRegistry(viewManagerList),
|
|
31
|
+
eventDispatcher,
|
|
32
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public ReanimatedUIImplementation(
|
|
36
|
+
ReactApplicationContext reactContext,
|
|
37
|
+
ViewManagerRegistry viewManagerRegistry,
|
|
38
|
+
EventDispatcher eventDispatcher,
|
|
39
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
40
|
+
super(
|
|
41
|
+
reactContext,
|
|
42
|
+
viewManagerRegistry,
|
|
43
|
+
new UIViewOperationQueue(
|
|
44
|
+
reactContext,
|
|
45
|
+
new ReanimatedNativeHierarchyManager(viewManagerRegistry, reactContext),
|
|
46
|
+
minTimeLeftInFrameForNonBatchedOperationMs),
|
|
47
|
+
eventDispatcher);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Invoked when there is a mutation in a node tree.
|
|
52
|
+
*
|
|
53
|
+
* @param tag react tag of the node we want to manage
|
|
54
|
+
* @param indicesToRemove ordered (asc) list of indicies at which view should be removed
|
|
55
|
+
* @param viewsToAdd ordered (asc based on mIndex property) list of tag-index pairs that represent
|
|
56
|
+
* a view which should be added at the specified index
|
|
57
|
+
* @param tagsToDelete list of tags corresponding to views that should be removed
|
|
58
|
+
*/
|
|
59
|
+
public void manageChildren(
|
|
60
|
+
int viewTag,
|
|
61
|
+
@Nullable ReadableArray moveFrom,
|
|
62
|
+
@Nullable ReadableArray moveTo,
|
|
63
|
+
@Nullable ReadableArray addChildTags,
|
|
64
|
+
@Nullable ReadableArray addAtIndices,
|
|
65
|
+
@Nullable ReadableArray removeFrom) {
|
|
66
|
+
super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.facebook.react.uimanager;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
6
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
7
|
+
import com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
public class ReanimatedUIImplementation extends UIImplementation {
|
|
11
|
+
public ReanimatedUIImplementation(
|
|
12
|
+
ReactApplicationContext reactContext,
|
|
13
|
+
UIManagerModule.ViewManagerResolver viewManagerResolver,
|
|
14
|
+
EventDispatcher eventDispatcher,
|
|
15
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
16
|
+
this(
|
|
17
|
+
reactContext,
|
|
18
|
+
new ViewManagerRegistry(viewManagerResolver),
|
|
19
|
+
eventDispatcher,
|
|
20
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public ReanimatedUIImplementation(
|
|
24
|
+
ReactApplicationContext reactContext,
|
|
25
|
+
List<ViewManager> viewManagerList,
|
|
26
|
+
EventDispatcher eventDispatcher,
|
|
27
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
28
|
+
this(
|
|
29
|
+
reactContext,
|
|
30
|
+
new ViewManagerRegistry(viewManagerList),
|
|
31
|
+
eventDispatcher,
|
|
32
|
+
minTimeLeftInFrameForNonBatchedOperationMs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public ReanimatedUIImplementation(
|
|
36
|
+
ReactApplicationContext reactContext,
|
|
37
|
+
ViewManagerRegistry viewManagerRegistry,
|
|
38
|
+
EventDispatcher eventDispatcher,
|
|
39
|
+
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
|
40
|
+
super(
|
|
41
|
+
reactContext,
|
|
42
|
+
viewManagerRegistry,
|
|
43
|
+
new UIViewOperationQueue(
|
|
44
|
+
reactContext,
|
|
45
|
+
new ReanimatedNativeHierarchyManager(viewManagerRegistry, reactContext),
|
|
46
|
+
minTimeLeftInFrameForNonBatchedOperationMs),
|
|
47
|
+
eventDispatcher);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Invoked when there is a mutation in a node tree.
|
|
52
|
+
*
|
|
53
|
+
* @param tag react tag of the node we want to manage
|
|
54
|
+
* @param indicesToRemove ordered (asc) list of indicies at which view should be removed
|
|
55
|
+
* @param viewsToAdd ordered (asc based on mIndex property) list of tag-index pairs that represent
|
|
56
|
+
* a view which should be added at the specified index
|
|
57
|
+
* @param tagsToDelete list of tags corresponding to views that should be removed
|
|
58
|
+
*/
|
|
59
|
+
public void manageChildren(
|
|
60
|
+
int viewTag,
|
|
61
|
+
@Nullable ReadableArray moveFrom,
|
|
62
|
+
@Nullable ReadableArray moveTo,
|
|
63
|
+
@Nullable ReadableArray addChildTags,
|
|
64
|
+
@Nullable ReadableArray addAtIndices,
|
|
65
|
+
@Nullable ReadableArray removeFrom) {
|
|
66
|
+
super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include 'lib'
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#include "AndroidErrorHandler.h"
|
|
2
|
+
#include <fbjni/fbjni.h>
|
|
3
|
+
#include <string>
|
|
4
|
+
#include "Logger.h"
|
|
5
|
+
|
|
6
|
+
namespace reanimated {
|
|
7
|
+
|
|
8
|
+
using namespace facebook::jni;
|
|
9
|
+
|
|
10
|
+
AndroidErrorHandler::AndroidErrorHandler(std::shared_ptr<Scheduler> scheduler) {
|
|
11
|
+
this->scheduler = scheduler;
|
|
12
|
+
this->error = std::make_shared<ErrorWrapper>();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void AndroidErrorHandler::raiseSpec() {
|
|
16
|
+
if (error->handled) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static const auto cls = javaClassStatic();
|
|
21
|
+
static auto method = cls->getStaticMethod<void(std::string)>("raise");
|
|
22
|
+
method(cls, error->message);
|
|
23
|
+
|
|
24
|
+
this->error->handled = true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
std::shared_ptr<Scheduler> AndroidErrorHandler::getScheduler() {
|
|
28
|
+
return this->scheduler;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
std::shared_ptr<ErrorWrapper> AndroidErrorHandler::getError() {
|
|
32
|
+
return this->error;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void AndroidErrorHandler::setError(std::string message) {
|
|
36
|
+
if (error->handled) {
|
|
37
|
+
error->message = message;
|
|
38
|
+
error->handled = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} // namespace reanimated
|