-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I cant calc the dom size #93
Labels
Comments
Please provide some codes to show your usecase, I'm hardly understand your problem. |
useEffect(() => {
const virtualListEle: HTMLDivElement = listContainerRef.current
containerHeight$.next(virtualListEle.clientHeight)
const actualRow$ = combineLatest(containerHeight$, props.options$).pipe(
map(([ch, { height }]) => Math.ceil(ch / height)),
)
const dataInViewSlice$ = combineLatest(props.data$, actualRow$).pipe(
map(([data, actualRows]) => data.slice(0, actualRows)),
)
const scrollHeight$ = combineLatest(props.data$, props.options$).pipe(
map(([data, { height }]) => data.length * height),
)
sub.add(
combineLatest(dataInViewSlice$, scrollHeight$).subscribe(
([data, height]) => {
setData(data)
seHeight(height)
},
),
)
return () => {
sub.unsubscribe()
}
}, [listContainerRef.current]) |
It seems that rxjs-hooks isn't suitable for this case. So you may have to do the thing in your own style. |
ok tks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useObservable is never use in useEffect, but i wanna calc the dom size without some event
The text was updated successfully, but these errors were encountered: