📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

react-native-is-edge-to-edge

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-is-edge-to-edge

Detect react-native-edge-to-edge package install

1.1.7
latest
Source
npm
Version published
Maintainers
2
Created
Source

react-native-is-edge-to-edge

Many libraries provide options to account for the transparency of status and navigation bars. For example, the useHideAnimation hook in react-native-bootsplash includes statusBarTranslucent and navigationBarTranslucent options, while the useAnimatedKeyboard hook in react-native-reanimated offers an isStatusBarTranslucentAndroid option, among others.

[!IMPORTANT]
Until third-party libraries officially add support for react-native-edge-to-edge to set these options automatically, you may need to adjust them manually to prevent interference with the library.

To support library authors, we provide this lightweight package called react-native-is-edge-to-edge (note the -is-!), which checks whether react-native-edge-to-edge is installed, making it easier to update your library accordingly:

import {
  controlEdgeToEdgeValues,
  isEdgeToEdge,
} from "react-native-is-edge-to-edge";

const EDGE_TO_EDGE = isEdgeToEdge();

function MyAwesomeLibraryComponent({
  statusBarTranslucent,
  navigationBarTranslucent,
}) {
  if (__DEV__) {
    // warn the user once about unnecessary defined values
    controlEdgeToEdgeValues({
      statusBarTranslucent,
      navigationBarTranslucent,
    });
  }

  return (
    <MyAwesomeLibraryNativeComponent
      statusBarTranslucent={EDGE_TO_EDGE || statusBarTranslucent}
      navigationBarTranslucent={EDGE_TO_EDGE || navigationBarTranslucent}
      // …
    />
  );
}

If you want to check for the library's presence on the native side to bypass certain parts of your code, consider using this small utility:

object EdgeToEdge {
  // we cannot detect edge-to-edge, but we can detect react-native-edge-to-edge install
  val ENABLED: Boolean = try {
      Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
      true
    } catch (exception: ClassNotFoundException) {
      false
    }
}

Keywords

react

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts