octopitus / rn-sliding-up-panel

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

SlideUpPanel loads before .show() & doesn't allow 2 panels #137

Closed Zontex closed 5 years ago

Zontex commented 5 years ago

Issue Description

The rn-sliding-up-panel library is super important component in my app so first of all I would like to thank the developer for keep maintaining this and bringing this solution to the community.

while working with the component I found out 2 issues when I would like to bind 2 different slide-up-panels at the same page, each slide-up panel will show up by calling separate function.

  1. The entire slideup component loads when the screen loads, even those this._panel.show() wasn't executed. this makes the app slower and produce more views even when unnecessary. it will not show the panel but it will render it inside the screen. (checked by running alert() inside the slide-up component)

  2. when using 2 slide-up components with different ref function, by calling one of them it will automatically render the second one on top of the first one, even tho their ref is completely different.

Steps to Reproduce / Code Snippets / Screenshots

First slide-up panel

<SlidingUpPanel
        style={{backgroundColor: 'rgb(255,255,255)'}}
        allowDragging={false}
        showBackdrop={true}
        ref={(c) => {
          this._firstPanel = c
        }}>

Second slide-up panel

<SlidingUpPanel
        style={{backgroundColor: 'rgb(255,255,255)'}}
        allowDragging={false}
        showBackdrop={true}
        ref={(b) => {
          this._secondPanel = b
        }}>

By executing this._firstPanel.show() it will show the second panel on top of the first panel.


Environment

octopitus commented 5 years ago

Duplicated #132

Zontex commented 5 years ago

Duplicated #132

Working perfectly. I suggest you could add this information to the description in the README file :) would help a lot and save time searching and trying ...