Skip to content

Pressable onPress not firing for the first press #440

@damtea

Description

@damtea

I use the action sheet for selecting an option from the list. I put Pressable component from react for each option, then when the user select the option, the onPress function is not firing at the first touch, but it works fine from the second touch. I don't know what am I doing wrong here.

Code:

<ActionSheet
id={id}
useBottomSafeAreaPadding
headerAlwaysVisible
gestureEnabled={false}
closeOnTouchBackdrop={true}
indicatorStyle={{
backgroundColor: "gray",
}}
containerStyle={{
backgroundColor: theme === "dark" ? "#111827" : "#ffffff",
paddingHorizontal: 16,
paddingTop: 8,
paddingBottom: 16,
}}
>

{options.map((option) => (
<Button
key={option.value?.toString()}
variant="ghost"
onPress={() => {
console.log("Button Pressed"); //this line does not work on the first touch. works on the second touch
onChange?.(option.value);
SheetManager.hide(id);
}}
className="my-1"
>
{option.label}

))}
{options.length === 0 && (

No options available

)}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions