Last active
April 20, 2022 23:42
-
-
Save xiongemi/ebc7f5eaf3ba9d576add088b97baf5ed to your computer and use it in GitHub Desktop.
aztro daily horoscope horoscope-list with container and on press action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; | |
| import { connect } from 'react-redux'; | |
| import { | |
| ZodiacSignListProps, | |
| mapDispatchToProps, | |
| } from './zodiac-sign-list.props'; | |
| export function ZodiacSignList({ setUserZodiacSignItem }: ZodiacSignListProps) { | |
| const keyExtractor = (item: AdhZodiacSignItem) => item.zodiacSign; | |
| return ( | |
| <FlatList | |
| keyExtractor={keyExtractor} | |
| data={AdhZodiacSignList} | |
| renderItem={({ item }) => ( | |
| <ListItem | |
| bottomDivider | |
| onPress={() => setUserZodiacSignItem(item)} | |
| > | |
| <Icon name={item.icon} /> | |
| <ListItem.Content> | |
| <ListItem.Title>{item.zodiacSign}</ListItem.Title> | |
| </ListItem.Content> | |
| <ListItem.Chevron /> | |
| </ListItem> | |
| )} | |
| /> | |
| ); | |
| } | |
| export const ZodiacSignListContainer = connect( | |
| null, | |
| mapDispatchToProps | |
| )(ZodiacSignList); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment