Nativescript, значок в текстовом поле - PullRequest
0 голосов
/ 04 марта 2019

Я пытаюсь получить иконки внутри текстового поля в проекте Nativescript Angular.Когда я пытаюсь это сделать, он оказывается вне поля или, по крайней мере, выглядит так.Я посмотрел некоторые примеры кода ( sample ), но он не будет работать, когда я сам попробую.

<GridLayout rows="auto, auto, auto, auto, auto" class="container" loaded="onLoaded()">
  <app-eon-colors-top></app-eon-colors-top>
  <StackLayout row="1" class="logo">
    <Image src="res://live_logo"></Image>
  </StackLayout>
  <Stacklayout row="2" class="form">
    <StackLayout>
      <TextField #userName hint="Användarnamn" class="field" [text]="userInput.username" required [isEnabled]="!(processing$ | async)" keyboardType="email" autocapitalizationType="none" autocorrect="false" (textChange)="setUsername($event)" (focus)="focusUserName($event)"
        (returnPress)="focusPassword()"></TextField>
    </StackLayout>
    <GridLayout columns="auto, *, auto">
      <Label col="0" class="icon fa-regular" [text]="lockIcon"></Label>
      <TextField col="1" #password hint="Lösenord" class="field" [text]="userInput.password" required [isEnabled]="!(processing$ | async)" secure="true" autocapitalizationType="none" autocorrect="false" (textChange)="setPassword($event)" (focus)="focusPassword($event)"
        (returnPress)="submit()">
      </TextField>
      <Label col="2" class="icon fa-regular" [text]="activePasswordShowHideIcon" ios:style="padding-bottom: 35" (tap)="showHidePassword()"></Label>
    </GridLayout>
    <Label class="error-msg" textWrap="true" *ngIf="(errors$ | async)" [text]="errorTxt"></Label>
    <Button class="login-button" text="LOGGA IN" [isEnabled]="!(processing$ | async)" (tap)="submit()"></Button>
  </Stacklayout>
  <ActivityIndicator rowSpan="5" color="#23a1b0" [busy]="(processing$ | async)" width="100" height="100" class="activity-indicator"></ActivityIndicator>
</GridLayout>

enter image description here

1 Ответ

0 голосов
/ 04 марта 2019

Вам придется удалить заданный по умолчанию фон / границу, поставляемую с TextField, и применить границу к родительскому контейнеру, чтобы он выглядел как часть TextField.

Пример

    <StackLayout class="form">
        <GridLayout class="m-10 input-border" columns="*,auto">
            <TextField col="0" class="input"></TextField>
            <Label col="1" class="h3" text="?" verticalAlignment="center"></Label>
        </GridLayout>
    </StackLayout>

Образец игровой площадки

...