UNPKG

react-native-fast-image

Version:
43 lines (42 loc) • 1.48 kB
/** A length in points (dp on Android), or a percentage: see [`objectPosition`](#objectposition). */ export type PositionLength = number | `${number}%`; /** * Where the image is in the view: see [`objectPosition`](#objectposition). */ export type ObjectPosition = string | (({ top?: PositionLength; bottom?: never; } | { bottom: PositionLength; top?: never; }) & ({ left?: PositionLength; right?: never; } | { right: PositionLength; left?: never; })); export type ResolvedAxis = { fraction: number; offset: number; }; export type ResolvedPosition = { x: ResolvedAxis; y: ResolvedAxis; }; /** The default, `50% 50%`. */ export declare const CENTERED: ResolvedPosition; /** * The position for objectPosition, or null if it isn't valid. A string is * CSS's syntax; an object has one of `top` and `bottom` and one of `left` * and `right`, each in points or a percentage, and a missing axis is * centered. Unset is centered. */ export declare function resolveObjectPosition(position: ObjectPosition | null | undefined): ResolvedPosition | null; /** * The position for objectPosition, or centered if it isn't valid (as CSS * ignores it), with a warning in development. */ export declare function objectPositionOrCentered(position: ObjectPosition | null | undefined): ResolvedPosition; /** The position as CSS (for the web version's object-position). */ export declare function cssPosition({ x, y }: ResolvedPosition): string;