본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

HeroUI Native 퀵 스타트 (Quick Start)

원문 보기 위키 갱신

HeroUI Native를 시작하는 방법에는 두 가지가 있어요. CLI로 완전히 세팅된 새 프로젝트를 만들거나, 기존 React Native·Expo 프로젝트에 직접 설치할 수 있답니다. 처음부터 구성하는 게 번거롭다면 CLI가 훨씬 빠르겠죠. 차근차근 따라 하시면 금방 첫 컴포넌트를 화면에 띄울 수 있어요.

출처: 문서

본문

프로젝트 상황에 맞는 경로를 선택하세요:

  • 옵션 1 — CLI로 새로 구성된 프로젝트를 만듭니다. 별도 설정이 필요 없어요.
  • 옵션 2 — 기존 React Native 또는 Expo 프로젝트에 HeroUI Native를 추가합니다.

옵션 1: 새 프로젝트 만들기

시작하는 가장 빠른 방법이에요. CLI가 Expo 프로젝트에 HeroUI Native, 필요한 모든 peer dependency, Uniwind / Tailwind CSS, 전역 스타일, 그리고 이미 연결된 HeroUINativeProvider까지 구성해 줍니다. 그래서 바로 빌드를 시작할 수 있죠.

npx create-heroui-native-app@latest
pnpm create heroui-native-app@latest
yarn create heroui-native-app
bun create heroui-native-app@latest

안내 프롬프트를 따라 진행한 뒤, 개발 서버를 시작하세요:

cd my-app
npm run start

이제 빌드를 시작할 준비가 됐어요. 첫 컴포넌트 사용하기로 건너뛰거나 컴포넌트 살펴보기를 확인해 보세요.

참고: 스캐폴드에는 TypeScript를 사용하는 Expo, 미리 구성된 Uniwind + Tailwind CSS, 필수 import가 포함된 global.css, 그리고 앱 진입점이 이미 GestureHandlerRootView와 HeroUINativeProvider로 감싸져 있는 형태가 들어 있어요.

옵션 2: 기존 프로젝트에 추가하기

이미 React Native 또는 Expo 앱이 있다면 아래 단계대로 HeroUI Native를 수동으로 설치하고 구성하세요.

AI 어시스턴트에게 맡기는 걸 선호하시나요? 편집기에 HeroUI Native MCP Server를 설치한 다음 관련 프롬프트를 AI 어시스턴트에 붙여넣으세요. 프로젝트를 분석해서 전체 구성을 처리해 줍니다.

1. HeroUI Native 설치

npm install heroui-native
pnpm add heroui-native
yarn add heroui-native
bun add heroui-native

2. 필수 Peer Dependency 설치

npm install react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.0
pnpm add react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.0
yarn add react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.0
bun add react-native-reanimated@^4.1.1 react-native-gesture-handler@^2.28.0 react-native-worklets@^0.5.1 react-native-safe-area-context@^5.6.0 react-native-svg@^15.12.1 tailwind-variants@^3.2.2 tailwind-merge@^3.4.0

경고: 호환성 문제를 피하려면 위에 명시된 정확한 버전을 사용하는 걸 권장해요. 버전이 일치하지 않으면 예상치 못한 버그가 발생할 수 있답니다.

3. 선택적 Dependency

이 패키지들은 특정 컴포넌트나 기능을 쓸 때만 필요해요:

Package Version Required for
react-native-screens ^4.16.0 BottomSheet, Dialog, Menu, Popover, Select, Toast
@gorhom/bottom-sheet ^5.2.9 BottomSheet, Menu / Popover / Select when presentation="bottom-sheet"

4. Uniwind 설정

Uniwind 설치 가이드를 따라 React Native용 Tailwind CSS를 구성하세요.

NativeWind에서 마이그레이션하고 있다면 마이그레이션 가이드를 확인하세요.

5. global.css 구성

global.css 파일 안에 다음 import를 추가하세요:

@import 'tailwindcss';
@import 'uniwind';

@import 'heroui-native/styles';

/* Path to the heroui-native lib inside node_modules relative to global.css */
/* Examples:
 *   - If global.css is at project root: ./node_modules/heroui-native/lib
 *   - If global.css is in app/: ../node_modules/heroui-native/lib
 *   - If global.css is in src/styles/: ../../node_modules/heroui-native/lib
 */
/* Not required starting from heroui-native 1.0.8 — the library registers its own source */
@source './node_modules/heroui-native/lib';

6. 앱을 Provider로 감싸기

앱을 HeroUINativeProvider로 감싸세요. 반드시 GestureHandlerRootView로 감싸야 해요:

import { HeroUINativeProvider } from 'heroui-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

export default function App() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <HeroUINativeProvider>{/* Your app content */}</HeroUINativeProvider>
    </GestureHandlerRootView>
  );
}

Note: text props, 애니메이션 설정, toast 구성 등의 고급 설정 옵션은 Provider 문서를 참고하세요.

첫 컴포넌트 사용하기 (Use Your First Component)

import { Button } from 'heroui-native';
import { View } from 'react-native';

export default function MyComponent() {
  return (
    <View className="flex-1 justify-center items-center bg-background">
      <Button onPress={() => console.log('Pressed!')}>Get Started</Button>
    </View>
  );
}

세분화된 export로 번들 크기 줄이기 (Reduce Bundle Size with Granular Exports)

번들 크기를 줄이고 필요한 컴포넌트만 가져오고 싶다면, 라이브러리가 컴포넌트별 세분화된 export를 제공해요:

// Granular imports - use when you need only a few components
import { HeroUINativeProvider } from "heroui-native/provider";
import { Button } from "heroui-native/button";
import { Card } from "heroui-native/card";

// General import - imports the whole library, use when you're using many components
import { Button, Card } from "heroui-native";

세분화된 import는 컴포넌트를 몇 개만 쓸 때 이상적이에요. 번들 크기를 작게 유지하는 데 도움이 되죠. heroui-native의 일반 import는 라이브러리 전체를 포함하므로, 앱 곳곳에서 많은 컴포넌트를 쓸 때 편리해요.

사용 가능한 세분화된 export:

  • heroui-native/provider - Provider component
  • heroui-native/provider-raw - Lightweight provider (keeps bare minimum to start)
  • heroui-native/[component-name] - Individual components
  • heroui-native/portal - Portal utilities
  • heroui-native/toast - Toast provider and utilities
  • heroui-native/utils - Utility functions
  • heroui-native/hooks - Custom hooks

중요: 번들 크기를 통제하려면 세분화된 import 패턴을 꾸준히 지켜야 해요. heroui-native에서 일반 import를 하나만 써도 이 최적화 전략이 깨져 버린답니다.

Tip: 번들을 더 세밀하게 제어하고 싶다면 ToastProvider와 PortalHost를 제외한 가벼운 provider인 HeroUINativeProviderRaw 사용을 고려해 보세요.

다음 단계 (What's Next?)

웹에서 실행하기 (Expo) (Running on Web)

경고: HeroUI Native는 현재 웹 사용을 권장하지 않아요. 지금은 모바일 플랫폼(iOS와 Android)에 집중하고 있답니다. 웹 개발에는 HeroUI React를 대신 사용해 주세요.

더 알아보기 (Learn more)