Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigator overlapping inner content #4264

Closed
fender opened this issue Nov 20, 2015 · 10 comments
Closed

Navigator overlapping inner content #4264

fender opened this issue Nov 20, 2015 · 10 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@fender
Copy link

fender commented Nov 20, 2015

I'm using the native Navigator component but when using a NavigatorBar, it is overlapping my inner content like so:
screenshot1

This is the content that should be visible but only shows when dragged/scrolled down.
screenshot2

Here is my nav component:

  ...
  render() {
    return (
      <Navigator
        style={styles.appContainer}
        initialRoute={{component: SplashScreen}}
        renderScene={this.renderScene}
        navigationBar={
          <Navigator.NavigationBar
            routeMapper={this.navBarRouteMapper}
            style={styles.navBar}
          />
        }
      />
    );
  }
});

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FFFFFF'
  },
  title: {
    fontSize: 40,
    fontWeight: 'bold',
    marginBottom: 5
  },
  button: {
    marginBottom: 7,
    borderWidth: 1,
    borderColor: '#000000',
    borderRadius: 2,
    padding: 5
  }
});

And the inner component:

  ...
  render() {
    return (
      <ListView style={styles.container}
        dataSource={this.state.dataSource}
        renderRow={this.renderRow}
      />
    );
  }

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  row: {
    flexDirection: 'row',
    justifyContent: 'center',
    padding: 10,
    backgroundColor: '#F6F6F6',
  },
  separator: {
    height: 1,
    backgroundColor: '#CCCCCC',
  },
  text: {
    flex: 1,
  }
});
@FaridSafi
Copy link

you can add sceneStyle={{paddingTop: 64}} to your navigator props

@sospartan
Copy link
Contributor

@FaridSafi better use this "Navigator.NavigationBar.Styles.General.NavBarHeight" I think

@brentvatne
Copy link
Collaborator

Hi there! Not a bug, please post these types of issues to StackOverflow :)

@lrettig
Copy link
Contributor

lrettig commented Jan 5, 2016

Has this issue been addressed on StackOverflow? I'm having the same issue and couldn't find anything related there. Just wanted to check before opening a new ticket. Thanks!

@fender
Copy link
Author

fender commented Jan 5, 2016

@lrettig I just added a paddingTop as mentioned above.

@lrettig
Copy link
Contributor

lrettig commented Jan 5, 2016

Thanks. I was confused by #470 as this:

Very simple solution will be wrap the with a container view, like ScrollView

didn't work for me. Adding paddingTop does, of course, help. I guess this is the accepted way of working around this issue.

@ragamufin
Copy link

Just an addition to @sospartan 's comment. I think the correct height can be found in Navigator.NavigationBar.Styles.General.TotalNavHeight

@pejalo
Copy link

pejalo commented Feb 9, 2017

Another tip: Scroll bars look better if you use marginTop instead of paddingTop

@ReDetection
Copy link

Well, Navigator is deprecated and removed from default package. What is recommended solution now?

@nhoxbypass
Copy link

I think paddingTop is the only solution if you don't want to embed it in a ScrollView or use 3rd library to get exactly the StatusBar height.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants