# \[공지\] 공통 네비게이션바 아이콘 추가 안내

**URL:** <https://techchat-apps-in-toss.toss.im/t/topic/183>\
**Category:** 개발 공지사항\
**Created:** [9월 11, 2025, 8:37오전 UTC](https://techchat-apps-in-toss.toss.im/t/topic/183 "2025-09-11T08:37:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dylan](https://yyz1.discourse-cdn.com/flex007/user_avatar/techchat-apps-in-toss.toss.im/dylan/32/597_2.png) [@Dylan](https://techchat-apps-in-toss.toss.im/u/Dylan)\
**Post date:** [9월 11, 2025, 8:37오전 UTC](https://techchat-apps-in-toss.toss.im/t/topic/183/1 "2025-09-11T08:37:47Z")

</div>

상단 공통 네비게이션바에 아이콘 추가하는 방법을 안내드려요.

1. ReactNative

```tsx
import { useTopNavigation } from '@apps-in-toss/framework';
  // TopNavigation 설정
  const { addAccessoryButton } = useTopNavigation();
  
  // 하트 아이콘 버튼 추가
  addAccessoryButton({
    title: '하트',
    icon: {
      name: 'icon-heart-mono',
    },
    id: 'heart',
    onPress: () => console.log('테스트'), // 콜백함수 등록
  });

```

혹은 granite.config.ts 에

```tsx

navigationBar?: {
  withBackButton?: boolean;
  withHomeButton?: boolean;
  initialAccessoryButton?: InitialAccessoryButton;

```

```tsx
//e.g.
import { appsInToss } from '@apps-in-toss/framework/plugins';
import { defineConfig } from '@granite-js/react-native/config';

export default defineConfig({
  scheme: 'intoss',
  appName: 'my-granite-app-1',
  plugins: [
    appsInToss({
      brand: {
        displayName: 'my-granite-app-1', // 화면에 노출될 앱의 한글 이름으로 바꿔주세요.
        primaryColor: '#3182F6', // 화면에 노출될 앱의 기본 색상으로 바꿔주세요.
        icon: "",
        bridgeColorMode: 'basic',
      },
      permissions: [],
      navigationBar: {
        withBackButton: true,
        withHomeButton: true,
        initialAccessoryButton: {
          icon: {
            name: 'icon-heart-mono',
          },
          id: 'heart',
          title: '하트',
        },
      },
    }),
  ],
});

```

1. Webview

```tsx
import { partner, tdsEvent } from '@apps-in-toss/web-framework'

  // 하트 아이콘 버튼 추가
  useEffect(() => {
    partner.addAccessoryButton({
      id: 'heart',
      title: '하트',
      icon: {
        name: 'icon-heart-mono',
      },
    });

    // 네비게이션 액세서리 버튼 클릭 이벤트 리스너 등록
    const cleanup = tdsEvent.addEventListener('navigationAccessoryEvent', {
      onEvent: ({ id }) => {
        if (id === 'heart') {
          console.log('테스트');
        }
      },
    });

    return cleanup;
  }, []);

```

혹은 granite.config.ts 에

```tsx
navigationBar?: {
  withBackButton?: boolean;
  withHomeButton?: boolean;
  initialAccessoryButton?: InitialAccessoryButton;
};

```

```tsx
// e.g.
import { defineConfig } from '@apps-in-toss/web-framework/config';

export default defineConfig({
  appName: 'webview-app-1',
  brand: {
    displayName: 'webview-app-1', // 화면에 노출될 앱의 한글 이름으로 바꿔주세요.
    primaryColor: '#3182F6', // 화면에 노출될 앱의 기본 색상으로 바꿔주세요.
    icon: "",
    bridgeColorMode: 'basic',
  },
  web: {
    host: 'localhost',
    port: 5173,
    commands: {
      dev: 'vite',
      build: 'tsc -b && vite build',
    },
  },
  permissions: [],
  outdir: 'dist',
  navigationBar: {
    withBackButton: true,
    withHomeButton: true,
    initialAccessoryButton: {
      id: 'close',
      title: 'Close',
      icon: {
        name: 'icon-heart-mono',
      },
    }
  },
});

```

- navigationBar 옵션 추가 → 기존 webViewProps 내 header 옵션으로 사용하고 계셨다면, 마이그레이션이 필요해요
- withHomeButton 옵션 신규 추가
- 초기 노출가능한 버튼 2개 → 1개로 변경
