npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-placeholder

v1.1.3

Published

React Native Package to set a placeholder while your components are loading

Downloads

122

Readme

react-native-facebook-like-placeholder

You can not always remove the waiting time to get an information but you can make it feels shorter.

This react-native module allows you to set a placeholder to render something while fetching the main component/element (example: when a remote image loads, when you are performing a GET request to your Database, etc.).
This placeholder design is based on the one on Facebook and is partly customisable.

Illustration

###Fast Use :

import RNPlaceholder	from 'react-native-placeholder'

state = {done: false}

<RNPlaceholder
	done={this.state.done}>
	
	<Image
	source={{uri: "https://images.unsplash.com/photo-1433888104365-77d8043c9615?dpr=2&auto=format&fit=crop&w=767&h=510&q=80&cs=tinysrgb&crop="}}
	style={{width: 200, height: 200}}
	onLoadEnd={() => this.setState({done: true})}/>
</RNPlaceholder>

###The Component : Placeholder

The Component takes a few props :

  • Width : The width of the view, used to calculate the size of the placeholder (default: ScreenWidth * .9)
  • Height : The height of the view, used to calculate the size of the placeholder (default: ScreenHeight * .133)
  • placeholderDesign : An array of array, which determines the width, the height and the margin of the Lines (default: [[.5, .1, .05, .07], [.3, .1, .05, .07], [.4, .1, .05, .07]])
  • Done : A state, set to false at first, which will change to true at the end of the loading

The placeholder has two main "parts", the Cube (non editable for now) and the Lines (editables). With no specifics data, a basic component is set.
The Done props has to be a state from the parents component that will switch to true at the end of the loading (for instance with the onLoadEnd method of the component).

Illustration