Since

0.1

View class represents a rectangular area on the screen and it is responsible for event handling. View is the base of all UI classes.

Example

import View from '@smartface/native/ui/view';
import Color from '@smartface/native/ui/color';
var myView = new View();
myView.width = 300;
myView.height = 500;
myView.top = 50;
myView.left = 50;
myView.backgroundColor = Color.RED;

Type Parameters

Hierarchy

Implemented by

Properties

nativeObject: any
text: string

Gets/sets text of SearchView.

Property

Android

Ios

Since

0.1

hint: string

Gets/sets hint text of SearchView.

Property

Android

Ios

Since

0.1

cursorColor?: IColor

Gets/sets cursor color of searchview.

Property

Ios

Android

Since

3.2.1

textColor: IColor

Gets/sets text color of SearchView.

Property

Android

Ios

Since

0.1

iconImage: IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

Gets/sets search icon image of SearchView.

Property

Android

Ios

Since

0.1

Deprecated

3.2.2 Use UI.SearchView#searchIcon instead.

searchIcon: IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

Gets/sets search icon image of SearchView.

Property

Android

Ios

Since

3.2.2

borderWidth: number

Sets/gets border thickness of bounded view. Accepts unsigned numbers, 0 means no border. When the searchview is added to header bar, the border width of the search view will be 0 on ios.

Property

= 1]

Android

Ios

Since

0.1

font: null | IFont

Gets/sets the font of the SearchView.

Property

= null]

Android

Ios

Since

0.1

textAlignment: TextAlignment

Gets/sets text alignment of the SearchView.

Property

= UI.TextAlignment.MIDLEFT]

Android

Ios

Since

0.1

hintTextColor: IColor

Gets/sets the color of the hint text.

Property

= UI.Color.LIGHTGRAY]

Ios

Android

Since

0.1

textFieldBackgroundColor: IColor

Gets/sets the color of the textFieldBackgroundColor.

Property

Ios

Android

Since

3.0.2

transitionId: string

Gets/sets the transitionId to be used for transitionViews. See transitionViews for more information

Property

Android

Ios

Since

0.1

accessible: boolean

Gets/sets whether the view is an accessibility element that an assistive app can access.

Property

Android

Ios

Member

UI.View

Since

4.3.2

accessibilityLabel: string

A content description briefly describes the view. VoiceOver will read this string when a user selects the associated element.

Property

Android

Ios

Member

UI.View

Since

4.3.2

alpha: number

Defines the opacity of a view. The value of this property is a float number between 0.0 and 1.0. 0 represents view is completely transparent and 1 represents view is completely opaque.

Property

= 1]

Android

Ios

Member

UI.View

Since

0.1

backgroundColor: ViewState<IColor>

Gets/sets background color of a view. It allows setting background color with UI.Color instance.

Property

= UI.Color.WHITE]

Android

Ios

Member

UI.View

Since

0.1

borderColor: IColor

Sets/gets border color of bounded view.

Property

= UI.Color.BLACK]

Android

Ios

Since

0.1

borderRadius: number

Sets/gets corner radius of a view. BorderRadius maximum value must be half of the shortest edge.

Property

= 0]

Android

Ios

Since

0.1

borderTopLeftRadius: number

Sets/gets top-left corner radius of a view.

Property

= 0]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderTopLeftRadius is available on Android.

borderTopRightRadius: number

Sets/gets top-right corner radius of a view.

Property

= 0]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderTopRightRadius is available on Android.

borderTopStartRadius: number

Sets/gets top-start corner radius of a view.

Property

= -1]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderTopStartRadius is available on Android.

borderTopEndRadius: number

Sets/gets top-end corner radius of a view.

Property

= -1]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderTopEndRadius is available on Android.

borderBottomLeftRadius: number

Sets/gets bottom-left corner radius of a view.

Property

= 0]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderBottomLeftRadius is available on Android.

borderBottomRightRadius: number

Sets/gets bottom-right corner radius of a view.

Property

= 0]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderBottomRightRadius is available on Android.

borderBottomStartRadius: number

Sets/gets bottom-start corner radius of a view.

Property

= -1]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderBottomStartRadius is available on Android.

borderBottomEndRadius: number

Sets/gets bottom-end corner radius of a view.

Property

= -1]

Android

Ios

Since

5.0.3

Deprecated

since 5.1.1 Use the borderRadiusEdges property instead. Also android.borderBottomEndRadius is available on Android.

id: number

Gets/sets id of a view. It should be unique number for each object inside page. Id will be generated unique by default.

Property

Android

Ios

Member

UI.View

Since

0.1

testId: string

Gets/sets test id for view. resource-id for android; accessibilityIdentifier for iOS.

Property

Android

Ios

Member

UI.View

Since

4.3.2

visible: boolean

Gets/sets visibility of view. It is set to true as default.

Property

= true]

Android

Ios

Member

UI.View

Since

0.1

rotation: number

Gets/sets the degrees that the view is rotated around the pivot point.

Property

= 0]

Android

Ios

Member

UI.View

Since

1.1.10

rotationX: number

Gets/sets the degrees that the view is rotated around the horizontal axis through the pivot point. RotationX works different for iOS and Android. Android gives perpective to the view but iOS doesn't. This will cause difference on user interface.

Property

= 0]

Android

Ios

Member

UI.View

Since

1.1.10

rotationY: number

Gets/sets the degrees that the view is rotated around the vertical axis through the pivot point. RotationY works different for iOS and Android. Android gives perpective to the view but iOS doesn't. This will cause difference on user interface.

Property

= 0]

Android

Ios

Member

UI.View

Since

1.1.10

touchEnabled: boolean

Enables/disables touches to view. When set to false events related to touches won't fire. It is set to true as default.

Property

= true]

Android

Ios

Member

UI.View

Since

0.1

left: number

Gets/sets left position of a view relative to its parent.

Property

= 0]

Android

Ios

Since

0.1

top: number

Gets/sets top position of a view relative to its parent.

Property

= 0]

Android

Ios

Since

0.1

right: number

Gets/sets right position of a view relative to its parent. This property works only if view's positionType is UI.FlexLayout.PositionType.ABSOLUTE.

Property

= 0]

Android

Ios

Since

0.1

bottom: number

Gets/sets bottom position of a view relative to its parent. This property works only if view's positionType is UI.FlexLayout.PositionType.ABSOLUTE.

Property

= 0]

Android

Ios

Since

0.1

height: number

Gets/sets height of a view.

Property

= 0]

Android

Ios

Since

0.1

width: number

Gets/sets width of a view.

Property

= 0]

Android

Ios

Since

0.1

minWidth: number

Gets/sets minimum width of a view.

Property

= 0]

Android

Ios

Since

0.1

minHeight: number

Gets/sets minimum height of a view.

Property

= 0]

Android

Ios

Since

0.1

maxWidth: number

Gets/sets maximum width of a view.

Property

= 0]

Android

Ios

Since

0.1

maxHeight: number

Gets/sets maximum height of a view.

Property

= 0]

Android

Ios

Since

0.1

paddingTop: number

Gets/Sets the padding space on the top side of a view.

Property

= 0]

Android

Ios

Since

0.1

paddingBottom: number

Gets/Sets the padding space on the bottom side of a view.

Property

= 0]

Android

Ios

Since

0.1

paddingLeft: number

Gets/Sets the padding space on the left side of a view.

Property

= 0]

Android

Ios

Since

0.1

paddingRight: number

Gets/Sets the padding space on the right side of a view.

Property

= 0]

Android

Ios

Since

0.1

padding: number

Gets/Sets the padding space on the all sides of a view.

Property

= 0]

Android

Ios

Since

0.1

marginTop: number

Gets/Sets the margin space on the top side of a view.

Property

= 0]

Android

Ios

Since

0.1

marginBottom: number

Gets/Sets the margin space on the bottom side of a view.

Property

= 0]

Android

Ios

Since

0.1

marginLeft: number

Gets/Sets the margin space on the left side of a view.

Property

= 0]

Android

