Skip to main content
Actions do what a user does. In native mode (the default when the app has @quiesco/native) they are real touches and keyboard input; in js mode they call the component’s callbacks instead (see call options). Every action waits for the app to be idle before and after it, and needs exactly one visible target (finding elements). Coordinates are logical units: points on iOS, dp on Android, CSS pixels on the web.

Tapping

tap(target, options?)

Types: MatcherInput · TapOptions · ElementSummary Taps the center of the element. An element partly cut off by a scroll view or an overflow ancestor is tapped at the center of its visible part.

doubleTap(target, options?)

Types: MatcherInput · ActionOptions · ElementSummary Two taps in one gesture.

multiTap(target, count, options?)

Types: MatcherInput · ActionOptions · ElementSummary count taps in one gesture.

longPress(target, options?)

Types: MatcherInput · LongPressOptions · ElementSummary Presses and holds the element.

tapAt(point, options?)

Types: Point · ActionOptions Taps a point of the screen (window coordinates), whatever is there.

longPressAt(point, options?)

Types: Point · LongPressAtOptions Presses and holds a point of the screen (window coordinates).

Text input

type(target, text, options?)

Types: MatcherInput · TypeOptions · ElementSummary Focuses the input and enters text after what is already there. In native mode the text goes through the system’s input method, so any language works. On iOS and Android the whole text arrives at once; on the web one key per character.

replaceText(target, text, options?)

Types: MatcherInput · ActionOptions · ElementSummary Replaces the whole text of the input at once.

clear(target, options?)

Types: MatcherInput · ActionOptions · ElementSummary Empties the input.

pressKey(target, key, options?)

Types: MatcherInput · KeyName · ActionOptions · ElementSummary Sends the return key ('enter') or 'backspace' to the field. 'enter' submits a single-line input and adds a newline in a multi-line one. The field only has to exist: the key reaches it even where the keyboard’s return key would be out of reach.

dismissKeyboard(options?)

Types: ActionOptions Hides the software keyboard.

Scrolling

scroll(target, direction, options?)

Types: MatcherInput · Direction · ScrollOptions · ElementSummary Scrolls a scroll view. 'down' reveals the content below. In native mode a finger drags and slows down to a stop, so the content moves by about distance without a fling (less the system’s touch slop: about 10 pt on iOS, 7% on Android).

scrollTo(container, target, options?)

Types: MatcherInput · ActionOptions · ElementSummary Scrolls container until the center of target is visible (where a tap goes): down, then up; right, then left in a horizontal list. Each step moves less than one screenful, so nothing is skipped. At an end of the content, a target whose center stays cut off is returned as it is.

scrollToEdge(target, edge, options?)

Types: MatcherInput · Edge · ActionOptions · ElementSummary Scrolls to the 'top', 'bottom', 'left' or 'right' end. A virtualized list that renders more rows as it scrolls is followed while it grows (in native mode with real flings).

scrollToIndex(list, index, options?)

Types: MatcherInput · ScrollToIndexOptions · ElementSummary Brings row index of a FlatList / FlashList into view, also without getItemLayout.
scrollTo, scrollToEdge and scrollToIndex take several steps (at most 60); each step may wait up to the call’s timeout for the app to settle.

Gestures

swipe(target, direction, options?)

Types: MatcherInput · Direction · SwipeOptions · ElementSummary A swipe with inertia. direction is the direction the finger moves.

drag(target, to, options?)

Types: MatcherInput · Point · DragOptions · ElementSummary Presses and holds the element, moves it to the center of to (an element), or to { point } (window coordinates), and releases. It needs real touches: not available in js mode.
Pinch, rotate and other gestures with several fingers are on multi-finger gestures.

goBack(options?)

Types: ActionOptions Goes back to the previous screen the way a user does on each platform: the Android back button (after closing the keyboard), the browser’s back, the navigation bar’s back button on iOS, else the iOS edge swipe. In an Expo Router app it fails when the route did not change.

pressBack(options?)

Types: ActionOptions The Android back button, or the browser’s back on the web. Not available on iOS (ACTION_NOT_SUPPORTED): use goBack() for a test that runs everywhere.

openUrl(url, options?)

Types: ActionOptions Opens a deep link: in the app on iOS, with am start on Android, in the address bar on the web. While the app is in the background (app.device.sendToBackground()), it opens the link from outside the app as another app would; on iOS it answers the system’s “Open in …?” question. Resolves when the app is in front and idle.

Other inputs

Controls that hold a value — switches, sliders, pickers, date pickers — are set with setValue and adjustSlider, and accessibilityAction performs a screen reader’s action: see value controls.

In js mode

When an action calls callbacks instead of touching the screen:
  • a tap at a point presses the topmost element there;
  • a tap on a switch without onPress toggles it through onValueChange;
  • pressKey calls onSubmitEditing / onKeyPress;
  • scrollToEdge sets the scroll offset;
  • from is ignored;
  • drag is not supported, since it needs real touches.