Layout Property Inheritance Relationships

An important concept is the inheritance and override mechanism for layout properties.

Walk Properties Do Not Inherit

  • Each component must explicitly define its own Walk properties
  • Child component Walk properties are completely independent of parent components

Layout Properties Partially Inherit

  • flow direction influences child components' default behavior
  • spacing applies between sibling child components
  • alignment affects all child components' positioning
1// Layout property inheritance example
2Parent = <View> {
3    layout: {
4        flow: Down,
5        align: {x: 0.5} // All child components default to horizontal center alignment
6    },
7
8    <Child1> {
9        // Inherits parent's flow and align
10    }
11
12    <Child2> {
13        layout: {
14            align: {x: 1.0} // Overrides inherited alignment, changes to right alignment
15        }
16    }
17}