aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/common/Draggable.tsx57
-rw-r--r--src/components/taggs/TaggDraggable.tsx12
-rw-r--r--src/screens/profile/CaptionScreen.tsx28
3 files changed, 44 insertions, 53 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>
diff --git a/src/components/taggs/TaggDraggable.tsx b/src/components/taggs/TaggDraggable.tsx
index 1ef2e69f..4e45f000 100644
--- a/src/components/taggs/TaggDraggable.tsx
+++ b/src/components/taggs/TaggDraggable.tsx
@@ -37,12 +37,12 @@ const TaggDraggable: React.FC<TaggDraggableProps> = (
const draggableRef = useRef(null);
useEffect(() => {
draggableRef.current.measure((fx, fy, width, height, px, py) => {
- console.log('Drag Component width is: ' + width);
- console.log('Drag Component height is: ' + height);
- console.log('X offset to frame: ' + fx);
- console.log('Y offset to frame: ' + fy);
- console.log('X offset to page: ' + px);
- console.log('Y offset to page: ' + py);
+ // console.log('Drag Component width is: ' + width);
+ // console.log('Drag Component height is: ' + height);
+ // console.log('X offset to frame: ' + fx);
+ // console.log('Y offset to frame: ' + fy);
+ // console.log('X offset to page: ' + px);
+ // console.log('Y offset to page: ' + py);
setStart([width, height]);
});
}, []);
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index ecb51531..ec55e43a 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -17,9 +17,7 @@ import {Button} from 'react-native-elements';
import {useDispatch, useSelector} from 'react-redux';
import {SearchBackground} from '../../components';
import {CaptionScreenHeader} from '../../components/';
-// import Draggable from '../../components/common/Draggable';
import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator';
-// import TaggDraggable from '../../components/taggs/TaggDraggable';
import {TAGG_LIGHT_BLUE_2} from '../../constants';
import {ERROR_UPLOAD, SUCCESS_PIC_UPLOAD} from '../../constants/strings';
import {MainStackParams} from '../../routes';
@@ -31,7 +29,6 @@ import {
import {RootState} from '../../store/rootReducer';
import {SCREEN_WIDTH, StatusBarHeight} from '../../utils';
import {mentionPartTypes} from '../../utils/comments';
-// import {TouchableOpacity} from 'react-native-gesture-handler';
/**
* Upload Screen to allow users to upload posts to Tagg
@@ -64,10 +61,14 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const imageRef = useRef(null);
// const zIndex = [0, 999];
+ // state variables used to position draggables
// const [offset, setOffset] = useState([0, 0]);
// const [curStart, setCurStart] = useState([0, 0]);
// const [imageDimensions, setImageDimensions] = useState([0, 0]);
+ // state var used to keep track of draggable z ordering
+ // const [layerOrder, setLayerOrder] = useState<string[]>([]);
+
// created a state variable to keep track of every tag
// idea is that each element in the list
// const [taggList, setTaggList] = useState([
@@ -88,15 +89,6 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
// username: 'ankit.thanekar',
// },
// ]);
- // state variables used to position draggables
-
- // state var used to keep track of draggable z ordering
- // const [layerOrder, setLayerOrder] = useState<string[]>([]);
- // created a test user - BUG - failed to register a profile visit -
- // const testUser: UserType = {
- // userId: 'ID-1234-567',
- // username: 'dragonofthewest',
- // };
const navigateToProfile = () => {
//Since the logged In User is navigating to own profile, useXId is not required
@@ -138,12 +130,12 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
// useEffect(() => {
// imageRef.current.measure((fx, fy, width, height, px, py) => {
- // console.log('Component width is: ' + width);
- // console.log('Component height is: ' + height);
- // console.log('X offset to frame: ' + fx);
- // console.log('Y offset to frame: ' + fy);
- // console.log('X offset to page: ' + px);
- // console.log('Y offset to page: ' + py);
+ // // console.log('Component width is: ' + width);
+ // // console.log('Component height is: ' + height);
+ // // console.log('X offset to frame: ' + fx);
+ // // console.log('Y offset to frame: ' + fy);
+ // // console.log('X offset to page: ' + px);
+ // // console.log('Y offset to page: ' + py);
// setOffset([px, py]);
// setImageDimensions([width, height]);
// });