Ensure event actually fires when the timeline is loaded

This commit is contained in:
Nat 2022-05-19 17:55:21 -07:00
parent f889540ba5
commit 04fb46404f
3 changed files with 13 additions and 8 deletions

View File

@ -64,9 +64,11 @@ const Feed = (props) => {
);
}, []);
const _handleTimelineLoaded = () => setState({...state,
const _handleTimelineLoaded = () => {
setState({...state,
postsRendered: true,
});
};
let endOfTimelineMessage = <></>;
if (state.postsRendered) {

View File

@ -220,13 +220,14 @@ export const PostByData = (props) => {
own,
loaded: true
});
if (props.onPostLoaded != null) {
props.onPostLoaded();
}
});
}, []);
useEffect(() => {
// This is run after the state has been updated
props.onPostLoaded();
}, [state])
const _handleFavourite = async () => {
let newStatus;

View File

@ -23,7 +23,9 @@ const TimelineView = (props) => {
}
}, [postsLoaded]);
_handlePostLoaded = () => setPostsLoaded(postsLoaded + 1);
const _handlePostLoaded = () => {
setPostsLoaded(postsLoaded + 1);
}
return (
<View>