react-native-svg를 설치해야 했지만, Expo Vector Icons를 사용하면 별도의 설정 없이 원하는 아이콘을 사용할 수 있습니다.
이 링크는 Expo Vector Icons에서 제공하는 아이콘을 볼 수 있는 링크입니다. expo.fyi↗npm i @expo/vector-icons
import { 아이콘 패키지 } from '@expo/vector-icons';이고, 두 번째 코드는 <아이콘 컴포넌트 />입니다. 두 코드를 복사하여 프로젝트에 붙여넣으면 아이콘이 나타납니다. 아래는 예시 코드와 결과입니다.import AntDesign from '@expo/vector-icons/AntDesign';
import { SafeAreaView } from 'react-native-safe-area-context';
 
const App = () => {
  return (
    <SafeAreaView
      style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
    >
      <AntDesign name="checkcircle" size={24} color="black" />
    </SafeAreaView>
  );
};
 
export default App;
Icon.Button 컴포넌트는 아이콘과 텍스트를 함께 사용할 수 있습니다. 아래는 예시 코드와 결과입니다.import AntDesign from '@expo/vector-icons/AntDesign';
import { SafeAreaView } from 'react-native-safe-area-context';
 
const App = () => {
  return (
    <SafeAreaView
      style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
    >
      <AntDesign.Button
        name="checkcircle"
        size={24}
        color="white"
        backgroundColor={'green'}
        onPress={() => console.log('Button Pressed')}
      >
        Press Me
      </AntDesign.Button>
    </SafeAreaView>
  );
};
 
export default App;
| Prop | 설명 | 타입 | 기본값 | 
|---|---|---|---|
| name | 아이콘 이름 | string | X | 
| size | 아이콘 크기 | number | 20 | 
| color | 아이콘 색상 | string | white | 
| backgroundColor | 버튼 배경색 | string | #007AFF | 
| onPress | 버튼 클릭 시 실행할 함수 | () => void | null | 
| borderRadius | 버튼 테두리 둥글기 | number | 5 | 
| iconStyle | 아이콘 스타일 | StyleProp | {marginRight: 10} |