简体   繁体   中英

How to use fontStyle on IOS? (with React-Native)

I am trying to use the writing styles "bold", "italic" on IOS, but I encounter the following error:

Invalid RCTFontStyle 'bold'. should be one of: (
italic,
normal,
oblique
)

What I should change to no longer have an error when I build on IOS?

I don't understand because on android when i use fontStyle: 'bold' , I don't have the error and everything is working properly. I am novice, any help and simple explanations would be very appreciated.

Just use fontWeight instead.

fontWeight: 'bold'

or

fontWeight: 500;

fontWeight should be the correct prop to apply bold styling.

fontStyle: enum('normal', 'italic')
fontWeight: enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')

see documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM