Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add overlayEnable option in drawer layout #11652

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brannonvann
Copy link
Contributor

Please provide enough information so that others can review your pull request.

Motivation

I like the react-native-drawer-layout and want to use it to host some settings that will pull out in a drawer. In my case, the requirements are that the drawer open and close but the content remain interactive. Currently, when using drawerType="front", drawerType="slide", and drawerType="back" and the drawer is open the content in the drawer is covered in an overlay that close the drawer when one attempts to interact with the content (children). This works well for use in a navigation but in my case I need to be able to interact with the content like drawerType="permanent" but open and close like drawerType="front".

I added a boolean option available on Drawer props following the naming conventions called overlayEnabled to allow the overlay to be turned off. It defaults to true to maintain the original functionality but can be set to false to allow the users to interact with the drawer content and leave the drawer open.

Test plan

  1. Use the repo example project.
  2. In the DrawerView.tsx set the Drawer prop overlayEnabled={false} and notice that you can click on the button to close the drawer in the screen (from the Drawer children).
  3. In the DrawerView.tsx set the Drawer prop overlayEnabled={true} the overlay appears over the content (children). Clicking any part of the will close the drawer.
  4. In the DrawerView.tsx omit the Drawer prop overlayEnabled the overlay appears over the content (children). Clicking any part of the will close the drawer.

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (688c43a) 75.75% compared to head (1ae0752) 75.77%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11652      +/-   ##
==========================================
+ Coverage   75.75%   75.77%   +0.02%     
==========================================
  Files         205      205              
  Lines        5956     5957       +1     
  Branches     2329     2330       +1     
==========================================
+ Hits         4512     4514       +2     
  Misses       1393     1393              
+ Partials       51       50       -1     
Files Coverage Δ
...es/react-native-drawer-layout/src/views/Drawer.tsx 81.25% <100.00%> (+0.60%) ⬆️
...t-native-drawer-layout/src/views/legacy/Drawer.tsx 58.42% <100.00%> (+0.56%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@netlify
Copy link

netlify bot commented Oct 21, 2023

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 1ae0752
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/653428f7e7957200086cfad3
😎 Deploy Preview https://deploy-preview-11652--react-navigation-example.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Is there any reason overlayStyle={{ display: 'none' }} isn't sufficient? I'd rather not add additional props unless necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants