【问题标题】:React Native - Flat list scrolling is not working in Pan ResponderReact Native - 平面列表滚动在 Pan Responder 中不起作用
【发布时间】:2020-01-05 13:20:09
【问题描述】:

React Native,使用 PanResponder 视图作为父视图并将平面列表作为视图的子视图,没有 PanResponder,平面列表滚动工作正常,但使用 PanResponder,平面列表滚动不起作用。

【问题讨论】:

    标签: react-native scroll react-native-flatlist


    【解决方案1】:

    我没有找到合适的解决方案,但解决方法是将平面列表项包装在 TouchableOpacity 中,它会使平面列表可滚动。 如果不喜欢 TouchableOpacity 的不透明度,可以将activeOpacity 设置为 1。

    例子:

    <View {...this.gestureHandlers.panHandlers} style={styles.container}>
      <FlatList
        horizontal={true}
        data={this.state.FlatlistData}
        renderItem={({ item }) => {
          return (
            <TouchableOpacity activeOpacity={1} style={styles.itemsStyle}>
              {/* Your core view here */}
            </TouchableOpacity>
          )
        }}
      />
    </View>
    

    【讨论】:

      猜你喜欢
      • 2019-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多