Trouble with ScrollView not scrolling on Nativescript-Vue

I am facing an issue with a scrollable view in my project. I have a list of items that should be scrollable, but for some reason it is not scrolling as expected. The structure involves a vertical stack layout wrapped in a scrollview, and inside the stacklayout there is a gridlayout populated using a v-for loop.

Below is the code snippet causing the problem:

<template>
<ScrollView android:clipToPadding="false" orientation="vertical" style="width:100%; height:100%; background-color:rgb(245,245,245);">
    <StackLayout orientation="horizontal" style="width:100%; height:100%; padding:10px;"> 
        <GridLayout columns="auto,*" rows="auto,auto,auto" v-for="comment in 6" :key="comment" style="width:100%; height:auto; margin:5px 0px; padding:20px; background-color:white;" >
            <Image row="0" col="0" src="~/assets/images/menu-2.jpg" loadMode="async" stretch="fill" style="width:55px; height:55px;  border-radius:50%; margin:0px 20px 0px 0px;"></Image>
            <StackLayout row="0" col="1" orientation="horizontal" style="width:100%; height:20px; ">
                <Label :text="'fa-star' | fonticon" class="fa" v-for="star in 5" fontSize="12" :key="star" style="color:yellow; vertical-align:center;"></Label>
                <Label text="hace 3 horas" class="fa c_grey" style="margin:0px 0px 0px 10px; vertcal-align:center;"></Label>
            </StackLayout>
            <Label row="1" col="1" class="c_normal fs_smaller" textWrap="true" style="margin:0;" lineHeight="0" text="I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position. I am not actually cropping the image. Any suggestions are appreciated. Thanks!"></Label>
        </GridLayout>
    </StackLayout>
</ScrollView>
</template>

Answer №1

Instead of specifying width/height 100% on every component, you can simply set height 100% on the StackLayout. This will prevent the StackLayout from exceeding the screen bounds and making it non-scrollable.

<template>
<ScrollView android:clipToPadding="false" orientation="vertical" style="background-color:rgb(245,245,245);">
    <StackLayout orientation="vertical" style="padding:10px;"> 
        <GridLayout columns="auto,*" rows="auto,auto,auto" v-for="comment in 6" :key="comment" style="width:100%; height:auto; margin:5px 0px; padding:20px; background-color:white;" >
            <Image row="0" col="0" src="~/assets/images/menu-2.jpg" loadMode="async" stretch="fill" style="width:55px; height:55px; border-radius:50%; margin:0px 20px 0px 0px;"></Image>
            <StackLayout row="0" col="1" orientation="horizontal" style="width:100%; height:20px; ">
                <Label :text="'fa-star' | fonticon" class="fa" v-for="star in 5" fontSize="12" :key="star" style="color:yellow; vertical-align:center;"></Label>
                <Label text="hace 3 horas" class="fa c_grey" style="margin:0px 0px 0px 10px; vertcal-align:center;"></Label>
            </StackLayout>
            <Label row="1" col="1" class="c_normal fs_smaller" textWrap="true" style="margin:0;" lineHeight="0" text="I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position. I am not actually cropping the image. Any suggestions are appreciated. Thanks!"></Label>
        </GridLayout>
    </StackLayout>
</ScrollView>
</template>

Note: Using ListView instead of v-for is recommended for better performance when rendering a list of items.

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

What is the best way to import scss files and images in Vue.js storybook stories?

In this component, I am importing an image using src="@/assets/images/logo.png" with the help of @ for addressing: <template> <div class="loading_container"> <img class="loading_logo" src="@/assets/ ...

Discovering access to this.$i18n.locales from store getter in Nuxt, i18n, and Vuex

Currently, I am constructing a web application utilizing Nuxt v2.15 and @nuxtjs/i18n v7.2 while employing Vuex for state management. Within my global state, I aim to develop a getter that retrieves a value reliant on this.$i18n.locale. How can I effective ...

Searching for a specific set of rows within an array? Look no further than jQuery and JavaScript

I'm struggling to find the right title for my project, but I'm doing my best to capture its essence. I am in the process of developing a calculator that compares values within multiple arrays. Each data item in my array consists of 34 rows, wit ...

How can I disable gestures in a collectionView when interacting with a slider in a cell?

