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.
Files changed (72) hide show
  1. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +17 -12
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.h +2 -2
  3. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +2 -2
  4. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +30 -0
  5. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +1 -1
  6. package/Common/cpp/SharedItems/Shareables.cpp +3 -1
  7. package/Common/cpp/SharedItems/Shareables.h +37 -22
  8. package/Common/cpp/Tools/RuntimeDecorator.cpp +26 -25
  9. package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
  10. package/ios/LayoutReanimation/REAAnimationsManager.h +3 -1
  11. package/ios/LayoutReanimation/REAAnimationsManager.m +49 -16
  12. package/ios/LayoutReanimation/REAUIManager.mm +22 -62
  13. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +2 -2
  14. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  15. package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
  16. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  17. package/lib/commonjs/reanimated2/core.js +6 -74
  18. package/lib/commonjs/reanimated2/core.js.map +1 -1
  19. package/lib/commonjs/reanimated2/errors.js +66 -0
  20. package/lib/commonjs/reanimated2/errors.js.map +1 -0
  21. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  22. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +0 -10
  23. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  24. package/lib/commonjs/reanimated2/initializers.js +157 -0
  25. package/lib/commonjs/reanimated2/initializers.js.map +1 -0
  26. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +1 -6
  27. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  28. package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -7
  29. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  30. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +0 -4
  31. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  32. package/lib/commonjs/reanimated2/mock.js +26 -0
  33. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  34. package/lib/commonjs/reanimated2/shareables.js +6 -0
  35. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  36. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +2 -2
  37. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  38. package/lib/module/reanimated2/component/FlatList.js +18 -4
  39. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  40. package/lib/module/reanimated2/core.js +3 -74
  41. package/lib/module/reanimated2/core.js.map +1 -1
  42. package/lib/module/reanimated2/errors.js +58 -0
  43. package/lib/module/reanimated2/errors.js.map +1 -0
  44. package/lib/module/reanimated2/globals.d.js.map +1 -1
  45. package/lib/module/reanimated2/hook/useAnimatedStyle.js +2 -12
  46. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  47. package/lib/module/reanimated2/initializers.js +143 -0
  48. package/lib/module/reanimated2/initializers.js.map +1 -0
  49. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +1 -6
  50. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  51. package/lib/module/reanimated2/js-reanimated/global.js +4 -7
  52. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  53. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +0 -2
  54. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  55. package/lib/module/reanimated2/mock.js +26 -0
  56. package/lib/module/reanimated2/mock.js.map +1 -1
  57. package/lib/module/reanimated2/shareables.js +6 -1
  58. package/lib/module/reanimated2/shareables.js.map +1 -1
  59. package/package.json +3 -2
  60. package/plugin.js +81 -15
  61. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +11 -2
  62. package/src/reanimated2/component/FlatList.tsx +30 -5
  63. package/src/reanimated2/core.ts +3 -66
  64. package/src/reanimated2/errors.ts +57 -0
  65. package/src/reanimated2/globals.d.ts +22 -3
  66. package/src/reanimated2/hook/useAnimatedStyle.ts +1 -11
  67. package/src/reanimated2/initializers.ts +143 -0
  68. package/src/reanimated2/js-reanimated/JSReanimated.ts +8 -4
  69. package/src/reanimated2/js-reanimated/global.ts +4 -7
  70. package/src/reanimated2/layoutReanimation/animationsManager.ts +0 -3
  71. package/src/reanimated2/mock.ts +105 -0
  72. package/src/reanimated2/shareables.ts +7 -0
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initializeUIRuntime = initializeUIRuntime;
7
+
8
+ var _errors = require("./errors");
9
+
10
+ var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
11
+
12
+ var _PlatformChecker = require("./PlatformChecker");
13
+
14
+ var _threads = require("./threads");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ // callGuard is only used with debug builds
19
+ function callGuardDEV(fn) {
20
+ 'worklet';
21
+
22
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
23
+ args[_key - 1] = arguments[_key];
24
+ }
25
+
26
+ try {
27
+ fn(...args);
28
+ } catch (e) {
29
+ if (global.ErrorUtils) {
30
+ global.ErrorUtils.reportFatalError(e);
31
+ } else {
32
+ throw e;
33
+ }
34
+ }
35
+ }
36
+
37
+ function valueUnpacker(objectToUnpack, category) {
38
+ 'worklet';
39
+
40
+ let workletsCache = global.__workletsCache;
41
+ let handleCache = global.__handleCache;
42
+
43
+ if (workletsCache === undefined) {
44
+ // init
45
+ workletsCache = global.__workletsCache = new Map();
46
+ handleCache = global.__handleCache = new WeakMap();
47
+ }
48
+
49
+ if (objectToUnpack.__workletHash) {
50
+ let workletFun = workletsCache.get(objectToUnpack.__workletHash);
51
+
52
+ if (workletFun === undefined) {
53
+ if (global.evalWithSourceMap) {
54
+ // if the runtime (hermes only for now) supports loading source maps
55
+ // we want to use the proper filename for the location as it guarantees
56
+ // that debugger understands and loads the source code of the file where
57
+ // the worklet is defined.
58
+ workletFun = global.evalWithSourceMap('(' + objectToUnpack.asString + '\n)', objectToUnpack.__location, objectToUnpack.__sourceMap);
59
+ } else if (global.evalWithSourceUrl) {
60
+ // if the runtime doesn't support loading source maps, in dev mode we
61
+ // can pass source url when evaluating the worklet. Now, instead of using
62
+ // the actual file location we use worklet hash, as it the allows us to
63
+ // properly symbolicate traces (see errors.ts for details)
64
+ workletFun = global.evalWithSourceUrl('(' + objectToUnpack.asString + '\n)', `worklet_${objectToUnpack.__workletHash}`);
65
+ } else {
66
+ // in release we use the regular eval to save on JSI calls
67
+ // eslint-disable-next-line no-eval
68
+ workletFun = eval('(' + objectToUnpack.asString + '\n)');
69
+ }
70
+
71
+ workletsCache.set(objectToUnpack.__workletHash, workletFun);
72
+ }
73
+
74
+ const functionInstance = workletFun.bind(objectToUnpack);
75
+ objectToUnpack._recur = functionInstance;
76
+ return functionInstance;
77
+ } else if (objectToUnpack.__init) {
78
+ let value = handleCache.get(objectToUnpack);
79
+
80
+ if (value === undefined) {
81
+ value = objectToUnpack.__init();
82
+ handleCache.set(objectToUnpack, value);
83
+ }
84
+
85
+ return value;
86
+ } else if (category === 'RemoteFunction') {
87
+ const fun = () => {
88
+ throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.
89
+
90
+ Possible solutions are:
91
+ a) If you want to synchronously execute this method, mark it as a worklet
92
+ b) If you want to execute this function on the JS thread, wrap it using \`runOnJS\``);
93
+ };
94
+
95
+ fun.__remoteFunction = objectToUnpack;
96
+ return fun;
97
+ } else {
98
+ throw new Error('data type not recognized by unpack method');
99
+ }
100
+ }
101
+
102
+ function initializeUIRuntime() {
103
+ _NativeReanimated.default.installCoreFunctions(callGuardDEV, valueUnpacker);
104
+
105
+ const IS_JEST = (0, _PlatformChecker.isJest)();
106
+ const capturableConsole = console;
107
+ (0, _threads.runOnUI)(() => {
108
+ 'worklet'; // setup error handler
109
+
110
+ global.ErrorUtils = {
111
+ reportFatalError: error => {
112
+ (0, _threads.runOnJS)(_errors.reportFatalErrorOnJS)({
113
+ message: error.message,
114
+ stack: error.stack
115
+ });
116
+ }
117
+ }; // setup console
118
+ // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version
119
+
120
+ global.console = {
121
+ debug: (0, _threads.runOnJS)(capturableConsole.debug),
122
+ log: (0, _threads.runOnJS)(capturableConsole.log),
123
+ warn: (0, _threads.runOnJS)(capturableConsole.warn),
124
+ error: (0, _threads.runOnJS)(capturableConsole.error),
125
+ info: (0, _threads.runOnJS)(capturableConsole.info)
126
+ };
127
+
128
+ if (!IS_JEST) {
129
+ // Jest mocks requestAnimationFrame API and it does not like if that mock gets overridden
130
+ // so we avoid doing requestAnimationFrame batching in Jest environment.
131
+ const nativeRequestAnimationFrame = global.requestAnimationFrame;
132
+ let callbacks = [];
133
+
134
+ global.requestAnimationFrame = callback => {
135
+ callbacks.push(callback);
136
+
137
+ if (callbacks.length === 1) {
138
+ // We schedule native requestAnimationFrame only when the first callback
139
+ // is added and then use it to execute all the enqueued callbacks. Once
140
+ // the callbacks are run, we clear the array.
141
+ nativeRequestAnimationFrame(timestamp => {
142
+ const currentCallbacks = callbacks;
143
+ callbacks = [];
144
+ currentCallbacks.forEach(f => f(timestamp));
145
+ });
146
+ } // Reanimated currently does not support cancelling calbacks requested with
147
+ // requestAnimationFrame. We return -1 as identifier which isn't in line
148
+ // with the spec but it should give users better clue in case they actually
149
+ // attempt to store the value returned from rAF and use it for cancelling.
150
+
151
+
152
+ return -1;
153
+ };
154
+ }
155
+ })();
156
+ }
157
+ //# sourceMappingURL=initializers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["callGuardDEV","fn","args","e","global","ErrorUtils","reportFatalError","valueUnpacker","objectToUnpack","category","workletsCache","__workletsCache","handleCache","__handleCache","undefined","Map","WeakMap","__workletHash","workletFun","get","evalWithSourceMap","asString","__location","__sourceMap","evalWithSourceUrl","eval","set","functionInstance","bind","_recur","__init","value","fun","Error","__remoteFunction","initializeUIRuntime","NativeReanimatedModule","installCoreFunctions","IS_JEST","isJest","capturableConsole","console","runOnUI","error","runOnJS","reportFatalErrorOnJS","message","stack","debug","log","warn","info","nativeRequestAnimationFrame","requestAnimationFrame","callbacks","callback","push","length","timestamp","currentCallbacks","forEach","f"],"sources":["initializers.ts"],"sourcesContent":["import { reportFatalErrorOnJS } from './errors';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { isJest } from './PlatformChecker';\nimport { runOnUI, runOnJS } from './threads';\n\n// callGuard is only used with debug builds\nfunction callGuardDEV<T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n): void {\n 'worklet';\n try {\n fn(...args);\n } catch (e) {\n if (global.ErrorUtils) {\n global.ErrorUtils.reportFatalError(e as Error);\n } else {\n throw e;\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 if (global.evalWithSourceMap) {\n // if the runtime (hermes only for now) supports loading source maps\n // we want to use the proper filename for the location as it guarantees\n // that debugger understands and loads the source code of the file where\n // the worklet is defined.\n workletFun = global.evalWithSourceMap(\n '(' + objectToUnpack.asString + '\\n)',\n objectToUnpack.__location,\n objectToUnpack.__sourceMap\n ) as (...args: any[]) => any;\n } else if (global.evalWithSourceUrl) {\n // if the runtime doesn't support loading source maps, in dev mode we\n // can pass source url when evaluating the worklet. Now, instead of using\n // the actual file location we use worklet hash, as it the allows us to\n // properly symbolicate traces (see errors.ts for details)\n workletFun = global.evalWithSourceUrl(\n '(' + objectToUnpack.asString + '\\n)',\n `worklet_${objectToUnpack.__workletHash}`\n ) as (...args: any[]) => any;\n } else {\n // in release we use the regular eval to save on JSI calls\n // eslint-disable-next-line no-eval\n workletFun = eval('(' + objectToUnpack.asString + '\\n)') as (\n ...args: any[]\n ) => any;\n }\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 initializeUIRuntime() {\n NativeReanimatedModule.installCoreFunctions(callGuardDEV, valueUnpacker);\n\n const IS_JEST = isJest();\n\n const capturableConsole = console;\n runOnUI(() => {\n 'worklet';\n // setup error handler\n global.ErrorUtils = {\n reportFatalError: (error: Error) => {\n runOnJS(reportFatalErrorOnJS)({\n message: error.message,\n stack: error.stack,\n });\n },\n };\n\n // setup console\n // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version\n global.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\n if (!IS_JEST) {\n // Jest mocks requestAnimationFrame API and it does not like if that mock gets overridden\n // so we avoid doing requestAnimationFrame batching in Jest environment.\n const nativeRequestAnimationFrame = global.requestAnimationFrame;\n let callbacks: Array<(time: number) => void> = [];\n global.requestAnimationFrame = (\n callback: (timestamp: number) => void\n ): number => {\n callbacks.push(callback);\n if (callbacks.length === 1) {\n // We schedule native requestAnimationFrame only when the first callback\n // is added and then use it to execute all the enqueued callbacks. Once\n // the callbacks are run, we clear the array.\n nativeRequestAnimationFrame((timestamp) => {\n const currentCallbacks = callbacks;\n callbacks = [];\n currentCallbacks.forEach((f) => f(timestamp));\n });\n }\n // Reanimated currently does not support cancelling calbacks requested with\n // requestAnimationFrame. We return -1 as identifier which isn't in line\n // with the spec but it should give users better clue in case they actually\n // attempt to store the value returned from rAF and use it for cancelling.\n return -1;\n };\n }\n })();\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA;AACA,SAASA,YAAT,CACEC,EADF,EAGQ;EACN;;EADM,kCADHC,IACG;IADHA,IACG;EAAA;;EAEN,IAAI;IACFD,EAAE,CAAC,GAAGC,IAAJ,CAAF;EACD,CAFD,CAEE,OAAOC,CAAP,EAAU;IACV,IAAIC,MAAM,CAACC,UAAX,EAAuB;MACrBD,MAAM,CAACC,UAAP,CAAkBC,gBAAlB,CAAmCH,CAAnC;IACD,CAFD,MAEO;MACL,MAAMA,CAAN;IACD;EACF;AACF;;AAED,SAASI,aAAT,CAAuBC,cAAvB,EAA4CC,QAA5C,EAAoE;EAClE;;EACA,IAAIC,aAAa,GAAGN,MAAM,CAACO,eAA3B;EACA,IAAIC,WAAW,GAAGR,MAAM,CAACS,aAAzB;;EACA,IAAIH,aAAa,KAAKI,SAAtB,EAAiC;IAC/B;IACAJ,aAAa,GAAGN,MAAM,CAACO,eAAP,GAAyB,IAAII,GAAJ,EAAzC;IACAH,WAAW,GAAGR,MAAM,CAACS,aAAP,GAAuB,IAAIG,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AAwC,GAAG,EAA/C;;MACAlD,MAAM,CAACiD,qBAAP,GACEE,QAD6B,IAElB;QACXD,SAAS,CAACE,IAAV,CAAeD,QAAf;;QACA,IAAID,SAAS,CAACG,MAAV,KAAqB,CAAzB,EAA4B;UAC1B;UACA;UACA;UACAL,2BAA2B,CAAEM,SAAD,IAAe;YACzC,MAAMC,gBAAgB,GAAGL,SAAzB;YACAA,SAAS,GAAG,EAAZ;YACAK,gBAAgB,CAACC,OAAjB,CAA0BC,CAAD,IAAOA,CAAC,CAACH,SAAD,CAAjC;UACD,CAJ0B,CAA3B;QAKD,CAXU,CAYX;QACA;QACA;QACA;;;QACA,OAAO,CAAC,CAAR;MACD,CAnBD;IAoBD;EACF,CAhDD;AAiDD"}
@@ -9,14 +9,10 @@ var _NativeReanimated = require("../NativeReanimated/NativeReanimated");
9
9
 
