Skip to content

Conversation

@nmassey
Copy link
Contributor

@nmassey nmassey commented Sep 15, 2024

Overview of the bug

As per #676, v4.0.0-canary.13 accidentally introduced a bug that caused the click events on Pagination.Basic to no longer work.

This appears to have been accidentally introduced in #655

Thanks to @qwertychouskie for reporting here:

Why

From the TouchableWithoutFeedback docs:

Importantly, TouchableWithoutFeedback works by cloning its child and applying responder props to it. It is therefore required that any intermediary components pass through those props to the underlying React Native component.

What: the fix

  1. in Pagination.Custom, standardize by importing TouchableWithoutFeedback from react-native (like we already do for Pagination.Basic)
  2. for both Pagination.Basic and Pagination.Custom, lower the <TouchableWithoutFeedback> wrapper to inside of PaginationItem so that it is immediately around the target <View> (or <Animated.View>) instead

Why

When using TouchableWithoutFeedback, it's important to keep <TouchableWithoutFeedback> immediately around the child <View> component.

Suggestion for reviewer

As a bulk of the changeset is just whitespace changes, I suggest reviewing this PR with whitespace hidden -

image

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2024

🦋 Changeset detected

Latest commit: 00c948b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-native-reanimated-carousel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-reanimated-carousel ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 15, 2024 4:46am

@nmassey nmassey marked this pull request as ready for review September 15, 2024 04:51
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 15, 2024
@nmassey nmassey changed the title fix PaginationItem onPress (both Pagination.Basic and Pagination.Custom) fix: PaginationItem onPress (both Pagination.Basic and Pagination.Custom) Sep 15, 2024
@nmassey
Copy link
Contributor Author

nmassey commented Sep 15, 2024

A potential alternative solution -
Something like ...props on PaginationItem and forwarded to its child (e.g. <View {...props}> or <Animated.View {...props}>) might work (see StackOverflow here: https://stackoverflow.com/a/68952082 ). But this feels a little clunkier to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants