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

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

Open
AnhPhammm opened this issue Jan 23, 2025 · 0 comments
Open

Comments

@AnhPhammm
Copy link

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>
  )
@AnhPhammm AnhPhammm changed the title action Pressable tag not call when i click to image in carousel in expo 52 action Pressable tag not call when i click image in carousel in expo 52 Jan 23, 2025
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

1 participant