stipsan/react-spring-bottom-sheet

BottomSheet resets to previous snap point when trying to track height

Tasemu opened this issue · 0 comments

Tasemu commented

We have an issue where we need to track whether our bottom sheet is maximised or minimised in our app. The sheet is always open but can be either full screen or minimal at the bottom of the screen. We are trying to use onSpringEnd to set a local state but when we do this, the re-render seems to conflict with the sheet and causes it to jump back to its previous snap point?

const [height, setHeight] = useState(0);
 <Sheet
          open
          {....otherProps}
          ref={sheetRef}
          onSpringEnd=(() => { setHeight(sheetRef.height) })
          />
        }
      >