Comments (10)
OK, the good news is that the info window is shown for each type of template. The less-than-good news is that none of the formatting from the .scss file is applied, which would be expected I suppose given we're assigning the template text directly. This is good enough to keep me going but I'm hoping that keyed info window templates is something you can add in the coming weeks. I'll be glad to help with this, at least with the testing.
from nativescript-google-maps.
Hi, The Kyed template doesn't work since NS 7 and I did not have the time to investigate it, but try to set it from the js side.
I didi not try it but you can try with those property exposed to the maps
public infoWindowTemplate: string | Template;
public infoWindowTemplates: string | Array<KeyedTemplate>;
marker.infoWindowTemplates = `<template key="testWindow">
<StackLayout orientation="vertical" width="160" height="160" >
<Image src="res://icon" stretch="fill" height="100" width="100" className="infoWindowImage" />
<Label text="Let's Begin!" className="title" />
</StackLayout>
</template>`;
from nativescript-google-maps.
@kefahB - as always, thanks for the prompt response.
Given that mine is a JavaScript project, what should I add to (presumably) map-page.js?
from nativescript-google-maps.
Yes
from nativescript-google-maps.
To be more specific:
public infoWindowTemplate: string | Template;
public infoWindowTemplates: string | Array<KeyedTemplate>;
is TypeScript, and is not valid in my JavaScript project. I receive Declaration or statement expected
messages.
from nativescript-google-maps.
You wont use those, you will use them from marker. infoWindowTemplates =
YOUR XML TEMPLATE``
marker.infoWindowTemplates = `<template key="testWindow">
<StackLayout orientation="vertical" width="160" height="160" >
<Image src="res://icon" stretch="fill" height="100" width="100" className="infoWindowImage" />
<Label text="Let's Begin!" className="title" />
</StackLayout>
</template>`;
// THEN TRY TO ADD YOUR TEMPLATE
marker.infoWindowTemplate = 'testWindow';
Like I sed, I imagine how it does work and I didn't tested it
from nativescript-google-maps.
Ah, I understand. I'll play with this and let you know how it goes. Thanks again.
from nativescript-google-maps.
@dlcole I'll try to bring a little time to do some stuff on this but I have also a lot of migrations to do and have my business also :)
from nativescript-google-maps.
@kefahB Any progress on this issue? I'll need to publish my app next month and it would be really great if this could be working. Is there anything I can contribute on my end?
from nativescript-google-maps.
I investigated this further and got it working. The dapriett version of this plugin includes this warning:
[!WARNING] if you are using NS7 infoWindowTemplate won't work from a xml file! a temporary solution will be declaring infoWindow Template from the code behind like this :
I followed that example but for keyed info window templates:
var mapView;
export function onMapReady(args) {
mapView = args.object;
// Define custom map marker templates
mapView.infoWindowTemplates =
`<template key="infoWindow">
<StackLayout orientation="vertical" width="250" height="160">
<Label textWrap ="true" class="info-title" text="{{ title }}" />
<Label class="info-snippet" textWrap="true" text="{{ snippet }}" />
<Label class="info-text" textWrap ="true" text="{{ info }}" />
</StackLayout>
</template>
<template key="mapGroupWindow">
<StackLayout orientation="vertical" width="200" height="100">
<Label class="info-title" textWrap ="true" text="{{ title }}" />
<Label class="info-date" textWrap="true" text="{{ snippet }}" />
<Label class="info-since" textWrap ="true" text="{{ info }}" />
<Label class="info-since" textWrap ="true" text="{{ speed }}" />
</StackLayout>
</template>
<template key="weatherWindow">
<StackLayout orientation="vertical" width="270" height="120">
<Label textWrap ="true" class="info-title" text="{{ title }}" />
<Label class="info-snippet" textWrap="true" text="{{ snippet }}" />
<Label class="info-text" textWrap ="true" text="{{ info }}" />
</StackLayout>
</template>`;
This now lets me access and format the various info windows as desired. So, you can use keyed info window templates, you just have to specify them in the mapReady event handler. As such, I'll close this issue.
from nativescript-google-maps.
Related Issues (11)
- Nativescript 8 HOT 11
- {N} 8.1 iOS app crashes immediately attempting to navigate to map page HOT 9
- Crash on iOS calling GMSMapView.mapWithFrameCamera HOT 5
- Could not find com.android.tools.build:gradle:4.5.6. HOT 17
- Failed to build plugin @kefah/nativescript-google-maps HOT 1
- How to make package or how can I include this source code into my project HOT 1
- StyleBase circular export Android HOT 4
- NO NATIVE COMPONENT FOR ELEMENT TAG NAME NATIVEMAPVIEW HOT 1
- Organize documentation
- isInfoWindowShown always returns true HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-google-maps.