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

DraggableRange bottom does not respect panel show or hide #223

Open poudelsubhan opened 9 months ago

poudelsubhan commented 9 months ago

Issue Description

Whenever I populate draggableRange.bottom with a non-zero value, it shows the panel even when I have not called panel.show() and shows it even after calling panel.hide().

Steps to Reproduce / Code Snippets / Screenshots

I only want the panel to show when someVal has been set to true. However, it just shows the panel at start anyway. I also want the panel to dismiss when otherVal is set and yet there's still the same problem.

export default const panelComp = () => {
   const [someVal, setSomeVal] = useState(false);
   const [otherVal, setOtherVal] = useState(false);
   const panelRef = useRef<SlidingUpPanel>(null);

  useEffect(() => {
     if (someVal) panelRef.current?.show();
  }, [someVal] )

  useEffect(() => {
     if (otherVal) panelRef.current?.hide();
 }, [otherVal] )

  return (
    <View stlye={ flex: 1} >
         <SomethingElse />
         <SlidingUpPanel
               ref={panelRef}
               draggableRange = {{ top: 800, bottom: 200 }}
         >
                <Component>
         </SlidingUpPanel>
   </View>
 );
}

Environment