Home » Android » android – The Expo SDK requires Expo to run. i am beginner in react-native?-Exceptionshub

android – The Expo SDK requires Expo to run. i am beginner in react-native?-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

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 .

How to&Answers:

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.

Answer:

you can use either expo or react-native you cant use both at same time:
expo is another CLI and react-native is parent CLI
from my suggetion many modules are not supported on EXPO project which require nativemodules so i suggest you to use react-native instead expo
differentiate bwtween react-native and expo is

Project start with Expo

Expo is a toolchain built around React Native to help you quickly start an app. It provides a set of tools that simplify the development and testing of React Native app and arms you with the components of users interface and services that are usually available in third-party native React Native components. With Expo you can find all of them in Expo SDK.

You can read how to set up your project in the Introduction section (Installation subsection)

Expo advantages

  1. Fast and simple project installation (in just several minutes)
  2. A convenient utility Expo CLI that opens in a browser and helps to check the app status, devices it runs on, scan QR code or send the link via email to open the app in Expo client, switch the production / development mode and publish your app on Expo server.
  3. Expo client is an app that is installed from Google Play and Apple Store on your phone. It allows opening projects during development without build via XCode or Android Studio. With Expo client, you can send your app to others for review, which is very useful when testing as you can see all changes in code in Expo client without creating apk or ipa files.
  4. Expo SDK offers the collection of ready solutions, such as working with the device accelerometer, camera, notifications, geolocation, etc. You can see them in the section SDK API Reference. Expo team regularly updates SDK with new solutions.
  5. Over the Air – very handy Expo feature for updating your app over the air without repeated deployment on Google Play or Apple Store. When users open your app, it will automatically update new changes in JavaScript code. However, such things as app icon, its name and other settings are not updated via OTA. You can read about it in more detail in the Limitations section.

Expo drawbacks

  1. You can’t add native modules written in Objective-C, Swift, Java, Kotlin
  2. You can’t use packages with native languages that require linking
  3. The app has a big size as it is built with all Expo SDK solutions, even those you don’t use. An application with Hello World weighs 25 MB
  4. Often everything works well in Expo client during testing, but certain problems may occur in a standalone app.

React Native without Expo

Advantages

  1. You can add native modules written in Objective-C, Swift, Java, Kotlin, and packages that require linking

  2. You can decide by yourself what React Native version to use

Disadvantages

  1. You won’t have an opportunity to develop iOS without macOS, as you have to use XCode for some of the settings.
  2. If you have started to work with React Native recently or have switched to it from Expo, setting a project will take a fair amount of time.

Answer:

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 .