UNPKG

react-native-enhance-stylesheet

Version:
98 lines (83 loc) 2.25 kB
/** * Created by MeePwn * https://github.com/maybewaityou * * description: * */ export declare const screenW; export declare const screenH; export declare const fontScale; export declare const pixelRatio; // 像素密度 export declare const DEFAULT_DENSITY = 2; export declare class ScreenAdapter { public static screenW; public static screenH; public static pixelRatio; public static DEFAULT_DENSITY; public w2: number; public h2: number; public screenW: number; public screenH: number; public margin: number; public marginTop: number; public marginLeft: number; public marginBottom: number; public marginRight: number; public marginHorizontal: number; public marginVertical: number; public padding: number; public paddingTop: number; public paddingLeft: number; public paddingBottom: number; public paddingRight: number; public paddingHorizontal: number; public paddingVertical: number; /** * px 转换成 dp * @param config 参数 ( 以 iPhone6 为基准, 如果以其他尺寸为基准的话, 请修改下面的 750 和 1334 为对应尺寸即可.) */ constructor(config?: any) /** * px 转换成 dp * @param config 参数 ( 以 iPhone6 为基准, 如果以其他尺寸为基准的话, 请修改下面的 750 和 1334 为对应尺寸即可.) */ public init(config?: any); /** * 设置字体的 size (单位 px) * * @param size 传入设计稿上的 px * @returns {Number} 返回实际 sp */ public setSpText(size: number): number; /** * 屏幕适配,缩放size * * @param size * @returns {Number} */ public scaleSize(size: number): number; /** * 判断是否为iPhoneX * * @returns {boolean} */ public isiPhoneX(): boolean; /** * 根据是否是 iPhoneX 返回不同的样式 * * @param iPhoneXStyle * @param iosStyle * @param androidStyle * @returns {*} */ public ifiPhoneX(iPhoneXStyle?: any, iosStyle?: any, androidStyle?: any): any; } export declare const sa: ScreenAdapter; export declare class EnhanceStyleSheet { public build(config: any): void; public value<T>(key: string): T; public create<T>(styles: any): T; } export declare const EStyleSheet: EnhanceStyleSheet;