react-native-reanimated 4.7.1 → 4.7.2

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.
Files changed (63) hide show
  1. package/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -9
  2. package/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +2 -6
  3. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +135 -33
  4. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +37 -3
  5. package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +28 -0
  6. package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +8 -0
  7. package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +4 -1
  8. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +228 -87
  9. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +22 -5
  10. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +9 -12
  11. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +6 -5
  12. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +5 -2
  13. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +22 -1
  14. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +39 -9
  15. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +1 -1
  16. package/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +13 -0
  17. package/Common/cpp/reanimated/Tools/TextMetrics.h +22 -0
  18. package/android/src/main/cpp/reanimated/android/NativeProxy.cpp +19 -0
  19. package/android/src/main/cpp/reanimated/android/NativeProxy.h +1 -0
  20. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.kt +24 -0
  21. package/apple/reanimated/apple/REAReducedMotion.h +1 -3
  22. package/apple/reanimated/apple/native/PlatformDepMethodsHolderImpl.mm +28 -0
  23. package/jest/resolver.js +4 -1
  24. package/lib/module/PropsRegistryGarbageCollector.js +43 -25
  25. package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
  26. package/lib/module/ReanimatedModule/NativeReanimated.js +2 -2
  27. package/lib/module/ReanimatedModule/NativeReanimated.js.map +1 -1
  28. package/lib/module/commonTypes.js.map +1 -1
  29. package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -1
  30. package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
  31. package/lib/module/createAnimatedComponent/AnimatedComponent.native.js +10 -34
  32. package/lib/module/createAnimatedComponent/AnimatedComponent.native.js.map +1 -1
  33. package/lib/module/platform-specific/jsVersion.js +1 -1
  34. package/lib/module/platformFunctions/setNativeProps.native.js +2 -1
  35. package/lib/module/platformFunctions/setNativeProps.native.js.map +1 -1
  36. package/lib/module/updateProps/updateProps.native.js +5 -4
  37. package/lib/module/updateProps/updateProps.native.js.map +1 -1
  38. package/lib/typescript/PropsRegistryGarbageCollector.d.ts +2 -2
  39. package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
  40. package/lib/typescript/ReanimatedModule/reanimatedModuleProxy.d.ts +1 -1
  41. package/lib/typescript/ReanimatedModule/reanimatedModuleProxy.d.ts.map +1 -1
  42. package/lib/typescript/commonTypes.d.ts +3 -1
  43. package/lib/typescript/commonTypes.d.ts.map +1 -1
  44. package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts +1 -1
  45. package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
  46. package/lib/typescript/createAnimatedComponent/AnimatedComponent.native.d.ts +1 -1
  47. package/lib/typescript/createAnimatedComponent/AnimatedComponent.native.d.ts.map +1 -1
  48. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +1 -1
  49. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts.map +1 -1
  50. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  51. package/lib/typescript/updateProps/updateProps.native.d.ts.map +1 -1
  52. package/package.json +7 -7
  53. package/src/PropsRegistryGarbageCollector.ts +46 -25
  54. package/src/ReanimatedModule/NativeReanimated.ts +2 -2
  55. package/src/ReanimatedModule/reanimatedModuleProxy.ts +1 -1
  56. package/src/commonTypes.ts +3 -1
  57. package/src/createAnimatedComponent/AnimatedComponent.native.tsx +5 -30
  58. package/src/createAnimatedComponent/AnimatedComponent.tsx +1 -1
  59. package/src/createAnimatedComponent/commonTypes.ts +1 -1
  60. package/src/platform-specific/jsVersion.ts +1 -1
  61. package/src/platformFunctions/setNativeProps.native.ts +3 -1
  62. package/src/privateGlobals.d.ts +1 -0
  63. package/src/updateProps/updateProps.native.ts +10 -3
@@ -143,39 +143,14 @@ export default class AnimatedComponent
143
143
  }
144
144
  }
145
145
 
146
- _syncStylePropsBackToReact(settledUpdates: StyleProps) {
146
+ _syncStylePropsBackToReact(props: StyleProps, style: StyleProps) {
147
147
  if (!FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS) {
148
148
  return;
149
149
  }
150
- // Settled updates arrive as one bag with no style-vs-props origin, so
151
- // partition them by the keys of attached animated props — only values
152
- // from `useAnimatedProps` or shared values passed as inline top-level
153
- // props may be passed as top-level props, all the other ones are
154
- // style-only.
155
- const animatedPropsKeys = new Set([
156
- ...this._animatedProps.flatMap((animatedProp) =>
157
- Object.keys(animatedProp.initial?.value ?? {})
158
- ),
159
- ...Object.keys(this._InlinePropManager._inlineTopLevelProps),
160
- ]);
161
- if (animatedPropsKeys.size === 0) {
162
- this.setState((state) => ({
163
- settledStyle: { ...state.settledStyle, ...settledUpdates },
164
- }));
165
- return;
166
- }
167
- this.setState((state) => {
168
- const settledProps = { ...state.settledProps };
169
- const settledStyle = { ...state.settledStyle };
170
- for (const key in settledUpdates) {
171
- if (animatedPropsKeys.has(key)) {
172
- settledProps[key] = settledUpdates[key];
173
- } else {
174
- settledStyle[key] = settledUpdates[key];
175
- }
176
- }
177
- return { settledProps, settledStyle };
178
- });
150
+ this.setState((state) => ({
151
+ settledProps: { ...state.settledProps, ...props },
152
+ settledStyle: { ...state.settledStyle, ...style },
153
+ }));
179
154
  // TODO(future): revert changes when animated styles are detached
180
155
  }
181
156
 
@@ -179,7 +179,7 @@ export default class AnimatedComponent
179
179
  }
