0

I have a problem that my StackLayout does not scroll in a scrollView.

<Page loaded="loaded" id="main">
<Page.actionBar>
    <ActionBar title="Register">
    </ActionBar>
</Page.actionBar>
<ScrollView orientation="vertical" id="scrollView">
    <StackLayout id="Content">
        <Label id="Lfname" text="First name: " />
        <TextField text="{{ fname }}" id="fname" hint="first name" />

        <Label text="Last name: " />
        <TextField text="{{ lname }}" id="lname" hint="last name" />

        <Label text="E-mail: " />
        <TextField text="{{ email }}" id="email" hint="email" />

        <Label text="Confirm E-mail: " />
        <TextField text="{{ emailConfirm }}" id="emailConfirm" hint="email" />

        <Label text="Password: "/>
        <TextField text="{{ password }}" id="password" secure="true"/>

        <Label text="Confirm Password: "/>
        <TextField text="{{ passwordConfirm }}" id="passwordConfirm" secure="true"/>

        <Button id="register" text="Register" tap="onRegister" class="confirm" />
        <Button id="login" text="Login" tap="onLogin" class="link"/>
    </StackLayout>
</ScrollView>
</Page>

I've spend hours looking for the problem, but can't find it. I'm pretty new to nativescript so that might be the problem.

Here are my packages:

{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
    "id": "org.nativescript.foodFetish",
    "tns-android": {
        "version": "4.0.1"
    }
},
"dependencies": {
    "nativescript-theme-core": "~1.0.4",
    "tns-core-modules": "^4.1.0"
},
"devDependencies": {
    "babel-traverse": "^6.26.0",
    "babel-types": "^6.26.0",
    "babylon": "6.4.5",
    "lazy": "1.0.11"
}
}

And I run android 4.4.2.

2 Answers 2

1

This should work, at least it works on my devices. Do not hesitate to create playgrounds when you have a problem, it's way easier to reproduce the bug (here is one for your code). Note that ScrollView scrolls only if there is more content to display than the size of your screen, so if your screen is bigger than the content inside the ScrollView, you won't see any scroll effect.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the response. It does also work for me in the playground. But when I run it in the debugger in Visual Studio Code. It does not. I do have the view in a frame in app-root.xml . It seems that the StackLayout does not care about the content in it. When I call "getMeasuredHeight()" on the content, it stays the size of the screen. I think that it just doesn't let it render outside of my screen, so the scrollview doesn't have anything to scroll to. image. Here is a view of what i see in my mobile.
1

I found the problem. It seemed that i was setting the height of "#Content" to "100%". Stupid mistake, thanks for the response.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.