Skip to content

Commit 260e5f8

Browse files
committed
Add props onLoad and onLoadEnd like webview
1 parent 34dbd55 commit 260e5f8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/Canvas.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ var Canvas = createReactClass({
1414
propTypes: {
1515
style: PropTypes.object,
1616
context: PropTypes.object,
17-
render: PropTypes.func.isRequired
17+
render: PropTypes.func.isRequired,
18+
onLoad: PropTypes.func,
19+
onLoadEnd: PropTypes.func,
1820
},
1921

2022
render() {
@@ -32,6 +34,8 @@ var Canvas = createReactClass({
3234
style={this.props.style}
3335
javaScriptEnabled={true}
3436
scrollEnabled={false}
37+
onLoad={this.props.onLoad}
38+
onLoadEnd={this.props.onLoadEnd}
3539
/>
3640
</View>
3741
);

lib/QRCode.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ var QRCode = createReactClass({
5353
size: PropTypes.number,
5454
bgColor: PropTypes.string,
5555
fgColor: PropTypes.string,
56+
onLoad: PropTypes.func,
57+
onLoadEnd: PropTypes.func,
5658
},
5759

5860
getDefaultProps: function() {
@@ -61,6 +63,8 @@ var QRCode = createReactClass({
6163
fgColor: 'white',
6264
bgColor: 'black',
6365
size: 128,
66+
onLoad: () => {},
67+
onLoadEnd: () => {},
6468
}
6569
},
6670

@@ -98,6 +102,8 @@ var QRCode = createReactClass({
98102
cells: qr(value).modules,
99103
}}
100104
render={renderCanvas}
105+
onLoad={this.props.onLoad}
106+
onLoadEnd={this.props.onLoadEnd}
101107
style={{height: size, width: size}}
102108
/>
103109
</View>

0 commit comments

Comments
 (0)