mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 19:31:54 +03:00
update upvote state inside post card
This commit is contained in:
parent
4032217c11
commit
db823b76f1
@ -32,7 +32,7 @@ const PostCardContainer = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [_content, setContent] = useState(content);
|
const [_content, setContent] = useState(content);
|
||||||
const [reblogs, setReblogs] = useState([]);
|
const [reblogs, setReblogs] = useState([]);
|
||||||
const [activeVotes, setActiveVotes] = useState(get(_content, 'active_votes', []));
|
const [activeVotes, setActiveVotes] = useState(get(content, 'active_votes', []));
|
||||||
|
|
||||||
//NOTE: potentially unnessacry fetch
|
//NOTE: potentially unnessacry fetch
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
@ -41,6 +41,11 @@ const PostCardContainer = ({
|
|||||||
// }
|
// }
|
||||||
// }, [isRefresh]);
|
// }, [isRefresh]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setContent(content);
|
||||||
|
setActiveVotes(get(content, 'active_votes', []));
|
||||||
|
}, [content]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isCancelled = false;
|
let isCancelled = false;
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ const PostCardView = ({
|
|||||||
const [activeVotesCount, setActiveVotesCount] = useState(activeVotes.length || 0);
|
const [activeVotesCount, setActiveVotesCount] = useState(activeVotes.length || 0);
|
||||||
const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300);
|
const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setActiveVotesCount(activeVotes.length);
|
||||||
|
}, [activeVotes]);
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
|
|
||||||
const _handleOnUserPress = () => {
|
const _handleOnUserPress = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user