A flexible way to handle safe areas, also works on Android and the Web! This library currently has experimental support for the new react-native architecture. Note that there will be breaking changes and only the latest version of react-native will be supported. This library has 2 important concepts, if you are familiar with React Context this is very similar. The SafeAreaProvider component is a View from where insets provided by Consumers are relative to. This means that if this view overlaps with any system elements (status bar, notches, etc.) these values will be provided to descendent consumers. Usually, you will have one provider at the top of your app. Consumers are components and hooks that allow using inset values provided by the nearest parent Provider. Values are always relative to a provider and not to these components.

Features

  • You should add SafeAreaProvider in your app root component
  • SafeAreaView is a regular View component with the safe area insets applied as padding or margin
  • Optional, array of top, right, bottom, and left
  • If you are doing server side rendering on the web you can use initialMetrics to inject insets
  • This library includes a built in mock for Jest
  • This library currently has experimental support for the new react-native architecture

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow react-native-safe-area-context

react-native-safe-area-context Web Site

Other Useful Business Software
Build on Google Cloud with $300 in Free Credit Icon
Build on Google Cloud with $300 in Free Credit

New to Google Cloud? Get $300 in free credit to explore Compute Engine, BigQuery, Cloud Run, Vertex AI, and 150+ other products.

Start your next project with $300 in free Google Cloud credit. Spin up VMs, run containers, query exabytes in BigQuery, or build AI apps with Vertex AI and Gemini. Once your credits are used, keep building with 20+ products with free monthly usage, including Compute Engine, Cloud Storage, GKE, and Cloud Run functions. Sign up to start building right away.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of react-native-safe-area-context!

Additional Project Details

Operating Systems

Android, Apple iPhone

Programming Language

TypeScript

Related Categories

TypeScript User Interface (UI) Software

Registered

2023-06-15