React-native-navigation: iOS TopBar title font weight changes on push/pop

Created on 15 May 2019  路  17Comments  路  Source: wix/react-native-navigation

Issue Description

2019-05-15 20 30 45

Steps to Reproduce / Code Snippets / Screenshots


Navigation.setRoot({
    root: {
      stack: {
        children: [
          {
            component: {
              name: 'navigation.app',
              options: {
                topBar: {
                  visible: true,
                  title: {
                    text: 'Your Recipes',
                  },
                  searchBar: true,
                  searchBarPlaceholder: "Search for Recipes",
                  rightButtons: [
                    {
                      id: "add-recipe",
                      systemItem: "add"
                    }
                  ]
                },
              }
            }

          }
        ]
      }
    }
  })

After using Navigation.push() and Navigation.pop() the title font weight changes and stays like this.


Environment

  • React Native Navigation version: Tested on latest master branch
  • React Native version: 0.59.5
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Both Simulator + physical device. Both debug and release builds.
馃彋 stale

Most helpful comment

For everyone experiencing this:
Hotfixed it for myself by editing this line:

https://github.com/wix/react-native-navigation/blob/b0c8113243de2043b98442dd485c04b0422aa213/lib/ios/RNNFontAttributesCreator.m#L18

- titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[fontSize floatValue]];
+ titleTextAttributes[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[fontSize floatValue]];

All 17 comments

Yeah, this has been around for some time now. I think this occurs on both platform.

I have the same problem, huge bummer

Same here

I can reproduce this on
"react-native": "0.59.8", "react-native-navigation": "2.18.5"

For everyone experiencing this:
Hotfixed it for myself by editing this line:

https://github.com/wix/react-native-navigation/blob/b0c8113243de2043b98442dd485c04b0422aa213/lib/ios/RNNFontAttributesCreator.m#L18

- titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[fontSize floatValue]];
+ titleTextAttributes[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[fontSize floatValue]];

Create a PR for it, everyone can benefit from it :)

I don't think it's exactly expected behavior to always be bold, and this also only works if you don't use a custom font. If it is I'd be happy to create a PR :)

I think it should inherit from the user set in options, however if user doesn't specify, it should be default to bold? The fact that it's bold initially suggest to me that it should default to bold.

There is no configurable option as of now.

Still an issue on react-native-navigation version 2.21.0

For everyone experiencing this:
Hotfixed it for myself by editing this line:

https://github.com/wix/react-native-navigation/blob/b0c8113243de2043b98442dd485c04b0422aa213/lib/ios/RNNFontAttributesCreator.m#L18

- titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[fontSize floatValue]];
+ titleTextAttributes[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[fontSize floatValue]];

Used https://www.npmjs.com/package/patch-package along with this one

- titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[fontSize floatValue]];
+ titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[fontSize floatValue] weight:UIFontWeightBold];

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

NOt stale :(

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

not stale :(

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings