react-native-reanimated 3.0.0-rc.8 → 3.0.0-rc.9
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/NativeModules/NativeReanimatedModule.cpp +17 -12
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +2 -2
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +2 -2
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +30 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +1 -1
- package/Common/cpp/SharedItems/Shareables.cpp +3 -1
- package/Common/cpp/SharedItems/Shareables.h +37 -22
- package/Common/cpp/Tools/RuntimeDecorator.cpp +26 -25
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
- package/ios/LayoutReanimation/REAAnimationsManager.h +3 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +49 -16
- package/ios/LayoutReanimation/REAUIManager.mm +22 -62
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +2 -2
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +6 -74
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +66 -0
- package/lib/commonjs/reanimated2/errors.js.map +1 -0
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +0 -10
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +157 -0
- package/lib/commonjs/reanimated2/initializers.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +1 -6
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -7
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +0 -4
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +26 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/shareables.js +6 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +2 -2
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +18 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/core.js +3 -74
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +58 -0
- package/lib/module/reanimated2/errors.js.map +1 -0
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +2 -12
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +143 -0
- package/lib/module/reanimated2/initializers.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +1 -6
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +4 -7
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +0 -2
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/mock.js +26 -0
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +6 -1
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/package.json +3 -2
- package/plugin.js +81 -15
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +11 -2
- package/src/reanimated2/component/FlatList.tsx +30 -5
- package/src/reanimated2/core.ts +3 -66
- package/src/reanimated2/errors.ts +57 -0
- package/src/reanimated2/globals.d.ts +22 -3
- package/src/reanimated2/hook/useAnimatedStyle.ts +1 -11
- package/src/reanimated2/initializers.ts +143 -0
- package/src/reanimated2/js-reanimated/JSReanimated.ts +8 -4
- package/src/reanimated2/js-reanimated/global.ts +4 -7
- package/src/reanimated2/layoutReanimation/animationsManager.ts +0 -3
- package/src/reanimated2/mock.ts +105 -0
- package/src/reanimated2/shareables.ts +7 -0
|
@@ -23,11 +23,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
23
23
|
|
|
24
24
|
const AnimatedFlatList = (0, _createAnimatedComponent.default)(_reactNative.FlatList);
|
|
25
25
|
|
|
26
|
-
const createCellRenderer = itemLayoutAnimation => {
|
|
26
|
+
const createCellRenderer = (itemLayoutAnimation, cellStyle) => {
|
|
27
27
|
const cellRenderer = props => {
|
|
28
28
|
return /*#__PURE__*/_react.default.createElement(_View.default, {
|
|
29
29
|
layout: itemLayoutAnimation,
|
|
30
|
-
onLayout: props.onLayout
|
|
30
|
+
onLayout: props.onLayout,
|
|
31
|
+
style: cellStyle
|
|
31
32
|
}, props.children);
|
|
32
33
|
};
|
|
33
34
|
|
|
@@ -39,8 +40,9 @@ const ReanimatedFlatlist = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
39
40
|
itemLayoutAnimation,
|
|
40
41
|
...restProps
|
|
41
42
|
} = props;
|
|
43
|
+
const cellStyle = restProps !== null && restProps !== void 0 && restProps.inverted ? restProps !== null && restProps !== void 0 && restProps.horizontal ? styles.horizontallyInverted : styles.verticallyInverted : undefined;
|
|
42
44
|
|
|
43
|
-
const cellRenderer = _react.default.useMemo(() => createCellRenderer(itemLayoutAnimation), []);
|
|
45
|
+
const cellRenderer = _react.default.useMemo(() => createCellRenderer(itemLayoutAnimation, cellStyle), [cellStyle]);
|
|
44
46
|
|
|
45
47
|
return /*#__PURE__*/_react.default.createElement(AnimatedFlatList, _extends({
|
|
46
48
|
ref: ref
|
|
@@ -48,6 +50,20 @@ const ReanimatedFlatlist = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
48
50
|
CellRendererComponent: cellRenderer
|
|
49
51
|
}));
|
|
50
52
|
});
|
|
53
|
+
|
|
54
|
+
const styles = _reactNative.StyleSheet.create({
|
|
55
|
+
verticallyInverted: {
|
|
56
|
+
transform: [{
|
|
57
|
+
scaleY: -1
|
|
58
|
+
}]
|
|
59
|
+
},
|
|
60
|
+
horizontallyInverted: {
|
|
61
|
+
transform: [{
|
|
62
|
+
scaleX: -1
|
|
63
|
+
}]
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
51
67
|
var _default = ReanimatedFlatlist;
|
|
52
68
|
exports.default = _default;
|
|
53
69
|
//# sourceMappingURL=FlatList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimatedFlatList","createAnimatedComponent","FlatList","createCellRenderer","itemLayoutAnimation","cellRenderer","props","onLayout","children","ReanimatedFlatlist","forwardRef","ref","restProps","React","useMemo"],"sources":["FlatList.tsx"],"sourcesContent":["import React, { ForwardedRef, forwardRef } from 'react';\nimport {
|
|
1
|
+
{"version":3,"names":["AnimatedFlatList","createAnimatedComponent","FlatList","createCellRenderer","itemLayoutAnimation","cellStyle","cellRenderer","props","onLayout","children","ReanimatedFlatlist","forwardRef","ref","restProps","inverted","horizontal","styles","horizontallyInverted","verticallyInverted","undefined","React","useMemo","StyleSheet","create","transform","scaleY","scaleX"],"sources":["FlatList.tsx"],"sourcesContent":["import React, { ForwardedRef, forwardRef } from 'react';\nimport {\n FlatList,\n FlatListProps,\n LayoutChangeEvent,\n StyleSheet,\n} from 'react-native';\nimport ReanimatedView from './View';\nimport createAnimatedComponent from '../../createAnimatedComponent';\nimport { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';\nimport { StyleProps } from '../commonTypes';\n\nconst AnimatedFlatList = createAnimatedComponent(FlatList as any) as any;\n\ninterface AnimatedFlatListProps {\n onLayout: (event: LayoutChangeEvent) => void;\n // implicit `children` prop has been removed in @types/react^18.0.0\n children: React.ReactNode;\n inverted?: boolean;\n horizontal?: boolean;\n}\n\nconst createCellRenderer = (\n itemLayoutAnimation?: ILayoutAnimationBuilder,\n cellStyle?: StyleProps\n) => {\n const cellRenderer = (props: AnimatedFlatListProps) => {\n return (\n <ReanimatedView\n layout={itemLayoutAnimation}\n onLayout={props.onLayout}\n style={cellStyle}>\n {props.children}\n </ReanimatedView>\n );\n };\n\n return cellRenderer;\n};\n\nexport interface ReanimatedFlatListProps<ItemT> extends FlatListProps<ItemT> {\n itemLayoutAnimation?: ILayoutAnimationBuilder;\n}\n\ntype ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatListProps<T>>;\n\nconst ReanimatedFlatlist: ReanimatedFlatListFC = forwardRef(\n (props: ReanimatedFlatListProps<any>, ref: ForwardedRef<FlatList>) => {\n const { itemLayoutAnimation, ...restProps } = props;\n\n const cellStyle = restProps?.inverted\n ? restProps?.horizontal\n ? styles.horizontallyInverted\n : styles.verticallyInverted\n : undefined;\n\n const cellRenderer = React.useMemo(\n () => createCellRenderer(itemLayoutAnimation, cellStyle),\n [cellStyle]\n );\n\n return (\n <AnimatedFlatList\n ref={ref}\n {...restProps}\n CellRendererComponent={cellRenderer}\n />\n );\n }\n);\n\nconst styles = StyleSheet.create({\n verticallyInverted: { transform: [{ scaleY: -1 }] },\n horizontallyInverted: { transform: [{ scaleX: -1 }] },\n});\n\nexport default ReanimatedFlatlist;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AACA;;;;;;;;;;AAIA,MAAMA,gBAAgB,GAAG,IAAAC,gCAAA,EAAwBC,qBAAxB,CAAzB;;AAUA,MAAMC,kBAAkB,GAAG,CACzBC,mBADyB,EAEzBC,SAFyB,KAGtB;EACH,MAAMC,YAAY,GAAIC,KAAD,IAAkC;IACrD,oBACE,6BAAC,aAAD;MACE,MAAM,EAAEH,mBADV;MAEE,QAAQ,EAAEG,KAAK,CAACC,QAFlB;MAGE,KAAK,EAAEH;IAHT,GAIGE,KAAK,CAACE,QAJT,CADF;EAQD,CATD;;EAWA,OAAOH,YAAP;AACD,CAhBD;;AAwBA,MAAMI,kBAAwC,gBAAG,IAAAC,iBAAA,EAC/C,CAACJ,KAAD,EAAsCK,GAAtC,KAAsE;EACpE,MAAM;IAAER,mBAAF;IAAuB,GAAGS;EAA1B,IAAwCN,KAA9C;EAEA,MAAMF,SAAS,GAAGQ,SAAS,SAAT,IAAAA,SAAS,WAAT,IAAAA,SAAS,CAAEC,QAAX,GACdD,SAAS,SAAT,IAAAA,SAAS,WAAT,IAAAA,SAAS,CAAEE,UAAX,GACEC,MAAM,CAACC,oBADT,GAEED,MAAM,CAACE,kBAHK,GAIdC,SAJJ;;EAMA,MAAMb,YAAY,GAAGc,cAAA,CAAMC,OAAN,CACnB,MAAMlB,kBAAkB,CAACC,mBAAD,EAAsBC,SAAtB,CADL,EAEnB,CAACA,SAAD,CAFmB,CAArB;;EAKA,oBACE,6BAAC,gBAAD;IACE,GAAG,EAAEO;EADP,GAEMC,SAFN;IAGE,qBAAqB,EAAEP;EAHzB,GADF;AAOD,CAtB8C,CAAjD;;AAyBA,MAAMU,MAAM,GAAGM,uBAAA,CAAWC,MAAX,CAAkB;EAC/BL,kBAAkB,EAAE;IAAEM,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE,CAAC;IAAX,CAAD;EAAb,CADW;EAE/BR,oBAAoB,EAAE;IAAEO,SAAS,EAAE,CAAC;MAAEE,MAAM,EAAE,CAAC;IAAX,CAAD;EAAb;AAFS,CAAlB,CAAf;;eAKehB,kB"}
|
|
@@ -47,23 +47,18 @@ var _PlatformChecker = require("./PlatformChecker");
|
|
|
47
47
|
|
|
48
48
|
var _shareables = require("./shareables");
|
|
49
49
|
|
|
50
|
-
var _threads = require("./threads");
|
|
51
|
-
|
|
52
50
|
var _mappers = require("./mappers");
|
|
53
51
|
|
|
54
52
|
var _mutables = require("./mutables");
|
|
55
53
|
|
|
54
|
+
var _initializers = require("./initializers");
|
|
55
|
+
|
|
56
|
+
var _threads = require("./threads");
|
|
57
|
+
|
|
56
58
|
var _time = require("./time");
|
|
57
59
|
|
|
58
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
61
|
|
|
60
|
-
/* global _setGlobalConsole */
|
|
61
|
-
if (global._setGlobalConsole === undefined) {
|
|
62
|
-
// it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
|
|
63
|
-
global._setGlobalConsole = () => {// noop
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
62
|
const testWorklet = () => {
|
|
68
63
|
'worklet';
|
|
69
64
|
};
|
|
@@ -136,55 +131,6 @@ function getViewProp(viewTag, propName) {
|
|
|
136
131
|
});
|
|
137
132
|
}
|
|
138
133
|
|
|
139
|
-
function valueUnpacker(objectToUnpack, category) {
|
|
140
|
-
'worklet';
|
|
141
|
-
|
|
142
|
-
let workletsCache = global.__workletsCache;
|
|
143
|
-
let handleCache = global.__handleCache;
|
|
144
|
-
|
|
145
|
-
if (workletsCache === undefined) {
|
|
146
|
-
// init
|
|
147
|
-
workletsCache = global.__workletsCache = new Map();
|
|
148
|
-
handleCache = global.__handleCache = new WeakMap();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (objectToUnpack.__workletHash) {
|
|
152
|
-
let workletFun = workletsCache.get(objectToUnpack.__workletHash);
|
|
153
|
-
|
|
154
|
-
if (workletFun === undefined) {
|
|
155
|
-
// eslint-disable-next-line no-eval
|
|
156
|
-
workletFun = eval('(' + objectToUnpack.asString + '\n)');
|
|
157
|
-
workletsCache.set(objectToUnpack.__workletHash, workletFun);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const functionInstance = workletFun.bind(objectToUnpack);
|
|
161
|
-
objectToUnpack._recur = functionInstance;
|
|
162
|
-
return functionInstance;
|
|
163
|
-
} else if (objectToUnpack.__init) {
|
|
164
|
-
let value = handleCache.get(objectToUnpack);
|
|
165
|
-
|
|
166
|
-
if (value === undefined) {
|
|
167
|
-
value = objectToUnpack.__init();
|
|
168
|
-
handleCache.set(objectToUnpack, value);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return value;
|
|
172
|
-
} else if (category === 'RemoteFunction') {
|
|
173
|
-
const fun = () => {
|
|
174
|
-
throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.
|
|
175
|
-
|
|
176
|
-
Possible solutions are:
|
|
177
|
-
a) If you want to synchronously execute this method, mark it as a worklet
|
|
178
|
-
b) If you want to execute this function on the JS thread, wrap it using \`runOnJS\``);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
fun.__remoteFunction = objectToUnpack;
|
|
182
|
-
return fun;
|
|
183
|
-
} else {
|
|
184
|
-
throw new Error('data type not recognized by unpack method');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
134
|
function registerEventHandler(eventHash, eventHandler) {
|
|
189
135
|
return _NativeReanimated.default.registerEventHandler(eventHash, (0, _shareables.makeShareableCloneRecursive)(eventHandler));
|
|
190
136
|
}
|
|
@@ -207,25 +153,11 @@ function registerSensor(sensorType, interval, eventHandler) {
|
|
|
207
153
|
|
|
208
154
|
function unregisterSensor(listenerId) {
|
|
209
155
|
return _NativeReanimated.default.unregisterSensor(listenerId);
|
|
210
|
-
}
|
|
156
|
+
} // initialize UI runtime if applicable
|
|
211
157
|
|
|
212
|
-
_NativeReanimated.default.installCoreFunctions(valueUnpacker);
|
|
213
158
|
|
|
214
159
|
if (!(0, _PlatformChecker.isWeb)() && isConfigured()) {
|
|
215
|
-
|
|
216
|
-
(0, _threads.runOnUI)(() => {
|
|
217
|
-
'worklet';
|
|
218
|
-
|
|
219
|
-
const console = {
|
|
220
|
-
debug: (0, _threads.runOnJS)(capturableConsole.debug),
|
|
221
|
-
log: (0, _threads.runOnJS)(capturableConsole.log),
|
|
222
|
-
warn: (0, _threads.runOnJS)(capturableConsole.warn),
|
|
223
|
-
error: (0, _threads.runOnJS)(capturableConsole.error),
|
|
224
|
-
info: (0, _threads.runOnJS)(capturableConsole.info)
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
_setGlobalConsole(console);
|
|
228
|
-
})();
|
|
160
|
+
(0, _initializers.initializeUIRuntime)();
|
|
229
161
|
}
|
|
230
162
|
|
|
231
163
|
let featuresConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["global","_setGlobalConsole","undefined","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","shouldBeUseWeb","isConfigured","isConfiguredCheck","configurationCheckWrapper","__DEV__","fn","startMapper","startMapperUnwrapped","makeShareable","makeShareableUnwrapped","makeMutable","makeMutableUnwrapped","makeRemote","makeRemoteUnwrapped","_WORKLET","_log","s","console","log","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","NativeReanimatedModule","result","substr","valueUnpacker","objectToUnpack","category","workletsCache","__workletsCache","handleCache","__handleCache","Map","WeakMap","workletFun","get","eval","asString","set","functionInstance","bind","_recur","__init","value","fun","__remoteFunction","registerEventHandler","eventHash","eventHandler","makeShareableCloneRecursive","unregisterEventHandler","id","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","interval","unregisterSensor","installCoreFunctions","isWeb","capturableConsole","runOnUI","debug","runOnJS","warn","error","info","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","configureLayoutAnimation","configureProps","uiProps","nativeProps","nativeShouldBeMock"],"sources":["core.ts"],"sourcesContent":["/* global _setGlobalConsole */\nimport NativeReanimatedModule from './NativeReanimated';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport { BasicWorkletFunction, Value3D, ValueRotation } from './commonTypes';\nimport {\n makeShareableCloneRecursive,\n makeShareable as makeShareableUnwrapped,\n} from './shareables';\nimport { runOnUI, runOnJS } from './threads';\nimport { startMapper as startMapperUnwrapped } from './mappers';\nimport {\n makeMutable as makeMutableUnwrapped,\n makeRemote as makeRemoteUnwrapped,\n} from './mutables';\nimport { LayoutAnimationFunction } from './layoutReanimation';\n\nexport { stopMapper } from './mappers';\nexport { runOnJS, runOnUI } from './threads';\nexport { getTimestamp } from './time';\n\nif (global._setGlobalConsole === undefined) {\n // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1\n global._setGlobalConsole = () => {\n // noop\n };\n}\n\nexport type ReanimatedConsole = Pick<\n Console,\n 'debug' | 'log' | 'warn' | 'info' | 'error'\n>;\n\nconst testWorklet: BasicWorkletFunction<void> = () => {\n 'worklet';\n};\n\nconst throwUninitializedReanimatedException = () => {\n throw new Error(\n \"Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \\n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \\n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache\"\n );\n};\n\nexport const checkPluginState: (throwError: boolean) => boolean = (\n throwError = true\n) => {\n if (!testWorklet.__workletHash && !shouldBeUseWeb()) {\n if (throwError) {\n throwUninitializedReanimatedException();\n }\n return false;\n }\n return true;\n};\n\nexport const isConfigured: (throwError?: boolean) => boolean = (\n throwError = false\n) => {\n return checkPluginState(throwError);\n};\n\nexport const isConfiguredCheck: () => void = () => {\n checkPluginState(true);\n};\n\nconst configurationCheckWrapper = __DEV__\n ? <T extends Array<any>, U>(fn: (...args: T) => U) => {\n return (...args: T): U => {\n isConfigured(true);\n return fn(...args);\n };\n }\n : <T extends Array<any>, U>(fn: (...args: T) => U) => fn;\n\nexport const startMapper = __DEV__\n ? configurationCheckWrapper(startMapperUnwrapped)\n : startMapperUnwrapped;\n\nexport const makeShareable = __DEV__\n ? configurationCheckWrapper(makeShareableUnwrapped)\n : makeShareableUnwrapped;\n\nexport const makeMutable = __DEV__\n ? configurationCheckWrapper(makeMutableUnwrapped)\n : makeMutableUnwrapped;\n\nexport const makeRemote = __DEV__\n ? configurationCheckWrapper(makeRemoteUnwrapped)\n : makeRemoteUnwrapped;\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function getViewProp<T>(viewTag: string, propName: string): Promise<T> {\n if (global._IS_FABRIC) {\n throw new Error(\n '[react-native-reanimated] `getViewProp` is not supported on Fabric yet'\n );\n }\n\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nfunction valueUnpacker(objectToUnpack: any, category?: string): any {\n 'worklet';\n let workletsCache = global.__workletsCache;\n let handleCache = global.__handleCache;\n if (workletsCache === undefined) {\n // init\n workletsCache = global.__workletsCache = new Map();\n handleCache = global.__handleCache = new WeakMap();\n }\n if (objectToUnpack.__workletHash) {\n let workletFun = workletsCache.get(objectToUnpack.__workletHash);\n if (workletFun === undefined) {\n // eslint-disable-next-line no-eval\n workletFun = eval('(' + objectToUnpack.asString + '\\n)') as (\n ...args: any[]\n ) => any;\n workletsCache.set(objectToUnpack.__workletHash, workletFun);\n }\n const functionInstance = workletFun.bind(objectToUnpack);\n objectToUnpack._recur = functionInstance;\n return functionInstance;\n } else if (objectToUnpack.__init) {\n let value = handleCache!.get(objectToUnpack);\n if (value === undefined) {\n value = objectToUnpack.__init();\n handleCache!.set(objectToUnpack, value);\n }\n return value;\n } else if (category === 'RemoteFunction') {\n const fun = () => {\n throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.\n\nPossible solutions are:\n a) If you want to synchronously execute this method, mark it as a worklet\n b) If you want to execute this function on the JS thread, wrap it using \\`runOnJS\\``);\n };\n fun.__remoteFunction = objectToUnpack;\n return fun;\n } else {\n throw new Error('data type not recognized by unpack method');\n }\n}\n\nexport function registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n): string {\n return NativeReanimatedModule.registerEventHandler(\n eventHash,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterEventHandler(id: string): void {\n return NativeReanimatedModule.unregisterEventHandler(id);\n}\n\nexport function subscribeForKeyboardEvents(\n eventHandler: (state: number, height: number) => void\n): number {\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unsubscribeFromKeyboardEvents(listenerId: number): void {\n return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);\n}\n\nexport function registerSensor(\n sensorType: number,\n interval: number,\n eventHandler: (data: Value3D | ValueRotation) => void\n): number {\n return NativeReanimatedModule.registerSensor(\n sensorType,\n interval,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterSensor(listenerId: number): void {\n return NativeReanimatedModule.unregisterSensor(listenerId);\n}\n\nNativeReanimatedModule.installCoreFunctions(valueUnpacker);\n\nif (!isWeb() && isConfigured()) {\n const capturableConsole = console;\n runOnUI(() => {\n 'worklet';\n const console = {\n debug: runOnJS(capturableConsole.debug),\n log: runOnJS(capturableConsole.log),\n warn: runOnJS(capturableConsole.warn),\n error: runOnJS(capturableConsole.error),\n info: runOnJS(capturableConsole.info),\n };\n _setGlobalConsole(console);\n })();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimations(\n viewTag: number,\n type: string,\n config: LayoutAnimationFunction | Keyframe\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n makeShareableCloneRecursive(config)\n );\n}\n\nexport function configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AAQA;;;;AAlBA;AAoBA,IAAIA,MAAM,CAACC,iBAAP,KAA6BC,SAAjC,EAA4C;EAC1C;EACAF,MAAM,CAACC,iBAAP,GAA2B,MAAM,CAC/B;EACD,CAFD;AAGD;;AAOD,MAAME,WAAuC,GAAG,MAAM;EACpD;AACD,CAFD;;AAIA,MAAMC,qCAAqC,GAAG,MAAM;EAClD,MAAM,IAAIC,KAAJ,CACJ,4cADI,CAAN;AAGD,CAJD;;AAMO,MAAMC,gBAAkD,GAAG,YAE7D;EAAA,IADHC,UACG,uEADU,IACV;;EACH,IAAI,CAACJ,WAAW,CAACK,aAAb,IAA8B,CAAC,IAAAC,+BAAA,GAAnC,EAAqD;IACnD,IAAIF,UAAJ,EAAgB;MACdH,qCAAqC;IACtC;;IACD,OAAO,KAAP;EACD;;EACD,OAAO,IAAP;AACD,CAVM;;;;AAYA,MAAMM,YAA+C,GAAG,YAE1D;EAAA,IADHH,UACG,uEADU,KACV;EACH,OAAOD,gBAAgB,CAACC,UAAD,CAAvB;AACD,CAJM;;;;AAMA,MAAMI,iBAA6B,GAAG,MAAM;EACjDL,gBAAgB,CAAC,IAAD,CAAhB;AACD,CAFM;;;AAIP,MAAMM,yBAAyB,GAAGC,OAAO,GACXC,EAA1B,IAAoD;EAClD,OAAO,YAAmB;IACxBJ,YAAY,CAAC,IAAD,CAAZ;IACA,OAAOI,EAAE,CAAC,YAAD,CAA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I,IAA1B,CAHQ;MAIdC,KAAK,EAAE,IAAAF,gBAAA,EAAQH,iBAAiB,CAACK,KAA1B,CAJO;MAKdC,IAAI,EAAE,IAAAH,gBAAA,EAAQH,iBAAiB,CAACM,IAA1B;IALQ,CAAhB;;IAOA/E,iBAAiB,CAACyB,OAAD,CAAjB;EACD,CAVD;AAWD;;AAOD,IAAIuD,cAA8B,GAAG;EACnCC,sBAAsB,EAAE,KADW;EAEnCC,SAAS,EAAE;AAFwB,CAArC;;AAKO,SAASD,sBAAT,CACLE,IADK,EAGC;EAAA,IADNC,YACM,uEADS,IACT;;EACN,IAAIA,YAAJ,EAAkB;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IADT;MAEfD,SAAS,EAAE;IAFI,CAAjB;;IAIAhD,yBAAA,CAAuB+C,sBAAvB,CAA8CE,IAA9C;EACD,CAND,MAMO,IACL,CAACH,cAAc,CAACE,SAAhB,IACAF,cAAc,CAACC,sBAAf,KAA0CE,IAFrC,EAGL;IACAH,cAAc,CAACC,sBAAf,GAAwCE,IAAxC;;IACAjD,yBAAA,CAAuB+C,sBAAvB,CAA8CE,IAA9C;EACD;AACF;;AAEM,SAASE,yBAAT,CACLzD,OADK,EAEL0D,IAFK,EAGLC,MAHK,EAIC;EACNrD,yBAAA,CAAuBsD,wBAAvB,CACE5D,OADF,EAEE0D,IAFF,EAGE,IAAAzB,uCAAA,EAA4B0B,MAA5B,CAHF;AAKD;;AAEM,SAASE,cAAT,CAAwBC,OAAxB,EAA2CC,WAA3C,EAAwE;EAC7E,IAAI,CAAC,IAAAC,mCAAA,GAAL,EAA2B;IACzB1D,yBAAA,CAAuBuD,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF"}
|
|
1
|
+
{"version":3,"names":["testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","shouldBeUseWeb","isConfigured","isConfiguredCheck","configurationCheckWrapper","__DEV__","fn","startMapper","startMapperUnwrapped","makeShareable","makeShareableUnwrapped","makeMutable","makeMutableUnwrapped","makeRemote","makeRemoteUnwrapped","global","_WORKLET","_log","s","console","log","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","NativeReanimatedModule","result","substr","registerEventHandler","eventHash","eventHandler","makeShareableCloneRecursive","unregisterEventHandler","id","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","interval","unregisterSensor","isWeb","initializeUIRuntime","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","configureLayoutAnimation","configureProps","uiProps","nativeProps","nativeShouldBeMock"],"sources":["core.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport { BasicWorkletFunction, Value3D, ValueRotation } from './commonTypes';\nimport {\n makeShareableCloneRecursive,\n makeShareable as makeShareableUnwrapped,\n} from './shareables';\nimport { startMapper as startMapperUnwrapped } from './mappers';\nimport {\n makeMutable as makeMutableUnwrapped,\n makeRemote as makeRemoteUnwrapped,\n} from './mutables';\nimport { LayoutAnimationFunction } from './layoutReanimation';\nimport { initializeUIRuntime } from './initializers';\n\nexport { stopMapper } from './mappers';\nexport { runOnJS, runOnUI } from './threads';\nexport { getTimestamp } from './time';\n\nexport type ReanimatedConsole = Pick<\n Console,\n 'debug' | 'log' | 'warn' | 'info' | 'error'\n>;\n\nconst testWorklet: BasicWorkletFunction<void> = () => {\n 'worklet';\n};\n\nconst throwUninitializedReanimatedException = () => {\n throw new Error(\n \"Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \\n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \\n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache\"\n );\n};\n\nexport const checkPluginState: (throwError: boolean) => boolean = (\n throwError = true\n) => {\n if (!testWorklet.__workletHash && !shouldBeUseWeb()) {\n if (throwError) {\n throwUninitializedReanimatedException();\n }\n return false;\n }\n return true;\n};\n\nexport const isConfigured: (throwError?: boolean) => boolean = (\n throwError = false\n) => {\n return checkPluginState(throwError);\n};\n\nexport const isConfiguredCheck: () => void = () => {\n checkPluginState(true);\n};\n\nconst configurationCheckWrapper = __DEV__\n ? <T extends Array<any>, U>(fn: (...args: T) => U) => {\n return (...args: T): U => {\n isConfigured(true);\n return fn(...args);\n };\n }\n : <T extends Array<any>, U>(fn: (...args: T) => U) => fn;\n\nexport const startMapper = __DEV__\n ? configurationCheckWrapper(startMapperUnwrapped)\n : startMapperUnwrapped;\n\nexport const makeShareable = __DEV__\n ? configurationCheckWrapper(makeShareableUnwrapped)\n : makeShareableUnwrapped;\n\nexport const makeMutable = __DEV__\n ? configurationCheckWrapper(makeMutableUnwrapped)\n : makeMutableUnwrapped;\n\nexport const makeRemote = __DEV__\n ? configurationCheckWrapper(makeRemoteUnwrapped)\n : makeRemoteUnwrapped;\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function getViewProp<T>(viewTag: string, propName: string): Promise<T> {\n if (global._IS_FABRIC) {\n throw new Error(\n '[react-native-reanimated] `getViewProp` is not supported on Fabric yet'\n );\n }\n\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nexport function registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n): string {\n return NativeReanimatedModule.registerEventHandler(\n eventHash,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterEventHandler(id: string): void {\n return NativeReanimatedModule.unregisterEventHandler(id);\n}\n\nexport function subscribeForKeyboardEvents(\n eventHandler: (state: number, height: number) => void\n): number {\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unsubscribeFromKeyboardEvents(listenerId: number): void {\n return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);\n}\n\nexport function registerSensor(\n sensorType: number,\n interval: number,\n eventHandler: (data: Value3D | ValueRotation) => void\n): number {\n return NativeReanimatedModule.registerSensor(\n sensorType,\n interval,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterSensor(listenerId: number): void {\n return NativeReanimatedModule.unregisterSensor(listenerId);\n}\n\n// initialize UI runtime if applicable\nif (!isWeb() && isConfigured()) {\n initializeUIRuntime();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimations(\n viewTag: number,\n type: string,\n config: LayoutAnimationFunction | Keyframe\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n makeShareableCloneRecursive(config)\n );\n}\n\nexport function configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AACA;;AAKA;;AAGA;;AACA;;;;AAOA,MAAMA,WAAuC,GAAG,MAAM;EACpD;AACD,CAFD;;AAIA,MAAMC,qCAAqC,GAAG,MAAM;EAClD,MAAM,IAAIC,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;;AACA,IAAI,CAAC,IAAAK,sBAAA,GAAD,IAAY1C,YAAY,EAA5B,EAAgC;EAC9B,IAAA2C,iCAAA;AACD;;AAOD,IAAIC,cAA8B,GAAG;EACnCC,sBAAsB,EAAE,KADW;EAEnCC,SAAS,EAAE;AAFwB,CAArC;;AAKO,SAASD,sBAAT,CACLE,IADK,EAGC;EAAA,IADNC,YACM,uEADS,IACT;;EACN,IAAIA,YAAJ,EAAkB;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IADT;MAEfD,SAAS,EAAE;IAFI,CAAjB;;IAIApB,yBAAA,CAAuBmB,sBAAvB,CAA8CE,IAA9C;EACD,CAND,MAMO,IACL,CAACH,cAAc,CAACE,SAAhB,IACAF,cAAc,CAACC,sBAAf,KAA0CE,IAFrC,EAGL;IACAH,cAAc,CAACC,sBAAf,GAAwCE,IAAxC;;IACArB,yBAAA,CAAuBmB,sBAAvB,CAA8CE,IAA9C;EACD;AACF;;AAEM,SAASE,yBAAT,CACL7B,OADK,EAEL8B,IAFK,EAGLC,MAHK,EAIC;EACNzB,yBAAA,CAAuB0B,wBAAvB,CACEhC,OADF,EAEE8B,IAFF,EAGE,IAAAlB,uCAAA,EAA4BmB,MAA5B,CAHF;AAKD;;AAEM,SAASE,cAAT,CAAwBC,OAAxB,EAA2CC,WAA3C,EAAwE;EAC7E,IAAI,CAAC,IAAAC,mCAAA,GAAL,EAA2B;IACzB9B,yBAAA,CAAuB2B,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerWorkletStackDetails = registerWorkletStackDetails;
|
|
7
|
+
exports.reportFatalErrorOnJS = reportFatalErrorOnJS;
|
|
8
|
+
|
|
9
|
+
const _workletStackDetails = new Map();
|
|
10
|
+
|
|
11
|
+
function registerWorkletStackDetails(hash, stackDetails) {
|
|
12
|
+
_workletStackDetails.set(hash, stackDetails);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getBundleOffset(error) {
|
|
16
|
+
var _error$stack, _error$stack$split;
|
|
17
|
+
|
|
18
|
+
const frame = (_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : (_error$stack$split = _error$stack.split('\n')) === null || _error$stack$split === void 0 ? void 0 : _error$stack$split[0];
|
|
19
|
+
|
|
20
|
+
if (frame) {
|
|
21
|
+
const parsedFrame = /@([^@]+):(\d+):(\d+)/.exec(frame);
|
|
22
|
+
|
|
23
|
+
if (parsedFrame) {
|
|
24
|
+
const [, file, line, col] = parsedFrame;
|
|
25
|
+
return [file, Number(line), Number(col)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return ['unknown', 0, 0];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function processStack(stack) {
|
|
33
|
+
const workletStackEntries = stack.match(/worklet_(\d+):(\d+):(\d+)/g);
|
|
34
|
+
let result = stack;
|
|
35
|
+
workletStackEntries === null || workletStackEntries === void 0 ? void 0 : workletStackEntries.forEach(match => {
|
|
36
|
+
const [, hash, origLine, origCol] = match.split(/:|_/).map(Number);
|
|
37
|
+
|
|
38
|
+
const errorDetails = _workletStackDetails.get(hash);
|
|
39
|
+
|
|
40
|
+
if (!errorDetails) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const [error, lineOffset, colOffset] = errorDetails;
|
|
45
|
+
const [bundleFile, bundleLine, bundleCol] = getBundleOffset(error);
|
|
46
|
+
const line = origLine + bundleLine + lineOffset;
|
|
47
|
+
const col = origCol + bundleCol + colOffset;
|
|
48
|
+
result = result.replace(match, `${bundleFile}:${line}:${col}`);
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function reportFatalErrorOnJS(_ref) {
|
|
54
|
+
let {
|
|
55
|
+
message,
|
|
56
|
+
stack
|
|
57
|
+
} = _ref;
|
|
58
|
+
const error = new Error();
|
|
59
|
+
error.message = message;
|
|
60
|
+
error.stack = stack ? processStack(stack) : undefined;
|
|
61
|
+
error.name = 'ReanimatedError'; // @ts-ignore React Native's ErrorUtils implementation extends the Error type with jsEngine field
|
|
62
|
+
|
|
63
|
+
error.jsEngine = 'reanimated';
|
|
64
|
+
global.ErrorUtils.reportFatalError(error);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_workletStackDetails","Map","registerWorkletStackDetails","hash","stackDetails","set","getBundleOffset","error","frame","stack","split","parsedFrame","exec","file","line","col","Number","processStack","workletStackEntries","match","result","forEach","origLine","origCol","map","errorDetails","get","lineOffset","colOffset","bundleFile","bundleLine","bundleCol","replace","reportFatalErrorOnJS","message","Error","undefined","name","jsEngine","global","ErrorUtils","reportFatalError"],"sources":["errors.ts"],"sourcesContent":["type StackDetails = [Error, number, number];\n\nconst _workletStackDetails = new Map<number, StackDetails>();\n\nexport function registerWorkletStackDetails(\n hash: number,\n stackDetails: StackDetails\n) {\n _workletStackDetails.set(hash, stackDetails);\n}\n\nfunction getBundleOffset(error: Error): [string, number, number] {\n const frame = error.stack?.split('\\n')?.[0];\n if (frame) {\n const parsedFrame = /@([^@]+):(\\d+):(\\d+)/.exec(frame);\n if (parsedFrame) {\n const [, file, line, col] = parsedFrame;\n return [file, Number(line), Number(col)];\n }\n }\n return ['unknown', 0, 0];\n}\n\nfunction processStack(stack: string): string {\n const workletStackEntries = stack.match(/worklet_(\\d+):(\\d+):(\\d+)/g);\n let result = stack;\n workletStackEntries?.forEach((match) => {\n const [, hash, origLine, origCol] = match.split(/:|_/).map(Number);\n const errorDetails = _workletStackDetails.get(hash);\n if (!errorDetails) {\n return;\n }\n const [error, lineOffset, colOffset] = errorDetails;\n const [bundleFile, bundleLine, bundleCol] = getBundleOffset(error);\n const line = origLine + bundleLine + lineOffset;\n const col = origCol + bundleCol + colOffset;\n\n result = result.replace(match, `${bundleFile}:${line}:${col}`);\n });\n return result;\n}\n\nexport function reportFatalErrorOnJS({\n message,\n stack,\n}: {\n message: string;\n stack?: string;\n}) {\n const error = new Error();\n error.message = message;\n error.stack = stack ? processStack(stack) : undefined;\n error.name = 'ReanimatedError';\n // @ts-ignore React Native's ErrorUtils implementation extends the Error type with jsEngine field\n error.jsEngine = 'reanimated';\n global.ErrorUtils.reportFatalError(error);\n}\n"],"mappings":";;;;;;;;AAEA,MAAMA,oBAAoB,GAAG,IAAIC,GAAJ,EAA7B;;AAEO,SAASC,2BAAT,CACLC,IADK,EAELC,YAFK,EAGL;EACAJ,oBAAoB,CAACK,GAArB,CAAyBF,IAAzB,EAA+BC,YAA/B;AACD;;AAED,SAASE,eAAT,CAAyBC,KAAzB,EAAiE;EAAA;;EAC/D,MAAMC,KAAK,mBAAGD,KAAK,CAACE,KAAT,uEAAG,aAAaC,KAAb,CAAmB,IAAnB,CAAH,uDAAG,mBAA2B,CAA3B,CAAd;;EACA,IAAIF,KAAJ,EAAW;IACT,MAAMG,WAAW,GAAG,uBAAuBC,IAAvB,CAA4BJ,KAA5B,CAApB;;IACA,IAAIG,WAAJ,EAAiB;MACf,MAAM,GAAGE,IAAH,EAASC,IAAT,EAAeC,GAAf,IAAsBJ,WAA5B;MACA,OAAO,CAACE,IAAD,EAAOG,MAAM,CAACF,IAAD,CAAb,EAAqBE,MAAM,CAACD,GAAD,CAA3B,CAAP;IACD;EACF;;EACD,OAAO,CAAC,SAAD,EAAY,CAAZ,EAAe,CAAf,CAAP;AACD;;AAED,SAASE,YAAT,CAAsBR,KAAtB,EAA6C;EAC3C,MAAMS,mBAAmB,GAAGT,KAAK,CAACU,KAAN,CAAY,4BAAZ,CAA5B;EACA,IAAIC,MAAM,GAAGX,KAAb;EACAS,mBAAmB,SAAnB,IAAAA,mBAAmB,WAAnB,YAAAA,mBAAmB,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easuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n} from './commonTypes';\nimport type {
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n} from './commonTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport { LayoutAnimationStartFunction } from './layoutReanimation';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _REANIMATED_VERSION_CPP: string;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n const evalWithSourceUrl: (js: string, sourceURL: string) => any;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _getTimestamp: () => number;\n const _notifyAboutProgress: (tag: number, value: number) => void;\n const _notifyAboutEnd: (\n tag: number,\n finished: boolean,\n removeView: boolean\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _makeShareableClone: (value: any) => any;\n const _updateDataSynchronously: (\n dataHolder: ShareableSyncDataHolderRef,\n data: ShareableRef\n ) => void;\n const _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n const requestAnimationFrame: (callback: (time: number) => void) => number;\n const console: Console;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _REANIMATED_VERSION_CPP: string;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n evalWithSourceUrl: (js: string, sourceURL: string) => any;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _getTimestamp: () => number;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _makeShareableClone: (value: any) => any;\n _updateDataSynchronously: (\n ShareableSyncDataHolderRef,\n ShareableRef\n ) => void;\n _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationsManager: {\n start: LayoutAnimationStartFunction;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n __workletsCache?: Map<string, (...args: any[]) => any>;\n __handleCache?: WeakMap<any, any>;\n __mapperRegistry?: MapperRegistry;\n requestAnimationFrame: (callback: (time: number) => void) => number;\n console: Console;\n }\n }\n}\n"],"mappings":""}
|
|
@@ -388,16 +388,6 @@ function useAnimatedStyle(updater, dependencies, adapters) {
|
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
if (!(0, _PlatformChecker.shouldBeUseWeb)()) {
|
|
392
|
-
updaterFn = () => {
|
|
393
|
-
'worklet';
|
|
394
|
-
|
|
395
|
-
const style = updaterFn();
|
|
396
|
-
(0, _utils.parseColors)(style);
|
|
397
|
-
return style;
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
|
|
401
391
|
if ((0, _PlatformChecker.isJest)()) {
|
|
402
392
|
fun = () => {
|
|
403
393
|
'worklet';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareAnimation","animatedProp","lastAnimation","lastValue","Array","isArray","forEach","prop","index","onFrame","animation","value","current","undefined","callStart","timestamp","onStart","getTimestamp","Object","keys","key","runAnimations","result","animationsActive","allFinished","entry","finished","callback","k","styleUpdater","viewDescriptors","updater","state","maybeViewRef","animations","newValues","oldValues","last","hasAnimations","isAnimated","frame","_timestamp","isAnimationCancelled","isAnimationRunning","updates","propName","updateProps","requestAnimationFrame","_frameTimestamp","assign","style","getStyleWithoutAnimations","diff","styleDiff","jestStyleUpdater","animatedStyle","adapters","length","updatePropsJestWrapper","checkSharedValueUsage","currentKey","element","Error","useAnimatedStyle","dependencies","viewsRef","makeViewsRefSet","initRef","useRef","inputs","values","_closure","adaptersArray","adaptersHash","buildWorkletsHash","useSharedValue","__workletHash","push","initialStyle","initialUpdaterRun","validateAnimatedStyles","initial","remoteState","makeRemote","makeViewDescriptorsSet","sharableViewDescriptors","NativeReanimatedModule","native","useEffect","fun","updaterFn","adapter","shouldBeUseWeb","parseColors","isJest","mapperId","startMapper","stopMapper","process","env","JEST_WORKER_ID"],"sources":["useAnimatedStyle.ts"],"sourcesContent":["/* global _frameTimestamp */\nimport { MutableRefObject, useEffect, useRef } from 'react';\n\nimport { startMapper, stopMapper, makeRemote, getTimestamp } from '../core';\nimport updateProps, { updatePropsJestWrapper } from '../UpdateProps';\nimport { initialUpdaterRun } from '../animation';\nimport NativeReanimatedModule from '../NativeReanimated';\nimport { useSharedValue } from './useSharedValue';\nimport {\n buildWorkletsHash,\n getStyleWithoutAnimations,\n isAnimated,\n parseColors,\n styleDiff,\n validateAnimatedStyles,\n} from './utils';\nimport { DependencyList, Descriptor } from './commonTypes';\nimport {\n makeViewDescriptorsSet,\n makeViewsRefSet,\n ViewDescriptorsSet,\n ViewRefSet,\n} from '../ViewDescriptorsSet';\nimport { isJest, shouldBeUseWeb } from '../PlatformChecker';\nimport {\n AnimationObject,\n Timestamp,\n AdapterWorkletFunction,\n AnimatedStyle,\n BasicWorkletFunction,\n BasicWorkletFunctionOptional,\n NestedObjectValues,\n SharedValue,\n} from '../commonTypes';\nexport interface AnimatedStyleResult {\n viewDescriptors: ViewDescriptorsSet;\n initial: AnimatedStyle;\n viewsRef: ViewRefSet<any>;\n animatedStyle?: MutableRefObject<AnimatedStyle>;\n}\n\ninterface AnimatedState {\n last: AnimatedStyle;\n animations: AnimatedStyle;\n isAnimationRunning: boolean;\n isAnimationCancelled: boolean;\n}\n\ninterface AnimationRef {\n initial: {\n value: AnimatedStyle;\n updater: () => AnimatedStyle;\n };\n remoteState: AnimatedState;\n viewDescriptors: ViewDescriptorsSet;\n}\n\nfunction prepareAnimation(\n animatedProp: AnimatedStyle,\n lastAnimation: AnimatedStyle,\n lastValue: AnimatedStyle\n): void {\n 'worklet';\n if (Array.isArray(animatedProp)) {\n animatedProp.forEach((prop, index) => {\n prepareAnimation(\n prop,\n lastAnimation && lastAnimation[index],\n lastValue && lastValue[index]\n );\n });\n // return animatedProp;\n }\n if (typeof animatedProp === 'object' && animatedProp.onFrame) {\n const animation = animatedProp;\n\n let value = animation.current;\n if (lastValue !== undefined) {\n if (typeof lastValue === 'object') {\n if (lastValue.value !== undefined) {\n // previously it was a shared value\n value = lastValue.value;\n } else if (lastValue.onFrame !== undefined) {\n if (lastAnimation?.current !== undefined) {\n // it was an animation before, copy its state\n value = lastAnimation.current;\n } else if (lastValue?.current !== undefined) {\n // it was initialized\n value = lastValue.current;\n }\n }\n } else {\n // previously it was a plain value, just set it as starting point\n value = lastValue;\n }\n }\n\n animation.callStart = (timestamp: Timestamp) => {\n animation.onStart(animation, value, timestamp, lastAnimation);\n };\n animation.callStart(getTimestamp());\n animation.callStart = null;\n } else if (typeof animatedProp === 'object') {\n // it is an object\n Object.keys(animatedProp).forEach((key) =>\n prepareAnimation(\n animatedProp[key],\n lastAnimation && lastAnimation[key],\n lastValue && lastValue[key]\n )\n );\n }\n}\n\nfunction runAnimations(\n animation: AnimatedStyle,\n timestamp: Timestamp,\n key: number | string,\n result: AnimatedStyle,\n animationsActive: SharedValue<boolean>\n): boolean {\n 'worklet';\n if (!animationsActive.value) {\n return true;\n }\n if (Array.isArray(animation)) {\n result[key] = [];\n let allFinished = true;\n animation.forEach((entry, index) => {\n if (\n !runAnimations(entry, timestamp, index, result[key], animationsActive)\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else if (typeof animation === 'object' && animation.onFrame) {\n let finished = true;\n if (!animation.finished) {\n if (animation.callStart) {\n animation.callStart(timestamp);\n animation.callStart = null;\n }\n finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n if (finished) {\n animation.finished = true;\n animation.callback && animation.callback(true /* finished */);\n }\n }\n result[key] = animation.current;\n return finished;\n } else if (typeof animation === 'object') {\n result[key] = {};\n let allFinished = true;\n Object.keys(animation).forEach((k) => {\n if (\n !runAnimations(\n animation[k],\n timestamp,\n k,\n result[key],\n animationsActive\n )\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else {\n result[key] = animation;\n return true;\n }\n}\n\nfunction styleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: BasicWorkletFunction<AnimatedStyle>,\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>\n): void {\n 'worklet';\n const animations = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n let hasAnimations = false;\n for (const key in newValues) {\n const value = newValues[key];\n if (isAnimated(value)) {\n prepareAnimation(value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n } else {\n delete animations[key];\n }\n }\n\n if (hasAnimations) {\n const frame = (_timestamp?: Timestamp) => {\n const { animations, last, isAnimationCancelled } = state;\n const timestamp = _timestamp ?? getTimestamp();\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle = {};\n let allFinished = true;\n for (const propName in animations) {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n }\n\n if (updates) {\n updateProps(viewDescriptors, updates, maybeViewRef);\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n };\n\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n if (_frameTimestamp) {\n frame(_frameTimestamp);\n } else {\n requestAnimationFrame(frame);\n }\n }\n state.last = Object.assign({}, oldValues, newValues);\n const style = getStyleWithoutAnimations(state.last);\n if (style) {\n updateProps(viewDescriptors, style, maybeViewRef);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n\n const diff = styleDiff(oldValues, newValues);\n state.last = Object.assign({}, oldValues, newValues);\n if (diff) {\n updateProps(viewDescriptors, newValues, maybeViewRef);\n }\n }\n}\n\nfunction jestStyleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: BasicWorkletFunction<AnimatedStyle>,\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: AdapterWorkletFunction[] = []\n): void {\n 'worklet';\n const animations: AnimatedStyle = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n // extract animated props\n let hasAnimations = false;\n Object.keys(animations).forEach((key) => {\n const value = newValues[key];\n if (!isAnimated(value)) {\n delete animations[key];\n }\n });\n Object.keys(newValues).forEach((key) => {\n const value = newValues[key];\n if (isAnimated(value)) {\n prepareAnimation(value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n }\n });\n\n function frame(_timestamp?: Timestamp) {\n const { animations, last, isAnimationCancelled } = state;\n const timestamp = _timestamp ?? getTimestamp();\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle = {};\n let allFinished = true;\n Object.keys(animations).forEach((propName) => {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n });\n\n if (Object.keys(updates).length) {\n updatePropsJestWrapper(\n viewDescriptors,\n updates,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n }\n\n if (hasAnimations) {\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n if (_frameTimestamp) {\n frame(_frameTimestamp);\n } else {\n requestAnimationFrame(frame);\n }\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n }\n\n // calculate diff\n const diff = styleDiff(oldValues, newValues);\n state.last = Object.assign({}, oldValues, newValues);\n\n if (Object.keys(diff).length !== 0) {\n updatePropsJestWrapper(\n viewDescriptors,\n diff,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n}\n\n// check for invalid usage of shared values in returned object\nfunction checkSharedValueUsage(\n prop: NestedObjectValues<AnimationObject>,\n currentKey?: string\n): void {\n if (Array.isArray(prop)) {\n // if it's an array (i.ex. transform) validate all its elements\n for (const element of prop) {\n checkSharedValueUsage(element, currentKey);\n }\n } else if (typeof prop === 'object' && prop.value === undefined) {\n // if it's a nested object, run validation for all its props\n for (const key of Object.keys(prop)) {\n checkSharedValueUsage(prop[key], key);\n }\n } else if (\n currentKey !== undefined &&\n typeof prop === 'object' &&\n prop.value !== undefined\n ) {\n // if shared value is passed insted of its value, throw an error\n throw new Error(\n `invalid value passed to \\`${currentKey}\\`, maybe you forgot to use \\`.value\\`?`\n );\n }\n}\n\nexport function useAnimatedStyle<T extends AnimatedStyle>(\n updater: BasicWorkletFunction<T>,\n dependencies?: DependencyList,\n adapters?: AdapterWorkletFunction | AdapterWorkletFunction[]\n): AnimatedStyleResult {\n const viewsRef: ViewRefSet<any> = makeViewsRefSet();\n const initRef = useRef<AnimationRef>();\n const inputs = Object.values(updater._closure ?? {});\n const adaptersArray: AdapterWorkletFunction[] = adapters\n ? Array.isArray(adapters)\n ? adapters\n : [adapters]\n : [];\n const adaptersHash = adapters ? buildWorkletsHash(adaptersArray) : null;\n const animationsActive = useSharedValue<boolean>(true);\n const animatedStyle: MutableRefObject<AnimatedStyle> = useRef<AnimatedStyle>(\n {}\n );\n\n // build dependencies\n if (!dependencies) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n adaptersHash && dependencies.push(adaptersHash);\n\n if (!initRef.current) {\n const initialStyle: AnimatedStyle = initialUpdaterRun(updater);\n validateAnimatedStyles(initialStyle);\n initRef.current = {\n initial: {\n value: initialStyle,\n updater: updater,\n },\n remoteState: makeRemote<AnimatedState>({\n last: initialStyle,\n animations: {},\n isAnimationCancelled: false,\n isAnimationRunning: false,\n }),\n viewDescriptors: makeViewDescriptorsSet(),\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { initial, remoteState, viewDescriptors } = initRef.current!;\n const sharableViewDescriptors = viewDescriptors.sharableViewDescriptors;\n const maybeViewRef = NativeReanimatedModule.native ? undefined : viewsRef;\n\n dependencies.push(sharableViewDescriptors);\n\n useEffect(() => {\n let fun;\n let updaterFn = updater as BasicWorkletFunctionOptional<T>;\n if (adapters) {\n updaterFn = () => {\n 'worklet';\n const newValues = updater();\n adaptersArray.forEach((adapter) => {\n adapter(newValues);\n });\n return newValues;\n };\n }\n\n if (!shouldBeUseWeb()) {\n updaterFn = () => {\n 'worklet';\n const style = updaterFn();\n parseColors(style);\n return style;\n };\n }\n\n if (isJest()) {\n fun = () => {\n 'worklet';\n jestStyleUpdater(\n sharableViewDescriptors,\n updater,\n remoteState,\n maybeViewRef,\n animationsActive,\n animatedStyle,\n adaptersArray\n );\n };\n } else {\n fun = () => {\n 'worklet';\n styleUpdater(\n sharableViewDescriptors,\n updaterFn,\n remoteState,\n maybeViewRef,\n animationsActive\n );\n };\n }\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n\n useEffect(() => {\n animationsActive.value = true;\n return () => {\n // initRef.current = null;\n // viewsRef = null;\n animationsActive.value = false;\n };\n }, []);\n\n checkSharedValueUsage(initial.value);\n\n if (process.env.JEST_WORKER_ID) {\n return { viewDescriptors, initial: initial, viewsRef, animatedStyle };\n } else {\n return { viewDescriptors, initial: initial, viewsRef };\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AASA;;AAMA;;;;;;;;AAvBA;AAyDA,SAASA,gBAAT,CACEC,YADF,EAEEC,aAFF,EAGEC,SAHF,EAIQ;EACN;;EACA,IAAIC,KAAK,CAACC,OAAN,CAAcJ,YAAd,CAAJ,EAAiC;IAC/BA,YAAY,CAACK,OAAb,CAAqB,CAACC,IAAD,EAAOC,KAAP,KAAiB;MACpCR,gBAAgB,CACdO,IADc,EAEdL,aAAa,IAAIA,aAAa,CAACM,KAAD,CAFhB,EAGdL,SAAS,IAAI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array","isArray","forEach","prop","index","onFrame","animation","value","current","undefined","callStart","timestamp","onStart","getTimestamp","Object","keys","key","runAnimations","result","animationsActive","allFinished","entry","finished","callback","k","styleUpdater","viewDescriptors","updater","state","maybeViewRef","animations","newValues","oldValues","last","hasAnimations","isAnimated","frame","_timestamp","isAnimationCancelled","isAnimationRunning","updates","propName","updateProps","requestAnimationFrame","_frameTimestamp","assign","style","getStyleWithoutAnimations","diff","styleDiff","jestStyleUpdater","animatedStyle","adapters","length","updatePropsJestWrapper","checkSharedValueUsage","currentKey","element","Error","useAnimatedStyle","dependencies","viewsRef","makeViewsRefSet","initRef","useRef","inputs","values","_closure","adaptersArray","adaptersHash","buildWorkletsHash","useSharedValue","__workletHash","push","initialStyle","initialUpdaterRun","validateAnimatedStyles","initial","remoteState","makeRemote","makeViewDescriptorsSet","sharableViewDescriptors","NativeReanimatedModule","native","useEffect","fun","updaterFn","adapter","isJest","mapperId","startMapper","stopMapper","process","env","JEST_WORKER_ID"],"sources":["useAnimatedStyle.ts"],"sourcesContent":["/* global _frameTimestamp */\nimport { MutableRefObject, useEffect, useRef } from 'react';\n\nimport { startMapper, stopMapper, makeRemote, getTimestamp } from '../core';\nimport updateProps, { updatePropsJestWrapper } from '../UpdateProps';\nimport { initialUpdaterRun } from '../animation';\nimport NativeReanimatedModule from '../NativeReanimated';\nimport { useSharedValue } from './useSharedValue';\nimport {\n buildWorkletsHash,\n getStyleWithoutAnimations,\n isAnimated,\n styleDiff,\n validateAnimatedStyles,\n} from './utils';\nimport { DependencyList, Descriptor } from './commonTypes';\nimport {\n makeViewDescriptorsSet,\n makeViewsRefSet,\n ViewDescriptorsSet,\n ViewRefSet,\n} from '../ViewDescriptorsSet';\nimport { isJest } from '../PlatformChecker';\nimport {\n AnimationObject,\n Timestamp,\n AdapterWorkletFunction,\n AnimatedStyle,\n BasicWorkletFunction,\n BasicWorkletFunctionOptional,\n NestedObjectValues,\n SharedValue,\n} from '../commonTypes';\nexport interface AnimatedStyleResult {\n viewDescriptors: ViewDescriptorsSet;\n initial: AnimatedStyle;\n viewsRef: ViewRefSet<any>;\n animatedStyle?: MutableRefObject<AnimatedStyle>;\n}\n\ninterface AnimatedState {\n last: AnimatedStyle;\n animations: AnimatedStyle;\n isAnimationRunning: boolean;\n isAnimationCancelled: boolean;\n}\n\ninterface AnimationRef {\n initial: {\n value: AnimatedStyle;\n updater: () => AnimatedStyle;\n };\n remoteState: AnimatedState;\n viewDescriptors: ViewDescriptorsSet;\n}\n\nfunction prepareAnimation(\n animatedProp: AnimatedStyle,\n lastAnimation: AnimatedStyle,\n lastValue: AnimatedStyle\n): void {\n 'worklet';\n if (Array.isArray(animatedProp)) {\n animatedProp.forEach((prop, index) => {\n prepareAnimation(\n prop,\n lastAnimation && lastAnimation[index],\n lastValue && lastValue[index]\n );\n });\n // return animatedProp;\n }\n if (typeof animatedProp === 'object' && animatedProp.onFrame) {\n const animation = animatedProp;\n\n let value = animation.current;\n if (lastValue !== undefined) {\n if (typeof lastValue === 'object') {\n if (lastValue.value !== undefined) {\n // previously it was a shared value\n value = lastValue.value;\n } else if (lastValue.onFrame !== undefined) {\n if (lastAnimation?.current !== undefined) {\n // it was an animation before, copy its state\n value = lastAnimation.current;\n } else if (lastValue?.current !== undefined) {\n // it was initialized\n value = lastValue.current;\n }\n }\n } else {\n // previously it was a plain value, just set it as starting point\n value = lastValue;\n }\n }\n\n animation.callStart = (timestamp: Timestamp) => {\n animation.onStart(animation, value, timestamp, lastAnimation);\n };\n animation.callStart(getTimestamp());\n animation.callStart = null;\n } else if (typeof animatedProp === 'object') {\n // it is an object\n Object.keys(animatedProp).forEach((key) =>\n prepareAnimation(\n animatedProp[key],\n lastAnimation && lastAnimation[key],\n lastValue && lastValue[key]\n )\n );\n }\n}\n\nfunction runAnimations(\n animation: AnimatedStyle,\n timestamp: Timestamp,\n key: number | string,\n result: AnimatedStyle,\n animationsActive: SharedValue<boolean>\n): boolean {\n 'worklet';\n if (!animationsActive.value) {\n return true;\n }\n if (Array.isArray(animation)) {\n result[key] = [];\n let allFinished = true;\n animation.forEach((entry, index) => {\n if (\n !runAnimations(entry, timestamp, index, result[key], animationsActive)\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else if (typeof animation === 'object' && animation.onFrame) {\n let finished = true;\n if (!animation.finished) {\n if (animation.callStart) {\n animation.callStart(timestamp);\n animation.callStart = null;\n }\n finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n if (finished) {\n animation.finished = true;\n animation.callback && animation.callback(true /* finished */);\n }\n }\n result[key] = animation.current;\n return finished;\n } else if (typeof animation === 'object') {\n result[key] = {};\n let allFinished = true;\n Object.keys(animation).forEach((k) => {\n if (\n !runAnimations(\n animation[k],\n timestamp,\n k,\n result[key],\n animationsActive\n )\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else {\n result[key] = animation;\n return true;\n }\n}\n\nfunction styleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: BasicWorkletFunction<AnimatedStyle>,\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>\n): void {\n 'worklet';\n const animations = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n let hasAnimations = false;\n for (const key in newValues) {\n const value = newValues[key];\n if (isAnimated(value)) {\n prepareAnimation(value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n } else {\n delete animations[key];\n }\n }\n\n if (hasAnimations) {\n const frame = (_timestamp?: Timestamp) => {\n const { animations, last, isAnimationCancelled } = state;\n const timestamp = _timestamp ?? getTimestamp();\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle = {};\n let allFinished = true;\n for (const propName in animations) {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n }\n\n if (updates) {\n updateProps(viewDescriptors, updates, maybeViewRef);\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n };\n\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n if (_frameTimestamp) {\n frame(_frameTimestamp);\n } else {\n requestAnimationFrame(frame);\n }\n }\n state.last = Object.assign({}, oldValues, newValues);\n const style = getStyleWithoutAnimations(state.last);\n if (style) {\n updateProps(viewDescriptors, style, maybeViewRef);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n\n const diff = styleDiff(oldValues, newValues);\n state.last = Object.assign({}, oldValues, newValues);\n if (diff) {\n updateProps(viewDescriptors, newValues, maybeViewRef);\n }\n }\n}\n\nfunction jestStyleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: BasicWorkletFunction<AnimatedStyle>,\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: AdapterWorkletFunction[] = []\n): void {\n 'worklet';\n const animations: AnimatedStyle = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n // extract animated props\n let hasAnimations = false;\n Object.keys(animations).forEach((key) => {\n const value = newValues[key];\n if (!isAnimated(value)) {\n delete animations[key];\n }\n });\n Object.keys(newValues).forEach((key) => {\n const value = newValues[key];\n if (isAnimated(value)) {\n prepareAnimation(value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n }\n });\n\n function frame(_timestamp?: Timestamp) {\n const { animations, last, isAnimationCancelled } = state;\n const timestamp = _timestamp ?? getTimestamp();\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle = {};\n let allFinished = true;\n Object.keys(animations).forEach((propName) => {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n });\n\n if (Object.keys(updates).length) {\n updatePropsJestWrapper(\n viewDescriptors,\n updates,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n }\n\n if (hasAnimations) {\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n if (_frameTimestamp) {\n frame(_frameTimestamp);\n } else {\n requestAnimationFrame(frame);\n }\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n }\n\n // calculate diff\n const diff = styleDiff(oldValues, newValues);\n state.last = Object.assign({}, oldValues, newValues);\n\n if (Object.keys(diff).length !== 0) {\n updatePropsJestWrapper(\n viewDescriptors,\n diff,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n}\n\n// check for invalid usage of shared values in returned object\nfunction checkSharedValueUsage(\n prop: NestedObjectValues<AnimationObject>,\n currentKey?: string\n): void {\n if (Array.isArray(prop)) {\n // if it's an array (i.ex. transform) validate all its elements\n for (const element of prop) {\n checkSharedValueUsage(element, currentKey);\n }\n } else if (typeof prop === 'object' && prop.value === undefined) {\n // if it's a nested object, run validation for all its props\n for (const key of Object.keys(prop)) {\n checkSharedValueUsage(prop[key], key);\n }\n } else if (\n currentKey !== undefined &&\n typeof prop === 'object' &&\n prop.value !== undefined\n ) {\n // if shared value is passed insted of its value, throw an error\n throw new Error(\n `invalid value passed to \\`${currentKey}\\`, maybe you forgot to use \\`.value\\`?`\n );\n }\n}\n\nexport function useAnimatedStyle<T extends AnimatedStyle>(\n updater: BasicWorkletFunction<T>,\n dependencies?: DependencyList,\n adapters?: AdapterWorkletFunction | AdapterWorkletFunction[]\n): AnimatedStyleResult {\n const viewsRef: ViewRefSet<any> = makeViewsRefSet();\n const initRef = useRef<AnimationRef>();\n const inputs = Object.values(updater._closure ?? {});\n const adaptersArray: AdapterWorkletFunction[] = adapters\n ? Array.isArray(adapters)\n ? adapters\n : [adapters]\n : [];\n const adaptersHash = adapters ? buildWorkletsHash(adaptersArray) : null;\n const animationsActive = useSharedValue<boolean>(true);\n const animatedStyle: MutableRefObject<AnimatedStyle> = useRef<AnimatedStyle>(\n {}\n );\n\n // build dependencies\n if (!dependencies) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n adaptersHash && dependencies.push(adaptersHash);\n\n if (!initRef.current) {\n const initialStyle: AnimatedStyle = initialUpdaterRun(updater);\n validateAnimatedStyles(initialStyle);\n initRef.current = {\n initial: {\n value: initialStyle,\n updater: updater,\n },\n remoteState: makeRemote<AnimatedState>({\n last: initialStyle,\n animations: {},\n isAnimationCancelled: false,\n isAnimationRunning: false,\n }),\n viewDescriptors: makeViewDescriptorsSet(),\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { initial, remoteState, viewDescriptors } = initRef.current!;\n const sharableViewDescriptors = viewDescriptors.sharableViewDescriptors;\n const maybeViewRef = NativeReanimatedModule.native ? undefined : viewsRef;\n\n dependencies.push(sharableViewDescriptors);\n\n useEffect(() => {\n let fun;\n let updaterFn = updater as BasicWorkletFunctionOptional<T>;\n if (adapters) {\n updaterFn = () => {\n 'worklet';\n const newValues = updater();\n adaptersArray.forEach((adapter) => {\n adapter(newValues);\n });\n return newValues;\n };\n }\n\n if (isJest()) {\n fun = () => {\n 'worklet';\n jestStyleUpdater(\n sharableViewDescriptors,\n updater,\n remoteState,\n maybeViewRef,\n animationsActive,\n animatedStyle,\n adaptersArray\n );\n };\n } else {\n fun = () => {\n 'worklet';\n styleUpdater(\n sharableViewDescriptors,\n updaterFn,\n remoteState,\n maybeViewRef,\n animationsActive\n );\n };\n }\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n\n useEffect(() => {\n animationsActive.value = true;\n return () => {\n // initRef.current = null;\n // viewsRef = null;\n animationsActive.value = false;\n };\n }, []);\n\n checkSharedValueUsage(initial.value);\n\n if (process.env.JEST_WORKER_ID) {\n return { viewDescriptors, initial: initial, viewsRef, animatedStyle };\n } else {\n return { viewDescriptors, initial: initial, viewsRef };\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AAMA;;;;;;;;AAtBA;AAwDA,SAASA,gBAAT,CACEC,YADF,EAEEC,aAFF,EAGEC,SAHF,EAIQ;EACN;;EACA,IAAIC,KAAK,CAACC,OAAN,CAAcJ,YAAd,CAAJ,EAAiC;IAC/BA,YAAY,CAACK,OAAb,CAAqB,CAACC,IAAD,EAAOC,KAAP,KAAiB;MACpCR,gBAAgB,CACdO,IADc,EAEdL,aAAa,IAAIA,aAAa,CAACM,KAAD,CAFhB,EAGdL,SAAS,IAAIA,SAAS,CAACK,KAAD,CAHR,CAAhB;IAKD,CAND,EAD+B,CAQ/B;EACD;;EACD,IAAI,OAAOP,YAAP,KAAwB,QAAxB,IAAoCA,YAAY,CAACQ,OAArD,EAA8D;IAC5D,MAAMC,SAAS,GAAGT,YAAlB;IAEA,IAAIU,KAAK,GAAGD,SAAS,CAACE,OAAtB;;IACA,IAAIT,SAAS,KAAKU,SAAlB,EAA6B;MAC3B,IAAI,OAAOV,SAAP,KAAqB,QAAzB,EAAmC;QACjC,IAAIA,SAAS,CAACQ,KAAV,KAAoBE,SAAxB,EAAmC;UACjC;UACAF,KAAK,GAAGR,SAAS,CAACQ,KAAlB;QACD,CAHD,MAGO,IAAIR,SAAS,CAACM,OAAV,KAAsBI,SAA1B,EAAqC;UAC1C,IAAI,CAAAX,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEU,OAAf,MAA2BC,SAA/B,EAA0C;YACxC;YACAF,KAAK,GAAGT,aAAa,CAACU,OAAtB;UACD,CAHD,MAGO,IAAI,CAAAT,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAES,OAAX,MAAuBC,SAA3B,EAA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