Flatlist cards of different sizes

Issue

I have an issue that I can’t solve,

i have a flatlist that returns fake information but i would like the card size to adjust according to the information i want the card to grow along with the added item, for example i have a standard size but i want it when the If the user writes a long description, the card he added changes size but the one before it does not remain at its normal size. I took the height but the cards are all the same size, how could I do that in the flatlist?

Solution

So depending on what you are looking for exactly you could use import { AutoSizeText, ResizeTextMode } from 'react-native-auto-size-text'; to automatically adjust the size of the text within a defined view.

If you want the view to be of a fixed size just define the height and width either on its own (height:20, width:20) or based on screen size using import { Dimensions } from 'react-native' and then height: Dimensions.get('screen').height.

Hope this helps! /W

Answered By – William O'Brien

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.