[英]How to change Expo entry point properly?
I want to change entry point of my expo app.我想更改我的 expo 应用程序的入口点。 I have tried these simple steps:我已经尝试了这些简单的步骤:
First of all, I have created a simple expo project.首先,我创建了一个简单的 expo 项目。
$ expo init test
$ cd test
$ rm App.js
$ mkdir src
$ touch src/App.js
I have changed app.json of my expo based app as follows我已更改基于 expo 的应用程序的 app.json 如下
{
"expo": {
...,
entryPoint: "./src/App.js",
...
}
}
Then i have filled the App.js as folows然后我填写了 App.js 如下
import React from "react";
import { Text } from "react-native";
export default () => <Text>Hello World</Text>;
However, the first trial have been failed.然而,第一次审判失败了。 It have shown only splash screen.它只显示了启动画面。
Then i have edited the App.js as follows:然后我编辑了 App.js 如下:
import React from "react";
import { Text } from "react-native";
import { registerRootComponent } from "expo";
const App = () => <Text>Hello World</Text>;
registerRootComponent(App);
I have seen "Hello World" text in the screen.我在屏幕上看到了“Hello World”文本。 However, hotreloading have not been working.但是,hotreloading 一直没有工作。 Then i have modified main entry in package.json然后我修改了 package.json 中的主要条目
"main": "./src/App.js",
In this way hot reloading is working in second save action.这样,热重载在第二次保存动作中起作用。
I am wondering我想知道
I suggest you read this article:我建议你阅读这篇文章:
https://docs.expo.dev/versions/latest/sdk/register-root-component/#what-if-i-want-to-name-my https://docs.expo.dev/versions/latest/sdk/register-root-component/#what-if-i-want-to-name-my
and be sure you restarted your whole dev process并确保您重新启动了整个开发过程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.