Kuxazululiwe: phendula ingxenye yomdabu maphakathi nendawo

Isibuyekezo sokugcina: 09/11/2023

Inkinga enkulu ukuthi ingxenye yomdabu esabelayo ephakathi nendawo ayifinyeleleki kalula.

I'm trying to create a component at the bottom center of the screen in React Native. I've tried using <code>absolute</code> and <code>relative</code> positioning, but nothing seems to work. Here's my code:
<code>&lt;View style={{position: 'absolute', bottom: 0, alignItems: 'center'}}&gt;
  &lt;Text&gt;This is my component!&lt;/Text&gt;
&lt;/View&gt;
</code>


A:

You can use <code>flexDirection:'row'</code>,<code>justifyContent:'center'</code>,<code>alignItems:'flex-end'</code>. 

<View style={{flexDirection:'row',justifyContent:'center',alignItems:'flex-end'}}>
<Text>This is my component!</Text>
</View>

Iyini i-Yoga ku-React Native

I-React Native iyinkundla yokwakha izinhlelo zokusebenza zeselula nge-React. I-Yoga iwulimi lokuhlela olusiza abathuthukisi bakhe izixhumanisi zomsebenzisi nezinhlelo zokusebenza.

Yini iFlexbox

?

I-Flexbox iyimojuli yesakhiwo ye-React Native eyenza kube lula ukwakha izakhiwo eziguquguqukayo nezisabelayo. Ikuvumela ukuthi ucacise ukuthi yiziphi izingxenye okufanele zelulwe nokuthi yiziphi okufanele zicindezelwe, futhi inikeza izinketho ezihlukahlukene zokulawula ukuthi isakhiwo sinikezwa kanjani.

Okuthunyelwe okuhlobene:

Shiya amazwana