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

193
Views
¿Cómo "heredo" accesorios de componentes principales en componentes creados a medida?

Creé un componente personalizado que quiero reutilizar varias veces en mi aplicación. El componente en sí mismo usa un TouchableHighlight dentro de él.

Quiero que el uso del componente pueda pasar a través de accesorios TouchableHighlight sin tener que declararlos por separado dentro del componente personalizado.

Un ejemplo muy simple:

Componente:

 const CustomComponent = () => ( <TouchableHighlight> <Text>Custom component</Text> </TouchableHighlight>)

Uso:

 <CustomComponent activeOpacity={0.5} underlayColor=“red” onPress={someAction} />

Entonces, para resumir, me gustaría que TouchableHighlight use activeOpacity, underlayColor y onPress sin tener que seleccionarlos individualmente dentro del componente.

Espero que tenga sentido y lo haya explicado lo suficiente.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede extender los accesorios si solo quiere que pasen.

 const CustomComponent = (props) => ( <TouchableHighlight ...props> <Text>Custom component</Text> </TouchableHighlight>)
about 4 years ago · Juan Pablo Isaza Report

0

Prueba esto:

 const CustomComponent = ({touchableHighlightProps, ...otherProps}) => { return ( <TouchableHighlight {...touchableHighlightProps}> <Text>Custom component</Text> </TouchableHighlight> ) }

Entonces el uso será:

 <CustomComponent touchableHighlightProps={touchableHighlightProps} />
about 4 years ago · Juan Pablo Isaza Report
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!