Atrisināts: reaģējiet uz vietējo komponentu apakšējā centrā

Galvenā problēma ir tā, ka reaģējošais dabiskais komponents apakšējā centrā nav viegli pieejams.

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>

Kas ir joga programmā React Native

React Native ir platforma mobilo lietotņu izveidei, izmantojot React. Joga ir programmēšanas valoda, kas palīdz izstrādātājiem izveidot lietotāja saskarnes un lietojumprogrammas.

Kas ir Flexbox

?

Flexbox ir React Native izkārtojuma modulis, kas ļauj viegli izveidot elastīgus un atsaucīgus izkārtojumus. Tas ļauj norādīt, kuri komponenti ir jāizstiepj un kuri jāsaspiež, un tas nodrošina dažādas iespējas, kā kontrolēt izkārtojuma renderēšanu.

Related posts:

Leave a Comment