Skip to content

Commit 1ac7fe6

Browse files
authored
fix: empty list crash (#19)
1 parent b99816c commit 1ac7fe6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,16 @@ export class ScrollBottomSheet<T extends any> extends Component<Props<T>> {
695695
const { method, args } = imperativeScrollOptions[
696696
this.props.componentType
697697
];
698-
// @ts-ignore
699-
this.props.innerRef.current?.getNode()[method](args);
698+
if (
699+
(this.props.componentType === 'FlatList' &&
700+
(this.props?.data?.length || 0) > 0) ||
701+
(this.props.componentType === 'SectionList' &&
702+
this.props.sections.length > 0) ||
703+
this.props.componentType === 'ScrollView'
704+
) {
705+
// @ts-ignore
706+
this.props.innerRef.current?.getNode()[method](args);
707+
}
700708
})
701709
),
702710
set(this.dragY, 0),

0 commit comments

Comments
 (0)