Add config version, and invalidate layout on config change (#1674)

Summary:
X-link: https://github.com/facebook/react-native/pull/45259

This is a continuation of the previous PR: https://github.com/facebook/react-native/pull/45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Changelog: [Internal]

Pull Request resolved: https://github.com/facebook/yoga/pull/1674

Reviewed By: rozele

Differential Revision: D59286992

Pulled By: NickGerleman

fbshipit-source-id: f46f35b03d5d9a743b798844ee3e1a02c271ccde
This commit is contained in:
Andrew Coates
2024-07-03 12:46:18 -07:00
committed by Facebook GitHub Bot
parent a1e9abb9b3
commit e4fe14ab3e
7 changed files with 212 additions and 5 deletions

View File

@@ -136,6 +136,11 @@ void Node::setConfig(yoga::Config* config) {
if (yoga::configUpdateInvalidatesLayout(*config_, *config)) {
markDirtyAndPropagate();
layout_.configVersion = 0;
} else {
// If the config is functionally the same, then align the configVersion so
// that we can reuse the layout cache
layout_.configVersion = config->getVersion();
}
config_ = config;