swiftui-react-native
Version:
A React Native component library inspired by SwiftUI
145 lines (144 loc) • 6.18 kB
TypeScript
import { ViewStyle } from 'react-native';
type Color = 'blue' | 'red' | 'green' | 'yellow' | 'orange' | 'purple' | 'pink' | 'primary' | 'secondary' | 'accentColor' | 'black' | 'white' | 'gray' | 'clear' | 'mint' | 'brown' | 'teal' | 'cyan' | 'indigo' | `#${string}` | `rgb${string}` | (string & {});
type LinearGradient = {
linearGradient: {
colors: Color[];
startPoint: 'top' | 'bottom' | 'leading' | 'trailing' | 'topLeading' | 'topTrailing' | 'bottomLeading' | 'bottomTrailing';
endPoint: 'top' | 'bottom' | 'leading' | 'trailing' | 'topLeading' | 'topTrailing' | 'bottomLeading' | 'bottomTrailing';
};
};
export type Modifiers = {
ignoresSafeArea?: boolean;
padding?: number | boolean | {
leading?: number;
top?: number;
bottom?: number;
trailing?: number;
horizontal?: number;
vertical?: number;
all?: number;
};
border?: {
color?: Color;
width?: number;
};
foregroundStyle?: Color | Color[] | LinearGradient;
rotationEffect?: {
degrees?: number;
radians?: number;
};
redacted?: 'privacy' | 'placeholder' | 'invalidated';
scaleEffect?: number;
shadow?: {
color?: Color;
x?: number;
y?: number;
radius?: number;
opacity?: number;
};
background?: Color | LinearGradient;
disabled?: boolean;
hidden?: boolean;
frame?: {
width?: number;
height?: number;
} | {
minWidth?: number | 'infinity';
minHeight?: number | 'infinity';
maxWidth?: number | 'infinity';
maxHeight?: number | 'infinity';
};
zIndex?: number;
opacity?: number;
tint?: Color;
cornerRadius?: number;
position?: {
x: number;
y: number;
};
offset?: {
x: number;
y: number;
};
fixedSize?: boolean | {
horizontal?: boolean;
vertical?: boolean;
};
lineLimit?: number;
animation?: {
type: 'spring' | 'easeIn' | 'easeOut' | 'easeInOut' | 'linear' | 'interpolatingSpring' | 'bouncy' | 'smooth' | 'default';
value: any;
};
contentTransition?: 'numericText' | 'opacity' | 'identity' | 'interpolate' | 'symbolEffect';
labelIsHidden?: boolean;
blur?: number;
saturation?: number;
grayscale?: number;
brightness?: number;
contrast?: number;
compositingGroup?: boolean;
blendMode?: 'color' | 'colorBurn' | 'colorDodge' | 'darken' | 'difference' | 'exclusion' | 'hardLight' | 'hue' | 'lighten' | 'luminosity' | 'multiply' | 'overlay' | 'saturation' | 'screen' | 'softLight' | 'sourceAtop' | 'destinationOver' | 'destinationOut' | 'plusDarker' | 'plusLighter' | 'normal';
mask?: string;
clipShape?: 'circle' | 'roundedRectangle' | 'capsule' | 'rectangle' | 'ellipse' | {
shape: 'roundedRectangle';
cornerRadius: number;
};
fill?: Color;
stroke?: {
color: Color;
lineWidth: number;
};
environment?: {
colorScheme: 'light' | 'dark';
};
textContentType?: 'name' | 'namePrefix' | 'givenName' | 'middleName' | 'familyName' | 'nameSuffix' | 'nickname' | 'jobTitle' | 'organizationName' | 'location' | 'fullStreetAddress' | 'streetAddressLine1' | 'streetAddressLine2' | 'addressCity' | 'addressState' | 'addressCityAndState' | 'sublocality' | 'countryName' | 'postalCode' | 'telephoneNumber' | 'emailAddress' | 'URL' | 'creditCardNumber' | 'username' | 'password' | 'newPassword' | 'oneTimeCode' | 'shipmentTrackingNumber' | 'flightNumber' | 'dateTime' | 'birthdate' | 'birthdateDay' | 'birthdateMonth' | 'birthdateYear' | 'creditCardSecurityCode' | 'creditCardName' | 'creditCardGivenName' | 'creditCardMiddleName' | 'creditCardFamilyName' | 'creditCardExpiration' | 'creditCardExpirationMonth' | 'creditCardExpirationYear' | 'creditCardType';
keyboardType?: 'numberPad' | 'phonePad' | 'namePhonePad' | 'emailAddress' | 'decimalPad' | 'twitter' | 'webSearch' | 'asciiCapableNumberPad' | 'numbersAndPunctuation' | 'URL' | 'asciiCapable' | 'default';
textInputAutocapitalization?: 'never' | 'words' | 'sentences' | 'characters';
autocorrectionDisabled?: boolean;
resizable?: boolean;
imageScale?: 'small' | 'medium' | 'large';
symbolRenderingMode?: 'palette' | 'monochrome' | 'hierarchical' | 'multicolor';
fontSize?: number;
fontWeight?: 'ultralight' | 'thin' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy' | 'black';
font?: 'body' | 'callout' | 'caption' | 'caption2' | 'footnote' | 'headline' | 'largeTitle' | 'subheadline' | 'title' | 'title2' | 'title3';
bold?: boolean;
italic?: boolean;
strikethrough?: boolean | {
isActive: boolean;
color?: Color;
pattern?: 'dot' | 'dash' | 'solid' | 'dashDotDot' | 'dashDot';
};
underline?: boolean | {
isActive: boolean;
color?: Color;
pattern?: 'dot' | 'dash' | 'solid' | 'dashDotDot' | 'dashDot';
};
buttonStyle?: 'bordered' | 'borderless' | 'plain' | 'borderedProminent';
pickerStyle?: 'wheel' | 'segmented' | 'menu';
textFieldStyle?: 'plain' | 'roundedBorder';
listStyle?: 'inset' | 'grouped' | 'plain' | 'insetGrouped';
sensoryFeedback?: {
feedback: 'warning' | 'error' | 'success' | 'alignment' | 'decrease' | 'impact' | 'increase' | 'levelChange' | 'selection' | 'start' | 'stop';
trigger: any;
};
scrollDisabled?: boolean;
onAppear?: () => void;
onDisappear?: () => void;
};
export type NativeModifiersProp = {
[key: string]: any;
};
export type ExperimentalPrivateModifierProp = {
_modifiers: NativeModifiersProp[];
};
export declare function getExperimentalPrivateModifiers(modifiers: Modifiers): NativeModifiersProp;
/**
* Maps a modifiers object or function to an array of native modifiers, with
* the order being preserved.
*/
export declare function mapToNativeModifiers(modifiers: Modifiers): NativeModifiersProp[] | (Modifiers & any[]);
export declare function getSizeFromModifiers(modifiers: Modifiers, defaultSize?: {
width: number;
height: number;
}): ViewStyle;
export {};