mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make android work
Differential Revision: D84055754
This commit is contained in:
committed by
meta-codesync[bot]
parent
f4e93df55e
commit
ca5a0cc765
+1
@@ -975,6 +975,7 @@ AnimationMutations NativeAnimatedNodesManager::pullAnimationMutations() {
|
||||
AnimationMutation{tag, nullptr, propsBuilder.get()});
|
||||
containsChange = true;
|
||||
}
|
||||
updateViewPropsDirect_.clear();
|
||||
}
|
||||
|
||||
if (!containsChange) {
|
||||
|
||||
+12
-6
@@ -82,6 +82,12 @@ NativeAnimatedNodesManagerProvider::getOrCreate(
|
||||
nativeAnimatedNodesManager_ =
|
||||
std::make_shared<NativeAnimatedNodesManager>(animationBackend_);
|
||||
|
||||
nativeAnimatedDelegate_ =
|
||||
std::make_shared<UIManagerNativeAnimatedDelegateBackendImpl>(
|
||||
animationBackend_);
|
||||
|
||||
uiManager->setNativeAnimatedDelegate(nativeAnimatedDelegate_);
|
||||
|
||||
uiManager->unstable_setAnimationBackend(animationBackend_);
|
||||
} else {
|
||||
nativeAnimatedNodesManager_ =
|
||||
@@ -90,6 +96,12 @@ NativeAnimatedNodesManagerProvider::getOrCreate(
|
||||
std::move(fabricCommitCallback),
|
||||
std::move(startOnRenderCallback_),
|
||||
std::move(stopOnRenderCallback_));
|
||||
|
||||
nativeAnimatedDelegate_ =
|
||||
std::make_shared<UIManagerNativeAnimatedDelegateImpl>(
|
||||
nativeAnimatedNodesManager_);
|
||||
|
||||
uiManager->setNativeAnimatedDelegate(nativeAnimatedDelegate_);
|
||||
}
|
||||
|
||||
addEventEmitterListener(
|
||||
@@ -112,12 +124,6 @@ NativeAnimatedNodesManagerProvider::getOrCreate(
|
||||
return false;
|
||||
}));
|
||||
|
||||
nativeAnimatedDelegate_ =
|
||||
std::make_shared<UIManagerNativeAnimatedDelegateImpl>(
|
||||
nativeAnimatedNodesManager_);
|
||||
|
||||
uiManager->setNativeAnimatedDelegate(nativeAnimatedDelegate_);
|
||||
|
||||
// TODO: remove force casting.
|
||||
auto* scheduler = (Scheduler*)uiManager->getDelegate();
|
||||
animatedMountingOverrideDelegate_ =
|
||||
|
||||
+21
-5
@@ -10,6 +10,18 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
UIManagerNativeAnimatedDelegateBackendImpl::
|
||||
UIManagerNativeAnimatedDelegateBackendImpl(
|
||||
std::weak_ptr<AnimationBackend> animationBackend)
|
||||
: animationBackend_(std::move(animationBackend)) {}
|
||||
|
||||
void UIManagerNativeAnimatedDelegateBackendImpl::runAnimationFrame() {
|
||||
if (auto animationBackendStrong = animationBackend_.lock()) {
|
||||
animationBackendStrong->onAnimationFrame(
|
||||
std::chrono::steady_clock::now().time_since_epoch().count() / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
static inline Props::Shared cloneProps(
|
||||
AnimatedProps& animatedProps,
|
||||
const ShadowNode& shadowNode) {
|
||||
@@ -108,13 +120,17 @@ void AnimationBackend::onAnimationFrame(double timestamp) {
|
||||
void AnimationBackend::start(const Callback& callback) {
|
||||
callbacks.push_back(callback);
|
||||
// TODO: startOnRenderCallback_ should provide the timestamp from the platform
|
||||
startOnRenderCallback_([this]() {
|
||||
onAnimationFrame(
|
||||
std::chrono::steady_clock::now().time_since_epoch().count() / 1000);
|
||||
});
|
||||
if (startOnRenderCallback_) {
|
||||
startOnRenderCallback_([this]() {
|
||||
onAnimationFrame(
|
||||
std::chrono::steady_clock::now().time_since_epoch().count() / 1000);
|
||||
});
|
||||
}
|
||||
}
|
||||
void AnimationBackend::stop() {
|
||||
stopOnRenderCallback_();
|
||||
if (stopOnRenderCallback_) {
|
||||
stopOnRenderCallback_();
|
||||
}
|
||||
callbacks.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,20 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class AnimationBackend;
|
||||
|
||||
class UIManagerNativeAnimatedDelegateBackendImpl
|
||||
: public UIManagerNativeAnimatedDelegate {
|
||||
public:
|
||||
explicit UIManagerNativeAnimatedDelegateBackendImpl(
|
||||
std::weak_ptr<AnimationBackend> animationBackend);
|
||||
|
||||
void runAnimationFrame() override;
|
||||
|
||||
private:
|
||||
std::weak_ptr<AnimationBackend> animationBackend_;
|
||||
};
|
||||
|
||||
struct AnimationMutation {
|
||||
Tag tag;
|
||||
const ShadowNodeFamily* family;
|
||||
|
||||
Reference in New Issue
Block a user