Help prepare for 2025 → Answer 8 simple questions on our Fall Survey
Open Survey
SearchBar
Represents a search bar component.

Summary

Constructors

constructor

Properties

android
clearEvent
hint
ios
submitEvent
text
textFieldBackgroundColor
textFieldHintColor
152 properties inherited from View
Click to expand

Methods

dismissSoftInput
on
111 methods inherited from View
Click to expand

Constructors

constructor

new SearchBar(): SearchBar

Properties

android

android: any
Gets the native [android widget](http://developer.android.com/reference/android/widget/SearchView.html) that represents the user interface for this component. Valid only when running on Android OS.

hint

hint: string
Gets or sets the text of the search bar text field hint/placeholder.

ios

ios: any
Gets the native iOS [UISearchBar](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchBar_Class/) that represents the user interface for this component. Valid only when running on iOS.

text

text: string
Gets or sets a search bar text.

textFieldBackgroundColor

textFieldBackgroundColor: Color
Gets or sets the TextField background color of the SearchBar component.

textFieldHintColor

textFieldHintColor: Color
Gets or sets the TextField Hint color of the SearchBar component.

clearEvent

Static
clearEvent: string
String value used when hooking to clear event.

submitEvent

Static
submitEvent: string
String value used when hooking to submit event.

Methods

dismissSoftInput

dismissSoftInput(): void
Hides the soft input method, usually a soft keyboard.
Returns void

on

on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void
A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
Parameter Default Description
eventNames
string

String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").

callback
(data: EventData) => void

Callback function which will be executed when event is raised.

thisArg
any

An optional parameter which will be used as `this` context for callback execution.

Returns void
on(event: "submit", callback: (args: EventData) => void, thisArg?: any): void
Raised when a search bar search is submitted.
Parameter Default Description
event
"submit"

callback
(args: EventData) => void

thisArg
any

Returns void
on(event: "close", callback: (args: EventData) => void, thisArg?: any): void
Raised when a search bar search is closed.
Parameter Default Description
event
"close"

callback
(args: EventData) => void

thisArg
any

Returns void
Previous
ScrollView