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

customizing with trackXRenderer doesn't work because elementRef is missing in props #34

Closed
nathanbamford2 opened this issue Dec 24, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@nathanbamford2
Copy link

nathanbamford2 commented Dec 24, 2018

Hi, this is a great tool, but I can't seem to figure out how to make the custom render for trackX work. When I get the props like in the example:
trackXRenderer={ props => { const {elementRef, ...restProps} = props; return <span {...restProps} className="MyAwesomeTrackVertical" ref={elementRef}/> } }
props only has children, className, onClick, and style, with no elementRef. As a result the scroll doesn't function.

When I look in the code under dist/Track.js, I see this:
props = _objectWithoutProperties(_this$props, ["className", "renderer", "type", "elementRef", "onClick"]); props.className = "track " + (type === TYPE_X ? "trackX" : "trackY") + (className ? " " + className : ""); props.onClick = this.onClickHandler; return renderer ? renderer(props) : _react.default.createElement("div", _extends({}, props, {

It's clearly stripping out the elementRef property before calling my custom render function.

Is this by design? Am I meant to somehow implement the custom render without the elementRef property?

Thanks,

Nathan

xobotyi added a commit that referenced this issue Dec 24, 2018
@xobotyi
Copy link
Owner

xobotyi commented Dec 24, 2018

Thanks for the report, it definitely was a bug.
Fixed in v3.1.4

@xobotyi xobotyi closed this as completed Dec 24, 2018
@xobotyi xobotyi self-assigned this Dec 24, 2018
@xobotyi xobotyi added the bug Something isn't working label Dec 24, 2018
xobotyi added a commit that referenced this issue Dec 24, 2018
First approach was incorrect;
ToDo: cover custom renderers with tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants