添加添加条件判断

This commit is contained in:
lyswhut 2021-06-05 16:18:42 +08:00
parent 5e15f20d67
commit c1a930f961

View File

@ -44,7 +44,7 @@ export default memo(() => {
// const imgWidth = useMemo(() => layout.width * 0.75, [layout.width])
const handleScrollToActive = useCallback((index = lineRef.current) => {
if (index < 0) return
if (scrollViewRef.current) {
if (scrollViewRef.current && linesRef.current.length <= index + 1) {
try {
scrollViewRef.current.scrollToIndex({
index: index,