Animating elements in Nativescript Vue using v-show and transitions

I am facing some issues while using v-show with Nativescript. I attempted to create an animation as outlined in . When using v-show, the element doesn't completely disappear from the screen.

Below is my code:

<template>
    <Page actionBarHidden="true">
        <GridLayout>
            <transition name="bounce">
                <MainMenu v-show="menuOpen" class="mainMenu" @menu-closed="toogleMenu" />
            </transition>
            <StackLayout >
                <button text="Menu" @tap="toogleMenu" />
                <Label :text="menuOpen" />
            </StackLayout>
        </GridLayout>
    </Page>
</template>

<script scoped>
import MainMenu from './MainMenu.vue'

export default {
    components:{ MainMenu },
    data() { return { menuOpen: false, } },
    methods: {
        toogleMenu() { this.menuOpen = !this.menuOpen; },
    },
};
</script>
<style scoped>
    .bounce-enter-active {
    animation-name: bounce-in;
    animation-duration: 1s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-in-out;
}
.bounce-leave-active {
    animation-name: bounce-in;
    animation-duration: 0.25s;
    animation-fill-mode: forwards;
    animation-direction: reverse;
    animation-timing-function: ease-in-out;
}
@keyframes bounce-in {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}
</style>

MainMenu.vue

<template>
    <AbsoluteLayout class="mainMenu">
        <StackLayout class="mainMenuItems">
            <Label text="Menu" />
            <button text="Close" @tap="closeMenu" />
        </StackLayout>
    </AbsoluteLayout >
</template>

<script scoped>
export default {
    methods: {
        closeMenu() { this.$emit("menu-closed"); }
    },
};
</script>

<style scoped>
    .mainMenu {
        width:80%;
        left: 0;
        right: 0;
        top:0;
        bottom: 0;
        background: lightblue;
        z-index: 3;
    }
    .mainMenuItems {
        width:100%;
        left: 0;
        right: 0;
        font-size:20%;
        text-align: center;
        color:coral;
    }
</style>

It seems that the 'bounce' transition should trigger when the v-if or v-show state of the inner element changes. However, the area of the created menu becomes unresponsive, as another element takes its place. This is likely due to the z-index, but with v-show, the element should theoretically disappear from view and not be affected by z-index.

It is noteworthy that I can click on the main screen with v-show and trigger a button from the hidden menu. The Menu button becomes unresponsive. With v-if, I only see the blocked Menu button.

Alternatively, when I remove the z-index, all elements of the StackLayout appear on the front layer. Even if I specify a z-index for the StackLayout, e.g. 2 (lower than the MainMenu), the element still doesn't fully disappear from the screen. The following libraries are being used:

  • "@nativescript/core": "~8.5.0",
  • "@nativescript/theme": "~3.0.2",
  • "@nativescript/types": "^8.5.0",
  • "nativescript-vue": "~2.9.3"

Android API 26 (also tested with 29 and 30)

Could you provide suggestions on how to tackle this issue and maintain the correct layer order? Z-index doesn't seem to be the most elegant solution.

Answer №1

After careful examination, it was determined that utilizing Animate.css does not present any issues that were encountered with a custom animation. It appears that this might be the most effective solution available at the moment.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Experience the magic of CSS Sprite once it's been successfully uploaded!

Visit the website for testing here Located at the bottom of the page are two images with hover effects - one labeled "Contact us" and the other "Jobs Available!" During local testing, these images are visible. However, once uploaded to a server, they dis ...

Error in CSS Header - Position Shifts when Hovered Over

UPDATED HEADER HTML/CSS I am currently working on the header section of my website at . I encountered a bug where, upon hovering over the links in the header from right to left, the positions of the links become disorganized. I am unsure of what might be ...

Execution issue with Typescript function

In my Nativescript project, I have the following TypeScript file: import { Observable } from 'tns-core-modules/data/observable'; import { isIOS } from "tns-core-modules/platform"; import { Color } from "tns-core-modules/color"; import { request, ...

Email Embedder - Incorporating HTML source code into email communications

I've encountered an issue where the CDNs (Bootstrap and FontAwesome) do not work when I embed my HTML source code into an email. Despite using inline styling throughout, the receiver still faces this problem. Any insights on why the CDNs are failing t ...

What is the best method to include the product name in the URL of my Vue.JS application using Vue Router?

I am looking to dynamically insert the product name in the URL. Currently, it appears as "http://localhost:8080/product/?ID=1". I would like it to display as "http://localhost:8080/product/Iphone-11-Pro?ID=1" Below is the router-link code found in the ...

Issue: User is being redirected from "/login" to "/home" due to a navigation guard. This problem arises in the interaction between Vue-router and Firebase authentication

I'm currently working on an app that utilizes Vue.js and Firebase for authentication. I am trying to implement a verification process using the beforeEach method in my router file to ensure that users can only sign in if their displayName matches a sp ...

Placing a div in the corner of an image

Is there a way to position a meta-data div in the corner of every post image, even with different image sizes? For example: This is what I currently have in my loop: <div id="images"> <?php wp_get_attachment_image(); ?> </div> < ...

I'm wondering if there is a method for me to get only the count of input fields that have the class "Calctime" and are not empty when this function is executed

Currently, I am developing an airport application that aims to track the time it takes to travel between different airports. In this context, moving from one airport to another is referred to as a Sector, and the duration of time taken for this journey is ...

Setting MenuItem to the correct width in asp.net simplified

I have a 1000px wide container, within it there is a menu control with 5 items (links). Each item has a width of 200px in the CSS file to make use of the entire length of the line. .level1 { border-width: 0px; margin: 0px; padding: 0px; background ...

BEM Methodology: Ensuring the CSS value in one block takes precedence over property definitions in another block

I'm facing a challenge with BEM as I try to make properties from one block take precedence over styles in another. Some might suggest adding a modifier for .button, but in some cases, specific properties need to be applied only on certain pages withou ...

Modifying the background color using highcharts.js

I am attempting to customize the background colors of a highcharts scatter plot. While I can easily change the color of a specific section using the code provided, my goal is to apply multiple colors to different ranges within the same plot. Specifically, ...

Developing explosive Vue components consecutively

During my recent work on creating Vue components in a loop, I came across a strange issue with wires. for(let i=0;i<testInfo.length;i++) { $("#home").append("<lib_" + testInfo[i]['lib_id'] + "></lib_" + testInfo[i]['lib_id ...

Tips for displaying a sub-menu upon hovering

I am attempting to display the list of sub-menu items when hovering over the main menu item. I have tried using the following CSS code, but it did not work as expected. Any assistance will be greatly appreciated. CSS: summary.header__menu-item.list-menu__ ...

How to Position Input Fields over an Image Using CSS

I am working on positioning input fields over an image to allow data entry directly onto the image itself. https://i.sstatic.net/jW4iM.png Currently, I have a series of input fields (shown above) and three images with different squares on them. My goal is ...

Adding items from top to bottom in Vue.js

Recently, I came across a code snippet that caught my attention: <comment-form @created="add"></comment-form> <div v-for="(comment, index) in items" :key="comment.id"> <comment :data="comment"></comment> </div> Wit ...

Is it achievable through CSS alone to eliminate the bullet point in a UL list when it consists of just a single item?

Is it feasible to achieve a solution using CSS alone that remains functional even on IE8, ensuring the following criteria: If a <ul> list contains 2 or more items, then maintain the bullets in front of each item as per usual. When there is only one ...

Is it advisable to utilize CSS3 media queries to serve varied image sizes for retina display devices?

Although many questions similar to mine have been asked before, I believe my situation is slightly different. I have recently created a mobile app using JQM + Cordova/PhoneGap. In the beginning, I utilized large images aimed at retina display devices and ...

What is an alternative method for creating a horizontal line without the need for the <hr> tag?

Is there a way to create a slim horizontal line without using the <hr> tag ? This is what I attempted: .horizontal-line{ border-top: 1px solid #9E9E9E; border-bottom: 1px solid #9E9E9E; } While it does function, I am hoping for a thinner line. ...

Is it possible to have 3 divs with the height of the tallest

I have a unique template that I employ for crafting responsive websites. It relies on boxes with percentage widths, floats, and clears. A prime instance can be viewed via this link. Notice how the three boxes vary in height. While it's simple to set a ...

The React MUI v5 Card's background features a subtle white hue with a 5% opacity, leaving me curious about its origin

I've noticed a strange styling issue in my code. It seems to be related to a class called .css-18bsee0-MuiPaper-root-MuiCard-root, possibly from MUI's Card or MUI's Paper components. However, I can't find it in my own code. While tryin ...