항목이 하나도 없을 때 사용할 컴포넌트의 이름은 Empty로 하겠습니다. 이미지를 불러와 사용하는 방법을 배우기 전에, 우선 문구만 나타내봅시다.

    components 디렉터리에 Empty.js 파일을 만들어 다음과 같이 코드를 작성해보세요.

    components/Empty.js

    import React from 'react';
    import {View, Text, StyleSheet} from 'react-native';
    
    function Empty() {
      return (
        <View style={styles.block}>
          <Text style={styles.description}>야호! 할일이 없습니다.</Text>
        </View>
      );
    }
    
    const styles = StyleSheet.create({
      block: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
      },
      description: {
        fontSize: 24,
        color: '#9e9e9e',
      },
    });
    
    export default Empty;
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.