Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-utils

React Native Utilities

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

React Native Utils

React Native Utilities is a package born out of the incessant rewriting of utility functions while developing scalable and maintainable React Native applications. It aims to be a repository that holds trivial yet useful utility functions that are most times copied over from project to project.

Installation

npm install rn-utils

Utilities

Device Dimensions

FunctionUsageUtility
getDeviceHeightRNUtils.getDeviceHeight()Returns the device's current viewport height.
getDeviceWidthRNUtils.getDeviceWidth()Returns the device's current viewport width.

Device Orientation

Currently the only 3rd party package used by React Native Utilities is the React Native Orientation module. If you wish to use any of the Orientation functionalities of React Native Utils, remember to link its native dependencies.

react-native link react-native-orientation
FunctionUsageUtility
addOrientationListenerRNUtils.addOrientationListener((orientation) => this.setState({ orientation }))Creates an event listener that triggers whenever the orientation of the device changes.
getOrientationRNUtils.getOrientation()Function that returns the current device's orientation. It uses getInitialOrientation method from React Native Orietation module to allow for Async/Initial orientation checks.
isLandscapeRNUtils.isLandscape(orientation)Helper that returns true if current device orientation is Landscape. The orientation argument must be passed. This is usually used with the addOrientationListener or getOrientation utility functions.
lockLandscapeRNUtils.lockLandscape()Locks the device's viewport to the Landscape mode. Disables portrait.
lockPortraitRNUtils.lockPortrait()Locks the device's viewport to the Portrait mode. Disables landscape.
unlockOrientationsRNUtils.unlockOrientations()Unlocks any previous locking behavior applied by lockPortrait or lockLandscape.

FAQs

Package last updated on 28 Apr 2017

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