deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
917 stars 235 forks source link

A lot of space under listview when try to insert element on the last position #125

Open EJohnF opened 6 years ago

EJohnF commented 6 years ago

two problems:

  1. a lot of space under list view
  2. very fast scrolling to the bottom (almost immediately)

Code:

<SortableListView style={{ marginBottom: 44 }} data={this.state.items} order={this.state.order} disableAnimatedScrolling bounces={false} // tryed to set it to true onRowMoved={e => replacePositions(e.from, e.to)} renderRow={row => } renderSeparator={() => <View style={{ height: 8 }} />} renderFooter={this.renderAddPicture} />

video with a problem: https://drive.google.com/file/d/1OsJvX-mlvUMVeS_g8X1c2kGL0KiBrR7l/view?usp=sharing

EJohnF commented 6 years ago

I've found how to solve a problem with space under listview. But it's definitely very bad way (just a hack):

need to change here (line 244)

const MAX_HEIGHT = Math.max(
          0,
          this.scrollContainerHeight - this.listLayout.height + itemHeight
        )

to this.scrollContainerHeight - this.listLayout.height + itemHeight + 300

and here (line 303)

handleContentSizeChange = (width, height) => {
    this.scrollContainerHeight = height
  }

to this.scrollContainerHeight = height - 300

nihgwu commented 6 years ago

Thanks for reporting, I'm aware of that too