Skip to content

Can't use <ol> element as contentElement #129

Open
@billerr

Description

@billerr

What is the current behavior?

I'm trying to output an <ol> element as my content element, using contentProps as in the docs. However, the ref type shows an incompatibility error:

Type 'ElementRef<HTMLDivElement> | undefined' is not assignable to type 'string | ((instance: HTMLOListElement | null) => void) | RefObject<HTMLOListElement> | null | undefined'.

Maybe I'm doing something wrong, or I need to override the default ElementRef generic type,, but I couldn't get more info on howw to do this from the docs.

Steps to reproduce it :
Here is the code (the error shows up on the "ref" prop):

<Scrollbar 
    noScrollX 
    removeTrackXWhenNotUsed 
    mobileNative 
    onUpdate={ scrollHandler } 
    contentProps={{
        renderer: ({ elementRef, ...props}) =>(
            <ol {...props} className="Form__stepList" ref={ elementRef } />
        )
    }}>
    <li ...></li>
    <li ...></li>
    <li ...></li>
</Scrollbar>

What is the expected behavior?
I should be able to substitute the default <div> element for the contentElement with an <ol> element.

A little about versions:

  • OS: Windows 10
  • Browser (vendor and version): Electron (latest)
  • React: 16.9 (w Typescript)
  • react-scrollbars-custom: latest
  • Did this worked in the previous package version? don't know

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions