-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project:
CLI: 8.2.14
Cross-platform modules:
"tns-core-modules": "~6.5.15"
"nativescript-feedback": "^1.5.0",
Describe the bug
Calling this.feedback.show({..} ) fails with Error: You are trying to set "Companion" which is a final field! Final fields can only be read.
Add plugin into a new {N} project. Import and execute:
var test = require("nativescript-kotlintest");
test.doTest();
feedback.service.js :
import { Injectable } from '@angular/core';
import { Feedback, FeedbackType } from 'nativescript-feedback';
@Injectable({
providedIn: 'root'
})
export class FeedbackService {
private feedback: Feedback;
constructor() {
this.feedback = new Feedback();
}
showSuccessMessage(message: string) {
this.feedback.show({
message: message,
type: FeedbackType.Success
});
}
}
Component.ts:
login() {
this.processing = false;
this.authService.login(this.user.email, this.user.password).subscribe(
data => {
this.feedbackService.showSuccessMessage("test message");
this.routerExtensions.navigate(['/bills/tabs'], { clearHistory: true });
},
error => {
console.log(error);
}
);
}
Expected behavior
To not crash.
Additional context:
Issue occur if function gets invoked.
Full stacktrace:
JS: ERROR Error: Uncaught (in promise): Error: You are trying to set "Companion" which is a final field! Final fields can only be read.
JS: Error: You are trying to set "Companion" which is a final field! Final fields can only be read.
JS: at file:///node_modules/nativescript-feedback/feedback.js:17:0
JS: at new ZoneAwarePromise file:///node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js:902:0
JS: at Feedback.show file:///node_modules/nativescript-feedback/feedback.js:15:0
JS: at FeedbackService.module.exports.push../app/shared/services/feedback.service.ts.FeedbackService.showSuccessMessage file:///src/app/shared/services/feedback.service.ts:15:18
JS: at SafeSubscriber._next file:///src/app/auth/auth.component.ts:50:29
JS: at SafeSubscriber.push.../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub file:///node_modules/rxjs/_esm5/internal/Subscriber.js:192:0
JS: at SafeSubscriber.push.../node_modules/r...
Further github issue, which does not solve the problem:
NativeScript/android#1178