Ios

Since

0.1

marginRight: number

Gets/Sets the margin space required on the right side of a view.

Property

= 0]

Android

Ios

Since

0.1

margin: number

Gets/Sets the margin space required on the all sides of a view.

Property

= 0]

Android

Ios

Since

0.1

positionType: Flex.PositionType

This property specifies the type of positioning method used for a view. To position a view relative to its parent with top,left,right and bottom properties you must set the position type to absolute.

Property

= UI.FlexLayout.PositionType.RELATIVE]

Android

Ios

Since

0.1

flexGrow: number

This property specifies how much a view will grow relative to the other views inside the same UI.FlexLayout FlexLayout.

Property

= 0]

Android

Ios

Since

0.1

aspectRatio: number

AspectRatio keeps the ratio between the width and the height of a view. AspectRatio has higher priority than UI.View#flexGrow flexGrow.

Property

Android

Ios

Since

0.1

flexShrink: number

This property specifies how much a view will shrink relative to the other views inside the same UI.FlexLayout FlexLayout.

Property

= 1]

Android

Ios

Since

0.1

flexBasis: number

This property specifies the initial length of a view in a UI.FlexLayout FlexLayout.

Property

= -1]

Android

Ios

Since

0.1

scale: Point2D

This property sets the amount that the view is scaled in X & Y around the pivot point, as a proportion of the view's unscaled width. A value of 1 means that no scaling is applied. Actually UI.flipVertically flipVertically & UI.flipHorizontally flipHorizontally functions are assignes -1 to X & Y to mirror the view. So while using scale, need to consider these functions.

Property

Android

Ios

Since

4.0.1

alignSelf: Flex.AlignSelf

This property specifies how a child view aligns in the cross-axis. It overrides the UI.FlexLayout.AlignItems FlexLayout.AlignItems property of the parent.

Property

= UI.FlexLayout.AlignSelf.AUTO]

Android

Ios

Since

0.1

masksToBounds: boolean

A Boolean indicating whether sublayers are clipped to the layer’s bounds. Android sublayers still overlaps the border's width and as known issue,if UI.View#maskedBorders maskedBorders is used then sublayer won't be clipped.

Property

= true]

Ios

Android

Since

4.1.4

borderRadiusEdges: BorderRadiusEdges

A Boolean indicating whether sublayers are clipped to the layer’s bounds. Android sublayers still overlaps the border's width and as known issue,if UI.View#borderRadiusEdges borderRadiusEdges is used then sublayer won't be clipped.

Property

= {topLeft: true, topRight: true, bottomLeft: true, bottomRight: true}]

Ios

Android

Since

5.1.1

maskedBorders: Border[]

Specified enums indicates that which corner of View will have radius.

Property

= [View.Border.TOP_LEFT, View.Border.TOP_RIGHT, View.Border.BOTTOM_RIGHT, View.Border.BOTTOM_LEFT]]

Ios

Android

Since

4.1.4

Deprecated

since 5.0.3 Use the borderRadiusEdges properties instead.

shadowColor: IColor

The color of the shadow. UI.View.ios#masksToBounds property must be false for shadow on iOS. On Android, this property only works on Android 9 and above.

Property

= UI.Color.BLACK]

Ios

Android

Since

5.0.3

parent: undefined | IView<"touch" | "touchCancelled" | "touchEnded" | "touchMoved", { [key: string]: any }, MobileOSProps<ViewIOSProps, ViewAndroidProps>>
uniqueId: string
onTouchMoved: ((e: boolean | { isInside: boolean }, point?: Point2D) => boolean)

Type declaration

    • (e: boolean | { isInside: boolean }, point?: Point2D): boolean
    • Deprecated

      This method is deprecated in favor of EventEmitter. You could get more details for the deprecated events from here https://docs.smartface.io/smartface-native-framework/tips-and-tricks/handling-events

      Example

      import View from '@smartface/native/ui/view';
      import FlexLayout from '@smartface/native/ui/flexlayout';
      import Button from '@smartface/native/ui/button';

      this.view1.on(View.Events.TouchMoved, (point) => {
      console.info('view onTouchMoved', point);
      });
      this.flexLayout1.on(FlexLayout.Events.TouchMoved, (point) => {
      console.info('flexLayout onTouchMoved', point);
      });
      this.button1.on(Button.Events.TouchMoved, (point) => {
      console.info('button onTouchMoved', point);
      });

      Parameters

      • e: boolean | { isInside: boolean }
      • Optional point: Point2D

      Returns boolean

getPosition: (() => { left: number; top: number; width: number; height: number })

Type declaration

    • (): { left: number; top: number; width: number; height: number }
    • Returns { left: number; top: number; width: number; height: number }

      • left: number
      • top: number
      • width: number
      • height: number
android: Partial<SearchViewAndroidProps>
ios: Partial<SearchViewIOSProps>

Methods

  • Adds SearchView to UI.Page's headerBar view. When SearchView is added to header bar, UI.SearchView#borderWidth borderWidth of SearchView will be 0 on ios. In Android, searchview always will be iconified. So to make apperance always expanded, combine searchview with UI.HeaderBar#titleLayout titleLayout

    Method

    addToHeaderBar

    Android

    Ios

    Since

    0.1

    Parameters

    • page: IPage<"load" | "dismissComplete" | "dismissStart" | "dismissCancel" | "hide" | "show" | "orientationChange" | "safeAreaPaddingChange", MobileOSProps<PageIOSParams, PageAndroidParams>, any>

    Returns void

  • Removes SearchView from UI.Page's headerBar view.

    Method

    removeFromHeaderBar

    Android

    Ios

    Since

    0.1

    Parameters

    • page: IPage<"load" | "dismissComplete" | "dismissStart" | "dismissCancel" | "hide" | "show" | "orientationChange" | "safeAreaPaddingChange", MobileOSProps<PageIOSParams, PageAndroidParams>, any>

    Returns void

  • This function shows keyboard.

    Method

    showKeyboard

    Android

    Ios

    Since

    0.1

    Deprecated

    1.1.8 Use UI.SearchView#requestFocus instead.

    Returns void

  • This function hides keyboard.

    Method

    hideKeyboard

    Android

    Ios

    Since

    0.1

    Deprecated

    1.1.8 Use UI.SearchView#removeFocus instead.

    Returns void

  • This function gives focus to the SearchView. When the SearchView gained focus, keyboard will appear.

    Method

    requestFocus

    Android

    Ios

    Since

    1.1.8

    Returns void

  • This function removes focus from the SearchView. When the SearchView lost its focus, keyboard will disappear.

    Method

    removeFocus

    Android

    Ios

    Since

    1.1.8

    Returns void

  • Creates an event emitter instance to listen for the actions

    Returns

    Call the function to remove the event

    Parameters

    • eventName: "cancelButtonClicked"
    • callback: (() => void)

      Gets as any arguments as it needs

        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchBegin"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchEnd"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "textChanged"
    • callback: ((searchText: string) => void)
        • (searchText: string): void
        • Parameters

          • searchText: string

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Removes the specified event and invokes the callback after it is removed

    Parameters

    • eventName: "cancelButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchBegin"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchEnd"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "textChanged"
    • callback: ((searchText: string) => void)
        • (searchText: string): void
        • Parameters

          • searchText: string

          Returns void

    Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Triggers the event manually.

    Parameters

    • eventName: "cancelButtonClicked"

    Returns void

  • Parameters

    • eventName: "searchBegin"

    Returns void

  • Parameters

    • eventName: "searchButtonClicked"

    Returns void

  • Parameters

    • eventName: "searchEnd"

    Returns void

  • Parameters

    • eventName: "textChanged"
    • searchText: string

    Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • Rest ...args: any[]

    Returns void

  • Creates an event emitter instance to listen for the actions

    Returns

    Call the function to remove the event

    Parameters

    • eventName: "cancelButtonClicked"
    • callback: (() => void)

      Gets as any arguments as it needs

        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchBegin"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "searchEnd"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "textChanged"
    • callback: ((searchText: string) => void)
        • (searchText: string): void
        • Parameters

          • searchText: string

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

    Parameters

    • eventName: "cancelButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchBegin"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchEnd"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "textChanged"
    • callback: ((searchText: string) => void)
        • (searchText: string): void
        • Parameters

          • searchText: string

          Returns void

    Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Adds a one-time listener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

    Parameters

    • eventName: "cancelButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchBegin"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchButtonClicked"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "searchEnd"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • eventName: "textChanged"
    • callback: ((searchText: string) => void)
        • (searchText: string): void
        • Parameters

          • searchText: string

          Returns void

    Returns void

  • Parameters

    • eventName: "touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "cancelButtonClicked" | "searchBegin" | "searchButtonClicked" | "searchEnd" | "textChanged"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree. It is useful to call this method when you want to change layout parameters on runtime. If this view layout invalidated, call applyLayout from the Page.layout in the iOS and from the view itself in the Android.

    Method

    applyLayout

    Android

    Ios

    Returns void

  • This method put a view to the top of other views in z-direction.

    Method

    bringToFront

    Android

    Ios

    Since

    0.1

    Returns void

  • This method flips the view horizontally.

    Method

    flipHorizontally

    Android

    Ios

    Since

    3.1.3

    Returns void

  • This method flips the view vertically.

    Method

    flipVertically

    Android

    Ios

    Since

    3.1.3

    Returns void

  • This method returns an object that defines view location on screen. Do not use this method for invisible views in UI.ListView ListView and UI.GridView GridView.

    Method

    getScreenLocation

    Returns

    location

    Returns

    location.x

    Returns

    location.y

    Android

    Ios

    Since

    3.2.0

    Returns Point2D

  • Gets the parent view of a view.

    Example

    import FlexLayout from '@smartface/native/ui/flexlayout';
    import Label from '@smartface/native/ui/label';

    var myFlexLayout = new FlexLayout();
    myFlexLayout.id = 5432;

    var myLabel = new Label({
    text: "Smartface Label"
    });
    myFlexLayout.addChild(myLabel);
    var parentId = myLabel.getParent().id; //is equal to 5432.

    Returns

    Parent view of a view, null if not exists.

    Method

    getParent

    Android

    Ios

    Since

    0.1

    Returns null | IViewGroup<"touch" | "touchCancelled" | "touchEnded" | "touchMoved" | "viewAdded" | "viewRemoved", any, MobileOSProps<ViewGroupIOSProps, ViewGroupAndroidProps>>

  • This method marks the view as needs relayout.

    Method

    dirty

    Android

    Ios

    Since

    4.3.6

    Returns void

