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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum ALIGNMENT needs exported to pass values to scrollToAlignment prop with TypeScript #68

Open
mts opened this issue Nov 21, 2018 · 6 comments

Comments

@mts
Copy link

mts commented Nov 21, 2018

Hello 聽馃檪

I am using react-tiny-virtual-list in a real-world TypeScript project.

Apparently the type of scrollToAlignment prop has changed from string in v2.1.4 to enum ALIGNMENT in v2.2.0 and scrollToAlignment props which is not available at the moment in TypeScript because enum ALIGNMENT is not exported in index.d.ts

I could only use scrollToAlignment prop with a value of appropriate type namely enum ALIGNMENT as follows:

in some-project > node_modules/react-tiny-virtual-list/types/index.d.ts

export { DIRECTION as ScrollDirection, ALIGNMENT as scrollAlignment } from './constants';

in some-project > some-component

<VirtualList
    width="99%"
    height={100}
    itemCount={5}
    itemSize={30}
    scrollToIndex={0}
    renderItem={doSomething}
    scrollToAlignment={scrollAlignment.AUTO}
    onItemsRendered={doSomething}
/>

Appreciated if scrollToAlignment is available to use in TypeScript in v2.2.0.

I made the following PR to offer a solution to this issue:
https://github.com/clauderic/react-tiny-virtual-list/pull/69

@mts mts changed the title ALIGNMENT enumeration needs exported to pass values to scrollToAlignment prop with TypeScript enum ALIGNMENT needs exported to pass values to scrollToAlignment prop with TypeScript Nov 21, 2018
@stephenotalora
Copy link

+1 is there anyway this can be prioritize? the only way to currently make this to work with typescript is by declaring an enum that duplicates the existing ALIGNMENT constant. is there anyway this can be exposed?

@stephenotalora
Copy link

@clauderic are you the maintainer of this repo? there's already a PR for this #69 is there any way this can be merged and released to npm?

@stephenotalora
Copy link

@mts any reason why #69 was never merged?

@mts
Copy link
Author

mts commented Apr 13, 2019

@stephenotalora No idea. As a workaround, you can fork the repo, apply the changes you need and change your project's dependency for the time being to your fork instead if you like.

@stephenotalora
Copy link

stephenotalora commented Apr 14, 2019

thanks @mts, that's what I ended up doing 馃檹 too bad the repo seems to have been abandoned...

@jigsawye
Copy link

FYI, here is my workaround:

 scrollToAlignment={'auto' as any}

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

No branches or pull requests

3 participants