Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source map is missing #9

Open
vdh opened this issue Apr 3, 2020 · 10 comments · May be fixed by #11
Open

Source map is missing #9

vdh opened this issue Apr 3, 2020 · 10 comments · May be fixed by #11

Comments

@vdh
Copy link

vdh commented Apr 3, 2020

node_modules/react-double-scrollbar/dist/DoubleScrollbar.js has:

//# sourceMappingURL=DoubleScrollbar.js.map

But DoubleScrollbar.js.map is not included in the release.

@willnode
Copy link

willnode commented May 4, 2020

Me too. Having a warning generated when building from Parcel.

‼  Could not load existing sourcemap of "../node_modules/react-double-scrollbar/dist/DoubleScrollbar.js".

@lfsando
Copy link

lfsando commented Aug 9, 2020

Also having the same issue

@bujoriosif
Copy link

Same issue here

1 similar comment
@dogeow
Copy link

dogeow commented Jan 25, 2021

Same issue here

@mithusingh32
Copy link

@umchee I can create a PR for the fix. Just a simple missing file.

@frankadrian
Copy link

Hi, facing the same issue here, is this project still being maintained?

@moonbe77
Copy link

ATM found this workaround, it is related to another library but it worked for me. mswjs/msw#1030 (comment)

@German919
Copy link

estoy teniendo el mismo error... como puedo solucionarlo

@GersonDias
Copy link

pleeease press the button and deploy this source map to NPM!

@milanchymcak
Copy link

pleeease press the button and deploy this source map to NPM!

You can fork it and create your own component out of it. I added the height: "0px" so its good looking and made it typescript friendly

import React from 'react';

interface DoubleScrollbarProps {
    children: React.ReactNode;
}

interface DoubleScrollbarState {
    width: string;
}

class DoubleScrollbar extends React.Component<DoubleScrollbarProps, DoubleScrollbarState> {
    outerDiv: React.RefObject<HTMLDivElement>;
    innerDiv: React.RefObject<HTMLDivElement>;
    childrenWrapper: React.RefObject<HTMLDivElement>;
    boundCalculateWidth: () => void;

    constructor(props: DoubleScrollbarProps) {
        super(props);
        this.state = {
            width: "auto"
        };

        this.outerDiv = React.createRef();
        this.innerDiv = React.createRef();
        this.childrenWrapper = React.createRef();

        this.boundCalculateWidth = this.calculateWidth.bind(this);
    }

    componentDidMount() {
        const outerDiv = this.outerDiv.current;
        const childWrapper = this.childrenWrapper.current;

        // Set initial width
        this.calculateWidth();

        // Update width when window size changes
        window.addEventListener("resize", this.boundCalculateWidth);

        // Associate the scrolls
        if (outerDiv && childWrapper) {
            outerDiv.onscroll = () => {
                childWrapper.scrollLeft = outerDiv.scrollLeft;
            };

            childWrapper.onscroll = () => {
                outerDiv.scrollLeft = childWrapper.scrollLeft;
            };
        }
    }

    componentWillUnmount() {
        window.removeEventListener("resize", this.boundCalculateWidth);
    }

    componentDidUpdate() {
        this.calculateWidth();
    }

    calculateWidth() {
        const width = this.getChildWrapperWidth() || "auto";

        // Set the width of the inner div to the first child's
        if (width !== this.state.width) {
            this.setState({ width });
        }
    }

    getChildWrapperWidth() {
        if (this.childrenWrapper.current) {
            return `${this.childrenWrapper.current.scrollWidth}px`;
        }
        return null;
    }

    render() {
        const outerDivStyle: React.CSSProperties = { overflowX: "auto", overflowY: "hidden" };
        const innerDivStyle: React.CSSProperties = { paddingTop: "1px", width: this.state.width, height: "0px" };
        const childDivStyle: React.CSSProperties = { overflow: "auto", overflowY: "hidden" };

        return (
            <div>
                <div ref={this.outerDiv} style={outerDivStyle}>
                    <div ref={this.innerDiv} style={innerDivStyle}>&nbsp;</div>
                </div>
                <div ref={this.childrenWrapper} style={childDivStyle}>
                    {this.props.children}
                </div>
            </div>
        );
    }
}

export default DoubleScrollbar;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet