From 260e5f83ef9e8bcd8f7113c508c23907d5e75054 Mon Sep 17 00:00:00 2001 From: zhong <384232149@qq.com> Date: Fri, 20 Apr 2018 15:57:33 +0800 Subject: [PATCH] Add props onLoad and onLoadEnd like webview --- lib/Canvas.js | 6 +++++- lib/QRCode.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Canvas.js b/lib/Canvas.js index d38c205..81d7f3e 100644 --- a/lib/Canvas.js +++ b/lib/Canvas.js @@ -14,7 +14,9 @@ var Canvas = createReactClass({ propTypes: { style: PropTypes.object, context: PropTypes.object, - render: PropTypes.func.isRequired + render: PropTypes.func.isRequired, + onLoad: PropTypes.func, + onLoadEnd: PropTypes.func, }, render() { @@ -32,6 +34,8 @@ var Canvas = createReactClass({ style={this.props.style} javaScriptEnabled={true} scrollEnabled={false} + onLoad={this.props.onLoad} + onLoadEnd={this.props.onLoadEnd} /> ); diff --git a/lib/QRCode.js b/lib/QRCode.js index cbde837..7471f47 100644 --- a/lib/QRCode.js +++ b/lib/QRCode.js @@ -53,6 +53,8 @@ var QRCode = createReactClass({ size: PropTypes.number, bgColor: PropTypes.string, fgColor: PropTypes.string, + onLoad: PropTypes.func, + onLoadEnd: PropTypes.func, }, getDefaultProps: function() { @@ -61,6 +63,8 @@ var QRCode = createReactClass({ fgColor: 'white', bgColor: 'black', size: 128, + onLoad: () => {}, + onLoadEnd: () => {}, } }, @@ -98,6 +102,8 @@ var QRCode = createReactClass({ cells: qr(value).modules, }} render={renderCanvas} + onLoad={this.props.onLoad} + onLoadEnd={this.props.onLoadEnd} style={{height: size, width: size}} />