Reputation: 815
I want to use a custom font family in my react-native project for that when I run the command
npx react-native link
it shows me the error error Unrecognized command "link"
. As I checked this may be because react-native removed the link command from the latest version of react-native.
So that I want to know how I can link the font family without using the react-native link command. I'm using the following version of react and react-native
"react": "18.0.0",
"react-native": "0.69.1",
Lastly Thank You For Your Help In Advance.
Upvotes: 7
Views: 20905
Reputation: 1145
first, create react-native.config.js
file like below image
module. Exports = {
project: {
ios: {},
android: {},
},
assets: ['./src/assets/fonts/'], // path of your assert file
};
and then run
npx react-native-asset
Support my YouTube Channel
Upvotes: 3
Reputation: 181
npx react-native link
auto-linking command is deprecated in react-native v0.60 or higher versions. Use npx react-native-asset
.
If you don't have react-native.config.js file then create new file and paste it:
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/'], // <- your asset folder's path
};
Upvotes: 5