gluestack

gluestack Logogluestack

custom font not applied in ios

danishqureshi8817 posted this in #support
Open in Discord
Avatar
danishqureshi8817OP
Hello , I am not able to use custom font in iOS react native its working fine in android , help me @sannabara &1193976460621393931 &1204775656232194068

32 Replies

Avatar
viraj1098
Hey @danishqureshi8817 , which version of gluestack-ui you are working with?
Can you provide us with github repo?
Avatar
danishqureshi8817OP
I am using 1.1.25
Avatar
viraj1098
Can you provide us with github repo?
also which font you want to load?
Avatar
danishqureshi8817OP
Ok I will provide you code zip file
Avatar
viraj1098
https://v1.gluestack.io/ui/docs/guides/advanced/fonts also please make sure you follow this steps
Avatar
danishqureshi8817OP
I am using cli
This steps for expo
Avatar
viraj1098
Hey @danishqureshi8817 , Can you provide us with minimal reproduction of your use case?
Avatar
danishqureshi8817OP
<Text fontFamily={'$poppinsRegular'} fontSize={12} lineHeight={16} color={colors.black} numberOfLines={1} >Following</Text> i am using text tag but custom font family not work in ios devices
Avatar
viraj1098
Hey @danishqureshi8817 can you provide a repo it's to debug from just code snippet.
Avatar
danishqureshi8817OP
okk i wil provide you Zip
Because repo is not public
Avatar
danishqureshi8817OP
Avatar
viraj1098
Hey @danishqureshi8817 , I am getting Transfer expired
Sorry, this transfer has expired and is not available any more
Please check
Avatar
danishqureshi8817OP
I will señd again wait
Avatar
sravankumar101
hey @danishqureshi8817 your project is working correctly in our system. Check whether you're pod install in ios is correct or not.
Image
Avatar
danishqureshi8817OP
i am already install pods but not work
if you are available so can we connect on google meet
Avatar
sravankumar101
Please check once whether the font in changing on normal react_native text
Avatar
danishqureshi8817OP
yha , its working in normal react native text Tag
Avatar
sravankumar101
okay then , please dm me meet link.
Avatar
danishqureshi8817OP
okk wait
Avatar
sravankumar101
By default, the gluestack-ui text is having the following properties:
style={{ color: '#374151', fontStyle: 'normal', fontSize: 16, fontWeight: 400, }}
if we provide the same styling for the default react-native text with same font we can find that they are perfectly matching.
Image
so there will be difference in the android & ios text with same fontFamily too.If you want to make them look same in both platforms. You can make your own custom text component with custom styles provided.
Which will be something like ,
import { Text as RNText } from 'react-native'; import { styled } from '@gluestack-style/react'; const StyledText = styled(RNText); export const Text = StyledText;

If you want to add the custom styles that would be like :

const StyledText = styled( RNText, { color: '$text700', fontWeight: '$normal', fontFamily: '$body', fontStyle: 'normal', letterSpacing: '$md', variants: { isTruncated: { true: { props: { // @ts-ignore numberOfLines: 1, ellipsizeMode: 'tail', }, }, }, bold: { true: { fontWeight: '$bold', }, }, underline: { true: { textDecorationLine: 'underline', }, }, strikeThrough: { true: { textDecorationLine: 'line-through', }, }, size: { '2xs': { fontSize: '$2xs', }, 'xs': { fontSize: '$xs', }, 'sm': { fontSize: '$sm', }, 'md': { fontSize: '$md', }, 'lg': { fontSize: '$lg', }, 'xl': { fontSize: '$xl', }, '2xl': { fontSize: '$2xl', }, '3xl': { fontSize: '$3xl', }, '4xl': { fontSize: '$4xl', }, '5xl': { fontSize: '$5xl', }, '6xl': { fontSize: '$6xl', }, }, sub: { true: { fontSize: '$xs', }, }, italic: { true: { fontStyle: 'italic', }, }, }, defaultProps: { size: 'md', }, }, )
Avatar
danishqureshi8817OP
any update @sravankumar101
Avatar
sravankumar101
Could you please refer to the above message @danishqureshi8817
https://gluestack.forumify.io/post/1267446347821224070#message-1270726905167085568
This is not a issue but a platform different between same applied tokens.
Avatar
danishqureshi8817OP
okk but how to handle this
Avatar
sravankumar101