Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A way to only link fonts react native

Tags:

I am working with react native and I only want to link my fonts and nothing else.

I am using react-native-maps and it specifically says in the docs "Do not use react-native link"

Everywhere I look I see that people say to do react-native link in order to link fonts but I am wonder in if there is proper syntax for just linking fonts like:

react-native link ./assets/fonts or something? That way it will not also link all my other libraries

like image 326
E Pierre Avatar asked Mar 01 '18 19:03

E Pierre


People also ask

How do I unlink fonts react-native?

Navigate to android/app/src/main/assets/fontsAnd remove the fonts you want out. And that'll be all.


2 Answers

You can give react-native link a parameter / name that is not present in your package.json - this will cause the task list for the command to contain only the link assets task.

So react-native link ./assets/fonts is not a valid command, but it should work.

Do remember you need your fonts dir specified in package.json as per Hamed's answer.

like image 84
Marek Lisik Avatar answered Oct 20 '22 07:10

Marek Lisik


I'm just going to link them manually. This is a really strange requirement for react-native-maps though. Almost everything in react-native that is a individual library needs linking.

If anyone else has a better answer please let me know.

https://medium.com/@kswanie21/custom-fonts-in-react-native-tutorial-for-ios-android-76ceeaa0eb78

^ I know stack overflow does not like links but there are a lot of steps and images.

EDIT

Cool thing, if you do react-native link <specific-library-name-here> then react-native will first link your assets and then link that specific library. So if you ever just want to link your fonts you can do that by linking some specific library along with it.

EDIT 2

If you just want to link your assets folder, try react-native link "package-that-does-not-exist", it will still link your assets without linking anything else.

like image 24
E Pierre Avatar answered Oct 20 '22 06:10

E Pierre