Page MenuHomePhabricator

[native] improve BottomSheet component close function
ClosedPublic

Authored by ginsu on Sep 21 2023, 11:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 7:31 PM
Unknown Object (File)
Fri, Nov 1, 12:24 PM
Unknown Object (File)
Mon, Oct 28, 11:55 PM
Unknown Object (File)
Mon, Oct 28, 10:12 PM
Unknown Object (File)
Sat, Oct 26, 1:28 AM
Unknown Object (File)
Oct 22 2024, 8:55 PM
Unknown Object (File)
Oct 20 2024, 9:29 AM
Unknown Object (File)
Oct 20 2024, 9:29 AM
Subscribers

Details

Summary

As I was working with/testing out the bottom sheet component, I was running into a bug where if I quickly pressed the bottom sheet backdrop again before the bottom sheet was fully open the onChange callback would not get called. This meant that I was unable to navigate back away from the user profile bottom sheet screen and I would be stuck.

I read through the docs again and I actually found a better prop called onDismiss that just always get called whenever the bottom sheet gets dismissed regardless if the bottom sheet was fully opened or not.

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

With onDismiss we can just pass in the onClosed callback prop making the implementation a lot more simple!

Depends on D9258

Test Plan

Confirmed that when I press the bottomsheet backdrop before the bottomsheet fully opens, I can successfully navigate back when the bottom sheet dismisses

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, inka.

Nice, much easier to understand at a glance

This revision is now accepted and ready to land.Sep 26 2023, 12:23 PM