diff --git a/components/Post.js b/components/Post.js index 9a7f509..fc00b08 100644 --- a/components/Post.js +++ b/components/Post.js @@ -26,6 +26,7 @@ let Post = (props) => { let [bookmarked, changeBookmarked] = useState(post.bookmarks && post.bookmarks.includes(viewer._id)); const isOwner = String(post.profileid || '') === String(viewer?._id || ''); const swipeX = useRef(new Animated.Value(0)).current; + const mediaGestureActiveRef = useRef(false); const SWIPE_WIDTH = 86; let toProfileText = post.toProfile && post.toProfile !== post.profileid ? : undefined; @@ -118,6 +119,7 @@ let Post = (props) => { const panResponder = useMemo(() => PanResponder.create({ onMoveShouldSetPanResponder: (_, gestureState) => isOwner && + !mediaGestureActiveRef.current && Math.abs(gestureState.dx) > 8 && Math.abs(gestureState.dx) > Math.abs(gestureState.dy), onPanResponderMove: (_, gestureState) => { @@ -171,12 +173,58 @@ let Post = (props) => { - + { + mediaGestureActiveRef.current = true; + return false; + }} + onMoveShouldSetResponderCapture={() => { + mediaGestureActiveRef.current = true; + return false; + }} + onResponderRelease={() => { + mediaGestureActiveRef.current = false; + }} + onResponderTerminate={() => { + mediaGestureActiveRef.current = false; + }} + onTouchEnd={() => { + mediaGestureActiveRef.current = false; + }} + onTouchCancel={() => { + mediaGestureActiveRef.current = false; + }} + > + + : {i18n.t("message.news")} {cleanContent} - + { + mediaGestureActiveRef.current = true; + return false; + }} + onMoveShouldSetResponderCapture={() => { + mediaGestureActiveRef.current = true; + return false; + }} + onResponderRelease={() => { + mediaGestureActiveRef.current = false; + }} + onResponderTerminate={() => { + mediaGestureActiveRef.current = false; + }} + onTouchEnd={() => { + mediaGestureActiveRef.current = false; + }} + onTouchCancel={() => { + mediaGestureActiveRef.current = false; + }} + > + + }