-
Notifications
You must be signed in to change notification settings - Fork 58
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
Refine Bottom Sheets in/out transition #820
Conversation
Instead of conditionally rendering, just pass the isVisible property (which will be passed down to BottomSheet). This prevents the picker being dismissed immediately when closed, instead of using the desired animation.
I'm a bit confused by the test error:
Is jest not expected to import the css properly? |
That's it.
|
Thanks! Tests are passing locally now. That file kind of makes me want to make a case of dropping SCSS for native styles 😬 |
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.
Looking good!
I left a comment about why we were removing the component instead of using the isVisible
prop.
The referenced PR is not too clear, so this is a simpler explanation:
When we add a block with a text input (any kind), that start focused by default, when the picker is dismissed via isVisible = false
, the focus will change to the previous block (if it also has a text input).
There might be another cause of this behavior, but when I investigated it many months ago, this was the only solution I could find.
Oh interesting. I debugged it a bit, and I think I know what's going on. When you select a block from the picker:
Relevant stack trace:
I think I'll revert the change for now and move this to a new issue. The first thing I'd try to do is hook into react-native-modal |
This reverts commit 11f3d71.
This should be ready to review again |
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.
The first thing I'd try to do is hook into react-native-modal onModalHide, and have one callback for when the block type is tapped, so the new block is inserted immediately, and a second one for when the bottom sheet is fully dismissed, so we can focus on the right block.
That sounds like it could work. Thanks for checking it out :)
Details in Gutenberg PR: WordPress/gutenberg#14831
On the gutenberg-mobile side, this also fixes how we were presenting the block picker so it actually animates out instead of dismissing immediately.
Fixes #595