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)
Mon, Sep 30, 3:29 AM
Unknown Object (File)
Fri, Sep 13, 5:08 AM
Unknown Object (File)
Fri, Sep 13, 2:57 AM
Unknown Object (File)
Fri, Sep 13, 2:57 AM
Unknown Object (File)
Fri, Sep 13, 2:57 AM
Unknown Object (File)
Fri, Sep 13, 2:56 AM
Unknown Object (File)
Fri, Sep 13, 2:50 AM
Unknown Object (File)
Aug 27 2024, 7:10 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