diff options
author | George Rusu <george@tagg.id> | 2021-05-21 10:14:39 -0700 |
---|---|---|
committer | George Rusu <george@tagg.id> | 2021-05-21 10:14:39 -0700 |
commit | 872c58ddcf3b6185da9909131161f418d9960c07 (patch) | |
tree | 0b566c6d9afe1ef8672817989a15b9500bc095f9 /src/components/common/Draggable.tsx | |
parent | 1dd836609297a287d4ce32ef61c72746f8ac838c (diff) |
Remove unnecessary comments, print statements
Diffstat (limited to 'src/components/common/Draggable.tsx')
-rw-r--r-- | src/components/common/Draggable.tsx | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/components/common/Draggable.tsx b/src/components/common/Draggable.tsx index 94446a18..676e0fe5 100644 --- a/src/components/common/Draggable.tsx +++ b/src/components/common/Draggable.tsx @@ -5,20 +5,19 @@ import React from 'react'; import { - View, - Text, - Image, - PanResponder, Animated, Dimensions, - TouchableOpacity, - StyleSheet, GestureResponderEvent, + Image, + PanResponder, PanResponderGestureState, StyleProp, + StyleSheet, + Text, + TouchableOpacity, + View, + ViewStyle, } from 'react-native'; -// import PropTypes from 'prop-types'; -import {ViewStyle} from 'react-native'; function clamp(number: number, min: number, max: number) { return Math.max(min, Math.min(number, max)); @@ -77,11 +76,11 @@ export default function Draggable(props: IProps) { animatedViewProps, touchableOpacityProps, onDrag, - // onShortPressRelease, + onShortPressRelease, onDragRelease, - // onLongPress, - // onPressIn, - // onPressOut, + onLongPress, + onPressIn, + onPressOut, onRelease, x, y, @@ -195,10 +194,10 @@ export default function Draggable(props: IProps) { listener: handleOnDrag, useNativeDriver: false, }), - onPanResponderRelease: (_) => { - console.log('end'); - // setZIndex(1); - }, + // onPanResponderRelease: (_) => { + // // console.log('end'); + // // setZIndex(1); + // }, }); }, [ handleOnDrag, @@ -281,15 +280,15 @@ export default function Draggable(props: IProps) { childSize.current = {x: width, y: height}; }, []); - // const handlePressOut = React.useCallback( - // (event: GestureResponderEvent) => { - // onPressOut(event); - // if (!isDragging.current) { - // onRelease(event, false); - // } - // }, - // [onPressOut, onRelease], - // ); + const handlePressOut = React.useCallback( + (event: GestureResponderEvent) => { + onPressOut(event); + if (!isDragging.current) { + onRelease(event, false); + } + }, + [onPressOut, onRelease], + ); const getDebugView = React.useCallback(() => { const {width, height} = Dimensions.get('window'); @@ -323,10 +322,10 @@ export default function Draggable(props: IProps) { onLayout={handleOnLayout} style={dragItemCss} disabled={true} - onPress={() => console.log('ere')} - onLongPress={() => console.log('eeee')} - onPressIn={() => console.log('HERE')} - onPressOut={() => console.log('reeee')}> + onPress={onShortPressRelease} + onLongPress={onLongPress} + onPressIn={onPressIn} + onPressOut={onPressOut}> {touchableContent} </TouchableOpacity> </Animated.View> |