deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

EJohnF opened this issue · comments

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

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

Thanks for reporting, I'm aware of that too