1 | import { ViewBase } from '../view-base';
|
2 | import { Property, InheritedProperty } from '../properties';
|
3 | import { EventData } from '../../../data/observable';
|
4 | import { Color } from '../../../color';
|
5 | import { Animation, AnimationDefinition, AnimationPromise } from '../../animation';
|
6 | import { GestureTypes, GesturesObserver } from '../../gestures';
|
7 | import { LinearGradient } from '../../styling/linear-gradient';
|
8 | import { AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, AccessibilityEventOptions } from '../../../accessibility/accessibility-types';
|
9 | import { CoreTypes } from '../../../core-types';
|
10 | import { ShadowCSSValues } from '../../styling/css-shadow';
|
11 | import { ViewCommon } from './view-common';
|
12 |
|
13 | export * from './view-common';
|
14 | // helpers (these are okay re-exported here)
|
15 | export * from './view-helper';
|
16 |
|
17 | // This one can eventually be cleaned up but causes issues with a lot of ui-suite plugins in particular if not exported here
|
18 | export * from '../properties';
|
19 |
|
20 | export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator;
|
21 |
|
22 | /**
|
23 | * Specifies the type name for the instances of this View class,
|
24 | * that is used when matching CSS type selectors.
|
25 | *
|
26 | * Usage:
|
27 | * ```
|
28 | * @CSSType("Button")
|
29 | * class Button extends View {
|
30 | * }
|
31 | * ```
|
32 | *
|
33 | * Internally the decorator set `Button.prototype.cssType = "Button"`.
|
34 | * @param type The type name, e. g. "Button", "Label", etc.
|
35 | */
|
36 | export function CSSType(type: string): ClassDecorator;
|
37 |
|
38 | /**
|
39 | *
|
40 | * @param view The view
|
41 | * @param context The ModuleType
|
42 | * @param type Type of the ModuleType to be matched
|
43 | */
|
44 | export function viewMatchesModuleContext(view: View, context: ModuleContext, type: ModuleType[]): boolean;
|
45 |
|
46 | /**
|
47 | * The Point interface describes a two dimensional location.
|
48 | * It has two properties x and y, representing the x and y coordinate of the location.
|
49 | */
|
50 | export interface Point {
|
51 | /**
|
52 | * Represents the x coordinate of the location.
|
53 | */
|
54 | x: number;
|
55 |
|
56 | /**
|
57 | * Represents the y coordinate of the location.
|
58 | */
|
59 | y: number;
|
60 |
|
61 | /**
|
62 | * Represents the z coordinate of the location.
|
63 | */
|
64 | z?: number;
|
65 | }
|
66 |
|
67 | /**
|
68 | * The Size interface describes abstract dimensions in two dimensional space.
|
69 | * It has two properties width and height, representing the width and height values of the size.
|
70 | */
|
71 | export interface Size {
|
72 | /**
|
73 | * Represents the width of the size.
|
74 | */
|
75 | width: number;
|
76 |
|
77 | /**
|
78 | * Represents the height of the size.
|
79 | */
|
80 | height: number;
|
81 | }
|
82 |
|
83 | /**
|
84 | * Defines the data for the shownModally event.
|
85 | */
|
86 | export interface ShownModallyData extends EventData {
|
87 | /**
|
88 | * The context (optional, may be undefined) passed to the view when shown modally.
|
89 | */
|
90 | context?: any;
|
91 |
|
92 | /**
|
93 | * A callback to call when you want to close the modally shown view.
|
94 | * Pass in any kind of arguments and you will receive when the callback parameter
|
95 | * of View.showModal is executed.
|
96 | */
|
97 | closeCallback?: Function;
|
98 | }
|
99 |
|
100 | /**
|
101 | * This class is the base class for all UI components.
|
102 | * A View occupies a rectangular area on the screen and is responsible for drawing and layouting of all UI components within.
|
103 | */
|
104 | export abstract class View extends ViewCommon {
|
105 | /**
|
106 | * String value used when hooking to layoutChanged event.
|
107 | */
|
108 | public static layoutChangedEvent: string;
|
109 | /**
|
110 | * String value used when hooking to showingModally event.
|
111 | */
|
112 | public static showingModallyEvent: string;
|
113 |
|
114 | /**
|
115 | * String value used when hooking to shownModally event.
|
116 | */
|
117 | public static shownModallyEvent: string;
|
118 |
|
119 | /**
|
120 | * String value used when hooking to accessibilityBlur event.
|
121 | */
|
122 | public static accessibilityBlurEvent: string;
|
123 |
|
124 | /**
|
125 | * String value used when hooking to accessibilityFocus event.
|
126 | */
|
127 | public static accessibilityFocusEvent: string;
|
128 |
|
129 | /**
|
130 | * String value used when hooking to accessibilityFocusChanged event.
|
131 | */
|
132 | public static accessibilityFocusChangedEvent: string;
|
133 |
|
134 | /**
|
135 | * Gets the android-specific native instance that lies behind this proxy. Will be available if running on an Android platform.
|
136 | */
|
137 | // @ts-ignore
|
138 | public android: any;
|
139 |
|
140 | /**
|
141 | * Gets the ios-specific native instance that lies behind this proxy. Will be available if running on an iOS platform.
|
142 | */
|
143 | // @ts-ignore
|
144 | public ios: any;
|
145 |
|
146 | /**
|
147 | * Gets or sets the binding context of this instance. This object is used as a source for each Binding that does not have a source object specified.
|
148 | */
|
149 | bindingContext: any;
|
150 |
|
151 | /**
|
152 | * Gets or sets the border color of the view.
|
153 | */
|
154 | borderColor: string | Color;
|
155 |
|
156 | /**
|
157 | * Gets or sets the top border color of the view.
|
158 | */
|
159 | borderTopColor: Color;
|
160 |
|
161 | /**
|
162 | * Gets or sets the right border color of the view.
|
163 | */
|
164 | borderRightColor: Color;
|
165 |
|
166 | /**
|
167 | * Gets or sets the bottom border color of the view.
|
168 | */
|
169 | borderBottomColor: Color;
|
170 |
|
171 | /**
|
172 | * Gets or sets the left border color of the view.
|
173 | */
|
174 | borderLeftColor: Color;
|
175 |
|
176 | /**
|
177 | * Gets or sets the border width of the view.
|
178 | */
|
179 | borderWidth: string | CoreTypes.LengthType;
|
180 |
|
181 | /**
|
182 | * Gets or sets the top border width of the view.
|
183 | */
|
184 | borderTopWidth: CoreTypes.LengthType;
|
185 |
|
186 | /**
|
187 | * Gets or sets the right border width of the view.
|
188 | */
|
189 | borderRightWidth: CoreTypes.LengthType;
|
190 |
|
191 | /**
|
192 | * Gets or sets the bottom border width of the view.
|
193 | */
|
194 | borderBottomWidth: CoreTypes.LengthType;
|
195 |
|
196 | /**
|
197 | * Gets or sets the left border width of the view.
|
198 | */
|
199 | borderLeftWidth: CoreTypes.LengthType;
|
200 |
|
201 | /**
|
202 | * Gets or sets the border radius of the view.
|
203 | */
|
204 | borderRadius: string | CoreTypes.LengthType;
|
205 |
|
206 | /**
|
207 | * Gets or sets the top left border radius of the view.
|
208 | */
|
209 | borderTopLeftRadius: CoreTypes.LengthType;
|
210 |
|
211 | /**
|
212 | * Gets or sets the top right border radius of the view.
|
213 | */
|
214 | borderTopRightRadius: CoreTypes.LengthType;
|
215 |
|
216 | /**
|
217 | * Gets or sets the bottom right border radius of the view.
|
218 | */
|
219 | borderBottomRightRadius: CoreTypes.LengthType;
|
220 |
|
221 | /**
|
222 | * Gets or sets the bottom left border radius of the view.
|
223 | */
|
224 | borderBottomLeftRadius: CoreTypes.LengthType;
|
225 |
|
226 | /**
|
227 | * Gets or sets the color of the view.
|
228 | */
|
229 | color: Color;
|
230 |
|
231 | /**
|
232 | * Hide the view and its children from the a11y service
|
233 | */
|
234 | accessibilityHidden: boolean;
|
235 |
|
236 | /**
|
237 | * The view's unique accessibilityIdentifier.
|
238 | *
|
239 | * This is used for automated testing.
|
240 | */
|
241 | accessibilityIdentifier: string;
|
242 |
|
243 | /**
|
244 | * Which role should this view be treated by the a11y service?
|
245 | */
|
246 | accessibilityRole: AccessibilityRole;
|
247 |
|
248 | /**
|
249 | * Which state should this view be treated as by the a11y service?
|
250 | */
|
251 | accessibilityState: AccessibilityState;
|
252 |
|
253 | /**
|
254 | * Short description of the element, ideally one word.
|
255 | */
|
256 | accessibilityLabel: string;
|
257 |
|
258 | /**
|
259 | * Current value of the element in a localized string.
|
260 | */
|
261 | accessibilityValue: string;
|
262 |
|
263 | /**
|
264 | * A hint describes the elements behavior. Example: 'Tap change playback speed'
|
265 | */
|
266 | accessibilityHint: string;
|
267 | accessibilityLiveRegion: AccessibilityLiveRegion;
|
268 |
|
269 | /**
|
270 | * Sets the language in which to speak the element's label and value.
|
271 | * Accepts language ID tags that follows the "BCP 47" specification.
|
272 | */
|
273 | accessibilityLanguage: string;
|
274 |
|
275 | /**
|
276 | * This view starts a media session. Equivalent to trait = startsMedia
|
277 | */
|
278 | accessibilityMediaSession: boolean;
|
279 |
|
280 | /**
|
281 | * Defines whether accessibility font scale should affect font size.
|
282 | */
|
283 | iosAccessibilityAdjustsFontSize: boolean;
|
284 |
|
285 | /**
|
286 | * Gets or sets the minimum accessibility font scale.
|
287 | */
|
288 | iosAccessibilityMinFontScale: number;
|
289 |
|
290 | /**
|
291 | * Gets or sets the maximum accessibility font scale.
|
292 | */
|
293 | iosAccessibilityMaxFontScale: number;
|
294 |
|
295 | /**
|
296 | * Internal use only. This is used to limit the number of updates to android.view.View.setContentDescription()
|
297 | */
|
298 | _androidContentDescriptionUpdated?: boolean;
|
299 |
|
300 | automationText: string;
|
301 |
|
302 | /**
|
303 | * Gets or sets the elevation of the android view.
|
304 | */
|
305 | androidElevation: number;
|
306 |
|
307 | /**
|
308 | * Gets or sets the dynamic elevation offset of the android view.
|
309 | */
|
310 | androidDynamicElevationOffset: number;
|
311 |
|
312 | /**
|
313 | * Gets or sets the background style property.
|
314 | */
|
315 | background: string;
|
316 |
|
317 | /**
|
318 | * Gets or sets the background color of the view.
|
319 | */
|
320 | backgroundColor: string | Color;
|
321 |
|
322 | /**
|
323 | * Gets or sets the background image of the view.
|
324 | */
|
325 | backgroundImage: string | LinearGradient;
|
326 |
|
327 | /**
|
328 | * Gets or sets the box shadow of the view.
|
329 | */
|
330 | boxShadow: string | ShadowCSSValues;
|
331 |
|
332 | /**
|
333 | * Gets or sets the minimum width the view may grow to.
|
334 | */
|
335 | minWidth: CoreTypes.LengthType;
|
336 |
|
337 | /**
|
338 | * Gets or sets the minimum height the view may grow to.
|
339 | */
|
340 | minHeight: CoreTypes.LengthType;
|
341 |
|
342 | /**
|
343 | * Gets or sets the desired width of the view.
|
344 | */
|
345 | width: CoreTypes.PercentLengthType;
|
346 |
|
347 | /**
|
348 | * Gets or sets the desired height of the view.
|
349 | */
|
350 | height: CoreTypes.PercentLengthType;
|
351 |
|
352 | /**
|
353 | * Gets or sets margin style property.
|
354 | */
|
355 | margin: string | CoreTypes.PercentLengthType;
|
356 |
|
357 | /**
|
358 | * Specifies extra space on the left side of this view.
|
359 | */
|
360 | marginLeft: CoreTypes.PercentLengthType;
|
361 |
|
362 | /**
|
363 | * Specifies extra space on the top side of this view.
|
364 | */
|
365 | marginTop: CoreTypes.PercentLengthType;
|
366 |
|
367 | /**
|
368 | * Specifies extra space on the right side of this view.
|
369 | */
|
370 | marginRight: CoreTypes.PercentLengthType;
|
371 |
|
372 | /**
|
373 | * Specifies extra space on the bottom side of this view.
|
374 | */
|
375 | marginBottom: CoreTypes.PercentLengthType;
|
376 |
|
377 | /**
|
378 | * Gets or sets the alignment of this view within its parent along the Horizontal axis.
|
379 | */
|
380 | horizontalAlignment: CoreTypes.HorizontalAlignmentType;
|
381 |
|
382 | /**
|
383 | * Gets or sets the alignment of this view within its parent along the Vertical axis.
|
384 | */
|
385 | verticalAlignment: CoreTypes.VerticalAlignmentType;
|
386 |
|
387 | /**
|
388 | * Gets or sets the visibility of the view.
|
389 | */
|
390 | visibility: CoreTypes.VisibilityType;
|
391 |
|
392 | /**
|
393 | * Gets or sets the opacity style property.
|
394 | */
|
395 | opacity: number;
|
396 |
|
397 | /**
|
398 | * Gets or sets the rotate affine transform of the view along the Z axis.
|
399 | */
|
400 | rotate: number;
|
401 |
|
402 | /**
|
403 | * Gets or sets the rotate affine transform of the view along the X axis.
|
404 | */
|
405 | rotateX: number;
|
406 |
|
407 | /**
|
408 | * Gets or sets the rotate affine transform of the view along the Y axis.
|
409 | */
|
410 | rotateY: number;
|
411 |
|
412 | /**
|
413 | * Gets or sets the distance of the camera form the view perspective.
|
414 | * Usually needed when rotating the view over the X or Y axis.
|
415 | */
|
416 | perspective: number;
|
417 |
|
418 | /**
|
419 | * Gets or sets the translateX affine transform of the view in device independent pixels.
|
420 | */
|
421 | translateX: CoreTypes.dip;
|
422 |
|
423 | /**
|
424 | * Gets or sets the translateY affine transform of the view in device independent pixels.
|
425 | */
|
426 | translateY: CoreTypes.dip;
|
427 |
|
428 | /**
|
429 | * Gets or sets the scaleX affine transform of the view.
|
430 | */
|
431 | scaleX: number;
|
432 |
|
433 | /**
|
434 | * Gets or sets the scaleY affine transform of the view.
|
435 | */
|
436 | scaleY: number;
|
437 |
|
438 | //END Style property shortcuts
|
439 |
|
440 | /**
|
441 | * Gets or sets the X component of the origin point around which the view will be transformed. The default value is 0.5 representing the center of the view.
|
442 | */
|
443 | originX: number;
|
444 |
|
445 | /**
|
446 | * Gets or sets the Y component of the origin point around which the view will be transformed. The default value is 0.5 representing the center of the view.
|
447 | */
|
448 | originY: number;
|
449 |
|
450 | /**
|
451 | * Gets or sets a value indicating whether the the view is enabled. This affects the appearance of the view.
|
452 | */
|
453 | isEnabled: boolean;
|
454 |
|
455 | /**
|
456 | * Gets or sets a value indicating whether the user can interact with the view. This does not affect the appearance of the view.
|
457 | */
|
458 | isUserInteractionEnabled: boolean;
|
459 |
|
460 | /**
|
461 | * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: false
|
462 | */
|
463 | iosOverflowSafeArea: boolean;
|
464 |
|
465 | /**
|
466 | * Enables or disables the iosOverflowSafeArea property for all children. This property is iOS specific. Default value: true
|
467 | */
|
468 | iosOverflowSafeAreaEnabled: boolean;
|
469 |
|
470 | /**
|
471 | * Gets or sets a value indicating whether the the view should totally ignore safe areas computation. This property is iOS specific. Default value: false
|
472 | */
|
473 | iosIgnoreSafeArea: boolean;
|
474 |
|
475 | /**
|
476 | * Gets is layout is valid. This is a read-only property.
|
477 | */
|
478 | isLayoutValid: boolean;
|
479 |
|
480 | /**
|
481 | * Gets the CSS fully qualified type name.
|
482 | * Using this as element type should allow for PascalCase and kebap-case selectors, when fully qualified, to match the element.
|
483 | */
|
484 | cssType: string;
|
485 |
|
486 | cssClasses: Set<string>;
|
487 | cssPseudoClasses: Set<string>;
|
488 |
|
489 | /**
|
490 | * This is called to find out how big a view should be. The parent supplies constraint information in the width and height parameters.
|
491 | * The actual measurement work of a view is performed in onMeasure(int, int), called by this method. Therefore, only onMeasure(int, int) can and must be overridden by subclasses.
|
492 | * @param widthMeasureSpec Horizontal space requirements as imposed by the parent
|
493 | * @param heightMeasureSpec Vertical space requirements as imposed by the parent
|
494 | */
|
495 | public measure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
496 |
|
497 | /**
|
498 | * Assign a size and position to a view and all of its descendants
|
499 | * This is the second phase of the layout mechanism. (The first is measuring). In this phase, each parent calls layout on all of its children to position them. This is typically done using the child measurements that were stored in the measure pass().
|
500 | * Derived classes should not override this method. Derived classes with children should override onLayout. In that method, they should call layout on each of their children.
|
501 | * @param l Left position, relative to parent
|
502 | * @param t Top position, relative to parent
|
503 | * @param r Right position, relative to parent
|
504 | * @param b Bottom position, relative to parent
|
505 | */
|
506 | public layout(left: number, top: number, right: number, bottom: number, setFrame?: boolean): void;
|
507 |
|
508 | /**
|
509 | * Returns the raw width component.
|
510 | */
|
511 | public getMeasuredWidth(): number;
|
512 |
|
513 | /**
|
514 | * Returns the raw height component.
|
515 | */
|
516 | public getMeasuredHeight(): number;
|
517 |
|
518 | public getMeasuredState(): number;
|
519 |
|
520 | /**
|
521 | * Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.
|
522 | * When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an exception, thrown by measure(int, int).
|
523 | * @param widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
|
524 | * @param heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
|
525 | */
|
526 | public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
527 |
|
528 | /**
|
529 | * Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.
|
530 | * @param left Left position, relative to parent
|
531 | * @param top Top position, relative to parent
|
532 | * @param right Right position, relative to parent
|
533 | * @param bottom Bottom position, relative to parent
|
534 | */
|
535 | public onLayout(left: number, top: number, right: number, bottom: number): void;
|
536 |
|
537 | /**
|
538 | * This method must be called by onMeasure(int, int) to store the measured width and measured height. Failing to do so will trigger an exception at measurement time.
|
539 | * @param measuredWidth The measured width of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL.
|
540 | * @param measuredHeight The measured height of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL.
|
541 | */
|
542 | public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void;
|
543 |
|
544 | /**
|
545 | * Called from onLayout when native view position is about to be changed.
|
546 | * @param left Left position, relative to parent
|
547 | * @param top Top position, relative to parent
|
548 | * @param right Right position, relative to parent
|
549 | * @param bottom Bottom position, relative to parent
|
550 | */
|
551 | public layoutNativeView(left: number, top: number, right: number, bottom: number): void;
|
552 |
|
553 | /**
|
554 | * Measure a child by taking into account its margins and a given measureSpecs.
|
555 | * @param parent This parameter is not used. You can pass null.
|
556 | * @param child The view to be measured.
|
557 | * @param measuredWidth The measured width that the parent layout specifies for this view.
|
558 | * @param measuredHeight The measured height that the parent layout specifies for this view.
|
559 | */
|
560 | public static measureChild(parent: View, child: View, widthMeasureSpec: number, heightMeasureSpec: number): { measuredWidth: number; measuredHeight: number };
|
561 |
|
562 | /**
|
563 | * Layout a child by taking into account its margins, horizontal and vertical alignments and a given bounds.
|
564 | * @param parent This parameter is not used. You can pass null.
|
565 | * @param left Left position, relative to parent
|
566 | * @param top Top position, relative to parent
|
567 | * @param right Right position, relative to parent
|
568 | * @param bottom Bottom position, relative to parent
|
569 | */
|
570 | public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void;
|
571 |
|
572 | /**
|
573 | * Utility to reconcile a desired size and state, with constraints imposed
|
574 | * by a MeasureSpec. Will take the desired size, unless a different size
|
575 | * is imposed by the constraints. The returned value is a compound integer,
|
576 | * with the resolved size in the MEASURED_SIZE_MASK bits and
|
577 | * optionally the bit MEASURED_STATE_TOO_SMALL set if the resulting
|
578 | * size is smaller than the size the view wants to be.
|
579 | */
|
580 | public static resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number;
|
581 |
|
582 | public static combineMeasuredStates(curState: number, newState): number;
|
583 |
|
584 | /**
|
585 | * Tries to focus the view.
|
586 | * Returns a value indicating whether this view or one of its descendants actually took focus.
|
587 | */
|
588 | public focus(): boolean;
|
589 |
|
590 | public getGestureObservers(type: GestureTypes): Array<GesturesObserver> | undefined;
|
591 |
|
592 | /**
|
593 | * Removes the listener(s) for the specified event name.
|
594 | *
|
595 | * @param eventName The name of the event.
|
596 | * @param callback An optional specific event listener to remove (if omitted,
|
597 | * all event listeners by this name will be removed).
|
598 | * @param thisArg An optional parameter which, when set, will be used to
|
599 | * refine search of the correct event listener to be removed.
|
600 | */
|
601 | off(eventName: string, callback?: (args: EventData) => void, thisArg?: any);
|
602 |
|
603 | /**
|
604 | * Adds a listener for the specified event name.
|
605 | *
|
606 | * @param eventName The name of the event.
|
607 | * @param callback The event listener to add. Will be called when an event of
|
608 | * the given name is raised.
|
609 | * @param thisArg An optional parameter which, when set, will be bound as the
|
610 | * `this` context when the callback is called. Falsy values will be not be
|
611 | * bound.
|
612 | */
|
613 | on(eventName: string, callback: (args: EventData) => void, thisArg?: any);
|
614 |
|
615 | /**
|
616 | * Raised when a loaded event occurs.
|
617 | */
|
618 | on(event: 'loaded', callback: (args: EventData) => void, thisArg?: any);
|
619 |
|
620 | /**
|
621 | * Raised when an unloaded event occurs.
|
622 | */
|
623 | on(event: 'unloaded', callback: (args: EventData) => void, thisArg?: any);
|
624 |
|
625 | /**
|
626 | * Raised when a back button is pressed.
|
627 | * This event is raised only for android.
|
628 | */
|
629 | on(event: 'androidBackPressed', callback: (args: EventData) => void, thisArg?: any);
|
630 |
|
631 | /**
|
632 | * Raised before the view is shown as a modal dialog.
|
633 | */
|
634 | on(event: 'showingModally', callback: (args: ShownModallyData) => void, thisArg?: any): void;
|
635 |
|
636 | /**
|
637 | * Raised after the view is shown as a modal dialog.
|
638 | */
|
639 | on(event: 'shownModally', callback: (args: ShownModallyData) => void, thisArg?: any);
|
640 |
|
641 | /**
|
642 | * Returns the current modal view that this page is showing (is parent of), if any.
|
643 | */
|
644 | modal: View;
|
645 |
|
646 | /**
|
647 | * Animates one or more properties of the view based on the supplied options.
|
648 | */
|
649 | public animate(options: AnimationDefinition): AnimationPromise;
|
650 |
|
651 | /**
|
652 | * Creates an Animation object based on the supplied options.
|
653 | */
|
654 | public createAnimation(options: AnimationDefinition): Animation;
|
655 |
|
656 | /**
|
657 | * Returns the iOS safe area insets of this view.
|
658 | */
|
659 | public getSafeAreaInsets(): { left; top; right; bottom };
|
660 |
|
661 | /**
|
662 | * Returns the location of this view in the window coordinate system.
|
663 | */
|
664 | public getLocationInWindow(): Point;
|
665 |
|
666 | /**
|
667 | * Returns the location of this view in the screen coordinate system.
|
668 | */
|
669 | public getLocationOnScreen(): Point;
|
670 |
|
671 | /**
|
672 | * Returns the location of this view in the otherView's coordinate system.
|
673 | */
|
674 | public getLocationRelativeTo(otherView: View): Point;
|
675 |
|
676 | /**
|
677 | * Returns the actual size of the view in device-independent pixels.
|
678 | */
|
679 | public getActualSize(): Size;
|
680 |
|
681 | /**
|
682 | * Derived classes can override this method to handle Android back button press.
|
683 | */
|
684 | onBackPressed(): boolean;
|
685 |
|
686 | /**
|
687 | * @private
|
688 | * A valid css string which will be applied for all nested UI components (based on css rules).
|
689 | */
|
690 | css: string;
|
691 |
|
692 | /**
|
693 | * @private
|
694 | * Adds a new values to current css.
|
695 | * @param cssString - A valid css which will be added to current css.
|
696 | */
|
697 | addCss(cssString: string): void;
|
698 |
|
699 | /**
|
700 | * @private
|
701 | * Adds the content of the file to the current css.
|
702 | * @param cssFileName - A valid file name (from the application root) which contains a valid css.
|
703 | */
|
704 | addCssFile(cssFileName: string): void;
|
705 |
|
706 | /**
|
707 | * @private
|
708 | * Changes the current css to the content of the file.
|
709 | * @param cssFileName - A valid file name (from the application root) which contains a valid css.
|
710 | */
|
711 | changeCssFile(cssFileName: string): void;
|
712 |
|
713 | // Lifecycle events
|
714 | _getNativeViewsCount(): number;
|
715 |
|
716 | /**
|
717 | * Internal method:
|
718 | * Closes all modal views. Should be used by plugins like `nativescript-angular` which implement their own `modal views` service.
|
719 | */
|
720 | _closeAllModalViewsInternal(): boolean;
|
721 |
|
722 | /**
|
723 | * Internal method:
|
724 | * Gets all modal views of the current view.
|
725 | */
|
726 | _getRootModalViews(): Array<ViewBase>;
|
727 |
|
728 | _eachLayoutView(callback: (View) => void): void;
|
729 |
|
730 | /**
|
731 | * iOS Only Internal method used to update various view details like background rerendering, border, etc.
|
732 | */
|
733 | _onSizeChanged?(): void;
|
734 |
|
735 | /**
|
736 | * Android only check if gesture observers are attached
|
737 | */
|
738 | hasGestureObservers?(): boolean;
|
739 |
|
740 | /**
|
741 | * Android only to set the touch listener
|
742 | */
|
743 | setOnTouchListener?(): void;
|
744 |
|
745 | /**
|
746 | * Iterates over children of type View.
|
747 | * @param callback Called for each child of type View. Iteration stops if this method returns falsy value.
|
748 | */
|
749 | public eachChildView(callback: (view: View) => boolean): void;
|
750 |
|
751 | /**
|
752 | * Send accessibility event
|
753 | * @params options AccessibilityEventOptions
|
754 | * androidAccessibilityEvent: AndroidAccessibilityEvent;
|
755 | * iosNotificationType: IOSPostAccessibilityNotificationType;
|
756 | * message: string;
|
757 | *
|
758 | * iOS Notes:
|
759 | * type = 'announcement' will announce `args` via VoiceOver. If no args element will be announced instead.
|
760 | * type = 'layout' used when the layout of a screen changes.
|
761 | * type = 'screen' large change made to the screen.
|
762 | */
|
763 | public sendAccessibilityEvent(options: Partial<AccessibilityEventOptions>): void;
|
764 |
|
765 | /**
|
766 | * Make an announcement to the screen reader.
|
767 | */
|
768 | public accessibilityAnnouncement(msg?: string): void;
|
769 |
|
770 | /**
|
771 | * Announce screen changed
|
772 | */
|
773 | public accessibilityScreenChanged(): void;
|
774 |
|
775 | //@private
|
776 | /**
|
777 | * @private
|
778 | */
|
779 | _modalParent?: View;
|
780 | /**
|
781 | * @private
|
782 | */
|
783 | isLayoutRequired: boolean;
|
784 | /**
|
785 | * @private
|
786 | */
|
787 | _gestureObservers: any;
|
788 | /**
|
789 | * @private
|
790 | * androidx.fragment.app.FragmentManager
|
791 | */
|
792 | _manager: any;
|
793 | /**
|
794 | * @private
|
795 | */
|
796 | _setNativeClipToBounds(): void;
|
797 | /**
|
798 | * Called by measure method to cache measureSpecs.
|
799 | * @private
|
800 | */
|
801 | _setCurrentMeasureSpecs(widthMeasureSpec: number, heightMeasureSpec: number): boolean;
|
802 | /**
|
803 | * Called by layout method to cache view bounds.
|
804 | * @private
|
805 | */
|
806 | _setCurrentLayoutBounds(left: number, top: number, right: number, bottom: number): { boundsChanged: boolean; sizeChanged: boolean };
|
807 | /**
|
808 | * Return view bounds.
|
809 | * @private
|
810 | */
|
811 | _getCurrentLayoutBounds(): {
|
812 | left: number;
|
813 | top: number;
|
814 | right: number;
|
815 | bottom: number;
|
816 | };
|
817 | /**
|
818 | * @private
|
819 | */
|
820 | _goToVisualState(state: string);
|
821 | /**
|
822 | * @private
|
823 | */
|
824 | _setNativeViewFrame(nativeView: any, frame: any): void;
|
825 | // _onStylePropertyChanged(property: dependencyObservable.Property): void;
|
826 | /**
|
827 | * @private
|
828 | */
|
829 | _updateEffectiveLayoutValues(parentWidthMeasureSize: number, parentWidthMeasureMode: number, parentHeightMeasureSize: number, parentHeightMeasureMode: number): void;
|
830 | /**
|
831 | * @private
|
832 | */
|
833 | _currentWidthMeasureSpec: number;
|
834 | /**
|
835 | * @private
|
836 | */
|
837 | _currentHeightMeasureSpec: number;
|
838 | /**
|
839 | * @private
|
840 | */
|
841 | _setMinWidthNative(value: CoreTypes.LengthType): void;
|
842 | /**
|
843 | * @private
|
844 | */
|
845 | _setMinHeightNative(value: CoreTypes.LengthType): void;
|
846 | /**
|
847 | * @private
|
848 | */
|
849 | _redrawNativeBackground(value: any): void;
|
850 | /**
|
851 | * @private
|
852 | * method called on Android to apply the background. This allows custom handling
|
853 | */
|
854 | _applyBackground(background: Background, isBorderDrawable: boolean, onlyColor: boolean, backgroundDrawable: any);
|
855 |
|
856 | /**
|
857 | * @private
|
858 | */
|
859 | _removeAnimation(animation: Animation): boolean;
|
860 | /**
|
861 | * @private
|
862 | */
|
863 | _onLivesync(context?: { type: string; path: string }): boolean;
|
864 | /**
|
865 | * @private
|
866 | */
|
867 | _getFragmentManager(): any; /* androidx.fragment.app.FragmentManager */
|
868 | _handleLivesync(context?: { type: string; path: string }): boolean;
|
869 |
|
870 | /**
|
871 | * Updates styleScope or create new styleScope.
|
872 | * @param cssFileName
|
873 | * @param cssString
|
874 | * @param css
|
875 | */
|
876 | _updateStyleScope(cssFileName?: string, cssString?: string, css?: string): void;
|
877 |
|
878 | /**
|
879 | * Called in android when native view is attached to window.
|
880 | */
|
881 | _onAttachedToWindow(): void;
|
882 |
|
883 | /**
|
884 | * Called in android when native view is dettached from window.
|
885 | */
|
886 | _onDetachedFromWindow(): void;
|
887 |
|
888 | /**
|
889 | * Checks whether the current view has specific view for an ancestor.
|
890 | */
|
891 | _hasAncestorView(ancestorView: View): boolean;
|
892 | //@endprivate
|
893 |
|
894 | /**
|
895 | * __Obsolete:__ There is a new property system that does not rely on _getValue.
|
896 | */
|
897 | _getValue(property: any): never;
|
898 |
|
899 | /**
|
900 | * __Obsolete:__ There is a new property system that does not rely on _setValue.
|
901 | */
|
902 | _setValue(property: any, value: any): never;
|
903 | }
|
904 |
|
905 | /**
|
906 | * Base class for all UI components that are containers.
|
907 | */
|
908 | export class ContainerView extends View {
|
909 | /**
|
910 | * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: true
|
911 | */
|
912 | public iosOverflowSafeArea: boolean;
|
913 | }
|
914 |
|
915 | /**
|
916 | * Base class for all UI components that implement custom layouts.
|
917 | */
|
918 | export class CustomLayoutView extends ContainerView {
|
919 | //@private
|
920 | /**
|
921 | * @private
|
922 | */
|
923 | _updateNativeLayoutParams(child: View): void;
|
924 | /**
|
925 | * @private
|
926 | */
|
927 | _setChildMinWidthNative(child: View, value: CoreTypes.LengthType): void;
|
928 | /**
|
929 | * @private
|
930 | */
|
931 | _setChildMinHeightNative(child: View, value: CoreTypes.LengthType): void;
|
932 | //@endprivate
|
933 | }
|
934 |
|
935 | /**
|
936 | * Defines an interface for a View factory function.
|
937 | * Commonly used to specify the visualization of data objects.
|
938 | */
|
939 | export interface Template {
|
940 | /**
|
941 | * Call signature of the factory function.
|
942 | * Returns a new View instance.
|
943 | */
|
944 | (): View;
|
945 | }
|
946 |
|
947 | /**
|
948 | * Defines an interface for Template with a key.
|
949 | */
|
950 | export interface KeyedTemplate {
|
951 | /**
|
952 | * The unique key of the template.
|
953 | */
|
954 | key: string;
|
955 |
|
956 | /**
|
957 | * The function that creates the view.
|
958 | */
|
959 | createView: Template;
|
960 | }
|
961 |
|
962 | /**
|
963 | * Defines an interface for adding arrays declared in xml.
|
964 | */
|
965 | export interface AddArrayFromBuilder {
|
966 | /**
|
967 | * A function that is called when an array declaration is found in xml.
|
968 | * @param name - Name of the array.
|
969 | * @param value - The actual value of the array.
|
970 | */
|
971 | _addArrayFromBuilder(name: string, value: Array<any>): void;
|
972 | }
|
973 |
|
974 | /**
|
975 | * Defines an interface for adding a child element declared in xml.
|
976 | */
|
977 | export interface AddChildFromBuilder {
|
978 | /**
|
979 | * Called for every child element declared in xml.
|
980 | * This method will add a child element (value) to current element.
|
981 | * @param name - Name of the element.
|
982 | * @param value - Value of the element.
|
983 | */
|
984 | _addChildFromBuilder(name: string, value: any): void;
|
985 | }
|
986 |
|
987 | export const originXProperty: Property<View, number>;
|
988 | export const originYProperty: Property<View, number>;
|
989 | export const isEnabledProperty: Property<View, boolean>;
|
990 | export const isUserInteractionEnabledProperty: Property<View, boolean>;
|
991 | export const iosOverflowSafeAreaProperty: Property<View, boolean>;
|
992 | export const iosOverflowSafeAreaEnabledProperty: InheritedProperty<View, boolean>;
|