File tree Expand file tree Collapse file tree
packages/react-native/ReactCommon/react/renderer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,13 +66,17 @@ NativeAnimatedNodesManagerProvider::getOrCreate(
6666 };
6767
6868 if (ReactNativeFeatureFlags::useSharedAnimatedBackend ()) {
69+ // TODO: this should be initialized outside of animated, but for now it
70+ // was convenient to do it here
6971 animationBackend_ = std::make_shared<AnimationBackend>(
7072 std::move (startOnRenderCallback_),
7173 std::move (stopOnRenderCallback_),
7274 std::move (directManipulationCallback));
7375
7476 nativeAnimatedNodesManager_ =
7577 std::make_shared<NativeAnimatedNodesManager>(animationBackend_);
78+
79+ uiManager->setAnimationBackend (animationBackend_);
7680 } else {
7781 nativeAnimatedNodesManager_ =
7882 std::make_shared<NativeAnimatedNodesManager>(
Original file line number Diff line number Diff line change @@ -678,6 +678,15 @@ void UIManager::setNativeAnimatedDelegate(
678678 nativeAnimatedDelegate_ = delegate;
679679}
680680
681+ void UIManager::setAnimationBackend (
682+ std::weak_ptr<AnimationBackend> animationBackend) {
683+ animationBackend_ = animationBackend;
684+ }
685+
686+ std::weak_ptr<AnimationBackend> UIManager::getAnimationBackend () {
687+ return animationBackend_;
688+ }
689+
681690void UIManager::animationTick () const {
682691 if (animationDelegate_ != nullptr &&
683692 animationDelegate_->shouldAnimateFrame ()) {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ namespace facebook::react {
3636class UIManagerBinding ;
3737class UIManagerCommitHook ;
3838class UIManagerMountHook ;
39+ class AnimationBackend ;
3940
4041class UIManager final : public ShadowTreeDelegate {
4142 public:
@@ -62,6 +63,8 @@ class UIManager final : public ShadowTreeDelegate {
6263 * the pointer before being destroyed.
6364 */
6465 void setAnimationDelegate (UIManagerAnimationDelegate* delegate);
66+ void setAnimationBackend (std::weak_ptr<AnimationBackend> animationBackend);
67+ std::weak_ptr<AnimationBackend> getAnimationBackend ();
6568
6669 /* *
6770 * Execute stopSurface on any UIMAnagerAnimationDelegate.
@@ -258,6 +261,8 @@ class UIManager final : public ShadowTreeDelegate {
258261
259262 std::unique_ptr<LazyShadowTreeRevisionConsistencyManager>
260263 lazyShadowTreeRevisionConsistencyManager_;
264+
265+ std::weak_ptr<AnimationBackend> animationBackend_;
261266};
262267
263268} // namespace facebook::react
You can’t perform that action at this time.
0 commit comments