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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@react-native-community/status-bar

v1.0.3

Published

Native module for mutating status bar state

Downloads

156

Readme

react-native-status-bar

npm package CircleCI Status Supports Android and iOS MIT License code style: prettier

Getting started

$ npm install @react-native-community/status-bar --save

Mostly automatic installation

$ react-native link @react-native-community/status-bar

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-status-bar and add RNCStatusBar.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNCStatusBar.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactnativecommunity.statusbar.RNCStatusBarPackage; to the imports at the top of the file
  • Add new RNCStatusBarPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-status-bar'
    project(':react-native-status-bar').projectDir = new File(rootProject.projectDir,  '../../node_modules/@react-native-community/status-bar/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    implementation project(':react-native-status-bar')

Usage

import StatusBar from '@react-native-community/status-bar';

function MyComponent() {
  return (
    <TouchableHighlight
      style={styles.wrapper}
      onPress={() => StatusBar.setHidden(true, "slide");} // or "fade"
    >
      <View style={styles.button}>
        <Text> Hide status bar </Text>
      </View>
    </TouchableHighlight>
  )
}

Api

For cases where using a component is not ideal, there is also an imperative API exposed as static functions on the component. It is however not recommended to use the static API and the component for the same prop because any value set by the static API will get overriden by the one set by the component in the next render.

Constants

currentHeight (Android only) The height of the status bar.

Props

Methods

Type Definitions


Reference

Props

animated

If the transition between status bar property changes should be animated. Supported for backgroundColor, barStyle and hidden.

| Type | Required | | ---- | -------- | | bool | No |


barStyle

Sets the color of the status bar text.

| Type | Required | | ------------------------------------------------ | -------- | | enum('default', 'light-content', 'dark-content') | No |


hidden

If the status bar is hidden.

| Type | Required | | ---- | -------- | | bool | No |


backgroundColor

The background color of the status bar.

| Type | Required | Platform | | ------------------ | -------- | -------- | | color | No | Android |


translucent

If the status bar is translucent. When translucent is set to true, the app will draw under the status bar. This is useful when using a semi transparent status bar color.

| Type | Required | Platform | | ---- | -------- | -------- | | bool | No | Android |


networkActivityIndicatorVisible

If the network activity indicator should be visible.

| Type | Required | Platform | | ---- | -------- | -------- | | bool | No | iOS |


showHideTransition

The transition effect when showing and hiding the status bar using the hidden prop. Defaults to 'fade'.

| Type | Required | Platform | | --------------------- | -------- | -------- | | enum('fade', 'slide') | No | iOS |

Methods

setHidden()

static setHidden(hidden: boolean, [animation]: StatusBarAnimation)

Show or hide the status bar

Parameters:

| Name | Type | Required | Description | | --------- | ----------------------------------------------------- | -------- | ---------------------------------------------------------------- | | hidden | boolean | Yes | Hide the status bar. | | animation | StatusBarAnimation | No | Optional animation when changing the status bar hidden property. |


setBarStyle()

static setBarStyle(style: StatusBarStyle, [animated]: boolean)

Set the status bar style

Parameters:

| Name | Type | Required | Description | | -------- | --------------------------------------------- | -------- | ------------------------- | | style | StatusBarStyle | Yes | Status bar style to set | | animated | boolean | No | Animate the style change. |


setNetworkActivityIndicatorVisible()

static setNetworkActivityIndicatorVisible(visible: boolean)

Control the visibility of the network activity indicator

Parameters:

| Name | Type | Required | Description | | ------- | ------- | -------- | ------------------- | | visible | boolean | Yes | Show the indicator. |


setBackgroundColor()

static setBackgroundColor(color: string, [animated]: boolean)

Set the background color for the status bar

Parameters:

| Name | Type | Required | Description | | -------- | ------- | -------- | ------------------------- | | color | color | Yes | Background color. | | animated | boolean | No | Animate the style change. |


setTranslucent()

static setTranslucent(translucent: boolean)

Control the translucency of the status bar

Parameters:

| Name | Type | Required | Description | | ----------- | ------- | -------- | ------------------- | | translucent | boolean | Yes | Set as translucent. |

Type Definitions

StatusBarStyle

Status bar style

| Type | | ----- | | $Enum |

Constants:

| Value | Description | | ------------- | -------------------------------------------------------------------- | | default | Default status bar style (dark for iOS, light for Android) | | light-content | Dark background, white texts and icons | | dark-content | Light background, dark texts and icons (requires API>=23 on Android) |


StatusBarAnimation

Status bar animation

| Type | | ----- | | $Enum |

Constants:

| Value | Description | | ----- | --------------- | | none | No animation | | fade | Fade animation | | slide | Slide animation |