-
Notifications
You must be signed in to change notification settings - Fork 14
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
Replacing an absolutely positioned node does not preserve position #792
Comments
I ran into this issue while experimenting today. I looked into the issue and it did not seem like a quick fix without it being a hack. I'd rather not add another parameter to the already excessively long list of parameters in |
Is this a regression with 0.25? It seemed to work better in 0.24. It appears that adding the node to be replaced in it own frame will allow it to position correctly. However, its making the figma files a bit complicated |
…odes. When performing a component replacement, pass the original node's margin into the replacement context. When this margin exists in DesignFrame, replace the current ViewStyle's margin with the context's margin.
…odes. When performing a component replacement, pass the original node's external layout properties into the replacement context. When this exists in DesignFrame, replace the current ViewStyle's external layout properties with the one in the replacement context.
…odes. When performing a component replacement, pass the original node's external layout properties into the replacement context. When this exists in DesignFrame, replace the current ViewStyle's external layout properties with the one in the replacement context.
…odes. When performing a component replacement, pass the original node's external layout properties into the replacement context. When this exists in DesignFrame, replace the current ViewStyle's external layout properties with the one in the replacement context.
…odes. When performing a component replacement, pass the original node's external layout properties into the replacement context. When this exists in DesignFrame, replace the current ViewStyle's external layout properties with the one in the replacement context.
@HooHaa-code regarding our discussion on changing the size of a component replacement, you showed an example that roughly looks like this. You were doing a component replacement of #ReplaceMe with a #RedBox. The problem was that if a designer resized #RedBox but not #ReplaceMe, then it would still take the size of #ReplaceMe, which is not desired. Once the pull request for this ticket goes in, you shouldn't need to have a parent frame #ReplaceMe. You can just put #RedBox directly into #stage and rename it to #ReplaceMe. Then, when the component #RedBox changes size, the instance of it in #stage also changes size, so the original and replacement node will always be the same. Does that work for you? Like this: |
…odes. (#826) When performing a component replacement, pass the original node's external layout properties into the replacement context. When this exists in DesignFrame, replace the current ViewStyle's external layout properties with the one in the replacement context. This ensures that the replacement node uses the original node's layout and size properties.
A
@Composable (ComponentReplacementContext) -> Unit
type customization on a node that is absolutely positioned (not in an autolayout) will not preserve the position of the original node. To achieve this, we need to somehow provide the position of the node being replaced to the replacement composable and have it use that instead of its own position.The text was updated successfully, but these errors were encountered: