mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d2ae775bf7
Summary: With the change, a new delegate method allows a receiver to alter a new (proposed) shadow tree with another tree by returning the altered tree. We will it use in future diffs to implement Commit Hooks. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D25221313 fbshipit-source-id: 9f83577d862b713fff71fa365ce660cc1de87c84
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
/*
|
|
* 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
|
|
|
|
#include <react/renderer/mounting/MountingCoordinator.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class ShadowTree;
|
|
|
|
/*
|
|
* Abstract class for ShadowTree's delegate.
|
|
*/
|
|
class ShadowTreeDelegate {
|
|
public:
|
|
/*
|
|
* Called right before a ShadowTree commits a new tree.
|
|
* The receiver can alter a new (proposed) shadow tree with another tree
|
|
* by returning the altered tree.
|
|
* Returning a `nullptr` cancels the commit.
|
|
*/
|
|
virtual RootShadowNode::Unshared shadowTreeWillCommit(
|
|
ShadowTree const &shadowTree,
|
|
RootShadowNode::Shared const &oldRootShadowNode,
|
|
RootShadowNode::Unshared const &newRootShadowNode) const = 0;
|
|
|
|
/*
|
|
* Called right after Shadow Tree commit a new state of the tree.
|
|
*/
|
|
virtual void shadowTreeDidFinishTransaction(
|
|
ShadowTree const &shadowTree,
|
|
MountingCoordinator::Shared const &mountingCoordinator) const = 0;
|
|
|
|
virtual ~ShadowTreeDelegate() noexcept = default;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|