Rozwiązany: zareaguj natywny komponent na dole pośrodku

Głównym problemem jest to, że natywny komponent reagujący na dole pośrodku nie jest łatwo dostępny.

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>

Czym jest joga w React Native

React Native to platforma do tworzenia aplikacji mobilnych za pomocą React. Yoga to język programowania, który pomaga programistom tworzyć interfejsy użytkownika i aplikacje.

Co to jest Flexbox

?

Flexbox to moduł układu dla React Native, który ułatwia tworzenie elastycznych i responsywnych układów. Pozwala określić, które komponenty mają być rozciągnięte, a które skompresowane, a także udostępnia różne opcje kontrolowania sposobu renderowania układu.

Powiązane posty:

Zostaw komentarz