octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
929 stars 157 forks source link

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

Open ajoykarmakar459 opened 3 years ago

ajoykarmakar459 commented 3 years ago

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?