Skip to content

Commit

Permalink
Call setSurfaceProps when props change in SurfaceHandler (facebook#37087
Browse files Browse the repository at this point in the history
)

Summary:
Pull Request resolved: facebook#37087

changelog: [internal]

Surface props can change during life cycle of a surface. This was supported before the new renderer as well. AppRegistry has a corresponding method for this: `AppRegistry.setSurfaceProps`.
To add support for this, we just need to call into `UIManager::setSurfaceProps`.

Reviewed By: rshest

Differential Revision: D45272046

fbshipit-source-id: d138b57d5c83f554839b0db0e6721045b8dc81ef
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Apr 25, 2023
1 parent bfeef95 commit 09a810a
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,25 @@ std::string SurfaceHandler::getModuleName() const noexcept {

void SurfaceHandler::setProps(folly::dynamic const &props) const noexcept {
SystraceSection s("SurfaceHandler::setProps");
std::unique_lock lock(parametersMutex_);
parameters_.props = props;
auto parameters = Parameters{};
{
std::unique_lock lock(parametersMutex_);

parameters_.props = props;
parameters = parameters_;
}

{
std::shared_lock lock(linkMutex_);

if (link_.status == Status::Running) {
link_.uiManager->setSurfaceProps(
parameters.surfaceId,
parameters.moduleName,
parameters.props,
parameters.displayMode);
}
}
}

folly::dynamic SurfaceHandler::getProps() const noexcept {
Expand Down

0 comments on commit 09a810a

Please sign in to comment.