UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

110 lines (109 loc) • 5.39 kB
import { Position } from '../view-interfaces'; import type { View } from '..'; import { CoreTypes } from '../../../../core-types'; export * from './view-helper-common'; export declare const AndroidHelper = 0; declare class UILayoutViewController extends UIViewController { owner: WeakRef<View>; static initWithOwner(owner: WeakRef<View>): UILayoutViewController; viewDidLoad(): void; viewWillLayoutSubviews(): void; viewDidLayoutSubviews(): void; viewWillAppear(animated: boolean): void; viewDidDisappear(animated: boolean): void; get childViewControllerForStatusBarStyle(): UIViewController; traitCollectionDidChange(previousTraitCollection: UITraitCollection): void; get preferredStatusBarStyle(): UIStatusBarStyle; } declare class UIAdaptivePresentationControllerDelegateImp extends NSObject implements UIAdaptivePresentationControllerDelegate { static ObjCProtocols: { prototype: UIAdaptivePresentationControllerDelegate; }[]; owner: WeakRef<View>; closedCallback: Function; static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIAdaptivePresentationControllerDelegateImp; presentationControllerDidDismiss(presentationController: UIPresentationController): void; } declare class UIPopoverPresentationControllerDelegateImp extends NSObject implements UIPopoverPresentationControllerDelegate { static ObjCProtocols: { prototype: UIPopoverPresentationControllerDelegate; }[]; owner: WeakRef<View>; closedCallback: Function; static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp; popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController): void; } /** * Bars a scroll view's content passes beneath, registered with UIKit so its * scroll edge effect covers them (iOS 26+). A bar may load after the scroll * view, be recreated, or live in another window (a keyboard accessory), so * entries are kept per NativeScript view and registered whenever both native * views exist. */ export declare class ScrollEdgeContainers { private readonly owner; private readonly entries; private readonly onContainerLoaded; private readonly onContainerUnloaded; constructor(owner: { nativeViewProtected: UIScrollView; }); add(view: View, edge: CoreTypes.ScrollEdgeType): void; remove(view: View): void; /** Registers every entry whose native views exist. */ attach(): void; /** Unregisters every entry; they register again on the next attach. */ detach(): void; private release; } export declare class IOSHelper { static traitCollectionColorAppearanceChangedEvent: string; static traitCollectionLayoutDirectionChangedEvent: string; static UILayoutViewController: typeof UILayoutViewController; static UIAdaptivePresentationControllerDelegateImp: typeof UIAdaptivePresentationControllerDelegateImp; static UIPopoverPresentationControllerDelegateImp: typeof UIPopoverPresentationControllerDelegateImp; /** * Styles the scroll edge effect on every edge of a scroll view, or hides * them all for `none`. No-op before iOS 26. */ static setScrollEdgeEffect(scrollView: UIScrollView, effect: CoreTypes.ScrollEdgeEffectType): void; static getParentWithViewController(view: View): View; static isHostedInView(view: View): boolean; static extendUnderContainerSafeArea(nativeView: UIView, frame: CGRect): CGRect; static invalidateStatusBarAppearance(controller?: UIViewController, reason?: string): void; static updateAutoAdjustScrollInsets(controller: UIViewController, owner: View): void; /** * This method simulates the iOS 11+ safeAreaLayoutGuide property and its constraints for older versions. * * @param controller * @param owner */ static updateConstraints(controller: UIViewController, owner: View): void; /** * This method simulates the iOS 11+ safeAreaLayoutGuide property for older versions. * * @param controller */ static initLayoutGuide(controller: UIViewController): UILayoutGuide; static insertNativeSubview(parentNativeView: UIView, childNativeView: UIView, atIndex?: number): void; static layoutView(controller: UIViewController, owner: View): void; static getPositionFromFrame(frame: CGRect): Position; static getFrameFromPosition(position: Position, insets?: Position): CGRect; /** * Returns `true` when an ancestor ScrollView has `iosContentInsetAdjustmentBehavior` * other than `'never'`, meaning iOS applies safe-area insets via `adjustedContentInset`. * `View.getSafeAreaInsets` returns empty insets in that case so nested content * doesn't double-count them. * * Duck-types on the property name to avoid a circular import of ScrollView. * The property defaults to `'never'`, so this returns `false` unless explicitly opted in. */ static hasIOSManagedInsetAncestor(view: View): boolean; static shrinkToSafeArea(view: View, frame: CGRect): CGRect; static expandBeyondSafeArea(view: View, frame: CGRect): CGRect; static getAvailableSpaceFromParent(view: View, frame: CGRect): { safeArea: CGRect; fullscreen: CGRect; inWindow: CGRect; }; }