rn-system-brightness

0.0.6 • Public • Published

RN System Brightness

Access and update the system brightness on a device Android vs IOS

Install

npm version npm download

yarn add rn-system-brightness
npm i --save rn-system-brightness

Setup

Android

Also update you manifest params and include xmlns:tools

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.baseproject"
  xmlns:tools="http://schemas.android.com/tools"> // <---add

Open the manifest file of your Android project and add

<uses-permission
  android:name="android.permission.WRITE_SETTINGS"
  tools:ignore="ProtectedPermissions"
/>

IOS

cd ios
pod install

API

import Brightness from "rn-system-brightness";

// SET
await Brightness.setBrightness(0.8); // between 0 and 1

// GET
const brightness = await Brightness.getBrightness();

// GET max brightness
const maxBrightness = await Brightness.getMaxBrightness();

// GET Permission ANDROID
const per = await Brightness.hasPermission(); // boolean true or false

// REQUEST ANDROID > 6
await Brightness.requestPermission();

Package Sidebar

Install

npm i rn-system-brightness

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

91.5 kB

Total Files

17

Last publish

Collaborators

  • hlam104