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

233
Vistas
How to change style of child component

How can I change the style of a child component I don't have control of?

I know about overrides but I can't see how to use it here.

For example

const styles = StyleSheet.create({
  container: {
    backgroundColor: '#ff0000'
  },
  inner: {
    backgroundColor: '#00ff00',
    width: '50px',
    height: '50px',
    margin: '10px 10px'
  }
})

class Child extends Component {
  render() {
    return (
      <div className={styles.container}>
        <div className={styles.inner}></div>
      </div>
    )
  }
}

When using this element, without changing any of its own source code, how can I change its styling?

const desiredStylesOfChild = StyleSheet.create({
  container: {
    backgroundColor: '#012345'
  },
  inner: {
    backgroundColor: '#abcdef',
    width: '50%',
    height: '50%',
    margin: '10% 10%'
  }
})

class Parent extends Component {
  render() {
    return (
      <h1>Something something</h1>
      <Child />
    )
  }
}
about 4 years ago · Juan Pablo Isaza
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