Skip to content

Commit

Permalink
fix(AnalyticalTable): don't crash if scrollTo methods are not defined (
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusNotheis authored May 15, 2020
1 parent bea48ae commit 636d507
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ export const useTableScrollHandles = (ref) => {
if (analyticalTableRef.current) {
Object.assign(analyticalTableRef.current, {
scrollTo: (offset, align) => {
reactWindowRef.current.scrollToOffset(offset, { align });
if (typeof reactWindowRef.current?.scrollToOffset === 'function') {
reactWindowRef.current.scrollToOffset(offset, { align });
}
},
scrollToItem: (index, align) => {
reactWindowRef.current.scrollToIndex(index, { align });
if (typeof reactWindowRef.current?.scrollToIndex === 'function') {
reactWindowRef.current.scrollToIndex(index, { align });
}
}
});
}
Expand Down

0 comments on commit 636d507

Please sign in to comment.