React-native-navigation: [V2][iOS] topBar is not displaying Title Text

Created on 21 Feb 2019  路  2Comments  路  Source: wix/react-native-navigation

Issue Description

IOS topbar is not rendering text at all while Android's topbar title is. The phone on the right is the Iphone 8 SImulator while the phone on the left is the Google Pixel 2.

screen shot 2019-02-20 at 11 31 02 pm

Steps to Reproduce / Code Snippets / Screenshots

import { Navigation } from "react-native-navigation";
import AuthScreen from './src/screens/Auth';
Navigation.registerComponent('AuthScreen', () => AuthScreen);

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      stack: {
        children: [{
          component: {
            name: 'AuthScreen',
          }
        }],
        options: {
          topBar: {
            title: {
              text: 'Login'
            }
          }
        }
      }
    }
  });
});

Environment

"react-native": "0.58.5",

  • React Native Navigation version: ^2.12.0
  • React Native version: 0.58.5
  • Platform(s) (iOS, Android, or both?): IOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Iphone 8 Simulator

Most helpful comment

Hello. Please try to replace topBar options from stack to component. I thinks it should be something like this:

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      stack: {
        children: [{
          component: {
            name: 'AuthScreen',
            options: {
              topBar: {
                title: {
                  text: 'Login'
                }
              }
            }
          }
        }]
      }
    }
  });
});

All 2 comments

Hello. Please try to replace topBar options from stack to component. I thinks it should be something like this:

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      stack: {
        children: [{
          component: {
            name: 'AuthScreen',
            options: {
              topBar: {
                title: {
                  text: 'Login'
                }
              }
            }
          }
        }]
      }
    }
  });
});

This solved my problem, this should be noted in the docs if it hasn't already.

Was this page helpful?
0 / 5 - 0 ratings