36

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?

1

3 Answers 3

71

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

So, please try this:

npx react-native-asset
Sign up to request clarification or add additional context in comments.

4 Comments

Does this work for libraries as well as assets?
@conor909 I have used it for a few libraries and not encountered any problems yet. But i'm not sure anyway.
LOL can't find module react-native.config.js
@Yiping you can create it manually (see the other answer)
42

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

Comments

1

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'):

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.