155058f92SEvan Baconimport { ClassAttributes, ComponentProps, ComponentType } from 'react';
2a8465056SEvan Baconimport {
3a8465056SEvan Bacon  AccessibilityRole,
4a8465056SEvan Bacon  StyleProp,
5a8465056SEvan Bacon  Text as NativeText,
6a8465056SEvan Bacon  TextStyle as NativeTextStyle,
7a8465056SEvan Bacon} from 'react-native';
855058f92SEvan Bacon
9a3634a2bSEvan Baconimport { WebViewStyle } from './View';
10*8a424bebSJames Ideimport { createSafeStyledView } from '../css/createSafeStyledView';
11a3634a2bSEvan Bacon
1255058f92SEvan Bacon// https://github.com/necolas/react-native-web/issues/832
1355058f92SEvan Bacon
1455058f92SEvan Bacontype NativeTextProps = ComponentProps<typeof NativeText> & ClassAttributes<typeof NativeText>;
1555058f92SEvan Bacon
1655058f92SEvan Baconexport interface WebTextStyle {
1755058f92SEvan Bacon  /** string is only available on web */
1855058f92SEvan Bacon  fontSize?: NativeTextStyle['fontSize'] | string;
1955058f92SEvan Bacon  /** string is only available on web */
2055058f92SEvan Bacon  lineHeight?: NativeTextStyle['lineHeight'] | string;
2155058f92SEvan Bacon  /** @platform web */
2255058f92SEvan Bacon  fontFeatureSettings?: string;
2355058f92SEvan Bacon  /** @platform web */
2455058f92SEvan Bacon  textIndent?: string;
2555058f92SEvan Bacon  /** @platform web */
2655058f92SEvan Bacon  textOverflow?: string;
2755058f92SEvan Bacon  /** @platform web */
2855058f92SEvan Bacon  textRendering?: string;
2955058f92SEvan Bacon  /** @platform web */
3055058f92SEvan Bacon  textTransform?: string;
3155058f92SEvan Bacon  /** @platform web */
3255058f92SEvan Bacon  unicodeBidi?: string;
3355058f92SEvan Bacon  /** @platform web */
3455058f92SEvan Bacon  wordWrap?: string;
3555058f92SEvan Bacon}
3655058f92SEvan Bacon
37a3634a2bSEvan Baconexport type TextStyle = Omit<NativeTextStyle, 'position' | 'fontSize' | 'lineHeight'> &
38a3634a2bSEvan Bacon  WebTextStyle &
39a3634a2bSEvan Bacon  WebViewStyle;
4055058f92SEvan Bacon
4155058f92SEvan Baconexport type WebTextProps = {
4255058f92SEvan Bacon  style?: StyleProp<TextStyle>;
4355058f92SEvan Bacon  /** @platform web */
4455058f92SEvan Bacon  tabIndex?: number;
45a3634a2bSEvan Bacon  /** @platform web */
46a3634a2bSEvan Bacon  accessibilityLevel?: number;
47a3634a2bSEvan Bacon  accessibilityRole?: 'listitem' | 'heading' | AccessibilityRole;
48a3634a2bSEvan Bacon  /** @platform web */
49a3634a2bSEvan Bacon  href?: string;
50a3634a2bSEvan Bacon  /** @deprecated use the prop `hrefAttrs={{ target: '...' }}` instead. */
51a3634a2bSEvan Bacon  target?: string;
52a3634a2bSEvan Bacon  /** @platform web */
53a3634a2bSEvan Bacon  hrefAttrs?: {
54a3634a2bSEvan Bacon    /** @platform web */
55a3634a2bSEvan Bacon    target?: string;
56a3634a2bSEvan Bacon    /** @platform web */
57a3634a2bSEvan Bacon    rel?: string;
58a3634a2bSEvan Bacon    /** @platform web */
59a3634a2bSEvan Bacon    download?: boolean | string;
60a3634a2bSEvan Bacon  };
61a3634a2bSEvan Bacon  /** @platform web */
62a3634a2bSEvan Bacon  lang?: string;
6355058f92SEvan Bacon};
6455058f92SEvan Bacon
65a8465056SEvan Baconexport type TextProps = Omit<NativeTextProps, 'style' | 'accessibilityRole'> & WebTextProps;
6655058f92SEvan Bacon
6755058f92SEvan Baconconst Text = NativeText as ComponentType<TextProps>;
6855058f92SEvan Bacon
69641d0767SEvan Baconexport default createSafeStyledView(Text) as ComponentType<TextProps>;
70