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

[REGRESSION] The onClick function of <Pagination.Basic> doesn't work #676

Closed
qwertychouskie opened this issue Sep 14, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@qwertychouskie
Copy link

f41173c introduced a regression where the onClick doesn't fire when clicking the dots of the <Pagination.Basic> component.

As per facebook/react-native#10180 (comment), the issue is that React Native's built-in <TouchableWithoutFeedback> needs the child to be a <View>, not a custom component. Either revert the offending commit, or wrap the <PaginationItem> in a <View>.

Oddly enough, <Pagination.Custom> still imports <TouchableWithoutFeedback> from react-native-gesture-handler, and therefore using <Pagination.Custom> is a viable workaround for now.

@qwertychouskie qwertychouskie added the bug Something isn't working label Sep 14, 2024
Copy link

dosubot bot commented Sep 14, 2024

I found a similar closed issue that might be relevant to your problem. The issue titled "Hi" was last updated on July 06, 2022. This issue was referenced by:

Regarding the regression introduced in commit f41173cc5d374a94e9757214fe98270ad2661259, it appears that the onClick function of <Pagination.Basic> is not working because React Native's <TouchableWithoutFeedback> requires its child to be a <View>, not a custom component.

To resolve this issue, you have a couple of options:

  1. Revert the Commit: Reverting the commit that introduced the regression.
  2. Wrap <PaginationItem> in a <View>: Modify the code to wrap the <PaginationItem> in a <View>.

As a temporary workaround, you can use <Pagination.Custom>, which imports <TouchableWithoutFeedback> from react-native-gesture-handler and still functions correctly.

Here is an example of how you might wrap the <PaginationItem> in a <View>:

<TouchableWithoutFeedback
  key={index}
  onPress={() => onPress?.(index)}
>
  <View>
    <PaginationItem
      index={index}
      size={size}
      count={data.length}
      dotStyle={dotStyle}
      animValue={progress}
      horizontal={!horizontal}
      activeDotStyle={activeDotStyle}
    >
      {renderItem?.(item, index)}
    </PaginationItem>
  </View>
</TouchableWithoutFeedback>

This should ensure that the onClick event fires correctly.

To continue talking to Dosu, mention @dosu.

nmassey added a commit to nmassey/react-native-reanimated-carousel that referenced this issue Sep 15, 2024
nmassey added a commit to nmassey/react-native-reanimated-carousel that referenced this issue Sep 15, 2024
nmassey added a commit to nmassey/react-native-reanimated-carousel that referenced this issue Sep 15, 2024
@nmassey
Copy link
Contributor

nmassey commented Sep 15, 2024

As per Discord (here), @qwertychouskie - are you able to review the proposed fix here?

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