// @flow import * as React from 'react'; import {IconButton, List, withTheme} from 'react-native-paper'; type Props = { theme: Object, onPress: Function, onStartPress: Function, item: Object, height: number, } type State = { isFav: boolean, } class GroupListItem extends React.Component { colors: Object; constructor(props) { super(props); this.colors = props.theme.colors; this.state = { isFav: (props.item.isFav !== undefined && props.item.isFav), } } shouldComponentUpdate(prevProps: Props, prevState: State) { return (prevState.isFav !== this.state.isFav); } onStarPress = () => { this.setState({isFav: !this.state.isFav}); this.props.onStartPress(); } render() { return ( } right={props => } style={{ height: this.props.height, justifyContent: 'center', }} /> ); } } export default withTheme(GroupListItem);