Skip to content

Commit

Permalink
Merge branch 'release/5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomejerry committed May 29, 2017
2 parents 72e6eda + 68905c4 commit 4ca4731
Show file tree
Hide file tree
Showing 7 changed files with 2,028 additions and 60 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ react-native link react-native-svg
npm install react-native-qrcode-svg --save
```

### Examples
## Examples

```
import QRCode from 'react-native-qrcode-svg';
Expand Down Expand Up @@ -88,7 +88,7 @@ render() {
```


### Props
## Props

Name | Default | Description
----------------|------------|--------------
Expand All @@ -99,6 +99,7 @@ logo | null | Image source object. Ex. {uri: 'base64string'} or {require(
logoSize | 20% of size | Size of the imprinted logo. Bigger logo = less error correction in QR code
logoBackgroundColor | backgroundColor | The logo gets a filled quadratic background with this color. Use 'transparent' if your logo already has its own backdrop.
getRef | null | Get SVG ref for further usage
ecl | 'M' | Error correction level


## Saving generated code to gallery
Expand Down Expand Up @@ -127,8 +128,12 @@ saveQrToDisk() {
```


### Dependencies
## Dependencies

### PeerDependencies

* [react-native-svg](https://github.com/magicismight/react-native-svg)

* [javascript-qrcode](https://github.com/siciarek/javascript-qrcode)
### Dependencies

* [node-qrcode](https://github.com/soldair/node-qrcode)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-qrcode-svg",
"version": "4.0.2",
"version": "5.0.0",
"description": "A QR Code generator for React Native based on react-native-svg and javascript-qrcode.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"react-native-svg": "^5.1.5"
},
"dependencies": {
"javascript-qrcode": "git+https://[email protected]/awesomejerry/javascript-qrcode.git"
"qrcode": "^0.8.1"
},
"devDependencies": {
"babel-eslint": "^7.2.2",
Expand Down
43 changes: 17 additions & 26 deletions src/__tests__/Matrix-test.js
Original file line number Diff line number Diff line change
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, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1 ],
[ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 ],
[ 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ],
[ 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0 ],
[ 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1 ],
[ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0 ],
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1 ]
]

it('generates correctly', () => {
it('generates with ecl:M correctly', () => {
const matrix = genMatrix('test')
expect(matrix).toEqual(expected)
expect(matrix).toMatchSnapshot()
})

it('generates with ecl:L correctly', () => {
const matrix = genMatrix('test', 'L')
expect(matrix).toMatchSnapshot()
})

it('generates with ecl:H correctly', () => {
const matrix = genMatrix('test', 'H')
expect(matrix).toMatchSnapshot()
})

it('generates with ecl:Q correctly', () => {
const matrix = genMatrix('test', 'Q')
expect(matrix).toMatchSnapshot()
})
Loading

0 comments on commit 4ca4731

Please sign in to comment.