Bottom Sheet as a detail editor #1174
Unanswered
yolpsoftware
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are using the Bottom Sheet in a few screens where some "items" are listed. If the user clicks on one of the item, a bottom sheet opens where the user can edito the details of the selected item. Some of the screens have just one item, others have several.
To avoid repeating code, we created a reusable component
DetailsEditor
which can be placed in whatever screen like this:As soon as the prop
selectedItem
is set to an ID, the editor bottom sheet opens and lets the user edit the details. TheonClose
prop is used to signal that the editor should be closed, so theselectedItemId
state variable is set tonull
.Unfortunately, all the simplicity of the
react-native-bottom-sheet
API seems to have gone in that scenario. Maybe we were doing it in an unnatural way, but our code ended up very messy. We had great difficulty to cover everything, but in the end, everything worked fine.However, we are sure there must be an easier way to do this. Maybe #1171 would make this easier.
Is this use case covered in an example somewhere?
Beta Was this translation helpful? Give feedback.
All reactions