-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
link and unlink commands have been removed in the favour of autolinking #34095
Comments
@zanyar3 To manually install on Android, you need to drop the files on this folder: create a file in package com.<YourAppPackageName>.components;
import android.content.Context;
import android.graphics.Typeface;
import androidx.appcompat.widget.AppCompatTextView;
import android.util.AttributeSet;
public class <NameThatYouWant> extends AppCompatTextView {
public <NameThatYouWant>(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public <NameThatYouWant>(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public <NameThatYouWant>(Context context) {
super(context);
init();
}
public void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/<FontFileName>.ttf");
setTypeface(tf ,Typeface.NORMAL);
}
} And on iOS you must follow this guide: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app |
This is a question/issue for the CLI which lives here: |
Thanks this worked for me. |
Just use |
only supports font files, this tool supports all assets ? What about other library for link native code ? |
This solution is for RN V0.69 as it does not support As for libraries, they are linked automatically when you run project on android and |
@infoSamyak I know, but only support asset link |
Yes, this is working for in react-native 0.69 |
Wow, thanks, thank you very much!!!, my colleagues and I have been looking into this for about 2 weeks! 🚀🚀🚀 |
this works for android but on iOS device getting an error of "unrecognized font family". anyone can help please? |
same here |
in RN +0.69 sometimes when you are trying to add your custom fonts, you may saw this error :
If you get this error first install it works for me ☺❤ |
Doesn't work for me at all:
I don't use yarn so I tried with npm:
With the Java code example, what am I supposed to use for "NameThatYouWant"? |
Did you create the react-native.config.js? |
This is ridiculous |
PS D:\Adminpanel> react-native link react-native-image-picker not wrking |
Description
I want add custom fonts for react native project.
after add fonts and config files need link project for add font for Android and iOS respectively.
But when run
npx react-native link
have a errorUnrecognized command "link".
Version
0.69
Output of
npx react-native info
Steps to reproduce
react-native.config.js
in root project foldermodule.exports
npx react-native link
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: