Page MenuHomePhabricator

[native] introduce onClosed callback prop to BottomSheet component
ClosedPublic

Authored by ginsu on Sep 7 2023, 9:18 AM.
Tags
None
Referenced Files
F3343754: D9098.id30861.diff
Fri, Nov 22, 4:00 AM
Unknown Object (File)
Sun, Nov 3, 1:47 PM
Unknown Object (File)
Fri, Nov 1, 12:43 PM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:29 AM
Unknown Object (File)
Oct 20 2024, 9:24 AM
Unknown Object (File)
Oct 18 2024, 1:31 AM
Subscribers

Details

Summary

In subsequent diffs we will introduce some logic where we want to navigate back from the modal bottom sheet screen back to the screen we originally were before we opened/navigated to the modal bottom sheet screen when the bottomsheet closes. Unfortunately, the bottom sheet library does not have a callback prop for this. However, it does have a callback prop called onChange that gets triggered every time the sheet position changes. We can use this and set a condition where if the sheet position index is -1 (the sheet is closed) then we call the onClosed callback prop

https://gorhom.github.io/react-native-bottom-sheet/props/#onchange

Test Plan

Passed in a callback which logged a message to the console as the onClosed prop and confirmed that the message appeared when the bottomsheet closed

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable