react-native -- ScrollView

作者: Miss_Fairy | 来源:发表于2017-08-18 16:00 被阅读0次

ScrollView 的一些常用属性值
1.contentContainerStyle 这些样式会应用到一个内层容器上,所有的子视图都会包裹在内容容器内。

return(
  <ScrollView contentContainerStyle={styles.contentContainer}>
</ScrollView>
)
const styles = StyleSheet.create({
  contentContainer: {
      paddingVertical:20
  }
})

2.horizontal 当此属性为true的时候,所有的子视图会在水平方向上排成一行,而不是默认的在垂直方向上排成一列。默认值是false。
3.onContentSizeChange 此函数会在ScrollView内容可滚动内容师徒发生变化时调用。
调用参数为内容视图的宽和高:(contentWidth,contentHeight)
此方法是通过绑定在内容容器上的onLayout来实现的。
4.onMomentumScrollStart 滚动动画开始时调用此函数。
5.onMomentumScrollEnd 滚动动画结束时调用此函数。
6.refrshControl 指定RefreshControl 组件,用于为ScrollView提供下拉刷新功能。
7.showHorizontalScrollIndicator 当此属性为true时,显示一个水平方向的滚动条。
8.showVerticalScrollIndicator 当此属性为true时,显示一个垂直方向的滚动条。
9.pagingEnabled 当值为true时,滚动条会停在滚动视图的尺寸的整数倍位置,这个可以用在水平分页上。默认值为false。

相关文章

网友评论

    本文标题:react-native -- ScrollView

    本文链接:https://www.haomeiwen.com/subject/zcearxtx.html