question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to controll the scroll outside the list

See original GitHub issue

Hi, recently I use react-window in my project, it works perfect if the scroll event is listened by the List self, but if I wrapped the List with div/Tab, how to hide the list’s scrollbar and make the parent div to take control of scrolling? The main part of the code is like this:

<div ref={outerRef} style={{overflow:'auto',height:'200px'}} onScroll={scrollCheck}>
        <Tab
            defaultActiveKey='tab1'
            onChange={(key)=>{ console.log("onChange====",key)}}
            >
                <Tab.TabPane tab="hot" tabKey="tab1" >
                    <FixedSizeList
                        className={'demo'}
                        height={200}
                        itemSize={40} 
                        itemData={itemData}
                        width={300}
                        outerRef={outerRef}
                    />
                </Tab.TabPane>
                <Tab.TabPane tab="newest" tabKey="tab2" >
                    <div style={{background: '#368AD9', color: '#fff', padding: '15px' }}>
                        2...
                    </div>
                </Tab.TabPane>
        </Tab>
    </div>

the render effect is like this, now I have two scrollbars

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
martynaskadisacommented, Apr 19, 2020

You can use WindowScroller component from react-virtualized: https://codesandbox.io/s/vy620pkzzy

https://github.com/bvaughn/react-window/issues/30

3reactions
311chaoscommented, Apr 19, 2020

I would love to see an example of something like WindowScroller in react-window. I attempted to do something with the scroll listener on the parent, but I ended up with a mess.

I guess I am mostly commenting to follow in the case that someone out there has got this to work with react-window and is willing to share a codesandbox or something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable scrolling in outer elements? - Stack Overflow
This allows you to scroll a list within an outer list, or you can change the outer list to the document to do...
Read more >
Prevent Scroll On Scrollable Elements [JS & CSS] - Alvaro Trigo
1. Cancelling scroll using JavaScript ... One of the options is to listen to the wheel event on the element you want to...
Read more >
Prevent Scroll Chaining With Overscroll Behavior
How to prevent scroll chaining with overscroll-behavior property in CSS.
Read more >
How to fight the <body> scroll. First of all - Medium
Oh! That's super easy — style="overflow:hidden" on body. overflow:hidden will remove the scrollbars (they are hidden), and block the scroll, as long this ......
Read more >
How to disable scrolling temporarily using JavaScript
In this method, a new CSS class is created where the height is set to 100%, and the scroll bar is disabled by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found