aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/common/MomentTags.tsx2
-rw-r--r--src/screens/moments/TagFriendsScreen.tsx26
2 files changed, 14 insertions, 14 deletions
diff --git a/src/components/common/MomentTags.tsx b/src/components/common/MomentTags.tsx
index 6ea76508..37069e18 100644
--- a/src/components/common/MomentTags.tsx
+++ b/src/components/common/MomentTags.tsx
@@ -90,7 +90,6 @@ const MomentTags: React.FC<MomentTagsProps> = ({
// Checks for and adds boundaries
if (boundaries) {
- console.log(boundaries);
const newBounds = [...boundariesList];
if (boundaries.top) {
newBounds[2] = boundaries.top;
@@ -104,7 +103,6 @@ const MomentTags: React.FC<MomentTagsProps> = ({
if (boundaries.right) {
newBounds[1] = boundaries.right;
}
- console.log(newBounds);
setBoundariesList(newBounds);
}
},
diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx
index 983b1be3..6c982936 100644
--- a/src/screens/moments/TagFriendsScreen.tsx
+++ b/src/screens/moments/TagFriendsScreen.tsx
@@ -38,6 +38,7 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
const [imageWidth, setImageWidth] = useState<number>(0);
const [imageHeight, setImageHeight] = useState<number>(0);
const [bottomBound, setBottomBound] = useState<number>(0);
+ const [topHeight, setTopHeight] = useState<number>(0);
const [topBound, setTopBound] = useState<number>(0);
/*
@@ -77,9 +78,10 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
};
/*
- * Calculate boundary (if any) for drag from bottom
+ * Calculate boundary (if any) for drag from bottom and top
*/
useEffect(() => {
+ // Bottom dead zone
if (SCREEN_HEIGHT / 2 - imageHeight / 2 < SCREEN_HEIGHT * 0.15) {
if (SCREEN_HEIGHT / 2 - imageHeight / 2 < 0) {
setBottomBound(SCREEN_HEIGHT * 0.15);
@@ -89,7 +91,16 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
);
}
}
- }, [imageHeight, imageWidth]);
+
+ // Top dead zone
+ if (SCREEN_HEIGHT / 2 - imageHeight / 2 < topHeight) {
+ if (SCREEN_HEIGHT / 2 - imageHeight / 2 < 0) {
+ setTopBound(topHeight + 15);
+ } else {
+ setTopBound(topHeight - (SCREEN_HEIGHT / 2 - imageHeight / 2) + 15);
+ }
+ }
+ }, [imageHeight, imageWidth, topHeight]);
/*
* Calculating image width and height with respect to it's enclosing view's dimensions. Only works for images.
@@ -162,16 +173,7 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
style={styles.titleContainer}
onLayout={(event) => {
const {y, height} = event.nativeEvent.layout;
- const tempBound = y + height;
- if (SCREEN_HEIGHT / 2 - imageHeight / 2 < tempBound) {
- if (SCREEN_HEIGHT / 2 - imageHeight / 2 < 0) {
- setTopBound(tempBound + 15);
- } else {
- setTopBound(
- tempBound - (SCREEN_HEIGHT / 2 - imageHeight / 2) + 15,
- );
- }
- }
+ setTopHeight(y + height);
}}>
<TouchableOpacity
onPress={() => {