Skip to content

Latest commit

 

History

History
executable file
·
52 lines (39 loc) · 919 Bytes

README.md

File metadata and controls

executable file
·
52 lines (39 loc) · 919 Bytes

#react-native-proximity

A React Native wrapper that provides access to the state of the proximity sensor.

Usage of react-native-proximity and scrollview.

##Getting Started

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

##Usage

Import the library

import Proximity from 'react-native-proximity';

###addListener(callback)

componentDidMount(){
 Proximity.addListener(this._setProximity);
},

/**
 * State of proximity sensor
 * @param {object} data
 */
 _setProximity(data) {
   this.setState({
     proximity: data.proximity,
   });
 },

###removeListener(callback)

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