react-native-reanimated 3.13.0-rc.2 → 3.13.0
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/LayoutAnimationsManager.cpp +8 -2
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +3 -1
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +58 -33
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +19 -9
- package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.cpp +11 -7
- package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +14 -6
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +1 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +1 -1
- package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +1 -1
- package/Common/cpp/ReanimatedRuntime/WorkletRuntime.h +1 -1
- package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +6 -6
- package/Common/cpp/SharedItems/Shareables.cpp +25 -8
- package/Common/cpp/SharedItems/Shareables.h +12 -7
- package/android/CMakeLists.txt +1 -1
- package/android/src/main/cpp/LayoutAnimations.cpp +14 -0
- package/android/src/main/cpp/LayoutAnimations.h +5 -0
- package/android/src/main/cpp/NativeProxy.cpp +10 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -2
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +2 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +2 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +10 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ScreensHelper.java +83 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +130 -31
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +36 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/TabNavigatorObserver.java +128 -0
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +8 -0
- package/android/src/reactNativeVersionPatch/RuntimeExecutor/73/com/swmansion/reanimated/NativeProxy.java +6 -0
- package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +6 -0
- package/apple/LayoutReanimation/REAAnimationsManager.h +2 -0
- package/apple/LayoutReanimation/REAAnimationsManager.m +5 -0
- package/apple/LayoutReanimation/REAScreensHelper.h +6 -0
- package/apple/LayoutReanimation/REAScreensHelper.m +92 -4
- package/apple/LayoutReanimation/REASharedTransitionManager.h +1 -0
- package/apple/LayoutReanimation/REASharedTransitionManager.m +254 -55
- package/apple/native/NativeProxy.mm +12 -0
- package/lib/module/Colors.js +5 -2
- package/lib/module/Colors.js.map +1 -1
- package/lib/module/UpdateProps.js +8 -8
- package/lib/module/UpdateProps.js.map +1 -1
- package/lib/module/ViewDescriptorsSet.js +0 -27
- package/lib/module/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/createAnimatedComponent/InlinePropManager.js +1 -7
- package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/PropsFilter.js +1 -6
- package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
- package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +1 -5
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/hook/commonTypes.js.map +1 -1
- package/lib/module/hook/useAnimatedStyle.js +12 -15
- package/lib/module/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/hook/useFrameCallback.js +2 -2
- package/lib/module/hook/useFrameCallback.js.map +1 -1
- package/lib/module/hook/useWorkletCallback.js +1 -1
- package/lib/module/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/js-reanimated/index.js +3 -28
- package/lib/module/js-reanimated/index.js.map +1 -1
- package/lib/module/js-reanimated/webUtils.js +9 -0
- package/lib/module/js-reanimated/webUtils.js.map +1 -0
- package/lib/module/js-reanimated/webUtils.web.js +25 -0
- package/lib/module/js-reanimated/webUtils.web.js.map +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/CurvedTransition.js +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/layoutReanimation/defaultTransitions/EntryExitTransition.js +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/layoutReanimation/defaultTransitions/FadingTransition.js +11 -10
- package/lib/module/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/layoutReanimation/defaultTransitions/JumpingTransition.js +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/layoutReanimation/defaultTransitions/LinearTransition.js +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/layoutReanimation/defaultTransitions/SequencedTransition.js +1 -0
- package/lib/module/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/layoutReanimation/web/Easing.web.js +14 -0
- package/lib/module/layoutReanimation/web/Easing.web.js.map +1 -0
- package/lib/module/layoutReanimation/web/animationParser.js +16 -1
- package/lib/module/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/layoutReanimation/web/animationsManager.js +25 -8
- package/lib/module/layoutReanimation/web/animationsManager.js.map +1 -1
- package/lib/module/layoutReanimation/web/componentStyle.js +12 -16
- package/lib/module/layoutReanimation/web/componentStyle.js.map +1 -1
- package/lib/module/layoutReanimation/web/componentUtils.js +53 -18
- package/lib/module/layoutReanimation/web/componentUtils.js.map +1 -1
- package/lib/module/layoutReanimation/web/config.js +1 -12
- package/lib/module/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/layoutReanimation/web/createAnimation.js +21 -2
- package/lib/module/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/layoutReanimation/web/domUtils.js +6 -5
- package/lib/module/layoutReanimation/web/domUtils.js.map +1 -1
- package/lib/module/layoutReanimation/web/transition/Jumping.web.js +43 -0
- package/lib/module/layoutReanimation/web/transition/Jumping.web.js.map +1 -0
- package/lib/module/platform-specific/RNRenderer.web.js +1 -1
- package/lib/module/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/module/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/platformFunctions/setNativeProps.web.js +1 -3
- package/lib/module/platformFunctions/setNativeProps.web.js.map +1 -1
- package/lib/typescript/UpdateProps.d.ts +2 -3
- package/lib/typescript/ViewDescriptorsSet.d.ts +0 -9
- package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +1 -2
- package/lib/typescript/hook/commonTypes.d.ts +3 -6
- package/lib/typescript/hook/useWorkletCallback.d.ts +1 -1
- package/lib/typescript/js-reanimated/index.d.ts +2 -4
- package/lib/typescript/js-reanimated/webUtils.d.ts +3 -0
- package/lib/typescript/js-reanimated/webUtils.web.d.ts +3 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/FadingTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/LinearTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +1 -0
- package/lib/typescript/layoutReanimation/web/Easing.web.d.ts +10 -0
- package/lib/typescript/layoutReanimation/web/animationParser.d.ts +1 -2
- package/lib/typescript/layoutReanimation/web/componentStyle.d.ts +1 -1
- package/lib/typescript/layoutReanimation/web/componentUtils.d.ts +4 -3
- package/lib/typescript/layoutReanimation/web/config.d.ts +5 -12
- package/lib/typescript/layoutReanimation/web/createAnimation.d.ts +2 -0
- package/lib/typescript/layoutReanimation/web/domUtils.d.ts +1 -1
- package/lib/typescript/layoutReanimation/web/transition/Jumping.web.d.ts +29 -0
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +4 -3
- package/src/Colors.ts +5 -2
- package/src/UpdateProps.ts +8 -11
- package/src/ViewDescriptorsSet.ts +0 -42
- package/src/createAnimatedComponent/InlinePropManager.ts +2 -8
- package/src/createAnimatedComponent/PropsFilter.tsx +0 -4
- package/src/createAnimatedComponent/commonTypes.ts +1 -2
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +1 -5
- package/src/hook/commonTypes.ts +3 -6
- package/src/hook/useAnimatedStyle.ts +9 -26
- package/src/hook/useFrameCallback.ts +2 -2
- package/src/hook/useWorkletCallback.ts +1 -1
- package/src/js-reanimated/index.ts +11 -37
- package/src/js-reanimated/webUtils.ts +8 -0
- package/src/js-reanimated/webUtils.web.ts +27 -0
- package/src/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -0
- package/src/layoutReanimation/defaultTransitions/EntryExitTransition.ts +2 -0
- package/src/layoutReanimation/defaultTransitions/FadingTransition.ts +12 -10
- package/src/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -0
- package/src/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -0
- package/src/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -0
- package/src/layoutReanimation/web/Easing.web.ts +15 -0
- package/src/layoutReanimation/web/animationParser.ts +30 -2
- package/src/layoutReanimation/web/animationsManager.ts +45 -12
- package/src/layoutReanimation/web/componentStyle.ts +13 -16
- package/src/layoutReanimation/web/componentUtils.ts +68 -25
- package/src/layoutReanimation/web/config.ts +5 -14
- package/src/layoutReanimation/web/createAnimation.ts +38 -4
- package/src/layoutReanimation/web/domUtils.ts +15 -5
- package/src/layoutReanimation/web/transition/Jumping.web.ts +44 -0
- package/src/platform-specific/RNRenderer.web.ts +1 -1
- package/src/platform-specific/jsVersion.ts +1 -1
- package/src/platformFunctions/setNativeProps.web.ts +1 -1
|
@@ -21,7 +21,7 @@ void LayoutAnimationsManager::configureAnimationBatch(
|
|
|
21
21
|
sharedTransitionConfigs.push_back(std::move(layoutAnimationConfig));
|
|
22
22
|
} else {
|
|
23
23
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
24
|
-
if (type == ENTERING){
|
|
24
|
+
if (type == ENTERING) {
|
|
25
25
|
enteringAnimationsForNativeID_[tag] = config;
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
@@ -132,7 +132,7 @@ void LayoutAnimationsManager::startLayoutAnimation(
|
|
|
132
132
|
jsi::Value(tag),
|
|
133
133
|
jsi::Value(static_cast<int>(type)),
|
|
134
134
|
values,
|
|
135
|
-
config->
|
|
135
|
+
config->toJSValue(rt));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
void LayoutAnimationsManager::cancelLayoutAnimation(
|
|
@@ -165,6 +165,12 @@ int LayoutAnimationsManager::findPrecedingViewTagForTransition(const int tag) {
|
|
|
165
165
|
return -1;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
const std::vector<int> &LayoutAnimationsManager::getSharedGroup(
|
|
169
|
+
const int viewTag) {
|
|
170
|
+
const auto &groupSharedTag = viewTagToSharedTag_[viewTag];
|
|
171
|
+
return sharedTransitionGroups_[groupSharedTag];
|
|
172
|
+
}
|
|
173
|
+
|
|
168
174
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
169
175
|
void LayoutAnimationsManager::transferConfigFromNativeID(
|
|
170
176
|
const int nativeId,
|
|
@@ -46,6 +46,7 @@ class LayoutAnimationsManager {
|
|
|
46
46
|
void transferConfigFromNativeID(const int nativeId, const int tag);
|
|
47
47
|
#endif
|
|
48
48
|
int findPrecedingViewTagForTransition(const int tag);
|
|
49
|
+
const std::vector<int> &getSharedGroup(const int viewTag);
|
|
49
50
|
#ifndef NDEBUG
|
|
50
51
|
std::string getScreenSharedTagPairString(
|
|
51
52
|
const int screenTag,
|
|
@@ -67,7 +68,8 @@ class LayoutAnimationsManager {
|
|
|
67
68
|
#endif
|
|
68
69
|
|
|
69
70
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
70
|
-
std::unordered_map<int, std::shared_ptr<Shareable>>
|
|
71
|
+
std::unordered_map<int, std::shared_ptr<Shareable>>
|
|
72
|
+
enteringAnimationsForNativeID_;
|
|
71
73
|
#endif
|
|
72
74
|
std::unordered_map<int, std::shared_ptr<Shareable>> enteringAnimations_;
|
|
73
75
|
std::unordered_map<int, std::shared_ptr<Shareable>> exitingAnimations_;
|
|
@@ -14,7 +14,8 @@ namespace reanimated {
|
|
|
14
14
|
// When animations finish, the Host Tree will represent the most recent Shadow
|
|
15
15
|
// Tree
|
|
16
16
|
// On android this code will be sometimes executed on the JS thread.
|
|
17
|
-
// That's why we have to schedule some of animation manager function on the UI
|
|
17
|
+
// That's why we have to schedule some of animation manager function on the UI
|
|
18
|
+
// thread
|
|
18
19
|
std::optional<MountingTransaction> LayoutAnimationsProxy::pullTransaction(
|
|
19
20
|
SurfaceId surfaceId,
|
|
20
21
|
MountingTransaction::Number transactionNumber,
|
|
@@ -153,7 +154,8 @@ void LayoutAnimationsProxy::parseRemoveMutations(
|
|
|
153
154
|
std::shared_ptr<MutationNode> mutationNode;
|
|
154
155
|
std::shared_ptr<Node> node = nodeForTag_[tag],
|
|
155
156
|
parent = nodeForTag_[parentTag],
|
|
156
|
-
unflattenedParent =
|
|
157
|
+
unflattenedParent =
|
|
158
|
+
nodeForTag_[unflattenedParentTag];
|
|
157
159
|
|
|
158
160
|
if (!node) {
|
|
159
161
|
mutationNode = std::make_shared<MutationNode>(mutation);
|
|
@@ -178,9 +180,9 @@ void LayoutAnimationsProxy::parseRemoveMutations(
|
|
|
178
180
|
parent = std::make_shared<Node>(parentTag);
|
|
179
181
|
nodeForTag_[parentTag] = parent;
|
|
180
182
|
}
|
|
181
|
-
|
|
182
|
-
if (!unflattenedParent){
|
|
183
|
-
if (parentTag == unflattenedParentTag){
|
|
183
|
+
|
|
184
|
+
if (!unflattenedParent) {
|
|
185
|
+
if (parentTag == unflattenedParentTag) {
|
|
184
186
|
unflattenedParent = parent;
|
|
185
187
|
} else {
|
|
186
188
|
unflattenedParent = std::make_shared<Node>(unflattenedParentTag);
|
|
@@ -225,7 +227,7 @@ void LayoutAnimationsProxy::handleRemovals(
|
|
|
225
227
|
node, true, true, false, filteredMutations)) {
|
|
226
228
|
filteredMutations.push_back(node->mutation);
|
|
227
229
|
nodeForTag_.erase(node->tag);
|
|
228
|
-
node->unflattenedParent->removeChildFromUnflattenedTree(node)
|
|
230
|
+
node->unflattenedParent->removeChildFromUnflattenedTree(node); //???
|
|
229
231
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
230
232
|
LOG(INFO) << "delete " << node->tag << std::endl;
|
|
231
233
|
#endif
|
|
@@ -268,7 +270,8 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
|
|
|
268
270
|
case ShadowViewMutation::Type::Insert: {
|
|
269
271
|
updateIndexForMutation(mutation);
|
|
270
272
|
if (nodeForTag_.contains(mutation.parentShadowView.tag)) {
|
|
271
|
-
nodeForTag_[mutation.parentShadowView.tag]->applyMutationToIndices(
|
|
273
|
+
nodeForTag_[mutation.parentShadowView.tag]->applyMutationToIndices(
|
|
274
|
+
mutation);
|
|
272
275
|
}
|
|
273
276
|
|
|
274
277
|
if (movedViews.contains(tag)) {
|
|
@@ -296,7 +299,8 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
|
|
|
296
299
|
filteredMutations.push_back(mutation);
|
|
297
300
|
|
|
298
301
|
// temporarily set opacity to 0 to prevent flickering on android
|
|
299
|
-
std::shared_ptr<ShadowView> newView =
|
|
302
|
+
std::shared_ptr<ShadowView> newView =
|
|
303
|
+
cloneViewWithoutOpacity(mutation, propsParserContext);
|
|
300
304
|
|
|
301
305
|
filteredMutations.push_back(ShadowViewMutation::UpdateMutation(
|
|
302
306
|
mutation.newChildShadowView, *newView, mutation.parentShadowView));
|
|
@@ -305,7 +309,8 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
|
|
|
305
309
|
|
|
306
310
|
case ShadowViewMutation::Type::Update: {
|
|
307
311
|
auto shouldAnimate = hasLayoutChanged(mutation);
|
|
308
|
-
if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LAYOUT) ||
|
|
312
|
+
if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LAYOUT) ||
|
|
313
|
+
(!shouldAnimate && !layoutAnimations_.contains(tag))) {
|
|
309
314
|
// We should cancel any ongoing animation here to ensure that the
|
|
310
315
|
// proper final state is reached for this view However, due to how
|
|
311
316
|
// RNSScreens handle adding headers (a second commit is triggered to
|
|
@@ -315,7 +320,7 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
|
|
|
315
320
|
// TODO: find a better solution for this problem
|
|
316
321
|
filteredMutations.push_back(mutation);
|
|
317
322
|
continue;
|
|
318
|
-
} else if (!shouldAnimate){
|
|
323
|
+
} else if (!shouldAnimate) {
|
|
319
324
|
updateOngoingAnimationTarget(tag, mutation);
|
|
320
325
|
continue;
|
|
321
326
|
}
|
|
@@ -365,7 +370,9 @@ void LayoutAnimationsProxy::endAnimationsRecursively(
|
|
|
365
370
|
node->state = DELETED;
|
|
366
371
|
// iterate from the end, so that children
|
|
367
372
|
// with higher indices appear first in the mutations list
|
|
368
|
-
for (auto it = node->unflattenedChildren.rbegin();
|
|
373
|
+
for (auto it = node->unflattenedChildren.rbegin();
|
|
374
|
+
it != node->unflattenedChildren.rend();
|
|
375
|
+
it++) {
|
|
369
376
|
auto &subNode = *it;
|
|
370
377
|
if (subNode->state != DELETED) {
|
|
371
378
|
endAnimationsRecursively(subNode, mutations);
|
|
@@ -435,7 +442,9 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
|
|
|
435
442
|
|
|
436
443
|
// iterate from the end, so that children
|
|
437
444
|
// with higher indices appear first in the mutations list
|
|
438
|
-
for (auto it = node->unflattenedChildren.rbegin();
|
|
445
|
+
for (auto it = node->unflattenedChildren.rbegin();
|
|
446
|
+
it != node->unflattenedChildren.rend();
|
|
447
|
+
it++) {
|
|
439
448
|
auto &subNode = *it;
|
|
440
449
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
441
450
|
LOG(INFO) << "child " << subNode->tag << " "
|
|
@@ -540,21 +549,28 @@ bool LayoutAnimationsProxy::shouldOverridePullTransaction() const {
|
|
|
540
549
|
return true;
|
|
541
550
|
}
|
|
542
551
|
|
|
543
|
-
void LayoutAnimationsProxy::createLayoutAnimation(
|
|
544
|
-
|
|
552
|
+
void LayoutAnimationsProxy::createLayoutAnimation(
|
|
553
|
+
const ShadowViewMutation &mutation,
|
|
554
|
+
ShadowView &oldView,
|
|
555
|
+
const SurfaceId &surfaceId,
|
|
556
|
+
const int tag) const {
|
|
545
557
|
int count = 1;
|
|
546
558
|
auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
547
|
-
|
|
559
|
+
|
|
548
560
|
if (layoutAnimationIt != layoutAnimations_.end()) {
|
|
549
561
|
auto &layoutAnimation = layoutAnimationIt->second;
|
|
550
562
|
oldView = *layoutAnimation.currentView;
|
|
551
563
|
count = layoutAnimation.count + 1;
|
|
552
564
|
}
|
|
553
|
-
|
|
554
|
-
auto finalView = std::make_shared<ShadowView>(
|
|
565
|
+
|
|
566
|
+
auto finalView = std::make_shared<ShadowView>(
|
|
567
|
+
mutation.type == ShadowViewMutation::Remove
|
|
568
|
+
? mutation.oldChildShadowView
|
|
569
|
+
: mutation.newChildShadowView);
|
|
555
570
|
auto currentView = std::make_shared<ShadowView>(oldView);
|
|
556
571
|
auto parentView = std::make_shared<ShadowView>(mutation.parentShadowView);
|
|
557
|
-
layoutAnimations_.insert_or_assign(
|
|
572
|
+
layoutAnimations_.insert_or_assign(
|
|
573
|
+
tag, LayoutAnimation{finalView, currentView, parentView, {}, count});
|
|
558
574
|
}
|
|
559
575
|
|
|
560
576
|
void LayoutAnimationsProxy::startEnteringAnimation(
|
|
@@ -627,7 +643,7 @@ void LayoutAnimationsProxy::startLayoutAnimation(
|
|
|
627
643
|
auto surfaceId = mutation.oldChildShadowView.surfaceId;
|
|
628
644
|
auto oldView = mutation.oldChildShadowView;
|
|
629
645
|
createLayoutAnimation(mutation, oldView, surfaceId, tag);
|
|
630
|
-
|
|
646
|
+
|
|
631
647
|
Snapshot currentValues(oldView, surfaceManager.getWindow(surfaceId));
|
|
632
648
|
Snapshot targetValues(
|
|
633
649
|
mutation.newChildShadowView, surfaceManager.getWindow(surfaceId));
|
|
@@ -647,16 +663,18 @@ void LayoutAnimationsProxy::startLayoutAnimation(
|
|
|
647
663
|
yogaValues.setProperty(uiRuntime_, "targetWidth", targetValues.width);
|
|
648
664
|
yogaValues.setProperty(uiRuntime_, "targetHeight", targetValues.height);
|
|
649
665
|
yogaValues.setProperty(uiRuntime_, "windowWidth", targetValues.windowWidth);
|
|
650
|
-
yogaValues.setProperty(
|
|
666
|
+
yogaValues.setProperty(
|
|
667
|
+
uiRuntime_, "windowHeight", targetValues.windowHeight);
|
|
651
668
|
layoutAnimationsManager_->startLayoutAnimation(
|
|
652
669
|
uiRuntime_, tag, LayoutAnimationType::LAYOUT, yogaValues);
|
|
653
670
|
});
|
|
654
671
|
}
|
|
655
672
|
|
|
656
673
|
void LayoutAnimationsProxy::updateOngoingAnimationTarget(
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
layoutAnimations_[tag].finalView =
|
|
674
|
+
const int tag,
|
|
675
|
+
const ShadowViewMutation &mutation) const {
|
|
676
|
+
layoutAnimations_[tag].finalView =
|
|
677
|
+
std::make_shared<ShadowView>(mutation.newChildShadowView);
|
|
660
678
|
}
|
|
661
679
|
|
|
662
680
|
void LayoutAnimationsProxy::maybeCancelAnimation(const int tag) const {
|
|
@@ -685,30 +703,37 @@ void LayoutAnimationsProxy::transferConfigFromNativeID(
|
|
|
685
703
|
// When entering animations start, we temporarily set opacity to 0
|
|
686
704
|
// so that we can immediately insert the view at the right position
|
|
687
705
|
// and schedule the animation on the UI thread
|
|
688
|
-
std::shared_ptr<ShadowView> LayoutAnimationsProxy::cloneViewWithoutOpacity(
|
|
689
|
-
|
|
690
|
-
|
|
706
|
+
std::shared_ptr<ShadowView> LayoutAnimationsProxy::cloneViewWithoutOpacity(
|
|
707
|
+
facebook::react::ShadowViewMutation &mutation,
|
|
708
|
+
const PropsParserContext &propsParserContext) const {
|
|
709
|
+
auto newView = std::make_shared<ShadowView>(mutation.newChildShadowView);
|
|
691
710
|
folly::dynamic opacity = folly::dynamic::object("opacity", 0);
|
|
692
|
-
auto newProps = getComponentDescriptorForShadowView(*newView).cloneProps(
|
|
711
|
+
auto newProps = getComponentDescriptorForShadowView(*newView).cloneProps(
|
|
712
|
+
propsParserContext, newView->props, RawProps(opacity));
|
|
693
713
|
newView->props = newProps;
|
|
694
714
|
return newView;
|
|
695
715
|
}
|
|
696
716
|
|
|
697
|
-
void LayoutAnimationsProxy::maybeRestoreOpacity(
|
|
717
|
+
void LayoutAnimationsProxy::maybeRestoreOpacity(
|
|
718
|
+
LayoutAnimation &layoutAnimation,
|
|
719
|
+
const jsi::Object &newStyle) const {
|
|
698
720
|
if (layoutAnimation.opacity && !newStyle.hasProperty(uiRuntime_, "opacity")) {
|
|
699
|
-
newStyle.setProperty(
|
|
721
|
+
newStyle.setProperty(
|
|
722
|
+
uiRuntime_, "opacity", jsi::Value(*layoutAnimation.opacity));
|
|
700
723
|
layoutAnimation.opacity.reset();
|
|
701
724
|
}
|
|
702
725
|
}
|
|
703
726
|
|
|
704
|
-
void LayoutAnimationsProxy::maybeUpdateWindowDimensions(
|
|
727
|
+
void LayoutAnimationsProxy::maybeUpdateWindowDimensions(
|
|
728
|
+
facebook::react::ShadowViewMutation &mutation,
|
|
729
|
+
SurfaceId surfaceId) const {
|
|
705
730
|
// This is a hacky way to obtain the window dimensions.
|
|
706
731
|
// We can identify the root, by checking if its tag is equal to the surfaceId
|
|
707
732
|
if (mutation.parentShadowView.tag == surfaceId) {
|
|
708
733
|
surfaceManager.updateWindow(
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
734
|
+
surfaceId,
|
|
735
|
+
mutation.parentShadowView.layoutMetrics.frame.size.width,
|
|
736
|
+
mutation.parentShadowView.layoutMetrics.frame.size.height);
|
|
712
737
|
}
|
|
713
738
|
}
|
|
714
739
|
|
|
@@ -38,18 +38,18 @@ struct LayoutAnimationsProxy : public MountingOverrideDelegate {
|
|
|
38
38
|
std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
|
|
39
39
|
ContextContainer::Shared contextContainer_;
|
|
40
40
|
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
|
|
41
|
-
jsi::Runtime&
|
|
41
|
+
jsi::Runtime &uiRuntime_;
|
|
42
42
|
const std::shared_ptr<UIScheduler> uiScheduler_;
|
|
43
43
|
LayoutAnimationsProxy(
|
|
44
44
|
std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager,
|
|
45
45
|
SharedComponentDescriptorRegistry componentDescriptorRegistry,
|
|
46
46
|
ContextContainer::Shared contextContainer,
|
|
47
|
-
jsi::Runtime&
|
|
47
|
+
jsi::Runtime &uiRuntime,
|
|
48
48
|
const std::shared_ptr<UIScheduler> uiScheduler)
|
|
49
49
|
: layoutAnimationsManager_(layoutAnimationsManager),
|
|
50
50
|
contextContainer_(contextContainer),
|
|
51
51
|
componentDescriptorRegistry_(componentDescriptorRegistry),
|
|
52
|
-
uiRuntime_(
|
|
52
|
+
uiRuntime_(uiRuntime),
|
|
53
53
|
uiScheduler_(uiScheduler) {}
|
|
54
54
|
|
|
55
55
|
void startEnteringAnimation(const int tag, ShadowViewMutation &mutation)
|
|
@@ -73,7 +73,7 @@ struct LayoutAnimationsProxy : public MountingOverrideDelegate {
|
|
|
73
73
|
void handleRemovals(
|
|
74
74
|
ShadowViewMutationList &filteredMutations,
|
|
75
75
|
std::vector<std::shared_ptr<MutationNode>> &roots) const;
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
void handleUpdatesAndEnterings(
|
|
78
78
|
ShadowViewMutationList &filteredMutations,
|
|
79
79
|
const std::unordered_map<Tag, ShadowView> &movedViews,
|
|
@@ -85,11 +85,21 @@ struct LayoutAnimationsProxy : public MountingOverrideDelegate {
|
|
|
85
85
|
ShadowViewMutationList &mutations) const;
|
|
86
86
|
void updateOngoingAnimationTarget(
|
|
87
87
|
const int tag,
|
|
88
|
-
const ShadowViewMutation&
|
|
89
|
-
std::shared_ptr<ShadowView> cloneViewWithoutOpacity(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
void
|
|
88
|
+
const ShadowViewMutation &mutation) const;
|
|
89
|
+
std::shared_ptr<ShadowView> cloneViewWithoutOpacity(
|
|
90
|
+
facebook::react::ShadowViewMutation &mutation,
|
|
91
|
+
const PropsParserContext &propsParserContext) const;
|
|
92
|
+
void maybeRestoreOpacity(
|
|
93
|
+
LayoutAnimation &layoutAnimation,
|
|
94
|
+
const jsi::Object &newStyle) const;
|
|
95
|
+
void maybeUpdateWindowDimensions(
|
|
96
|
+
facebook::react::ShadowViewMutation &mutation,
|
|
97
|
+
SurfaceId surfaceId) const;
|
|
98
|
+
void createLayoutAnimation(
|
|
99
|
+
const ShadowViewMutation &mutation,
|
|
100
|
+
ShadowView &oldView,
|
|
101
|
+
const SurfaceId &surfaceId,
|
|
102
|
+
const int tag) const;
|
|
93
103
|
|
|
94
104
|
void updateIndexForMutation(ShadowViewMutation &mutation) const;
|
|
95
105
|
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
namespace reanimated {
|
|
5
5
|
|
|
6
|
-
std::unordered_map<Tag, UpdateValues> &SurfaceManager::getUpdateMap(
|
|
6
|
+
std::unordered_map<Tag, UpdateValues> &SurfaceManager::getUpdateMap(
|
|
7
|
+
SurfaceId surfaceId) {
|
|
7
8
|
auto props = props_.find(surfaceId);
|
|
8
9
|
if (props != props_.end()) {
|
|
9
10
|
return *props->second;
|
|
@@ -14,7 +15,10 @@ std::unordered_map<Tag, UpdateValues> &SurfaceManager::getUpdateMap(SurfaceId su
|
|
|
14
15
|
return *newProps;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
void SurfaceManager::updateWindow(
|
|
18
|
+
void SurfaceManager::updateWindow(
|
|
19
|
+
const SurfaceId surfaceId,
|
|
20
|
+
const double windowWidth,
|
|
21
|
+
const double windowHeight) {
|
|
18
22
|
windows_.insert_or_assign(surfaceId, Rect{windowWidth, windowHeight});
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -48,8 +52,8 @@ void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
|
|
|
48
52
|
break;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
auto&
|
|
55
|
+
|
|
56
|
+
auto &flattenedChildren = child->parent->children;
|
|
53
57
|
for (int i = flattenedChildren.size() - 1; i >= 0; i--) {
|
|
54
58
|
if (flattenedChildren[i]->tag == child->tag) {
|
|
55
59
|
flattenedChildren.erase(flattenedChildren.begin() + i);
|
|
@@ -69,13 +73,13 @@ void Node::insertUnflattenedChildren(
|
|
|
69
73
|
mergeAndSwap(unflattenedChildren, newChildren);
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
bool Node::isMutationMode(){
|
|
76
|
+
bool Node::isMutationMode() {
|
|
73
77
|
return false;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
bool MutationNode::isMutationMode(){
|
|
80
|
+
bool MutationNode::isMutationMode() {
|
|
77
81
|
return true;
|
|
78
82
|
}
|
|
79
|
-
}
|
|
83
|
+
} // namespace reanimated
|
|
80
84
|
|
|
81
85
|
#endif
|
|
@@ -75,10 +75,14 @@ struct Node {
|
|
|
75
75
|
void removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child);
|
|
76
76
|
void applyMutationToIndices(ShadowViewMutation mutation);
|
|
77
77
|
void insertChildren(std::vector<std::shared_ptr<MutationNode>> &newChildren);
|
|
78
|
-
void insertUnflattenedChildren(
|
|
78
|
+
void insertUnflattenedChildren(
|
|
79
|
+
std::vector<std::shared_ptr<MutationNode>> &newChildren);
|
|
79
80
|
virtual bool isMutationMode();
|
|
80
81
|
explicit Node(const Tag tag) : tag(tag) {}
|
|
81
|
-
Node(Node &&node)
|
|
82
|
+
Node(Node &&node)
|
|
83
|
+
: children(std::move(node.children)),
|
|
84
|
+
unflattenedChildren(std::move(node.unflattenedChildren)),
|
|
85
|
+
tag(node.tag) {}
|
|
82
86
|
virtual ~Node() = default;
|
|
83
87
|
};
|
|
84
88
|
|
|
@@ -104,7 +108,8 @@ struct SurfaceManager {
|
|
|
104
108
|
mutable std::unordered_map<SurfaceId, Rect> windows_;
|
|
105
109
|
|
|
106
110
|
std::unordered_map<Tag, UpdateValues> &getUpdateMap(SurfaceId surfaceId);
|
|
107
|
-
void
|
|
111
|
+
void
|
|
112
|
+
updateWindow(SurfaceId surfaceId, double windowWidth, double windowHeight);
|
|
108
113
|
Rect getWindow(SurfaceId surfaceId);
|
|
109
114
|
};
|
|
110
115
|
|
|
@@ -134,11 +139,14 @@ static inline bool isRNSScreen(std::shared_ptr<MutationNode> node) {
|
|
|
134
139
|
node->mutation.oldChildShadowView.componentName, "RNSScreen");
|
|
135
140
|
}
|
|
136
141
|
|
|
137
|
-
static inline bool hasLayoutChanged(const ShadowViewMutation&
|
|
138
|
-
return mutation.oldChildShadowView.layoutMetrics.frame !=
|
|
142
|
+
static inline bool hasLayoutChanged(const ShadowViewMutation &mutation) {
|
|
143
|
+
return mutation.oldChildShadowView.layoutMetrics.frame !=
|
|
144
|
+
mutation.newChildShadowView.layoutMetrics.frame;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
static inline void mergeAndSwap(
|
|
147
|
+
static inline void mergeAndSwap(
|
|
148
|
+
std::vector<std::shared_ptr<MutationNode>> &A,
|
|
149
|
+
std::vector<std::shared_ptr<MutationNode>> &B) {
|
|
142
150
|
std::vector<std::shared_ptr<MutationNode>> merged;
|
|
143
151
|
auto it1 = A.begin(), it2 = B.begin();
|
|
144
152
|
while (it1 != A.end() && it2 != B.end()) {
|
|
@@ -136,7 +136,7 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec {
|
|
|
136
136
|
jsi::Value measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue);
|
|
137
137
|
|
|
138
138
|
void initializeFabric(const std::shared_ptr<UIManager> &uiManager);
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
void initializeLayoutAnimations();
|
|
141
141
|
|
|
142
142
|
std::string obtainPropFromShadowNode(
|
|
@@ -97,7 +97,7 @@ jsi::Value WorkletRuntime::executeSync(
|
|
|
97
97
|
auto result = runGuarded(shareableWorklet);
|
|
98
98
|
auto shareableResult = extractShareableOrThrow(uiRuntime, result);
|
|
99
99
|
lock.unlock();
|
|
100
|
-
return shareableResult->
|
|
100
|
+
return shareableResult->toJSValue(rt);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
jsi::Value WorkletRuntime::get(
|
|
@@ -39,7 +39,7 @@ class WorkletRuntime : public jsi::HostObject,
|
|
|
39
39
|
Args &&...args) const {
|
|
40
40
|
jsi::Runtime &rt = *runtime_;
|
|
41
41
|
return runOnRuntimeGuarded(
|
|
42
|
-
rt, shareableWorklet->
|
|
42
|
+
rt, shareableWorklet->toJSValue(rt), std::forward<Args>(args)...);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
void runAsyncGuarded(
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#include "Shareables.h"
|
|
5
5
|
#include "WorkletRuntime.h"
|
|
6
6
|
|
|
7
|
+
#include <vector>
|
|
8
|
+
|
|
7
9
|
#ifdef ANDROID
|
|
8
10
|
#include "Logger.h"
|
|
9
11
|
#else
|
|
@@ -102,21 +104,19 @@ void WorkletRuntimeDecorator::decorate(
|
|
|
102
104
|
: extractShareableOrThrow<ShareableArray>(
|
|
103
105
|
rt, argsValue, "[Reanimated] Args must be an array.");
|
|
104
106
|
jsScheduler->scheduleOnJS([=](jsi::Runtime &rt) {
|
|
105
|
-
auto remoteFun = shareableRemoteFun->
|
|
107
|
+
auto remoteFun = shareableRemoteFun->toJSValue(rt);
|
|
106
108
|
if (shareableArgs == nullptr) {
|
|
107
109
|
// fast path for remote function w/o arguments
|
|
108
110
|
remoteFun.asObject(rt).asFunction(rt).call(rt);
|
|
109
111
|
} else {
|
|
110
112
|
auto argsArray =
|
|
111
|
-
shareableArgs->
|
|
113
|
+
shareableArgs->toJSValue(rt).asObject(rt).asArray(rt);
|
|
112
114
|
auto argsSize = argsArray.size(rt);
|
|
113
|
-
|
|
114
|
-
// to use VLAs here, hence disabling the lint rule
|
|
115
|
-
jsi::Value args[argsSize]; // NOLINT(runtime/arrays)
|
|
115
|
+
std::vector<jsi::Value> args(argsSize);
|
|
116
116
|
for (size_t i = 0; i < argsSize; i++) {
|
|
117
117
|
args[i] = argsArray.getValueAtIndex(rt, i);
|
|
118
118
|
}
|
|
119
|
-
remoteFun.asObject(rt).asFunction(rt).call(rt, args,
|
|
119
|
+
remoteFun.asObject(rt).asFunction(rt).call(rt, const_cast<const jsi::Value *>(args.data()), args.size());
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
});
|
|
@@ -78,10 +78,22 @@ jsi::Value makeShareableClone(
|
|
|
78
78
|
} else {
|
|
79
79
|
if (shouldRetainRemote.isBool() && shouldRetainRemote.getBool()) {
|
|
80
80
|
shareable = std::make_shared<RetainingShareable<ShareableObject>>(
|
|
81
|
-
rt,
|
|
81
|
+
rt,
|
|
82
|
+
object
|
|
83
|
+
#if SUPPORTS_NATIVE_STATE
|
|
84
|
+
,
|
|
85
|
+
nativeStateSource
|
|
86
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
87
|
+
);
|
|
82
88
|
} else {
|
|
83
|
-
shareable =
|
|
84
|
-
|
|
89
|
+
shareable = std::make_shared<ShareableObject>(
|
|
90
|
+
rt,
|
|
91
|
+
object
|
|
92
|
+
#if SUPPORTS_NATIVE_STATE
|
|
93
|
+
,
|
|
94
|
+
nativeStateSource
|
|
95
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
96
|
+
);
|
|
85
97
|
}
|
|
86
98
|
}
|
|
87
99
|
} else if (value.isString()) {
|
|
@@ -135,7 +147,7 @@ std::shared_ptr<Shareable> Shareable::undefined() {
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
template <typename BaseClass>
|
|
138
|
-
jsi::Value RetainingShareable<BaseClass>::
|
|
150
|
+
jsi::Value RetainingShareable<BaseClass>::toJSValue(jsi::Runtime &rt) {
|
|
139
151
|
if (&rt == primaryRuntime_) {
|
|
140
152
|
// TODO: it is suboptimal to generate new object every time getJS is
|
|
141
153
|
// called on host runtime – the objects we are generating already exists
|
|
@@ -172,7 +184,7 @@ jsi::Value ShareableArray::toJSValue(jsi::Runtime &rt) {
|
|
|
172
184
|
auto size = data_.size();
|
|
173
185
|
auto ary = jsi::Array(rt, size);
|
|
174
186
|
for (size_t i = 0; i < size; i++) {
|
|
175
|
-
ary.setValueAtIndex(rt, i, data_[i]->
|
|
187
|
+
ary.setValueAtIndex(rt, i, data_[i]->toJSValue(rt));
|
|
176
188
|
}
|
|
177
189
|
return ary;
|
|
178
190
|
}
|
|
@@ -198,11 +210,14 @@ ShareableObject::ShareableObject(jsi::Runtime &rt, const jsi::Object &object)
|
|
|
198
210
|
auto value = extractShareableOrThrow(rt, object.getProperty(rt, key));
|
|
199
211
|
data_.emplace_back(key.utf8(rt), value);
|
|
200
212
|
}
|
|
213
|
+
#if SUPPORTS_NATIVE_STATE
|
|
201
214
|
if (object.hasNativeState(rt)) {
|
|
202
215
|
nativeState_ = object.getNativeState(rt);
|
|
203
216
|
}
|
|
217
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
204
218
|
}
|
|
205
219
|
|
|
220
|
+
#if SUPPORTS_NATIVE_STATE
|
|
206
221
|
ShareableObject::ShareableObject(
|
|
207
222
|
jsi::Runtime &rt,
|
|
208
223
|
const jsi::Object &object,
|
|
@@ -213,16 +228,18 @@ ShareableObject::ShareableObject(
|
|
|
213
228
|
nativeState_ = nativeStateSource.asObject(rt).getNativeState(rt);
|
|
214
229
|
}
|
|
215
230
|
}
|
|
231
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
216
232
|
|
|
217
233
|
jsi::Value ShareableObject::toJSValue(jsi::Runtime &rt) {
|
|
218
234
|
auto obj = jsi::Object(rt);
|
|
219
235
|
for (size_t i = 0, size = data_.size(); i < size; i++) {
|
|
220
|
-
obj.setProperty(
|
|
221
|
-
rt, data_[i].first.c_str(), data_[i].second->getJSValue(rt));
|
|
236
|
+
obj.setProperty(rt, data_[i].first.c_str(), data_[i].second->toJSValue(rt));
|
|
222
237
|
}
|
|
238
|
+
#if SUPPORTS_NATIVE_STATE
|
|
223
239
|
if (nativeState_ != nullptr) {
|
|
224
240
|
obj.setNativeState(rt, nativeState_);
|
|
225
241
|
}
|
|
242
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
226
243
|
return obj;
|
|
227
244
|
}
|
|
228
245
|
|
|
@@ -265,7 +282,7 @@ jsi::Value ShareableRemoteFunction::toJSValue(jsi::Runtime &rt) {
|
|
|
265
282
|
|
|
266
283
|
jsi::Value ShareableHandle::toJSValue(jsi::Runtime &rt) {
|
|
267
284
|
if (remoteValue_ == nullptr) {
|
|
268
|
-
auto initObj = initializer_->
|
|
285
|
+
auto initObj = initializer_->toJSValue(rt);
|
|
269
286
|
auto value = std::make_unique<jsi::Value>(getValueUnpacker(rt).call(
|
|
270
287
|
rt, initObj, jsi::String::createFromAscii(rt, "Handle")));
|
|
271
288
|
|
|
@@ -62,10 +62,9 @@ inline void cleanupIfRuntimeExists(
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
class Shareable {
|
|
65
|
-
|
|
65
|
+
public:
|
|
66
66
|
virtual jsi::Value toJSValue(jsi::Runtime &rt) = 0;
|
|
67
67
|
|
|
68
|
-
public:
|
|
69
68
|
virtual ~Shareable();
|
|
70
69
|
|
|
71
70
|
enum ValueType {
|
|
@@ -88,10 +87,6 @@ class Shareable {
|
|
|
88
87
|
|
|
89
88
|
explicit Shareable(ValueType valueType) : valueType_(valueType) {}
|
|
90
89
|
|
|
91
|
-
virtual jsi::Value getJSValue(jsi::Runtime &rt) {
|
|
92
|
-
return toJSValue(rt);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
90
|
inline ValueType valueType() const {
|
|
96
91
|
return valueType_;
|
|
97
92
|
}
|
|
@@ -114,7 +109,7 @@ class RetainingShareable : virtual public BaseClass {
|
|
|
114
109
|
explicit RetainingShareable(jsi::Runtime &rt, Args &&...args)
|
|
115
110
|
: BaseClass(rt, std::forward<Args>(args)...), primaryRuntime_(&rt) {}
|
|
116
111
|
|
|
117
|
-
jsi::Value
|
|
112
|
+
jsi::Value toJSValue(jsi::Runtime &rt);
|
|
118
113
|
|
|
119
114
|
~RetainingShareable() {
|
|
120
115
|
cleanupIfRuntimeExists(secondaryRuntime_, secondaryValue_);
|
|
@@ -183,16 +178,26 @@ class ShareableObject : public Shareable {
|
|
|
183
178
|
public:
|
|
184
179
|
ShareableObject(jsi::Runtime &rt, const jsi::Object &object);
|
|
185
180
|
|
|
181
|
+
#if defined(USE_HERMES) || REACT_NATIVE_MINOR_VERSION >= 74
|
|
182
|
+
#define SUPPORTS_NATIVE_STATE 1
|
|
183
|
+
#else
|
|
184
|
+
#define SUPPORTS_NATIVE_STATE 0
|
|
185
|
+
#endif
|
|
186
|
+
|
|
187
|
+
#if SUPPORTS_NATIVE_STATE
|
|
186
188
|
ShareableObject(
|
|
187
189
|
jsi::Runtime &rt,
|
|
188
190
|
const jsi::Object &object,
|
|
189
191
|
const jsi::Value &nativeStateSource);
|
|
192
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
190
193
|
|
|
191
194
|
jsi::Value toJSValue(jsi::Runtime &rt) override;
|
|
192
195
|
|
|
193
196
|
protected:
|
|
194
197
|
std::vector<std::pair<std::string, std::shared_ptr<Shareable>>> data_;
|
|
198
|
+
#if SUPPORTS_NATIVE_STATE
|
|
195
199
|
std::shared_ptr<jsi::NativeState> nativeState_;
|
|
200
|
+
#endif // SUPPORTS_NATIVE_STATE
|
|
196
201
|
};
|
|
197
202
|
|
|
198
203
|
class ShareableHostObject : public Shareable {
|
package/android/CMakeLists.txt
CHANGED
|
@@ -15,7 +15,7 @@ add_compile_options(${folly_FLAGS})
|
|
|
15
15
|
|
|
16
16
|
string(APPEND CMAKE_CXX_FLAGS " -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION} -DREANIMATED_VERSION=${REANIMATED_VERSION} -DHERMES_ENABLE_DEBUGGER=${HERMES_ENABLE_DEBUGGER}")
|
|
17
17
|
|
|
18
|
-
string(APPEND CMAKE_CXX_FLAGS " -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++${CMAKE_CXX_STANDARD} -Wall -Werror")
|
|
18
|
+
string(APPEND CMAKE_CXX_FLAGS " -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++${CMAKE_CXX_STANDARD} -Wall -Wpedantic -Werror")
|
|
19
19
|
|
|
20
20
|
if(${IS_NEW_ARCHITECTURE_ENABLED})
|
|
21
21
|
string(APPEND CMAKE_CXX_FLAGS " -DRCT_NEW_ARCH_ENABLED")
|