Reactjs 您在a上指定了“onScroll”<;滚动视图>;但不是“滚动油门”`
我正在代码中使用react native的滚动视图Reactjs 您在a上指定了“onScroll”<;滚动视图>;但不是“滚动油门”`,reactjs,react-native,scrollview,react-native-scrollview,Reactjs,React Native,Scrollview,React Native Scrollview,我正在代码中使用react native的滚动视图 <ScrollView style={styles.productlist} > <CarouselComponent images={images}/> </ScrollView> 您可能正在使用较旧版本的react native looped carousel。在github上,有一个27天前修复的描述您的问题的 修复: 更新到最新版本的react native looped caro
<ScrollView style={styles.productlist} >
<CarouselComponent images={images}/>
</ScrollView>
您可能正在使用较旧版本的
react native looped carousel
。在github上,有一个27天前修复的描述您的问题的
修复:
更新到最新版本的
react native looped carousel
应该可以解决您的问题。或者,您可以通过手动添加scrollEventThrottle来修复错误。请参阅。您的代码中没有任何错误,问题包含在react native looped carousel
中,原因如下:
我建议你另找一个图书馆。React native的代码以非常快的速度增长,每个库都应该经常更新
为了了解一些新内容,scrollEventThrottle
prop定义了在滚动时触发onScroll
事件的次数。数字越大,事件被触发的次数越少16
是最精确的值。CarouseComponent/ReviewComponent的内部是什么?CarouseComponent渲染图像的内部是什么?ReviewComponent渲染用户评论的内部是什么。您是否使用带onScroll方法的ScrollView?可能,CarouseComponent
本身就是一个ScrollView,您可以共享CarouselComponent
code吗?不,这些只是只返回Carousel的功能组件。我使用的是最新版本的'react native looped Carousel`@RaviSharma您是对的,修复程序尚未发布。您仍然可以手动修复它。
const renderImages = (image, index) => {
return (
<Image
key={index}
style={styles.carouselImage}
source={{ uri: image.large }}
/>
);
}
const CarouselComponent = (props) => {
const { images: { alternate = [] } = {} } = props;
if (alternate.length > 0) {
return (
<Carousel
delay={3000}
autoplay
style={styles.carouselLayout}
bullets
chosenBulletStyle={globalStyle.proDetCarSelectBullet}
bulletStyle={globalStyle.productDetailBullet}
bulletsContainerStyle={globalStyle.proDetCarBullet}
isLooped
currentPage={0}
>
{alternate.map((image, index) => renderImages(image, index))}
</Carousel>
);
}
return null;
}