0
votes

I would like to know how can I have multiple fullscreen in scrollview with nativescript please ?

enter image description here

I tried this :

<Page actionBarHidden="true" class="page">
    <ScrollView orientation="vertical">
        <StackLayout>
            <StackLayout height="100%" backgroundColor="red">
<Label text="Fullscreen 1"></Label>
            </StackLayout>

            <StackLayout height="100%" backgroundColor="blue">
<Label text="Fullscreen 2"></Label>
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Page>

But the stack aren't fullscreen.

1

1 Answers

0
votes

I fixed with this :

Template

<Page actionBarHidden="true">
    <ScrollView orientation="vertical">
        <StackLayout>
            <StackLayout :height="screenHeight" backgroundColor="red">
                ...
            </StackLayout>

            <StackLayout :height="screenHeight" backgroundColor="blue">
                ...
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Page>

And add this :

import { screen } from "tns-core-modules/platform";

...
data() {
    return {
        screenHeight: 0
    };
},
...
created() {
    this.screenHeight = screen.mainScreen.heightDIPs
}