wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

[V4][iOS] A title for stack doesn`t work #5853

Open mtnt opened 4 years ago

mtnt commented 4 years ago

Issue Description

I have the following structure: root -> stack -> component(single); There is a text title for the stack and it`s invisible. (I tried a component also and its constructor wasn`t called) But if I use static options inside the component (single child of the stack) the title is shown.

Steps to Reproduce / Code Snippets / Screenshots

{
  root: {
    bottomTabs: {
      children: [
        {
          stack: {
            children: [{...}],
            options: {
              topBar: {
                visible: true,
                title: { text: 'sample title' },
              },
              bottomTab: { text: 'Menu' },
            },
          },
        },
      ],
    },
  },
};

Environment

mtnt commented 4 years ago

FYI: When a title set to a child component options, it works well.

SudoPlz commented 3 years ago

@mtnt We may be experiencing the same issue.

Can you please try the following and let me know if it works for you?

1) Go to: https://github.com/wix/react-native-navigation/blob/master/lib/ios/TopBarTitlePresenter.m#L21 which for you should be in node_modules/react-native-navigation/lib/ios/TopBarTitlePresenter.m

and replace if (options.subtitle.text.hasValue) { with if (options.subtitle.text.hasValue || options.title.text.hasValue) {

2) Set the following into your topBar

topBar: {
    visible: true,
    title: { text: 'sample title' },
    background: {
        color: '#00000000' // We need this otherwise the topBar title get's hidden behind a background view
    }
},

and see if that makes your title visible.

I think this is a bug, but I'm still trying to figure it out.

SudoPlz commented 3 years ago

Ok I managed to steadily reproduce this one and opened another ticket with a reproducible example: https://github.com/wix/react-native-navigation/issues/7001