react-native-reanimated 3.16.4 → 3.16.6

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 (46) hide show
  1. package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +21 -13
  2. package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -0
  3. package/lib/module/createAnimatedComponent/JSPropsUpdater.js +4 -5
  4. package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
  5. package/lib/module/createAnimatedComponent/NativeEventsManager.js +35 -8
  6. package/lib/module/createAnimatedComponent/NativeEventsManager.js.map +1 -1
  7. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +51 -46
  8. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  9. package/lib/module/fabricUtils.js +4 -11
  10. package/lib/module/fabricUtils.js.map +1 -1
  11. package/lib/module/platform-specific/findHostInstance.js +44 -0
  12. package/lib/module/platform-specific/findHostInstance.js.map +1 -0
  13. package/lib/module/platform-specific/findHostInstance.web.js +4 -0
  14. package/lib/module/platform-specific/findHostInstance.web.js.map +1 -0
  15. package/lib/module/platform-specific/jsVersion.js +1 -1
  16. package/lib/typescript/createAnimatedComponent/JSPropsUpdater.d.ts.map +1 -1
  17. package/lib/typescript/createAnimatedComponent/NativeEventsManager.d.ts.map +1 -1
  18. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +6 -6
  19. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts.map +1 -1
  20. package/lib/typescript/createAnimatedComponent/createAnimatedComponent.d.ts.map +1 -1
  21. package/lib/typescript/fabricUtils.d.ts +2 -1
  22. package/lib/typescript/fabricUtils.d.ts.map +1 -1
  23. package/lib/typescript/platform-specific/findHostInstance.d.ts +15 -0
  24. package/lib/typescript/platform-specific/findHostInstance.d.ts.map +1 -0
  25. package/lib/typescript/platform-specific/findHostInstance.web.d.ts +2 -0
  26. package/lib/typescript/platform-specific/findHostInstance.web.d.ts.map +1 -0
  27. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/src/createAnimatedComponent/JSPropsUpdater.ts +4 -5
  30. package/src/createAnimatedComponent/NativeEventsManager.ts +44 -13
  31. package/src/createAnimatedComponent/commonTypes.ts +6 -6
  32. package/src/createAnimatedComponent/createAnimatedComponent.tsx +55 -56
  33. package/src/fabricUtils.ts +9 -15
  34. package/src/platform-specific/findHostInstance.ts +77 -0
  35. package/src/platform-specific/findHostInstance.web.ts +3 -0
  36. package/src/platform-specific/jsVersion.ts +1 -1
  37. package/lib/module/platform-specific/RNRenderer.js +0 -6
  38. package/lib/module/platform-specific/RNRenderer.js.map +0 -1
  39. package/lib/module/platform-specific/RNRenderer.web.js +0 -6
  40. package/lib/module/platform-specific/RNRenderer.web.js.map +0 -1
  41. package/lib/typescript/platform-specific/RNRenderer.d.ts +0 -2
  42. package/lib/typescript/platform-specific/RNRenderer.d.ts.map +0 -1
  43. package/lib/typescript/platform-specific/RNRenderer.web.d.ts +0 -3
  44. package/lib/typescript/platform-specific/RNRenderer.web.d.ts.map +0 -1
  45. package/src/platform-specific/RNRenderer.ts +0 -4
  46. package/src/platform-specific/RNRenderer.web.ts +0 -4
