Skip to content

Cannot read property 'findViewById' of undefined #20

@saschaarthur

Description

@saschaarthur

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 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions