Call setSurfaceProps when props change in SurfaceHandler (#37087)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Samuel Susla
2023-04-25 11:47:07 -07:00
committed by Facebook GitHub Bot
parent bfeef95c44
commit 09a810ae7d
@@ -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 {