10
10
  var _PlatformChecker = require("../PlatformChecker");
11
11
 
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
-
14
12
  class JSReanimated extends _NativeReanimated.NativeReanimated {
15
13
  constructor() {
16
14
  super(false);
17
15
 
18
- _defineProperty(this, "_valueUnpacker", undefined);
19
-
20
16
  if ((0, _PlatformChecker.isJest)()) {
21
17
  // on node < 16 jest have problems mocking performance.now method which
22
18
  // results in the tests failing, since date precision isn't that important
@@ -33,8 +29,7 @@ class JSReanimated extends _NativeReanimated.NativeReanimated {
33
29
  };
34
30
  }
35
31
 
36
- installCoreFunctions(valueUnpacker) {
37
- this._valueUnpacker = valueUnpacker;
32
+ installCoreFunctions(_callGuard, _valueUnpacker) {// noop
38
33
  }
39
34
 
40
35
  scheduleOnUI(worklet) {
@@ -1 +1 @@
1
- {"version":3,"names":["JSReanimated","NativeReanimated","constructor","undefined","isJest","getTimestamp","Date","now","window","performance","makeShareableClone","value","__hostObjectShareableJSRef","installCoreFunctions","valueUnpacker","_valueUnpacker","scheduleOnUI","worklet","requestAnimationFrame","registerEventHandler","_eventHash","_eventHandler","unregisterEventHandler","_","enableLayoutAnimations","console","warn","registerSensor","unregisterSensor","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents"],"sources":["JSReanimated.ts"],"sourcesContent":["import { NativeReanimated } from '../NativeReanimated/NativeReanimated';\nimport { ShareableRef } from '../commonTypes';\nimport { isJest } from '../PlatformChecker';\n\nexport default class JSReanimated extends NativeReanimated {\n _valueUnpacker?: <T>(value: T) => void = undefined;\n\n constructor() {\n super(false);\n if (isJest()) {\n // on node < 16 jest have problems mocking performance.now method which\n // results in the tests failing, since date precision isn't that important\n // for tests, we use Date.now instead\n this.getTimestamp = () => Date.now();\n } else {\n this.getTimestamp = () => window.performance.now();\n }\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return { __hostObjectShareableJSRef: value };\n }\n\n installCoreFunctions(valueUnpacker: <T>(value: T) => T): void {\n this._valueUnpacker = valueUnpacker;\n }\n\n scheduleOnUI<T>(worklet: ShareableRef<T>) {\n // @ts-ignore web implementation has still not been updated after the rewrite, this will be addressed once the web implementation updates are ready\n requestAnimationFrame(worklet);\n }\n\n registerEventHandler<T>(\n _eventHash: string,\n _eventHandler: ShareableRef<T>\n ): string {\n // noop\n return '';\n }\n\n unregisterEventHandler(_: string): void {\n // noop\n }\n\n enableLayoutAnimations() {\n console.warn(\n '[Reanimated] enableLayoutAnimations is not available for WEB yet'\n );\n }\n\n registerSensor(): number {\n console.warn('[Reanimated] useAnimatedSensor is not available on web yet.');\n return -1;\n }\n\n unregisterSensor(): void {\n // noop\n }\n\n subscribeForKeyboardEvents(_: ShareableRef<number>): number {\n console.warn(\n '[Reanimated] useAnimatedKeyboard is not available on web yet.'\n );\n return -1;\n }\n\n unsubscribeFromKeyboardEvents(_: number): void {\n // noop\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEe,MAAMA,YAAN,SAA2BC,kCAA3B,CAA4C;EAGzDC,WAAW,GAAG;IACZ,MAAM,KAAN;;IADY,wCAF2BC,SAE3B;;IAEZ,IAAI,IAAAC,uBAAA,GAAJ,EAAc;MACZ;MACA;MACA;MACA,KAAKC,YAAL,GAAoB,MAAMC,IAAI,CAACC,GAAL,EAA1B;IACD,CALD,MAKO;MACL,KAAKF,YAAL,GAAoB,MAAMG,MAAM,CAACC,WAAP,CAAmBF,GAAnB,EAA1B;IACD;EACF;;EAEDG,kBAAkB,CAAIC,KAAJ,EAA+B;IAC/C,OAAO;MAAEC,0BAA0B,EAAED;IAA9B,CAAP;EACD;;EAEDE,oBAAoB,CAACC,aAAD,EAA0C;IAC5D,KAAKC,cAAL,GAAsBD,aAAtB;EACD;;EAEDE,YAAY,CAAIC,OAAJ,EAA8B;IACxC;IACAC,qBAAqB,CAACD,OAAD,CAArB;EACD;;EAEDE,oBAAoB,CAClBC,UADkB,EAElBC,aAFkB,EAGV;IACR;IACA,OAAO,EAAP;EACD;;EAEDC,sBAAsB,CAACC,CAAD,EAAkB,CACtC;EACD;;EAEDC,sBAAsB,GAAG;IACvBC,OAAO,CAACC,IAAR,CACE,kEADF;EAGD;;EAEDC,cAAc,GAAW;IACvBF,OAAO,CAACC,IAAR,CAAa,6DAAb;IACA,OAAO,CAAC,CAAR;EACD;;EAEDE,gBAAgB,GAAS,CACvB;EACD;;EAEDC,0BAA0B,CAACN,CAAD,EAAkC;IAC1DE,OAAO,CAACC,IAAR,CACE,+DADF;IAGA,OAAO,CAAC,CAAR;EACD;;EAEDI,6BAA6B,CAACP,CAAD,EAAkB,CAC7C;EACD;;AAhEwD"}
1
+ {"version":3,"names":["JSReanimated","NativeReanimated","constructor","isJest","getTimestamp","Date","now","window","performance","makeShareableClone","value","__hostObjectShareableJSRef","installCoreFunctions","_callGuard","_valueUnpacker","scheduleOnUI","worklet","requestAnimationFrame","registerEventHandler","_eventHash","_eventHandler","unregisterEventHandler","_","enableLayoutAnimations","console","warn","registerSensor","unregisterSensor","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents"],"sources":["JSReanimated.ts"],"sourcesContent":["import { NativeReanimated } from '../NativeReanimated/NativeReanimated';\nimport { ShareableRef } from '../commonTypes';\nimport { isJest } from '../PlatformChecker';\n\nexport default class JSReanimated extends NativeReanimated {\n constructor() {\n super(false);\n if (isJest()) {\n // on node < 16 jest have problems mocking performance.now method which\n // results in the tests failing, since date precision isn't that important\n // for tests, we use Date.now instead\n this.getTimestamp = () => Date.now();\n } else {\n this.getTimestamp = () => window.performance.now();\n }\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return { __hostObjectShareableJSRef: value };\n }\n\n installCoreFunctions(\n _callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n _valueUnpacker: <T>(value: T) => T\n ): void {\n // noop\n }\n\n scheduleOnUI<T>(worklet: ShareableRef<T>) {\n // @ts-ignore web implementation has still not been updated after the rewrite, this will be addressed once the web implementation updates are ready\n requestAnimationFrame(worklet);\n }\n\n registerEventHandler<T>(\n _eventHash: string,\n _eventHandler: ShareableRef<T>\n ): string {\n // noop\n return '';\n }\n\n unregisterEventHandler(_: string): void {\n // noop\n }\n\n enableLayoutAnimations() {\n console.warn(\n '[Reanimated] enableLayoutAnimations is not available for WEB yet'\n );\n }\n\n registerSensor(): number {\n console.warn('[Reanimated] useAnimatedSensor is not available on web yet.');\n return -1;\n }\n\n unregisterSensor(): void {\n // noop\n }\n\n subscribeForKeyboardEvents(_: ShareableRef<number>): number {\n console.warn(\n '[Reanimated] useAnimatedKeyboard is not available on web yet.'\n );\n return -1;\n }\n\n unsubscribeFromKeyboardEvents(_: number): void {\n // noop\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEe,MAAMA,YAAN,SAA2BC,kCAA3B,CAA4C;EACzDC,WAAW,GAAG;IACZ,MAAM,KAAN;;IACA,IAAI,IAAAC,uBAAA,GAAJ,EAAc;MACZ;MACA;MACA;MACA,KAAKC,YAAL,GAAoB,MAAMC,IAAI,CAACC,GAAL,EAA1B;IACD,CALD,MAKO;MACL,KAAKF,YAAL,GAAoB,MAAMG,MAAM,CAACC,WAAP,CAAmBF,GAAnB,EAA1B;IACD;EACF;;EAEDG,kBAAkB,CAAIC,KAAJ,EAA+B;IAC/C,OAAO;MAAEC,0BAA0B,EAAED;IAA9B,CAAP;EACD;;EAEDE,oBAAoB,CAClBC,UADkB,EAKlBC,cALkB,EAMZ,CACN;EACD;;EAEDC,YAAY,CAAIC,OAAJ,EAA8B;IACxC;IACAC,qBAAqB,CAACD,OAAD,CAArB;EACD;;EAEDE,oBAAoB,CAClBC,UADkB,EAElBC,aAFkB,EAGV;IACR;IACA,OAAO,EAAP;EACD;;EAEDC,sBAAsB,CAACC,CAAD,EAAkB,CACtC;EACD;;EAEDC,sBAAsB,GAAG;IACvBC,OAAO,CAACC,IAAR,CACE,kEADF;EAGD;;EAEDC,cAAc,GAAW;IACvBF,OAAO,CAACC,IAAR,CAAa,6DAAb;IACA,OAAO,CAAC,CAAR;EACD;;EAEDE,gBAAgB,GAAS,CACvB;EACD;;EAEDC,0BAA0B,CAACN,CAAD,EAAkC;IAC1DE,OAAO,CAACC,IAAR,CACE,+DADF;IAGA,OAAO,CAAC,CAAR;EACD;;EAEDI,6BAA6B,CAACP,CAAD,EAAkB,CAC7C;EACD;;AApEwD"}
@@ -12,9 +12,6 @@ const initializeGlobalsForWeb = () => {
12
12
  if ((0, _PlatformChecker.shouldBeUseWeb)()) {
13
13
  global._frameTimestamp = null;
14
14
 
15
- global._setGlobalConsole = _val => {// noop
16
- };
17
-
18
15
  global._measure = () => {
19
16
  console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
20
17
  return {
@@ -43,10 +40,10 @@ const initializeGlobalsForWeb = () => {
43
40
  return true;
44
41
  };
45
42
  /*
46
- If a file doesn't export anything, tree shaking doesn't pack
47
- it into the JS bundle. In effect, the code inside of this file
48
- will never execute. That is why we wrapped initialization code
49
- into a function, and we call this one during creating
43
+ If a file doesn't export anything, tree shaking doesn't pack
44
+ it into the JS bundle. In effect, the code inside of this file
45
+ will never execute. That is why we wrapped initialization code
46
+ into a function, and we call this one during creating
50
47
  the module export object.
51
48
  */
52
49
 
@@ -1 +1 @@
1
- {"version":3,"names":["initializeGlobalsForWeb","shouldBeUseWeb","global","_frameTimestamp","_setGlobalConsole","_val","_measure","console","warn","x","y","width","height","pageX","pageY","_scrollTo","_dispatchCommand","_setGestureState"],"sources":["global.ts"],"sourcesContent":["// In order to keep bundle size down, we treat this file as a polyfill for Web.\n\nimport { shouldBeUseWeb } from '../PlatformChecker';\nconst initializeGlobalsForWeb = () => {\n if (shouldBeUseWeb()) {\n global._frameTimestamp = null;\n global._setGlobalConsole = (_val) => {\n // noop\n };\n global._measure = () => {\n console.warn(\n \"[Reanimated] You can't use `measure` with Chrome Debugger or with web version\"\n );\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n };\n };\n global._scrollTo = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version\"\n );\n };\n global._dispatchCommand = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` or `dispatchCommand` methods with Chrome Debugger or with web version\"\n );\n };\n global._setGestureState = () => {\n console.warn(\n \"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version\"\n );\n };\n }\n return true;\n};\n\n/*\n If a file doesn't export anything, tree shaking doesn't pack \n it into the JS bundle. In effect, the code inside of this file \n will never execute. That is why we wrapped initialization code \n into a function, and we call this one during creating \n the module export object.\n*/\n\nexport default initializeGlobalsForWeb();\n"],"mappings":";;;;;;;AAEA;;AAFA;AAGA,MAAMA,uBAAuB,GAAG,MAAM;EACpC,IAAI,IAAAC,+BAAA,GAAJ,EAAsB;IACpBC,MAAM,CAACC,eAAP,GAAyB,IAAzB;;IACAD,MAAM,CAACE,iBAAP,GAA4BC,IAAD,IAAU,CACnC;IACD,CAFD;;IAGAH,MAAM,CAACI,QAAP,GAAkB,MAAM;MACtBC,OAAO,CAACC,IAAR,CACE,+EADF;MAGA,OAAO;QACLC,CAAC,EAAE,CADE;QAELC,CAAC,EAAE,CAFE;QAGLC,KAAK,EAAE,CAHF;QAILC,MAAM,EAAE,CAJH;QAKLC,KAAK,EAAE,CALF;QAMLC,KAAK,EAAE;MANF,CAAP;IAQD,CAZD;;IAaAZ,MAAM,CAACa,SAAP,GAAmB,MAAM;MACvBR,OAAO,CAACC,IAAR,CACE,gFADF;IAGD,CAJD;;IAKAN,MAAM,CAACc,gBAAP,GAA0B,MAAM;MAC9BT,OAAO,CAACC,IAAR,CACE,6GADF;IAGD,CAJD;;IAKAN,MAAM,CAACe,gBAAP,GAA0B,MAAM;MAC9BV,OAAO,CAACC,IAAR,CACE,uFADF;IAGD,CAJD;EAKD;;EACD,OAAO,IAAP;AACD,CApCD;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;;;eAEeR,uBAAuB,E"}
1
+ {"version":3,"names":["initializeGlobalsForWeb","shouldBeUseWeb","global","_frameTimestamp","_measure","console","warn","x","y","width","height","pageX","pageY","_scrollTo","_dispatchCommand","_setGestureState"],"sources":["global.ts"],"sourcesContent":["// In order to keep bundle size down, we treat this file as a polyfill for Web.\n\nimport { shouldBeUseWeb } from '../PlatformChecker';\nconst initializeGlobalsForWeb = () => {\n if (shouldBeUseWeb()) {\n global._frameTimestamp = null;\n global._measure = () => {\n console.warn(\n \"[Reanimated] You can't use `measure` with Chrome Debugger or with web version\"\n );\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n };\n };\n global._scrollTo = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version\"\n );\n };\n global._dispatchCommand = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` or `dispatchCommand` methods with Chrome Debugger or with web version\"\n );\n };\n global._setGestureState = () => {\n console.warn(\n \"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version\"\n );\n };\n }\n return true;\n};\n\n/*\n If a file doesn't export anything, tree shaking doesn't pack\n it into the JS bundle. In effect, the code inside of this file\n will never execute. That is why we wrapped initialization code\n into a function, and we call this one during creating\n the module export object.\n*/\n\nexport default initializeGlobalsForWeb();\n"],"mappings":";;;;;;;AAEA;;AAFA;AAGA,MAAMA,uBAAuB,GAAG,MAAM;EACpC,IAAI,IAAAC,+BAAA,GAAJ,EAAsB;IACpBC,MAAM,CAACC,eAAP,GAAyB,IAAzB;;IACAD,MAAM,CAACE,QAAP,GAAkB,MAAM;MACtBC,OAAO,CAACC,IAAR,CACE,+EADF;MAGA,OAAO;QACLC,CAAC,EAAE,CADE;QAELC,CAAC,EAAE,CAFE;QAGLC,KAAK,EAAE,CAHF;QAILC,MAAM,EAAE,CAJH;QAKLC,KAAK,EAAE,CALF;QAMLC,KAAK,EAAE;MANF,CAAP;IAQD,CAZD;;IAaAV,MAAM,CAACW,SAAP,GAAmB,MAAM;MACvBR,OAAO,CAACC,IAAR,CACE,gFADF;IAGD,CAJD;;IAKAJ,MAAM,CAACY,gBAAP,GAA0B,MAAM;MAC9BT,OAAO,CAACC,IAAR,CACE,6GADF;IAGD,CAJD;;IAKAJ,MAAM,CAACa,gBAAP,GAA0B,MAAM;MAC9BV,OAAO,CAACC,IAAR,CACE,uFADF;IAGD,CAJD;EAKD;;EACD,OAAO,IAAP;AACD,CAjCD;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;;;eAEeN,uBAAuB,E"}
@@ -4,12 +4,8 @@ var _core = require("../core");
4
4
 
5
5
  var _styleAnimation = require("../animation/styleAnimation");
6
6
 
7
- var _reactNative = require("react-native");
8
-
9
7
  var _mutables = require("../mutables");
10
8
 
11
- _reactNative.LogBox.ignoreLogs(['Overriding previous layout animation with']);
12
-
13
9
  const TAG_OFFSET = 1e9;
14
10
 
15
11
  function startObservingProgress(tag, sharedValue) {
@@ -1 +1 @@
1
- {"version":3,"names":["LogBox","ignoreLogs","TAG_OFFSET","startObservingProgress","tag","sharedValue","addListener","_notifyAboutProgress","value","stopObservingProgress","cancelled","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","enteringAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","set","enteringAnimation","get","undefined","makeUIMutable","initialValues","_value","animation","withStyleAnimation","callback","finished","delete","shouldRemoveView","runOnUI","global","LayoutAnimationsManager"],"sources":["animationsManager.ts"],"sourcesContent":["import { runOnUI } from '../core';\nimport { withStyleAnimation } from '../animation/styleAnimation';\nimport { LogBox } from 'react-native';\nimport { SharedValue } from '../commonTypes';\nimport { makeUIMutable } from '../mutables';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationsValues,\n} from './animationBuilder';\n\nLogBox.ignoreLogs(['Overriding previous layout animation with']);\n\nconst TAG_OFFSET = 1e9;\n\nfunction startObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>\n): void {\n 'worklet';\n sharedValue.addListener(tag + TAG_OFFSET, () => {\n _notifyAboutProgress(tag, sharedValue.value);\n });\n}\n\nfunction stopObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n cancelled: boolean,\n removeView: boolean\n): void {\n 'worklet';\n sharedValue.removeListener(tag + TAG_OFFSET);\n _notifyAboutEnd(tag, cancelled, removeView);\n}\n\nfunction createLayoutAnimationManager() {\n 'worklet';\n const enteringAnimationForTag = new Map();\n const mutableValuesForTag = new Map();\n\n return {\n start(\n tag: number,\n type: string,\n yogaValues: LayoutAnimationsValues,\n config: LayoutAnimationFunction\n ) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === 'entering') {\n enteringAnimationForTag.set(tag, currentAnimation);\n } else if (type === 'layout') {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag.get(tag);\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n\n let value = mutableValuesForTag.get(tag);\n if (value === undefined) {\n value = makeUIMutable(style.initialValues);\n mutableValuesForTag.set(tag, value);\n } else {\n stopObservingProgress(tag, value, false, false);\n value._value = style.initialValues;\n }\n\n // @ts-ignore The line below started failing because I added types to the method – don't have time to fix it right now\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n enteringAnimationForTag.delete(tag);\n mutableValuesForTag.delete(tag);\n const shouldRemoveView = type === 'exiting';\n stopObservingProgress(tag, value, finished, shouldRemoveView);\n }\n style.callback &&\n style.callback(finished === undefined ? false : finished);\n };\n\n startObservingProgress(tag, value);\n value.value = animation;\n },\n };\n}\n\nrunOnUI(() => {\n 'worklet';\n global.LayoutAnimationsManager = createLayoutAnimationManager();\n})();\n"],"mappings":";;AAAA;;AACA;;AACA;;AAEA;;AAMAA,mBAAA,CAAOC,UAAP,CAAkB,CAAC,2CAAD,CAAlB;;AAEA,MAAMC,UAAU,GAAG,GAAnB;;AAEA,SAASC,sBAAT,CACEC,GADF,EAEEC,WAFF,EAGQ;EACN;;EACAA,WAAW,CAACC,WAAZ,CAAwBF,GAAG,GAAGF,UAA9B,EAA0C,MAAM;IAC9CK,oBAAoB,CAACH,GAAD,EAAMC,WAAW,CAACG,KAAlB,CAApB;EACD,CAFD;AAGD;;AAED,SAASC,qBAAT,CACEL,GADF,EAEEC,WAFF,EAGEK,SAHF,EAIEC,UAJF,EAKQ;EACN;;EACAN,WAAW,CAACO,cAAZ,CAA2BR,GAAG,GAAGF,UAAjC;;EACAW,eAAe,CAACT,GAAD,EAAMM,SAAN,EAAiBC,UAAjB,CAAf;AACD;;AAED,SAASG,4BAAT,GAAwC;EACtC;;EACA,MAAMC,uBAAuB,GAAG,IAAIC,GAAJ,EAAhC;EACA,MAAMC,mBAAmB,GAAG,IAAID,GAAJ,EAA5B;EAEA,OAAO;IACLE,KAAK,CACHd,GADG,EAEHe,IAFG,EAGHC,UAHG,EAIHC,MAJG,EAKH;MACA,MAAMC,KAAK,GAAGD,MAAM,CAACD,UAAD,CAApB;MACA,IAAIG,gBAAgB,GAAGD,KAA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B,GAAiCO,QAAhD,CADF;MAED,CATD;;MAWAhC,sBAAsB,CAACC,GAAD,EAAMI,KAAN,CAAtB;MACAA,KAAK,CAACA,KAAN,GAAcwB,SAAd;IACD;;EA9CI,CAAP;AAgDD;;AAED,IAAAM,aAAA,EAAQ,MAAM;EACZ;;EACAC,MAAM,CAACC,uBAAP,GAAiC1B,4BAA4B,EAA7D;AACD,CAHD"}
1
+ {"version":3,"names":["TAG_OFFSET","startObservingProgress","tag","sharedValue","addListener","_notifyAboutProgress","value","stopObservingProgress","cancelled","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","enteringAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","set","enteringAnimation","get","undefined","makeUIMutable","initialValues","_value","animation","withStyleAnimation","callback","finished","delete","shouldRemoveView","runOnUI","global","LayoutAnimationsManager"],"sources":["animationsManager.ts"],"sourcesContent":["import { runOnUI } from '../core';\nimport { withStyleAnimation } from '../animation/styleAnimation';\nimport { SharedValue } from '../commonTypes';\nimport { makeUIMutable } from '../mutables';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationsValues,\n} from './animationBuilder';\n\nconst TAG_OFFSET = 1e9;\n\nfunction startObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>\n): void {\n 'worklet';\n sharedValue.addListener(tag + TAG_OFFSET, () => {\n _notifyAboutProgress(tag, sharedValue.value);\n });\n}\n\nfunction stopObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n cancelled: boolean,\n removeView: boolean\n): void {\n 'worklet';\n sharedValue.removeListener(tag + TAG_OFFSET);\n _notifyAboutEnd(tag, cancelled, removeView);\n}\n\nfunction createLayoutAnimationManager() {\n 'worklet';\n const enteringAnimationForTag = new Map();\n const mutableValuesForTag = new Map();\n\n return {\n start(\n tag: number,\n type: string,\n yogaValues: LayoutAnimationsValues,\n config: LayoutAnimationFunction\n ) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === 'entering') {\n enteringAnimationForTag.set(tag, currentAnimation);\n } else if (type === 'layout') {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag.get(tag);\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n\n let value = mutableValuesForTag.get(tag);\n if (value === undefined) {\n value = makeUIMutable(style.initialValues);\n mutableValuesForTag.set(tag, value);\n } else {\n stopObservingProgress(tag, value, false, false);\n value._value = style.initialValues;\n }\n\n // @ts-ignore The line below started failing because I added types to the method – don't have time to fix it right now\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n enteringAnimationForTag.delete(tag);\n mutableValuesForTag.delete(tag);\n const shouldRemoveView = type === 'exiting';\n stopObservingProgress(tag, value, finished, shouldRemoveView);\n }\n style.callback &&\n style.callback(finished === undefined ? false : finished);\n };\n\n startObservingProgress(tag, value);\n value.value = animation;\n },\n };\n}\n\nrunOnUI(() => {\n 'worklet';\n global.LayoutAnimationsManager = createLayoutAnimationManager();\n})();\n"],"mappings":";;AAAA;;AACA;;AAEA;;AAMA,MAAMA,UAAU,GAAG,GAAnB;;AAEA,SAASC,sBAAT,CACEC,GADF,EAEEC,WAFF,EAGQ;EACN;;EACAA,WAAW,CAACC,WAAZ,CAAwBF,GAAG,GAAGF,UAA9B,EAA0C,MAAM;IAC9CK,oBAAoB,CAACH,GAAD,EAAMC,WAAW,CAACG,KAAlB,CAApB;EACD,CAFD;AAGD;;AAED,SAASC,qBAAT,CACEL,GADF,EAEEC,WAFF,EAGEK,SAHF,EAIEC,UAJF,EAKQ;EACN;;EACAN,WAAW,CAACO,cAAZ,CAA2BR,GAAG,GAAGF,UAAjC;;EACAW,eAAe,CAACT,GAAD,EAAMM,SAAN,EAAiBC,UAAjB,CAAf;AACD;;AAED,SAASG,4BAAT,GAAwC;EACtC;;EACA,MAAMC,uBAAuB,GAAG,IAAIC,GAAJ,EAAhC;EACA,MAAMC,m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lB,IAAI,KAAK,SAAlC;UACAV,qBAAqB,CAACL,GAAD,EAAMI,KAAN,EAAa2B,QAAb,EAAuBE,gBAAvB,CAArB;QACD;;QACDf,KAAK,CAACY,QAAN,IACEZ,KAAK,CAACY,QAAN,CAAeC,QAAQ,KAAKP,SAAb,GAAyB,KAAzB,GAAiCO,QAAhD,CADF;MAED,CATD;;MAWAhC,sBAAsB,CAACC,GAAD,EAAMI,KAAN,CAAtB;MACAA,KAAK,CAACA,KAAN,GAAcwB,SAAd;IACD;;EA9CI,CAAP;AAgDD;;AAED,IAAAM,aAAA,EAAQ,MAAM;EACZ;;EACAC,MAAM,CAACC,uBAAP,GAAiC1B,4BAA4B,EAA7D;AACD,CAHD"}
@@ -10,6 +10,29 @@ const ID = t => t;
10
10
 
11
11
  const IMMEDIATE_CB_INVOCATION = cb => cb();
12
12
 
13
+ class BaseAnimationMock {
14
+ duration(_) {
15
+ return this;
16
+ }
17
+
18
+ delay(_) {
19
+ return this;
20
+ }
21
+
22
+ withCallback(_) {
23
+ return this;
24
+ }
25
+
26
+ randomDelay() {
27
+ return this;
28
+ }
29
+
30
+ withInitialValues() {
31
+ return this;
32
+ }
33
+
34
+ }
35
+
13
36
  const ReanimatedV2 = {
14
37
  useSharedValue: v => ({
15
38
  value: v
@@ -83,6 +106,9 @@ const ReanimatedV2 = {
83
106
  runOnJS: fn => fn,
84
107
  runOnUI: fn => fn
85
108
  };
109
+ ['FadeIn', 'FadeInRight', 'FadeInLeft', 'FadeInUp', 'FadFadeInDown', 'FadeOut', 'FadeOutRight', 'FadeOutLeft', 'FadeOutUp', 'FadeOutDown', 'FlipInYLeft', 'FlipInXDown', 'FlipInYRight', 'FlipInEasyX', 'FlipInEasyY', 'FlipOutXUp', 'FlipOutYLeft', 'FlipOutXDown', 'FlipOutYRight', 'FlipOutEasyX', 'FlipOutEasyY', 'StretchInY', 'StretchOutX', 'StretchOutY', 'SlideInLeft', 'SlideOutRight', 'SlideOutLeft', 'SlideInUp', 'SlideInDown', 'SlideOutUp', 'ZoomInRotate', 'ZoomInLeft', 'ZoomInRight', 'ZoomInUp', 'ZoomInDown', 'ZoomInEasyUp', 'ZoomInEasyDown', 'ZoomOut', 'ZoomOutRotate', 'ZoomOutLeft', 'ZoomOutRight', 'ZoomOutUp', 'ZoomOutDown', 'ZoomOutEasyUp', 'ZoomOutEasyDown', 'BounceInDown', 'BounceInUp', 'BounceInLeft', 'BounceInRight', 'BounceOut', 'BounceOutDown', 'BounceOutUp', 'BounceOutLeft', 'BounceOutRight', 'LightSpeedInLeft', 'LightSpeedOutRight', 'LightSpeedOutLeft', 'PinwheelOut', 'RotateInDownRight', 'RotateInUpLeft', 'RotateInUpRight', 'RotateOutDownLeft', 'RotateOutDownRight', 'RotateOutUpLeft', 'RotateOutUpRight', 'RollInRight', 'RollOutLeft', 'RollOutRight'].forEach(k => Object.assign(ReanimatedV2, {
110
+ [k]: new BaseAnimationMock()
111
+ }));
86
112
  module.exports = { ...ReanimatedV2
87
113
  };
88
114
  //# sourceMappingURL=mock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","_","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nconst ReanimatedV2 = {\n useSharedValue: (v) => ({ value: v }),\n useDerivedValue: (a) => ({ value: a() }),\n useAnimatedScrollHandler: () => NOOP,\n useAnimatedGestureHandler: () => NOOP,\n useAnimatedStyle: IMMEDIATE_CB_INVOCATION,\n useAnimatedRef: () => ({ current: null }),\n useAnimatedReaction: NOOP,\n useAnimatedProps: IMMEDIATE_CB_INVOCATION,\n\n withTiming: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withSpring: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withDecay: (_, cb) => {\n cb && cb(true);\n return 0;\n },\n withDelay: (_, animationValue) => {\n return animationValue;\n },\n withSequence: (..._animations) => {\n return 0;\n },\n withRepeat: (animation) => {\n return animation;\n },\n cancelAnimation: NOOP,\n measure: () => ({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n }),\n Easing: {\n linear: ID,\n ease: ID,\n quad: ID,\n cubic: ID,\n poly: ID,\n sin: ID,\n circle: ID,\n exp: ID,\n elastic: ID,\n back: ID,\n bounce: ID,\n bezier: () => ({ factory: ID }),\n bezierFn: ID,\n in: ID,\n out: ID,\n inOut: ID,\n },\n Extrapolation: {\n EXTEND: 'extend',\n CLAMP: 'clamp',\n IDENTITY: 'identity',\n },\n\n runOnJS: (fn) => fn,\n runOnUI: (fn) => fn,\n};\n\nmodule.exports = {\n ...ReanimatedV2,\n};\n"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,EAAE,GAAIC,CAAD,IAAOA,CAAlB;;AACA,MAAMC,uBAAuB,GAAIC,EAAD,IAAuBA,EAAE,EAAzD;;AAEA,MAAMC,YAAY,GAAG;EACnBC,cAAc,EAAGC,CAAD,KAAQ;IAAEC,KAAK,EAAED;EAAT,CAAR,CADG;EAEnBE,eAAe,EAAGC,CAAD,KAAQ;IAAEF,KAAK,EAAEE,CAAC;EAAV,CAAR,C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,EALA;IAMNyC,GAAG,EAAEzC,EANC;IAON0C,MAAM,EAAE1C,EAPF;IAQN2C,GAAG,EAAE3C,EARC;IASN4C,OAAO,EAAE5C,EATH;IAUN6C,IAAI,EAAE7C,EAVA;IAWN8C,MAAM,EAAE9C,EAXF;IAYN+C,MAAM,EAAE,OAAO;MAAEC,OAAO,EAAEhD;IAAX,CAAP,CAZF;IAaNiD,QAAQ,EAAEjD,EAbJ;IAcNkD,EAAE,EAAElD,EAdE;IAeNmD,GAAG,EAAEnD,EAfC;IAgBNoD,KAAK,EAAEpD;EAhBD,CAxCW;EA0DnBqD,aAAa,EAAE;IACbC,MAAM,EAAE,QADK;IAEbC,KAAK,EAAE,OAFM;IAGbC,QAAQ,EAAE;EAHG,CA1DI;EAgEnBC,OAAO,EAAGC,EAAD,IAAQA,EAhEE;EAiEnBC,OAAO,EAAGD,EAAD,IAAQA;AAjEE,CAArB;AAoEAE,MAAM,CAACC,OAAP,GAAiB,EACf,GAAGzD;AADY,CAAjB"}
1
+ {"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","BaseAnimationMock","duration","_","delay","withCallback","randomDelay","withInitialValues","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","forEach","k","Object","assign","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nclass BaseAnimationMock {\n duration(_: number) {\n return this;\n }\n\n delay(_: number) {\n return this;\n }\n\n withCallback(_: (finsihed: boolean) => void) {\n return this;\n }\n\n randomDelay() {\n return this;\n }\n\n withInitialValues() {\n return this;\n }\n}\n\nconst ReanimatedV2 = {\n useSharedValue: (v) => ({ value: v }),\n useDerivedValue: (a) => ({ value: a() }),\n useAnimatedScrollHandler: () => NOOP,\n useAnimatedGestureHandler: () => NOOP,\n useAnimatedStyle: IMMEDIATE_CB_INVOCATION,\n useAnimatedRef: () => ({ current: null }),\n useAnimatedReaction: NOOP,\n useAnimatedProps: IMMEDIATE_CB_INVOCATION,\n\n withTiming: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withSpring: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withDecay: (_, cb) => {\n cb && cb(true);\n return 0;\n },\n withDelay: (_, animationValue) => {\n return animationValue;\n },\n withSequence: (..._animations) => {\n return 0;\n },\n withRepeat: (animation) => {\n return animation;\n },\n cancelAnimation: NOOP,\n measure: () => ({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n }),\n Easing: {\n linear: ID,\n ease: ID,\n quad: ID,\n cubic: ID,\n poly: ID,\n sin: ID,\n circle: ID,\n exp: ID,\n elastic: ID,\n back: ID,\n bounce: ID,\n bezier: () => ({ factory: ID }),\n bezierFn: ID,\n in: ID,\n out: ID,\n inOut: ID,\n },\n Extrapolation: {\n EXTEND: 'extend',\n CLAMP: 'clamp',\n IDENTITY: 'identity',\n },\n\n runOnJS: (fn) => fn,\n runOnUI: (fn) => fn,\n};\n\n[\n 'FadeIn',\n 'FadeInRight',\n 'FadeInLeft',\n 'FadeInUp',\n 'FadFadeInDown',\n 'FadeOut',\n 'FadeOutRight',\n 'FadeOutLeft',\n 'FadeOutUp',\n 'FadeOutDown',\n\n 'FlipInYLeft',\n 'FlipInXDown',\n 'FlipInYRight',\n 'FlipInEasyX',\n 'FlipInEasyY',\n 'FlipOutXUp',\n 'FlipOutYLeft',\n 'FlipOutXDown',\n 'FlipOutYRight',\n 'FlipOutEasyX',\n 'FlipOutEasyY',\n\n 'StretchInY',\n 'StretchOutX',\n 'StretchOutY',\n 'SlideInLeft',\n 'SlideOutRight',\n 'SlideOutLeft',\n 'SlideInUp',\n 'SlideInDown',\n 'SlideOutUp',\n\n 'ZoomInRotate',\n 'ZoomInLeft',\n 'ZoomInRight',\n 'ZoomInUp',\n 'ZoomInDown',\n 'ZoomInEasyUp',\n 'ZoomInEasyDown',\n 'ZoomOut',\n 'ZoomOutRotate',\n 'ZoomOutLeft',\n 'ZoomOutRight',\n 'ZoomOutUp',\n 'ZoomOutDown',\n 'ZoomOutEasyUp',\n 'ZoomOutEasyDown',\n\n 'BounceInDown',\n 'BounceInUp',\n 'BounceInLeft',\n 'BounceInRight',\n 'BounceOut',\n 'BounceOutDown',\n 'BounceOutUp',\n 'BounceOutLeft',\n 'BounceOutRight',\n\n 'LightSpeedInLeft',\n 'LightSpeedOutRight',\n 'LightSpeedOutLeft',\n\n 'PinwheelOut',\n\n 'RotateInDownRight',\n 'RotateInUpLeft',\n 'RotateInUpRight',\n 'RotateOutDownLeft',\n 'RotateOutDownRight',\n 'RotateOutUpLeft',\n 'RotateOutUpRight',\n\n 'RollInRight',\n 'RollOutLeft',\n 'RollOutRight',\n].forEach((k) =>\n Object.assign(ReanimatedV2, {\n [k]: new BaseAnimationMock(),\n })\n);\n\nmodule.exports = {\n ...ReanimatedV2,\n};\n"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,EAAE,GAAIC,CAAD,IAAOA,CAAlB;;AACA,MAAMC,uBAAuB,GAAIC,EAAD,IAAuBA,EAAE,EAAzD;;AAEA,MAAMC,iBAAN,CAAwB;EACtBC,QAAQ,CAACC,CAAD,EAAY;IAClB,OAAO,IAAP;EACD;;EAEDC,KAAK,CAACD,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zBF,EA0BE,aA1BF,EA2BE,aA3BF,EA4BE,eA5BF,EA6BE,cA7BF,EA8BE,WA9BF,EA+BE,aA/BF,EAgCE,YAhCF,EAkCE,cAlCF,EAmCE,YAnCF,EAoCE,aApCF,EAqCE,UArCF,EAsCE,YAtCF,EAuCE,cAvCF,EAwCE,gBAxCF,EAyCE,SAzCF,EA0CE,eA1CF,EA2CE,aA3CF,EA4CE,cA5CF,EA6CE,WA7CF,EA8CE,aA9CF,EA+CE,eA/CF,EAgDE,iBAhDF,EAkDE,cAlDF,EAmDE,YAnDF,EAoDE,cApDF,EAqDE,eArDF,EAsDE,WAtDF,EAuDE,eAvDF,EAwDE,aAxDF,EAyDE,eAzDF,EA0DE,gBA1DF,EA4DE,kBA5DF,EA6DE,oBA7DF,EA8DE,mBA9DF,EAgEE,aAhEF,EAkEE,mBAlEF,EAmEE,gBAnEF,EAoEE,iBApEF,EAqEE,mBArEF,EAsEE,oBAtEF,EAuEE,iBAvEF,EAwEE,kBAxEF,EA0EE,aA1EF,EA2EE,aA3EF,EA4EE,cA5EF,EA6EEE,OA7EF,CA6EWC,CAAD,IACRC,MAAM,CAACC,MAAP,CAAc1D,YAAd,EAA4B;EAC1B,CAACwD,CAAD,GAAK,IAAI/D,iBAAJ;AADqB,CAA5B,CA9EF;AAmFAkE,MAAM,CAACC,OAAP,GAAiB,EACf,GAAG5D;AADY,CAAjB"}
@@ -13,6 +13,8 @@ var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
13
13
 
14
14
  var _PlatformChecker = require("./PlatformChecker");
15
15
 
16
+ var _errors = require("./errors");
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  // for web/chrome debugger/jest environments this file provides a stub implementation
@@ -66,6 +68,10 @@ function makeShareableCloneRecursive(value) {
66
68
  // this is a remote function
67
69
  toAdapt = value;
68
70
  } else {
71
+ if (__DEV__ && value.__workletHash !== undefined) {
72
+ (0, _errors.registerWorkletStackDetails)(value.__workletHash, value.__stackDetails);
73
+ }
74
+
69
75
  toAdapt = {};
70
76
 
71
77
  for (const [key, element] of Object.entries(value)) {
@@ -1 +1 @@
1
- {"version":3,"names":["USE_STUB_IMPLEMENTATION","shouldBeUseWeb","_shareableCache","WeakMap","_shareableFlag","Symbol","registerShareableMapping","shareable","shareableRef","set","makeShareableShadowNodeWrapper","shadowNodeWrapper","adoptedSNW","NativeReanimatedModule","makeShareableClone","makeShareableCloneRecursive","value","type","cached","get","undefined","toAdapt","Array","isArray","map","element","__workletHash","key","Object","entries","__DEV__","freeze","adopted","makeShareableCloneOnUIRecursive","cloneRecursive","_makeShareableClone","makeShareable","handle","__init"],"sources":["shareables.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { ShareableRef } from './commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\n\n// for web/chrome debugger/jest environments this file provides a stub implementation\n// where no shareable references are used. Instead, the objects themselves are used\n// instead of shareable references, because of the fact that we don't have to deal with\n// runnning the code on separate VMs.\nconst USE_STUB_IMPLEMENTATION = shouldBeUseWeb();\n\nconst _shareableCache = new WeakMap<\n Record<string, unknown>,\n ShareableRef<any> | symbol\n>();\n// the below symbol is used to represent a mapping from the value to itself\n// this is used to allow for a converted shareable to be passed to makeShareableClone\nconst _shareableFlag = Symbol('shareable flag');\n\nexport function registerShareableMapping(\n shareable: any,\n shareableRef?: ShareableRef<any>\n): void {\n if (USE_STUB_IMPLEMENTATION) {\n return;\n }\n _shareableCache.set(shareable, shareableRef || _shareableFlag);\n}\n\nexport function makeShareableShadowNodeWrapper<T>(shadowNodeWrapper: T): T {\n const adoptedSNW =\n NativeReanimatedModule.makeShareableClone(shadowNodeWrapper);\n registerShareableMapping(shadowNodeWrapper, adoptedSNW);\n return shadowNodeWrapper;\n}\n\nexport function makeShareableCloneRecursive<T>(value: any): ShareableRef<T> {\n if (USE_STUB_IMPLEMENTATION) {\n return value;\n }\n // This one actually may be worth to be moved to c++, we also need similar logic to run on the UI thread\n const type = typeof value;\n if ((type === 'object' || type === 'function') && value !== null) {\n const cached = _shareableCache.get(value);\n if (cached === _shareableFlag) {\n return value;\n } else if (cached !== undefined) {\n return cached as ShareableRef<T>;\n } else {\n let toAdapt: any;\n if (Array.isArray(value)) {\n toAdapt = value.map((element) => makeShareableCloneRecursive(element));\n } else if (type === 'function' && value.__workletHash === undefined) {\n // this is a remote function\n toAdapt = value;\n } else {\n toAdapt = {};\n for (const [key, element] of Object.entries(value)) {\n toAdapt[key] = makeShareableCloneRecursive(element);\n }\n }\n if (__DEV__) {\n // we freeze objects that are transformed to shareable. This should help\n // detect issues when someone modifies data after it's been converted to\n // shareable. Meaning that they may be doing a faulty assumption in their\n // code expecting that the updates are going to automatically populate to\n // the object sent to the UI thread. If the user really wants some objects\n // to be mutable they should use share values instead.\n Object.freeze(value);\n }\n const adopted = NativeReanimatedModule.makeShareableClone(toAdapt);\n _shareableCache.set(value, adopted);\n _shareableCache.set(adopted, _shareableFlag);\n return adopted;\n }\n }\n return NativeReanimatedModule.makeShareableClone(value);\n}\n\nexport function makeShareableCloneOnUIRecursive<T>(value: T): ShareableRef<T> {\n 'worklet';\n if (USE_STUB_IMPLEMENTATION) {\n // @ts-ignore web is an interesting place where we don't run a secondary VM on the UI thread\n // see more details in the comment where USE_STUB_IMPLEMENTATION is defined.\n return value;\n }\n function cloneRecursive<T>(value: T): ShareableRef<T> {\n const type = typeof value;\n if ((type === 'object' || type === 'function') && value !== null) {\n let toAdapt: any;\n if (Array.isArray(value)) {\n toAdapt = value.map((element) => cloneRecursive(element));\n } else {\n toAdapt = {};\n for (const [key, element] of Object.entries(value)) {\n toAdapt[key] = cloneRecursive(element);\n }\n }\n if (__DEV__) {\n // See the reasoning behind freezing in the other comment above.\n Object.freeze(value);\n }\n return _makeShareableClone(toAdapt);\n }\n return _makeShareableClone(value);\n }\n return cloneRecursive(value);\n}\n\nexport function makeShareable<T>(value: T): T {\n if (USE_STUB_IMPLEMENTATION) {\n return value;\n }\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return value;\n },\n });\n registerShareableMapping(value, handle);\n return value;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;AAEA;AACA;AACA;AACA;AACA,MAAMA,uBAAuB,GAAG,IAAAC,+BAAA,GAAhC;;AAEA,MAAMC,eAAe,GAAG,IAAIC,OAAJ,EAAxB,C,CAIA;AACA;;;AACA,MAAMC,cAAc,GAAGC,MAAM,CAAC,gBAAD,CAA7B;;AAEO,SAASC,wBAAT,CACLC,SADK,EAELC,YAFK,EAGC;EACN,IAAIR,uBAAJ,EAA6B;IAC3B;EACD;;EACDE,eAAe,CAACO,GAAhB,CAAoBF,SAApB,EAA+BC,YAAY,IAAIJ,cAA/C;AACD;;AAEM,SAASM,8BAAT,CAA2CC,iBAA3C,EAAoE;EACzE,MAAMC,UAAU,GACdC,yBAAA,CAAuBC,kBAAvB,CAA0CH,iBAA1C,CADF;;EAEAL,wBAAwB,CAACK,iBAAD,EAAoBC,UAApB,CAAxB;EACA,OAAOD,iBAAP;AACD;;AAEM,SAASI,2BAAT,CAAwCC,KAAxC,EAAqE;EAC1E,IAAIhB,uBAAJ,EAA6B;IAC3B,OAAOgB,KAAP;EACD,CAHyE,CAI1E;;;EACA,MAAMC,IAAI,GAAG,OAAOD,KAApB;;EACA,IAAI,CAACC,IAAI,KAAK,QAAT,IAAqBA,IAAI,KAAK,UAA/B,KAA8CD,KAAK,KAAK,IAA5D,EAAkE;IAChE,MAAME,MAAM,GAAGhB,eAAe,CAACiB,GAAhB,CAAoBH,KAApB,CAAf;;IACA,IAAIE,MAAM,KAAKd,cAAf,EAA+B;MAC7B,OAAOY,KAAP;IACD,CAFD,MAEO,IAAIE,MAAM,KAAKE,SAAf,EAA0B;MAC/B,OAAOF,MAAP;IACD,CAFM,MAEA;MACL,IAAIG,OAAJ;;MACA,IAAIC,KAAK,CAACC,OAAN,CAAcP,KAAd,CAAJ,EAA0B;QACxBK,OAAO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CAAWC,OAAD,IAAaS,cAAc,CAACT,OAAD,CAArC,CAAV;MACD,CAFD,MAEO;QACLJ,OAAO,GAAG,EAAV;;QACA,KAAK,MAAM,CAACM,GAAD,EAAMF,OAAN,CAAX,IAA6BG,MAAM,CAACC,OAAP,CAAeb,KAAf,CAA7B,EAAoD;UAClDK,OAAO,CAACM,GAAD,CAAP,GAAeO,cAAc,CAACT,OAAD,CAA7B;QACD;MACF;;MACD,IAAIK,OAAJ,EAAa;QACX;QACAF,MAAM,CAACG,MAAP,CAAcf,KAAd;MACD;;MACD,OAAOmB,mBAAmB,CAACd,OAAD,CAA1B;IACD;;IACD,OAAOc,mBAAmB,CAACnB,KAAD,CAA1B;EACD;;EACD,OAAOkB,cAAc,CAAClB,KAAD,CAArB;AACD;;AAEM,SAASoB,aAAT,CAA0BpB,KAA1B,EAAuC;EAC5C,IAAIhB,uBAAJ,EAA6B;IAC3B,OAAOgB,KAAP;EACD;;EACD,MAAMqB,MAAM,GAAGtB,2BAA2B,CAAC;IACzCuB,MAAM,EAAE,MAAM;MACZ;;MACA,OAAOtB,KAAP;IACD;EAJwC,CAAD,CAA1C;EAMAV,wBAAwB,CAACU,KAAD,EAAQqB,MAAR,CAAxB;EACA,OAAOrB,KAAP;AACD"}
1
+ {"version":3,"names":["USE_STUB_IMPLEMENTATION","shouldBeUseWeb","_shareableCache","WeakMap","_shareableFlag","Symbol","registerShareableMapping","shareable","shareableRef","set","makeShareableShadowNodeWrapper","shadowNodeWrapper","adoptedSNW","NativeReanimatedModule","makeShareableClone","makeShareableCloneRecursive","value","type","cached","get","undefined","toAdapt","Array","isArray","map","element","__workletHash","__DEV__","registerWorkletStackDetails","__stackDetails","key","Object","entries","freeze","adopted","makeShareableCloneOnUIRecursive","cloneRecursive","_makeShareableClone","makeShareable","handle","__init"],"sources":["shareables.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { ShareableRef } from './commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport { registerWorkletStackDetails } from './errors';\n\n// for web/chrome debugger/jest environments this file provides a stub implementation\n// where no shareable references are used. Instead, the objects themselves are used\n// instead of shareable references, because of the fact that we don't have to deal with\n// runnning the code on separate VMs.\nconst USE_STUB_IMPLEMENTATION = shouldBeUseWeb();\n\nconst _shareableCache = new WeakMap<\n Record<string, unknown>,\n ShareableRef<any> | symbol\n>();\n// the below symbol is used to represent a mapping from the value to itself\n// this is used to allow for a converted shareable to be passed to makeShareableClone\nconst _shareableFlag = Symbol('shareable flag');\n\nexport function registerShareableMapping(\n shareable: any,\n shareableRef?: ShareableRef<any>\n): void {\n if (USE_STUB_IMPLEMENTATION) {\n return;\n }\n _shareableCache.set(shareable, shareableRef || _shareableFlag);\n}\n\nexport function makeShareableShadowNodeWrapper<T>(shadowNodeWrapper: T): T {\n const adoptedSNW =\n NativeReanimatedModule.makeShareableClone(shadowNodeWrapper);\n registerShareableMapping(shadowNodeWrapper, adoptedSNW);\n return shadowNodeWrapper;\n}\n\nexport function makeShareableCloneRecursive<T>(value: any): ShareableRef<T> {\n if (USE_STUB_IMPLEMENTATION) {\n return value;\n }\n // This one actually may be worth to be moved to c++, we also need similar logic to run on the UI thread\n const type = typeof value;\n if ((type === 'object' || type === 'function') && value !== null) {\n const cached = _shareableCache.get(value);\n if (cached === _shareableFlag) {\n return value;\n } else if (cached !== undefined) {\n return cached as ShareableRef<T>;\n } else {\n let toAdapt: any;\n if (Array.isArray(value)) {\n toAdapt = value.map((element) => makeShareableCloneRecursive(element));\n } else if (type === 'function' && value.__workletHash === undefined) {\n // this is a remote function\n toAdapt = value;\n } else {\n if (__DEV__ && value.__workletHash !== undefined) {\n registerWorkletStackDetails(\n value.__workletHash,\n value.__stackDetails\n );\n }\n toAdapt = {};\n for (const [key, element] of Object.entries(value)) {\n toAdapt[key] = makeShareableCloneRecursive(element);\n }\n }\n if (__DEV__) {\n // we freeze objects that are transformed to shareable. This should help\n // detect issues when someone modifies data after it's been converted to\n // shareable. Meaning that they may be doing a faulty assumption in their\n // code expecting that the updates are going to automatically populate to\n // the object sent to the UI thread. If the user really wants some objects\n // to be mutable they should use share values instead.\n Object.freeze(value);\n }\n const adopted = NativeReanimatedModule.makeShareableClone(toAdapt);\n _shareableCache.set(value, adopted);\n _shareableCache.set(adopted, _shareableFlag);\n return adopted;\n }\n }\n return NativeReanimatedModule.makeShareableClone(value);\n}\n\nexport function makeShareableCloneOnUIRecursive<T>(value: T): ShareableRef<T> {\n 'worklet';\n if (USE_STUB_IMPLEMENTATION) {\n // @ts-ignore web is an interesting place where we don't run a secondary VM on the UI thread\n // see more details in the comment where USE_STUB_IMPLEMENTATION is defined.\n return value;\n }\n function cloneRecursive<T>(value: T): ShareableRef<T> {\n const type = typeof value;\n if ((type === 'object' || type === 'function') && value !== null) {\n let toAdapt: any;\n if (Array.isArray(value)) {\n toAdapt = value.map((element) => cloneRecursive(element));\n } else {\n toAdapt = {};\n for (const [key, element] of Object.entries(value)) {\n toAdapt[key] = cloneRecursive(element);\n }\n }\n if (__DEV__) {\n // See the reasoning behind freezing in the other comment above.\n Object.freeze(value);\n }\n return _makeShareableClone(toAdapt);\n }\n return _makeShareableClone(value);\n }\n return cloneRecursive(value);\n}\n\nexport function makeShareable<T>(value: T): T {\n if (USE_STUB_IMPLEMENTATION) {\n return value;\n }\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return value;\n },\n });\n registerShareableMapping(value, handle);\n return value;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;;;AAEA;AACA;AACA;AACA;AACA,MAAMA,uBAAuB,GAAG,IAAAC,+BAAA,GAAhC;;AAEA,MAAMC,eAAe,GAAG,IAAIC,OAAJ,EAAxB,C,CAIA;AACA;;;AACA,MAAMC,cAAc,GAAGC,MAAM,CAAC,gBAAD,CAA7B;;AAEO,SAASC,wBAAT,CACLC,SADK,EAELC,YAFK,EAGC;EACN,IAAIR,uBAAJ,EAA6B;IAC3B;EACD;;EACDE,eAAe,CAACO,GA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,EAAa;QACX;QACAI,MAAM,CAACE,MAAP,CAAcjB,KAAd;MACD;;MACD,OAAOqB,mBAAmB,CAAChB,OAAD,CAA1B;IACD;;IACD,OAAOgB,mBAAmB,CAACrB,KAAD,CAA1B;EACD;;EACD,OAAOoB,cAAc,CAACpB,KAAD,CAArB;AACD;;AAEM,SAASsB,aAAT,CAA0BtB,KAA1B,EAAuC;EAC5C,IAAIhB,uBAAJ,EAA6B;IAC3B,OAAOgB,KAAP;EACD;;EACD,MAAMuB,MAAM,GAAGxB,2BAA2B,CAAC;IACzCyB,MAAM,EAAE,MAAM;MACZ;;MACA,OAAOxB,KAAP;IACD;EAJwC,CAAD,CAA1C;EAMAV,wBAAwB,CAACU,KAAD,EAAQuB,MAAR,CAAxB;EACA,OAAOvB,KAAP;AACD"}
@@ -49,8 +49,8 @@ export class NativeReanimated {
49
49
  throw new Error('stub implementation, used on the web only');
50
50
  }
51
51
 
52
- installCoreFunctions(valueUnpacker) {
53
- return this.InnerNativeModule.installCoreFunctions(valueUnpacker);
52
+ installCoreFunctions(callGuard, valueUnpacker) {
53
+ return this.InnerNativeModule.installCoreFunctions(callGuard, valueUnpacker);
54
54
  }
55
55
 
56
56
  makeShareableClone(value) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","version","jsVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","getTimestamp","Error","installCoreFunctions","valueUnpacker","makeShareableClone","value","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { ShareableRef, ShareableSyncDataHolderRef } from '../commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n getTimestamp(): number {\n throw new Error('stub implementation, used on the web only');\n }\n\n installCoreFunctions(valueUnpacker: <T>(value: T) => T): void {\n return this.InnerNativeModule.installCoreFunctions(valueUnpacker);\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(value);\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n handler: ShareableRef<T>\n ) {\n return this.InnerNativeModule.registerSensor(sensorType, interval, handler);\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(handler: ShareableRef<number>): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(handler);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,cAA9B;AAGA,SAASC,OAAO,IAAIC,SAApB,QAAqC,uBAArC;AAEA,OAAO,MAAMC,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IA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EAEtBI,IAFsB,EAGtBC,MAHsB,EAItB;IACA,KAAK3C,iBAAL,CAAuByC,wBAAvB,CAAgDH,OAAhD,EAAyDI,IAAzD,EAA+DC,MAA/D;EACD;;EAEDC,sBAAsB,CAACC,IAAD,EAAsB;IAC1C,KAAK7C,iBAAL,CAAuB4C,sBAAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKhD,iBAAL,CAAuB8C,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACpB,OAAD,EAAwC;IAChE,OAAO,KAAK7B,iBAAL,CAAuBiD,0BAAvB,CAAkDpB,OAAlD,CAAP;EACD;;EAEDqB,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAKnD,iBAAL,CAAuBkD,6BAAvB,CAAqDC,UAArD;EACD;;AA9H2B"}
1
+ {"version":3,"names":["NativeModules","version","jsVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","getTimestamp","Error","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","value","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { ShareableRef, ShareableSyncDataHolderRef } from '../commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n getTimestamp(): number {\n throw new Error('stub implementation, used on the web only');\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(value);\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n handler: ShareableRef<T>\n ) {\n return this.InnerNativeModule.registerSensor(sensorType, interval, handler);\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(handler: ShareableRef<number>): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(handler);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,cAA9B;AAGA,SAASC,OAAO,IAAIC,SAApB,QAAqC,uBAArC;AAEA,OAAO,MAAMC,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;;IACzB,IAAIC,MAAM,CAACC,uBAAP,KAAmCC,SAAnC,IAAgDH,MAApD,EAA4D;MAC1D,MA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IAAzD,EAA+DC,MAA/D;EACD;;EAEDC,sBAAsB,CAACC,IAAD,EAAsB;IAC1C,KAAK9C,iBAAL,CAAuB6C,sBAAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKjD,iBAAL,CAAuB+C,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACpB,OAAD,EAAwC;IAChE,OAAO,KAAK9B,iBAAL,CAAuBkD,0BAAvB,CAAkDpB,OAAlD,CAAP;EACD;;EAEDqB,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAKpD,iBAAL,CAAuBmD,6BAAvB,CAAqDC,UAArD;EACD;;AAvI2B"}
@@ -1,16 +1,17 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { forwardRef } from 'react';
4
- import { FlatList } from 'react-native';
4
+ import { FlatList, StyleSheet } from 'react-native';
5
5
  import ReanimatedView from './View';
6
6
  import createAnimatedComponent from '../../createAnimatedComponent';
7
7
  const AnimatedFlatList = createAnimatedComponent(FlatList);
8
8
 
9
- const createCellRenderer = itemLayoutAnimation => {
9
+ const createCellRenderer = (itemLayoutAnimation, cellStyle) => {
10
10
  const cellRenderer = props => {
11
11
  return /*#__PURE__*/React.createElement(ReanimatedView, {
12
12
  layout: itemLayoutAnimation,
13
- onLayout: props.onLayout
13
+ onLayout: props.onLayout,
14
+ style: cellStyle
14
15
  }, props.children);
15
16
  };
16
17
 
@@ -22,12 +23,25 @@ const ReanimatedFlatlist = /*#__PURE__*/forwardRef((props, ref) => {
22
23
  itemLayoutAnimation,
23
24
  ...restProps
24
25
  } = props;
25
- const cellRenderer = React.useMemo(() => createCellRenderer(itemLayoutAnimation), []);
26
+ const cellStyle = restProps !== null && restProps !== void 0 && restProps.inverted ? restProps !== null && restProps !== void 0 && restProps.horizontal ? styles.horizontallyInverted : styles.verticallyInverted : undefined;
27
+ const cellRenderer = React.useMemo(() => createCellRenderer(itemLayoutAnimation, cellStyle), [cellStyle]);
26
28
  return /*#__PURE__*/React.createElement(AnimatedFlatList, _extends({
27
29
  ref: ref
28
30
  }, restProps, {
29
31
  CellRendererComponent: cellRenderer
30
32
  }));
31
33
  });
34
+ const styles = StyleSheet.create({
35
+ verticallyInverted: {
36
+ transform: [{
37
+ scaleY: -1
38
+ }]
39
+ },
40
+ horizontallyInverted: {
41
+ transform: [{
42
+ scaleX: -1
43
+ }]
44
+ }
45
+ });
32
46
  export default ReanimatedFlatlist;
33
47
  //# sourceMappingURL=FlatList.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","FlatList","ReanimatedView","createAnimatedComponent","AnimatedFlatList","createCellRenderer","itemLayoutAnimation","cellRenderer","props","onLayout","children","ReanimatedFlatlist","ref","restProps","useMemo"],"sources":["FlatList.tsx"],"sourcesContent":["import React, { ForwardedRef, forwardRef } from 'react';\nimport { FlatList, FlatListProps, LayoutChangeEvent } from 'react-native';\nimport ReanimatedView from './View';\nimport createAnimatedComponent from '../../createAnimatedComponent';\nimport { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/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}\n\nconst createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {\n const cellRenderer = (props: AnimatedFlatListProps) => {\n return (\n <ReanimatedView layout={itemLayoutAnimation} onLayout={props.onLayout}>\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 cellRenderer = React.useMemo(\n () => createCellRenderer(itemLayoutAnimation),\n []\n );\n\n return (\n <AnimatedFlatList\n ref={ref}\n {...restProps}\n CellRendererComponent={cellRenderer}\n />\n );\n }\n);\n\nexport default ReanimatedFlatlist;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAA8BC,UAA9B,QAAgD,OAAhD;AACA,SAASC,QAAT,QAA2D,cAA3D;AACA,OAAOC,cAAP,MAA2B,QAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAGA,MAAMC,gBAAgB,GAAGD,uBAAuB,CAACF,QAAD,CAAhD;;AAQA,MAAMI,kBAAkB,GAAIC,mBAAD,IAAmD;EAC5E,MAAMC,YAAY,GAAIC,KAAD,IAAkC;IACrD,oBACE,oBAAC,cAAD;MAAgB,MAAM,EAAEF,mBAAxB;MAA6C,QAAQ,EAAEE,KAAK,CAACC;IAA7D,GACGD,KAAK,CAACE,QADT,CADF;EAKD,CAND;;EAQA,OAAOH,YAAP;AACD,CAVD;;AAkBA,MAAMI,kBAAwC,gBAAGX,UAAU,CACzD,CAACQ,KAAD,EAAsCI,GAAtC,KAAsE;EACpE,MAAM;IAAEN,mBAAF;IAAuB,GAAGO;EAA1B,IAAwCL,KAA9C;EAEA,MAAMD,YAAY,GAAGR,KAAK,CAACe,OAAN,CACnB,MAAMT,kBAAkB,CAACC,mBAAD,CADL,EAEnB,EAFmB,CAArB;EAKA,oBACE,oBAAC,gBAAD;IACE,GAAG,EAAEM;EADP,GAEMC,SAFN;IAGE,qBAAqB,EAAEN;EAHzB,GADF;AAOD,CAhBwD,CAA3D;AAmBA,eAAeI,kBAAf"}
1
+ {"version":3,"names":["React","forwardRef","FlatList","StyleSheet","ReanimatedView","createAnimatedComponent","AnimatedFlatList","createCellRenderer","itemLayoutAnimation","cellStyle","cellRenderer","props","onLayout","children","ReanimatedFlatlist","ref","restProps","inverted","horizontal","styles","horizontallyInverted","verticallyInverted","undefined","useMemo","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,OAAOA,KAAP,IAA8BC,UAA9B,QAAgD,OAAhD;AACA,SACEC,QADF,EAIEC,UAJF,QAKO,cALP;AAMA,OAAOC,cAAP,MAA2B,QAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAIA,MAAMC,gBAAgB,GAAGD,uBAAuB,CAACH,QAAD,CAAhD;;AAUA,MAAMK,kBAAkB,GAAG,CACzBC,mBADyB,EAEzBC,SAFyB,KAGtB;EACH,MAAMC,YAAY,GAAIC,KAAD,IAAkC;IACrD,oBACE,oBAAC,cAAD;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,gBAAGb,UAAU,CACzD,CAACU,KAAD,EAAsCI,GAAtC,KAAsE;EACpE,MAAM;IAAEP,mBAAF;IAAuB,GAAGQ;EAA1B,IAAwCL,KAA9C;EAEA,MAAMF,SAAS,GAAGO,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,MAAMZ,YAAY,GAAGV,KAAK,CAACuB,OAAN,CACnB,MAAMhB,kBAAkB,CAACC,mBAAD,EAAsBC,SAAtB,CADL,EAEnB,CAACA,SAAD,CAFmB,CAArB;E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