From 83004c15b5470ecf605a86ab90811076d25bbe81 Mon Sep 17 00:00:00 2001 From: Jesse Onolememen Date: Tue, 31 Mar 2020 16:45:31 +0100 Subject: [PATCH] feat(ios): implement remove on longpress --- src/BubbleSelect.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/BubbleSelect.tsx b/src/BubbleSelect.tsx index 9fe00d1e..6fac41ed 100644 --- a/src/BubbleSelect.tsx +++ b/src/BubbleSelect.tsx @@ -7,12 +7,15 @@ const RNBubbleSelect = requireNativeComponent('RNBubbleSelectView'); export type BubbleSelectProps = Omit & { onSelect?: (bubble: BubbleNode) => void; onDeselect?: (bubble: BubbleNode) => void; + onRemove?: (bubble: BubbleNode) => void; bubbleSize?: number; allowsMultipleSelection?: boolean; children: React.ReactNode; style?: object; width?: number; height?: number; + removeOnLongPress?: boolean; + longPressDuration?: number; }; const BubbleSelect = ({ @@ -22,6 +25,9 @@ const BubbleSelect = ({ allowsMultipleSelection, children, bubbleSize, + onRemove, + removeOnLongPress, + longPressDuration, width = 200, height = 200, ...bubbleProps @@ -33,7 +39,6 @@ const BubbleSelect = ({ }; const handleSelect = (event: NativeSyntheticEvent) => { - console.log(event); if (onSelect) { onSelect(event.nativeEvent); } @@ -45,13 +50,22 @@ const BubbleSelect = ({ } }; + const handleRemove = (event: NativeSyntheticEvent) => { + if (onRemove) { + onRemove(event.nativeEvent); + } + }; + return ( {React.Children.map(children, (child: any) => React.cloneElement(child, bubbleProps)