我想使用flashlist
将项目呈现到屏幕上,根据文档,我们唯一需要做的就是重命名组件并将estimatedItemSize
属性添加到组件中,所以我这样做了,但我得到了这个奇怪的错误。
组件代码:
export const RestaurantsScreen = () => {
const { isLoading, error, clearError, sendRequest } = useHttpClient();
const [fetchedRestaurants, setFetchedRestaurants] = useState([]);
...
...
...
{!isLoading && fetchedRestaurants.length > 0 && (
<FlashList
data={fetchedRestaurants}
renderItem={renderItemComponent}
keyExtractor={(item) => item.name}
initialNumToRender={3}
estimatedItemSize={15}
/>
)}
</SafeArea>
);
};
误差为:
Invariant Violation: requireNativeComponent: "AutoLayoutView" was not found in the UIManager.
This error is located at:
in AutoLayoutView (created by AutoLayoutView)
in AutoLayoutView (created by ScrollComponent)
in RCTView (created by View)
in View (created by ScrollComponent)
in ...
它可以与flatlist
一起工作。
3条答案
按热度按时间vptzau2j1#
安装软件包并运行npx pod-install后,请确保重新安装应用程序(例如yarn ios)
amrnrhlw2#
这是因为flashlist模块具有本机依赖项(这就是为什么安装文档提示您在ios目录中安装带有
pod install
的本机deps)。无论何时,只要你在“原生”方面做了任何更改,你就需要通过xCode(或
yarn ios
)重建应用程序。之后,您将不会再看到错误🤩
xuo3flqw3#
看这条推文,看起来你需要构建一个自定义的开发客户端:https://twitter.com/Baconbrix/status/1542574116850524162?s=20&t=pbf86KkE8JkhY5ZQ4Z_w_g