0

Just starting out learning React Native. Going through examples on the official site. I did the Hello World example and the status bar is overlapping the text. How can I hide the status bar?

import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';

class HelloWorldApp extends Component {
  render() {
    return (
      <Text>Hello world!</Text>
    );
  }
}

AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);

Thanks

1
  • post your code here Commented Apr 11, 2017 at 2:34

1 Answer 1

3

You can use the StatusBar component.

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

class HelloWorldApp extends Component {
  render() {
    return (
      <View>
        <StatusBar hidden={true} />
        <Text>Hello world!</Text>
      </View>
    );
  }
}

AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! Much appreciated
Above not worked for me. I need to hide status bar in some screens and not for all screens

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.