mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
parent
740d9b796e
commit
7252c7c1da
@ -161,6 +161,14 @@ class ChatWindow extends Component<
|
||||
}
|
||||
}
|
||||
|
||||
onTopLoaded = () => {
|
||||
const { graphSize, unreadCount } = this.props;
|
||||
console.log(graphSize, unreadCount);
|
||||
if(graphSize >= unreadCount) {
|
||||
this.props.dismissUnread();
|
||||
}
|
||||
};
|
||||
|
||||
onBottomLoaded = () => {
|
||||
if(this.state.unreadIndex.eq(bigInt.zero)) {
|
||||
this.calculateUnreadIndex();
|
||||
@ -274,6 +282,7 @@ class ChatWindow extends Component<
|
||||
origin='bottom'
|
||||
style={virtScrollerStyle}
|
||||
onBottomLoaded={this.onBottomLoaded}
|
||||
onTopLoaded={this.onTopLoaded}
|
||||
// @ts-ignore paging @liam-fitzgerald on virtualscroller props
|
||||
onScroll={this.onScroll}
|
||||
data={graph}
|
||||
|
@ -90,6 +90,11 @@ export interface VirtualScrollerProps<K,V> {
|
||||
* Callback to execute when finished loading from start
|
||||
*/
|
||||
onBottomLoaded?: () => void;
|
||||
/*
|
||||
* Callback to execute when finished loading from end
|
||||
*/
|
||||
onTopLoaded?: () => void;
|
||||
|
||||
/*
|
||||
* equality function for the key type
|
||||
*/
|
||||
@ -413,6 +418,9 @@ export default class VirtualScroller<K,V> extends Component<VirtualScrollerProps
|
||||
if(newer && this.props.onBottomLoaded) {
|
||||
this.props.onBottomLoaded();
|
||||
}
|
||||
if(!newer && this.props.onTopLoaded) {
|
||||
this.props.onTopLoaded();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user