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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@noemec/react-native-brightness

v0.3.1

Published

Control de brillo para React Native (Android / iOS)

Readme

@noemec/react-native-brightness

Control de brillo para React Native (Android / iOS)

Una librería nativa para React Native que permite controlar el brillo de la pantalla en dispositivos Android e iOS.

Características

  • Control del nivel de brillo de la pantalla
  • Obtener el nivel actual de brillo de la pantalla
  • Obtener el nivel de brillo del sistema (Android)
  • Resetear el brillo al valor del sistema (Android)
  • Soporte para React Native 0.72+
  • Compatible con Android e iOS

Instalación

npm install @noemec/react-native-brightness

o

yarn add @noemec/react-native-brightness

Instalación nativa

Para React Native 0.60 y superior, la librería se enlaza automáticamente. Solo necesitas:

cd ios && pod install && cd ..
npx react-native run-ios

Para Android:

cd android && ./gradlew clean && cd .. && npx react-native run-android

Uso

import DeviceBrightness from '@noemec/react-native-brightness';

// Establecer el brillo (0.0 - 1.0)
await DeviceBrightness.setBrightnessLevel(0.5);

// Obtener el nivel actual de brillo
const currentBrightness = await DeviceBrightness.getBrightnessLevel();

// Obtener el nivel de brillo del sistema (solo Android)
const systemBrightness = await DeviceBrightness.getSystemBrightnessLevel();

// Resetear al brillo del sistema (solo Android)
await DeviceBrightness.setBrightnessLevel(-1);

API

setBrightnessLevel(level: number): Promise<void>

Establece el nivel de brillo de la pantalla.

Parámetros:

  • level (number): Nivel de brillo entre 0.0 (mínimo) y 1.0 (máximo). En Android, también acepta -1 para resetear al valor del sistema.

Nota: El valor -1 para resetear solo funciona en Android. En iOS solo acepta valores entre 0.0 y 1.0.

Ejemplo:

// Establecer brillo al 75%
await DeviceBrightness.setBrightnessLevel(0.75);

// Resetear al brillo del sistema (solo Android)
await DeviceBrightness.setBrightnessLevel(-1);

getBrightnessLevel(): Promise<number>

Obtiene el nivel actual de brillo de la pantalla.

Retorna: Promise que resuelve con un número entre 0.0 y 1.0.

Ejemplo:

const brightness = await DeviceBrightness.getBrightnessLevel();
console.log(`Brillo actual: ${brightness}`);

getSystemBrightnessLevel(): Promise<number> (Solo Android)

Obtiene el nivel de brillo configurado en el sistema.

Retorna: Promise que resuelve con un número entre 0.0 y 1.0.

Ejemplo:

const systemBrightness = await DeviceBrightness.getSystemBrightnessLevel();
console.log(`Brillo del sistema: ${systemBrightness}`);

Manejo de errores

La librería puede lanzar los siguientes errores:

  • E_NO_ACTIVITY: No se encontró la actividad actual
  • E_RANGE: El valor de brillo está fuera del rango permitido
  • E_SYSTEM_BRIGHTNESS: Error al obtener el brillo del sistema
try {
  await DeviceBrightness.setBrightnessLevel(0.8);
} catch (error) {
  console.error('Error al establecer el brillo:', error);
}

Limitaciones

  • getSystemBrightnessLevel: Esta función solo está disponible en Android.
  • Reset de brillo (valor -1): Solo disponible en Android. En iOS usar valores entre 0.0 y 1.0.
  • Permisos: No requiere permisos especiales.
  • Expo: No es compatible con Expo Managed Workflow. Requiere React Native CLI o Expo Bare Workflow.

Requisitos

  • React Native >= 0.72
  • React >= 18
  • Android: SDK 23+, Java 17
  • iOS: iOS 13.4+, Xcode 12+

Contribuir

Las contribuciones son bienvenidas. Por favor lee CONTRIBUTION.md para más detalles.

Licencia

MIT

Autor

Jose Altamar

Changelog

0.1.0

  • Versión inicial
  • Soporte para control de brillo en Android e iOS
  • Funciones para establecer y obtener brillo
  • Función para obtener brillo del sistema (solo Android)