Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/components/__tests__/Icon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Icon source={source} size={ICON_SIZE} testID="image-icon" />);
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading