skip to Main Content

i want to use flashlistto 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


  1. 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

    Login or Signup to reply.
  2. After installing the package and running npx pod-install, make sure you reinstall the app e.g yarn ios

    Login or Signup to reply.
  3. 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 🤩

    Login or Signup to reply.
  4. After install the flashlist dependency with pod install then you need to run the App again from xcode open xcode and press command + R on Mac,
    after that your error will resolved.

    Login or Signup to reply.
  5. I am using Expo SDK 46,
    I install FlashList by command mentioned in https://shopify.github.io/flash-list/docs/#installation

    npx expo install @shopify/flash-list expo-dev-client
    

    After that, I rebuild development build by command

    eas build -p ios --profile development --local
    

    Restart app again, and error gone

    expo start --dev-client
    
    Login or Signup to reply.
  6. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search