Skip to content

Instantly share code, notes, and snippets.

@rayterrill
Last active December 25, 2017 03:02
Show Gist options
  • Select an option

  • Save rayterrill/3a33efa480d8b02a65ae045cd30dffa4 to your computer and use it in GitHub Desktop.

Select an option

Save rayterrill/3a33efa480d8b02a65ae045cd30dffa4 to your computer and use it in GitHub Desktop.

Setting Text to Start Just Below the Status Bar

import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Image } from 'react-native';
import { getStatusBarHeight } from 'react-native-status-bar-height';

export default class LotsOfStyles extends Component {
  render() {
    return (
      <View style={styles.top}>
        <Text style={styles.red}>just red</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  top: {
	paddingTop: getStatusBarHeight(),
  }
});

// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject', () => LotsOfStyles);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment