diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 5714951fcb..3f46baef3c 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -16,7 +16,7 @@ export type IconSource = | Readonly<{ source: IconSourceBase; direction: 'rtl' | 'ltr' | 'auto' }> | ((props: IconProps & { color: ColorValue }) => React.ReactNode); -type IconProps = { +export type IconProps = { /** * Size of icon. */ diff --git a/src/components/__tests__/Icon.test.tsx b/src/components/__tests__/Icon.test.tsx index d1d280a63f..68baaa53f2 100644 --- a/src/components/__tests__/Icon.test.tsx +++ b/src/components/__tests__/Icon.test.tsx @@ -2,12 +2,20 @@ import { Image } from 'react-native'; import { describe, expect, it } from '@jest/globals'; +import type { IconProps, IconSource } from '../../index'; import { render, screen } from '../../test-utils'; import Icon from '../Icon'; const ICON_SIZE = 24; describe('Icon Component', () => { + it('exports IconSource and IconProps types from root index', () => { + const iconSource: IconSource = 'camera'; + const iconProps: IconProps = { size: 24 }; + expect(iconSource).toBe('camera'); + expect(iconProps.size).toBe(24); + }); + it('renders correctly with image source', async () => { const source = { uri: 'https://picsum.photos/700' }; await render(); diff --git a/src/index.tsx b/src/index.tsx index 1807d2f249..118da4d047 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -104,6 +104,7 @@ export type { Variant as FABVariant, Size as FABSize, } from './components/FAB/tokens'; +export type { IconSource, IconProps } from './components/Icon'; export type { Props as IconButtonProps } from './components/IconButton/IconButton'; export type { Props as ListAccordionProps } from './components/List/ListAccordion'; export type { Props as ListAccordionGroupProps } from './components/List/ListAccordionGroup';