【问题标题】:Tap event is incorrectly fired when swiping a RadListView轻扫 RadListView 时,点击事件被错误触发
【发布时间】:2021-02-22 17:46:53
【问题描述】:

我有一个显示项目列表的 RadListView。在每个项目模板中,我都有一个(点击)事件,在点击项目时触发,以重定向到项目详细信息屏幕。但是,由于某种原因,每当我垂直滑动 RadListView 以遍历列表时,它会在我开始滑动的任何位置触发 (tap) 事件,并错误地重定向到项目详细信息屏幕,而不是仅在列表中向上或向下移动。

<RadListView
        class="list transparent"
        [class.visible]="!data.loading"
        [visibility]="!data.loading ? 'visible' : 'collapse'"
        [items]="data.items"
        swipeActions="true"
        (itemSwipeProgressStarted)="onSwipeCellStarted($event)">
        <ng-template let-item="item">
            <StackLayout class="item" orientation="horizontal" (tap)="view(item)">
                <Image
                    [src]="item.photos?.length ? item.photos[0] : ''"
                    [visibility]="item.photos?.length ? 'visible' : 'collapse'">
                </Image>
                <StackLayout orientation="vertical">
                    <Label
                        class="title"
                        [text]="item.address">
                    </Label>
                </StackLayout>
            </StackLayout>
        </ng-template>

        <GridLayout *tkListItemSwipeTemplate columns="*, auto">
            <StackLayout id="delete" col="1" (tap)="deleteRow($event)" class="delete">
                <Label class="fas" [text]="IconsEnum.trashAlt"></Label>
            </StackLayout>
        </GridLayout>
    </RadListView>

我尝试摆脱 (tap) 事件,而是在 RadListView 上使用以下内容:

multipleSelection="false" selectionBehavior="Press" (itemSelected)="itemSelected($event)"

这解决了滑动的问题,但是它引入了一个新问题,它只会每两次点击而不是每次滑动选择一个项目。

从 RadListView 中选择项目的正确方法是什么?

【问题讨论】:

    标签: nativescript nativescript-angular


    【解决方案1】:

    从@nativescript/ios 7.1.1 升级到 7.2.0 解决了这个错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2013-03-10
      • 1970-01-01
      • 2018-04-18
      相关资源
      最近更新 更多