i want to use flashlist
to render items to the screen , acording to the docs the only thing that we need to do is to rename the component and add estimatedItemSize
attribute to the component , so i did it but i got this weird error .
component code :
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>
);
};
and the error is :
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 ...
it works fine with flatlist
.
6
Answers
See this tweet, looks like you need to build a custom dev client: https://twitter.com/Baconbrix/status/1542574116850524162?s=20&t=pbf86KkE8JkhY5ZQ4Z_w_g
After installing the package and running npx pod-install, make sure you reinstall the app e.g yarn ios
The reason for this is that flashlist module has native dependencies (this is why installation docs prompts you to install the native deps with
pod install
in the ios directory).Whenever you change anything on the "native" side of things you need to rebuild the app via xCode (or with
yarn ios
).After that you will not see the error anymore 🤩
After install the
flashlist
dependency withpod install
then you need to run the App again fromxcode
openxcode
and presscommand + R
on Mac,after that your error will resolved.
I am using Expo SDK 46,
I install FlashList by command mentioned in https://shopify.github.io/flash-list/docs/#installation
After that, I rebuild development build by command
Restart app again, and error gone
if you are using expo go, make sure you are using SDK 46 or newer, as you can find in flashlist documentation that it is support from SDK 46 upwards ,
you can upgrade your expo SDK by run
expo upgrade
in your project.