In my React Native app, I have a parent View
that container a child View
that contains a Text
element. By default, the child View's width stretches to fill the parent. But if I add alignItems: 'center'
, the child moves to the center but also its width shrinks to be only as wide as to fit the text it contains.
Here is a snack. Un-comment alignItems: 'center'
to see the difference: https://snack.expo.io/@gkeenley/alignitems-example
Does anyone know why this happens?