octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined is not an object (evaluating 'this._panel.transitionTo')

ajoykarmakar459 opened this issue · comments

You can manually call to transactionTo inside onDragEnd event (It's invoked with the current position of the panel) with some conditions e.g. did user scroll over half of draggable range? If yes, then scroll to top, otherwise scroll back to bottom.

_handleOnDragEnd(position) {
  if (position > 640/2) {
    this._panel.transitionTo(640)
  } else {
    this._panel.transitionTo(0)
  }
}

<SlidingUpPanel
  ref={c => this._panel = c}
  draggableRange={{top: 640, bottom: 0}}
  onDragEnd={this._handleOnDragEnd}
/>

_Originally posted by @octopitus in https://github.com/octopitus/rn-sliding-up-panel/issues/39#issuecomment-374865105_```



This code is not working anymore. What's the replacement for this code?