UNPKG

28.9 kBTypeScriptView Raw
1import { ViewBase } from '../view-base';
2import { Property, InheritedProperty } from '../properties';
3import { EventData } from '../../../data/observable';
4import { Color } from '../../../color';
5import { Animation, AnimationDefinition, AnimationPromise } from '../../animation';
6import { GestureTypes, GesturesObserver } from '../../gestures';
7import { LinearGradient } from '../../styling/linear-gradient';
8import { AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, AccessibilityEventOptions } from '../../../accessibility/accessibility-types';
9import { CoreTypes } from '../../../core-types';
10import { ShadowCSSValues } from '../../styling/css-shadow';
11import { ViewCommon } from './view-common';
12
13export * from './view-common';
14// helpers (these are okay re-exported here)
15export * 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
18export * from '../properties';
19
20export 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 */
36export 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 */
44export 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 */
50export 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 */
71export 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 */
86export 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 */
104export 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 * If `true` the element is an accessibility element and all the children will be treated as a single selectable component.
233 */
234 accessible: boolean;
235
236 /**
237 * Hide the view and its children from the a11y service
238 */
239 accessibilityHidden: boolean;
240
241 /**
242 * The view's unique accessibilityIdentifier.
243 *
244 * This is used for automated testing.
245 */
246 accessibilityIdentifier: string;
247
248 /**
249 * Which role should this view be treated by the a11y service?
250 */
251 accessibilityRole: AccessibilityRole;
252
253 /**
254 * Which state should this view be treated as by the a11y service?
255 */
256 accessibilityState: AccessibilityState;
257
258 /**
259 * Short description of the element, ideally one word.
260 */
261 accessibilityLabel: string;
262
263 /**
264 * Current value of the element in a localized string.
265 */
266 accessibilityValue: string;
267
268 /**
269 * A hint describes the elements behavior. Example: 'Tap change playback speed'
270 */
271 accessibilityHint: string;
272 accessibilityLiveRegion: AccessibilityLiveRegion;
273
274 /**
275 * Sets the language in which to speak the element's label and value.
276 * Accepts language ID tags that follows the "BCP 47" specification.
277 */
278 accessibilityLanguage: string;
279
280 /**
281 * This view starts a media session. Equivalent to trait = startsMedia
282 */
283 accessibilityMediaSession: boolean;
284
285 /**
286 * Defines whether accessibility font scale should affect font size.
287 */
288 iosAccessibilityAdjustsFontSize: boolean;
289
290 /**
291 * Gets or sets the minimum accessibility font scale.
292 */
293 iosAccessibilityMinFontScale: number;
294
295 /**
296 * Gets or sets the maximum accessibility font scale.
297 */
298 iosAccessibilityMaxFontScale: number;
299
300 /**
301 * Internal use only. This is used to limit the number of updates to android.view.View.setContentDescription()
302 */
303 _androidContentDescriptionUpdated?: boolean;
304
305 automationText: string;
306
307 /**
308 * Gets or sets the elevation of the android view.
309 */
310 androidElevation: number;
311
312 /**
313 * Gets or sets the dynamic elevation offset of the android view.
314 */
315 androidDynamicElevationOffset: number;
316
317 /**
318 * Gets or sets the background style property.
319 */
320 background: string;
321
322 /**
323 * Gets or sets the background color of the view.
324 */
325 backgroundColor: string | Color;
326
327 /**
328 * Gets or sets the background image of the view.
329 */
330 backgroundImage: string | LinearGradient;
331
332 /**
333 * Gets or sets the box shadow of the view.
334 */
335 boxShadow: string | ShadowCSSValues;
336
337 /**
338 * Gets or sets the minimum width the view may grow to.
339 */
340 minWidth: CoreTypes.LengthType;
341
342 /**
343 * Gets or sets the minimum height the view may grow to.
344 */
345 minHeight: CoreTypes.LengthType;
346
347 /**
348 * Gets or sets the desired width of the view.
349 */
350 width: CoreTypes.PercentLengthType;
351
352 /**
353 * Gets or sets the desired height of the view.
354 */
355 height: CoreTypes.PercentLengthType;
356
357 /**
358 * Gets or sets margin style property.
359 */
360 margin: string | CoreTypes.PercentLengthType;
361
362 /**
363 * Specifies extra space on the left side of this view.
364 */
365 marginLeft: CoreTypes.PercentLengthType;
366
367 /**
368 * Specifies extra space on the top side of this view.
369 */
370 marginTop: CoreTypes.PercentLengthType;
371
372 /**
373 * Specifies extra space on the right side of this view.
374 */
375 marginRight: CoreTypes.PercentLengthType;
376
377 /**
378 * Specifies extra space on the bottom side of this view.
379 */
380 marginBottom: CoreTypes.PercentLengthType;
381
382 /**
383 * Gets or sets the alignment of this view within its parent along the Horizontal axis.
384 */
385 horizontalAlignment: CoreTypes.HorizontalAlignmentType;
386
387 /**
388 * Gets or sets the alignment of this view within its parent along the Vertical axis.
389 */
390 verticalAlignment: CoreTypes.VerticalAlignmentType;
391
392 /**
393 * Gets or sets the visibility of the view.
394 */
395 visibility: CoreTypes.VisibilityType;
396
397 /**
398 * Gets or sets the opacity style property.
399 */
400 opacity: number;
401
402 /**
403 * Gets or sets the rotate affine transform of the view along the Z axis.
404 */
405 rotate: number;
406
407 /**
408 * Gets or sets the rotate affine transform of the view along the X axis.
409 */
410 rotateX: number;
411
412 /**
413 * Gets or sets the rotate affine transform of the view along the Y axis.
414 */
415 rotateY: number;
416
417 /**
418 * Gets or sets the distance of the camera form the view perspective.
419 * Usually needed when rotating the view over the X or Y axis.
420 */
421 perspective: number;
422
423 /**
424 * Gets or sets the translateX affine transform of the view in device independent pixels.
425 */
426 translateX: CoreTypes.dip;
427
428 /**
429 * Gets or sets the translateY affine transform of the view in device independent pixels.
430 */
431 translateY: CoreTypes.dip;
432
433 /**
434 * Gets or sets the scaleX affine transform of the view.
435 */
436 scaleX: number;
437
438 /**
439 * Gets or sets the scaleY affine transform of the view.
440 */
441 scaleY: number;
442
443 //END Style property shortcuts
444
445 /**
446 * 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.
447 */
448 originX: number;
449
450 /**
451 * 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.
452 */
453 originY: number;
454
455 /**
456 * Gets or sets a value indicating whether the the view is enabled. This affects the appearance of the view.
457 */
458 isEnabled: boolean;
459
460 /**
461 * Gets or sets a value indicating whether the user can interact with the view. This does not affect the appearance of the view.
462 */
463 isUserInteractionEnabled: boolean;
464
465 /**
466 * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: false
467 */
468 iosOverflowSafeArea: boolean;
469
470 /**
471 * Enables or disables the iosOverflowSafeArea property for all children. This property is iOS specific. Default value: true
472 */
473 iosOverflowSafeAreaEnabled: boolean;
474
475 /**
476 * Gets or sets a value indicating whether the the view should totally ignore safe areas computation. This property is iOS specific. Default value: false
477 */
478 iosIgnoreSafeArea: boolean;
479
480 /**
481 * Gets is layout is valid. This is a read-only property.
482 */
483 isLayoutValid: boolean;
484
485 /**
486 * Gets the CSS fully qualified type name.
487 * Using this as element type should allow for PascalCase and kebap-case selectors, when fully qualified, to match the element.
488 */
489 cssType: string;
490
491 cssClasses: Set<string>;
492 cssPseudoClasses: Set<string>;
493
494 /**
495 * This is called to find out how big a view should be. The parent supplies constraint information in the width and height parameters.
496 * 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.
497 * @param widthMeasureSpec Horizontal space requirements as imposed by the parent
498 * @param heightMeasureSpec Vertical space requirements as imposed by the parent
499 */
500 public measure(widthMeasureSpec: number, heightMeasureSpec: number): void;
501
502 /**
503 * Assign a size and position to a view and all of its descendants
504 * 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().
505 * 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.
506 * @param l Left position, relative to parent
507 * @param t Top position, relative to parent
508 * @param r Right position, relative to parent
509 * @param b Bottom position, relative to parent
510 */
511 public layout(left: number, top: number, right: number, bottom: number, setFrame?: boolean): void;
512
513 /**
514 * Returns the raw width component.
515 */
516 public getMeasuredWidth(): number;
517
518 /**
519 * Returns the raw height component.
520 */
521 public getMeasuredHeight(): number;
522
523 public getMeasuredState(): number;
524
525 /**
526 * 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.
527 * 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).
528 * @param widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
529 * @param heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
530 */
531 public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
532
533 /**
534 * 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.
535 * @param left Left position, relative to parent
536 * @param top Top position, relative to parent
537 * @param right Right position, relative to parent
538 * @param bottom Bottom position, relative to parent
539 */
540 public onLayout(left: number, top: number, right: number, bottom: number): void;
541
542 /**
543 * 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.
544 * @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.
545 * @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.
546 */
547 public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void;
548
549 /**
550 * Called from onLayout when native view position is about to be changed.
551 * @param left Left position, relative to parent
552 * @param top Top position, relative to parent
553 * @param right Right position, relative to parent
554 * @param bottom Bottom position, relative to parent
555 */
556 public layoutNativeView(left: number, top: number, right: number, bottom: number): void;
557
558 /**
559 * Measure a child by taking into account its margins and a given measureSpecs.
560 * @param parent This parameter is not used. You can pass null.
561 * @param child The view to be measured.
562 * @param measuredWidth The measured width that the parent layout specifies for this view.
563 * @param measuredHeight The measured height that the parent layout specifies for this view.
564 */
565 public static measureChild(parent: View, child: View, widthMeasureSpec: number, heightMeasureSpec: number): { measuredWidth: number; measuredHeight: number };
566
567 /**
568 * Layout a child by taking into account its margins, horizontal and vertical alignments and a given bounds.
569 * @param parent This parameter is not used. You can pass null.
570 * @param left Left position, relative to parent
571 * @param top Top position, relative to parent
572 * @param right Right position, relative to parent
573 * @param bottom Bottom position, relative to parent
574 */
575 public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void;
576
577 /**
578 * Utility to reconcile a desired size and state, with constraints imposed
579 * by a MeasureSpec. Will take the desired size, unless a different size
580 * is imposed by the constraints. The returned value is a compound integer,
581 * with the resolved size in the MEASURED_SIZE_MASK bits and
582 * optionally the bit MEASURED_STATE_TOO_SMALL set if the resulting
583 * size is smaller than the size the view wants to be.
584 */
585 public static resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number;
586
587 public static combineMeasuredStates(curState: number, newState): number;
588
589 /**
590 * Tries to focus the view.
591 * Returns a value indicating whether this view or one of its descendants actually took focus.
592 */
593 public focus(): boolean;
594
595 public getGestureObservers(type: GestureTypes): Array<GesturesObserver>;
596
597 /**
598 * Removes listener(s) for the specified event name.
599 * @param eventNames Comma delimited names of the events or gesture types the specified listener is associated with.
600 * @param callback An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.
601 * @param thisArg An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.
602 */
603 off(eventNames: string | GestureTypes, callback?: (args: EventData) => void, thisArg?: any);
604
605 /**
606 * A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
607 * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change") or you can use gesture types.
608 * @param callback - Callback function which will be executed when event is raised.
609 * @param thisArg - An optional parameter which will be used as `this` context for callback execution.
610 */
611 on(eventNames: string | GestureTypes, callback: (args: EventData) => void, thisArg?: any);
612
613 /**
614 * Raised when a loaded event occurs.
615 */
616 on(event: 'loaded', callback: (args: EventData) => void, thisArg?: any);
617
618 /**
619 * Raised when an unloaded event occurs.
620 */
621 on(event: 'unloaded', callback: (args: EventData) => void, thisArg?: any);
622
623 /**
624 * Raised when a back button is pressed.
625 * This event is raised only for android.
626 */
627 on(event: 'androidBackPressed', callback: (args: EventData) => void, thisArg?: any);
628
629 /**
630 * Raised before the view is shown as a modal dialog.
631 */
632 on(event: 'showingModally', callback: (args: ShownModallyData) => void, thisArg?: any): void;
633
634 /**
635 * Raised after the view is shown as a modal dialog.
636 */
637 on(event: 'shownModally', callback: (args: ShownModallyData) => void, thisArg?: any);
638
639 /**
640 * Returns the current modal view that this page is showing (is parent of), if any.
641 */
642 modal: View;
643
644 /**
645 * Animates one or more properties of the view based on the supplied options.
646 */
647 public animate(options: AnimationDefinition): AnimationPromise;
648
649 /**
650 * Creates an Animation object based on the supplied options.
651 */
652 public createAnimation(options: AnimationDefinition): Animation;
653
654 /**
655 * Returns the iOS safe area insets of this view.
656 */
657 public getSafeAreaInsets(): { left; top; right; bottom };
658
659 /**
660 * Returns the location of this view in the window coordinate system.
661 */
662 public getLocationInWindow(): Point;
663
664 /**
665 * Returns the location of this view in the screen coordinate system.
666 */
667 public getLocationOnScreen(): Point;
668
669 /**
670 * Returns the location of this view in the otherView's coordinate system.
671 */
672 public getLocationRelativeTo(otherView: View): Point;
673
674 /**
675 * Returns the actual size of the view in device-independent pixels.
676 */
677 public getActualSize(): Size;
678
679 /**
680 * Derived classes can override this method to handle Android back button press.
681 */
682 onBackPressed(): boolean;
683
684 /**
685 * @private
686 * A valid css string which will be applied for all nested UI components (based on css rules).
687 */
688 css: string;
689
690 /**
691 * @private
692 * Adds a new values to current css.
693 * @param cssString - A valid css which will be added to current css.
694 */
695 addCss(cssString: string): void;
696
697 /**
698 * @private
699 * Adds the content of the file to the current css.
700 * @param cssFileName - A valid file name (from the application root) which contains a valid css.
701 */
702 addCssFile(cssFileName: string): void;
703
704 /**
705 * @private
706 * Changes the current css to the content of the file.
707 * @param cssFileName - A valid file name (from the application root) which contains a valid css.
708 */
709 changeCssFile(cssFileName: string): void;
710
711 // Lifecycle events
712 _getNativeViewsCount(): number;
713
714 /**
715 * Internal method:
716 * Closes all modal views. Should be used by plugins like `nativescript-angular` which implement their own `modal views` service.
717 */
718 _closeAllModalViewsInternal(): boolean;
719
720 /**
721 * Internal method:
722 * Gets all modal views of the current view.
723 */
724 _getRootModalViews(): Array<ViewBase>;
725
726 _eachLayoutView(callback: (View) => void): void;
727
728 /**
729 * iOS Only Internal method used to update various view details like background rerendering, border, etc.
730 */
731 _onSizeChanged?(): void;
732
733 /**
734 * Android only check if gesture observers are attached
735 */
736 hasGestureObservers?(): boolean;
737
738 /**
739 * Android only to set the touch listener
740 */
741 setOnTouchListener?(): void;
742
743 /**
744 * Iterates over children of type View.
745 * @param callback Called for each child of type View. Iteration stops if this method returns falsy value.
746 */
747 public eachChildView(callback: (view: View) => boolean): void;
748
749 /**
750 * Send accessibility event
751 * @params options AccessibilityEventOptions
752 * androidAccessibilityEvent: AndroidAccessibilityEvent;
753 * iosNotificationType: IOSPostAccessibilityNotificationType;
754 * message: string;
755 *
756 * iOS Notes:
757 * type = 'announcement' will announce `args` via VoiceOver. If no args element will be announced instead.
758 * type = 'layout' used when the layout of a screen changes.
759 * type = 'screen' large change made to the screen.
760 */
761 public sendAccessibilityEvent(options: Partial<AccessibilityEventOptions>): void;
762
763 /**
764 * Make an announcement to the screen reader.
765 */
766 public accessibilityAnnouncement(msg?: string): void;
767
768 /**
769 * Announce screen changed
770 */
771 public accessibilityScreenChanged(): void;
772
773 //@private
774 /**
775 * @private
776 */
777 _modalParent?: View;
778 /**
779 * @private
780 */
781 isLayoutRequired: boolean;
782 /**
783 * @private
784 */
785 _gestureObservers: any;
786 /**
787 * @private
788 * androidx.fragment.app.FragmentManager
789 */
790 _manager: any;
791 /**
792 * @private
793 */
794 _setNativeClipToBounds(): void;
795 /**
796 * Called by measure method to cache measureSpecs.
797 * @private
798 */
799 _setCurrentMeasureSpecs(widthMeasureSpec: number, heightMeasureSpec: number): boolean;
800 /**
801 * Called by layout method to cache view bounds.
802 * @private
803 */
804 _setCurrentLayoutBounds(left: number, top: number, right: number, bottom: number): { boundsChanged: boolean; sizeChanged: boolean };
805 /**
806 * Return view bounds.
807 * @private
808 */
809 _getCurrentLayoutBounds(): {
810 left: number;
811 top: number;
812 right: number;
813 bottom: number;
814 };
815 /**
816 * @private
817 */
818 _goToVisualState(state: string);
819 /**
820 * @private
821 */
822 _setNativeViewFrame(nativeView: any, frame: any): void;
823 // _onStylePropertyChanged(property: dependencyObservable.Property): void;
824 /**
825 * @private
826 */
827 _updateEffectiveLayoutValues(parentWidthMeasureSize: number, parentWidthMeasureMode: number, parentHeightMeasureSize: number, parentHeightMeasureMode: number): void;
828 /**
829 * @private
830 */
831 _currentWidthMeasureSpec: number;
832 /**
833 * @private
834 */
835 _currentHeightMeasureSpec: number;
836 /**
837 * @private
838 */
839 _setMinWidthNative(value: CoreTypes.LengthType): void;
840 /**
841 * @private
842 */
843 _setMinHeightNative(value: CoreTypes.LengthType): void;
844 /**
845 * @private
846 */
847 _redrawNativeBackground(value: any): void;
848 /**
849 * @private
850 * method called on Android to apply the background. This allows custom handling
851 */
852 _applyBackground(background: Background, isBorderDrawable: boolean, onlyColor: boolean, backgroundDrawable: any);
853
854 /**
855 * @private
856 */
857 _removeAnimation(animation: Animation): boolean;
858 /**
859 * @private
860 */
861 _onLivesync(context?: { type: string; path: string }): boolean;
862 /**
863 * @private
864 */
865 _getFragmentManager(): any; /* androidx.fragment.app.FragmentManager */
866 _handleLivesync(context?: { type: string; path: string }): boolean;
867
868 /**
869 * Updates styleScope or create new styleScope.
870 * @param cssFileName
871 * @param cssString
872 * @param css
873 */
874 _updateStyleScope(cssFileName?: string, cssString?: string, css?: string): void;
875
876 /**
877 * Called in android when native view is attached to window.
878 */
879 _onAttachedToWindow(): void;
880
881 /**
882 * Called in android when native view is dettached from window.
883 */
884 _onDetachedFromWindow(): void;
885
886 /**
887 * Checks whether the current view has specific view for an ancestor.
888 */
889 _hasAncestorView(ancestorView: View): boolean;
890 //@endprivate
891
892 /**
893 * __Obsolete:__ There is a new property system that does not rely on _getValue.
894 */
895 _getValue(property: any): never;
896
897 /**
898 * __Obsolete:__ There is a new property system that does not rely on _setValue.
899 */
900 _setValue(property: any, value: any): never;
901}
902
903/**
904 * Base class for all UI components that are containers.
905 */
906export class ContainerView extends View {
907 /**
908 * Instruct container view to expand beyond the safe area. This property is iOS specific. Default value: true
909 */
910 public iosOverflowSafeArea: boolean;
911}
912
913/**
914 * Base class for all UI components that implement custom layouts.
915 */
916export class CustomLayoutView extends ContainerView {
917 //@private
918 /**
919 * @private
920 */
921 _updateNativeLayoutParams(child: View): void;
922 /**
923 * @private
924 */
925 _setChildMinWidthNative(child: View, value: CoreTypes.LengthType): void;
926 /**
927 * @private
928 */
929 _setChildMinHeightNative(child: View, value: CoreTypes.LengthType): void;
930 //@endprivate
931}
932
933/**
934 * Defines an interface for a View factory function.
935 * Commonly used to specify the visualization of data objects.
936 */
937export interface Template {
938 /**
939 * Call signature of the factory function.
940 * Returns a new View instance.
941 */
942 (): View;
943}
944
945/**
946 * Defines an interface for Template with a key.
947 */
948export interface KeyedTemplate {
949 /**
950 * The unique key of the template.
951 */
952 key: string;
953
954 /**
955 * The function that creates the view.
956 */
957 createView: Template;
958}
959
960/**
961 * Defines an interface for adding arrays declared in xml.
962 */
963export interface AddArrayFromBuilder {
964 /**
965 * A function that is called when an array declaration is found in xml.
966 * @param name - Name of the array.
967 * @param value - The actual value of the array.
968 */
969 _addArrayFromBuilder(name: string, value: Array<any>): void;
970}
971
972/**
973 * Defines an interface for adding a child element declared in xml.
974 */
975export interface AddChildFromBuilder {
976 /**
977 * Called for every child element declared in xml.
978 * This method will add a child element (value) to current element.
979 * @param name - Name of the element.
980 * @param value - Value of the element.
981 */
982 _addChildFromBuilder(name: string, value: any): void;
983}
984
985export const originXProperty: Property<View, number>;
986export const originYProperty: Property<View, number>;
987export const isEnabledProperty: Property<View, boolean>;
988export const isUserInteractionEnabledProperty: Property<View, boolean>;
989export const iosOverflowSafeAreaProperty: Property<View, boolean>;
990export const iosOverflowSafeAreaEnabledProperty: InheritedProperty<View, boolean>;