react-native-reanimated 3.0.0-rc.7 → 3.0.0-rc.8
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/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +161 -165
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
- package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +142 -0
- package/Common/cpp/SharedItems/Shareables.h +455 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +54 -26
- package/Common/cpp/Tools/RuntimeDecorator.h +11 -2
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
- package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
- package/android/src/main/cpp/LayoutAnimations.h +4 -4
- package/android/src/main/cpp/NativeProxy.cpp +50 -63
- package/ios/native/NativeProxy.mm +26 -42
- package/lib/commonjs/createAnimatedComponent.js +7 -11
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +7 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +111 -209
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +24 -50
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +8 -33
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +16 -100
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +91 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +153 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +58 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +7 -12
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +7 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/core.js +66 -188
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -52
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +8 -31
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +16 -95
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +5 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +84 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +133 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +45 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/package.json +1 -1
- package/plugin.js +31 -15
- package/src/createAnimatedComponent.tsx +8 -24
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +34 -53
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/util.ts +1 -0
- package/src/reanimated2/commonTypes.ts +29 -4
- package/src/reanimated2/core.ts +103 -230
- package/src/reanimated2/globals.d.ts +26 -26
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -64
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/interpolateColor.ts +2 -2
- package/src/reanimated2/jestUtils.ts +14 -29
- package/src/reanimated2/js-reanimated/JSReanimated.ts +19 -93
- package/src/reanimated2/js-reanimated/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +94 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/shareables.ts +121 -0
- package/src/reanimated2/threads.ts +46 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
- package/Common/cpp/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
- package/Common/cpp/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
- package/Common/cpp/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
- package/Common/cpp/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/Tools/Mapper.h +0 -51
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
|
-
#include <react/renderer/core/ShadowNode.h>
|
|
6
|
-
#endif
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <vector>
|
|
10
|
-
#include "HostFunctionHandler.h"
|
|
11
|
-
#include "JSIStoreValueUser.h"
|
|
12
|
-
#include "SharedParent.h"
|
|
13
|
-
#include "WorkletsCache.h"
|
|
14
|
-
|
|
15
|
-
using namespace facebook::react;
|
|
16
|
-
|
|
17
|
-
namespace reanimated {
|
|
18
|
-
|
|
19
|
-
class HostFunctionWrapper;
|
|
20
|
-
class AnimatedSensorModule;
|
|
21
|
-
|
|
22
|
-
class ValueWrapper {
|
|
23
|
-
friend AnimatedSensorModule;
|
|
24
|
-
|
|
25
|
-
public:
|
|
26
|
-
ValueWrapper() {}
|
|
27
|
-
explicit ValueWrapper(ValueType _type) : type(_type) {}
|
|
28
|
-
ValueType getType() const {
|
|
29
|
-
return type;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
virtual ~ValueWrapper() {}
|
|
33
|
-
|
|
34
|
-
static inline bool asBoolean(
|
|
35
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
36
|
-
static inline double asNumber(
|
|
37
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
38
|
-
static inline const std::string &asString(
|
|
39
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
40
|
-
static inline const std::shared_ptr<HostFunctionHandler> &asHostFunction(
|
|
41
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
42
|
-
static inline const std::shared_ptr<FrozenObject> &asFrozenObject(
|
|
43
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
44
|
-
static inline const std::shared_ptr<RemoteObject> &asRemoteObject(
|
|
45
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
46
|
-
static inline std::vector<std::shared_ptr<ShareableValue>> &asFrozenArray(
|
|
47
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
48
|
-
static inline const std::shared_ptr<MutableValue> &asMutableValue(
|
|
49
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
50
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
51
|
-
static inline const ShadowNode::Shared &asShadowNode(
|
|
52
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
53
|
-
#endif
|
|
54
|
-
|
|
55
|
-
static const HostFunctionWrapper *asHostFunctionWrapper(
|
|
56
|
-
const std::unique_ptr<ValueWrapper> &valueContainer);
|
|
57
|
-
|
|
58
|
-
protected:
|
|
59
|
-
ValueType type;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
class BooleanValueWrapper : public ValueWrapper {
|
|
63
|
-
public:
|
|
64
|
-
explicit BooleanValueWrapper(const bool _value)
|
|
65
|
-
: ValueWrapper(ValueType::BoolType), value(_value) {}
|
|
66
|
-
bool value;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
class NumberValueWrapper : public ValueWrapper {
|
|
70
|
-
public:
|
|
71
|
-
explicit NumberValueWrapper(const double _value)
|
|
72
|
-
: ValueWrapper(ValueType::NumberType), value(_value) {}
|
|
73
|
-
double value;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
class StringValueWrapper : public ValueWrapper {
|
|
77
|
-
public:
|
|
78
|
-
explicit StringValueWrapper(const std::string &_value)
|
|
79
|
-
: ValueWrapper(ValueType::StringType), value(_value) {}
|
|
80
|
-
std::string value;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
class HostFunctionWrapper : public ValueWrapper {
|
|
84
|
-
public:
|
|
85
|
-
explicit HostFunctionWrapper(
|
|
86
|
-
const std::shared_ptr<HostFunctionHandler> &_value)
|
|
87
|
-
: ValueWrapper(ValueType::HostFunctionType), value(_value) {}
|
|
88
|
-
std::shared_ptr<HostFunctionHandler> value;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
class FrozenObjectWrapper : public ValueWrapper {
|
|
92
|
-
public:
|
|
93
|
-
explicit FrozenObjectWrapper(const std::shared_ptr<FrozenObject> &_value)
|
|
94
|
-
: ValueWrapper(ValueType::FrozenObjectType), value(_value) {}
|
|
95
|
-
std::shared_ptr<FrozenObject> value;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
class RemoteObjectWrapper : public ValueWrapper {
|
|
99
|
-
public:
|
|
100
|
-
explicit RemoteObjectWrapper(const std::shared_ptr<RemoteObject> &_value)
|
|
101
|
-
: ValueWrapper(ValueType::RemoteObjectType), value(_value) {}
|
|
102
|
-
std::shared_ptr<RemoteObject> value;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
class FrozenArrayWrapper : public ValueWrapper {
|
|
106
|
-
public:
|
|
107
|
-
FrozenArrayWrapper() : ValueWrapper(ValueType::FrozenArrayType) {}
|
|
108
|
-
explicit FrozenArrayWrapper(
|
|
109
|
-
const std::vector<std::shared_ptr<ShareableValue>> &_value)
|
|
110
|
-
: ValueWrapper(ValueType::FrozenArrayType), value(_value) {}
|
|
111
|
-
std::vector<std::shared_ptr<ShareableValue>> value;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
class MutableValueWrapper : public ValueWrapper {
|
|
115
|
-
public:
|
|
116
|
-
explicit MutableValueWrapper(const std::shared_ptr<MutableValue> &_value)
|
|
117
|
-
: ValueWrapper(ValueType::MutableValueType), value(_value) {}
|
|
118
|
-
std::shared_ptr<MutableValue> value;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
122
|
-
class ShadowNodeValueWrapper : public ValueWrapper {
|
|
123
|
-
public:
|
|
124
|
-
explicit ShadowNodeValueWrapper(const ShadowNode::Shared &_value)
|
|
125
|
-
: ValueWrapper(ValueType::ShadowNodeType), value(_value) {}
|
|
126
|
-
ShadowNode::Shared value;
|
|
127
|
-
};
|
|
128
|
-
#endif
|
|
129
|
-
|
|
130
|
-
inline bool ValueWrapper::asBoolean(
|
|
131
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
132
|
-
return static_cast<BooleanValueWrapper *>(valueContainer.get())->value;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
inline double ValueWrapper::asNumber(
|
|
136
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
137
|
-
return static_cast<NumberValueWrapper *>(valueContainer.get())->value;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
inline const std::string &ValueWrapper::asString(
|
|
141
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
142
|
-
return static_cast<StringValueWrapper *>(valueContainer.get())->value;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
inline const std::shared_ptr<HostFunctionHandler> &ValueWrapper::asHostFunction(
|
|
146
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
147
|
-
return static_cast<HostFunctionWrapper *>(valueContainer.get())->value;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
inline const std::shared_ptr<FrozenObject> &ValueWrapper::asFrozenObject(
|
|
151
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
152
|
-
return static_cast<FrozenObjectWrapper *>(valueContainer.get())->value;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
inline const std::shared_ptr<RemoteObject> &ValueWrapper::asRemoteObject(
|
|
156
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
157
|
-
return static_cast<RemoteObjectWrapper *>(valueContainer.get())->value;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
inline std::vector<std::shared_ptr<ShareableValue>>
|
|
161
|
-
&ValueWrapper::asFrozenArray(
|
|
162
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
163
|
-
return static_cast<FrozenArrayWrapper *>(valueContainer.get())->value;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
inline const std::shared_ptr<MutableValue> &ValueWrapper::asMutableValue(
|
|
167
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
168
|
-
return static_cast<MutableValueWrapper *>(valueContainer.get())->value;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
172
|
-
inline const ShadowNode::Shared &ValueWrapper::asShadowNode(
|
|
173
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
174
|
-
return static_cast<ShadowNodeValueWrapper *>(valueContainer.get())->value;
|
|
175
|
-
}
|
|
176
|
-
#endif
|
|
177
|
-
|
|
178
|
-
inline const HostFunctionWrapper *ValueWrapper::asHostFunctionWrapper(
|
|
179
|
-
const std::unique_ptr<ValueWrapper> &valueContainer) {
|
|
180
|
-
return static_cast<HostFunctionWrapper *>(valueContainer.get());
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
} // namespace reanimated
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#include "JSIStoreValueUser.h"
|
|
2
|
-
#include "RuntimeManager.h"
|
|
3
|
-
#ifdef ANDROID
|
|
4
|
-
#include <AndroidScheduler.h>
|
|
5
|
-
#endif
|
|
6
|
-
|
|
7
|
-
namespace reanimated {
|
|
8
|
-
|
|
9
|
-
std::weak_ptr<jsi::Value> StoreUser::getWeakRef(jsi::Runtime &rt) {
|
|
10
|
-
const std::lock_guard<std::recursive_mutex> lock(storeUserData->storeMutex);
|
|
11
|
-
if (storeUserData->store.count(identifier) == 0) {
|
|
12
|
-
storeUserData->store[identifier] =
|
|
13
|
-
std::vector<std::shared_ptr<jsi::Value>>();
|
|
14
|
-
}
|
|
15
|
-
std::shared_ptr<jsi::Value> sv =
|
|
16
|
-
std::make_shared<jsi::Value>(rt, jsi::Value::undefined());
|
|
17
|
-
storeUserData->store[identifier].push_back(sv);
|
|
18
|
-
|
|
19
|
-
return sv;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
StoreUser::StoreUser(
|
|
23
|
-
std::shared_ptr<Scheduler> s,
|
|
24
|
-
const RuntimeManager &runtimeManager)
|
|
25
|
-
: scheduler(s) {
|
|
26
|
-
storeUserData = runtimeManager.storeUserData;
|
|
27
|
-
identifier = storeUserData->ctr++;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
StoreUser::~StoreUser() {
|
|
31
|
-
int id = identifier;
|
|
32
|
-
std::shared_ptr<Scheduler> strongScheduler = scheduler.lock();
|
|
33
|
-
if (strongScheduler != nullptr) {
|
|
34
|
-
std::shared_ptr<StaticStoreUser> sud = storeUserData;
|
|
35
|
-
#ifdef ANDROID
|
|
36
|
-
jni::ThreadScope::WithClassLoader([&] {
|
|
37
|
-
strongScheduler->scheduleOnUI([id, sud]() {
|
|
38
|
-
const std::lock_guard<std::recursive_mutex> lock(sud->storeMutex);
|
|
39
|
-
if (sud->store.count(id) > 0) {
|
|
40
|
-
sud->store.erase(id);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
#else
|
|
45
|
-
strongScheduler->scheduleOnUI([id, sud]() {
|
|
46
|
-
const std::lock_guard<std::recursive_mutex> lock(sud->storeMutex);
|
|
47
|
-
if (sud->store.count(id) > 0) {
|
|
48
|
-
sud->store.erase(id);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
#endif
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
} // namespace reanimated
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
#include <stdio.h>
|
|
5
|
-
#include <memory>
|
|
6
|
-
#include <mutex>
|
|
7
|
-
#include <unordered_map>
|
|
8
|
-
#include <vector>
|
|
9
|
-
#include "Scheduler.h"
|
|
10
|
-
|
|
11
|
-
using namespace facebook;
|
|
12
|
-
|
|
13
|
-
namespace reanimated {
|
|
14
|
-
|
|
15
|
-
class RuntimeManager;
|
|
16
|
-
|
|
17
|
-
struct StaticStoreUser {
|
|
18
|
-
std::atomic<int> ctr;
|
|
19
|
-
std::unordered_map<int, std::vector<std::shared_ptr<jsi::Value>>> store;
|
|
20
|
-
std::recursive_mutex storeMutex;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
class StoreUser {
|
|
24
|
-
int identifier = 0;
|
|
25
|
-
std::weak_ptr<Scheduler> scheduler;
|
|
26
|
-
std::shared_ptr<StaticStoreUser> storeUserData;
|
|
27
|
-
|
|
28
|
-
public:
|
|
29
|
-
StoreUser(std::shared_ptr<Scheduler> s, const RuntimeManager &runtimeManager);
|
|
30
|
-
|
|
31
|
-
std::weak_ptr<jsi::Value> getWeakRef(jsi::Runtime &rt);
|
|
32
|
-
void removeRefs();
|
|
33
|
-
|
|
34
|
-
virtual ~StoreUser();
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
} // namespace reanimated
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#include "Mapper.h"
|
|
2
|
-
#include "MutableValue.h"
|
|
3
|
-
#include "SharedParent.h"
|
|
4
|
-
|
|
5
|
-
namespace reanimated {
|
|
6
|
-
|
|
7
|
-
Mapper::Mapper(
|
|
8
|
-
NativeReanimatedModule *module,
|
|
9
|
-
unsigned long id,
|
|
10
|
-
std::shared_ptr<jsi::Function> mapper,
|
|
11
|
-
std::vector<std::shared_ptr<MutableValue>> inputs,
|
|
12
|
-
std::vector<std::shared_ptr<MutableValue>> outputs)
|
|
13
|
-
: id(id), module(module), mapper(mapper), inputs(inputs), outputs(outputs) {
|
|
14
|
-
auto markDirty = [this, module]() {
|
|
15
|
-
this->dirty = true;
|
|
16
|
-
module->maybeRequestRender();
|
|
17
|
-
};
|
|
18
|
-
for (auto input : inputs) {
|
|
19
|
-
input->addListener(id, markDirty);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
void Mapper::execute(jsi::Runtime &rt) {
|
|
24
|
-
dirty = false;
|
|
25
|
-
if (optimalizationLvl == 0) {
|
|
26
|
-
mapper->callWithThis(rt, *mapper); // call styleUpdater
|
|
27
|
-
} else {
|
|
28
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
|
-
jsi::Value newStyle = userUpdater->call(rt).asObject(rt);
|
|
30
|
-
#else
|
|
31
|
-
jsi::Object newStyle = userUpdater->call(rt).asObject(rt);
|
|
32
|
-
#endif
|
|
33
|
-
auto jsViewDescriptorArray = viewDescriptors->getValue(rt)
|
|
34
|
-
.getObject(rt)
|
|
35
|
-
.getProperty(rt, "value")
|
|
36
|
-
.asObject(rt)
|
|
37
|
-
.getArray(rt);
|
|
38
|
-
for (int i = 0; i < jsViewDescriptorArray.length(rt); ++i) {
|
|
39
|
-
auto jsViewDescriptor =
|
|
40
|
-
jsViewDescriptorArray.getValueAtIndex(rt, i).getObject(rt);
|
|
41
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
42
|
-
updateProps(
|
|
43
|
-
rt, jsViewDescriptor.getProperty(rt, "shadowNodeWrapper"), newStyle);
|
|
44
|
-
#else
|
|
45
|
-
updateProps(
|
|
46
|
-
rt,
|
|
47
|
-
static_cast<int>(jsViewDescriptor.getProperty(rt, "tag").asNumber()),
|
|
48
|
-
jsViewDescriptor.getProperty(rt, "name"),
|
|
49
|
-
newStyle);
|
|
50
|
-
#endif
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
void Mapper::enableFastMode(
|
|
56
|
-
const int optimalizationLvl,
|
|
57
|
-
const std::shared_ptr<ShareableValue> &updater,
|
|
58
|
-
const std::shared_ptr<ShareableValue> &jsViewDescriptors) {
|
|
59
|
-
if (optimalizationLvl == 0) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
viewDescriptors = jsViewDescriptors;
|
|
63
|
-
this->optimalizationLvl = optimalizationLvl;
|
|
64
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
65
|
-
updateProps = [this](
|
|
66
|
-
jsi::Runtime &rt,
|
|
67
|
-
const jsi::Value &shadowNodeValue,
|
|
68
|
-
const jsi::Value &props) {
|
|
69
|
-
this->module->updateProps(rt, shadowNodeValue, props);
|
|
70
|
-
};
|
|
71
|
-
#else
|
|
72
|
-
// TODO: don't get public field, instead call this->module->updateProps
|
|
73
|
-
updateProps = module->updatePropsFunction;
|
|
74
|
-
#endif
|
|
75
|
-
jsi::Runtime &rt = *module->runtime;
|
|
76
|
-
userUpdater = std::make_shared<jsi::Function>(
|
|
77
|
-
updater->getValue(rt).asObject(rt).asFunction(rt));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
Mapper::~Mapper() {
|
|
81
|
-
for (auto input : inputs) {
|
|
82
|
-
input->removeListener(id);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
} // namespace reanimated
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
#include <stdio.h>
|
|
5
|
-
#include <memory>
|
|
6
|
-
#include <vector>
|
|
7
|
-
#include "NativeReanimatedModule.h"
|
|
8
|
-
#include "ShareableValue.h"
|
|
9
|
-
|
|
10
|
-
using namespace facebook;
|
|
11
|
-
|
|
12
|
-
namespace reanimated {
|
|
13
|
-
|
|
14
|
-
class MapperRegistry;
|
|
15
|
-
|
|
16
|
-
struct ViewDescriptor {
|
|
17
|
-
int tag;
|
|
18
|
-
jsi::Value name;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
class Mapper : public std::enable_shared_from_this<Mapper> {
|
|
22
|
-
friend MapperRegistry;
|
|
23
|
-
|
|
24
|
-
private:
|
|
25
|
-
unsigned long id;
|
|
26
|
-
NativeReanimatedModule *module;
|
|
27
|
-
std::shared_ptr<jsi::Function> mapper;
|
|
28
|
-
std::vector<std::shared_ptr<MutableValue>> inputs;
|
|
29
|
-
std::vector<std::shared_ptr<MutableValue>> outputs;
|
|
30
|
-
bool dirty = true;
|
|
31
|
-
std::shared_ptr<jsi::Function> userUpdater;
|
|
32
|
-
UpdatePropsFunction updateProps;
|
|
33
|
-
int optimalizationLvl = 0;
|
|
34
|
-
std::shared_ptr<ShareableValue> viewDescriptors;
|
|
35
|
-
|
|
36
|
-
public:
|
|
37
|
-
Mapper(
|
|
38
|
-
NativeReanimatedModule *module,
|
|
39
|
-
unsigned long id,
|
|
40
|
-
std::shared_ptr<jsi::Function> mapper,
|
|
41
|
-
std::vector<std::shared_ptr<MutableValue>> inputs,
|
|
42
|
-
std::vector<std::shared_ptr<MutableValue>> outputs);
|
|
43
|
-
void execute(jsi::Runtime &rt);
|
|
44
|
-
void enableFastMode(
|
|
45
|
-
const int optimalizationLvl,
|
|
46
|
-
const std::shared_ptr<ShareableValue> &updater,
|
|
47
|
-
const std::shared_ptr<ShareableValue> &jsViewDescriptors);
|
|
48
|
-
virtual ~Mapper();
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
} // namespace reanimated
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _core = require("../core");
|
|
4
|
-
|
|
5
|
-
var _styleAnimation = require("../animation/styleAnimation");
|
|
6
|
-
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
|
|
9
|
-
/* global _stopObservingProgress, _startObservingProgress */
|
|
10
|
-
_reactNative.LogBox.ignoreLogs(['Overriding previous layout animation with']);
|
|
11
|
-
|
|
12
|
-
(0, _core.runOnUI)(() => {
|
|
13
|
-
'worklet';
|
|
14
|
-
|
|
15
|
-
const enteringAnimationForTag = {};
|
|
16
|
-
global.LayoutAnimationRepository = {
|
|
17
|
-
startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {
|
|
18
|
-
const style = config(yogaValues);
|
|
19
|
-
let currentAnimation = style.animations;
|
|
20
|
-
|
|
21
|
-
if (type === 'entering') {
|
|
22
|
-
enteringAnimationForTag[tag] = currentAnimation;
|
|
23
|
-
} else if (type === 'layout') {
|
|
24
|
-
// When layout animation is requested, but entering is still running, we merge
|
|
25
|
-
// new layout animation targets into the ongoing animation
|
|
26
|
-
const enteringAnimation = enteringAnimationForTag[tag];
|
|
27
|
-
|
|
28
|
-
if (enteringAnimation) {
|
|
29
|
-
currentAnimation = { ...enteringAnimation,
|
|
30
|
-
...style.animations
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
_stopObservingProgress(tag, false, false);
|
|
36
|
-
|
|
37
|
-
viewSharedValue._value = Object.assign({}, viewSharedValue._value, style.initialValues);
|
|
38
|
-
const animation = (0, _styleAnimation.withStyleAnimation)(currentAnimation);
|
|
39
|
-
|
|
40
|
-
animation.callback = finished => {
|
|
41
|
-
if (finished) {
|
|
42
|
-
delete enteringAnimationForTag[tag];
|
|
43
|
-
const shouldRemoveView = type === 'exiting';
|
|
44
|
-
|
|
45
|
-
_stopObservingProgress(tag, finished, shouldRemoveView);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
style.callback && style.callback(finished);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
viewSharedValue.value = animation;
|
|
52
|
-
|
|
53
|
-
_startObservingProgress(tag, viewSharedValue, type);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
})();
|
|
58
|
-
//# sourceMappingURL=LayoutAnimationRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LogBox","ignoreLogs","runOnUI","enteringAnimationForTag","global","LayoutAnimationRepository","startAnimationForTag","tag","type","yogaValues","config","viewSharedValue","style","currentAnimation","animations","enteringAnimation","_stopObservingProgress","_value","Object","assign","initialValues","animation","withStyleAnimation","callback","finished","shouldRemoveView","value","_startObservingProgress"],"sources":["LayoutAnimationRepository.ts"],"sourcesContent":["/* global _stopObservingProgress, _startObservingProgress */\nimport { runOnUI } from '../core';\nimport { withStyleAnimation } from '../animation/styleAnimation';\nimport { LogBox } from 'react-native';\n\nLogBox.ignoreLogs(['Overriding previous layout animation with']);\n\nrunOnUI(() => {\n 'worklet';\n\n const enteringAnimationForTag: Record<string, any> = {};\n\n global.LayoutAnimationRepository = {\n startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === 'entering') {\n enteringAnimationForTag[tag] = currentAnimation;\n } else if (type === 'layout') {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag[tag];\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n _stopObservingProgress(tag, false, false);\n viewSharedValue._value = Object.assign(\n {},\n viewSharedValue._value,\n style.initialValues\n );\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n delete enteringAnimationForTag[tag];\n const shouldRemoveView = type === 'exiting';\n _stopObservingProgress(tag, finished, shouldRemoveView);\n }\n style.callback && style.callback(finished);\n };\n\n viewSharedValue.value = animation;\n _startObservingProgress(tag, viewSharedValue, type);\n },\n };\n})();\n"],"mappings":";;AACA;;AACA;;AACA;;AAHA;AAKAA,mBAAA,CAAOC,UAAP,CAAkB,CAAC,2CAAD,CAAlB;;AAEA,IAAAC,aAAA,EAAQ,MAAM;EACZ;;EAEA,MAAMC,uBAA4C,GAAG,EAArD;EAEAC,MAAM,CAACC,yBAAP,GAAmC;IACjCC,oBAAoB,CAACC,GAAD,EAAMC,IAAN,EAAYC,UAAZ,EAAwBC,MAAxB,EAAgCC,eAAhC,EAAiD;MACnE,MAAMC,KAAK,GAAGF,MAAM,CAACD,UAAD,CAApB;MACA,IAAII,gBAAgB,GAAGD,KAAK,CAACE,UAA7B;;MAEA,IAAIN,IAAI,KAAK,UAAb,EAAyB;QACvBL,uBAAuB,CAACI,GAAD,CAAvB,GAA+BM,gBAA/B;MACD,CAFD,MAEO,IAAIL,IAAI,KAAK,QAAb,EAAuB;QAC5B;QACA;QACA,MAAMO,iBAAiB,GAAGZ,uBAAuB,CAACI,GAAD,CAAjD;;QACA,IAAIQ,iBAAJ,EAAuB;UACrBF,gBAAgB,GAAG,EAAE,GAAGE,iBAAL;YAAwB,GAAGH,KAAK,CAACE;UAAjC,CAAnB;QACD;MACF;;MACDE,sBAAsB,CAACT,GAAD,EAAM,KAAN,EAAa,KAAb,CAAtB;;MACAI,eAAe,CAACM,MAAhB,GAAyBC,MAAM,CAACC,MAAP,CACvB,EADuB,EAEvBR,eAAe,CAACM,MAFO,EAGvBL,KAAK,CAACQ,aAHiB,CAAzB;MAKA,MAAMC,SAAS,GAAG,IAAAC,kCAAA,EAAmBT,gBAAnB,CAAlB;;MAEAQ,SAAS,CAACE,QAAV,GAAsBC,QAAD,IAAwB;QAC3C,IAAIA,QAAJ,EAAc;UACZ,OAAOrB,uBAAuB,CAACI,GAAD,CAA9B;UACA,MAAMkB,gBAAgB,GAAGjB,IAAI,KAAK,SAAlC;;UACAQ,sBAAsB,CAACT,GAAD,EAAMiB,QAAN,EAAgBC,gBAAhB,CAAtB;QACD;;QACDb,KAAK,CAACW,QAAN,IAAkBX,KAAK,CAACW,QAAN,CAAeC,QAAf,CAAlB;MACD,CAPD;;MASAb,eAAe,CAACe,KAAhB,GAAwBL,SAAxB;;MACAM,uBAAuB,CAACpB,GAAD,EAAMI,eAAN,EAAuBH,IAAvB,CAAvB;IACD;;EAlCgC,CAAnC;AAoCD,CAzCD"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
|
-
import { runOnUI } from '../core';
|
|
3
|
-
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
-
import { LogBox } from 'react-native';
|
|
5
|
-
LogBox.ignoreLogs(['Overriding previous layout animation with']);
|
|
6
|
-
runOnUI(() => {
|
|
7
|
-
'worklet';
|
|
8
|
-
|
|
9
|
-
const enteringAnimationForTag = {};
|
|
10
|
-
global.LayoutAnimationRepository = {
|
|
11
|
-
startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {
|
|
12
|
-
const style = config(yogaValues);
|
|
13
|
-
let currentAnimation = style.animations;
|
|
14
|
-
|
|
15
|
-
if (type === 'entering') {
|
|
16
|
-
enteringAnimationForTag[tag] = currentAnimation;
|
|
17
|
-
} else if (type === 'layout') {
|
|
18
|
-
// When layout animation is requested, but entering is still running, we merge
|
|
19
|
-
// new layout animation targets into the ongoing animation
|
|
20
|
-
const enteringAnimation = enteringAnimationForTag[tag];
|
|
21
|
-
|
|
22
|
-
if (enteringAnimation) {
|
|
23
|
-
currentAnimation = { ...enteringAnimation,
|
|
24
|
-
...style.animations
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_stopObservingProgress(tag, false, false);
|
|
30
|
-
|
|
31
|
-
viewSharedValue._value = Object.assign({}, viewSharedValue._value, style.initialValues);
|
|
32
|
-
const animation = withStyleAnimation(currentAnimation);
|
|
33
|
-
|
|
34
|
-
animation.callback = finished => {
|
|
35
|
-
if (finished) {
|
|
36
|
-
delete enteringAnimationForTag[tag];
|
|
37
|
-
const shouldRemoveView = type === 'exiting';
|
|
38
|
-
|
|
39
|
-
_stopObservingProgress(tag, finished, shouldRemoveView);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
style.callback && style.callback(finished);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
viewSharedValue.value = animation;
|
|
46
|
-
|
|
47
|
-
_startObservingProgress(tag, viewSharedValue, type);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
})();
|
|
52
|
-
//# sourceMappingURL=LayoutAnimationRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["runOnUI","withStyleAnimation","LogBox","ignoreLogs","enteringAnimationForTag","global","LayoutAnimationRepository","startAnimationForTag","tag","type","yogaValues","config","viewSharedValue","style","currentAnimation","animations","enteringAnimation","_stopObservingProgress","_value","Object","assign","initialValues","animation","callback","finished","shouldRemoveView","value","_startObservingProgress"],"sources":["LayoutAnimationRepository.ts"],"sourcesContent":["/* global _stopObservingProgress, _startObservingProgress */\nimport { runOnUI } from '../core';\nimport { withStyleAnimation } from '../animation/styleAnimation';\nimport { LogBox } from 'react-native';\n\nLogBox.ignoreLogs(['Overriding previous layout animation with']);\n\nrunOnUI(() => {\n 'worklet';\n\n const enteringAnimationForTag: Record<string, any> = {};\n\n global.LayoutAnimationRepository = {\n startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === 'entering') {\n enteringAnimationForTag[tag] = currentAnimation;\n } else if (type === 'layout') {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag[tag];\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n _stopObservingProgress(tag, false, false);\n viewSharedValue._value = Object.assign(\n {},\n viewSharedValue._value,\n style.initialValues\n );\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n delete enteringAnimationForTag[tag];\n const shouldRemoveView = type === 'exiting';\n _stopObservingProgress(tag, finished, shouldRemoveView);\n }\n style.callback && style.callback(finished);\n };\n\n viewSharedValue.value = animation;\n _startObservingProgress(tag, viewSharedValue, type);\n },\n };\n})();\n"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,SAAxB;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,MAAT,QAAuB,cAAvB;AAEAA,MAAM,CAACC,UAAP,CAAkB,CAAC,2CAAD,CAAlB;AAEAH,OAAO,CAAC,MAAM;EACZ;;EAEA,MAAMI,uBAA4C,GAAG,EAArD;EAEAC,MAAM,CAACC,yBAAP,GAAmC;IACjCC,oBAAoB,CAACC,GAAD,EAAMC,IAAN,EAAYC,UAAZ,EAAwBC,MAAxB,EAAgCC,eAAhC,EAAiD;MACnE,MAAMC,KAAK,GAAGF,MAAM,CAACD,UAAD,CAApB;MACA,IAAII,gBAAgB,GAAGD,KAAK,CAACE,UAA7B;;MAEA,IAAIN,IAAI,KAAK,UAAb,EAAyB;QACvBL,uBAAuB,CAACI,GAAD,CAAvB,GAA+BM,gBAA/B;MACD,CAFD,MAEO,IAAIL,IAAI,KAAK,QAAb,EAAuB;QAC5B;QACA;QACA,MAAMO,iBAAiB,GAAGZ,uBAAuB,CAACI,GAAD,CAAjD;;QACA,IAAIQ,iBAAJ,EAAuB;UACrBF,gBAAgB,GAAG,EAAE,GAAGE,iBAAL;YAAwB,GAAGH,KAAK,CAACE;UAAjC,CAAnB;QACD;MACF;;MACDE,sBAAsB,CAACT,GAAD,EAAM,KAAN,EAAa,KAAb,CAAtB;;MACAI,eAAe,CAACM,MAAhB,GAAyBC,MAAM,CAACC,MAAP,CACvB,EADuB,EAEvBR,eAAe,CAACM,MAFO,EAGvBL,KAAK,CAACQ,aAHiB,CAAzB;MAKA,MAAMC,SAAS,GAAGrB,kBAAkB,CAACa,gBAAD,CAApC;;MAEAQ,SAAS,CAACC,QAAV,GAAsBC,QAAD,IAAwB;QAC3C,IAAIA,QAAJ,EAAc;UACZ,OAAOpB,uBAAuB,CAACI,GAAD,CAA9B;UACA,MAAMiB,gBAAgB,GAAGhB,IAAI,KAAK,SAAlC;;UACAQ,sBAAsB,CAACT,GAAD,EAAMgB,QAAN,EAAgBC,gBAAhB,CAAtB;QACD;;QACDZ,KAAK,CAACU,QAAN,IAAkBV,KAAK,CAACU,QAAN,CAAeC,QAAf,CAAlB;MACD,CAPD;;MASAZ,eAAe,CAACc,KAAhB,GAAwBJ,SAAxB;;MACAK,uBAAuB,CAACnB,GAAD,EAAMI,eAAN,EAAuBH,IAAvB,CAAvB;IACD;;EAlCgC,CAAnC;AAoCD,CAzCM,CAAP"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
|
-
import { runOnUI } from '../core';
|
|
3
|
-
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
-
import { LogBox } from 'react-native';
|
|
5
|
-
|
|
6
|
-
LogBox.ignoreLogs(['Overriding previous layout animation with']);
|
|
7
|
-
|
|
8
|
-
runOnUI(() => {
|
|
9
|
-
'worklet';
|
|
10
|
-
|
|
11
|
-
const enteringAnimationForTag: Record<string, any> = {};
|
|
12
|
-
|
|
13
|
-
global.LayoutAnimationRepository = {
|
|
14
|
-
startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {
|
|
15
|
-
const style = config(yogaValues);
|
|
16
|
-
let currentAnimation = style.animations;
|
|
17
|
-
|
|
18
|
-
if (type === 'entering') {
|
|
19
|
-
enteringAnimationForTag[tag] = currentAnimation;
|
|
20
|
-
} else if (type === 'layout') {
|
|
21
|
-
// When layout animation is requested, but entering is still running, we merge
|
|
22
|
-
// new layout animation targets into the ongoing animation
|
|
23
|
-
const enteringAnimation = enteringAnimationForTag[tag];
|
|
24
|
-
if (enteringAnimation) {
|
|
25
|
-
currentAnimation = { ...enteringAnimation, ...style.animations };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
_stopObservingProgress(tag, false, false);
|
|
29
|
-
viewSharedValue._value = Object.assign(
|
|
30
|
-
{},
|
|
31
|
-
viewSharedValue._value,
|
|
32
|
-
style.initialValues
|
|
33
|
-
);
|
|
34
|
-
const animation = withStyleAnimation(currentAnimation);
|
|
35
|
-
|
|
36
|
-
animation.callback = (finished?: boolean) => {
|
|
37
|
-
if (finished) {
|
|
38
|
-
delete enteringAnimationForTag[tag];
|
|
39
|
-
const shouldRemoveView = type === 'exiting';
|
|
40
|
-
_stopObservingProgress(tag, finished, shouldRemoveView);
|
|
41
|
-
}
|
|
42
|
-
style.callback && style.callback(finished);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
viewSharedValue.value = animation;
|
|
46
|
-
_startObservingProgress(tag, viewSharedValue, type);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
})();
|