question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Consumer UI Refresh] Add CreateMenu. Bottom Drawer Modal Pattern + Hook up FAB

See original GitHub issue

If you haven’t already, check out our contributing guidelines for onboarding!


For this issue we will create a new type of Modal called bottomDocked and then display a menu CreateMenu component with two options “New Group” and “New Chat”. For now, touching both of these options will open the ChatSwitcher which we can do by calling ChatSwitcher.show() and closing the modal after a selection is made.

We are using the react-native-modal library which has good documentation.

  1. Create a new component called CreateMenu which will render a bottomDrawer type Modal. It should look like this: Screen Shot 2021-01-13 at 3 19 15 PM
  2. CreateMenu should have the following props:
    1. isVisible - Boolean Used to display or hide the menu
    2. menuItemData - array of objects with the following additional props:
      1. icon - icon component to show in the option
      2. text - text to display to the right of the icon
      3. onPress - function fired when menu option selected
  3. The CreateMenu should render the bottomDrawer Modal and then render the rows for each option passed in the menuItemData array.
  4. Remove the ability to hide the FAB.js isHidden
  5. When the FAB is active we will set the isVisible property of the menu to true and when it is not active we will hide the modal.
  6. When the menu is closed (either via the x or by making a selection) the FAB should be set back to it’s original state.
  7. All menu selections should call ChatSwitcher.show().

So, after one of the selections in the menu is made we should see this view open: Screen Shot 2021-01-13 at 3 22 29 PM

The chat bubble and person icon assets to use are here: MenuAssets (1).zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
marcaaroncommented, Jan 14, 2021

@parasharrajat Thanks, we have assigned to Lucas already, but will have some more project work soon for you!

What happens to the FAB when the modal is open?

Correct. It should just be hidden by the modal in this case. There is a future plan for the alternate state of the FAB. But no need to worry about this for now.

Maybe make it go up with the modal (I believe we would need to do something tricky so it does not get obfuscated by the modal).

Interesting idea, but we have something else in mind 😃

Maybe leave it hidden and simply close the modal with a click anywhere outside of it.

Exactly! Clicking outside the modal should close it. Selecting one of the options will also close it.

1reaction
marcaaroncommented, Jan 14, 2021

Proposal sounds perfect!

And yes, I agree with you about the name change. Perhaps instead of having a state value with isFloatingActionButtonActive we can change this to isCreateMenuVisible and then pass this to both the modal and the fab?

As for the questions…

On large screens, I believe the View inside the modal should extend just the sidebar width, right? (gif at the end). I didn’t have time to look much, but if this is it do I copy the hard-coded value 300 I found in the animationTranslateX on the HomePage, or is there a better place to get this value? I can also take a better look at the sidebar components to find the value;

For now, it’s ok to do exactly as you have there. Our plan for this is to have another style of modal that is more like a popover for the wide screen views. In that case, the menu will be closed by pressing on the FAB and the menu will sit above like so:

Screen Shot 2021-01-14 at 12 32 52 PM

From the last commit I fetched upstream this afternoon, the mobile sidebar width was still not corresponding to the whole screen width, but I know I read in one of the issues it was going to be implemented (I’m pretty sure). If my assumption in 1. is correct, can I make the modal component width 100% in small screens, and 300 on others already?

Yep you are correct and that sounds like a good plan. We can do 300 for the wide view and 100% for the small view.

In the next gif, when I press the modal test button, I did call the ChatSwitcher.show(), and something weird happened (as can be seen in the gif). I will take a more in-depth look to debug it, but maybe someone can already tell me what is happening. No problem if it is not known, I’ll figure it out.

Ah hmm I see. It seems like the “ChatSwitcher” is not showing. I can help debug when you create a PR if you haven’t solved it yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Consumer UI Refresh] Add CreateMenu. Bottom Drawer ...
[Consumer UI Refresh] Add CreateMenu. Bottom Drawer Modal Pattern + Hook up FAB #1240 ... There is a future plan for the alternate...
Read more >
Diff - 2e0945b687..baaa9eae93 - chromium/src - Git at Google
SuggestionsNavigationDelegate; import org.chromium.ui.text. ... be shown before the sheet is opened // to ensure the toolbar ends up in the correct state.
Read more >
Untitled
Breaking news us govt shutdown, Audi b8 s4 for sale, Syarikat awam berhad dapat modal dari, Home movies cartoon coach, Feed2all nhl.
Read more >
HvC - ALBA.Net
Transition g1 s cycle cellulaire, Russian consonants pronunciation, R6 siege funny moments, Mapper pattern php, Ek3 technologies toronto?
Read more >
sitemap-questions-196.xml - Stack Overflow
... https://stackoverflow.com/questions/915170/how-to-connect-mysql-database- ... .com/questions/1550458/how-to-add-san-storage-support-to-your-application ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found