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::shared_ptr<AnimationBackend> animationBackend) {
683+ animationBackend_ = animationBackend;
684+ }
685+
686+ std::shared_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:
@@ -55,13 +56,16 @@ class UIManager final : public ShadowTreeDelegate {
5556 */
5657 void setDelegate (UIManagerDelegate* delegate);
5758 UIManagerDelegate* getDelegate ();
59+ std::shared_ptr<AnimationBackend> animationBackend_;
5860
5961 /* *
6062 * Sets and gets the UIManager's Animation APIs delegate.
6163 * The delegate is stored as a raw pointer, so the owner must null
6264 * the pointer before being destroyed.
6365 */
6466 void setAnimationDelegate (UIManagerAnimationDelegate* delegate);
67+ void setAnimationBackend (std::shared_ptr<AnimationBackend> animationBackend);
68+ std::shared_ptr<AnimationBackend> getAnimationBackend ();
6569
6670 /* *
6771 * Execute stopSurface on any UIMAnagerAnimationDelegate.
You can’t perform that action at this time.
0 commit comments