mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert D21583109: LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Differential Revision: D21583109 Original commit changeset: 234496841bde fbshipit-source-id: 2f74dcce23f4eebf987e2114ad1f23cf01e11a9d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
70f732dc8a
commit
5ae7e4fee2
@@ -23,9 +23,6 @@ namespace react {
|
||||
|
||||
class LayoutAnimationDriver : public LayoutAnimationKeyFrameManager {
|
||||
public:
|
||||
LayoutAnimationDriver(LayoutAnimationStatusDelegate *delegate)
|
||||
: LayoutAnimationKeyFrameManager(delegate) {}
|
||||
|
||||
virtual ~LayoutAnimationDriver() {}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -212,12 +212,6 @@ void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation(
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate(
|
||||
LayoutAnimationStatusDelegate *delegate) const {
|
||||
std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
|
||||
layoutAnimationStatusDelegate_ = delegate;
|
||||
}
|
||||
|
||||
bool LayoutAnimationKeyFrameManager::shouldOverridePullTransaction() const {
|
||||
return shouldAnimateFrame();
|
||||
}
|
||||
@@ -347,8 +341,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
.count();
|
||||
|
||||
bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
|
||||
|
||||
if (!mutations.empty()) {
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
{
|
||||
@@ -825,21 +817,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||
mutationsForAnimation.begin(),
|
||||
mutationsForAnimation.end());
|
||||
|
||||
// Signal to delegate if all animations are complete, or if we were not
|
||||
// animating anything and now some animation exists.
|
||||
if (inflightAnimationsExistInitially && inflightAnimations_.empty()) {
|
||||
std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
|
||||
if (layoutAnimationStatusDelegate_ != nullptr) {
|
||||
layoutAnimationStatusDelegate_->onAllAnimationsComplete();
|
||||
}
|
||||
} else if (
|
||||
!inflightAnimationsExistInitially && !inflightAnimations_.empty()) {
|
||||
std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
|
||||
if (layoutAnimationStatusDelegate_ != nullptr) {
|
||||
layoutAnimationStatusDelegate_->onAnimationStarted();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fill in telemetry
|
||||
return MountingTransaction{
|
||||
surfaceId, transactionNumber, std::move(mutations), {}};
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <react/mounting/MountingOverrideDelegate.h>
|
||||
#include <react/mounting/MountingTransaction.h>
|
||||
#include <react/mounting/ShadowViewMutation.h>
|
||||
#include <react/uimanager/LayoutAnimationStatusDelegate.h>
|
||||
#include <react/uimanager/UIManagerAnimationDelegate.h>
|
||||
|
||||
namespace facebook {
|
||||
@@ -38,7 +37,7 @@ enum class AnimationProperty {
|
||||
};
|
||||
enum class AnimationConfigurationType {
|
||||
Noop, // for animation placeholders that are not animated, and should be
|
||||
// executed once other animations have completed
|
||||
// executed once other animations have completed
|
||||
Create,
|
||||
Update,
|
||||
Delete
|
||||
@@ -98,12 +97,6 @@ struct LayoutAnimation {
|
||||
class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate,
|
||||
public MountingOverrideDelegate {
|
||||
public:
|
||||
LayoutAnimationKeyFrameManager(LayoutAnimationStatusDelegate *delegate)
|
||||
: layoutAnimationStatusDelegate_(delegate) {
|
||||
// This is the ONLY place where we set or access
|
||||
// layoutAnimationStatusDelegate_ without a mutex.
|
||||
}
|
||||
|
||||
void uiManagerDidConfigureNextLayoutAnimation(
|
||||
RawValue const &config,
|
||||
std::shared_ptr<EventTarget const> successCallback,
|
||||
@@ -125,19 +118,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate,
|
||||
MountingTelemetry const &telemetry,
|
||||
ShadowViewMutationList mutations) const override;
|
||||
|
||||
// LayoutAnimationStatusDelegate - this is for the platform to get
|
||||
// signal when animations start and complete. Setting and resetting this
|
||||
// delegate is protected by a mutex; ALL method calls into this delegate are
|
||||
// also protected by the mutex! The only way to set this without a mutex is
|
||||
// via a constructor.
|
||||
public:
|
||||
void setLayoutAnimationStatusDelegate(
|
||||
LayoutAnimationStatusDelegate *delegate) const;
|
||||
|
||||
private:
|
||||
mutable std::mutex layoutAnimationStatusDelegateMutex_;
|
||||
mutable LayoutAnimationStatusDelegate *layoutAnimationStatusDelegate_{};
|
||||
|
||||
void adjustDelayedMutationIndicesForMutation(
|
||||
SurfaceId surfaceId,
|
||||
ShadowViewMutation const &mutation) const;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class LayoutAnimationStatusDelegate {
|
||||
public:
|
||||
/**
|
||||
* Called when the LayoutAnimation engine state changes from animation nothing
|
||||
* to animating something. This will only be called when you go from 0 to N>0
|
||||
* active animations, N to N+1 animations will not result in this being
|
||||
* called.
|
||||
*/
|
||||
virtual void onAnimationStarted() = 0;
|
||||
|
||||
/**
|
||||
* Called when the LayoutAnimation engine completes all pending animations.
|
||||
*/
|
||||
virtual void onAllAnimationsComplete() = 0;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
Reference in New Issue
Block a user