Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'findViewById' of undefined #20

Open
saschaarthur opened this issue Oct 25, 2020 · 1 comment
Open

Cannot read property 'findViewById' of undefined #20

saschaarthur opened this issue Oct 25, 2020 · 1 comment

Comments

@saschaarthur
Copy link

saschaarthur commented Oct 25, 2020

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 NativeScript/nativescript-angular#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 ...

@saschaarthur
Copy link
Author

About the issue itself it seems its here discussed: NativeScript/NativeScript#5307

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant