首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >反应本机:水平滚动廊

反应本机:水平滚动廊
EN

Stack Overflow用户
提问于 2017-12-27 03:44:57
回答 1查看 3K关注 0票数 1

我想做一个水平滚动画廊的反应-本地人:

像这样,其中分离的屏幕有点单击。我还想让这些小圆圈向您展示有多少页,以及您在哪个屏幕上。就像ios主屏幕上的码头上的那些

到目前为止,我只有一个水平的scrollView,里面有一些“卡片”:

代码语言:javascript
复制
<ScrollView horizontal={true}>

                    <View style={{
                        height: 9,
                    }}>
                        {/*buffer between items*/}
                    </View>

                    <View 
                        style={{flexDirection: 'row',
                        width: width-9,
                        height: 50,
                        top: 163,
                        alignContent: 'center',
                        alignItems: 'center',
                        //justifyContent: 'flex-wrap',
                        flexWrap: 'wrap'
                        }}
                    >

                        {/*card 1*/}
                        <Card
                            onPress={() => navigate('General')}
                            source={require('../resources/icons/information.png')}
                            text={'General Info'}
                        >
                        </Card>

                        {/*card 2*/}
                        <Card
                            onPress={() => navigate('Grades')}
                            source={require('../resources/icons/information.png')}
                            text={'Gradebook'}
                        >
                        </Card>

                        {/*card 3*/}
                        <Card
                            onPress={() => navigate('Grades')}
                            source={require('../resources/icons/information.png')}
                            text={'Lunch Menu'}
                        >
                        </Card>

                        {/*card 4*/}
                        <Card
                            onPress={() => navigate('BellSchedule')}
                            source={require('../resources/icons/information.png')}
                            text={'Bell Schedules'}
                        >
                        </Card>

                        {/*card 5*/}
                        <Card
                            onPress={() => navigate('About')}
                            source={require('../resources/icons/information.png')}
                            text={'About'}
                        >
                        </Card>

                    </View>

                </ScrollView>

我现在所拥有的没有“页面”,也没有流畅的滚动。这和解决方案完全不一样。卷轴/视图/画廊之类的东西叫什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-27 03:53:00

您可以使用具有循环指示符的视图寻呼机组件。参考ReactNativeViewPager

代码如下所示

代码语言:javascript
复制
 <IndicatorViewPager
   style={{height:200}}
   indicator={this._renderDotIndicator()}>
      <View style={{backgroundColor:'cadetblue'}}>
            <Text>page one</Text>
      </View>
      <View style={{backgroundColor:'cornflowerblue'}}>
            <Text>page two</Text>
      </View>
      <View style={{backgroundColor:'#1AA094'}}>
            <Text>page three</Text>
      </View>
  </IndicatorViewPager>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47986084

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档