diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js index 5435954ff..89eb864a0 100644 --- a/src/components/postElements/body/view/postBodyView.js +++ b/src/components/postElements/body/view/postBodyView.js @@ -31,6 +31,7 @@ const PostBody = ({ handleOnUserPress, handleOnPostPress, dispatch, + onLoadEnd, }) => { const [isImageModalOpen, setIsImageModalOpen] = useState(false); const [postImages, setPostImages] = useState([]); @@ -41,7 +42,7 @@ const PostBody = ({ const intl = useIntl(); const actionImage = useRef(null); const actionLink = useRef(null); - const [isLoading, setIsLoading] = useState(true); + // const [isLoading, setIsLoading] = useState(true); useEffect(() => { if (selectedLink) { @@ -294,9 +295,9 @@ const PostBody = ({ }; const _handleLoadEnd = () => { - setTimeout(() => { - setIsLoading(false); - }, 200); + if (onLoadEnd) { + onLoadEnd(); + } }; const customStyle = ` @@ -461,7 +462,7 @@ const PostBody = ({ handleLinkPress(index); }} /> - {isLoading && (isComment ? : )} + {/* {isLoading && (isComment ? : )} */} (isComment ? : )} onShouldStartLoadWithRequest={false} scrollEnabled={false} scalesPageToFit={false} diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 612788dad..631e41303 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -48,6 +48,7 @@ const PostDisplayView = ({ const [isLoadedComments, setIsLoadedComments] = useState(false); const actionSheet = useRef(null); const [refreshing, setRefreshing] = useState(false); + const [postBodyLoading, setPostBodyLoading] = useState(false); // Component Life Cycles useEffect(() => { @@ -59,6 +60,7 @@ const PostDisplayView = ({ // Component Functions const onRefresh = useCallback(() => { setRefreshing(true); + setPostBodyLoading(true); fetchPost().then(() => setRefreshing(false)); }, [refreshing]); @@ -183,6 +185,10 @@ const PostDisplayView = ({ ); } + const _handleOnPostBodyLoad = () => { + setPostBodyLoading(false); + }; + return ( - - - - - Posted by - {` ${author || post.author} `} - {formatedTime} - - {/* {isPostEnd && this._getTabBar()} */} - + + {!postBodyLoading && ( + + + + Posted by + {` ${author || post.author} `} + {formatedTime} + + {/* {isPostEnd && this._getTabBar()} */} + + )} )} - {post && (isGetComment || isLoadedComments) && ( + {post && !postBodyLoading && (isGetComment || isLoadedComments) && (