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

NavigationBar fix for iPhone X, Xs Max, XR #434

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dongminkim
Copy link

I've found that NavigationBar dimension issues, especially on iPhone X.
So I try to fix them, and they seems to be fixed.

Simulators are positioned like this on screeenshots:

iPhone X iPhone SE
iPhone Xs Max iPhone XR

[Before]
1-2

[After]
2-2

[Test Source Code]

/* eslint-disable global-require */
import React, { Component } from 'react';
import {
  StatusBar,
} from 'react-native';
import { getStatusBarHeight } from 'react-native-status-bar-height';

import {
  Font, AppLoading,
} from 'expo';

import {
  View, Screen, NavigationBar,
  Icon, Button, Title, Caption,
} from '@shoutem/ui';

export default class App extends Component {
  static navigationOptions = {
    header: null,
  };

  state = {
    fontsAreLoaded: false,
  };

  async componentWillMount() {
    await Font.loadAsync({
      'Rubik-Black': require('../node_modules/@shoutem/ui/fonts/Rubik-Black.ttf'),
      'Rubik-BlackItalic': require('../node_modules/@shoutem/ui/fonts/Rubik-BlackItalic.ttf'),
      'Rubik-Bold': require('../node_modules/@shoutem/ui/fonts/Rubik-Bold.ttf'),
      'Rubik-BoldItalic': require('../node_modules/@shoutem/ui/fonts/Rubik-BoldItalic.ttf'),
      'Rubik-Italic': require('../node_modules/@shoutem/ui/fonts/Rubik-Italic.ttf'),
      'Rubik-Light': require('../node_modules/@shoutem/ui/fonts/Rubik-Light.ttf'),
      'Rubik-LightItalic': require('../node_modules/@shoutem/ui/fonts/Rubik-LightItalic.ttf'),
      'Rubik-Medium': require('../node_modules/@shoutem/ui/fonts/Rubik-Medium.ttf'),
      'Rubik-MediumItalic': require('../node_modules/@shoutem/ui/fonts/Rubik-MediumItalic.ttf'),
      'Rubik-Regular': require('../node_modules/@shoutem/ui/fonts/Rubik-Regular.ttf'),
      'rubicon-icon-font': require('../node_modules/@shoutem/ui/fonts/rubicon-icon-font.ttf'),
    });

    this.setState({ fontsAreLoaded: true });
  }

  render() {
    if (!this.state.fontsAreLoaded) {
      return <AppLoading />;
    }

    return (
      <Screen>
        <StatusBar backgroundColor="white" barStyle="dark-content" />
        <NavigationBar
          styleName="inline"
          leftComponent={<Button><Icon name="sidebar" /></Button>}
          centerComponent={<Title>NavigationBar</Title>}
          style={{
            container: {
              backgroundColor: 'lightpink',
            },
            componentsContainer: {
              backgroundColor: 'hotpink',
            },
            statusBar: {
              height: getStatusBarHeight(),
              backgroundColor: 'clear',
            },
          }}
        />
        <View>
          <Title>Hello</Title>
          <Caption>
            getStatusBarHeight() =
            {getStatusBarHeight()}
          </Caption>
        </View>
      </Screen>
    );
  }
}

@simpleminds619
Copy link

I am also facing this issue. Can we prioritize this PR and make this fix available soon please?

@dongminkim
Copy link
Author

dongminkim commented Nov 11, 2019

I've tested commit c87ba00.
Simulators are positioned like this on the screeenshot:

iPhone 11 Pro iPhone 8
iPhone 11 Pro Max iPhone 11

screenshot_331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants