-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ActionBar Blocking Events on Android by default #10529
Comments
That seems to be the native behaviour as explained here: https://stackoverflow.com/questions/30425786/how-to-click-views-behind-a-toolbar We can probably use the solution described. |
If I understand correctly, this solution advises me to create a separate class with toolbar extension and use that class to create each toolbar. Is there a possibility to have a solution from NativeScript side that I would be able to keep my implementation on JS? |
UPDATE: apparently, not only ActionBar element don't pass the events to the parent element by default. After some more testing I've found that that if you wrap your elements in <Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<ActionBar title="My App" icon="" />
<ScrollView>
<StackLayout class="p-20">
<Label text="Tap the button" class="h1 text-center" />
<Button text="TAP" tap="{{ onTap }}" class="-primary" />
<Label text="{{ message }}" class="h2 text-center" textWrap="true" />
</StackLayout>
</ScrollView>
</Page> If I remove <Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<ActionBar title="My App" icon="" />
<StackLayout class="p-20">
<Label text="Tap the button" class="h1 text-center" />
<Button text="TAP" tap="{{ onTap }}" class="-primary" />
<Label text="{{ message }}" class="h2 text-center" textWrap="true" />
</StackLayout>
</Page> |
After a deeper check, |
Issue Description
I would like to report an issue regarding the ActionBar element in NativeScript on Android. During my testing, I've observed that the ActionBar element blocks events for the rootView component unless I add an event listener specifically to the action bar. This behavior seems to affect Android only; on iOS, I don't encounter this issue.
Specifically, when I add an event listener to the action bar, I can see that events are bubbling up properly. However, this solution becomes cumbersome when dealing with a large number of pages, as I need to add an empty event listener to each action bar separately. Moreover, since I might need to create pages dynamically, this approach becomes impractical.
I believe that this issue may hinder the development process, especially for projects with complex navigation structures or dynamic page creation requirements. It would be ideal if events could propagate from the action bar to the rootView component without the need for additional event listeners or other flags.
I appreciate your attention to this matter and would be grateful for any assistance or insights on how to address this issue.
Thank you.
Reproduction
It can be reproduced easily by adding event listener to rootView when it gets initialised. When the app is running, the event is triggered anywhere on the screen except the ActionBar element. When I hide the ActionBar element, all screen is accessible. On iOS this issue is not applicable.
Relevant log output (if applicable)
No response
Environment
Dependencies
Please accept these terms
The text was updated successfully, but these errors were encountered: