Need help with react-native-proximity?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

williambout
199 Stars 48 Forks MIT License 26 Commits 14 Opened issues

Description

:iphone: A React Native wrapper that provides access to the proximity sensor on iOS and Android.

Services available

!
?

Need anything else?

Contributors list

# 93,711
React N...
Objecti...
iphone
siri
10 commits
# 193,429
React N...
Objecti...
iphone
Redux
4 commits
# 114,861
React N...
Objecti...
iphone
C
3 commits
# 380,970
Java
Android
React N...
Objecti...
2 commits
# 447,472
Java
Android
React N...
Objecti...
1 commit

npm version

react-native-proximity

A React Native wrapper that provides access to the state of the proximity sensor for iOS and Android.

Usage of react-native-proximity and scrollview.

Getting Started

  • Install the library
    shell
    npm install --save react-native-proximity
    
  • Link the library
    shell
    react-native link react-native-proximity
    

Usage

Import the library

import Proximity from 'react-native-proximity';

addListener(callback)

The callback function returns an object with proximity and distance properties. If proximity is true, it means the device is close to an physical object. distance is only supported in Android. ```javascript componentDidMount(){ Proximity.addListener(this._proximityListener); },

/** * State of proximity sensor * @param {object} data */ _proximityListener(data) { this.setState({ proximity: data.proximity, distance: data.distance // Android-only }); }, ```

removeListener(callback)

componentWillUnmount() {
  Proximity.removeListener(this._proximityListener);
},

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.