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

Support for iPhone X #59

Closed
kenljv opened this issue Nov 21, 2017 · 8 comments
Closed

Support for iPhone X #59

kenljv opened this issue Nov 21, 2017 · 8 comments

Comments

@kenljv
Copy link

kenljv commented Nov 21, 2017

I notice when using the default React Navigation TabNavigator the bottom safe area is automatically adjusted for both tab bar height and icons aligned to the top nicely but the moment I plug in tabBarComponent: NavigationComponent it does not and it will overlap with the bottom bar. Is there any support for this? Thanks!

@timomeh
Copy link
Owner

timomeh commented Nov 24, 2017

At the moment you could achieve this by checking if the device is an iPhone X and using innerStyle with an appropriate paddingBottom.

@Ehesp
Copy link

Ehesp commented Nov 27, 2017

Easy fix (RN 50+):

import { SafeAreaView } from 'react-native';
...
render() {
  return (
    <SafeAreaView style={{ flex: 1 }}>
      // rest of your app goes here
    </SafeAreaView>
  );
}

@kenljv
Copy link
Author

kenljv commented Nov 27, 2017

Thanks @timomeh and @Ehesp for the suggestion. I'll try that out. Also I read that it's not possible to do custom styling i.e. change font size for the tab titles? This is because on iOS it does appear a bit too large.

@keeleycarrigan
Copy link
Contributor

@kennyljv @timomeh I actually worked out a solution to that title custom styling locally recently just messing around but hadn't gotten around to making a PR. I will try to get one soon if @timomeh is cool with it.

@timomeh
Copy link
Owner

timomeh commented Dec 15, 2017

@keeleycarrigan Of course, contributions are always welcome. ❤️

@ermalkaleci
Copy link

@kennyljv @timomeh
Easy solution:

import { TabNavigator, SafeAreaView } from 'react-navigation';
import { NavigationComponent } from 'react-native-material-bottom-navigation';

const TabBar = props => (
  <SafeAreaView
    forceInset={{ top: 'never', bottom: 'always', horizontal: 'never' }}
    style={{ backgroundColor: '#fff' }}
  >
    <NavigationComponent {...props} />
  </SafeAreaView>
);

const MainScreen = TabNavigator(
  {
    Tab1: { screen: Screen },
    Tab2: { screen: Screen },
    Tab3: { screen: Screen },
    Tab4: { screen: Screen },
  },
  {
    tabBarComponent: TabBar,
    tabBarPosition: 'bottom',
    },
);

@timomeh
Copy link
Owner

timomeh commented Mar 22, 2018

I added support for iPhone X without SafeAreaView in #76. This issue will be closed when v1.0 will be released.

marz-22-2018 12-07-02

@timomeh timomeh added this to the v1.0.0 milestone Mar 22, 2018
@timomeh
Copy link
Owner

timomeh commented May 14, 2018

Closed with v1.0.0 ✨

@timomeh timomeh closed this as completed May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants