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

useListTransition 初始化key #14

Open
muyeyong opened this issue Apr 21, 2022 · 6 comments
Open

useListTransition 初始化key #14

muyeyong opened this issue Apr 21, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@muyeyong
Copy link

muyeyong commented Apr 21, 2022

如果像这样使用useListTransition(list, **300)
const keyRef = useRef(0); // change list to our list form with extra information. const initialList: Array<ItemWithState<Item>> = list.map((item, key) => ({ item, key: keyRef.current, stage: 'enter', }));
会导致key重复

@iamyoki iamyoki added the bug Something isn't working label Apr 22, 2022
@iamyoki iamyoki self-assigned this Apr 22, 2022
@iamyoki
Copy link
Owner

iamyoki commented Apr 22, 2022

Thank you. The useListTransition api hasn't been officially released, but it's apparently exists in the library, it's still in designing progress and will come with transition-hook v2, stay tuned~

@Imfahrenheit
Copy link

@iamyoki I was looking for an example image slider or carousel using your lib. So far I could not manage to produce something usable.

@iamyoki
Copy link
Owner

iamyoki commented May 23, 2022

@Imfahrenheit Could you produce a codesandbox example of your carousel? I would complete it for you.

@Imfahrenheit
Copy link

Imfahrenheit commented May 23, 2022

@iamyoki Thanks for the prompt response! I quickly created a codesandbox for you to give me some pointers. The carousel should slide left or right based on prev or next direction.

@iamyoki
Copy link
Owner

iamyoki commented May 23, 2022

@Imfahrenheit Take a look https://codesandbox.io/s/transition-hook-experiement-complete-boo32y?file=/src/Slider.tsx

@Imfahrenheit
Copy link

@Imfahrenheit Take a look https://codesandbox.io/s/transition-hook-experiement-complete-boo32y?file=/src/Slider.tsx

perfect! Thanks a lot, now I don't need to use react-transition-group for this.

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

3 participants