Pressable - Updated version of Touchable
Pressable component is an updated and advanced version of touchable and it's recommended to use pressable instead of Touchable.
The Pressable is a wrapper component used to make other components responsive to the user's touch. Useful for creating custom buttons or custom touchable containers.
To add a Pressable on the screen:
- Select the Pressable 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 Pressable appear as a container.
Here is an example below where an Image component is nested inside a Pressable component. Then, on the Pressable component, the Open Image Picker action via the Interactions tab (last tab) from the Properties Panel is added to open the device's media library when a user taps on the Image.
|Component Name||To alter the name of the component. The name is reflected in the Components tree. Defaults to Pressable.|
|Delay Long Press||Duration (in milliseconds) from onPressIng before onLongPress is called.|
|Hit Slop||Sets additional distance outside of the element in which a press can be detected.|
|Active Opacity||The opacity when the button is pressed.|
|Disabled Opacity||The opacity when the button is disabled.|
|On Press||Starts the action when the element is pressed.|
|On Long Press||Starts the action when the element is long pressed.|
Here you will find instructions to can create your own button using a touchable component provided by Draftbit. A Touchable or Pressable component provides the same capability as a Button to capture tapping gestures. However, it does not provide any default styling.
Updated about 1 month ago