Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React-native custom fonts - local font not working?

$
0
0

Alright, Ive copied the example at https://reactnative.dev/docs/text here:

import { StatusBar } from 'expo-status-bar';import { StyleSheet, Text, View } from 'react-native';import { useFonts } from '@use-expo/font';import { AppLoading } from 'expo';export default props => {  let [fontsLoaded] = useFonts({'Inter-SemiBoldItalic': 'https://rsms.me/inter/font-files/Inter-SemiBoldItalic.otf?v=3.12','SequelSansBlackDisp' : require('./assets/fonts/SequelSansBlackDisp.ttf'),  });  if (!fontsLoaded) {    return <AppLoading />;  } else {    return (<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}><Text style={{ fontFamily: 'Inter-SemiBoldItalic', fontSize: 28 }}>Inter SemiBoldItalic</Text><Text>Platform Default</Text></View>    );  }};

And have my fonts arranged like this:

enter image description here

When I delete the SequelSansBlackDisp font and just have the Inter-SemiBold, all works fine. My local font, however, gets the app stuck on loading and gives the error:enter image description here

How can I load my custom font? (I'd like this to work when I deploy to device as well)


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>