react-native-reanimated 4.4.1 → 4.4.3
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/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +12 -5
- package/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
- package/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
- package/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +5 -0
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +25 -12
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +3 -0
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +54 -24
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +13 -6
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +6 -2
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +44 -1
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +125 -43
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +228 -102
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +4 -0
- package/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +8 -3
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +7 -21
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +0 -16
- package/android/CMakeLists.txt +6 -0
- package/android/build.gradle.kts +21 -1
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.kt +46 -2
- package/android/src/main/java/com/swmansion/reanimated/keyboard/KeyboardAnimationCallback.kt +8 -1
- package/apple/reanimated/apple/ReanimatedModule.mm +12 -1
- package/compatibility.json +1 -1
- package/lib/module/PropsRegistryGarbageCollector.js +3 -6
- package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
- package/lib/module/animation/styleAnimation.js +4 -3
- package/lib/module/animation/styleAnimation.js.map +1 -1
- package/lib/module/common/constants/platform.js +4 -4
- package/lib/module/common/constants/platform.js.map +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js +3 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -1
- package/lib/module/css/component/AnimatedComponent.js +0 -2
- package/lib/module/css/component/AnimatedComponent.js.map +1 -1
- package/lib/module/css/native/managers/CSSManager.js +5 -5
- package/lib/module/css/native/managers/CSSManager.js.map +1 -1
- package/lib/module/css/native/managers/CSSTransitionsManager.js +8 -1
- package/lib/module/css/native/managers/CSSTransitionsManager.js.map +1 -1
- package/lib/module/css/svg/native/processors/stroke.js +9 -5
- package/lib/module/css/svg/native/processors/stroke.js.map +1 -1
- package/lib/module/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +6 -3
- package/lib/module/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/layoutReanimation/animationsManager.js +39 -11
- package/lib/module/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/mappers.js +1 -1
- package/lib/module/mappers.js.map +1 -1
- package/lib/module/platform-specific/findHostInstance.js +8 -5
- package/lib/module/platform-specific/findHostInstance.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/module/updateProps/updateProps.js +3 -2
- package/lib/module/updateProps/updateProps.js.map +1 -1
- package/lib/module/valueSetter.js +6 -7
- package/lib/module/valueSetter.js.map +1 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts +0 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
- package/lib/typescript/animation/styleAnimation.d.ts +1 -1
- package/lib/typescript/animation/styleAnimation.d.ts.map +1 -1
- package/lib/typescript/common/constants/platform.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +0 -1
- package/lib/typescript/createAnimatedComponent/commonTypes.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts.map +1 -1
- package/lib/typescript/css/component/AnimatedComponent.d.ts +0 -1
- package/lib/typescript/css/component/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts +5 -1
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts.map +1 -1
- package/lib/typescript/css/svg/native/processors/stroke.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +17 -14
- package/lib/typescript/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/animationsManager.d.ts.map +1 -1
- package/lib/typescript/platform-specific/findHostInstance.d.ts.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/platform-specific/types.d.ts +1 -0
- package/lib/typescript/platform-specific/types.d.ts.map +1 -1
- package/lib/typescript/updateProps/updateProps.d.ts.map +1 -1
- package/package.json +3 -3
- package/scripts/reanimated_utils.rb +7 -0
- package/src/PropsRegistryGarbageCollector.ts +3 -6
- package/src/animation/styleAnimation.ts +5 -3
- package/src/common/constants/platform.ts +4 -4
- package/src/createAnimatedComponent/AnimatedComponent.tsx +3 -1
- package/src/createAnimatedComponent/commonTypes.ts +0 -1
- package/src/createAnimatedComponent/getViewInfo.ts +3 -1
- package/src/css/component/AnimatedComponent.tsx +0 -2
- package/src/css/native/managers/CSSManager.ts +8 -8
- package/src/css/native/managers/CSSTransitionsManager.ts +9 -2
- package/src/css/svg/native/processors/stroke.ts +9 -6
- package/src/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +39 -36
- package/src/layoutReanimation/animationsManager.ts +41 -11
- package/src/mappers.ts +1 -1
- package/src/platform-specific/findHostInstance.ts +7 -7
- package/src/platform-specific/jsVersion.ts +1 -1
- package/src/platform-specific/types.ts +2 -0
- package/src/updateProps/updateProps.ts +3 -2
- package/src/valueSetter.ts +7 -7
|
@@ -12,7 +12,9 @@ function findHostInstanceFastPath(maybeNativeRef: HostInstance | undefined) {
|
|
|
12
12
|
if (
|
|
13
13
|
maybeNativeRef.__internalInstanceHandle &&
|
|
14
14
|
maybeNativeRef.__nativeTag &&
|
|
15
|
-
|
|
15
|
+
// ReactFabricHostComponent (e.g. react-native-macos) exposes `_viewConfig`;
|
|
16
|
+
// ReactNativeElement uses `__viewConfig`.
|
|
17
|
+
(maybeNativeRef.__viewConfig || maybeNativeRef._viewConfig)
|
|
16
18
|
) {
|
|
17
19
|
return maybeNativeRef;
|
|
18
20
|
}
|
|
@@ -55,13 +57,11 @@ export function findHostInstance(
|
|
|
55
57
|
resolveFindHostInstance_DEPRECATED();
|
|
56
58
|
/*
|
|
57
59
|
The Fabric implementation of `findHostInstance_DEPRECATED` requires a React ref as an argument
|
|
58
|
-
rather than a native ref.
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
rather than a native ref. Prefer the resolved component ref when available so components can
|
|
61
|
+
forward their ref to the host view that should be animated. Components that expose an animatable
|
|
62
|
+
ref via `getAnimatableRef` already have it resolved into `_componentRef`.
|
|
61
63
|
*/
|
|
62
64
|
return findHostInstance_DEPRECATED(
|
|
63
|
-
(ref as IAnimatedComponentInternalBase).
|
|
64
|
-
? (ref as IAnimatedComponentInternalBase)._componentRef
|
|
65
|
-
: ref
|
|
65
|
+
(ref as IAnimatedComponentInternalBase)._componentRef ?? ref
|
|
66
66
|
);
|
|
67
67
|
}
|
|
@@ -112,7 +112,7 @@ type NativePropsOperation = {
|
|
|
112
112
|
function createUpdatePropsManager() {
|
|
113
113
|
'worklet';
|
|
114
114
|
const nativeOperations: NativePropsOperation[] = [];
|
|
115
|
-
|
|
115
|
+
let jsOperations: JSPropsOperation[] = [];
|
|
116
116
|
|
|
117
117
|
let flushPending = false;
|
|
118
118
|
|
|
@@ -165,8 +165,9 @@ function createUpdatePropsManager() {
|
|
|
165
165
|
nativeOperations.length = 0;
|
|
166
166
|
}
|
|
167
167
|
if (jsOperations.length) {
|
|
168
|
+
// Fresh array each flush: scheduleOnRN caches serialized args by identity.
|
|
168
169
|
scheduleOnRN(updateJSProps, jsOperations);
|
|
169
|
-
jsOperations
|
|
170
|
+
jsOperations = [];
|
|
170
171
|
}
|
|
171
172
|
flushPending = false;
|
|
172
173
|
if (!USE_ANIMATION_BACKEND) {
|
package/src/valueSetter.ts
CHANGED
|
@@ -9,15 +9,19 @@ export function valueSetter<Value>(
|
|
|
9
9
|
'worklet';
|
|
10
10
|
const previousAnimation = mutable._animation;
|
|
11
11
|
if (previousAnimation) {
|
|
12
|
-
previousAnimation.cancelled = true;
|
|
13
12
|
mutable._animation = null;
|
|
13
|
+
if (!previousAnimation.finished) {
|
|
14
|
+
previousAnimation.cancelled = true;
|
|
15
|
+
previousAnimation.callback?.(false);
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
if (
|
|
16
19
|
typeof value === 'function' ||
|
|
17
20
|
(value !== null &&
|
|
18
21
|
typeof value === 'object' &&
|
|
19
22
|
// TODO TYPESCRIPT fix this after fixing AnimationObject type
|
|
20
|
-
(value as unknown as AnimationObject).onFrame !== undefined
|
|
23
|
+
(value as unknown as AnimationObject).onFrame !== undefined &&
|
|
24
|
+
(value as unknown as AnimationObject).onStart !== undefined)
|
|
21
25
|
) {
|
|
22
26
|
const animation: AnimationObject<Value> =
|
|
23
27
|
typeof value === 'function'
|
|
@@ -47,17 +51,13 @@ export function valueSetter<Value>(
|
|
|
47
51
|
|
|
48
52
|
const step = (timestamp: number) => {
|
|
49
53
|
if (animation.cancelled) {
|
|
50
|
-
animation.callback?.(false /* finished */);
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
56
|
const finished = animation.onFrame(animation, timestamp);
|
|
54
|
-
animation.finished = true;
|
|
55
57
|
animation.timestamp = timestamp;
|
|
56
|
-
// TODO TYPESCRIPT
|
|
57
|
-
// For now I'll assume that `animation.current` is always defined
|
|
58
|
-
// but actually need to dive into animations to understand it
|
|
59
58
|
mutable._value = animation.current!;
|
|
60
59
|
if (finished) {
|
|
60
|
+
animation.finished = true;
|
|
61
61
|
animation.callback?.(true /* finished */);
|
|
62
62
|
} else {
|
|
63
63
|
requestAnimationFrame(step);
|