이제 이 컴포넌트를 ArticleScreen에서 사용하세요.

    screens/ArticleScreen.tsx

    (...)
    import CommentItem from '../components/CommentItem';
    
    type ArticleScreenRouteProp = RouteProp<RootStackParamList, 'Article'>;
    
    function ArticleScreen() {
      (...)
      return (
        <FlatList
          style={styles.flatList}
          contentContainerStyle={[styles.flatListContent, {paddingBottom: bottom}]}
          data={commentsQuery.data}
          renderItem={({item}) => (
            <CommentItem
              id={item.id}
              message={item.message}
              publishedAt={item.published_at}
              username={item.user.username}
            />
          )}
          keyExtractor={(item) => item.id.toString()}
          ListHeaderComponent={
            <ArticleView
              title={title}
              body={body}
              publishedAt={published_at}
              username={user.username}
            />
          }
        />
      );
    }
    
    const styles = StyleSheet.create({
      (...)
    });
    
    export default ArticleScreen;
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.