Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 41 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
react-native-device-brightness
===============
# React Native Device Brightness - screen brightness adjustment tool for ReactNative

[![npm version](https://badge.fury.io/js/react-native-device-brightness.svg)](https://badge.fury.io/js/react-native-device-brightness)

Screen brightness adjustment tool for ReactNative iOS and Android.

## Installation
## Platforms Supported

- [x] iOS
- [x] Android

## Getting Started

### Install

```
npm install --save react-native-device-brightness
$ yarn add react-native-device-brightness
```

*Recommended via yarn*
(or)

For npm use
```
yarn add react-native-device-brightness
$ npm install --save react-native-device-brightness
```

## Automatically link
### Automatic Link

### With React Native 0.27+
```
react-native link react-native-device-brightness
```
- **React Native 0.60+** (skip this as auto-linking should work)

[CLI autolink feature](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) links the module while building the app.

### With older versions of React Native
You need [rnpm](https://github.com/rnpm/rnpm) (npm install -g rnpm)
```
rnpm link react-native-device-brightness
```
*Hey, bro! react-native-device-brightness wasn't support older version of React Native yet.*
Note For iOS using cocoapods, run:
```
$ cd ios/ && pod install
```

- **React Native <= 0.59**
```
react-native link react-native-device-brightness
```

- **With older versions of React Native <0.27**

You need [rnpm](https://github.com/rnpm/rnpm) (npm install -g rnpm)
```
rnpm link react-native-device-brightness
```
*Hey, bro! react-native-device-brightness wasn't support older version of React Native yet.*

## Manually link

Expand Down Expand Up @@ -118,11 +135,12 @@ include ':app'

- *Adjusting screen brightness will make iOS's Auto-Brightness function do nothing.*
- *Adjusting screen brightness in Android only works in App and will reset to system setting exiting App.*

```javascript
// ES5
var DeviceBrightness = require('react-native-device-brightness');
// or ES6
// import DeviceBrightness from 'react-native-device-brightness';
// ES5
var DeviceBrightness = require('react-native-device-brightness');
// or ES6
// import DeviceBrightness from 'react-native-device-brightness';

// It will throw a exception when value less than 0 or more than 1.
DeviceBrightness.setBrightnessLevel(luminous);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.2.0",
"description": "Screen brightness adjustment tool for ReactNative iOS and Android. ",
"main": "index.js",
"homepage": "https://github.com/Calvin-Huang/react-native-device-brightness#readme",
"repository": {
"type": "git",
"url": "https://github.com/Calvin-Huang/react-native-device-brightness"
Expand Down
21 changes: 21 additions & 0 deletions react-native-device-brightness.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = package["name"]
s.version = package["version"]
s.summary = package["description"]
s.license = package['license']
s.description = <<-DESC
react-native-device-brightness
DESC
s.homepage = package['homepage']
s.authors = package['author']
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/Calvin-Huang/react-native-device-brightness.git", :tag => "#{s.version}" }

s.source_files = "**/*.{h,m}"

s.dependency "React"
end