React native fast refresh ALWAYS reload app

假如想象 提交于 2020-12-15 05:20:49

问题


According to React-native docs, fast-refresh will fully reload the entire app only

if you edit a file that's imported by modules outside of the React tree

Now, Somewhere up the road the app started fully reload after every change in any module(even though apparently I did not change module that imported by modules outside React tree). so I tried to comment out anything in the main App.js module, but still, after save in the App.js module the fast refresh made the app fully reload.

The commented out app.js looks like this:

import React from "react";
import { Text, StyleSheet } from "react-native";
export default () => {
  return <Text>hessssssssssy!</Text>;
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
  },
});

every change in the text in the Text element entails a full app reload, this makes the development really hard.

I'm Using Expo CLI.

also Tried:

  • toggle fast reload on and off.
  • restart reinstall expo(worth trying).

This app is empty, so I have no idea why it still fully reloads after a change. if I would open a new project with the exact same app this would not fully reload on fast refresh but will hot-reload as intended.
the only differences between the entirely new project and the current project with commented out lines maybe would be in the app.json and package.json(and maybe the all unused files.)

来源:https://stackoverflow.com/questions/63456359/react-native-fast-refresh-always-reload-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!