Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
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 answers
Answer question

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 Report

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 Report

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!