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] Why NavigatorIOS overlaps upper part of inner component?

See original GitHub issue

I’ve just generated empty React-Native project (using react-native init) and added sample NavigatorIOS code.

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

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

var TestProject = React.createClass({
  render: function() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
});

var Test = React.createClass( {
  render() {
    return (
      <NavigatorIOS
        style={{flex:1}}
        initialRoute={{
          title: 'Preference',
          component: TestProject
        }}
        />
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('TestProject', () => Test);

ios simulator screen shot 10 2015 15 33 19

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
ericcastro92commented, May 10, 2017

FYI: For those coming across this issue, a more stable solution than setting paddingTop: 64 is turning off the translucent property.

<NavigatorIOS
   translucent={false}
   initialRoute={{
      ...
   }}/>
1reaction
marcshillingcommented, Jun 10, 2015

This is default iOS behavior since iOS 7 when they made the Navigation Bar translucent. Content is supposed to be able to visually scroll beneath the nav bar.

Anyway, if you don’t need that functionality, just set paddingTop: 64 on your container style which will start everything beneath the nav bar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native - Navigation from inner components
In a React Native application, how can I perform navigation when touching in some component not directly tied up with the main Navigator...
Read more >
Supporting safe areas | React Navigation
The area not overlapped by such items is referred to as "safe area". We try to apply proper insets on the UI elements...
Read more >
NavigatorIOS - React Native Archive
A navigator is an object of navigation functions that a view can call. It is passed as a prop to any component rendered...
Read more >
Communication between native and React Native
We maintain a hierarchy of components, in which each component depends only on its parent and its own internal state. We do this...
Read more >
Component won't render within NavigatorIOS - React Native ...
I had the same issue. Turned out I had to add some margin to the top of the view inside the MyView component....
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