-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Make header left/right insets configurable #692
Comments
This is something we need as well. The hit areas are just too small. I‘ve tried all combinations of margins, paddings, hit slops, but to no avail. Does anyone know how to do this with UIKit so we can PR or patch-package it? @martinandert Did you find a suitable workaround for this? |
Unfortunately not. We're using managed expo, so our ability to patch native code is very limited. |
The only way I found till now is using negative margin, e.g. |
Is there any update on this topic? |
any ideas? |
I am facing the same issue. I am using react-navigation-header-buttons I reduced the margin by using negative MarginRight on the item
|
I had think about this solution,but the extra 15 space will not animate when u go back by gesture right,it looks so strangely |
I made a PR that hopefully fixes the issue on |
@WoLewicki I've tried the PR and it doesn't seem to work. I have a |
@SimpleCreations I changed the implementation a bit, can you check again? And if it still does not work correctly, can you provide a reproduction of the issue? |
@WoLewicki seems to be working now, thank you! |
Doesn't applying margin like in this comment: #692 (comment) work? |
Negative margin doesn't help. It still not pressable in that space.
|
+1 |
I found something strange in the solution that gives negative margin. When I used the version @react-navigation/native-stack 6.9.10, I didn't have a problem with the hit area even if I gave a negative margin, but when I upgraded it to 6.9.17, the same problem occurred. In my experience, 6.9.10 only had a problem with narrowing the hit area when I gave the renderBackground option. Why did the problem get fixed and then relapsed? |
Is there any progress on this? This bug has been around for a while and the negative margin workaround really affects hit areas. |
Currently, the insets (paddings from the edge of the window) for custom
headerLeft
andheaderRight
views can not be adjusted. It always uses the default insets on iOS and Android (probably these values are provided by the system).Pull request #350 proposed making the insets customizable, but it was dismissed, I suppose because of this comment:
We have a use case where it would be nice if we were able to control the inset sizes:
We have a screen that renders a web view, so we added "go back" and "go forward" buttons to the header to control the navigation inside the web view. It looks like this:
As you can see, this doesn't look good, as the buttons -- due to the fixed insets -- appear too far away from the left and right window edges (reducing also the space available for the title). This is because we added padding around the small-ish chevron icons in order to increase the hit area of these buttons. Here's the same screenshot, but this time with outlines around the hit areas:
If there was a way to customize the insets, we could make it look like this instead:
This is much better, isn't it?
Here's the same screenshot again, showing the hit areas:
So this is exactly what we need.
As a workaround, we could style the buttons with negative margins in order to move them to the desired positions, but this affects the hit areas negatively:
It's effectively reducing the chance the user is actually able to hit the button with their thumb / finger by half.
This isn't iOS specific. It also applies to Android.
To further prove my point, here are screenshots of the stock iOS and Android back buttons, with outlines added around their hit areas:
As you can see, although the content of the back buttons appears inset from the left edge of the header / toolbar, their hit areas actually extend to the very edge.
Given all that, please consider adding
headerLeftInset
andheaderRightInset
options. In order to not break existing apps, these could beundefined
by default, rendering the inset sizes as they currently are.The text was updated successfully, but these errors were encountered: