本文介绍了将Expo项目转换为原始React Native项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了yarn run eject弹出,但是它给了我这个警告

I did yarn run eject to eject but it gave me this warning

Warning! We found at least one file where your project imports the Expo SDK

我知道我有一些使用Expo API的模块,像这样-

I know I have some modules which use Expo API like this -

await Expo.Font.loadAsync({
      Roboto: require('native-base/Fonts/Roboto.ttf'),
      Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
    });

现在我想将其转换为React Native Components,以便我可以弹出而没有任何错误,这样我就可以index.android.js&就像我们使用react-native init example

Now I want to convert this to React Native Components so that I can eject without any errors so that I getindex.android.js & index.ios.js in the root folder like we do while using react-native init example

推荐答案

4小时后,我得到了答案.

After 4 hours, I got the answer..

必须使用npm i -g exp&然后使用exp detach分离项目另外,我在app.json中添加了一些字段,使其可以按以下方式工作

Had to install exp using npm i -g exp & then used exp detach to detach the projectAlso I added some fields in app.json for it to work as follows

{
  "expo": {
    "name": "Project",
    "slug": "project",
    "sdkVersion": "18.0.0",
    "privacy": "public",
    "android": {
      "package": "com.example.project"
    }
 }
}

此处

侧注:它不会像使用react-native init那样创建文件夹结构...而是创建android&分别是ios个文件夹.

SideNote: It doesn't create the folder structure like when done using react-native init... It creates android & ios folders respectively.

这篇关于将Expo项目转换为原始React Native项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:22