reactjs - 使用 scrollview 的 react-native 自滚动效果
问题描述
我不确定标题是否准确,但我想在 react-native 中实现类似的东西
注意当用户从右到左快速滚动时它是如何自动滚动一段时间的。
这就是我所拥有的
这就是我的代码的样子
<ScrollView
style={{ ...styles.scrollView }}
horizontal={true}
contentContainerStyle={styles.scrollViewContainer}
showsHorizontalScrollIndicator={false}>
{profileData.map((profile, index) => {
return (
<TouchableWithoutFeedback
key={`${index}Profile`}
onPress={() => setActive(index)}>
<View style={styles.imageCircle}>
<ImageCircle uri={profile.path} active={index === active} />
</View>
</TouchableWithoutFeedback>
);
})}
</ScrollView>
知道如何修复它/在我的组件中应用它吗?下面是相关的样式。
import { StyleSheet, Dimensions } from 'react-native';
const { width } = Dimensions.get('window');
const styles = StyleSheet.create({
scrollView: {
height: 100,
},
scrollViewContainer: {
paddingHorizontal: width * 0.5 - width * 0.1,
},
imageCircle: {
width: width * 0.2,
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
},
});
export default styles;
解决方案
推荐阅读
- opencv - 如何“迭代”计算机视觉机器学习模型?
- r - Pivot_Longer 创建多个组合列
- flask - jinja2.exceptions.TemplateSyntaxError:遇到未知标签'url'
- python - 如何使用内部生成的输入实现 Pyaudio 回调
- c# - 循环 2 个特定列并进行计算计数器,输入另一个 datagridview
- node.js - 猫鼬 startSession() 挂起
- flutter - 相机无法在颤动中检测到中等分辨率的人脸
- blockchain - 在 TomoChain 节点中创建交易时出现“仅支持使用 ipc 发送交易”错误
- php - 按年、月、周和日分组数据
- c# - 为什么我通过 SendGrid 发送的邮件在我发送的项目中不可见?(.net 核心)