1

I am an experienced android developer and started learning react native. I am using ubuntu to make a project. I used code like this one react-native init myprojectand am using visual studio code for code editor.

To run a project on my physical device I run adb devices on the terminal, change directory to project directory then I start localhost like react-native start then I start my project on android by this code react-native run-android. The project works fine on my physical device.

But I am getting an error when I use Expo (** I do not know what is expo is**). I am following the net ninja tutorial series. When I use expo-icons I get no icons. This is the tutorial link : icons

When today I was learning about how to use custom fonts in the react-native I got similar errors like this one shown in this link.

I do not know why does expo is not working on my project. Before following this series, I looked at the book to learn react-native which was saying that now we do not use expo. So how can I get out of this problem?

although i get few answer that clears what is expo and one have also answered the problem of icons in react-native . currently i am not able to use custom fonts in react-native .

Kiran Patel
  • 98
  • 3
  • 12

2 Answers2

1

Expo and react-native both are different CLI to create an applications. Instead of using any components from expo in react-native application, you should use other packages. Since expo dependencies is not supported directly by react-native. (Correct me if I am wrong.) Like, Instead of expo-icons you can use react-native-vector-icons It will solve your current error.

Vanns35
  • 466
  • 4
  • 15
  • @Vanna35 thank you fro answer but i have solved the problem now i need solution for custom fonts again thank you . – Kiran Patel Feb 18 '20 at 05:59
  • actually i was getting error but now i am not getting any error and also the effect of fonts is not also showing . i tried to follow this post https://medium.com/@mehran.khan/ultimate-guide-to-use-custom-fonts-in-react-native-77fcdf859cf4 and it does not working so i am trying to hunting this type of error in github here https://github.com/facebook/react-native/issues/25852 – Kiran Patel Feb 18 '20 at 06:17
  • @Vanna35 thank you for help but i have found answer my self , thank you baby . – Kiran Patel Feb 18 '20 at 06:35
1

so i got the answer of custom fonts from GitHub Facebook issue .

create react-native.config.js file in your root project folder than paste below code into that file

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

than you can use fonts as fontFamily : 'exact_file_name' after this process you will be able to see changes if you do not see any changes . re run your project via terminal and you should see changes of font in the project .

Thank You all the person who helped me .

Kiran Patel
  • 98
  • 3
  • 12