UNPKG

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