diff --git a/README.md b/README.md index 8c02c23..fc7e259 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,14 @@ module.exports = HelloWorld; ``` ## Available Props -prop | type | default value -----------|----------------------|-------------- -`value` | `string` | `http://facebook.github.io/react-native/` -`size` | `number` | `128` -`bgColor` | `string` (CSS color) | `"#000"` -`fgColor` | `string` (CSS color) | `"#FFF"` +prop | type | default value +--------------------|----------------------|-------------- +`value` | `string` | `http://facebook.github.io/react-native/` +`size` | `number` | `128` +`bgColor` | `string` (CSS color) | `"#000"` +`fgColor` | `string` (CSS color) | `"#FFF"` +`errorCorrectLevel` | `number` (1, 0, 3, 2)| `"2"` + diff --git a/lib/QRCode.js b/lib/QRCode.js index 7471f47..d7fc0ba 100644 --- a/lib/QRCode.js +++ b/lib/QRCode.js @@ -55,6 +55,13 @@ var QRCode = createReactClass({ fgColor: PropTypes.string, onLoad: PropTypes.func, onLoadEnd: PropTypes.func, + // possible values for error correction level + // same as qr.js + // L ( 7% ) : 1, + // M ( 15% ) : 0, + // Q ( 25% ) : 3, + // H ( 30% ) : 2 + errorCorrectLevel: PropTypes.number }, getDefaultProps: function() { @@ -65,6 +72,7 @@ var QRCode = createReactClass({ size: 128, onLoad: () => {}, onLoadEnd: () => {}, + errorCorrectLevel: 2 // high error correction ( same as qr.js default ) } }, @@ -91,6 +99,7 @@ var QRCode = createReactClass({ render: function() { var size = this.props.size; var value = this.utf16to8(this.props.value); + var errorCorrectLevel = this.props.errorCorrectLevel; return (