mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-04 03:56:54 +03:00
support for long press quick reply modal
This commit is contained in:
parent
2e2c36a714
commit
aba5c66eb4
@ -13,6 +13,7 @@ const TextWithIcon = ({
|
||||
iconSize,
|
||||
wrapperStyle,
|
||||
textStyle,
|
||||
onLongPress,
|
||||
}) => {
|
||||
const [ltext, setLtext] = useState(text);
|
||||
useEffect(() => {
|
||||
@ -25,6 +26,7 @@ const TextWithIcon = ({
|
||||
underlayColor="transparent"
|
||||
disabled={!isClickable || !onPress}
|
||||
onPress={() => onPress && onPress()}
|
||||
onLongPress={() => onLongPress && onLongPress()}
|
||||
>
|
||||
<Fragment>
|
||||
<Icon
|
||||
|
@ -54,7 +54,6 @@ const PostDisplayView = ({
|
||||
const scrollRef = useRef<ScrollView>();
|
||||
const commentsReached = useRef<boolean>(false);
|
||||
|
||||
|
||||
const [postHeight, setPostHeight] = useState(0);
|
||||
const [scrollHeight, setScrollHeight] = useState(0);
|
||||
const [cacheVoteIcrement, setCacheVoteIcrement] = useState(0);
|
||||
@ -89,29 +88,32 @@ const PostDisplayView = ({
|
||||
|
||||
const _handleOnScroll = (event) => {
|
||||
const { y } = event.nativeEvent.contentOffset;
|
||||
console.log("scroll height", y)
|
||||
console.log('scroll height', y);
|
||||
setScrollHeight(HEIGHT + y);
|
||||
|
||||
const _commentButtonBounceOffset = y + (HEIGHT/1.7);
|
||||
if(!commentsReached.current && commentsRef.current && _commentButtonBounceOffset > postHeight ){
|
||||
const _commentButtonBounceOffset = y + HEIGHT / 1.7;
|
||||
if (
|
||||
!commentsReached.current &&
|
||||
commentsRef.current &&
|
||||
_commentButtonBounceOffset > postHeight
|
||||
) {
|
||||
commentsRef.current.bounceCommentButton();
|
||||
commentsReached.current = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const _handleOnPostLayout = (event) => {
|
||||
const { height } = event.nativeEvent.layout;
|
||||
console.log('post height', height)
|
||||
console.log('post height', height);
|
||||
setPostHeight(height);
|
||||
};
|
||||
|
||||
const _scrollToComments = () => {
|
||||
if(scrollRef.current){
|
||||
if (scrollRef.current) {
|
||||
const pos = postHeight;
|
||||
scrollRef.current.scrollTo({y:pos})
|
||||
scrollRef.current.scrollTo({ y: pos });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _handleOnReblogsPress = () => {
|
||||
if (reblogs.length > 0 && handleOnReblogsPress) {
|
||||
@ -160,8 +162,8 @@ const PostDisplayView = ({
|
||||
isClickable
|
||||
text={get(post, 'children', 0)}
|
||||
textMarginLeft={20}
|
||||
onLongPress={_showQuickReplyModal}
|
||||
onPress={() => _scrollToComments()}
|
||||
// onPress={() => handleOnReplyPress && handleOnReplyPress()}
|
||||
/>
|
||||
)}
|
||||
{!isLoggedIn && (
|
||||
@ -279,8 +281,7 @@ const PostDisplayView = ({
|
||||
)}
|
||||
</View>
|
||||
{post && !postBodyLoading && (isGetComment || isLoadedComments) && (
|
||||
|
||||
<CommentsDisplay
|
||||
<CommentsDisplay
|
||||
ref={commentsRef}
|
||||
author={author || post.author}
|
||||
mainAuthor={author || post.author}
|
||||
|
Loading…
Reference in New Issue
Block a user