-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix: propagate elements metrics to their shadow nodes #2802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kacperzolkiewski
merged 13 commits into
software-mansion:main
from
kacperzolkiewski:shadowNodesState
Nov 12, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
672e5c9
[WIP] Introduce shadow nodes state
jakex7 c952a63
fix: propagate elements metrics to their shadow nodes on iOS
kacperzolkiewski 665409e
fix: propagate elements metrics to their shadow nodes on Android
kacperzolkiewski b15b15a
fix: revert example changes
kacperzolkiewski 73ddf93
fix: Propagate elements metrics to their shadow nodes on iOS
kacperzolkiewski 3929280
fix: ctm matrix concatenation
kacperzolkiewski b401fbd
Merge branch 'main' into shadowNodesState
kacperzolkiewski c23d6d0
Update android/src/main/java/com/horcrux/svg/VirtualView.java
kacperzolkiewski a7ff4ce
Update common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescr…
kacperzolkiewski 983abf6
Update common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.h
kacperzolkiewski 49fb1bc
Update common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShad…
kacperzolkiewski 864b6ee
Update common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescr…
kacperzolkiewski 19e7493
fix: stateData error
kacperzolkiewski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptor.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // RNSVGComponentDescriptor.h | ||
| #pragma once | ||
| #include <react/debug/react_native_assert.h> | ||
| #include <react/renderer/core/ConcreteComponentDescriptor.h> | ||
| #include "RNSVGShadowNodes.h" | ||
|
|
||
| namespace facebook::react { | ||
|
|
||
| template <typename ShadowNodeT> | ||
| class RNSVGComponentDescriptor final : public ConcreteComponentDescriptor<ShadowNodeT> { | ||
| public: | ||
| using ConcreteComponentDescriptor<ShadowNodeT>::ConcreteComponentDescriptor; | ||
| void adopt(ShadowNode &shadowNode) const override { | ||
| react_native_assert(dynamic_cast<RNSVGLayoutableShadowNode *>(&shadowNode)); | ||
|
|
||
| auto layoutableShadowNode = dynamic_cast<RNSVGLayoutableShadowNode *>(&shadowNode); | ||
| auto state = std::static_pointer_cast<const typename ShadowNodeT::ConcreteState>(shadowNode.getState()); | ||
| auto stateData = state->getData(); | ||
|
|
||
| if (stateData.getWidth() != 0 && stateData.getHeight() != 0) { | ||
| layoutableShadowNode->setSize(Size{stateData.getWidth(), stateData.getHeight()}); | ||
| layoutableShadowNode->setShadowNodePosition(stateData.getX(), stateData.getY()); | ||
| } | ||
|
|
||
| ConcreteComponentDescriptor<ShadowNodeT>::adopt(shadowNode); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace facebook::react |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.