To set an item to have position absolute center with React Native, we can set the position
to absolute
.
Then we set justifyContent
and alignItems
to center
to center out item.
For instance, we write
<View
style={{
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center",
}}
>
<Text>text here ...</Text>
</View>
to set the position
, top
, left
, right
and bottom
values.
Then we center our View
by setting justifyContent
and alignItems
to center
.