Touchable

📘

Pressable - Advanced version of Touchable

Pressable component is an updated and advanced version of touchable and it's recommended to use pressable instead of Touchable.

The Touchable is a wrapper component is used to make other components responsive to the user's touch. Useful for creating custom buttons or custom touchable containers. You can use it to Trigger Actions.

Adding a Touchable component

To add a Touchable on the screen:

  • Select the Touchable component from the Components drawer. You can open the list of components by clicking the + button next to Components.
  • Select the added component in the Components tree.
  • Add a nested component to make Touchable appear as a container.

Here is an example below where an Image component is nested inside a Touchable component. Then, on the Touchable component, the Open Image Picker action via Interactions tab (last tab) from the Properties Panel is added to open the device's media library when a user taps on the Image.

Style Properties

Style properties allow you to customize the look and feel of the component. Combinations of styles applied to components can be saved as Stylesheets to easily reuse styles throughout your app. Styles can also be set dynamically using Variables. To learn more about all the different styling properties and how they work, take a look at Intro to Styling.

Configuration Properties

PropertyDescription
Component NameTo alter the name of the component. The name is reflected in the Components tree. Defaults to Touchable.

Data Properties

PropertyDescription
DisabledDisables the component when turned on

Conditional Display

You can conditionally display a component based on a given condition. Learn more about conditionally displaying components in the Conditional Display doc.

Triggers

NameDescription
On Press Starts the action when the element is pressed.
On Long Press Starts the action when the element is long pressed.

Creating a Custom Button From using Touchable

📘

Here you will find instructions to can create your own button using a Touchable component provided by Draftbit. A Touchable component provides the same capability as a Button to capture tapping gestures. However, it does not provide any default styling.