https://github.com/douugdev/react-native-proximity-screen
An Android-only simple library to turn off screen on proximity.
https://github.com/douugdev/react-native-proximity-screen
android react react-native
Last synced: about 2 months ago
JSON representation
An Android-only simple library to turn off screen on proximity.
- Host: GitHub
- URL: https://github.com/douugdev/react-native-proximity-screen
- Owner: douugdev
- License: mit
- Created: 2021-06-18T18:21:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-20T16:06:08.000Z (about 5 years ago)
- Last Synced: 2026-03-24T04:16:14.436Z (3 months ago)
- Topics: android, react, react-native
- Language: Java
- Homepage:
- Size: 366 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-proximity-screen
A JS/TS Library to programatically turn the screen off using the proximity sensor.
## Installation
```sh
npm install react-native-proximity-screen
# For older RN versions
react-native link react-native-proximity-screen
```
## Basic Usage
```js
import { startProximity, stopProximity } from 'react-native-proximity-screen';
import { useState, useEffect } from 'react';
// ...
useEffect(() => {
if (incall) {
startProximity();
} else {
stopProximity();
}
}, []);
```
## Docs
#### _async startProximity(void)_
#### _async stopProximity(void)_
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## Special Thanks
- [Javier González](https://github.com/CabezasGonzalezJavier) for the android base.
## License
MIT