FIX: Sensitive onPress when using tooltip

This commit is contained in:
Marcos Rodriguez Velez 2024-01-01 14:52:59 -04:00
parent c6717f1906
commit c597364cbd
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7

View file

@ -67,6 +67,32 @@ const ToolTipMenu = (props, ref) => {
props.children
)}
</ContextMenuButton>
) : props.onPress ? (
<TouchableOpacity accessibilityRole="button" onPress={props.onPress}>
<ContextMenuView
ref={ref}
internalCleanupMode="viewController"
onPressMenuItem={({ nativeEvent }) => {
props.onPressMenuItem(nativeEvent.actionKey);
}}
useActionSheetFallback={false}
menuConfig={{
menuTitle,
menuItems,
}}
{...(previewQRCode
? {
previewConfig: {
previewType: 'CUSTOM',
backgroundColor: 'white',
},
renderPreview: () => <QRCodeComponent value={previewValue} isMenuAvailable={false} />,
}
: {})}
>
{props.children}
</ContextMenuView>
</TouchableOpacity>
) : (
<ContextMenuView
ref={ref}
@ -74,6 +100,7 @@ const ToolTipMenu = (props, ref) => {
onPressMenuItem={({ nativeEvent }) => {
props.onPressMenuItem(nativeEvent.actionKey);
}}
useActionSheetFallback={false}
menuConfig={{
menuTitle,
menuItems,
@ -88,13 +115,7 @@ const ToolTipMenu = (props, ref) => {
}
: {})}
>
{props.onPress ? (
<TouchableOpacity accessibilityRole="button" onPress={props.onPress}>
{props.children}
</TouchableOpacity>
) : (
props.children
)}
{props.children}
</ContextMenuView>
);
};