AppmakerDeveloper

How to use SafeArea Context for iOS devices in Component level

In iOS devices to use safe are padding you can use with safe area context library.

Description

In iOS devices to use safe are padding you can use with safe area context library.

Usage

import { useSafeArea } from "react-native-safe-area-context";

const MyComponent = () => {
  const insets = useSafeArea();
  return (
    <View
      style={{
        paddingBottom: insets.bottom, // if required padding bottom
        paddingTop: insets.top, // if required padding for top
      }}
    >
      {/*
      Code here
    */}
    </View>
  );
};

On this page