meliorence / meliorence/react-native-snap-carousel

action Pressable tag not call when i click image in carousel in expo 52

Open
#1,038 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

when i update to expo 52, carousel not working smooth, something when i call pressable in carousel, function onpress not call,
please fix this problem for me
Here my code:

const handlePressBanner = useCallback(
    async (link: string) => {
      console.log(link, "link1")

      if (!link) {
        return
      }
      if (link.includes("http")) {
        console.log(link, "link2")

        await WebBrowser.openBrowserAsync(link)
        return
      }
      try {
        linkTo(link)
        console.log(link, "link3")
      } catch (e) {
        // eslint-disable-next-line no-console
        console.warn("linkTo error:::", link)
        bugsnagClient?.notify(e as Error, (event) => {
          event.addMetadata("linkTo", { path: link })
        })
      }
    },
    [bannerList],
  )

  const renderItem = useCallback(
    ({ item }: { item: TOEGetBanner }) => (
      <Pressable
        onPress={() => console.log('1111')
        }
        rounded="xl"
        overflow="hidden"
        disabled={!item.banner_link_url_app}
        style={{
          width: itemWidth,
          aspectRatio: 1200 / 525,
          backgroundColor: "red",
        }}
      >
        <ResponsiveImage
          uri={item.banner_image_url}
          width={itemWidth}
          resizeMode="contain"
        />
      </Pressable>
    ),
    [handlePressBanner, bannerList],
  )

  if (!bannerList) {
    return null
  }

  return (
    <Box py={4}>
      {/* eslint-disable-next-line */}
      {/* @ts-ignore */}
      <Carousel
        ref={ref}
        data={bannerList}
        swipeThreshold={100}
        renderItem={renderItem} 
        itemWidth={itemWidth}
        sliderWidth={width}
        loop
        autoplay
        autoplayInterval={5000}
        inactiveSlideScale={0.8}
        useScrollView
      />
    </Box>
  )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Expo 52 behavior with the provided Carousel, Pressable, and ResponsiveImage example, focusing on the renderItem interaction and useScrollView configuration. Trace whether the image receives or prevents the press event, and consider the issue done when pressing a carousel image reliably triggers onPress without breaking swiping.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.