Skip to content

About

Module for measuring react-native safe area sizes

Resources

Stars

8 stars

Watchers

1 watching

Forks

Repository files navigation

react-native-safe-area-helper

Build Status Coverage Status

Introduction

This is a simple component that lets you know what the insets/paddings for safe area are. Helps when adding support for iPhone X and similar devices.

Installation

npm install react-native-safe-area-helper --save

Usage (with optional flow types)

import SafeAreaHelper, { type SafeAreaInsets } from 'react-native-safe-area-helper'

class App extends Component {
    onInsetsChange = (insets: SafeAreaInsets) => {
        console.log(insets) // { top: 44, bottom: 20, left: 22, right: 0, }
    }

    render() {
        return (
            <View>
                ...
                // It tries to fill the whole screen with absolute transparent view
                <SafeAreaHelper onInsetsChange={this.onInsetsChange} />
            </View>
        )
    }
}

About

Module for measuring react-native safe area sizes

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages