Skip to content
This repository was archived by the owner on Jan 30, 2021. It is now read-only.
This repository was archived by the owner on Jan 30, 2021. It is now read-only.

[iOS] Hidden status bar not respected. #62

@dustinbahr

Description

@dustinbahr

This SafeAreaView does not respect hidden status bar in iOS as it should.

Even, when status bar is hidden, there is a top inset. You can use forceInsets to override this, however, it will then ALSO override the inset on iPhones with a notch. (iPhone X, etc)

In some circumstances, you want the safe area to inset for the notch, even if the status bar info is hidden.

The SafeAreaView built in to react-native DOES treat it correctly.

When status bar is hidden, there is still an inset on iPhone X, but not on normal iPhones.

Here are some examples:

react-native-safe-area-view SafeAreaView

import React from 'react';
import { View, StatusBar, Text } from 'react-native';
import SafeAreaView from 'react-native-safe-area-view';

export default class App extends React.Component {
  render() {
    return (
      <SafeAreaView style={{ backgroundColor: 'red', flex: 1 }}>
        <StatusBar hidden={true} />
        <View
          style={{
            backgroundColor: 'white',
            flex: 1,
            justifyContent: 'center',
            alignItems: 'center'
          }}
        >
          <Text>SafeAreaView</Text>
          <Text>react-native-safe-area-view</Text>
        </View>
      </SafeAreaView>
    );
  }
}

image

react-native SafeAreaView

import React from 'react';
import { View, StatusBar, Text, SafeAreaView } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <SafeAreaView style={{ backgroundColor: 'red', flex: 1 }}>
        <StatusBar hidden={true} />
        <View
          style={{
            backgroundColor: 'white',
            flex: 1,
            justifyContent: 'center',
            alignItems: 'center'
          }}
        >
          <Text>SafeAreaView</Text>
          <Text>react-native</Text>
        </View>
      </SafeAreaView>
    );
  }
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions