Skip to content
Closed
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
6 changes: 1 addition & 5 deletions src/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AnimatedText from './AnimatedText';
import type { VariantProp } from './types';
import StyledText from './v2/StyledText';
import { useInternalTheme } from '../../core/theming';
import type { ThemeProp } from '../../types';
import type { ThemeProp, TextComponent } from '../../types';
import { forwardRef } from '../../utils/forwardRef';

export type Props<T> = React.ComponentProps<typeof NativeText> & {
Expand Down Expand Up @@ -173,10 +173,6 @@ const styles = StyleSheet.create({
},
});

type TextComponent<T> = (
props: Props<T> & { ref?: React.RefObject<TextRef> }
) => JSX.Element;

const Component = forwardRef(Text) as TextComponent<never>;

export const customText = <T,>() => Component as unknown as TextComponent<T>;
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ export type {
ThemeBase,
MD3Elevation,
MD3TypescaleKey,
TextComponent,
} from './types';
5 changes: 5 additions & 0 deletions src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type * as React from 'react';

import type { $DeepPartial } from '@callstack/react-theme-provider';
import type { Props, TextRef } from './components/Typography/Text';

export type Font = {
fontFamily: string;
Expand Down Expand Up @@ -173,6 +174,10 @@ export type MD3Type = {
fontStyle?: Font['fontStyle'];
};

export type TextComponent<T> = (
props: Props<T> & { ref?: React.RefObject<TextRef> }
) => JSX.Element;

export type MD3Typescale =
| {
[key in MD3TypescaleKey]: MD3Type;
Expand Down