npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

rns-statusbar

v0.1.7

Published

RNS statusbar component with SafeArea view comp, that uses native Android and iOS enhancements allowing you to set/get statusbar color and height.

Readme

🧭 rns-statusbar

A modern, lightweight, and high-performance React Native + Expo native module for managing the status bar height and background color across both Android and iOS.
Includes an optional SafeArea wrapper component for simplified layout handling and improved visual consistency.

Built natively using Kotlin (Android) and Swift (iOS) for maximum performance and reliability.


✨ Key Features

  • ✅ Dynamic, per-device status bar height retrieval
  • ✅ Hex-based status bar background color control
  • ✅ Current color getter for runtime queries
  • ✅ Simple React hook and SafeArea wrapper component
  • ✅ 100% compatible with Expo EAS Build and bare React Native
  • ✅ Full TypeScript support (auto-complete and type definitions)

📦 Installation

Using npm

npm install rns-statusbar

Using yarn

yarn add rns-statusbar

⚙️ Expo / EAS Setup

If you use Expo Prebuild / EAS Build, the plugin is automatically registered in your configuration.
You can confirm that your app.json or app.config.js includes:

{
  "expo": {
    "plugins": ["rns-statusbar"]
  }
}

Then rebuild your native project:

npx expo prebuild

For local production builds:

eas build --platform android --local

🧱 Bare React Native Setup

If using plain React Native (without Expo):

iOS Setup

  1. Install the package
  2. Navigate to iOS directory and install pods
    cd ios && pod install
  3. Rebuild your project.

Android Setup

  1. Install the package
  2. Sync Gradle and rebuild your project.

🧩 Usage Example

import React, { useEffect } from 'react';
import {
  SafeArea,
  getStatusBarHeight,
  getStatusBarColor,
  setStatusBarColor,
  useTopPadding,
} from 'rns-statusbar';

export default function App() {
  const topPadding = useTopPadding();

  useEffect(() => {
    setStatusBarColor('#20232a');     // Set background color
    getStatusBarHeight().then(console.log); // Log status bar height
    getStatusBarColor().then(console.log);  // Log current color
  }, []);

  return (
    <SafeArea style={{ backgroundColor: '#fff' }}>
      <Text style={{ marginTop: topPadding }}>Hello Status Bar!</Text>
    </SafeArea>
  );
}

🔧 API Reference

Functions

| Function | Type | Description | |-----------|------|-------------| | getStatusBarHeight() | Promise<number> | Returns status bar height in dp (defaults to 24). | | getStatusBarColor() | Promise<string> | Returns current status bar color (hex string). | | setStatusBarColor(color: string) | Promise<void> | Updates status bar background color. | | getTopPadding() | Promise<number> | Cached getter for status bar height. | | useTopPadding() | () => number | React hook returning the top padding. |


Component: SafeArea

Cross-platform container ensuring UI content is rendered safely beneath the status bar.
When used, it automatically handles keyboard visibility and eliminates the need for KeyboardAvoidingView.

<SafeArea style={{ backgroundColor: '#fff' }}>
  {children}
</SafeArea>

| Prop | Type | Description | |------|------|-------------| | style | ViewStyle | StyleProp<ViewStyle> | Custom container style. | | children | React.ReactNode | Nested content. |


🧾 TypeScript Support

Type definitions (index.d.ts) are included by default, ensuring full IDE support:

import { getStatusBarHeight, SafeArea, getStatusBarHeight, getStatusBarColor, setStatusBarColor, useTopPadding } from 'rns-statusbar';

🧑‍💻 Development & Local Testing

To test your local changes in another app:

# from your test app folder
yarn add file:../rns-statusbar
npx pod-install ios

📄 License

MIT License © 2025 — Raiidr


💬 Contributing

Contributions are welcome!
If you encounter a bug or want to suggest a feature, open an issue or submit a pull request on GitHub.