问题
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