mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +00:00
Extract font/text related typings from props.js, ReadonlyArray<>
This commit is contained in:
Vendored
+93
-15
@@ -6,7 +6,65 @@ type NumberProp = string | number;
|
|||||||
|
|
||||||
export type FillRule = 'evenodd' | 'nonzero';
|
export type FillRule = 'evenodd' | 'nonzero';
|
||||||
export type Units = 'userSpaceOnUse' | 'objectBoundingBox';
|
export type Units = 'userSpaceOnUse' | 'objectBoundingBox';
|
||||||
|
|
||||||
export type TextAnchor = 'start' | 'middle' | 'end';
|
export type TextAnchor = 'start' | 'middle' | 'end';
|
||||||
|
export type FontStyle = 'normal' | 'italic' | 'oblique';
|
||||||
|
export type FontVariant = 'normal' | 'small-caps';
|
||||||
|
export type FontWeight =
|
||||||
|
| 'normal'
|
||||||
|
| 'bold'
|
||||||
|
| 'bolder'
|
||||||
|
| 'lighter'
|
||||||
|
| '100'
|
||||||
|
| '200'
|
||||||
|
| '300'
|
||||||
|
| '400'
|
||||||
|
| '500'
|
||||||
|
| '600'
|
||||||
|
| '700'
|
||||||
|
| '800'
|
||||||
|
| '900'
|
||||||
|
;
|
||||||
|
export type FontStretch =
|
||||||
|
| 'normal'
|
||||||
|
| 'wider'
|
||||||
|
| 'narrower'
|
||||||
|
| 'ultra-condensed'
|
||||||
|
| 'extra-condensed'
|
||||||
|
| 'condensed'
|
||||||
|
| 'semi-condensed'
|
||||||
|
| 'semi-expanded'
|
||||||
|
| 'expanded'
|
||||||
|
| 'extra-expanded'
|
||||||
|
| 'ultra-expanded'
|
||||||
|
;
|
||||||
|
export type TextDecoration = 'none' | 'underline' | 'overline' | 'line-through' | 'blink';
|
||||||
|
export type FontVariantLigatures = 'normal' | 'none';
|
||||||
|
export type AlignmentBaseline =
|
||||||
|
| 'baseline'
|
||||||
|
| 'text-bottom'
|
||||||
|
| 'alphabetic'
|
||||||
|
| 'ideographic'
|
||||||
|
| 'middle'
|
||||||
|
| 'central'
|
||||||
|
| 'mathematical'
|
||||||
|
| 'text-top'
|
||||||
|
| 'bottom'
|
||||||
|
| 'center'
|
||||||
|
| 'top'
|
||||||
|
| 'text-before-edge'
|
||||||
|
| 'text-after-edge'
|
||||||
|
| 'before-edge'
|
||||||
|
| 'after-edge'
|
||||||
|
| 'hanging'
|
||||||
|
;
|
||||||
|
export type BaselineShift = 'sub' | 'super' | 'baseline' | ReadonlyArray<NumberProp> | NumberProp;
|
||||||
|
export type LengthAdjust = 'spacing' | 'spacingAndGlyphs';
|
||||||
|
|
||||||
|
export type TextPathMethod = 'align' | 'stretch';
|
||||||
|
export type TextPathSpacing = 'auto' | 'exact';
|
||||||
|
export type TextPathMidLine = 'sharp' | 'smooth';
|
||||||
|
|
||||||
export type Linecap = 'butt' | 'square' | 'round';
|
export type Linecap = 'butt' | 'square' | 'round';
|
||||||
export type Linejoin = 'miter' | 'bevel' | 'round';
|
export type Linejoin = 'miter' | 'bevel' | 'round';
|
||||||
|
|
||||||
@@ -44,19 +102,30 @@ export interface StrokeProps {
|
|||||||
stroke?: string,
|
stroke?: string,
|
||||||
strokeWidth?: NumberProp,
|
strokeWidth?: NumberProp,
|
||||||
strokeOpacity?: NumberProp,
|
strokeOpacity?: NumberProp,
|
||||||
strokeDasharray?: number[] | string,
|
strokeDasharray?: ReadonlyArray<number> | string,
|
||||||
strokeDashoffset?: NumberProp,
|
strokeDashoffset?: NumberProp,
|
||||||
strokeLinecap?: Linecap,
|
strokeLinecap?: Linecap,
|
||||||
strokeLinejoin?: Linejoin,
|
strokeLinejoin?: Linejoin,
|
||||||
strokeMiterlimit?: NumberProp,
|
strokeMiterlimit?: NumberProp,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FontProps {
|
export interface FontObject {
|
||||||
fontFamily?: string,
|
fontStyle?: FontStyle,
|
||||||
|
fontVariant?: FontVariant,
|
||||||
|
fontWeight?: FontWeight,
|
||||||
|
fontStretch?: FontStretch,
|
||||||
fontSize?: NumberProp,
|
fontSize?: NumberProp,
|
||||||
fontWeight?: NumberProp,
|
fontFamily?: string,
|
||||||
fontStyle?: string,
|
textAnchor?: TextAnchor,
|
||||||
font?: object
|
textDecoration?: TextDecoration,
|
||||||
|
letterSpacing?: NumberProp,
|
||||||
|
wordSpacing?: NumberProp,
|
||||||
|
kerning?: NumberProp,
|
||||||
|
fontVariantLigatures?: FontVariantLigatures,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FontProps extends FontObject {
|
||||||
|
font?: FontObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransformObject {
|
export interface TransformObject {
|
||||||
@@ -112,14 +181,12 @@ export interface GProps extends CommonPathProps {
|
|||||||
}
|
}
|
||||||
export const G: React.ComponentClass<GProps>;
|
export const G: React.ComponentClass<GProps>;
|
||||||
|
|
||||||
export type ImageHref = ReactNative.ImageURISource | ReactNative.ImageURISource[] | ReactNative.ImageRequireSource;
|
|
||||||
|
|
||||||
export interface ImageProps extends ResponderProps, TouchableProps {
|
export interface ImageProps extends ResponderProps, TouchableProps {
|
||||||
x?: NumberProp,
|
x?: NumberProp,
|
||||||
y?: NumberProp,
|
y?: NumberProp,
|
||||||
width?: NumberProp,
|
width?: NumberProp,
|
||||||
height?: NumberProp,
|
height?: NumberProp,
|
||||||
href: ImageHref,
|
href: ReactNative.ImageProperties['source'],
|
||||||
preserveAspectRatio?: string,
|
preserveAspectRatio?: string,
|
||||||
}
|
}
|
||||||
export const Image: React.ComponentClass<ImageProps>;
|
export const Image: React.ComponentClass<ImageProps>;
|
||||||
@@ -159,12 +226,12 @@ export interface PatternProps {
|
|||||||
export const Pattern: React.ComponentClass<PatternProps>;
|
export const Pattern: React.ComponentClass<PatternProps>;
|
||||||
|
|
||||||
export interface PolygonProps extends CommonPathProps {
|
export interface PolygonProps extends CommonPathProps {
|
||||||
points: string | any[],
|
points: string | ReadonlyArray<any>,
|
||||||
}
|
}
|
||||||
export const Polygon: React.ComponentClass<PolygonProps>;
|
export const Polygon: React.ComponentClass<PolygonProps>;
|
||||||
|
|
||||||
export interface PolylineProps extends CommonPathProps {
|
export interface PolylineProps extends CommonPathProps {
|
||||||
points: string | any[],
|
points: string | ReadonlyArray<any>,
|
||||||
}
|
}
|
||||||
export const Polyline: React.ComponentClass<PolylineProps>;
|
export const Polyline: React.ComponentClass<PolylineProps>;
|
||||||
|
|
||||||
@@ -221,20 +288,31 @@ export const Symbol: React.ComponentClass<SymbolProps>;
|
|||||||
export interface TSpanProps extends CommonPathProps, FontProps {
|
export interface TSpanProps extends CommonPathProps, FontProps {
|
||||||
dx?: NumberProp,
|
dx?: NumberProp,
|
||||||
dy?: NumberProp,
|
dy?: NumberProp,
|
||||||
textAnchor?: TextAnchor,
|
|
||||||
}
|
}
|
||||||
export const TSpan: React.ComponentClass<TSpanProps>;
|
export const TSpan: React.ComponentClass<TSpanProps>;
|
||||||
|
|
||||||
export interface TextProps extends CommonPathProps, FontProps {
|
export interface TextSpecificProps extends CommonPathProps, FontProps {
|
||||||
|
alignmentBaseline: AlignmentBaseline,
|
||||||
|
baselineShift: BaselineShift,
|
||||||
|
verticalAlign: NumberProp,
|
||||||
|
lengthAdjust: LengthAdjust,
|
||||||
|
textLength: NumberProp,
|
||||||
|
fontData?: null | { [name: string]: any },
|
||||||
|
fontFeatureSettings?: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TextProps extends TextSpecificProps {
|
||||||
dx?: NumberProp,
|
dx?: NumberProp,
|
||||||
dy?: NumberProp,
|
dy?: NumberProp,
|
||||||
textAnchor?: TextAnchor,
|
|
||||||
}
|
}
|
||||||
export const Text: React.ComponentClass<TextProps>;
|
export const Text: React.ComponentClass<TextProps>;
|
||||||
|
|
||||||
export interface TextPathProps extends CommonPathProps, FontProps {
|
export interface TextPathProps extends TextSpecificProps {
|
||||||
href: string,
|
href: string,
|
||||||
startOffset?: NumberProp,
|
startOffset?: NumberProp,
|
||||||
|
method?: TextPathMethod,
|
||||||
|
spacing?: TextPathSpacing,
|
||||||
|
midLine: TextPathMidLine,
|
||||||
}
|
}
|
||||||
export const TextPath: React.ComponentClass<TextPathProps>;
|
export const TextPath: React.ComponentClass<TextPathProps>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user