mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
fixed comment image/link clicks and long press 1.5s
This commit is contained in:
parent
945d669abd
commit
2a7a1021fd
@ -1,5 +1,5 @@
|
||||
import React, { Fragment, useState, useRef } from 'react';
|
||||
import { View, TouchableWithoutFeedback } from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
import { useIntl } from 'react-intl';
|
||||
import get from 'lodash/get';
|
||||
@ -50,7 +50,7 @@ const CommentView = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableWithoutFeedback onLongPress={handleOnLongPress} delayLongPress={2000}>
|
||||
<Fragment>
|
||||
<View style={styles.commentContainer}>
|
||||
<PostHeaderDescription
|
||||
key={comment.permlink}
|
||||
@ -67,6 +67,7 @@ const CommentView = ({
|
||||
commentDepth={comment.depth}
|
||||
reputation={comment.author_reputation}
|
||||
handleOnUserPress={handleOnUserPress}
|
||||
handleOnLongPress={handleOnLongPress}
|
||||
body={comment.body}
|
||||
created={comment.created}
|
||||
key={`key-${comment.permlink}`}
|
||||
@ -176,7 +177,7 @@ const CommentView = ({
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,7 @@ const CommentBody = ({
|
||||
textSelectable = true,
|
||||
handleOnUserPress,
|
||||
handleOnPostPress,
|
||||
handleOnLongPress,
|
||||
created,
|
||||
commentDepth,
|
||||
reputation,
|
||||
@ -84,6 +85,9 @@ const CommentBody = ({
|
||||
setSelectedLink(href);
|
||||
actionLink.current.show();
|
||||
break;
|
||||
case 'longpress':
|
||||
handleOnLongPress();
|
||||
break;
|
||||
case 'markdown-author-link':
|
||||
if (!handleOnUserPress) {
|
||||
__handleOnUserPress(author);
|
||||
|
@ -118,6 +118,8 @@ true;
|
||||
`;
|
||||
|
||||
const customCommentScript = `
|
||||
var longpress = 1500;
|
||||
var delay;
|
||||
var images = document.getElementsByTagName("IMG");
|
||||
var imageUrls = [];
|
||||
for (var k = 0; k < images.length; k++) {
|
||||
@ -138,6 +140,22 @@ for (var i = 0; i < images.length; i++) {
|
||||
images[i].setAttribute("onclick", message);
|
||||
}
|
||||
}
|
||||
document.addEventListener('mousedown', function(event) {
|
||||
delay = setTimeout(check, longpress);
|
||||
function check() {
|
||||
var result = {
|
||||
type: 'longpress',
|
||||
};
|
||||
window.ReactNativeWebView.postMessage(JSON.stringify(result));
|
||||
return true;
|
||||
}
|
||||
}, true);
|
||||
document.addEventListener('mouseup', function (e) {
|
||||
clearTimeout(delay);
|
||||
});
|
||||
document.addEventListener('mouseout', function (e) {
|
||||
clearTimeout(delay);
|
||||
});
|
||||
document.addEventListener('click', function(event) {
|
||||
var el = event.target;
|
||||
while (el.tagName !== 'A') {
|
||||
|
Loading…
Reference in New Issue
Block a user