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.
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +21 -13
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -0
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +4 -5
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/NativeEventsManager.js +35 -8
- package/lib/module/createAnimatedComponent/NativeEventsManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +51 -46
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/fabricUtils.js +4 -11
- package/lib/module/fabricUtils.js.map +1 -1
- package/lib/module/platform-specific/findHostInstance.js +44 -0
- package/lib/module/platform-specific/findHostInstance.js.map +1 -0
- package/lib/module/platform-specific/findHostInstance.web.js +4 -0
- package/lib/module/platform-specific/findHostInstance.web.js.map +1 -0
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/NativeEventsManager.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +6 -6
- package/lib/typescript/createAnimatedComponent/commonTypes.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/createAnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/fabricUtils.d.ts +2 -1
- package/lib/typescript/fabricUtils.d.ts.map +1 -1
- package/lib/typescript/platform-specific/findHostInstance.d.ts +15 -0
- package/lib/typescript/platform-specific/findHostInstance.d.ts.map +1 -0
- package/lib/typescript/platform-specific/findHostInstance.web.d.ts +2 -0
- package/lib/typescript/platform-specific/findHostInstance.web.d.ts.map +1 -0
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +1 -1
- package/src/createAnimatedComponent/JSPropsUpdater.ts +4 -5
- package/src/createAnimatedComponent/NativeEventsManager.ts +44 -13
- package/src/createAnimatedComponent/commonTypes.ts +6 -6
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +55 -56
- package/src/fabricUtils.ts +9 -15
- package/src/platform-specific/findHostInstance.ts +77 -0
- package/src/platform-specific/findHostInstance.web.ts +3 -0
- package/src/platform-specific/jsVersion.ts +1 -1
- package/lib/module/platform-specific/RNRenderer.js +0 -6
- package/lib/module/platform-specific/RNRenderer.js.map +0 -1
- package/lib/module/platform-specific/RNRenderer.web.js +0 -6
- package/lib/module/platform-specific/RNRenderer.web.js.map +0 -1
- package/lib/typescript/platform-specific/RNRenderer.d.ts +0 -2
- package/lib/typescript/platform-specific/RNRenderer.d.ts.map +0 -1
- package/lib/typescript/platform-specific/RNRenderer.web.d.ts +0 -3
- package/lib/typescript/platform-specific/RNRenderer.web.d.ts.map +0 -1
- package/src/platform-specific/RNRenderer.ts +0 -4
- 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
|
+
}
|
|
@@ -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 +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 +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 +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"}
|