Repository navigation
Closed
Labels
package: core@ionic/core package
Description
Bug Report
Ionic Info
$ ionic info
Ionic:
ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.17
@angular-devkit/build-angular : 0.10.7
@angular-devkit/schematics : 7.1.0
@angular/cli : 7.1.0
@ionic/angular-toolkit : 1.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.3, (and 4 other plugins)
System:
Android SDK Tools : 26.1.1 (/home/geiringe/Android/Sdk)
NodeJS : v8.9.3 (/home/geiringe/.nvm/versions/node/v8.9.3/bin/node)
npm : 6.4.1
OS : Linux 4.15
Describe the Bug
SlidingItem.getSlidingRatio() is not defined.
Steps to Reproduce
Steps to reproduce the behavior:
- Create a basic list with ion-item-sliding
- Use the ionDrag event to fire function
- See error
Related Code
HTML:
<ion-list>
<ion-item-sliding #item (ionDrag)="onDrag($event)">
<ion-item>
<ion-row>
<ion-col size="8" size-md="9" text-left>
<h3>Some header 1</h3>
</ion-col>
</ion-row>
</ion-item>
<ion-item-options side="start">
<ion-item-option color="success">Complete</ion-item-option>
</ion-item-options>
</ion-item-sliding>
<ion-item-sliding #item (ionDrag)="onDrag($event)">
<ion-item>
<ion-row>
<ion-col size="8" size-md="9" text-left>
<h3>Some header 2</h3>
</ion-col>
</ion-row>
</ion-item>
<ion-item-options side="start">
<ion-item-option color="success">Complete</ion-item-option>
</ion-item-options>
</ion-item-sliding>
<ion-list>
Typescript:
import { Component, OnInit } from '@angular/core';
import { ItemSliding } from '@ionic/angular';
@Component({
selector: 'list-test',
templateUrl: './list-test.component.html',
styleUrls: ['./list-test.component.scss']
})
export class ListTestComponent implements OnInit {
constructor() { }
ngOnInit() {
}
async onDrag(item: ItemSliding) {
let ratio = await item.getSlidingRatio();
//let ratio = item.detail.ratio;
}
}
Error:
ERROR Error: Uncaught (in promise): TypeError: item.getSlidingRatio is not a function
TypeError: item.getSlidingRatio is not a function
Expected Behavior
Expect the value of the function getSlidingRatio() to return.
Workaround
You can use the item.detail.ratio property to get the value instead.
Reacted by shreeshbhat
Metadata
Metadata
Assignees
Labels
package: core@ionic/core package
Type
Fields
No fields configured for issues without a type.
Activity
manucorporat commentedon Dec 6, 2018
ionDrag event does not return a ItemSliding, but an event, check the detail property:
ionitron-bot commentedon Jan 5, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.