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

rn-loading

v1.0.0

Published

react native loading

Downloads

3

Readme

rn-loading

一款简单易用的 Loading 组件,支持 Android&iOS。

目录

安装

  • 1.在终端运行 npm i rn-loading --save
  • 2.在要使用Loading的js文件中添加import Loading from 'rn-loading'

如何使用?

第一步:

在你的js文件中导入 rn-loading

import Loading from 'rn-loading'

第二步:

将下面代码插入到render()方法中:

 render() {
          return (
              <View style={styles.container}>
                  ...
                  <Loading ref="loading"/>
              </View>
          );
  }

注意: 请将<Loading ref="loading"/> 放在最外层View的底部.

第三步:

使用:

  // 显示 loading
  this.refs.loading.show();

  // 关闭 loading ui
  this.refs.loading.show(false);
  // 或者调用close方法关闭
  this.refs.loading.close();

或者使用Loading的 show属性控制显示和关闭状态

render() {
          return (
              <View style={styles.container}>
                  ...
                  <Loading show={true/false}/>
              </View>
          );
  }

用例

render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight
                    onPress={()=>{
                        this.refs.loading.show();
                    }}>
                    <Text>Start Loading</Text>
                </TouchableHighlight>
                <Loading ref="loading"/>
            </View>
        );
    }

自定义 Loading

render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight
                    onPress={()=>{
                        this.refs.loading.show();
                    }}>
                    <Text>Start Loading</Text>
                </TouchableHighlight>
                <Loading
                    ref="loading"
                    image=require('../path/imagename.png')
                    backgroundColor='#ffffffF2'
                    borderRadius=5
                    size=70
                    imageSize=40
                    indicatorColor='gray'
                    easing=Loading.EasingType.ease
                />
            </View>
        );
    }

API

属性 | 类型 | 可选 | 默认值 | 描述 ----------------- | -------- | -------- | ----------- | ----------- image | PropTypes.any |true | null | 自定义加载图片 backgroundColor | PropTypes.string | true | '#ffffffF2' | 自定义加载UI背景颜色 borderRadius | PropTypes.number | true | 5 | 自定义加载UI圆角 size | PropTypes.number | true | 70 | 自定义加载UI高宽尺寸 imageSize | PropTypes.number | true | 40 | 自定义加载UI图片高宽尺寸 indicatorColor | PropTypes.string | true | 'gray' | 自定义默认加载器颜色 easing | PropTypes.func | true | Easing.ease | 自定义加载动画样式

方法 | 类型 | 可选 | 描述 ----------------- | -------- | -------- | ----------- show(bool) | function | true | 显示加载器 close() | function | - | 隐藏关闭加载器