React-native-router-flux: Title not centered in navBar in Android with one of left/right icons

Created on 6 Oct 2017  路  24Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.21
  • react-native v0.47.1

Expected behaviour

Title appears correctly centered when neither left and right icons exists or when both of them exist
With just one of left or right icons at the same time title should appear centered

Actual behaviour

The title is not centered if only one of right and left icons exists at the same time.

captura de pantalla 2017-10-06 a las 16 47 20

bug help wanted

Most helpful comment

Fixed on #3256.

Image from Gyazo

This was possible because of react-navigation changes, when headerLayoutPreset support was added. Docs were also updated to reflect it.

Example.js file has an example of how to make it work, below the line where it happens:

<Stack key="customNavBar" hideTabBar headerLayoutPreset='center'>

All 24 comments

I encountered this issue as well. What I do is adding a placeholder for left button and right button on root Scene. When the child Scene has any left/right button, override the property.

renderPlaceholder = () => <View />
<Scene
     key="root"
     renderLeftButton={this.renderPlaceholder}
     renderRightButton={this.renderPlaceholder}
/ >

eg: child Scene

<Scene
     key="sub"
     title="sub"
     component={PageComponent}
     hideTabBar
     renderLeftButton={() => <BackButton />}
/>

Please check latest master and PR #2491 (I've just merged it). Unfortunately I'm working on ios app only.

@aksonov I can help you testing changes on android - just tag me in the PR and give me instructions and I can check it there. :+1:

@daviscabral Could you check this ticket? :)

@aksonov it's still the same on android. Do I have to add any props to scene to get reflection or it should work automatically?

Right, I see this bug and PR is welcome.

android_title_alignment

"react-native": "0.51.0",
"react-native-router-flux": "^4.0.0-beta.25",

Will this be fixed?,I cant push the app to production without a fix.

Sorry - I've been idle in the last few days but I am getting back now to check this. I'll get an update as soon as I get my simulator up and running here.

@daviscabral any update?

Issue is still present on master - going to investigate now to see if I am able to solve it.
screenshot 2018-02-23 06 34 54

This issue is also present on React Native v. 0.54.2 with react-native-router-flux v. 4.0.0-beta.28.

I am a bit busy lately and couldn't finish the PR that I've started. I'll check if later today I'll spare some time for it. Thank you.

@davidcabral Is this going to get fixed?? Thank You

On it - should have a PR in a few hours. I am in a company transition, things are just crazy lately.

Sorry - took longer than I thought cause I was trying to fix the Example project that was not running - so I couldn't actually test and verify it properly.

@daviscabral Thank you! I manage to solve the issue making a custom nav bar. However this is better! Thanks!! Good luck with the company transition!

Thank you. Glad to hear that.

I'm still having this issues with react-native 0.55 and react-native-router-flux 4.0.0-beta.31 .
Was this fixed or should I follow @acollazomayer solution ?

The solution written by @JessieYF works good

Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists

This issue still exists with RNRF v4.0.5. Im not able to open it, but I think that it have to be open.

cc @daviscabral

Fixed on #3256.

Image from Gyazo

This was possible because of react-navigation changes, when headerLayoutPreset support was added. Docs were also updated to reflect it.

Example.js file has an example of how to make it work, below the line where it happens:

<Stack key="customNavBar" hideTabBar headerLayoutPreset='center'>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

VictorK1902 picture VictorK1902  路  3Comments

maphongba008 picture maphongba008  路  3Comments

sarovin picture sarovin  路  3Comments

YouYII picture YouYII  路  3Comments

sreejithr picture sreejithr  路  3Comments