1.0.3 • Published 3 years ago

@yz1311/react-native-easy-loading-view v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-easy-loading-view

npm downloads

预览

npm.io npm.io

开始

$ npm install react-native-easy-loading-view react-native-animated-spinkit --save

例子

Check example in the folder.

$ cd example
$ npm install
$ react-native run-ios

用法

必须在根节点引入Loading组件,在整个项目中只需要且只能引用一个

import Loading from '@yz1311/react-native-easy-loading-view';
render() {
        return (
            <View style={[{flex:1}]}>
                <App/>
                <Loading
                    ref={(view)=>{Loading.loadingDidCreate(view)}} // 必须调用
                />
            </View>
        );
    }

使用loading(显示或者隐藏)

import Loading from '@yz1311/react-native-easy-loading-view';

Loading.showLoading("加载中..."); //显示loading

Loading.hideLoading(); // 消失

参数

属性默认值类型描述
stylenullstyle最外层的样式
backgroundColorrgba(255,0,0,.1)color最外层的背景色
loadingStyle0style加载loading样式
indicatorSize30number加载图标的大小
indicatorColor#ffffffcolor加载图标的颜色
renderIndicatornullelement加载图标自定义
indicatorStylenullstyle加载图标样式
text加载中...string加载文字
textStylenullstyle加载文字样式

方法

showLoading(text)

参数:

名称类型默认值描述可选
textstring加载中...底部文字

hideLoading()