If react-modal-sheet is mounted while the user is touching the screen, the error TypeError: undefined is not an object (evaluating 'scrollable.scrollTop') will occur.
Perhaps scrollable is undefined because onTouchMove is called without calling the onTouchStart function. When scrollable === undefined, the process should be terminated as follows.
Problem
If react-modal-sheet is mounted while the user is touching the screen, the error
TypeError: undefined is not an object (evaluating 'scrollable.scrollTop')
will occur.How to produce:
<Sheet isOpen={true} />
is mounted.code:
Environment:
It seems that the following line is
scrollable === undefined
and an error occurs.https://github.com/Temzasse/react-modal-sheet/blob/a25d023fdda60dfa378969c0669c635d8a1dc485/src/use-prevent-scroll.ts#L135
Solution
Perhaps
scrollable
isundefined
because onTouchMove is called without calling the onTouchStart function. Whenscrollable === undefined
, the process should be terminated as follows.