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

onSnapToItem not called if loop={false} #1

Closed
kylegillen opened this issue Oct 7, 2021 · 2 comments
Closed

onSnapToItem not called if loop={false} #1

kylegillen opened this issue Oct 7, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@kylegillen
Copy link

Hi. Cool component.

I was able to fix the above changing the following, but I didn't do a PR as I didn't take the time to check what the knock-on effects could be. Hope it helps.

useAnimatedReaction(
        () => index.value,
        (i) => {
            if (loop) {
                switch (_data.length) {
                    case 1:
                        i = 0;
                        break;
                    case 2:
                        i = i % 2;
                        break;
                }
                onSnapToItem && runOnJS(onSnapToItem)(i);
            } else {
                onSnapToItem && runOnJS(onSnapToItem)(i);
            }
        },
        [onSnapToItem, loop, _data]
    );
@kylegillen kylegillen changed the title onSnaptToInterval not called if loop={false} onSnapToInterval not called if loop={false} Oct 7, 2021
@kylegillen kylegillen changed the title onSnapToInterval not called if loop={false} onSnapToItem not called if loop={false} Oct 7, 2021
@dohooo
Copy link
Owner

dohooo commented Oct 8, 2021

cool I'll try it

@dohooo dohooo added the bug Something isn't working label Oct 8, 2021
@dohooo
Copy link
Owner

dohooo commented Oct 8, 2021

v5.0

@dohooo dohooo closed this as completed Oct 8, 2021
Repository owner deleted a comment from github-actions bot Nov 6, 2022
dohooo added a commit that referenced this issue Nov 29, 2024
<!-- Is this PR related to an open issue? -->
<!-- GitHub: Fixes #0, Relates to #1, etc. -->

### Description

<!-- Summary of changes and why if no corresponding issue -->

### Review

- [ ] I self-reviewed this PR

<!-- Call out any changes that you'd like people to review or feedback on -->

### Testing

- [ ] I added/updated tests
- [ ] I manually tested

<!-- Describe any manual testing -->
dohooo added a commit that referenced this issue Nov 29, 2024
<!-- Is this PR related to an open issue? -->
<!-- GitHub: Fixes #0, Relates to #1, etc. -->

### Description

<!-- Summary of changes and why if no corresponding issue -->
#709

### Review

- [ ] I self-reviewed this PR

<!-- Call out any changes that you'd like people to review or feedback on -->

### Testing

- [ ] I added/updated tests
- [ ] I manually tested

<!-- Describe any manual testing -->
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