Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda