将 Expo 项目转换为原始 React Native 项目 [英] Convert Expo project to Original React Native project
问题描述
我做了 yarn runeject
来弹出,但它给了我这个警告
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
&index.ios.js
在根文件夹中,就像我们在使用 react-native init 示例时所做的那样
Now I want to convert this to React Native Components so that I can eject without any errors so that I get
index.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 expo
安装 exp
&然后使用 expoject
分离项目我还在 app.json
中添加了一些字段,使其按如下方式工作
Had to install exp
using npm i -g expo
& then used expo eject
to detach the project
Also 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 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!