Ashirbad Panigrahi
Ashirbad Panigrahi

Reputation: 815

npx react-native link command not working in latest version of react native. How can we link custom font family in my project

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

Answers (3)

Deepak Singh
Deepak Singh

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

enter image description here

Support my YouTube Channel

Upvotes: 3

Erkhemee
Erkhemee

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

Dimitri
Dimitri

Reputation: 206

You can use the following command: npx react-native-asset.

Upvotes: 16

Related Questions