From 85c06b2488f249c44998775eaf72863e83e3d7c3 Mon Sep 17 00:00:00 2001 From: wikimo Date: Sat, 23 Jan 2016 14:34:20 +0800 Subject: [PATCH 1/3] [wikimo] add vector-icons and hud text --- package.json | 1 + src/index.js | 52 ++++++++++++++++++++++++++++++++++----------------- src/styles.js | 9 +++++++-- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 90e2fd3..b892e96 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ }, "homepage": "https://github.com/naoufal/react-native-progress-hud", "dependencies": { + "react-native-vector-icons": "^1.0.4", "react-tween-state": "0.0.5" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index be14580..ee6f292 100644 --- a/src/index.js +++ b/src/index.js @@ -2,12 +2,14 @@ var React = require('react-native'); var tweenState = require('react-tween-state'); +var Icon = require('react-native-vector-icons/FontAwesome'); var { Image, StyleSheet, TouchableHighlight, - View + View, + Text } = React; var styles = require('./styles'); @@ -70,7 +72,8 @@ var ProgressHUD = React.createClass({ return { isDismissible: false, color: '#000', - overlayColor: 'rgba(0, 0, 0, 0)' + overlayColor: 'rgba(0, 0, 0, 0)', + iconSize: 48 }; }, @@ -119,6 +122,34 @@ var ProgressHUD = React.createClass({ this.getTweeningValue('rotate_deg') ).toString() + 'deg'; + + var labelView; + if (this.props.labelText) { + labelView = {this.props.labelText}; + } + + var iconView; + if (this.props.iconName) { + iconView = ; + }else{ + iconView = + + + + ; + } + return ( /*jshint ignore:start */ - - - - + {iconView} + {labelView} /*jshint ignore:end */ diff --git a/src/styles.js b/src/styles.js index a1ef744..56fa236 100644 --- a/src/styles.js +++ b/src/styles.js @@ -21,7 +21,8 @@ var styles = StyleSheet.create({ width: 100, height: 100, borderRadius: 16, - backgroundColor: '#FFFFFF' + backgroundColor: '#000000', + opacity: 0.6 }, spinner: { alignItems: 'center', @@ -34,7 +35,11 @@ var styles = StyleSheet.create({ width: 42, height: 42, borderRadius: 42 / 2, - backgroundColor: '#FFFFFF' + backgroundColor: '#000' + }, + label: { + paddingTop: 10, + color: '#FFFFFF' } }); From bbf541948a75dd9074c413aed71d9ca599e57034 Mon Sep 17 00:00:00 2001 From: wikimo Date: Sat, 23 Jan 2016 14:42:20 +0800 Subject: [PATCH 2/3] [wikimo] update reademe about how to use with icons --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48f718c..d4cee9a 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,18 @@ Are you using [React](https://facebook.github.io/react/)? Check out [React Prog ![progress-hud-screen](https://cloud.githubusercontent.com/assets/1627824/7716549/94f15754-fe61-11e4-9a59-358d460197f2.gif) +## Requirements +The icons is use [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons)/FontAwesomes + ## Install ```shell npm i --save react-native-progress-hud ``` + ## Usage Using the HUD in your app will usually look like this: + ```js var ProgressHUD = require('react-native-progress-hud'); @@ -32,8 +37,10 @@ var YourComponent = React.createClass({ + labelText="Success" + iconName="check" + iconSize={28} + overlayColor="rgba(0, 0, 0, 0.11)"/> ); } @@ -84,6 +91,8 @@ The following props can be used to modify the HUD's style and/or behaviour: |__`isDismissible`__|_Boolean_|Optional|`false`|When set to true, the HUD is dismissed on user interaction. |__`overlayColor`__|_String_|Optional|`rgba(0, 0, 0, 0)`|Sets the color of the overlay. |__`color`__|_String_|Optional|`#000`|Sets the color of the spinner. +|__`iconName`__|_String_|Optional|``|Sets the icon of hud,if set icon, spinner will not be show, only icon. +|__`iconSize`__|_String_|Optional|48|Sets icon size of hud. ## License Copyright (c) 2015, [Naoufal Kadhom](http://naoufal.com) From d80d7a8e3f2845b05e5061d21cbb9bad717a12bb Mon Sep 17 00:00:00 2001 From: wikimo Date: Sat, 23 Jan 2016 14:45:30 +0800 Subject: [PATCH 3/3] [wikimo] update reademe about props --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4cee9a..99e82af 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ The following props can be used to modify the HUD's style and/or behaviour: |__`isDismissible`__|_Boolean_|Optional|`false`|When set to true, the HUD is dismissed on user interaction. |__`overlayColor`__|_String_|Optional|`rgba(0, 0, 0, 0)`|Sets the color of the overlay. |__`color`__|_String_|Optional|`#000`|Sets the color of the spinner. -|__`iconName`__|_String_|Optional|``|Sets the icon of hud,if set icon, spinner will not be show, only icon. +|__`iconName`__|_String_|Optional|`optional`|Sets the icon of hud,if set icon, spinner will not be show, only icon. |__`iconSize`__|_String_|Optional|48|Sets icon size of hud. ## License