Nalutas: tumugon sa katutubong bahagi sa ibabang gitna

Ang pangunahing problema ay hindi madaling ma-access ang react native component sa gitnang ibaba.

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>

Ano ang Yoga sa React Native

Ang React Native ay isang platform para sa pagbuo ng mga mobile app gamit ang React. Ang yoga ay isang programming language na tumutulong sa mga developer na lumikha ng mga user interface at application.

Ano ang Flexbox

?

Ang Flexbox ay isang layout module para sa React Native na nagpapadali sa paggawa ng flexible at tumutugon na mga layout. Pinapayagan ka nitong tukuyin kung aling mga bahagi ang dapat i-stretch at kung alin ang dapat i-compress, at nagbibigay ito ng iba't ibang mga opsyon para sa pagkontrol kung paano nai-render ang layout.

Kaugnay na mga post:

Mag-iwan ng komento