我想用来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>
);
};
Run Code Online (Sandbox Code Playgroud)
错误是:
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 …Run Code Online (Sandbox Code Playgroud)