aboutsummaryrefslogtreecommitdiff
path: root/src/components/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/common')
-rw-r--r--src/components/common/Draggable.tsx57
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>