180
180
  }
181
181
 
182
- _syncStylePropsBackToReact(_props: StyleProps) {
182
+ _syncStylePropsBackToReact(_props: StyleProps, _style: StyleProps) {
183
183
  // noop
184
184
  }
185
185
 
@@ -152,7 +152,7 @@ export interface IAnimatedComponentInternal extends IAnimatedComponentInternalBa
152
152
  _NativeEventsManager?: INativeEventsManager;
153
153
  context: React.ContextType<typeof SkipEnteringContext>;
154
154
  setNativeProps: (props: StyleProps) => void;
155
- _syncStylePropsBackToReact: (props: StyleProps) => void;
155
+ _syncStylePropsBackToReact: (props: StyleProps, style: StyleProps) => void;
156
156
  }
157
157
 
158
158
  export type NestedArray<T> = T | NestedArray<T>[];
@@ -4,4 +4,4 @@
4
4
  * version used to build the native part of the library in runtime. Remember to
5
5
  * keep this in sync with the version declared in `package.json`
6
6
  */
7
- export const jsVersion = '4.7.1';
7
+ export const jsVersion = '4.7.2';
@@ -45,7 +45,9 @@ function setNativePropsNative(
45
45
  const shadowNodeWrapper = (animatedRef as AnimatedRefOnUI)
46
46
  .value as ShadowNodeWrapper;
47
47
  processColorsInProps(updates);
48
- global._updateProps!([{ shadowNodeWrapper, updates }]);
48
+ global._updateProps!([
49
+ { shadowNodeWrapper, updates, isAnimatedProps: false },
50
+ ]);
49
51
  }
50
52
 
51
53
  function setNativePropsJest() {
@@ -42,6 +42,7 @@ declare global {
42
42
  shadowNodeWrapper: ShadowNodeWrapper;
43
43
 
44
44
  updates: PropUpdates;
45
+ isAnimatedProps: boolean;
45
46
  }[]
46
47
  ) => void)
47
48
  | undefined;
@@ -27,7 +27,7 @@ const updateProps: (
27
27
  viewDescriptors: ViewDescriptorsWrapper,
28
28
  updates: PropUpdates,
29
29
  isAnimatedProps?: boolean
30
- ) => void = (viewDescriptors, updates, isAnimatedProps) => {
30
+ ) => void = (viewDescriptors, updates, isAnimatedProps = false) => {
31
31
  'worklet';
32
32
 
33
33
  // TODO: Remove this if once we have SVG props builder implemented
@@ -53,7 +53,8 @@ const updateProps: (
53
53
  // Use props builder only for style updaters, since animated props
54
54
  // can contain any properties of different types, depending on the
55
55
  // component, which we cannot process properly with the props builder.
56
- isAnimatedProps ? updates : stylePropsBuilder.build(updates)
56
+ isAnimatedProps ? updates : stylePropsBuilder.build(updates),
57
+ isAnimatedProps
57
58
  );
58
59
  };
59
60
 
@@ -66,6 +67,7 @@ function updateJSProps(operations: JSPropsOperation[]) {
66
67
  type NativePropsOperation = {
67
68
  shadowNodeWrapper: ShadowNodeWrapper;
68
69
  updates: StyleProps;
70
+ isAnimatedProps: boolean;
69
71
  };
70
72
 
71
73
  function createUpdatePropsManager() {
@@ -91,7 +93,11 @@ function createUpdatePropsManager() {
91
93
  }, {});
92
94
 
93
95
  return {
94
- update(viewDescriptors: ViewDescriptorsWrapper, updates: PropUpdates) {
96
+ update(
97
+ viewDescriptors: ViewDescriptorsWrapper,
98
+ updates: PropUpdates,
99
+ isAnimatedProps: boolean
100
+ ) {
95
101
  viewDescriptors.value.forEach(({ tag, shadowNodeWrapper }) => {
96
102
  const viewTag = tag as number;
97
103
  const { nativePropUpdates, jsPropUpdates } = processViewUpdates(
@@ -103,6 +109,7 @@ function createUpdatePropsManager() {
103
109
  nativeOperations.push({
104
110
  shadowNodeWrapper,
105
111
  updates: nativePropUpdates,
112
+ isAnimatedProps,
106
113
  });
107
114
  }
108
115
  if (jsPropUpdates) {