Events

onSearchBegin: (() => void)

Type declaration

    • (): void
    • This event is called when user focus on the search view by selecting it.

      onSearchBegin

      Deprecated

      Android

      Ios

      Since

      0.1

      Example

      import SearchView from '@smartface/native/ui/searchview';

      const searchView = new SearchView();
      searchView.on(SearchView.Events.SearchBegin, () => {
      console.info('onSearchBegin');
      });

      Returns void

onSearchEnd: (() => void)

Type declaration

    • (): void
    • This event is called when searchview loses focus.

      onSearchEnd

      Deprecated

      Android

      Ios

      Since

      0.1

      Example

      import SearchView from '@smartface/native/ui/searchview';

      const searchView = new SearchView();
      searchView.on(SearchView.Events.SearchEnd, () => {
      console.info('onSearchEnd');
      });

      Returns void

onTextChanged: ((searchText: string) => void)

Type declaration

    • (searchText: string): void
    • This event is called when user changes the search text.

      Android

      Ios

      Deprecated

      onTextChanged

      Since

      0.1

      Example

      import SearchView from '@smartface/native/ui/searchview';

      const searchView = new SearchView();
      searchView.on(SearchView.Events.TextChanged, (params) => {
      console.info('onTextChanged', params);
      });

      Parameters

      • searchText: string

        The current text in the search text view.

      Returns void

onSearchButtonClicked: (() => void)

