我正在使用反应本机复活轮播。在轮播中,我正在渲染图像,当我点击图像时,它不会滚动到该图像。这是代码:
setActiveSlide(index)} renderItem={({ item, index }) => ( carouselRef.current.scrollTo(index)}** activeOpacity={0.1} style={{ backgroundColor: activeSlide !== index ? carouselActiveSlide(index) : "#3887EF", borderWidth: 1, justifyContent: 'center', transform: [{ rotate: "32deg" }], borderRadius: 32, width: 50 }} />
我尝试测试其他事件,如 .next() 、 .prev() ,它们是否按预期工作,但 .scrollTo(index)代码> 不起作用。你能告诉我我错过了什么吗?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号