File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,12 @@ class App extends Component {
4343
4444** React Native Progress Webview** supports all React Native Webview props. Read the [ API Reference] ( https://github.com/react-native-community/react-native-webview/blob/master/docs/Reference.md ) to explore. There are a couple of exclusive props related to the loading bar.
4545
46- | prop | type | default | description |
47- | ----------------- | ------ | ------- | ------------------------------------------------------- |
48- | color | string | #3B78E7 | normal color of loading bar |
49- | errorColor | string | #f30 | error color of loading bar |
50- | disappearDuration | number | 300 | the visible duration after loading bar loading finished |
46+ | prop | type | default | description |
47+ | ----------------- | ------ | ------- | ----------------------------------------------------------- |
48+ | height | number | 3 | the height of loading bar |
49+ | color | string | #3B78E7 | the normal color of loading bar |
50+ | errorColor | string | #f30 | the error color of loading bar |
51+ | disappearDuration | number | 300 | the visible duration after the webview finishes the loading |
5152
5253## License
5354
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ import React from 'react';
22import { View , StyleSheet } from 'react-native' ;
33import PropTypes from 'prop-types' ;
44
5- const LoadingBar = ( { color, percent } ) => {
5+ const LoadingBar = ( { color, percent, height } ) => {
66 const style = {
77 backgroundColor : color ,
8- width : `${ percent * 100 } %`
8+ width : `${ percent * 100 } %` ,
9+ height,
910 } ;
1011 return < View style = { [ styles . container , style ] } /> ;
1112} ;
@@ -17,7 +18,6 @@ LoadingBar.propTypes = {
1718const styles = StyleSheet . create ( {
1819 container : {
1920 position : 'absolute' ,
20- height : 3 ,
2121 zIndex : 10 ,
2222 top : 0 ,
2323 left : 0 ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import LoadingBar from "./loading-bar";
77export default class ProgressBarWebView extends React . PureComponent {
88
99 static propTypes = {
10+ height : PropTypes . number ,
1011 color : PropTypes . string ,
1112 errorColor : PropTypes . string ,
1213 disappearDuration : PropTypes . number ,
@@ -17,6 +18,7 @@ export default class ProgressBarWebView extends React.PureComponent {
1718 } ;
1819
1920 static defaultProps = {
21+ height : 3 ,
2022 color : '#3B78E7' ,
2123 errorColor : '#f30' ,
2224 disappearDuration : 300 ,
@@ -59,10 +61,11 @@ export default class ProgressBarWebView extends React.PureComponent {
5961 }
6062
6163 render ( ) {
64+ const { height } = this . props ;
6265 const { percent, color, visible } = this . state ;
6366 return (
6467 < View style = { styles . container } >
65- { visible && < LoadingBar color = { color } percent = { percent } /> }
68+ { visible && < LoadingBar height = { height } color = { color } percent = { percent } /> }
6669 < WebView
6770 onLoadStart = { this . _onLoadStart }
6871 onLoadEnd = { this . _onLoadEnd }
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-progress-webview" ,
3- "version" : " 1.0.3 " ,
3+ "version" : " 1.1.0 " ,
44 "description" : " React Native Progress WebView is a wrapper of React Native WebView to provide the loading status." ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments