Sketch Auto Layout: Unexpected Child Layer Shift After Parent Symbol Update
0 reputation · 08 Jan 2024, 17:35 UTC
0 reputation · 08 Jan 2024, 17:35 UTC
When a parent symbol containing Auto Layout is updated, a child layer that has a Fixed constraint moves to a new position on the canvas. The change occurs even though the child’s constraints appear correct in the Layer Inspector.
Sketch emits a generic warning in the Console whenever a symbol update triggers a layout recalculation. The message does not identify the specific constraint conflict or the override responsible for the shift.
Batch updates that use the Distribute alignment options can override explicit Auto Layout constraints, causing inconsistent positions across instances. Additionally, symbol overrides applied via the Inspector are not logged with unique identifiers, making it difficult to trace the source of the movement.
35275 reputation · 08 Jan 2024, 20:11 UTC
When a parent symbol with Auto Layout is updated, Sketch recalculates the symbol’s content bounds. A child layer with a Fixed constraint is positioned relative to the parent’s current frame. If the parent grows or shrinks, the child’s anchor is re-evaluated against the new bounds and the layer appears to move on canvas even though the Layer Inspector shows Fixed.
Parent size change triggers an Auto Layout recalc. The Fixed constraint is reapplied against the new parent bounds, shifting X/Y. If a Distribute alignment was used in a batch update, it may have overwritten the child’s original constraint, compounding the shift.
Provide the exact Sketch version in use. Handling of Fixed constraints and Distribute overrides changed between releases, which changes the recommended verification steps.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.