UNPKG

3.48 kBTypeScriptView Raw
1import { View } from '..';
2
3export class ViewHelper {
4 /**
5 * Measure a child by taking into account its margins and a given measureSpecs.
6 * @param parent This parameter is not used. You can pass null.
7 * @param child The view to be measured.
8 * @param measuredWidth The measured width that the parent layout specifies for this view.
9 * @param measuredHeight The measured height that the parent layout specifies for this view.
10 */
11 public static measureChild(parent: View, child: View, widthMeasureSpec: number, heightMeasureSpec: number): { measuredWidth: number; measuredHeight: number };
12
13 /**
14 * Layout a child by taking into account its margins, horizontal and vertical alignments and a given bounds.
15 * @param parent This parameter is not used. You can pass null.
16 * @param left Left position, relative to parent
17 * @param top Top position, relative to parent
18 * @param right Right position, relative to parent
19 * @param bottom Bottom position, relative to parent
20 */
21 public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void;
22
23 /**
24 * Utility to reconcile a desired size and state, with constraints imposed
25 * by a MeasureSpec. Will take the desired size, unless a different size
26 * is imposed by the constraints. The returned value is a compound integer,
27 * with the resolved size in the MEASURED_SIZE_MASK bits and
28 * optionally the bit MEASURED_STATE_TOO_SMALL set if the resulting
29 * size is smaller than the size the view wants to be.
30 */
31 public static resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number;
32
33 public static combineMeasuredStates(curState: number, newState): number;
34}
35
36/**
37 * Various iOS view helper methods
38 */
39export namespace IOSHelper {
40 /**
41 * String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
42 */
43 export const traitCollectionColorAppearanceChangedEvent: string;
44
45 /**
46 * Returns a view with viewController or undefined if no such found along the view's parent chain.
47 * @param view The view form which to start the search.
48 */
49 export function getParentWithViewController(view: View): View;
50 export function updateAutoAdjustScrollInsets(controller: any /* UIViewController */, owner: View): void;
51 export function updateConstraints(controller: any /* UIViewController */, owner: View): void;
52 export function layoutView(controller: any /* UIViewController */, owner: View): void;
53 export function getPositionFromFrame(frame: any /* CGRect */): { left; top; right; bottom };
54 export function getFrameFromPosition(position: { left; top; right; bottom }, insets?: { left; top; right; bottom }): any; /* CGRect */
55 export function shrinkToSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
56 export function expandBeyondSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
57 export class UILayoutViewController {
58 public static initWithOwner(owner: WeakRef<View>): UILayoutViewController;
59 }
60 export class UIAdaptivePresentationControllerDelegateImp {
61 public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIAdaptivePresentationControllerDelegateImp;
62 }
63 export class UIPopoverPresentationControllerDelegateImp {
64 public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp;
65 }
66}