nativescript-snackbar
nativescript-snackbar copied to clipboard
Cannot read property 'findViewById' of undefined
Hello,
Getting following error on Android with snackbar 2.1.0:
Uncaught (in promise): TypeError: Cannot read property 'findViewById' of undefined
0: {
columnNumber: 35
lineNumber: 74
fileName: "webpack:///node_modules/@nstudio/nativescript-snackbar/snackbar.js"
functionName: "action"
}
1: {
columnNumber: 28
lineNumber: 909
fileName: "webpack:///node_modules/@nativescript/zone-js/zone-nativescript.js"
functionName: "ZoneAwarePromise"
}
2: {
columnNumber: 15
lineNumber: 67
fileName: "webpack:///node_modules/@nstudio/nativescript-snackbar/snackbar.js"
functionName: "action"
}
(zone-nativescript is patched by me with https://github.com/NativeScript/nativescript-angular/issues/2278, thats why i was able to trace it down to the snackbar..)
Thats the lines on the final js:
const activity = Application.android.foregroundActivity ||
Application.android.startActivity;
const x = activity.findViewById(android.R.id.content);
const rootViewOfActivity = x.getChildAt(0);
Activity ist just undefined, thats why it fails.
Edit: Updated code seems to be there, my mistake..
But please add the tag its missing ...
About the issue itself it seems its here discussed: https://github.com/NativeScript/NativeScript/issues/5307