// @flow import * as React from 'react'; import {Avatar, Chip, List, withTheme} from 'react-native-paper'; import {View} from 'react-native'; import type { ClubCategoryType, ClubType, } from '../../../screens/Amicale/Clubs/ClubListScreen'; import type {CustomThemeType} from '../../../managers/ThemeManager'; type PropsType = { onPress: () => void, categoryTranslator: (id: number) => ClubCategoryType, item: ClubType, height: number, theme: CustomThemeType, }; class ClubListItem extends React.Component { hasManagers: boolean; constructor(props: PropsType) { super(props); this.hasManagers = props.item.responsibles.length > 0; } shouldComponentUpdate(): boolean { return false; } getCategoriesRender(categories: Array): React.Node { const {props} = this; const final = []; categories.forEach((cat: number | null) => { if (cat != null) { const category: ClubCategoryType = props.categoryTranslator(cat); final.push( {category.name} , ); } }); return {final}; } render(): React.Node { const {props} = this; const categoriesRender = (): React.Node => this.getCategoriesRender(props.item.category); const {colors} = props.theme; return ( ( )} right={(): React.Node => ( )} style={{ height: props.height, justifyContent: 'center', }} /> ); } } export default withTheme(ClubListItem);