yongfong zhang
yongfong zhang

Reputation: 633

React Native justifyContent no effect

enter image description here

Figure, why setting the justifyContent property does not work?

Upvotes: 0

Views: 1461

Answers (2)

rmevans9
rmevans9

Reputation: 5643

When you are in a container that has the flex direction set to 'row' then justify-content actually sets the location horizontally instead of vertically. So in this case you would use alignItems. Since the RN implementation of flexbox is pretty close to the standard baring a few naming differences ('flexDirection' instead of 'flex-direction', etc) I would recommend working your way through the tutorial at http://flexboxfroggy.com/. Level 10 actually shows an example of the issue you are encountering here.

Upvotes: 1

Rockvic
Rockvic

Reputation: 5424

try to add alignItems: 'center'

Upvotes: 0

Related Questions