文件夹结构如下
app/
├─node_modules/
├─src/
│├─RepositoryItem。jsx
│├─rammstein。jsx
│├─rammstein。Jsx
├─rammstein。. json
├─README. jsonmd
├─App.js
RepositoryList和RepositoryItem被导入到Main.jsx中。主要。jsx导入到App.js
如果我修改了App.js或Main.js中的代码,并保存。世博会GO应用程序立即显示更改。
如果修改RepositoryList。jsx或RepositoryItem。JSX组件和保存,快速刷新发生,但不显示更改。只有当我手动重新加载应用程序。
如果修改RepositoryList。jsx组件和Main.jsx。Main中的变化。在RepositoryList中立即显示jsx的变化。JSX仅在手动重新加载后使用。
也如果我改变RepositoryItem或RepositoryList…"刷新…使用快速刷新显示;但这些变化并没有反映在应用程序
我在手机和平板电脑上都试过了,两个设备都出现了问题。
有办法解决这个问题吗?
您正在使用JSX文件(RepositoryItem.jsx;RepositoryList.jsx;Main.jsx)。你是否尝试过将扩展更改为JS?(Javascript)即:RepositoryItem.js
快速刷新适用于嵌套在子文件夹中的文件,如RepositoryList.js
和RepositoryItem.js
。
为什么它没有为我刷新是因为在RepositoryList
中我返回FlatList
组件,其中renderItem
是RepositoryItem
。像这样:
return (
<View>
<FlatList
data={repositories}
ItemSeparatorComponent={ItemSeparator}
renderItem={RepositoryItem}
/>
</View>
);
现在的问题是:为什么快速刷新不工作,如果我改变RepositoryItem
,这是FlatList
的renderItem
属性?