react-native-easy-loading-view
Preview
Getting started
$ npm install react-native-easy-loading-view --save
Example
Check example in the folder.
Usage
edit your project root view,like this(detail please see example):
import Loading from 'react-native-easy-loading-view'; {return <View =><App/><Loading= // 必须调用 = // 如果需要在loading或者hud的时候可以点击导航上面的按钮,建议根据自己导航栏具体高度来设置。如果不需要点击可以不设置= // 默认loading 和 会在 去掉top之后高度的中间,如果觉得位置不太合适,可以通着offsetY来调整 // = // 动画的文字// = // 动画文字的样式// = // 动画是显示的gif// = // 图片样式 // = // 的全局样式// = // 全局背景色// = // 默认全局文字// = // 文字样式// = // 上面的圈圈 // = // 上面圈圈的颜色// = // 自定义hud上面的圈圈显示,可以把转的圈圈替换为gif// = // 自定义hud图片的样式/></View>;}
use loading(show or dismiss)
import Loading from 'react-native-easy-loading-view'; Loading; //显示hudLoading; //显示loading Loading; // 消失
Properties
Prop | Default | Type | Description |
---|---|---|---|
top | 0 | number |
Distance from top of container. |
bottom | 0 | number |
Distance from bottom of container. |
offsetY | 0 | number |
loading or hud y offset. |
loadingDefaultText | string |
loading view default display text. | |
loadingTextStyle | {...} | style |
loading view display text style. |
loadingImage | image |
loading view display gif image. | |
loadingImageStyle | {...} | style |
loading view display image style |
hudDefaultText | string |
hud view default display text. | |
hudTextStyle | {...} | style |
hud view display text style. |
hudStyle | {...} | style |
hud view style. |
hudBackgroundColor | 'transparent' | color |
loading view display image style |
hudCustomImage | image |
hud view custom image. | |
hudImageStyle | {...} | style |
hud custom image style |
activityIndicatorSize | 'small' | string |
hud view default ActivityIndicator size. |
activityIndicatorColor | style |
hud view default ActivityIndicator color |
Methods
showHud(text, extraTop, bkColor)
Parameters:
Name | Type | default | Description | optional |
---|---|---|---|---|
text | string |
hudDefaultText | hud view display text | YES |
extraTop | number |
0 | hud view extra offset y | YES |
bkColor | string |
'' | hud view backgroundColor | YES |
showLoading(text, extraTop, bkColor)
Parameters:
Name | Type | default | Description | optional |
---|---|---|---|---|
text | string |
loadingDefaultText | loading view display text | YES |
extraTop | number |
0 | loading view extra offset y | YES |
bkColor | string |
'' | loading view backgroundColor | YES |