New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

expo-proximity

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-proximity

Provides access to the system's proximity sensor.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38
decreased by-28.3%
Maintainers
0
Weekly downloads
 
Created
Source

expo-proximity

Provides access to the system's proximity sensor.

API documentation

  • Documentation for the main branch
  • Documentation for the latest stable release

Installation in managed Expo projects

For managed Expo projects, run following command:

npx expo install expo-proximity

Installation in bare React Native projects

For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.

Add the package to your npm dependencies

npm install expo-proximity

Configure for iOS

Run npx pod-install after installing the npm package.

Configure for Android

API

import {
  isAvailableAsync,
  getProximityState,
  isActivated,
  addProximityStateListener,
  deactivate,
  activate,
  useProximity,
} from 'expo-proximity'

Hooks

useProximity()

const { proximityState, isActivated } = useProximity()

Methods

getProximityState()

Get if an object is near the sensor or not.

Returns: boolean

isActivated()

Get if the sensor is activated or not.

Returns: boolean

addProximityStateListener(listener: (event: ProximityStateChangeEvent) => void)

Method to add a listener on proximity state change event.

Returns: NativeEventSubscription

deactivate()

Method to deactivate the sensor.

Returns: Promise<void>

activate()

Method to activate the sensor.

Returns: Promise<void>

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

Keywords

FAQs

Package last updated on 01 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc