fivecar / react-native-draglist

FlatList that can be reordered by dragging its items
MIT License
118 stars 19 forks source link

Enhancement: ListFooterComponent #23

Closed noahkurz closed 1 year ago

noahkurz commented 1 year ago

First, let me say that I love this library. It is very well designed in its simplicity and performance. Super impressed.

I recently ran into an issue where I need a listFooterComponent that is not draggable. could this be a potential enhancement?

fivecar commented 1 year ago

@noahkurz : Yes, you should be able to do that today. As long as your ListFooterComponent doesn't itself call onDragStart or onDragEnd, it won't drag. (I've just verified this by adding a ListFooterComponent to the example app, code below).

      <DragList
        style={styles.scrolledList}
        ref={listRef} // Verify that using the ref works
        data={scrollData}
        keyExtractor={keyExtractor}
        onReordered={onScrollReordered}
        ListFooterComponent={() => (
          <View>
            <Text>Try dragging this footer</Text>
          </View>
        )}
        renderItem={renderItem}
      />