如何在react-native中使用Viewpager在单个屏幕上显示两个视图

时间:2017-12-26 12:38:19

标签: react-native viewpagerindicator

我正在使用rn-viewpager

我想要一个这样的观点:

enter image description here

但我得到的是这样的:

enter image description here

这是我的代码:

 <IndicatorViewPager
            style={{flex:1,width:60}}
            onPageSelected={(position) => this.onChangeRound(position)}
        >
            <View>
                <Image style={{marginLeft:40,justifyContent:'center',
                    resizeMode:'center'}}
                       source={this.state.firstRound}
                />
            </View >

            <View>
                <Image style={{marginLeft:40,justifyContent:'center',
                    resizeMode:'center' }}
                       source={this.state.secondRound}
                />
            </View >
            <View>
                <Image style={{marginLeft:40,justifyContent:'center',
                    resizeMode:'center' }}

                       source={this.state.thirdRound}
                />
            </View>
            <View>
                <Image style={{marginLeft:40,justifyContent:'center',
                    resizeMode:'center' }}
                       source={this.state.fourthRound}
                />
            </View>
            <View>
                <Image style={{marginLeft:40,justifyContent:'center',

                    resizeMode:'center' }}
                       source={this.state.fifthRound}
                />

            </View>

        </IndicatorViewPager>

请忽略'SCROLL'文字。

我想在我的屏幕上一次显示两个图像,一个是活动的,一个是非活动的,滚动时它应该改变。这里一切都正常,除了(一个屏幕上有2张图片)

0 个答案:

没有答案