Skip to content

Instantly share code, notes, and snippets.

@xiongemi
Last active April 20, 2022 23:39
Show Gist options
  • Select an option

  • Save xiongemi/2e51de1afb90881d0f6867f523bd8a89 to your computer and use it in GitHub Desktop.

Select an option

Save xiongemi/2e51de1afb90881d0f6867f523bd8a89 to your computer and use it in GitHub Desktop.
nx react native zodiac-sign-list.tsx with data passed in
import {
AdhZodiacSignItem,
AdhZodiacSignList,
} from '@aztro-daily-horoscope/models';
import React from 'react';
import { FlatList } from 'react-native';
import { ListItem } from '@rneui/base';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
export function ZodiacSignList() {
const keyExtractor = (item: AdhZodiacSignItem) => item.zodiacSign;
return (
<FlatList
keyExtractor={keyExtractor}
data={AdhZodiacSignList}
renderItem={({ item }) => (
<ListItem bottomDivider>
<Icon name={item.icon} />
<ListItem.Content>
<ListItem.Title>{item.zodiacSign}</ListItem.Title>
</ListItem.Content>
<ListItem.Chevron />
</ListItem>
)}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment