נפתרה: הגיבו לרכיב מקורי במרכז התחתון

הבעיה העיקרית היא שרכיב ה-react native במרכז התחתון אינו נגיש בקלות.

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>

מהי יוגה ב-React Native

React Native היא פלטפורמה לבניית אפליקציות לנייד עם React. יוגה היא שפת תכנות המסייעת למפתחים ליצור ממשקי משתמש ואפליקציות.

מה זה Flexbox

?

Flexbox הוא מודול פריסה עבור React Native שמקל על יצירת פריסות גמישות ומגוונות. זה מאפשר לך לציין אילו רכיבים יש למתוח ואילו יש לדחוס, והוא מספק מגוון אפשרויות לשליטה על אופן עיבוד הפריסה.

הודעות קשורות:

השאירו תגובה