nativescript-google-maps-sdk
nativescript-google-maps-sdk copied to clipboard
TypeError: Class constructor View cannot be invoked without 'new'
TypeError: Class constructor View cannot be invoked without 'new'
NativeScript 7 with Vue.js when trying to create the map.
Same error with NativeScript 7.0.8 with typescript (NativeScript Core)
Same error
same error w/ Nativescript 7.0.7 with JS (NativeScript Vue)
I managed to invoke this error by trying to create an instance outside of the registerElement
CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught TypeError: Class constructor View cannot be invoked without 'new' at MapViewBase(file: node_modules/nativescript-google-maps-sdk/map-view-common.js:128:46) at MapView(file: node_modules/nativescript-google-maps-sdk/map-view.ios.js:240:27) at (file:///app/bundle.js:887:12) at ./main.js(file:///app/bundle.js:907:30) at __webpack_require__(file: src/webpack/bootstrap:816:0) at checkDeferredModules(file: src/webpack/bootstrap:43:0) at webpackJsonpCallback(file: src/webpack/bootstrap:30:0) at (file:///app/bundle.js:2:57) at require(:1:137) ', reason: '(null)' *** First throw call stack: ( 0 CoreFoundation 0x00007fff2043a126 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48 2 NativeScript 0x000000010d7f62b4 _ZN3tns21NativeScriptException15OnUncaughtErrorEN2v85LocalINS1_7MessageEEENS2_INS1_5ValueEEE + 882 3 NativeScript 0x000000010dc23668 _ZN2v88internal14Me<…>
So my issue turned out be the handling of the plugin by babel
presets: [ [ '@babel/preset-env', { targets: { esmodules: true }, ----> include: ["transform-classes"] } ] ],
the inclusion of "include":"[transform-classes"] solved it for me, I arrived to this answer through this https://stackoverflow.com/questions/36577683/babel-error-class-constructor-foo-cannot-be-invoked-without-new answer. I hope this helps someone.
So my issue turned out be the handling of the plugin by babel
presets: [ [ '@babel/preset-env', { targets: { esmodules: true }, ----> include: ["transform-classes"] } ] ],
the inclusion of "include":"[transform-classes"] solved it for me, I arrived to this answer through this https://stackoverflow.com/questions/36577683/babel-error-class-constructor-foo-cannot-be-invoked-without-new answer. I hope this helps someone.
Hi, could you show your code please? I include a .babelrc file with your presets but this solution doesn't work for me :(
@benco8186 try this:
- tns install babel
- put this in .babelrc
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
},
"include": [
"transform-classes"
]
}
]
]
}
@benco8186 try this:
- tns install babel
- put this in .babelrc
{ "presets": [ [ "@babel/preset-env", { "targets": { "esmodules": true }, "include": [ "transform-classes" ] } ] ] }
Thank you, but it still doesn't work, may be it's because i'm using angular and not vue, also i'm not on nativescript 7, i use nativescript 6.5.3
I have created a fork and updated nativescript dependencies and typescript compiler version, if you compile the files and replace in the node module by these (map-view-common.js,map-view.android.js,map-view.ios.js,map-view.d.js),it works the fork url : https://github.com/benco8186/nativescript-google-maps-sdk/
I have created a fork and updated nativescript dependencies and typescript compiler version, if you compile the files and replace in the node module by these (map-view-common.js,map-view.android.js,map-view.ios.js,map-view.d.js),it works the fork url : https://github.com/benco8186/nativescript-google-maps-sdk/
Tried but wasn't able to get this achieved
I have created a fork and updated nativescript dependencies and typescript compiler version, if you compile the files and replace in the node module by these (map-view-common.js,map-view.android.js,map-view.ios.js,map-view.d.js),it works the fork url : https://github.com/benco8186/nativescript-google-maps-sdk/
Tried but wasn't able to get this achieved
Clone my fork, in the src folder open a terminal and run npm install, then tsc, don't worry about error informations. After that copy the .js files and in your project, in the original dependency nativescript maps sdk (in node_module), paste these files (replace the Originals). Normally that will work
I have created a fork and updated nativescript dependencies and typescript compiler version, if you compile the files and replace in the node module by these (map-view-common.js,map-view.android.js,map-view.ios.js,map-view.d.js),it works the fork url : https://github.com/benco8186/nativescript-google-maps-sdk/
Tried but wasn't able to get this achieved
Clone my fork, in the src folder open a terminal and run npm install, then tsc, don't worry about error informations. After that copy the .js files and in your project, in the original dependency nativescript maps sdk (in node_module), paste these files (replace the Originals). Normally that will work
I tried this and now I got new error : Error: This value is not a native object.
getting the same error
see #420
sorry, don't replace map-view.d.ts by a js file but by the ts file I attach a zip file with the files I used maps.zip
@hypery2k cool staff 👍
the infoWindowTemplate does not showing on !
hi @kefahB, when the infoWindow is not showing? thx
@funder7 .. this happen when I click on the marker .. I've did some debugs, it seems the infowindow does not exist at all on the plugin side.
.. this happen when I click on the marker .. I've did some debugs, it seems the infowindow does not exist at all on the plugin side.
Okay! Does it happen with the stable version of the plugin and nativescript 7+ or with the plugin version of #420? (nativescript 7 compatibility PR)
It work as expected with NS6.3
sorry, don't replace map-view.d.ts by a js file but by the ts file I attach a zip file with the files I used maps.zip
@benco8186 got this worked..but cameraChanged function not working after i tired this...!!!
I could not get this working either with NS7. But as documented here a bit, I was having problems still trying to use the old CLI with ios. So I'm basically using NS7 cli with my NS6 project, and it seems to work I just have to use --force
. This will probably hold me over for now, but would really like to get it working with NS7 fully at some point.
sorry, don't replace map-view.d.ts by a js file but by the ts file I attach a zip file with the files I used maps.zip
@benco8186 got this worked..but cameraChanged function not working after i tired this...!!!
@benco8186 same issue
Hi,
to resolve this issue you should declare NativeClass()
on MapViewDelegateImpl
and IndoorDisplayDelegateImpl
then you add ts-patch
at your package.json (dev), then add the flowing to your tsconfig.json
"plugins": [{
"transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
"type": "raw"
}]
and edit package.json at the script key like this :
"build": "npm run clean && ts-patch install && tsc",
same error...anyone handle this problem ...please describe breafly
Hi every one, this repo isn’t maintained frequently, try This plugin