Currently, I have implemented a custom slider within a collection view. The issue I am facing is that when I try to change the slider value using touchesMoved, it works perfectly outside of the collection view. However, within the collection view, the sl ...

Setting the Date in Angular.js: A Step-by-Step Guide

Make maxDate selectable as today at the latest (past days are clickable but not tomorrow). The range between minDay and maxDay should not exceed 365 days, allowing for fewer days to be selected. $scope.dateOptions = { formatYear: " ...

Sending an object to a Vue 2 component and confirming its validity

I am working with a Vue component that has numerous props. <Field v-for="field in fields" :key="field.name" :name="field.name" :type="field.type" :label="field.label" :values="field.values" :value ...

Unable to iterate through nested arrays in Contentful mapping

I am facing an issue while trying to map further into the array after successfully retrieving data from Contentful. The error message field.fields.map is not a function keeps popping up and I can't figure out what I'm doing wrong. export defau ...

Utilize Vue: Bring in the router within a helper class and navigate to a specific

I'm new to utilizing Vue, and I am currently attempting to import my existing router instance into a JavaScript class where I manage the Authentication. This is the content of my router file: import Vue from 'vue'; import Router from &apos ...

What is the best way to rearrange (exchange) elements within an Immutable Map?

Is there a way to rearrange items within an unchangeable list that is part of a Map? Here's an example: const Map = Immutable.fromJS({ name:'lolo', ids:[3,4,5] }); I have attempted to use the splice method for swapping, as well as ...

Utilizing Zoom Feature in ImageView Embedded within a ScrollView

I've been attempting to utilize the zoom feature within an ImageView. After trying numerous codes, I've encountered an issue where my ImageView is nested inside a ScrollView due to the presence of other objects. The latest code I experimented wi ...

Transferring image data to a different webpage

Currently, I am facing an issue with obtaining image data from a camera and photo album on a mobile device. Although I have successfully retrieved the chosen image using the provided code snippet below, my dilemma lies in transferring this image data to an ...

The process of authenticating route parameters in Nuxt

I'm having trouble validating route parameters in my page component using the following code: async validate({ params, store }) { await store.dispatch(types.VALIDATE_PARAMS_ASYNC, params.id) } And here's the corresponding code in the store: ...

Customize the jQuery datepicker by assigning a class to the first 17 days

How can I apply a class to only the first 17 days on a jquery datepicker calendar? I've attempted the following code, but it ends up adding the class to every day... beforeShowDay: function(date) { for (i = 0; i < 17; i++) { return [t ...

Tips for generating AJAX requests directly from HTML documents

Hey there! I'm fairly new to JavaScript and have a question that might seem silly to some. How exactly can I invoke a function from a Coffeescript file within my HTML code? I'd like to give users the option to choose the language in which they v ...

Deleting occurrences of a specific text from a JSON document and subsequently analyzing its contents

I am having an issue with a JSON file in which there are strings of characters attached to many of the field names. This is making it difficult for me to target those objects in JS. The structure looks like this: "bk:ParentField": { "bk:Field": "Va ...

How can state be shared between sibling components in React?

As someone who is relatively new to React, I am seeking guidance on the proper method of passing states between components. While I did come across a similar inquiry on Stack Overflow, I would appreciate if someone could provide a specific solution for my ...

loading times of Bootstrap-select are slow when used in multiples

I am facing performance issues on my website when I try to include more than 20 select options. The jQuery execution slows down significantly and there is a stop/continue alert, taking minutes to load. Is there any way to optimize the code for faster loadi ...

Vue encountering RangeError due to string length inconsistency in specific environments only

My Vue component is currently live in production within a WordPress theme, but I am encountering an error: jquery.min.js:2 Uncaught RangeError: Invalid string length at repeat$1 (vue.js:11398) at generateCodeFrame (vue.js:11380) at vue.js:1146 ...

How can I show the total sum of input values in a React.js input box?

Is there a way to dynamically display the sum of values entered in front of my label that updates automatically? For example, you can refer to the image linked below for the desired output Output Image I have initialized the state but I'm struggling ...

Utilize the $sample operator following the $group stage in MongoDB queries

Consider the dataset provided below: {company:"One", employee:"John"}, {company:"One", employee:"Mike"}, {company:"One", employee:"Donald"}, {company:"One", employee:"Mickey"}, {company:"Two", employee:"Johnny"}, {company:"Two", employee:"Da ...