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

Non-standard implementation #39

Closed
NewOldMax opened this issue Feb 24, 2017 · 8 comments
Closed

Non-standard implementation #39

NewOldMax opened this issue Feb 24, 2017 · 8 comments

Comments

@NewOldMax
Copy link

Hi! Thanks for this awesome library!
Can I build something like this with it?
asd24

@bd-arc
Copy link
Contributor

bd-arc commented Feb 24, 2017

@NewOldMax Absolutely :) The only distinctive characteristic of your example is the background animation. In order to do that, you'll need to rely on the onSnapToItem prop. It will then be easy to update the color based on current slide's index.

Still, be aware that, as stated in this issue, the callback will be fired immediately after clicking. If this is not a deal-breaker for you, you're good to go.

Do not hesitate to share your experimentations!

@bd-arc bd-arc closed this as completed Feb 24, 2017
@NewOldMax
Copy link
Author

I already implemented it :)
It works fine with touches, but I have some issues with swipe, for example, i can't swipe to end of carousel at one time, or sometimes position of last element is wrong
asd25

@bd-arc
Copy link
Contributor

bd-arc commented Feb 24, 2017

@NewOldMax Cool ;) Regarding your issues:

  • Scroll inertia varies depending on slide's size relative to viewport's size, e.g. the larger your slide is, the more difficult it is to swipe more than one slide at a time. You can try playing with this ScrollView prop and see if it helps.

  • The positioning issue is clearly the same as Slider shift when item clicked #33, but I wasn't able to reproduce it, either on a simulator nor a real device... Would you mind sharing the source code of your project so I can take a look at it? You can mail a zip file to me if you don't want it to go public ;)

@NewOldMax
Copy link
Author

Would you mind sharing the source code of your project so I can take a look at it?

I'll create some reproduction component on next week.

You can try playing with this ScrollView prop and see if it helps.

Unfortunately I'm working only with android, so this prop couldn't help me :(

@bd-arc
Copy link
Contributor

bd-arc commented Feb 24, 2017

Unfortunately I'm working only with android, so this prop couldn't help me :(

And does playing with enableMomentum change anything for you?

@NewOldMax
Copy link
Author

As I remember, with momentum behavior was strange, but I'm not sure

@NewOldMax
Copy link
Author

NewOldMax commented Feb 27, 2017

Seems to I fixed wrong offset with dynamic changing width of items.

const itemWidth = width * (index === 2 ? 0.6 : 0.65);

where index - index of selected item, index = 2 - my last item, and width - screen width
After this I can't reproduce case with wrong position.

@bd-arc
Copy link
Contributor

bd-arc commented Feb 27, 2017

@NewOldMax Ok, good to know. I confirm that dynamically changing items' width will lead to issues since this value is critical for snap thresholds' calculation and must remain the same for all items.

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

2 participants