action Pressable tag not call when i click image in carousel in expo 52
Author: AnhPhammmCreated Jan 23, 2025Updated Apr 29, 2025
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>
)Source: meliorence/react-native-snap-carousel