UNPKG

6.18 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 * Adds a listener for the specified event name.
115 *
116 * @param eventName The name of the event.
117 * @param callback The event listener to add. Will be called when an event of
118 * the given name is raised.
119 * @param thisArg An optional parameter which, when set, will be bound as the
120 * `this` context when the callback is called. Falsy values will be not be
121 * bound.
122 */
123 public on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
124
125 /**
126 * Raised when navigation to the page has started.
127 */
128 public on(event: 'navigatingTo', callback: (args: NavigatedData) => void, thisArg?: any): void;
129
130 /**
131 * Raised when navigation to the page has finished.
132 */
133 public on(event: 'navigatedTo', callback: (args: NavigatedData) => void, thisArg?: any): void;
134
135 /**
136 * Raised when navigation from the page has started.
137 */
138 public on(event: 'navigatingFrom', callback: (args: NavigatedData) => void, thisArg?: any): void;
139
140 /**
141 * Raised when navigation from the page has finished.
142 */
143 public on(event: 'navigatedFrom', callback: (args: NavigatedData) => void, thisArg?: any): void;
144 //@private
145
146 /**
147 * @private
148 */
149 hasActionBar: boolean;
150
151 /**
152 * A method called before navigating to the page.
153 * @private
154 * @param context - The data passed to the page through the NavigationEntry.context property.
155 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
156 * @param bindingContext - An object to become the binding context of the page navigating to. Optional.
157 */
158 public onNavigatingTo(context: any, isBackNavigation: boolean, bindingContext?: any): void;
159
160 /**
161 * A method called after navigated to the page.
162 * @private
163 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
164 */
165 public onNavigatedTo(isBackNavigation: boolean): void;
166
167 /**
168 * A method called before navigating from the page.
169 * @private
170 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
171 */
172 public onNavigatingFrom(isBackNavigation: boolean): void;
173
174 /**
175 * A method called after navigated from the page.
176 * @private
177 * @param isBackNavigation - True if the Page is being navigated from using the Frame.goBack() method, false otherwise.
178 */
179 public onNavigatedFrom(isBackNavigation: boolean): void;
180 //@endprivate
181
182 /**
183 * Announce screen changed
184 */
185 public accessibilityScreenChanged(refocus?: boolean): void;
186}
187
188/**
189 * Dependency property that specify if page background should span under status bar.
190 */
191export const backgroundSpanUnderStatusBarProperty: Property<Page, boolean>;
192
193/**
194 * Dependency property used to hide the Navigation Bar in iOS and the Action Bar in Android.
195 */
196export const actionBarHiddenProperty: Property<Page, boolean>;
197
198/**
199 * Dependency property used to control if swipe back navigation in iOS is enabled.
200 * This property is iOS specific. Default value: true
201 */
202export const enableSwipeBackNavigationProperty: Property<Page, boolean>;
203
204/**
205 * Property backing statusBarStyle.
206 */
207export const statusBarStyleProperty: CssProperty<Style, 'light' | 'dark'>;
208
209/**
210 * Property backing androidStatusBarBackground.
211 */
212export const androidStatusBarBackgroundProperty: CssProperty<Style, Color>;