【问题标题】:Hot reloading does not update changes热重载不会更新更改
【发布时间】:2017-12-30 01:43:58
【问题描述】:

我有一个 react 本机应用程序,现在当我对其进行更改时,会触发热重载,但更改不会显示在应用程序中。例如。在样式表中将背景颜色从绿色更改为白色会导致应用程序说“热重新加载”,但颜色保持白色。完全重新加载应用程序将显示绿色背景。

我尝试过的事情:

Setting root component to a class.

Removing yarn.lock

Reinstalling watchman

Trying to set MAX_WAIT_TIME(由于解决方案过时而无法正常工作)

Installing Babel Functional HMR

通过 Xcode 和 react-native run-ios 运行模拟器。

只运行热重载,热重载和实时重载,只有实时重载。有和没有远程调试。

系统:
macOS:10.13.2
反应原生:0.51.0
React-Native-Cli:2.0.1
Xcode(用于运行模拟器):9.2

这里出了什么问题?我怎样才能让热重载工作?

编辑:

看起来这是bug。保持这个问题开放,以防有人有解决方法。

【问题讨论】:

    标签: react-native hot-reload


    【解决方案1】:

    降级到 react-native 0.48.4 解决了这个问题。仍然不是最佳解决方案,所以我不会将此标记为答案。

    【讨论】:

      【解决方案2】:

      _# ###解决方案

      react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/应用程序/src/main/res

      输出将是: c:\Users\lenger\Desktop\webrowser>react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android。捆绑 --assets-dest android/app/src/main/res 扫描文件夹中的符号链接 c:\Users\lenger\Desktop\webrowser\node_modules (43ms) 扫描文件夹中的符号链接 c:\Users\lenger\Desktop\webrowser\node_modules (38ms) 加载依赖图,完成。 捆绑:开始 捆绑:完成 捆绑:将捆绑输出写入:android/app/src/main/assets/index.android.bundle bundle: 完成编写 bundle 输出

      之后

      再次运行react-native run-android,你会发现你的修改工作。

      感谢: [https://lengerrong.blogspot.am/2018/01/react-native-run-android-do-not.html][1]

      【讨论】:

        【解决方案3】:

        试试,

        rm -rf /usr/local/var/run/watchman && npm uninstall watchman && npm install watchman
        

        rm -rf /usr/local/var/run/watchman && brew uninstall watchman && brew install watchman
        

        然后

        react-native run-android
        

        【讨论】:

        • 你发布这个答案的理由是什么?
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-11-10
        • 2018-07-12
        • 1970-01-01
        • 2020-09-11
        • 2021-07-03
        • 2022-07-18
        • 2016-08-19
        相关资源
        最近更新 更多