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

150
Views
Cómo cambiar la base de fuentes en accesorios y establecer el valor predeterminado si no hay accesorios

La pregunta es bastante simple, tengo un texto, que tiene un accesorio predeterminado, fontSize , el problema es que quiero tener accesorios para cambiar ese tamaño cuando sea necesario, así que configuré la fuente predeterminada y accesorios para cambiar la fuente, pero realmente no lo hago. No sé cuál es la forma correcta de hacer esto.

Aquí está mi solución que no funcionó:

Los accesorios llamados textStyle , los defino usando la interfaz mecanografiada textStyle: TextStyle

Traté de tener condiciones en style como

 style={textListStyle?.fontSize ?? 15} <== not work

El cumplidor se queja

 No overload matches this call. Overload 1 of 2, '(props: TextProps | Readonly<TextProps>): Text', gave the following error. Type 'number' is not assignable to type 'StyleProp<TextStyle>'. Overload 2 of 2, '(props: TextProps, context: any): Text', gave the following

error.

y lo intenté

 style={!textListStyle?.fontSize ? 15 : textListStyle?.fontSize}

Mismo problema, ¿cuál es la mejor solución? Muchas gracias

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

0

No estoy seguro de entender realmente lo que está tratando de hacer. Por lo que entendí, tienes un accesorio e intentas definir un tamaño de fuente determinado cuando el accesorio es verdadero y otro cuando no lo es.

Yo lo haría :

 style={{fontSize: textListStyle.fontSize ? 15 : 20 }}

O si su "textListStyle?.fontSize" es un número entero:

 style={{fontSize: textListStyle?.fontSize ?? 15}}
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!