UNPKG

react-native-arrow-follow

Version:
148 lines (147 loc) 3.52 kB
import { Component } from 'react'; declare enum CORNER { TOP_LEFT = "TOP_LEFT", TOP_RIGHT = "TOP_RIGHT", BOTTOM_LEFT = "BOTTOM_LEFT", BOTTOM_RIGHT = "BOTTOM_RIGHT" } declare enum DIRECTION { HORIZONTAL = "HORIZONTAL", VERTICAL = "VERTICAL" } declare enum HORIZONTAL { LEFT = "LEFT", RIGHT = "RIGHT" } declare enum VERTICAL { TOP = "TOP", BOTTOM = "BOTTOM" } export declare type ICorner = CORNER | keyof typeof CORNER; export declare type IDirection = DIRECTION | keyof typeof DIRECTION; declare type IProps = { height: number; width: number; size?: number; color?: string; start: { corner: ICorner; direction: IDirection; }; end: { corner: ICorner; direction: IDirection; }; }; declare type IState = { width: number; height: number; aspectRatio: number; viewBox: [number, number, number, number]; size: number; route: string; triangleOrient: number; margins: any[]; }; declare class ArrowFollow extends Component<IProps, IState> { /** * @type {number} * @private */ private _xl; /** * @type {number} * @private */ private _xr; /** * @type {number} * @private */ private _yt; /** * @type {number} * @private */ private _yb; /** * @type {number} * @private */ private _radium; /** * @type {{width:number, height:number}} * @private */ private _triangle; /** * @param {IProps} props */ constructor(props: IProps); /** * @param {Readonly<IProps>} prevProps */ componentDidUpdate: (prevProps: Readonly<IProps>) => void; /** * @param {IProps} props * @return {Omit<IState, "route" | "triangleOrient" | "margins">} */ private _build; /** * @param {IProps} props * @param {VERTICAL} startVertical * @param {HORIZONTAL} startHorizontal * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @return {{width:number, height:number}} */ private _geCropView; /** * @param {VERTICAL} startVertical * @param {HORIZONTAL} startHorizontal * @param {POSITION} startPosition * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @param {POSITION} endPosition * @param width * @return {any[]} */ private _getMarginView; /** * @param {VERTICAL} startVertical * @param {HORIZONTAL} startHorizontal * @param {POSITION} startPosition * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @param {POSITION} _ * @return {string} */ private _getStart; /** * @param {VERTICAL} startVertical * @param {HORIZONTAL} startHorizontal * @param {POSITION} startPosition * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @param {POSITION} endPosition * @return {string} */ private _startCenter; /** * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @param {POSITION} direction * @return {string} */ private _getEnd; /** * @param {VERTICAL} endVertical * @param {HORIZONTAL} endHorizontal * @param {POSITION} endPosition * @return {number} */ private _arrowOrient; render: () => JSX.Element; } export { DIRECTION, HORIZONTAL, VERTICAL, CORNER }; export default ArrowFollow;