Image nested In Text with lineHeight specified overflows container
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 4
Descripción
Description
An <Image> nested within <Text> with a lineHeight specified causes the image to overflow the parent container.
Workarounds attempted:
- Specifying a fixed height on the image
- Wrapping the image in a
<View>with a fixedheightand/orlineHeight - Wrapping the Image in another
<Text>with a fixedheightand/orlineHeight - Wrapping the image in another
<Text>with lineHeight set toundefinedornull
Expected behaviour:
To be able to nest images in Text with a non-default lineHeight.
(Please let me know if any more details are required for this issue. Thanks!)
Steps to reproduce
Please see expo snack.
Code below:
export default function App() {
return (
<View style={styles.container}>
<View style={styles.box}>
<Text style={styles.text}>
Hello
<Image style={styles.image} source={require('./assets/snack-icon.png')} />
</Text>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#ecf0f1',
padding: 8,
},
box: {
backgroundColor: 'red',
},
text: {
backgroundColor: 'blue',
// lineHeight: 20,
},
image: {
height: 300,
}
});
React Native Version
0.76.0
Affected Platforms
Runtime - iOS, Runtime - Android
Output of npx react-native info
Please see expo snack.
Stacktrace or Logs
N/A
Reproducer
https://snack.expo.dev/@tomkelsey/image-nested-in-text-lineheight-bug
Alternative reproducer:
https://github.com/OzymandiasTheGreat/rn-view-in-text-bug
Screenshots and Videos
Without lineHeight specified:
With lineHeight specified:
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el componente App y los estilos del Expo Snack proporcionado y del reproductor alternativo; después, compara el diseño con y sin un lineHeight no predeterminado en iOS y Android. Se considera completado cuando un Image anidado en Text permanece dentro del contenedor padre en ambas plataformas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react-native
- Área
- mobile
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100