tezvyn:

alignItems: Aligning Children on the Cross Axis

Source: reactnative.devintermediate

alignItems arranges children along the cross axis of a flex container. If items flow down (column), it aligns them left/right. If they flow across (row), it aligns them top/bottom. The footgun: `alignSelf` on a child overrides this parent property.

alignItems is your tool for aligning children along the "cross axis" inside a React Native flex container, perpendicular to the main flow. If `flexDirection` is `column`, `alignItems` controls horizontal alignment. If it's `row`, it controls vertical alignment. The biggest footgun is forgetting the default is `stretch`, which can cause unexpected sizing, and that `alignSelf` on a child will always override the parent's setting.

Read the original → reactnative.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

alignItems: Aligning Children on the Cross Axis · Tezvyn