Failed prop type: Invalid prop `fontFamily` of type `object` supplied to `Text`, expected `string`.
Environment
This bug is found on the IPhone 7 device.
Description
I noticed that for the theme, we need to provide the fonts in the following format:
...
ios: {
regular: {
fontFamily: 'System',
fontWeight: '400' as '400',
},
medium: {
fontFamily: 'System',
fontWeight: '500' as '500',
},
light: {
fontFamily: 'System',
fontWeight: '300' as '300',
},
thin: {
fontFamily: 'System',
fontWeight: '100' as '100',
},
},
....
Then I took a peek at the code for those typography components. Let's take the Text component as an example:
return (
<NativeText
{...rest}
ref={(c) => {
this._root = c;
}}
style={[
{
fontFamily: theme.fonts.regular,
color: theme.colors.text,
textAlign: 'left',
writingDirection,
},
style,
]}
/>
);
Here theme.fonts.regular is an object obviously, which cannot be assigned to the key fontFamily. After I changed it to ...theme.fonts.regular, everything works as expected.
This bug also appears in the other components under Typography.
Reproducible Demo
Are you using the latest version or 2.x?
I'm experiencing the same issue with the latest version (3)
Me too. Face this error after upgrade to version 3. Error with the same code that I use in version 2. (I didn't use components that affected by breaking changes)
No any fontFamily noticed in Migration guide.
Try theme.fonts.ios.regular
I've added section regarding fonts to the migration guide.