Ionic-native: google maps setPadding not working

Created on 23 Sep 2016  路  14Comments  路  Source: ionic-team/ionic-native

google maps setPadding function is not working

Tried setPadding on a cordova project and it works no problem...

I am on ionic 2 beta 11

Most helpful comment

The issue is caused by ionic native add 2 extra null value on the args when the function is a sync call.

I have fixed it on my fork and I will provide a pull request.

All 14 comments

Can provider more info of problem?

@ramonornela I call map.setPadding(0,0,200,0) and it executes and does not set the padding like the google sdk is suppose to do. Did you test setPadding and get a different result?

       let latLng = new GoogleMapsLatLng(43.6439596, -79.3888239);
        this.map = new GoogleMap('nearbyMap', {
          'controls': {
            'compass': false
          },
          'gestures': {
            'tilt': false,
            'rotate': false
          }
        });
        this.map.on(GoogleMapsEvent.MAP_READY).subscribe((event) => {
            this.map.setPadding( 0, 0 , 200 , 0 );
        });

What the version ionic-native?

I doubt this is an issue with Ionic Native. It's probably just another conflict caused by Ionic Framework or could be a zoning issue. Try wrapping your setPadding() call with ngZone.run().

@ramonornela the latest version

@ihadeed I tried ngZone.run() like this:

        this.map.on(GoogleMapsEvent.MAP_READY).subscribe((event) => {
            this.zone.run(() => {
                this.map.setPadding(0,0,200,0);
            });
        });

and is still not working for me...to confirm this, I tried this.map.setClickable(false) and it successfully executes no problem in ngZone.run().

@ramonornela @ihadeed , have you tried setPadding and is working with an ionic 2 / ionic-native project?

Hey , I've also tried various workarounds but its noy working for me as well , please help with this if anyone can

@uditguru Tomorrow I will try look at it 馃槈

@uditguru I'm traveling many problems Internet since yesterday, I'll try later.

The issue is caused by ionic native add 2 extra null value on the args when the function is a sync call.

I have fixed it on my fork and I will provide a pull request.

My pull request here: https://github.com/driftyco/ionic-native/pull/646
That is my simple fix, just add resolve and reject to the args if either of them is not null.
But it seems that I am touching some core functions, I am not sure if it does not break other functions.

Problem with one to three arguments in example code above has four arguments :wink:, more too exists problem mentioned 馃槈

Thanks

@uditguru @arielgelbard the version 2.2.0 fixed this?

Closing this for now. We can re-open if you're still having issues.

Was this page helpful?
0 / 5 - 0 ratings