Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom title not centered on Android after upgrade to 4.0.1 #3207

Closed
pehagg opened this issue Aug 24, 2018 · 4 comments
Closed

Custom title not centered on Android after upgrade to 4.0.1 #3207

pehagg opened this issue Aug 24, 2018 · 4 comments

Comments

@pehagg
Copy link

pehagg commented Aug 24, 2018

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.1
  • react-native v0.56
  • os Android

Expected behaviour

Title should be centered.

Actual behaviour

The title used to be centered before upgrading from 4.0.0-beta.27 to 4.0.1. Title aligns to the left, next to the back button. Using titleStyle that centers the component doesn't help. Removing the renderRightComponent view required for centering the title on Android didn't help either.

This is the style definition for the title component:

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'center',
  },
});
@daviscabral
Copy link
Collaborator

This seems to be related to the react-navigation@2 upgrade.

Checking the link below, it seems now they have a headerLayoutPreset prop to manage that. That's not supported yet and will have to add it to the list.

react-navigation/react-navigation#4588
react-navigation/react-navigation#4615

@pehagg
Copy link
Author

pehagg commented Aug 24, 2018

Was able to fix this by adding flex: 1 to the style definition of the custom title component. Got inspiration from react-navigation/react-navigation#544. Using titleStyle doesn't seem to have any effect. Closing issue.

@pehagg pehagg closed this as completed Aug 24, 2018
@daviscabral
Copy link
Collaborator

daviscabral commented Aug 24, 2018

I'll keep this opened since it was an existent feature that is not working anymore and probably will be an easy to fix now that react-navigation provides an API for that.

That's also possible using custom nav bars.

@daviscabral daviscabral reopened this Aug 24, 2018
@aksonov
Copy link
Owner

aksonov commented Sep 6, 2018

Duplicate of #3153

@aksonov aksonov marked this as a duplicate of #3153 Sep 6, 2018
@aksonov aksonov closed this as completed Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants