UNPKG

6.27 kBTypeScriptView Raw
1import { PageBase } from './page-common';
2import { CssProperty, Property } from '../core/properties';
3import { Style } from '../styling/style';
4import { EventData } from '../../data/observable';
5import { Frame } from '../frame';
6import { ActionBar } from '../action-bar';
7import { KeyframeAnimationInfo } from '../animation/keyframe-animation';
8import { Color } from '../../color';
9
10export * from './page-common';
11
12/**
13 * Defines the data for the page navigation events.
14 */
15export interface NavigatedData extends EventData {
16 /**
17 * The navigation context (optional, may be undefined) passed to the page navigation events method.
18 */
19 context: any;
20
21 /**
22 * Represents if a navigation is forward or backward.
23 */
24 isBackNavigation: boolean;
25}
26
27/**
28 * Represents a logical unit for navigation (inside Frame).
29 */
30export declare class Page extends PageBase {
31 /**
32 * String value used when hooking to navigatingTo event.
33 */
34 public static readonly navigatingToEvent = 'navigatingTo';
35
36 /**
37 * String value used when hooking to navigatedTo event.
38 */
39 public static readonly navigatedToEvent = 'navigatedTo';
40
41 /**
42 * String value used when hooking to navigatingFrom event.
43 */
44 public static readonly navigatingFromEvent = 'navigatingFrom';
45
46 /**
47 * String value used when hooking to navigatedFrom event.
48 */
49 public static readonly navigatedFromEvent = 'navigatedFrom';
50
51 /**
52 * Gets or sets whether page background spans under status bar.
53 */
54 public backgroundSpanUnderStatusBar: boolean;
55
56 /**
57 * Gets or sets the style of the status bar.
58 */
59 // @ts-ignore
60 public statusBarStyle: 'light' | 'dark';
61
62 /**
63 * Gets or sets the color of the status bar in Android.
64 */
65 // @ts-ignore
66 public androidStatusBarBackground: Color;
67
68 /**
69 * Used to hide the Navigation Bar in iOS and the Action Bar in Android.
70 */
71 // @ts-ignore
72 public actionBarHidden: boolean;
73
74 /**
75 * Used to control if swipe back navigation in iOS is enabled. This property is iOS specific. Default value: true
76 */
77 public enableSwipeBackNavigation: boolean;
78
79 /**
80 * Returns a CSS keyframe animation with the specified name, if it exists.
81 */
82 public getKeyframeAnimationWithName(animationName: string): KeyframeAnimationInfo;
83
84 /**
85 * A property that is used to pass a data from another page (while navigate to).
86 */
87 // @ts-ignore
88 public navigationContext: any;
89
90 /**
91 * Gets the Frame object controlling this instance.
92 */
93 // @ts-ignore
94 public frame: Frame;
95
96 /**
97 * Gets the ActionBar for this page.
98 */
99 // @ts-ignore
100 public actionBar: ActionBar;
101
102 /**
103 * iOS Only
104 * Perform an action when user performans the "escape" gesture
105 */
106 public onAccessibilityPerformEscape?: () => boolean;
107
108 /**
109 * Should page changed be annnounced to the screen reader.
110 */
111 public accessibilityAnnouncePageEnabled: boolean;
112
113 /**
114 * A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
115 * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
116 * @param callback - Callback function which will be executed when event is raised.
117 * @param thisArg - An optional parameter which will be used as `this` context for callback execution.
118 */
119 public on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void;
120
121 /**
122 * Raised when navigation to the page has started.
123 */
124 public on(event: 'navigatingTo', callback: (args: NavigatedData) => void, thisArg?: any): void;
125
126 /**
127 * Raised when navigation to the page has finished.
128 */
129 public on(event: 'navigatedTo', callback: (args: NavigatedData) => void, thisArg?: any): void;
130
131 /**
132 * Raised when navigation from the page has started.
133 */
134 public on(event: 'navigatingFrom', callback: (args: NavigatedData) => void, thisArg?: any): void;
135
136 /**
137 * Raised when navigation from the page has finished.
138 */
139 public on(event: 'navigatedFrom', callback: (args: NavigatedData) => void, thisArg?: any): void;
140 //@private
141
142 /**
143 * @private
144 */
145 hasActionBar: boolean;
146
147 /**
148 * A method called before navigating to the page.
149 * @private
150 * @param context - The data passed to the page through the NavigationEntry.context property.
151 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
152 * @param bindingContext - An object to become the binding context of the page navigating to. Optional.
153 */
154 public onNavigatingTo(context: any, isBackNavigation: boolean, bindingContext?: any): void;
155
156 /**
157 * A method called after navigated to the page.
158 * @private
159 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
160 */
161 public onNavigatedTo(isBackNavigation: boolean): void;
162
163 /**
164 * A method called before navigating from the page.
165 * @private
166 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
167 */
168 public onNavigatingFrom(isBackNavigation: boolean): void;
169
170 /**
171 * A method called after navigated from the page.
172 * @private
173 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
174 */
175 public onNavigatedFrom(isBackNavigation: boolean): void;
176 //@endprivate
177
178 /**
179 * Announce screen changed
180 */
181 public accessibilityScreenChanged(refocus?: boolean): void;
182}
183
184/**
185 * Dependency property that specify if page background should span under status bar.
186 */
187export const backgroundSpanUnderStatusBarProperty: Property<Page, boolean>;
188
189/**
190 * Dependency property used to hide the Navigation Bar in iOS and the Action Bar in Android.
191 */
192export const actionBarHiddenProperty: Property<Page, boolean>;
193
194/**
195 * Dependency property used to control if swipe back navigation in iOS is enabled.
196 * This property is iOS specific. Default value: true
197 */
198export const enableSwipeBackNavigationProperty: Property<Page, boolean>;
199
200/**
201 * Property backing statusBarStyle.
202 */
203export const statusBarStyleProperty: CssProperty<Style, 'light' | 'dark'>;
204
205/**
206 * Property backing androidStatusBarBackground.
207 */
208export const androidStatusBarBackgroundProperty: CssProperty<Style, Color>;