Type declaration

    • (): void
    • This event is called when user clicks search button on the keyboard. In Android, clicking on search action button does not Application#hideKeyboard hide the keyboard.

      onSearchButtonClicked

      Deprecated

      Android

      Ios

      Since

      0.1

      Example

      import SearchView from '@smartface/native/ui/searchview';

      const searchView = new SearchView();
      searchView.on(SearchView.Events.SearchButtonClicked, (params) => {
      console.info('onSearchButtonClicked');
      });

      Returns void

onTouch: ((e?: Point2D) => boolean)

Type declaration

    • (e?: Point2D): boolean
    • This event is called when a touch screen motion event starts.

      onTouch

      Deprecated

      This method is deprecated in favor of EventEmitter. You could get more details for the deprecated events from here https://docs.smartface.io/smartface-native-framework/tips-and-tricks/handling-events

      Returns

      True if the listener has consumed the event, false otherwise.

      Android

      Ios

      Member

      UI.View

      Since

      0.1

      Example

      import View from '@smartface/native/ui/view';
      import FlexLayout from '@smartface/native/ui/flexlayout';
      import Button from '@smartface/native/ui/button';

      this.view1.on(View.Events.Touch, (point) => {
      console.info('view onTouch', point);
      });
      this.flexLayout1.on(FlexLayout.Events.Touch, (point) => {
      console.info('flexLayout onTouch', point);
      });
      this.button1.on(Button.Events.Touch, (point) => {
      console.info('button onTouch', point);
      });

      Parameters

      Returns boolean

onTouchEnded: ((isInside: boolean, point: Point2D) => boolean)

Type declaration

    • (isInside: boolean, point: Point2D): boolean
    • This event is called when a touch screen motion event ends. If touch position inside this view, isInside parameter will be true.

      onTouchEnded

      Deprecated

      This method is deprecated in favor of EventEmitter. You could get more details for the deprecated events from here https://docs.smartface.io/smartface-native-framework/tips-and-tricks/handling-events

      Returns

      True if the listener has consumed the event, false otherwise.

      Android

      Ios

      Member

      UI.View

      Since

      0.1

      Example

      import View from '@smartface/native/ui/view';
      import FlexLayout from '@smartface/native/ui/flexlayout';
      import Button from '@smartface/native/ui/button';

      this.view1.on(View.Events.TouchEnded, (isInside, point) => {
      console.info('view onTouchEnded', isInside, point);
      });
      this.flexLayout1.on(FlexLayout.Events.TouchEnded, (isInside, point) => {
      console.info('flexLayout onTouchEnded', isInside, point);
      });
      this.button1.on(Button.Events.TouchEnded, (isInside, point) => {
      console.info('button onTouchEnded', isInside, point);
      });

      Parameters

      • isInside: boolean

        This argument is deprecated. Use motionEvent's property.

      • point: Point2D

      Returns boolean

onTouchCancelled: ((point: Point2D) => boolean)

Type declaration

    • (point: Point2D): boolean
    • This event is called when a parent view takes control of the touch events, like a ListView or ScrollView does when scrolling.

      onTouchCancelled

      Deprecated

      This method is deprecated in favor of EventEmitter. You could get more details for the deprecated events from here https://docs.smartface.io/smartface-native-framework/tips-and-tricks/handling-events

      Returns

      True if the listener has consumed the event, false otherwise.

      Android

      Ios

      Member

      UI.View

      Since

      2.0.10

      Example

      import View from '@smartface/native/ui/view';
      import FlexLayout from '@smartface/native/ui/flexlayout';
      import Button from '@smartface/native/ui/button';

      this.view1.on(View.Events.TouchCancelled, (point) => {
      console.info('view onTouchCancelled', point);
      });
      this.flexLayout1.on(FlexLayout.Events.TouchCancelled, (point) => {
      console.info('flexLayout onTouchCancelled', point);
      });
      this.button1.on(Button.Events.TouchCancelled, (point) => {
      console.info('button onTouchCancelled', point);
      });

      Parameters

      Returns boolean

Generated using TypeDoc