react-native-reanimated 3.0.0-rc.4 → 3.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +97 -15
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +32 -8
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +16 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +8 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +17 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +2 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +1 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -1
- package/android/CMakeLists.txt +1 -0
- package/android/build.gradle +9 -1
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +16 -25
- package/android/src/main/cpp/LayoutAnimations.cpp +42 -50
- package/android/src/main/cpp/LayoutAnimations.h +17 -3
- package/android/src/main/cpp/NativeProxy.cpp +55 -6
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +208 -223
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +7 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +5 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +1 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +20 -7
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +8 -44
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +15 -61
- package/ios/LayoutReanimation/REAAnimationsManager.h +18 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +197 -162
- package/ios/LayoutReanimation/REAUIManager.mm +63 -70
- package/ios/native/NativeProxy.mm +55 -48
- package/lib/commonjs/createAnimatedComponent.js +26 -26
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +9 -9
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +17 -9
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +23 -62
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +27 -26
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/core.js +7 -9
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +17 -9
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +22 -61
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -1
- package/package.json +2 -2
- package/src/createAnimatedComponent.tsx +48 -39
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +15 -0
- package/src/reanimated2/core.ts +19 -10
- package/src/reanimated2/globals.d.ts +10 -6
- package/src/reanimated2/jestUtils.ts +14 -6
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +24 -50
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -55
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -40
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +0 -49
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
#import <dlfcn.h>
|
|
33
33
|
#endif
|
|
34
34
|
|
|
35
|
+
@interface RCTBridge (JSIRuntime)
|
|
36
|
+
- (void *)runtime;
|
|
37
|
+
@end
|
|
38
|
+
|
|
35
39
|
namespace reanimated {
|
|
36
40
|
|
|
37
41
|
using namespace facebook;
|
|
@@ -198,7 +202,8 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
198
202
|
auto jsQueue = std::make_shared<REAMessageThread>([NSRunLoop currentRunLoop], ^(NSError *error) {
|
|
199
203
|
throw error;
|
|
200
204
|
});
|
|
201
|
-
|
|
205
|
+
auto rnRuntime = reinterpret_cast<facebook::jsi::Runtime *>(reanimatedModule.bridge.runtime);
|
|
206
|
+
std::shared_ptr<jsi::Runtime> animatedRuntime = ReanimatedRuntime::make(rnRuntime, jsQueue);
|
|
202
207
|
|
|
203
208
|
std::shared_ptr<Scheduler> scheduler = std::make_shared<REAIOSScheduler>(jsInvoker);
|
|
204
209
|
std::shared_ptr<ErrorHandler> errorHandler = std::make_shared<REAIOSErrorHandler>(scheduler);
|
|
@@ -224,8 +229,8 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
224
229
|
[nodesManager synchronouslyUpdateViewOnUIThread:viewTag props:uiProps];
|
|
225
230
|
};
|
|
226
231
|
|
|
227
|
-
std::
|
|
228
|
-
|
|
232
|
+
auto layoutAnimationsProxy = std::make_shared<LayoutAnimationsProxy>(
|
|
233
|
+
[](int tag, jsi::Object newStyle) {}, [](int tag, bool isCancelled, bool removeView) {}, errorHandler);
|
|
229
234
|
#else
|
|
230
235
|
// Layout Animations start
|
|
231
236
|
__block std::weak_ptr<Scheduler> weakScheduler = scheduler;
|
|
@@ -241,16 +246,19 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
241
246
|
REAAnimationsManager *animationsManager = [[REAAnimationsManager alloc] initWithUIManager:reaUiManager];
|
|
242
247
|
[reaUiManagerNoCast setUp:animationsManager];
|
|
243
248
|
|
|
244
|
-
|
|
249
|
+
__weak REAAnimationsManager *weakAnimationsManager = animationsManager;
|
|
250
|
+
auto progressLayoutAnimation = [weakAnimationsManager, animatedRuntime](int tag, jsi::Object newStyle) {
|
|
251
|
+
REAAnimationsManager *animationsManager = weakAnimationsManager;
|
|
245
252
|
if (animationsManager) {
|
|
246
253
|
NSDictionary *propsDict = convertJSIObjectToNSDictionary(*animatedRuntime, newStyle);
|
|
247
|
-
[animationsManager
|
|
254
|
+
[animationsManager progressLayoutAnimationWithStyle:propsDict forTag:@(tag)];
|
|
248
255
|
}
|
|
249
256
|
};
|
|
250
257
|
|
|
251
|
-
auto
|
|
258
|
+
auto endLayoutAnimation = [weakAnimationsManager](int tag, bool isCancelled, bool removeView) {
|
|
259
|
+
REAAnimationsManager *animationsManager = weakAnimationsManager;
|
|
252
260
|
if (animationsManager) {
|
|
253
|
-
[animationsManager
|
|
261
|
+
[animationsManager endLayoutAnimationForTag:@(tag) cancelled:isCancelled removeView:removeView];
|
|
254
262
|
}
|
|
255
263
|
};
|
|
256
264
|
|
|
@@ -261,48 +269,10 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
261
269
|
[reanimatedModule.nodesManager configureUiProps:uiPropsSet andNativeProps:nativePropsSet];
|
|
262
270
|
};
|
|
263
271
|
|
|
264
|
-
|
|
265
|
-
std::make_shared<LayoutAnimationsProxy>(
|
|
272
|
+
auto layoutAnimationsProxy =
|
|
273
|
+
std::make_shared<LayoutAnimationsProxy>(progressLayoutAnimation, endLayoutAnimation, errorHandler);
|
|
274
|
+
auto weakLayoutAnimationsProxy = std::weak_ptr(layoutAnimationsProxy);
|
|
266
275
|
std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
|
|
267
|
-
[animationsManager setAnimationStartingBlock:^(
|
|
268
|
-
NSNumber *_Nonnull tag, NSString *type, NSDictionary *_Nonnull values, NSNumber *depth) {
|
|
269
|
-
std::shared_ptr<jsi::Runtime> rt = wrt.lock();
|
|
270
|
-
if (wrt.expired()) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
jsi::Object yogaValues(*rt);
|
|
274
|
-
for (NSString *key in values.allKeys) {
|
|
275
|
-
NSNumber *value = values[key];
|
|
276
|
-
yogaValues.setProperty(*rt, [key UTF8String], [value doubleValue]);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
jsi::Value layoutAnimationRepositoryAsValue =
|
|
280
|
-
rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository");
|
|
281
|
-
if (!layoutAnimationRepositoryAsValue.isUndefined()) {
|
|
282
|
-
jsi::Function startAnimationForTag =
|
|
283
|
-
layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "startAnimationForTag");
|
|
284
|
-
startAnimationForTag.call(
|
|
285
|
-
*rt,
|
|
286
|
-
jsi::Value([tag intValue]),
|
|
287
|
-
jsi::String::createFromAscii(*rt, std::string([type UTF8String])),
|
|
288
|
-
yogaValues,
|
|
289
|
-
jsi::Value([depth intValue]));
|
|
290
|
-
}
|
|
291
|
-
}];
|
|
292
|
-
|
|
293
|
-
[animationsManager setRemovingConfigBlock:^(NSNumber *_Nonnull tag) {
|
|
294
|
-
std::shared_ptr<jsi::Runtime> rt = wrt.lock();
|
|
295
|
-
if (wrt.expired()) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
jsi::Value layoutAnimationRepositoryAsValue =
|
|
299
|
-
rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository");
|
|
300
|
-
if (!layoutAnimationRepositoryAsValue.isUndefined()) {
|
|
301
|
-
jsi::Function removeConfig =
|
|
302
|
-
layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "removeConfig");
|
|
303
|
-
removeConfig.call(*rt, jsi::Value([tag intValue]));
|
|
304
|
-
}
|
|
305
|
-
}];
|
|
306
276
|
|
|
307
277
|
// Layout Animations end
|
|
308
278
|
#endif
|
|
@@ -409,7 +379,44 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
409
379
|
module->performOperations();
|
|
410
380
|
}
|
|
411
381
|
}];
|
|
382
|
+
#else
|
|
383
|
+
// Layout Animation callbacks setup
|
|
384
|
+
[animationsManager setAnimationStartingBlock:^(
|
|
385
|
+
NSNumber *_Nonnull tag, NSString *type, NSDictionary *_Nonnull values, NSNumber *depth) {
|
|
386
|
+
std::shared_ptr<jsi::Runtime> runtime = wrt.lock();
|
|
387
|
+
if (runtime == nullptr) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
|
|
391
|
+
if (layoutAnimationsProxy == nullptr) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
jsi::Object yogaValues(*runtime);
|
|
395
|
+
for (NSString *key in values.allKeys) {
|
|
396
|
+
NSNumber *value = values[key];
|
|
397
|
+
yogaValues.setProperty(*runtime, [key UTF8String], [value doubleValue]);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
layoutAnimationsProxy->startLayoutAnimation(*runtime, [tag intValue], std::string([type UTF8String]), yogaValues);
|
|
401
|
+
}];
|
|
402
|
+
|
|
403
|
+
[animationsManager setHasAnimationBlock:^(NSNumber *_Nonnull tag, NSString *_Nonnull type) {
|
|
404
|
+
auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
|
|
405
|
+
if (layoutAnimationsProxy == nullptr) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
return layoutAnimationsProxy->hasLayoutAnimation([tag intValue], std::string([type UTF8String]));
|
|
409
|
+
}];
|
|
410
|
+
|
|
411
|
+
[animationsManager setAnimationRemovingBlock:^(NSNumber *_Nonnull tag) {
|
|
412
|
+
auto layoutAnimationsProxy = weakLayoutAnimationsProxy.lock();
|
|
413
|
+
if (layoutAnimationsProxy == nullptr) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
layoutAnimationsProxy->clearLayoutAnimationConfig([tag intValue]);
|
|
417
|
+
}];
|
|
412
418
|
#endif
|
|
419
|
+
|
|
413
420
|
return module;
|
|
414
421
|
}
|
|
415
422
|
|
|
@@ -23,8 +23,6 @@ var _RNRenderer = require("./reanimated2/platform-specific/RNRenderer");
|
|
|
23
23
|
|
|
24
24
|
var _core = require("./reanimated2/core");
|
|
25
25
|
|
|
26
|
-
var _Default = require("./reanimated2/layoutReanimation/defaultAnimations/Default");
|
|
27
|
-
|
|
28
26
|
var _PlatformChecker = require("./reanimated2/PlatformChecker");
|
|
29
27
|
|
|
30
28
|
var _animation = require("./reanimated2/animation");
|
|
@@ -41,6 +39,16 @@ function dummyListener() {// empty listener we use to assign to listener propert
|
|
|
41
39
|
// event is used.
|
|
42
40
|
}
|
|
43
41
|
|
|
42
|
+
function maybeBuild(layoutAnimationOrBuilder) {
|
|
43
|
+
const isAnimationBuilder = value => 'build' in layoutAnimationOrBuilder && typeof layoutAnimationOrBuilder.build === 'function';
|
|
44
|
+
|
|
45
|
+
if (isAnimationBuilder(layoutAnimationOrBuilder)) {
|
|
46
|
+
return layoutAnimationOrBuilder.build();
|
|
47
|
+
} else {
|
|
48
|
+
return layoutAnimationOrBuilder;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
function flattenArray(array) {
|
|
45
53
|
if (!Array.isArray(array)) {
|
|
46
54
|
return [array];
|
|
@@ -117,36 +125,28 @@ function createAnimatedComponent(Component, options) {
|
|
|
117
125
|
setLocalRef: ref => {
|
|
118
126
|
// TODO update config
|
|
119
127
|
const tag = (0, _reactNative.findNodeHandle)(ref);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
128
|
+
const {
|
|
129
|
+
layout,
|
|
130
|
+
entering,
|
|
131
|
+
exiting
|
|
132
|
+
} = this.props;
|
|
133
|
+
|
|
134
|
+
if ((layout || entering || exiting) && tag != null) {
|
|
135
|
+
if (!(0, _PlatformChecker.shouldBeUseWeb)()) {
|
|
136
|
+
(0, _core.enableLayoutAnimations)(true, false);
|
|
129
137
|
}
|
|
130
138
|
|
|
131
|
-
if (
|
|
132
|
-
|
|
139
|
+
if (layout) {
|
|
140
|
+
(0, _core.configureLayoutAnimations)(tag, 'layout', maybeBuild(layout), this.sv);
|
|
133
141
|
}
|
|
134
142
|
|
|
135
|
-
if (
|
|
136
|
-
|
|
143
|
+
if (entering) {
|
|
144
|
+
(0, _core.configureLayoutAnimations)(tag, 'entering', maybeBuild(entering), this.sv);
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
exiting,
|
|
143
|
-
sv: this.sv
|
|
144
|
-
};
|
|
145
|
-
(0, _core.runOnUI)(() => {
|
|
146
|
-
'worklet';
|
|
147
|
-
|
|
148
|
-
global.LayoutAnimationRepository.registerConfig(tag, config);
|
|
149
|
-
})();
|
|
147
|
+
if (exiting) {
|
|
148
|
+
(0, _core.configureLayoutAnimations)(tag, 'exiting', maybeBuild(exiting), this.sv);
|
|
149
|
+
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
if (ref !== this._component) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dummyListener","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","value","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","shouldBeUseWeb","layout","entering","exiting","enableLayoutAnimations","DefaultLayout","DefaultEntering","DefaultExiting","build","config","sv","runOnUI","global","LayoutAnimationRepository","registerConfig","_component","isJest","animatedStyle","makeMutable","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n runOnUI,\n enableLayoutAnimations,\n} from './reanimated2/core';\nimport {\n DefaultEntering,\n DefaultExiting,\n DefaultLayout,\n} from './reanimated2/layoutReanimation/defaultAnimations/Default';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n if (\n !shouldBeUseWeb() &&\n (this.props.layout || this.props.entering || this.props.exiting) &&\n tag != null\n ) {\n enableLayoutAnimations(true, false);\n let layout = this.props.layout ? this.props.layout : DefaultLayout;\n let entering = this.props.entering\n ? this.props.entering\n : DefaultEntering;\n let exiting = this.props.exiting\n ? this.props.exiting\n : DefaultExiting;\n\n if (has('build', layout)) {\n layout = layout.build();\n }\n\n if (has('build', entering)) {\n entering = entering.build() as EntryExitAnimationFunction;\n }\n\n if (has('build', exiting)) {\n exiting = exiting.build() as EntryExitAnimationFunction;\n }\n\n const config = {\n layout,\n entering,\n exiting,\n sv: this.sv,\n };\n runOnUI(() => {\n 'worklet';\n global.LayoutAnimationRepository.registerConfig(tag, config);\n })();\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAKA;;AAeA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAGD,SAASC,YAAT,CAAyBC,KAAzB,EAAqD;EACnD,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd,CAAL,EAA2B;IACzB,OAAO,CAACA,KAAD,CAAP;EACD;;EACD,MAAMG,SAAc,GAAG,EAAvB;;EAEA,MAAMC,aAAa,GAAIC,GAAD,IAAiC;IACrDA,GAAG,CAACC,OAAJ,CAAaC,IAAD,IAAU;MACpB,IAAIN,KAAK,CAACC,OAAN,CAAcK,IAAd,CAAJ,EAAyB;QACvBH,aAAa,CAACG,IAAD,CAAb;MACD,CAFD,MAEO;QACLJ,SAAS,CAACK,IAAV,CAAeD,IAAf;MACD;IACF,CAND;EAOD,CARD;;EASAH,aAAa,CAACJ,KAAD,CAAb;;EACA,OAAOG,SAAP;AACD;;AAED,SAASM,kBAAT,CAA4BC,MAA5B,EAAkD;EAChD,OAAOA,MAAM,CAACC,MAAP,CAAeC,KAAD,IAAWA,KAAX,aAAWA,KAAX,uBAAWA,KAAK,CAAEC,eAAhC,CAAP;AACD;;AAED,SAASC,mBAAT,CACEC,MADF,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AD,eAAepG,KAAf;QAAsB,GAAG,EAAE,KAAKqG;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EAtXD;;EAV4D,gBAQxDnG,iBARwD;;EAmY9DA,iBAAiB,CAACyG,WAAlB,GAAiC,qBAC/B9G,SAAS,CAAC8G,WAAV,IAAyB9G,SAAS,CAACkF,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO5E,cAAA,CAAMyG,UAAN,CAA4B,CAACvG,KAAD,EAAQM,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACMN,KADN,EAEOM,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
1
|
+
{"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","sv","_component","isJest","animatedStyle","makeMutable","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n 'layout',\n maybeBuild(layout),\n this.sv\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n 'entering',\n maybeBuild(entering),\n this.sv\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n 'exiting',\n maybeBuild(exiting),\n this.sv\n );\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA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QACF,CAfM,MAeA,IACL2B,GAAG,KAAK,6BAAR,IACA,CAAC,IAAAmG,iCAAA,GAFI,EAGL;UACAvF,KAAK,CAACZ,GAAD,CAAL,GAAavB,KAAb;QACD;MACF;;MACD,OAAOmC,KAAP;IACD;;IAEDwF,MAAM,GAAG;MACP,MAAMxF,KAAK,GAAG,KAAKsE,uBAAL,CAA6B,KAAKtE,KAAlC,CAAd;;MACA,IAAI,IAAAgB,uBAAA,GAAJ,EAAc;QACZhB,KAAK,CAACiB,aAAN,GAAsB,KAAKA,aAA3B;MACD;;MAED,IAAI,KAAK0D,cAAT,EAAyB;QACvB,KAAKA,cAAL,GAAsB,KAAtB;MACD;;MAED,MAAMc,aAAa,GAAG1D,qBAAA,CAAS2D,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;;MAIA,oBACE,6BAAC,SAAD,eAAe7F,KAAf;QAAsB,GAAG,EAAE,KAAK8F;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EA/WD;;EAV4D,gBAQxD5F,iBARwD;;EA4X9DA,iBAAiB,CAACkG,WAAlB,GAAiC,qBAC/BvG,SAAS,CAACuG,WAAV,IAAyBvG,SAAS,CAAC2E,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAOrE,cAAA,CAAMkG,UAAN,CAA4B,CAAChG,KAAD,EAAQK,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACML,KADN,EAEOK,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
@@ -77,6 +77,10 @@ class NativeReanimated {
|
|
|
77
77
|
return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
configureLayoutAnimation(viewTag, type, config, viewSharedValue) {
|
|
81
|
+
this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config, viewSharedValue);
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
enableLayoutAnimations(flag) {
|
|
81
85
|
this.InnerNativeModule.enableLayoutAnimations(flag);
|
|
82
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\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 }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\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 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(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;;AAAA;;;;
|
|
1
|
+
{"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\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 }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\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: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\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(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;;AAAA;;;;AAUO,MAAMA,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;;IACzB,IAAIC,MAAM,CAACC,uBAAP,KAAmCC,SAAnC,IAAgDH,MAApD,EAA4D;MAC1D,MAAM;QAAEI;MAAF,IAAuBC,0BAA7B;MACAD,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEE,kBAAlB;IACD;;IACD,KAAKC,iBAAL,GAAyBN,MAAM,CAACC,uBAAhC;IACA,KAAKF,MAAL,GAAcA,MAAd;EACD;;EAEDQ,oBAAoB,CAACC,WAAD,EAA2C;IAC7D,OAAO,KAAKF,iBAAL,CAAuBC,oBAAvB,CAA4CC,WAA5C,CAAP;EACD;;EAEDC,aAAa,CAAIC,KAAJ,EAAiB;IAC5B,OAAO,KAAKJ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WAAvB,CAAmCC,OAAnC,EAA4CC,QAA5C,EAAsDC,QAAtD,CAAP;EACD;;EAEDC,wBAAwB,CACtBH,OADsB,EAEtBI,IAFsB,EAGtBC,MAHsB,EAItBC,eAJsB,EAKtB;IACA,KAAKlC,iBAAL,CAAuB+B,wBAAvB,CACEH,OADF,EAEEI,IAFF,EAGEC,MAHF,EAIEC,eAJF;EAMD;;EAEDC,sBAAsB,CAACC,IAAD,EAAsB;IAC1C,KAAKpC,iBAAL,CAAuBmC,sBAAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKvC,iBAAL,CAAuBqC,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACC,iBAAD,EAAkD;IAC1E,OAAO,KAAKzC,iBAAL,CAAuBwC,0BAAvB,CAAkDC,iBAAlD,CAAP;EACD;;EAEDC,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAK3C,iBAAL,CAAuB0C,6BAAvB,CAAqDC,UAArD;EACD;;AAhH2B"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.checkPluginState = void 0;
|
|
7
|
+
exports.configureLayoutAnimations = configureLayoutAnimations;
|
|
7
8
|
exports.configureProps = configureProps;
|
|
8
9
|
exports.enableLayoutAnimations = enableLayoutAnimations;
|
|
9
10
|
exports.getTimestamp = getTimestamp;
|
|
@@ -174,7 +175,8 @@ function workletValueSetter(value) {
|
|
|
174
175
|
animation.onStart(animation, this.value, timestamp, previousAnimation);
|
|
175
176
|
};
|
|
176
177
|
|
|
177
|
-
|
|
178
|
+
const currentTimestamp = getTimestamp();
|
|
179
|
+
initializeAnimation(currentTimestamp);
|
|
178
180
|
|
|
179
181
|
const step = timestamp => {
|
|
180
182
|
if (animation.cancelled) {
|
|
@@ -199,13 +201,7 @@ function workletValueSetter(value) {
|
|
|
199
201
|
};
|
|
200
202
|
|
|
201
203
|
this._animation = animation;
|
|
202
|
-
|
|
203
|
-
if (_frameTimestamp) {
|
|
204
|
-
// frame
|
|
205
|
-
step(_frameTimestamp);
|
|
206
|
-
} else {
|
|
207
|
-
requestAnimationFrame(step);
|
|
208
|
-
}
|
|
204
|
+
step(currentTimestamp);
|
|
209
205
|
} else {
|
|
210
206
|
// prevent setting again to the same value
|
|
211
207
|
// and triggering the mappers that treat this value as an input
|
|
@@ -262,7 +258,7 @@ function workletValueSetterJS(value) {
|
|
|
262
258
|
};
|
|
263
259
|
|
|
264
260
|
this._animation = animation;
|
|
265
|
-
|
|
261
|
+
step(getTimestamp());
|
|
266
262
|
} else {
|
|
267
263
|
this._setValue && this._setValue(value);
|
|
268
264
|
}
|
|
@@ -348,6 +344,10 @@ function enableLayoutAnimations(flag) {
|
|
|
348
344
|
}
|
|
349
345
|
}
|
|
350
346
|
|
|
347
|
+
function configureLayoutAnimations(viewTag, type, config, viewSharedValue) {
|
|
348
|
+
_NativeReanimated.default.configureLayoutAnimation(viewTag, type, config, viewSharedValue);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
351
|
function configureProps(uiProps, nativeProps) {
|
|
352
352
|
if (!(0, _PlatformChecker.nativeShouldBeMock)()) {
|
|
353
353
|
_NativeReanimated.default.configureProps(uiProps, nativeProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["global","_setGlobalConsole","undefined","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","shouldBeUseWeb","isConfigured","isConfiguredCheck","pushFrame","frame","NativeReanimatedModule","requestFrame","native","requestAnimationFrame","_WORKLET","_log","s","console","log","runOnUI","worklet","makeShareable","value","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","_getTimestamp","nativeShouldBeMock","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","Platform","OS","workletValueSetter","previousAnimation","_animation","cancelled","onFrame","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","step","finished","workletValueSetterJS","_setValue","makeMutable","makeRemote","object","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","runOnJS","fun","__callAsync","installCoreFunctions","isWeb","capturableConsole","debug","warn","error","info","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureProps","uiProps","nativeProps","jestResetJsReanimatedModule","jestResetModule"],"sources":["core.ts"],"sourcesContent":["/* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp _setGlobalConsole */\nimport NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport {\n BasicWorkletFunction,\n ComplexWorkletFunction,\n SharedValue,\n AnimationObject,\n AnimatableValue,\n Timestamp,\n} from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\nimport JSReanimated from './js-reanimated/JSReanimated';\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\nexport type WorkletValue =\n | (() => AnimationObject)\n | AnimationObject\n | AnimatableValue\n | Descriptor;\ninterface WorkletValueSetterContext {\n _animation?: AnimationObject | null;\n _value?: AnimatableValue | Descriptor;\n value?: AnimatableValue;\n _setValue?: (val: AnimatableValue | Descriptor) => void;\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\nfunction pushFrame(frame: (timestamp: Timestamp) => void): void {\n (NativeReanimatedModule as JSReanimated).pushFrame(frame);\n}\n\nexport function requestFrame(frame: (timestamp: Timestamp) => void): void {\n 'worklet';\n if (NativeReanimatedModule.native) {\n requestAnimationFrame(frame);\n } else {\n pushFrame(frame);\n }\n}\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function runOnUI<A extends any[], R>(\n worklet: ComplexWorkletFunction<A, R>\n): (...args: A) => void {\n return makeShareable(worklet);\n}\n\nexport function makeShareable<T>(value: T): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeShareable(value);\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\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n }\n return _getTimestamp();\n}\n\nfunction workletValueSetter<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n 'worklet';\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (this._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n initializeAnimation(getTimestamp());\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n this._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n this._animation = animation;\n\n if (_frameTimestamp) {\n // frame\n step(_frameTimestamp);\n } else {\n requestAnimationFrame(step);\n }\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (this._value === value) {\n return;\n }\n this._value = value as Descriptor | AnimatableValue;\n }\n}\n\n// We cannot use pushFrame\n// so we use own implementation for js\nfunction workletValueSetterJS<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame)\n ) {\n // animated set\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n let initializeAnimation: ((timestamp: number) => void) | null = (\n timestamp: number\n ) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n if (initializeAnimation) {\n initializeAnimation(timestamp);\n initializeAnimation = null; // prevent closure from keeping ref to previous animation\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n this._setValue && this._setValue(animation.current as AnimatableValue);\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestFrame(step);\n }\n };\n\n this._animation = animation;\n\n requestFrame(step);\n } else {\n this._setValue && this._setValue(value as AnimatableValue | Descriptor);\n }\n}\n\nexport function makeMutable<T>(value: T): SharedValue<T> {\n isConfiguredCheck();\n return NativeReanimatedModule.makeMutable(value);\n}\n\nexport function makeRemote<T>(object = {}): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeRemote(object);\n}\n\nexport function startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void = () => {\n // noop\n },\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]> = []\n): number {\n isConfiguredCheck();\n return NativeReanimatedModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n}\n\nexport function stopMapper(mapperId: number): void {\n NativeReanimatedModule.stopMapper(mapperId);\n}\n\nexport interface RunOnJSFunction<A extends any[], R> {\n __callAsync?: (...args: A) => void;\n (...args: A): R;\n}\n\nexport function runOnJS<A extends any[], R>(\n fun: RunOnJSFunction<A, R>\n): () => void {\n 'worklet';\n if (!_WORKLET) {\n return fun;\n }\n if (!fun.__callAsync) {\n throw new Error(\n \"Attempting to call runOnJS with an object that is not a host function. Using runOnJS is only possible with methods that are defined on the main React-Native Javascript thread and that aren't marked as worklets\"\n );\n } else {\n return fun.__callAsync;\n }\n}\n\nNativeReanimatedModule.installCoreFunctions(\n NativeReanimatedModule.native\n ? (workletValueSetter as <T>(value: T) => void)\n : (workletValueSetterJS as <T>(value: T) => void)\n);\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 configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n\nexport function jestResetJsReanimatedModule() {\n (NativeReanimatedModule as JSReanimated).jestResetModule();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;AAHA;AAeA,IAAIA,MAAM,CAACC,iBAAP,KAA6BC,SAAjC,EAA4C;EAC1C;EACAF,MAAM,CAACC,iBAAP,GAA2B,MAAM,CAC/B;EACD,CAFD;AAGD;;AAmBD,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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;EAC3C5E,yBAAD,CAAyC6E,eAAzC;AACD"}
|
|
1
|
+
{"version":3,"names":["global","_setGlobalConsole","undefined","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","shouldBeUseWeb","isConfigured","isConfiguredCheck","pushFrame","frame","NativeReanimatedModule","requestFrame","native","requestAnimationFrame","_WORKLET","_log","s","console","log","runOnUI","worklet","makeShareable","value","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","_getTimestamp","nativeShouldBeMock","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","Platform","OS","workletValueSetter","previousAnimation","_animation","cancelled","onFrame","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","currentTimestamp","step","finished","workletValueSetterJS","_setValue","makeMutable","makeRemote","object","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","runOnJS","fun","__callAsync","installCoreFunctions","isWeb","capturableConsole","debug","warn","error","info","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","viewSharedValue","configureLayoutAnimation","configureProps","uiProps","nativeProps","jestResetJsReanimatedModule","jestResetModule"],"sources":["core.ts"],"sourcesContent":["/* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp _setGlobalConsole */\nimport NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport {\n BasicWorkletFunction,\n ComplexWorkletFunction,\n SharedValue,\n AnimationObject,\n AnimatableValue,\n Timestamp,\n} from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\nimport JSReanimated from './js-reanimated/JSReanimated';\nimport { LayoutAnimationFunction } from './layoutReanimation';\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\nexport type WorkletValue =\n | (() => AnimationObject)\n | AnimationObject\n | AnimatableValue\n | Descriptor;\ninterface WorkletValueSetterContext {\n _animation?: AnimationObject | null;\n _value?: AnimatableValue | Descriptor;\n value?: AnimatableValue;\n _setValue?: (val: AnimatableValue | Descriptor) => void;\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\nfunction pushFrame(frame: (timestamp: Timestamp) => void): void {\n (NativeReanimatedModule as JSReanimated).pushFrame(frame);\n}\n\nexport function requestFrame(frame: (timestamp: Timestamp) => void): void {\n 'worklet';\n if (NativeReanimatedModule.native) {\n requestAnimationFrame(frame);\n } else {\n pushFrame(frame);\n }\n}\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function runOnUI<A extends any[], R>(\n worklet: ComplexWorkletFunction<A, R>\n): (...args: A) => void {\n return makeShareable(worklet);\n}\n\nexport function makeShareable<T>(value: T): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeShareable(value);\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\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n }\n return _getTimestamp();\n}\n\nfunction workletValueSetter<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n 'worklet';\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (this._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n const currentTimestamp = getTimestamp();\n initializeAnimation(currentTimestamp);\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n this._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n this._animation = animation;\n step(currentTimestamp);\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (this._value === value) {\n return;\n }\n this._value = value as Descriptor | AnimatableValue;\n }\n}\n\n// We cannot use pushFrame\n// so we use own implementation for js\nfunction workletValueSetterJS<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame)\n ) {\n // animated set\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n let initializeAnimation: ((timestamp: number) => void) | null = (\n timestamp: number\n ) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n if (initializeAnimation) {\n initializeAnimation(timestamp);\n initializeAnimation = null; // prevent closure from keeping ref to previous animation\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n this._setValue && this._setValue(animation.current as AnimatableValue);\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestFrame(step);\n }\n };\n\n this._animation = animation;\n step(getTimestamp());\n } else {\n this._setValue && this._setValue(value as AnimatableValue | Descriptor);\n }\n}\n\nexport function makeMutable<T>(value: T): SharedValue<T> {\n isConfiguredCheck();\n return NativeReanimatedModule.makeMutable(value);\n}\n\nexport function makeRemote<T>(object = {}): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeRemote(object);\n}\n\nexport function startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void = () => {\n // noop\n },\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]> = []\n): number {\n isConfiguredCheck();\n return NativeReanimatedModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n}\n\nexport function stopMapper(mapperId: number): void {\n NativeReanimatedModule.stopMapper(mapperId);\n}\n\nexport interface RunOnJSFunction<A extends any[], R> {\n __callAsync?: (...args: A) => void;\n (...args: A): R;\n}\n\nexport function runOnJS<A extends any[], R>(\n fun: RunOnJSFunction<A, R>\n): () => void {\n 'worklet';\n if (!_WORKLET) {\n return fun;\n }\n if (!fun.__callAsync) {\n throw new Error(\n \"Attempting to call runOnJS with an object that is not a host function. Using runOnJS is only possible with methods that are defined on the main React-Native Javascript thread and that aren't marked as worklets\"\n );\n } else {\n return fun.__callAsync;\n }\n}\n\nNativeReanimatedModule.installCoreFunctions(\n NativeReanimatedModule.native\n ? (workletValueSetter as <T>(value: T) => void)\n : (workletValueSetterJS as <T>(value: T) => void)\n);\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 viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n}\n\nexport function configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n\nexport function jestResetJsReanimatedModule() {\n (NativeReanimatedModule as JSReanimated).jestResetModule();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;AAHA;AAgBA,IAAIA,MAAM,CAACC,iBAAP,KAA6BC,SAAjC,EAA4C;EAC1C;EACAF,MAAM,CAACC,iBAAP,GAA2B,MAAM,CAC/B;EACD,CAFD;AAGD;;AAmBD,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,SAASM,SAAT,CAAmBC,KAAnB,EAAgE;EAC7DC,yBAAD,CAAyCF,SAAzC,CAAmDC,KAAnD;AACD;;AAEM,SAASE,YAAT,CAAsBF,KAAtB,EAAmE;EACxE;;EACA,IAAIC,yBAAA,CAAuBE,MAA3B,EAAmC;IACjCC,q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C;EAAA,IADNC,YACM,uEADS,IACT;;EACN,IAAIA,YAAJ,EAAkB;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IADT;MAEfD,SAAS,EAAE;IAFI,CAAjB;;IAIAvE,yBAAA,CAAuBsE,sBAAvB,CAA8CE,IAA9C;EACD,CAND,MAMO,IACL,CAACH,cAAc,CAACE,SAAhB,IACAF,cAAc,CAACC,sBAAf,KAA0CE,IAFrC,EAGL;IACAH,cAAc,CAACC,sBAAf,GAAwCE,IAAxC;;IACAxE,yBAAA,CAAuBsE,sBAAvB,CAA8CE,IAA9C;EACD;AACF;;AAEM,SAASE,yBAAT,CACL5D,OADK,EAEL6D,IAFK,EAGLC,MAHK,EAILC,eAJK,EAKC;EACN7E,yBAAA,CAAuB8E,wBAAvB,CACEhE,OADF,EAEE6D,IAFF,EAGEC,MAHF,EAIEC,eAJF;AAMD;;AAEM,SAASE,cAAT,CAAwBC,OAAxB,EAA2CC,WAA3C,EAAwE;EAC7E,IAAI,CAAC,IAAA1D,mCAAA,GAAL,EAA2B;IACzBvB,yBAAA,CAAuB+E,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF;;AAEM,SAASC,2BAAT,GAAuC;EAC3ClF,yBAAD,CAAyCmF,eAAzC;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (tag: number
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (\n tag: number,\n cancelled: boolean,\n removeView: boolean\n ) => void;\n const _startObservingProgress: (\n tag: number,\n viewSharedValue: { value: unknown; _value: unknown },\n type: string\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => 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 LayoutAnimationRepository: {\n configs: Record<string, unknown>;\n registerConfig(tag: number, config: Record<string, unknown>): void;\n removeConfig(tag: number): void;\n startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;\n };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n _setGlobalConsole: (console?: ReanimatedConsole) => void;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _stopObservingProgress: (tag: number, flag: boolean) => void;\n _startObservingProgress: (\n tag: number,\n flag: { value: boolean; _value: boolean }\n ) => void;\n _setGestureState: (handlerTag: number, newState: number) => 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 LayoutAnimationRepository: {\n startAnimationForTag(\n tag: number,\n type: string,\n yogaValues: Record<string, number>,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: { value: unknown; _value: unknown }\n ): void;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n }\n }\n}\n"],"mappings":""}
|