react-native-swiper 组件的动态高度

Seb*_*ger 5 react-native

他,我正在使用该react-native-swiper组件来显示图像幻灯片。

目前我正在heightSwiper组件指定属性,但我想height根据 swiper 中显示的图像大小进行动态设置。

在我的情况下,图像是二次的,高度由其宽度决定。所以刷卡器显示的所有图像都具有相同的高度。

我当前的 Swiper(具有固定高度)看起来像:

<Swiper autoplay height={375}>
            {bounty.pictures.map((item, key) => {
              return (
                <View key={key}>
                  <Image styleName="large-square" source={{ uri: item.image }}></Image>
                </View>
              )
            })}
</Swiper>
Run Code Online (Sandbox Code Playgroud)

当我height在当前实现中没有指定任何内容时,该Swiper组件大约是底层图像大小的两倍。

我找不到任何react-native-swiper使用动态高度的示例,具体取决于显示的内容。