Migrating from React.createClass
This commit is contained in:
parent
9dff9bc1e7
commit
7ca48289a1
|
@ -1,16 +1,19 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var PropTypes = require('prop-types');
|
||||||
|
var createReactClass = require('create-react-class');
|
||||||
|
|
||||||
var {
|
var {
|
||||||
View,
|
View,
|
||||||
WebView
|
WebView
|
||||||
} = require('react-native');
|
} = require('react-native');
|
||||||
|
|
||||||
var Canvas = React.createClass({
|
var Canvas = createReactClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
style: React.PropTypes.object,
|
style: PropTypes.object,
|
||||||
context: React.PropTypes.object,
|
context: PropTypes.object,
|
||||||
render: React.PropTypes.func.isRequired
|
render: PropTypes.func.isRequired
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var PropTypes = require('prop-types');
|
||||||
|
var createReactClass = require('create-react-class');
|
||||||
var Canvas = require('./Canvas.js');
|
var Canvas = require('./Canvas.js');
|
||||||
var qr = require('qr.js');
|
var qr = require('qr.js');
|
||||||
var {
|
var {
|
||||||
|
@ -45,12 +47,12 @@ function renderCanvas(canvas) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var QRCode = React.createClass({
|
var QRCode = createReactClass({
|
||||||
PropTypes: {
|
PropTypes: {
|
||||||
value: React.PropTypes.string,
|
value: PropTypes.string,
|
||||||
size: React.PropTypes.number,
|
size: PropTypes.number,
|
||||||
bgColor: React.PropTypes.string,
|
bgColor: PropTypes.string,
|
||||||
fgColor: React.PropTypes.string,
|
fgColor: PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/cssivision/react-native-qrcode#readme",
|
"homepage": "https://github.com/cssivision/react-native-qrcode#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"create-react-class": "^15.6.0",
|
||||||
|
"prop-types": "^15.5.10",
|
||||||
"qr.js": "0.0.0"
|
"qr.js": "0.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue