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)
Fri, Dec 20, 10:27 AM
Unknown Object (File)
Thu, Dec 19, 1:45 PM
Unknown Object (File)
Sun, Dec 8, 12:57 AM
Unknown Object (File)
Fri, Dec 6, 12:23 PM
Unknown Object (File)
Mon, Nov 25, 6:19 AM
Unknown Object (File)
Sun, Nov 24, 7:20 PM
Unknown Object (File)
Fri, Nov 22, 2:06 AM
Unknown Object (File)
Fri, Nov 22, 2:01 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
Lint Not Applicable
Unit
Tests Not Applicable

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