Disable Auto init from DOM
I'm mainly using simplebar-react, but in one specific case I also have to initialize simplebar via vanila JS package.
Before extracting simplebar-core as separate everything was working fine because of SimpleBar.instances check. But right now I'm getting 2 scrollbars instead of 1.
So, is it possible to add an option to disable auto init from DOM elements? or disable MutationObserver after initialization?
Hi @Nicolai8
I see how that can be an issue with the latest version. Maybe you can try adding data-simplebar="init" to the element that gets instantiated 2 times, it should prevent the vanilla SimpleBar from instantiating again.
Let me know if that works!
Sorry, I reverted back to previous version and completely forgot about the raised issue on the GitHub.
Was trying recently to update lib again.
There are few things with data-simplebar="init" approach:
- I can't add it to the
<SimpleBar />react component because in the Observer watcher it will trigger new instance initiation without check if it's initialized or not - so, I have to wrap
<SimpleBar />with<div data-simplebar="init" />- this fix an issue visually, but: *also generates massive amount of unnecessary HTML:
- have to rework, some components