diff --git a/native/tooltip/tooltip-context.react.js b/native/tooltip/tooltip-context.react.js --- a/native/tooltip/tooltip-context.react.js +++ b/native/tooltip/tooltip-context.react.js @@ -117,8 +117,11 @@ ); const onPressAction = (selectedIndex: ?number) => { - const index = selectedIndex ?? 0; - filteredOptions[index].onPress(); + if (!selectedIndex || selectedIndex < 0) { + cancel(); + return; + } + filteredOptions[selectedIndex].onPress(); }; const containerStyle = { @@ -137,9 +140,9 @@ }, [ hideTooltip, maxOptionsToDisplay, + showActionSheetWithOptions, visibleEntryIDsSet, cancel, - showActionSheetWithOptions, ]); const shouldShowMore = React.useCallback(() => {