dapriett / nativescript-google-maps-sdk

Cross Platform Google Maps SDK for Nativescript
MIT License
244 stars 163 forks source link

MapView issues in TabView component - cameraChanged not fires, markers cant be added #229

Open lpikora opened 6 years ago

lpikora commented 6 years ago

Platform: iOS Language: Angular

Description

When MapView is added as tab to MapView, added marker makes an error on iOS:

CONSOLE LOG file:///app/map/map.component.js:19:20: Map Ready
CONSOLE LOG file:///app/map/map.component.js:21:20: Setting a marker...
CONSOLE LOG file:///app/map/map.component.js:19:20: Map Ready
CONSOLE LOG file:///app/map/map.component.js:21:20: Setting a marker...
CONSOLE ERROR [native code]: ERROR TypeError: null is not an object (evaluating '_this._markers.push')
CONSOLE ERROR [native code]: ERROR CONTEXT [object Object]

cameraChanged event not fires on iOS when MapView is in TabView.

on Android all works fine.

Sourcecode

<TabView  xmlns="http://www.nativescript.org/tns.xsd" xmlns:maps="nativescript-google-maps-sdk" selectedIndex="0" sdkExampleTitle sdkToggleNavButton>
    <GridLayout *tabItem="{title: 'Map'}">
        <MapView #mapView [latitude]="latitude" [longitude]="longitude"
                 [zoom]="zoom" [bearing]="bearing"
                 [tilt]="tilt" i-padding="50,50,50,50" [padding]="padding" (mapReady)="onMapReady($event)"
                 (markerSelect)="onMarkerEvent($event)" (markerBeginDragging)="onMarkerEvent($event)"
                 (markerEndDragging)="onMarkerEvent($event)" (markerDrag)="onMarkerEvent($event)"
                 (markerInfoWindowTapped)="onMarkerEvent($event)" (coordinateTapped)="onCoordinateTapped($event)"
                 (cameraChanged)="onCameraChanged($event)"></MapView>
    </GridLayout>
    <GridLayout *tabItem="{title: 'Icon'}">
        <Image class="m-t-30 m-b-15" src="~/images/level1.png" width="80" height="80"></Image>
        <Label text="NativeScript" textWrap="true" class="h2 m-x-auto" color="blue"></Label>
    </GridLayout>
</TabView>

Github repo (fork of this repo with ng-demo modified)

https://github.com/lpikora/nativescript-google-maps-sdk

dennisdoc commented 6 years ago

+1