9.5.8 포스트 열기

    이제 프로필 화면에서 사진을 눌렀을 때, 단일 포스트를 조회하는 기능을 구현해봅시다. screens 경로에 PostScreen.js 파일을 생성해주세요.

    screens/PostScreen.js

    import {useRoute} from '@react-navigation/native';
    import React from 'react';
    import {ScrollView, StyleSheet} from 'react-native';
    import PostCard from '../components/PostCard';
    
    function PostScreen() {
      const route = useRoute();
      const {post} = route.params;
      return (
        <ScrollView contentContainerStyle={styles.contentContainer}>
          <PostCard
            user={post.user}
            photoURL={post.photoURL}
            description={post.description}
            createdAt={post.createdAt}
            id={post.id}
          />
        </ScrollView>
      );
    }
    
    const styles = StyleSheet.create({
      block: {flex: 1},
      contentContainer: {
        paddingBottom: 40,
      },
    });
    
    export default PostScreen;
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.