import React, { useEffect, FunctionComponent, useContext } from 'react'; import { View, ViewStyle, Image } from 'react-native'; import styles from './PixelTopicButtonStyles'; import usePixelTopicButtonTranslation from './PixelTopicButtonTranslation' import { PixelStyles } from 'react-native-pixel-styles'; import { PixelShadowButton, PixelwolfText } from 'react-native-pixel-components'; import { RicoIcon } from '../../../../../App/Components/RicoIcon/RicoIcon'; import { PixelTopic } from '../../Model/PixelTopic'; import { dateStoreContext } from 'react-native-pixel-utils'; import { useNavigation } from '@react-navigation/native'; interface IProps { // Props type definition style?: ViewStyle | ViewStyle[] topic: PixelTopic } interface IState { // State type definition } export const PixelTopicButton: FunctionComponent = (props) => { const { I18n } = usePixelTopicButtonTranslation() const themeStore = useContext(PixelStyles.pixelThemeStoreContext) const dateStore = useContext(dateStoreContext) const navigation = useNavigation() const initialState: IState = { }; // ComponentDidMount useEffect(() => { return () => { //ComponentDidUnmount } }, []) const onPressed = () => { navigation.navigate('PixelTopicScreen', { topic: props.topic }) } return ( {props.topic.category.name.toUpperCase()} {props.topic.title} {I18n.translation.CreatedBy(props.topic.author.name)} {props.topic.answers_amount && {I18n.translation.AnswersAmount(props.topic.answers_amount)} } {dateStore.getDateDescriptionFromString('2018-10-15T17:52:00Z')} ); };