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

80
Vistas
ImageBackground won't render react native

I'm doing a project in react native and my ImageBackgroud component does not want to render. The odd thing is I am already using ImageBackground in another component and it works there. I tried resizing the image but that didn't help.

Here is my component that renders child component with ImageBackground:

const DuringStay = () => {

  return (
        <View style={styles.container}>
             <FlatList
              data={test}
              numColumns={2}
              columnWrapperStyle={{
                justifyContent: 'space-between',
                marginBottom: 15,
              }}
              keyExtractor={item => item.id}
              renderItem={({ item }) => (
              <DuringStayTile item={item} />
              )}
            /> 
        </View>
  );
};

const styles = StyleSheet.create({
  container: {
    paddingHorizontal: 20,
    flex: 1,
  },
});

export default DuringStay;

Here is my component that doesn't want to render ImageBackground. My data comes correctly to the component and inside Pressable i can render other components but ImageBackground won't show up

const DuringStayTile = ({item}) => {
  const { title, uri } = item;
  console.log(title,uri)
  return (
    <Pressable style={styles.container}>
        <ImageBackground source={uri} resizeMode="cover" style={styles.image}>
              <LinearGradient 
              style={styles.textBox}
              colors={['transparent','rgba(0,0,0,0.6)']}>
                <Text>
                  {title} 
                </Text>
              </LinearGradient>
        </ImageBackground>
    </Pressable>
  );
};

export default DuringStayTile;

const styles = StyleSheet.create({
  container: {
    width: '48%',
    padding: 20,
    borderRadius: 10,
    padding:60,
    backgroundColor:'pink'
  },
  title: {
    fontWeight: 'bold',
    fontSize: 16,
  },
  image: {
    flex: 1,
    overflow:'hidden',
    justifyContent:'center'
  },
  textBox:{
    position:'absolute',
    right:0,
    bottom:0,
    width:'100%'

  },
});

Data that is imported:

 export const test = [
  {
      uri:require('../assets/f1.jpg'),
      title: 'Zip Line',
      id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba'
    },
    {
      uri: require('../assets/during.jpeg'),
      title: 'Blue Cave',
     id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
    },
    {
      uri: require('../assets/post.jpg'),
      title: 'Rafting',
      id: '58694a0f-3da1-471f-bd96-145571e29d72',
    }
  ]
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

image: {
    flex: 1,
    overflow:'hidden',
    justifyContent:'center',
 padding:30
  },
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