水平ScrollView在React Native中无法直接实现滚动的原因是,React Native的ScrollView组件默认只支持垂直滚动,并没有提供直接支持水平滚动的属性或方法。因此,如果需要实现水平滚动,需要使用HorizontalScrollView组件。 HorizontalScrollView组件可以通过设置horizontal属性为true来实现水平滚动。
View:React Native中最基础的组件,用于布局和样式化。 相关优势 灵活性:可以包含任意数量的子组件。 性能优化:通过只渲染屏幕上的内容来提高性能。 易于使用:简单的API使得集成滚动功能变得容易。 类型 垂直滚动:默认情况下,ScrollView支持垂直滚动。 水平滚动:通过设置horizontal属性为true,可以实现水平滚动。
额,还有ScrollView有的属性,ListView都有;所有horizontal、refreshControl,都可以个ListView设置。 基本属性就这些,更多属性参考:http://reactnative.cn/docs/0.45/listview.html#content 分组显示 /** * Created by blueberry on 6/9/2017. * * @flow */ import React, {Component} from 'react'; import {AppR...
ref="scrollView"horizontal={true} pagingEnabled={true}//当一帧滚动结束onMomentumScrollEnd={(e)=>this.onAnimationEnd(e)}//开始拖拽onScrollBeginDrag={this.onScrollBeginDrag}//停止拖拽onScrollEndDrag={this.onScrollEndDrag}>{this.renderAllImage()}</ScrollView> <View style = {styles.pageViewStyle}...
React Native 滚动视图 组件封装了滚动视图平台,同时提供了与锁定“应答”系统的触摸的集成。 尚不支持其他来自阻止滚动视图成为响应者的包含的响应。 Props Edit on GitHub alwaysBounceHorizontal布尔型 当为真时,滚动视图到达内容底部时,水平反弹,即使该内容小于滚动视图。当horizontal={true}时,默认值为 true,否则,...
如果您使用react-native-gesture-handler,还有一种更简单的解决方案 import { ScrollView } from 'react-native' import { ScrollView as GestureHandlerScrollView } from 'react-native-gesture-handler' <ScrollView horizontal> <GestureHandlerScrollView horizontal /> </ScrollVIew> Run Code Online (Sandbox Code ...
React Native中的组件ScrollView类似于iOS中的UIScrollView,其基本的使用方法和熟悉如下:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 ...
ScrollView> component', render: function() { return ( <ScrollView onScroll={() => { console.log('onScroll!'); }} scrollEventThrottle={200} contentInset={{top: -50}} style={styles.scrollView}> {THUMBS.map(createThumbRow)} </ScrollView> ); } }, { title: '<ScrollView> (horizontal ...
是否可以获得当前滚动位置,或者 React Native 中<ScrollView>组件的当前页面? 所以像: <ScrollView horizontal={true} pagingEnabled={true} onScrollAnimationEnd={() => { // get this scrollview's current page or x/y scroll position }}> this.state.data.map(function(e, i) { ...
所以我在视图顶部有一个水平滚动视图。 ScrollView 包含具有指定宽度的节点。然后我在 ScrollView 的底部有一个边框,就像你在这个屏幕截图中看到的那样:http: //i.imgur.com/pOV1JFP.png