Skip to content

Commit 52c189b

Browse files
author
刘欢
committed
feat:修改判断内容
1 parent dd7acdb commit 52c189b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/List.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
112112
innerProps,
113113
extraRender,
114114
styles,
115+
showScrollBar = 'optional',
115116
...restProps
116117
} = props;
117118

@@ -640,7 +641,7 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
640641
containerSize={size.height}
641642
style={styles?.verticalScrollBar}
642643
thumbStyle={styles?.verticalScrollBarThumb}
643-
showScrollBar={restProps?.showScrollBar}
644+
showScrollBar={showScrollBar}
644645
/>
645646
)}
646647

@@ -659,7 +660,7 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
659660
horizontal
660661
style={styles?.horizontalScrollBar}
661662
thumbStyle={styles?.horizontalScrollBarThumb}
662-
showScrollBar={restProps?.showScrollBar}
663+
showScrollBar={showScrollBar}
663664
/>
664665
)}
665666
</div>

src/ScrollBar.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ScrollBar = React.forwardRef<ScrollBarRef, ScrollBarProps>((props, ref) =>
3939
containerSize,
4040
style,
4141
thumbStyle: propsThumbStyle,
42-
showScrollBar = 'optional',
42+
showScrollBar,
4343
} = props;
4444

4545
const [dragging, setDragging] = React.useState(false);
@@ -53,17 +53,16 @@ const ScrollBar = React.forwardRef<ScrollBarRef, ScrollBarProps>((props, ref) =>
5353
const thumbRef = React.useRef<HTMLDivElement>();
5454

5555
// ======================= Visible ========================
56-
const [visible, setVisible] = React.useState(false);
56+
const [visible, setVisible] = React.useState(showScrollBar === true);
5757
const visibleTimeoutRef = React.useRef<ReturnType<typeof setTimeout>>();
5858

5959
const delayHidden = () => {
60+
if (showScrollBar === true) return;
6061
clearTimeout(visibleTimeoutRef.current);
6162
setVisible(true);
62-
if (showScrollBar === 'optional') {
63-
visibleTimeoutRef.current = setTimeout(() => {
64-
setVisible(false);
65-
}, 3000);
66-
}
63+
visibleTimeoutRef.current = setTimeout(() => {
64+
setVisible(false);
65+
}, 3000);
6766
};
6867

6968
// ======================== Range =========================

0 commit comments

Comments
 (0)