【问题标题】:Where we are setting http://localhost:8081/ in React Native App for Android我们在 React Native App for Android 中设置 http://localhost:8081/
【发布时间】:2021-04-01 20:04:54
【问题描述】:

我正在尝试使用 React Native 创建一个 android 应用程序。我是 React Native 的新手。 我的问题是我们可以从 https://domain_name.com/appname/index 加载 index.js 文件吗? 或者我们在哪里设置 http:localhost:8081 来响应原生?

【问题讨论】:

    标签: android react-native npm mobile localhost


    【解决方案1】:

    对于开发,您可以通过将--port 参数提供给命令react-native start 来自定义端口号,例如stated here

    理论上,您可以使用ngrok 之类的工具将打包器服务器公开到互联网,并通过developer debug menu 相应地配置捆绑器。不过我还没有亲自尝试过。

    对于生产,您可以通过expo-updatesreact-native-code-push 使您最新的js 包通过互联网访问。

    【讨论】:

      猜你喜欢
      • 2017-05-10
      • 2018-08-12
      • 2021-04-05
      • 1970-01-01
      • 1970-01-01
      • 2019-01-06
      • 1970-01-01
      • 1970-01-01
      • 2020-10-22
      相关资源
      最近更新 更多