Nativescript Plugin Feedback

feedback
android

#1

I have an existing project and I want to use nativescript-feedback plugin as shown here https://market.nativescript.org/plugins/nativescript-feedback.

I encounter error so I decide to start a new project.

I create a new project using this command “tns create test1 --template tns-template-tab-navigation-ng”. Then I run the following command

  1. “tns build android”,
  2. “tns run android --emulator”
    I can see the page shows up correctly.

Then I add the plugin using the command “tns plugin add nativescript-feedback”. I make changes to 2 of the files

  1. app\tabs\home\home.component.html


    <button text=“Click Me” (tap)=“clickMe()”>

  2. app\tabs\home\home.component.ts
    import { Component, OnInit } from “@angular/core”;
    import { Feedback, FeedbackPosition, FeedbackType } from “nativescript-feedback”;
    import { Color } from “tns-core-modules/color”;
    @Component({
    selector: “Home”,
    moduleId: module.id,
    templateUrl: “./home.component.html”
    })
    export class HomeComponent implements OnInit {
    private feedback: Feedback;
    constructor() {
    this.feedback = new Feedback();

    }

    ngOnInit(): void {
    /* ***********************************************************
    * Use the “ngOnInit” handler to initialize data for the view.
    *************************************************************/
    }

    clickMe(): void {
    console.log(“it reach the show success”);
    this.feedback.success({
    title: “Peek-a-boo!”,
    message: “Sorry. I will dismiss myself after 2.5 seconds.”,
    duration: 2500,
    // type: FeedbackType.Success, // no need to specify when using ‘success’ instead of ‘show’
    onTap: () => {
    console.log(“showSuccess tapped”);
    }
    });
    }
    }

When the application starts, i see the button “CLICK ME” and I click on it. I encounter the same error below.
JS: it reach the show success
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘Alerter’ of undefined
JS: TypeError: Cannot read property ‘Alerter’ of undefined
JS: at file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-feedback/feedback.js:20:46
JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:777:29)
JS: at Feedback.show (file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-feedback/feedback.js:18:16)
JS: at FeedbackCommon.success (file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-feedback/feedback.common.js:21:21)
JS: at HomeComponent.clickMe (file:///data/data/org.nativescript.test1/files/app/tabs/home/home.component.js:16:23)
JS: at Object.eval [as handleEvent] (ng:///TabsModule/HomeComponent.ngfactory.js:17:27)
JS: at handleEvent (file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:13585:155)
JS: at callWithDebugContext (file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:15094:42)
JS: at Object.debugHandleEvent [as handleEvent] (file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:14681:12)
JS: at dispatchEvent (file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:10000:25)
JS: at file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:10625:38
JS: at file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:187:26
JS: at ZoneDelegate.invoke (file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:365:26)
JS: at Object.onInvoke (file:///data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/bundles/core.umd.js:4787:33)
JS: at ZoneDelegate.invoke (file:///data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:364:32)

I were trying for the past few days to address the issue but I were not able to do it until now. Appreciate if anyone can guide me on how to resolve the issue.

Thanks in advance!


#2

Did you double check whether the android dependencies are installed properly?


#3

I haven’t done any android project before. I were trying to find if the dependencies are installed. How do I do it?


#4

Just try deleting the platforms folder and do tns run android again, that should take care of the plugin and it’s dependencies properly.


#5

I have done it 3 times but i still encounter the same issue. I issue the following command
“rm -rf hooks node_modules platforms” and “tns run android”


#6

Thanks for the tips. I run the following commands in another machine and it works fine.

  1. “rm -rf node_modules platforms”
  2. “tns build android”
  3. “tns run android --emulator”.

Appreciate your advise.