ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
192 stars 187 forks source link

Ionic1 expose-aside-when not working with Orientation change #335

Closed stripathix closed 6 years ago

stripathix commented 6 years ago

IonicV1 exposeAsideWhen not working with iPad Pro (12.9-inch) (2nd generations) (iOS 11.1)

I want to keep sideMenu open for Portrait mode in iPad Pro 12.9 inch. For this I have used directive like this: <ion-side-menu side="left" class="bn-menu" width="200" expose-aside-when="(min-width:1025px)">

But as the device is rotated multiple times sidemenu behaves weird. Either it stays open all the time or it gets closed for both landscape and portrait.

screen shot 2017-11-14 at 4 39 54 pm
revie commented 6 years ago

I fixed the problem on mine by duplicating the "resize" portion in the exposeAsideWhen directive in ionic.bundle.js to also trigger on "orientationchange". Just add the following right before function checkAsideExpose():

ionic.on('orientationchange', function() { if (prevInnerWidth === $window.innerWidth && prevInnerHeight === $window.innerHeight) { return; } prevInnerWidth = $window.innerWidth; prevInnerHeight = $window.innerHeight; onResize(); }, false);

Not sure why WKWebView isn't triggering a resize() call when it gets rotated on iOS 11, but the above fix seems to have worked for me.

stripathix commented 6 years ago

Thanks, works for me also :) .

stripathix commented 6 years ago

I wonder if this change will be merged into IonicV1 repo.