max
max

Reputation: 501

Unrecognized command "link" when linking fonts in react native

Trying to link custom fonts in a react native project, when using npx react-native link I get an error saying Unrecognized command "link"

Is there a way to resolve this?

Upvotes: 36

Views: 102062

Answers (3)

Pranavan
Pranavan

Reputation: 211

Manual setup for icons & try these steps

1.add this line android/app/build.gradle apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

2.add this line android/setting.gradle include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android'):

Upvotes: 0

Uzef Shaikh
Uzef Shaikh

Reputation: 744

manual linking has been removed from react-native 0.69 in favour of autolinking feature so now you have link your assets in native module or else you can use react-native-asset

remaining steps are same as before crate a file in root directory of project

react-native.config.js

module.exports = {
    project: {
        ios: {},
        android: {}
    },
    assets: ['./src/assets/'],
};

after installing react-native-asset run below command

yarn react-native-asset or npx react-native-asset

Upvotes: 42

ChaTho
ChaTho

Reputation: 761

Due to autolinking, link and unlink commands have been removed in React Native 0.69.

So, please try this:

npx react-native-asset

Upvotes: 71

Related Questions