NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

ActionBar + Page transition are causing content displacement (iOS) #1377

Open jeremypele opened 6 years ago

jeremypele commented 6 years ago

Hi,

with the transition to {N} 4.1 and nativescript-angular 6.0, I'm facing some issues coming from navigation animations.

I'm transitioning from a flat actionBar to a "regular" one, and the page is not correctly positionned.

with-animation

When I'm removing the animation, the position is correct.

without-animation

Seems like the animation calculations aren't correct.

Another example I have is with a page having a negative marginTop (to display an image under the actionBar). The position is broken when navigating back to this page. All good without the animations though.

NickIliev commented 6 years ago

@jeremypele I have created this test application trying to recreate the issue but to no avail. Can you please provide more information about the codebase used (the type of page transitions, the action bar code, etc.) - you could either modify my own example or directly create a Playground demonstration.

Also, is this happening on a specific iOS version?

jeremypele commented 6 years ago

Using ios 11.4. It actually works correctly when no transition are provided.

this._routerExtensions.navigate('my-page')

but as soon as a special transition is defined, then it breaks

this._routerExtensions.navigate('my-page,  { transition: { name: 'slideLeft' } })

I'll try to update the test app ASAP, but I'm first trying to clean my app to see if removing the custom transitions works for me. Still a bug though

jeremypele commented 6 years ago

@NickIliev Easy to reproduce with a new app. I've updated the seed on this fork => https://github.com/jeremypele/NS-Issues-2018-II/tree/master/nativescript-angular/issue-1377/app

With the transition: the second page got a padding-top white and going back to the first one put the page content under the status bar.

Without the transition it works just fine.

NickIliev commented 6 years ago

@jeremypele thank you for the detailed info. Confirming this one as a reproducible bug on iOS.

Steps to reproduce:

Happening only on iOS. The same will happen if we are navigating from page with ActionBar to page without any ActionBar

Related to https://github.com/NativeScript/NativeScript/issues/5768

jeremypele commented 6 years ago

@NickIliev Another issue, different but can be reproduced on the same demo app.

1) Navigate to the second page (without transition) 2) Start to drag the page to the left to go back but stay on the page

The header is broken and displays the first page actionbar style.

header-issue

WouterVanVegchel commented 6 years ago

On iOS 10.3 I have a similar issue: when I navigate to a page, the height of the action bar (flat) is ignored; content disappears under the action bar. As soon as I use a button from the keyboard on this page, the height of the action bar is no longer ignored; the content moves down. This behavior is only on iOS 10.

ThunderAnimal commented 6 years ago

Same here.

nativescript-angular: 6.06 tns-ios: 4.1.1

  1. First page hides the action-bar: this._page.actionBarHidden = true;
  2. Second page has normal action-bar with content on page
  3. When navigating from first page to second: the content will be pushed under the action-bar
  4. when navigating back with swipe, the UI of the action bar on second page break and is suddenly white

Can reproduce under iOS 10 and 11.

t3hmrman commented 5 years ago

Just ran into this -- I removed flat from my <ActionBar>s and things got much better, along with removing all places where I specified transition when navigating

mimamo10 commented 5 years ago

I'm having the same issue as t3hmrman, putting flat=true on the ActionBar displaces the content below. I'm not transitioning anywhere.

The same thing happens if, instead of setting 'flat', I set ios.controller.navigationBar.translucent to false.

mimamo10 commented 5 years ago

... I'm not using Angular, just javascript.

felicks commented 5 years ago

Is there a solution for this issue? I'm using the flat attribute to remove the color correction from ios

paul-muckypuddle commented 5 years ago

Experiencing this same issue with Nativescript Vue as well.

felicks commented 5 years ago

If you are using a ScrollView put it inside a StackLayout. This resolved the issue for me!

victordcp commented 5 years ago

Same problem here, I'm using nativescript/angular and iOS 12...

nmongiya commented 5 years ago

Not only on ios 12; it can be reproduced on ios 11 as well.

shmatul commented 5 years ago

+1 happens for me as well

stevenspiel commented 5 years ago

like @t3hmrman and @mimamo10, the issue is only present when flat=true is set (I'm using NS Core).

t3hmrman commented 5 years ago

hey @stevenspiel agreed -- I solved it by just removing flat IIRC. I might have also shuffled around some views (maybe the ScrollView and some layout) as @felicks suggested.

bl00djack commented 4 years ago

I don't know if anyone has found a proper solution for this yet. For me, I added a marginTop="1" in <ScrollView marginTop="1"> and it worked. However, it leaves a 1px of space between the ActionBar and ScrollView which you can probably cheat depending on the color/styling of your app. This is my full code

<template>
  <Page>
    <ActionBar title="Title" flat="true">
      <NavigationButton visibility="collapsed" />
    </ActionBar>
    <ScrollView marginTop="1">
        <!--- content -->
    </ScrollView>
  </Page>
</template>
pekevski commented 4 years ago

Removing flat=true on the ActionBar DOM element doesn't fix this issue for me. The only thing that correctly aligns the page is removing the animation options from the router.navigation