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

242
Views
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
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!