-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[SwipeableDrawer] Add appearOffset
prop
#30763
Conversation
|
Hi. Thank you for opening this PR. Can you add a demo describing the use of the prop you are proposing ( You can add to |
discoveryAmount
prop
Hi. Thanks for adding the demo. In case you didn't know, you can find it here |
"discoveryAmount" does not sound intuitive. IMO something like "discoveryZoneSize" would describe the intent of this prop better. |
Personally I think that confuses it with the swipe area width, as it's the amount the drawer moves on discovery, and not the size of the area you can click to discover the drawer. |
The word "amount" doesn't feel right to me in this context. Perhaps "discoveryDistance", then? |
@siriwatknp What do you think? |
I think Edit: Perhaps |
👍 |
This is from my thought when I first saw this PR.
I think the word |
@@ -43,6 +43,16 @@ const iOS = | |||
<SwipeableDrawer disableBackdropTransition={!iOS} disableDiscovery={iOS} />; | |||
``` | |||
|
|||
### Drawer Discovery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to edit drawers.md
and this file will be translated later.
### Drawer Discovery | ||
|
||
You can make the drawer appear slightly when the user touches the screen near where the drawer is located. | ||
|
||
The amount the drawer appears by can be configured using `discoveryAmount`, and it can be disabled using `disableDiscovery`. | ||
|
||
If you are on mobile, you can click near the edge of the screen to discover the drawers. | ||
|
||
{{"demo": "pages/components/drawers/SwipeableDiscoveryAmount.js"}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note that the demo only works on the mobile viewport? Also, I try to play this feature in iOS chrome but it does not work (Swipe on the left seems to navigate to the previous page instead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that's because disableDiscovery is disabled by default on iOS, so it wont work.
I can set it to always be enabled if you think that's better, but that might impact expected navigation on the page itself.
👋 The migration PR has been merged. Please follow these steps to make sure that the contents are all updated. (Sorry for the inconvenience)
If you are struggle with the steps above, feel free to tag @siriwatknp |
Okay, I think we have these options so far: |
I am good with |
I was struggling to get the tests to run for a while, as they would just crash / error for me (even without any edits). |
@hbjORbj After trying many tests of many varieties, I cannot get it to work. Here is the code:
And here is the error output of the console.log:
The fact that Testing on a codesandbox with demos (and in my own work project) shows that the Removing the transitionDuration={0} means that the drawer doesn't move at all before the code runs, as there is now a transition, so it wouldn't be an instant change. Changing the element with I really don't know what the problem is here. Is it possible to make these tests async, and then await delays? I'm not familiar with this specific library for testing. p.s. found this on line 234 of SwipeableDrawer.test.js: Edit: |
I cannot continue to work on the unit tests, due to drawer discovery being completely broken in React 18: Due to that, the tests for it are just malfunctioning, and as such, do not work. |
It should be possible to add tests now. @tech-meppem I know it's been a while, are you still interested in continuing the effort? |
I am, and I will try to. I just haven't got much time, and I'm not familiar with the test library. I will try and finish the tests soon. |
It's been a long time since any activity, so I am closing this PR. @tech-meppem If you are willing to continue working, feel free to re-open the PR and push the remaining changes. You can at least try adding tests, and the team will help you if you need any help. |
Adds a prop that changes how much the drawer moves when the user "discovers" it, by touching in the swipe-area.
Closes #30762