question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NavigatorIOS component not visible when used within TabBarIOS

See original GitHub issue

The NavigatorIOS component is rendered but not visible when used within TabBarIOS. However, it is visible in the Chrome and Xcode debuggers.

Rendered App

app

Chrome Debugger View

chrome debugger view

Xcode Captured View Hierarchy capture view hierarchy

App Code

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TabBarIOS,
  NavigatorIOS
} = React;

var ApplePage = React.createClass({
  render: function () {
    return (
      <View style={styles.view}>
        <Text style={styles.text}>Hello</Text>
        <Text style={styles.text}>World</Text>
      </View>
    )
  }
})

var MainView = React.createClass({

  getInitialState: function() {
    return {
      selectedTab: 'appleTab',
      notifCount: 0,
      presses: 0,
    };
  },

  render: function () {
    return (

      <TabBarIOS>
        <TabBarIOS.Item
          title="Apple Tab"
          icon={_icon('more')}
          selected={this.state.selectedTab === 'appleTab'}
          onPress={() => {
            this.setState({
              selectedTab: 'appleTab',
            });
          }}>

          <NavigatorIOS
            initialRoute={{
              title: 'Apple',
              component: ApplePage,
            }}
          />

        </TabBarIOS.Item>
      </TabBarIOS>
    )
  }
})

function _icon(imageUri) {
  return {
    uri: imageUri,
    isStatic: true
  };
}

var styles = React.StyleSheet.create({
  text: {
    color: 'black',
    backgroundColor: 'white',
    fontSize: 50,
    marginTop: 100
  },
  container: {
    flex: 1
  }
})

AppRegistry.registerComponent('MartialApp', () => MainView)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
nickhudkinscommented, Apr 10, 2015

The View that NavigatorIOS creates has no dimensions, toss a style that has {flex: 1} on it, and paddingTop: 64, flex: 1 on the myPage View and you’ll be all set 😃

var styles = StyleSheet.create({
  nav: {
    flex: 1
  },
  myPage: {
    flex: 1,
    backgroundColor: 'orange',
    paddingTop: 64
  }
});
0reactions
jerry-sjtucommented, Jan 24, 2016

@nickhudkins Thanks for saving my time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavigatorIOS doesn't work with TabBarIOS · Issue #504 · facebook ...
When the tab is selected, it does not display the NavigatorIOS correctly. The navigation bar appears at the top (and the navigator's initial...
Read more >
React Native : TabBarIOS and Navigation - Stack Overflow
But for second item, i tried using navigatorios to show component, but it shows only a blank page with title. it doesn't show...
Read more >
Implementing TabBarIOS with React Native | by Devsteam.mobi
Give each PreviousMonthsList its own NavigatorIOS component so that the TabBarIOS component does not disappear when PreviousMonthsList navigates to a previous ...
Read more >
NavigatorIOS · React Native
In this code, the navigator renders the component specified in initialRoute, which in this case is MyScene . This component will receive a...
Read more >
react-native-vector-icons - npm
Perfect for buttons, logos and nav/tab bars. Easy to extend, style and integrate into your project. Main advantages over react-native-icons.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found