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

86
Views
¿Qué tiene de malo esta implementación? No puedo anular el estilo.

Quiero anular el tamaño de fuente de mi texto de subtítulo. Obtengo el accesorio de estilo en mi componente. Lo he comprobado usando console.log y está bien. Pero mis estilos no se están implementando. ¿Qué le pasa a mi código? Por favor ayuda.

Aquí está el componente llamado Subtítulo,

 function SubHeadingText({children, style}) { return ( <Text style={[{fontSize: style.fontSize}, styles.textSubHeading]}> {children} </Text> ); } const styles = StyleSheet.create({ textSubHeading: { fontSize: 19, color: colors.black, }, });

y aquí estoy pasando el estilo

 <SubHeadingText style={{fontSize: 14}}> All fields are required to register with App. </SubHeadingText>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Voltee el orden de los estilos, se aplican en orden y lo anula con la hoja de estilo constante:

Ver React Native Style Docs :

También puede pasar una matriz de estilos: el último estilo de la matriz tiene prioridad, por lo que puede usar esto para heredar estilos.

 function SubHeadingText({children, style}) { return ( <Text style={[ styles.textSubHeading, // Needs to be applied first so next line overrides {fontSize: style.fontSize}, // Will override styles.textSubHeading fontSize ]}> {children} </Text> ); }
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!