Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

240
Vistas
agregar un botón Leer más al final de la tercera línea de un texto grande

trabajando en una aplicación nativa de reacción, tengo un componente que tiene texto y al final del texto puede hacer clic en leer más para ir a otra pantalla. Incluso si el texto no tiene más de 3 líneas, tengo que mostrar leer más al final. Esto es lo que tengo hasta ahora:

 const ShowReadMore = () => { const SOME_LONG_TEXT_BLOCK = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'; return ( <View style={{flexDirection: 'row'}}> <Text numberOfLines={3} style={{flex: 1, alignItems: 'center'}}> {SOME_LONG_TEXT_BLOCK} </Text> <Text onPress={() => navigationRef.navigate('somepage')} style={{alignSelf: 'flex-end'}}> Read More </Text> </View> ); };

y me da esto:

ingrese la descripción de la imagen aquí

No es exactamente lo que quiero, quiero que el texto sea de longitud completa para las primeras 2 líneas, y luego en la 3ra línea quiero ver el 'leer más' al final de las oraciones. Si solo hay 1 línea de texto, funciona bien, pero más de 2 líneas, siempre tendré para las primeras 2 líneas algunos espacios vacíos a la derecha, ¿cómo puedo llenar eso con el texto como: ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

¿Has intentado poner <Text> así:

 <View style={{flexDirection: 'row'}}> <Text numberOfLines={3} style={{flex: 1, alignItems: 'center'}}> {SOME_LONG_TEXT_BLOCK} <Text onPress={() => navigationRef.navigate('somepage')} style {{alignSelf: 'flex-end'}}> Read More </Text> </Text> </View>

Luego, modifica tu estilo para lograr lo que quieres.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Puedes intentar reemplazar View to Text

 return ( <Text style={{flexDirection: 'row'}}> <Text numberOfLines={3} style={{flex: 1, alignItems: 'center'}}> {SOME_LONG_TEXT_BLOCK} </Text> <Text onPress={() => navigationRef.navigate('somepage')} style={{alignSelf: 'flex-end'}}> Read More </Text> </Text>

);

Es posible que necesite View afuera como un contenedor

about 4 years ago · Juan Pablo Isaza Denunciar

0

Para eliminar el espacio en blanco, puede eliminar esta propiedad style={{flexDirection: 'row'}} de la vista.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda