Create doesn't exist in type of Actionsheet


#1

I have problem with actionsheet in ionic 2…

This is the code

import {Page, NavController} from 'ionic-angular';
import {ActionSheet} from 'ionic-native';

@Page({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
  constructor(public nav: NavController) {}
  
  signIn(){
    let sheet = ActionSheet.create({
        title : 'Sign In as',
        buttons : [
            {
             text:'Partner',
             handler : () =>{
                console.log('Cancel clicked');
             }
            },{
             text:'Member',
             handler : ()=>{
                console.log('Cancel clicked');
             }
            },{
             text:'Cancel',
             role:'cancel',
             handler : ()=>{
                console.log('Cancel clicked');
             }
            }
        ]
    });
    this.nav.present(sheet);
   }
}

when i try to ionic serve there are errors

TypeScript error:

D:/xampp/htdocs/payogo/android_2/Payogo/app/pages/home/home.ts(41,33): Error TS2339: Property 'create' does not exist on type 'typeof ActionSheet'.

Please help me thanks


#2

I believe that you’re mixing the native ActionSheet and the Ionic one, i.e. you’re importing the first one but using it like the second one. If you want to use the native implementation, then you should use the show() method (check out the available options here). If you want to use the Ionic 2 ActionSheet then change your import statement this way:

import {ActionSheet} from 'ionic-angular';

#3

thank you very much…