diff options
author | crupest <crupest@outlook.com> | 2020-06-10 00:43:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-10 00:43:33 +0800 |
commit | 0fe34194d091464f5b1f88a2a51c72875bb092d3 (patch) | |
tree | 0651086163c3c2a3ea3d68954dc8973cab63865e /Timeline/ClientApp/src/timeline/TimelineItem.tsx | |
parent | d4cf8359a953a5644d5878610e43be3075fa252c (diff) | |
parent | 0ec545e1bfee5bd6ebd7db8176bf44ba5b67bfbe (diff) | |
download | timeline-0fe34194d091464f5b1f88a2a51c72875bb092d3.tar.gz timeline-0fe34194d091464f5b1f88a2a51c72875bb092d3.tar.bz2 timeline-0fe34194d091464f5b1f88a2a51c72875bb092d3.zip |
Merge pull request #91 from crupest/scroll
Fix #90 .
Diffstat (limited to 'Timeline/ClientApp/src/timeline/TimelineItem.tsx')
-rw-r--r-- | Timeline/ClientApp/src/timeline/TimelineItem.tsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Timeline/ClientApp/src/timeline/TimelineItem.tsx b/Timeline/ClientApp/src/timeline/TimelineItem.tsx index 7d488826..215c7b12 100644 --- a/Timeline/ClientApp/src/timeline/TimelineItem.tsx +++ b/Timeline/ClientApp/src/timeline/TimelineItem.tsx @@ -55,6 +55,7 @@ export interface TimelineItemProps { };
onClick?: () => void;
avatarVersion?: number;
+ onResize?: () => void;
}
const TimelineItem: React.FC<TimelineItemProps> = (props) => {
@@ -62,7 +63,7 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { const current = props.current === true;
- const { more } = props;
+ const { more, onResize } = props;
const avatarUrl = useAvatarUrlWithGivenVersion(
props.avatarVersion,
@@ -117,7 +118,7 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { className="float-right float-sm-left mx-2"
to={'/users/' + props.post.author.username}
>
- <img src={avatarUrl} className="avatar rounded" />
+ <img onLoad={onResize} src={avatarUrl} className="avatar rounded" />
</Link>
{(() => {
const { content } = props.post;
@@ -125,7 +126,11 @@ const TimelineItem: React.FC<TimelineItemProps> = (props) => { return content.text;
} else {
return (
- <img src={content.url} className="timeline-content-image" />
+ <img
+ onLoad={onResize}
+ src={content.url}
+ className="timeline-content-image"
+ />
);
}
})()}
|