• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

119
Views
Establecer el ancho del contenedor devuelve un resultado inesperado

Tengo un contenedor <View style={styles.container}> en el que hay una <FlatList /> . Un elemento representado por <FlatList /> es una tarjeta, con este estilo

 card: { borderColor: 'green', borderWidth: 2, borderTopRightRadius: 7, borderBottomRightRadius: 7, borderBottomLeftRadius: 7, backgroundColor: 'white', padding: 5, width: '100%', height: 290, },

Hay merienda aquí https://snack.expo.dev/90GJaJuPw

Ahora, hay dos problemas.

  1. ¿Por qué <View style={styles.thisAffectsCardWidth} /> no está horizontalmente en el center de la tarjeta?
  2. ¿Por qué el ancho de la tarjeta <View style={styles.card} /> se hace más grande cuando uno ajusta el width de thisAffectsCardWidth de, por ejemplo, 50% to 100%`?
about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

  1. Intente eliminar alignItems: 'center' de contentContainerStyle y agregue width: '100%' Por ejemplo: contentContainerStyle={{ width: '100%' }} y agregue alignItems: 'center' a los estilos de tarjeta.

https://snack.expo.dev/@charinda04/forlorn-cereal

  1. Como no ha establecido el ancho de contentContainerStyle de flatList, el ancho cambia con el ancho de thisAffectsCardWidth .
about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error