A clean and lightweight progress HUD for react native app, based on SVProgressHUD.
This package migrated from flutter_svprogresshud to react native based on create_react_native_module package
yarn
$ yarn add react-native-svprogresshud
npm
$ npm install react-native-svprogresshud
$ react-native link react-native-svprogresshud
$ npx pod-install
(see demo in /example
)
SVProgressHUD
is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call SVProgressHUD.method()
).
Use SVProgressHUD
wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.
Using SVProgressHUD
in your app will usually look as simple as this:
SVProgressHUD.show();
setTimeout(SVProgressHUD.dismiss, 3000);
You can show the status of indeterminate tasks using one of the following:
SVProgressHUD.show();
SVProgressHUD.show("Trạng thái");
If you'd like the HUD to reflect the progress of a task, use one of these:
SVProgressHUD.showProgress(0.28);
SVProgressHUD.showProgress(0.96, "Đang xử lý...");
The HUD can be dismissed using:
SVProgressHUD.dismiss();
SVProgressHUD.dismiss(2000);
Show a confirmation glyph before before getting dismissed a little bit later. The display time depends on minimumDismissTimeInterval
and the length of the given string.
SVProgressHUD.showInfo("Thông tin.");
SVProgressHUD.showSuccess("Thành công!");
SVProgressHUD.showError("Có lỗi xảy ra!");
status
-string
color
-array
-[red, green, blue, alpha]
-alpha
between0
and1
or between0
and255
progress
-number
between0
and1
delay
-duration
in milliseconds
style
- default is"light"
. One of:"light" || "dark" || "custom"
style
- default is"none"
. One of:"none" || "clear" || "black" || "gradient" || "custom"
style
- default is"flat"
. One of:"flat" || "native"
width
- default is0.0
height
- default is0.0
ringThickness
- default is2.0
radius
- default is18.0
radius
- default is24.0
radius
- default is14.0
width
- default is0.0
width
- default is28.0
height
- default is28.0
shouldTintImages
- default istrue
interval
- default is5000
milliseconds
interval
- default is15000
milliseconds
interval
- default is150
milliseconds
interval
- default is150
milliseconds
interval
- default isfalse
While developing, you can run the example app to test your changes.
- Clone the repository
- Run
yarn
in the root directory to install dependencies, and again inexample
. - (on iOS) Run
npx pod-install
from theexample
directory
- Run
yarn run:android
to run on Android - Run
yarn run:ios
to run on iOS
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.