@@ -0,0 +1,77 @@
1
+ /* eslint-disable camelcase */
2
+ 'use strict';
3
+
4
+ import type { IAnimatedComponentInternal } from '../createAnimatedComponent/commonTypes';
5
+ import { ReanimatedError } from '../errors';
6
+ import { isFabric } from '../PlatformChecker';
7
+
8
+ type HostInstanceFabric = {
9
+ __internalInstanceHandle?: Record<string, unknown>;
10
+ __nativeTag?: number;
11
+ _viewConfig?: Record<string, unknown>;
12
+ };
13
+
14
+ type HostInstancePaper = {
15
+ _nativeTag?: number;
16
+ viewConfig?: Record<string, unknown>;
17
+ };
18
+
19
+ export type HostInstance = HostInstanceFabric & HostInstancePaper;
20
+
21
+ function findHostInstanceFastPath(maybeNativeRef: HostInstance) {
22
+ if (
23
+ maybeNativeRef.__internalInstanceHandle &&
24
+ maybeNativeRef.__nativeTag &&
25
+ maybeNativeRef._viewConfig
26
+ ) {
27
+ // This is a native ref to a Fabric component
28
+ return maybeNativeRef;
29
+ }
30
+ if (maybeNativeRef._nativeTag && maybeNativeRef.viewConfig) {
31
+ // This is a native ref to a Paper component
32
+ return maybeNativeRef;
33
+ }
34
+ // That means it’s a ref to a non-native component, and it’s necessary
35
+ // to call `findHostInstance_DEPRECATED` on them.
36
+ return undefined;
37
+ }
38
+
39
+ function resolveFindHostInstance_DEPRECATED() {
40
+ if (findHostInstance_DEPRECATED !== undefined) {
41
+ return;
42
+ }
43
+ if (isFabric()) {
44
+ try {
45
+ findHostInstance_DEPRECATED =
46
+ require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
47
+ } catch (e) {
48
+ throw new ReanimatedError(
49
+ 'Failed to resolve findHostInstance_DEPRECATED'
50
+ );
51
+ }
52
+ } else {
53
+ findHostInstance_DEPRECATED =
54
+ require('react-native/Libraries/Renderer/shims/ReactNative').findHostInstance_DEPRECATED;
55
+ }
56
+ }
57
+
58
+ let findHostInstance_DEPRECATED: (ref: unknown) => HostInstance;
59
+ export function findHostInstance(
60
+ component: IAnimatedComponentInternal | React.Component
61
+ ): HostInstance {
62
+ // Fast path for native refs
63
+ const hostInstance = findHostInstanceFastPath(
64
+ (component as IAnimatedComponentInternal)._componentRef as HostInstance
65
+ );
66
+ if (hostInstance !== undefined) {
67
+ return hostInstance;
68
+ }
69
+
70
+ resolveFindHostInstance_DEPRECATED();
71
+ // Fabric implementation of findHostInstance_DEPRECATED doesn't accept a ref as an argument
72
+ return findHostInstance_DEPRECATED(
73
+ isFabric()
74
+ ? component
75
+ : (component as IAnimatedComponentInternal)._componentRef
76
+ );
77
+ }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ export function findHostInstance(_component: any): void {}
@@ -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 = '3.16.4';
7
+ export const jsVersion = '3.16.6';
@@ -1,6 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
- 'use strict';
4
-
5
- export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
6
- //# sourceMappingURL=RNRenderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["default","RNRenderer"],"sourceRoot":"../../../src","sources":["platform-specific/RNRenderer.ts"],"mappings":"AAAA;AACA;AACA,YAAY;;AACZ,SAASA,OAAO,IAAIC,UAAU,QAAQ,mDAAmD","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- // RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.
4
- const RNRenderer = {};
5
- export { RNRenderer };
6
- //# sourceMappingURL=RNRenderer.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["RNRenderer"],"sourceRoot":"../../../src","sources":["platform-specific/RNRenderer.web.ts"],"mappings":"AAAA,YAAY;;AACZ;AACA,MAAMA,UAAU,GAAG,CAAC,CAAC;AACrB,SAASA,UAAU","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
2
- //# sourceMappingURL=RNRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RNRenderer.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/RNRenderer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mDAAmD,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const RNRenderer: {};
2
- export { RNRenderer };
3
- //# sourceMappingURL=RNRenderer.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RNRenderer.web.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/RNRenderer.web.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,IAAK,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
- 'use strict';
4
- export { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';
@@ -1,4 +0,0 @@
1
- 'use strict';
2
- // RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.
3
- const RNRenderer = {};
4
- export { RNRenderer };