Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native: Rendering of List not working

$
0
0

I currently stuck in a problem with rendering a list in react-native.This code renders only the first array element of the cards array, but not all array entries.Did I missed something?

Cards Array example:

const cards = [{"created_at": "2022-01-25 20:07:14", "description": "Descriptiontext", "id": 1, "title": "Titel 1", "updated_at": "2022-02-25 07:41:18.304291", "userid_fk": 2}, {"created_at": "2022-01-25 20:07:14", "description": "Descriptiontext 2", "id": 2, "title": "Titel 2", "updated_at": "2022-02-25 07:41:18.304291", "userid_fk": 2}]
<ScrollView>                {cards.map((element: any) => (<Layout                    key={element.id}                    style={[                      globalStyles.container,                      {flexDirection: 'row', justifyContent: 'space-between'},                    ]}><Layout><Text style={element.title} numberOfLines={1}>                        {element.title}</Text><Text                        style={styles.desc}                        ellipsizeMode={'tail'}                        numberOfLines={1}                        lineBreakMode="tail">                        {element.description}</Text><Text appearance={'hint'} style={styles.date}>                        Erstellt am:{''}                        {moment(String(element.created_at)).format('DD.MM.YYYY HH:mm',                        )}</Text></Layout><TouchableOpacity                      onPress={() => deleteCard(element.id)}><Icon                        name="trash"                        fill={silver}                        style={globalStyles.icon}                      /></TouchableOpacity></Layout>                ))}</ScrollView>

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>