File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import WebView from 'react-native-webview';
44import PropTypes from 'prop-types' ;
55import LoadingBar from "./loading-bar" ;
66
7- export default class ProgressBarWebView extends React . PureComponent {
7+ class ProgressBarWebView extends React . PureComponent {
88
99 static propTypes = {
1010 height : PropTypes . number ,
@@ -61,12 +61,13 @@ export default class ProgressBarWebView extends React.PureComponent {
6161 }
6262
6363 render ( ) {
64- const { height } = this . props ;
64+ const { height, forwardedRef } = this . props ;
6565 const { percent, color, visible } = this . state ;
6666 return (
6767 < View style = { styles . container } >
6868 { visible && < LoadingBar height = { height } color = { color } percent = { percent } /> }
6969 < WebView
70+ ref = { forwardedRef }
7071 onLoadStart = { this . _onLoadStart }
7172 onLoadEnd = { this . _onLoadEnd }
7273 onLoadProgress = { this . _onLoadProgress }
@@ -84,3 +85,7 @@ const styles = StyleSheet.create({
8485 position : 'relative' ,
8586 } ,
8687} ) ;
88+
89+ export default React . forwardRef ( ( props , ref ) => (
90+ < ProgressBarWebView { ...props } forwardedRef = { ref } />
91+ ) ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-progress-webview" ,
3- "version" : " 1.1.0 " ,
3+ "version" : " 1.1.1 " ,
44 "description" : " React Native Progress WebView is a wrapper of React Native WebView to provide the loading status." ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "test" : " echo \" Error: no test specified \" && exit 1 "
7+ "test" : " jest "
88 },
99 "keywords" : [
1010 " react" ,
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` LoadingBar Rendering should match to snapshot 1` ] = ` ShallowWrapper { } ` ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { shallow } from 'enzyme' ;
3+ import LoadingBar from '../lib/loading-bar' ;
4+
5+ describe ( 'LoadingBar' , ( ) => {
6+ describe ( 'Rendering' , ( ) => {
7+ it ( 'should match to snapshot' , ( ) => {
8+ const component = shallow ( < LoadingBar /> ) ;
9+ expect ( component ) . toMatchSnapshot ( )
10+ } ) ;
11+ } ) ;
12+ } ) ;
You can’t perform that action at this time.
0 commit comments