水平滚动ListView列的某些部分 [英] Horizontal scroll some part of ListView column

查看:81
本文介绍了水平滚动ListView列的某些部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在React Native中水平滚动ListView的某些部分.

I want to horizontally scroll some part of a ListView in React Native.

如何固定第一列的位置并使其他列水平滚动?

How can I fix the position of first column and make other column horizontally scrollable?

推荐答案

ListView的renderRow应该有一个Text,然后是水平的ScrollView.

The renderRow of ListView should have a Text followed by a horizontal ScrollView.

<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow}
/>

renderRow (rowData) {
  return (
  <View>
    <Text>rowData.field1</Text>
    <ScrollView horizontal={true}>
      <Text>rowData.field2</Text>
      <Text>rowData.field3</Text>
      <Text>rowData.field4</Text>
    </ScrollView>
  </View>
}

请注意ScrollView中的horizo​​ntal = true道具,它会实现.

Note the horizontal=true prop in ScrollView which will make it happen.

这篇关于水平滚动ListView列的某些部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