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

"Uncaught TypeError: Cannot read property '_onNativeEvent' of undefined" #26

Open
devyaz opened this issue Jan 25, 2018 · 14 comments
Open

Comments

@devyaz
Copy link

devyaz commented Jan 25, 2018

i get this in console @shripalsoni04
chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property '_onNativeEvent' of undefined", source: (1)
heres my system info
$ tns info All NativeScript components versions information ┌──────────────────┬─────────────────┬────────────────┬─────────────┐ │ Component │ Current version │ Latest version │ Information │ │ nativescript │ 3.4.1 │ 3.4.1 │ Up to date │ │ tns-core-modules │ 3.4.0 │ 3.4.0 │ Up to date │ │ tns-android │ 3.4.1 │ 3.4.1 │ Up to date │ │ tns-ios │ 3.4.1 │ 3.4.1 │ Up to date │ └──────────────────┴─────────────────┴────────────────┴─────────────┘ am using vanilla Javascript

@m-abs
Copy link

m-abs commented Mar 15, 2018

I'm having the same problem.

@dotnetdreamer
Copy link

i am having the same issue ...

@devyaz
Copy link
Author

devyaz commented Mar 21, 2018 via email

@xuanhungttm
Copy link

Hello. I have the same issue on iOS device.
It fails because the javascript local file cannot be loaded.
I have followed the solution in this comment and it works.
NativeScript/NativeScript#6377 (comment)

@himanshukk81
Copy link

Nothing Work for me this error comes once
in a while

@devyaz
Copy link
Author

devyaz commented Jul 21, 2020

hi, you need nativescript-webview-interface in your www folder or just clone it and use the www folder in your app or clone my repo Nativescript-Leaflet-Map as a working example you need a Mapbox Mapbox signup access token insert it into the index.html file

@ejlocop
Copy link

ejlocop commented Mar 2, 2021

@devyaz , does the HTML file needs to be available locally?

@devyaz
Copy link
Author

devyaz commented Mar 2, 2021 via email

@ejlocop
Copy link

ejlocop commented Mar 2, 2021

@devyaz , BTW, the plugin does not work on iOS (no logs in the console at all) and on Android, passing data from webview to nativeapp works but not when passing data from nativeapp to webview and showing this error.

Uncaught TypeError: Cannot read property '_onNativeEvent' of undefined

Note: I'm trying to load a hosted page and not a local file.

@kriefsacha
Copy link

Someone got news from that ?

@rpragesh
Copy link

@ejlocop did you find the solution???

@devyaz
Copy link
Author

devyaz commented Dec 28, 2021

I did back then, but thanks to webpack it doesn't work any more, I've switched to Flutter now trying flutter_webview_plus but I can't get leaflet map to render with local assets, only hosted

@devyaz
Copy link
Author

devyaz commented Dec 28, 2021

I solved it by cloning the demo and including the folder ‘www’ from the demo into my App, then modify the ‘www/index.js’ to my liking(am using leafletjs for my Map, so I get events from the map and to the map from {N}) hope it helps

From: Idrees Khan [mailto:[email protected]]
Sent: March 21, 2018 09:01 AM
To: shripalsoni04/nativescript-webview-interface [email protected]
Cc: devyaz [email protected]; Author [email protected]
Subject: Re: [shripalsoni04/nativescript-webview-interface] "Uncaught TypeError: Cannot read property '_onNativeEvent' of undefined" (#26)

i am having the same issue ...


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #26 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/ATfQSZ2th8aAYiw9qWy6cVwPBCrzLIDMks5tgfq6gaJpZM4Rsla0 . https://github.com/notifications/beacon/ATfQSWm1_3pTaeaIR1aCGa4EnbF27MtIks5tgfq6gaJpZM4Rsla0.gif

This was the way I solved it out

@baysoft
Copy link

baysoft commented Apr 10, 2023

It's a race condition problem.
I solve it using a 300ms delay like this:

    setTimeout(function () {
      oWebViewInterface.emit("from-native", { data: "testing" });
    }, 300);

I'm using the latest {N} and android 12.

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

9 participants