UNPKG

4.12 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 Android view helper methods
38 */
39export namespace AndroidHelper {
40 export function getDrawableColor(drawable: any /* android.graphics.drawable.Drawable */): Color;
41 export function setDrawableColor(color: number, drawable: any /* android.graphics.drawable.Drawable */, blendMode?: any /* androidx.core.graphics.BlendModeCompat */): void;
42 export function clearDrawableColor(drawable: any /* android.graphics.drawable.Drawable */): void;
43 export function getCopyOrDrawable(drawable: any /* android.graphics.drawable.Drawable */, resources?: any /* android.content.res.Resources */): any; /* android.graphics.drawable.Drawable */
44}
45
46/**
47 * Various iOS view helper methods
48 */
49export namespace IOSHelper {
50 /**
51 * String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
52 */
53 export const traitCollectionColorAppearanceChangedEvent: string;
54
55 /**
56 * Returns a view with viewController or undefined if no such found along the view's parent chain.
57 * @param view The view form which to start the search.
58 */
59 export function getParentWithViewController(view: View): View;
60 export function updateAutoAdjustScrollInsets(controller: any /* UIViewController */, owner: View): void;
61 export function updateConstraints(controller: any /* UIViewController */, owner: View): void;
62 export function layoutView(controller: any /* UIViewController */, owner: View): void;
63 export function getPositionFromFrame(frame: any /* CGRect */): { left; top; right; bottom };
64 export function getFrameFromPosition(position: { left; top; right; bottom }, insets?: { left; top; right; bottom }): any; /* CGRect */
65 export function shrinkToSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
66 export function expandBeyondSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
67 export class UILayoutViewController {
68 public static initWithOwner(owner: WeakRef<View>): UILayoutViewController;
69 }
70 export class UIAdaptivePresentationControllerDelegateImp {
71 public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIAdaptivePresentationControllerDelegateImp;
72 }
73 export class UIPopoverPresentationControllerDelegateImp {
74 public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp;
75 }
76}