Avoid status bar overlap on all screens

Viewed 18729
2 Answers

Step 1: Import Platform and StatusBar

import { Platform, StatusBar} from 'react-native';

Step 2: Add this style in parent View

paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0 

Full Code:

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

    export default class App extends Component {
      render() {
        return (
          <View style={{ paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0 }}>
            <Text>This is Text</Text>
          </View>
        );
      }
    }
Related