GithubHelp home page GithubHelp logo

Comments (4)

CatchABus avatar CatchABus commented on June 6, 2024

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.

from nativescript.

AndriusZal avatar AndriusZal commented on June 6, 2024

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?

from nativescript.

AndriusZal avatar AndriusZal commented on June 6, 2024

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 ScrollView, all the events around the screen will not be passed as well. In this example, I have attached event listener to the rootView and I will only be able to trigger event if I press on the button because it has another event listener attached.

<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 ScrollView, then I will get events across all screen except ActionBar:

<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>

from nativescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.