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

react-native-blurhash

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-blurhash

BlurHash is a compact representation of a placeholder for an image. This is a Native UI Module for React Native to wrap the Blurhash implementations and make them usable in React Native.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.4K
decreased by-24.79%
Maintainers
1
Weekly downloads
 
Created
Source

Blurhash

npm i react-native-blurhash
cd ios; pod install; cd ..

BlurHash is a compact representation of a placeholder for an image. This is a Native UI Module for React Native to wrap the Blurhash implementations and make them usable in React Native.

Turn grey image boxes into colorful blurred images

Example Workflow

In order to use the Blurhash component, you have to already have a Blurhash string. See the blurha.sh page to create example strings.

This is how I use it in my project:

  1. A user uploads images from the react native app to firebase
  2. In firebase, I have a storage trigger function that generates a blurhash string from the uploaded image using the TypeScript implementation
  3. After I generated the blurhash string, I set this as a property on my post document in Firestore.
  4. Now everytime a user loads a feed of posts from my Firestore database, the blurhash property can be used to display the loading placeholder.

About

The decoders are written in Swift and Kotlin, and are copied from the official woltapp/blurhash repository. I use caching techniques, to only re-render the (quite expensive) Blurhash image creation when one of the blurhash specific props (blurhash, width, height or punch) has changed.

NameTypeExplanationRequiredDefault Value
blurhashstringThe blurhash string to useundefined
widthnumberThe width to decode to. You can still up-/down-scale it in Reactundefined
heightnumberThe height to decode to. You can still up-/down-scale it in Reactundefined
punchnumberThe punch to use for decoding.1

Read the algorithm description for more details

iOS ScreenshotAndroid Screenshot
iOS Demo ScreenshotAndroid Demo Screenshot

Resources

Keywords

FAQs

Package last updated on 15 Jun 2020

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