reactjs - 您在 a 上指定了 `onScroll`但不是`scrollEventThrottle`
问题描述
我在我的代码中使用了 react-native 的 Scrollview 。
<ScrollView style={styles.productlist} >
<CarouselComponent images={images}/>
</ScrollView>
它在应用程序上运行良好,没有错误也没有警告,但在控制台中我反复收到以下消息:
您指定
onScroll
了 a 但不是scrollEventThrottle
。您只会收到一个事件。使用16
您获取所有事件,但请注意它可能会导致丢帧,如果您不需要那么高的精度,请使用更大的数字。
不知道缺少什么,我没有通过 onScroll 道具但仍然收到此消息。任何建议...
我的轮播组件代码是:
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;
}
解决方案
推荐阅读
- python - python在运行时生成GUI
- javascript - 使用 react-testing-library 时关于 setTimeout 的断言
- linux-kernel - u-boot.elf 和 u-boot 之间的混淆
- go - 当客户端取消连接时,Nginx(作为反向代理)不通知 gin-gonic(作为 Web 服务器)
- python - 如何验证 Python 和 Google Sheets API
- spring - 如何为多个表创建 JPA 规范?
- python-3.x - 导入与包同名的模块
- linux - 如何创建名称中包含输入的文件
- django - 结合两个变量过滤器 Django
- powershell - 调用多个脚本时不发送电子邮件