changed onReplyPress implementation in commen module

This commit is contained in:
Sadaqat Ali 2022-07-30 17:03:28 +05:00
parent a4d8edc311
commit 98dec4045c
2 changed files with 13 additions and 3 deletions

View File

@ -839,4 +839,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 0282022703ad578ab2d9afbf3147ba3b373b4311
COCOAPODS: 1.11.3
COCOAPODS: 1.11.2

View File

@ -18,6 +18,8 @@ import { TextWithIcon } from '../../basicUIElements';
import styles from './commentStyles';
import { useAppSelector } from '../../../hooks';
import { OptionsModal } from '../../atoms';
import { useDispatch } from 'react-redux';
import { showReplyModal } from '../../../redux/actions/uiAction';
const CommentView = ({
avatarSize,
@ -43,6 +45,7 @@ const CommentView = ({
}) => {
const intl = useIntl();
const actionSheet = useRef(null);
const dispatch = useDispatch();
const isMuted = useAppSelector(state => state.account.currentAccount.mutes?.indexOf(comment.author) > -1);
const lastCacheUpdate = useAppSelector((state) => state.cache.lastUpdate);
@ -113,6 +116,13 @@ const CommentView = ({
setChildCount(childCount + 1);
}
const _handleOnReplyPress = () => {
if (isLoggedIn) {
dispatch(showReplyModal(comment));
} else {
console.log('Not LoggedIn');
}
}
const _renderReadMoreButton = () => (
<TextWithIcon
@ -151,7 +161,7 @@ const CommentView = ({
mainAuthor={mainAuthor}
fetchedAt={fetchedAt}
incrementRepliesCount={_incrementRepliesCount}
handleOnReplyPress={handleOnReplyPress}
handleOnReplyPress={_handleOnReplyPress}
/>
</AnimatedView>
@ -218,7 +228,7 @@ const CommentView = ({
iconStyle={styles.leftIcon}
style={styles.leftButton}
name="comment-outline"
onPress={() => handleOnReplyPress && handleOnReplyPress(comment)}
onPress={_handleOnReplyPress}
iconType="MaterialCommunityIcons"
/>
)}