React Native:2个滚动视图,带有2个粘性标题

cha*_*apa 13 scrollview react-native

我试图创建一个左侧有时间的日视图,以及人物的顶部标题.目前我可以得到左边或顶部标题,但不是两个.

你如何获得2个粘性标题?

两个滚动视图,每个都有一个标题

我的渲染看起来像这样:

  <ScrollView style={{height: 600}}>
    <ScrollView horizontal={true}>
      <View style={styles.column}>
        <View style={{ flex: 1, flexDirection: 'row', width}}>
          {header}
        </View>

        <View style={styles.row}>
          <View style={[styles.container, { width, marginLeft: 40 }]}>
            {this.generateRows()}
          </View>
        </View>

      </View>
    </ScrollView>
    <View style={{backgroundColor: 'white', position: 'absolute', top: 0, bottom: 0, left: 0, }}>
      <View style={{ flex: 1, flexDirection: 'row'}}>
        <View style={styles.row}>
          <Text></Text>
        </View>
      </View>
      <View style={{height: 1000, width: 40 }}>
        {this.generateRowLabels()}
      </View>
    </View>
  </ScrollView>
Run Code Online (Sandbox Code Playgroud)

小智 1

您可以尝试将顶层 ScrollView 更改为 View/FlexBox,并将 flexDirection 作为“列”吗?这将导致内部 ScrollView 适应窗口大小。