Error:More than one layout child inside a ContentView


#1

My application starts with login:

<ActivityIndicator [busy]="isBusy" width="50" height="50"></ActivityIndicator>
<ScrollView class="background">
    <GridLayout rows="auto,auto,auto,auto,auto,auto">
        <Image src="~/tools/assets/logo2.png" stretch="none" row="0" margin="20" horizontalAlignment="center"></Image>
        <StackLayout row="1" margin="20" orientation="vertical">
            <TextField hint="Usuario" [(ngModel)]="formLogin.user"></TextField>
            <TextField hint="Contraseña" [(ngModel)]="formLogin.password" secure="true"></TextField>
        </StackLayout>
        <StackLayout orientation="horizontal" marginTop="10" row="2" marginLeft="20" marginRight="20">
            <Label text="Recordar usuario" textwrap="true" horizontalAlignment=left width="80%"></Label>
            <Switch [checked]="checked" horizontalAlignment=right (checkedChange)="onChecked($event)" width="20%"></Switch>
        </StackLayout>
        <StackLayout row="3" marginLeft="20" marginRight="20" marginTop="10">
            <Label text="Olvidé mi contraseña &#xf084;" fontWeight="bold" class="text-right icon" horizontalAlignment="right" [nsRouterLink]="['/landing/forgetpassword']"></Label>
        </StackLayout>
        <StackLayout row="4" marginTop="5" marginLeft="20" marginRight="20" marginTop="10">
            <Button class="btn-login" text="Ingresar" (tap)="login()" margin="5"></Button>
        </StackLayout>
        <StackLayout row="5" orientation="horizontal" horizontalAlignment="center" marginTop="20">
            <Label text="Si no tiene cuenta debe " class="text-right" horizontalAlignment="right"></Label>
            <Label [nsRouterLink]="['/landing/createuser']" text="solicitar acceso" fontWeight="bold" class="text-left" horizontalAlignment="left"></Label>
        </StackLayout>
    </GridLayout>
</ScrollView>

In Android it works perfect, but in iOS it even starts and presents the following error:

I don’t know, how I can solution this problem?


#2

What is the parent of ScrollView, is it a layout? You should not add more than one component to your Page.


#3

But, Can I use the same layout several times?


#4

Yes. You can use any layout any number of times. But ContentView and anything inherited from ContentView like Page / ScrollView can hold only one child element.