Skip to content

Commit 96af1be

Browse files
committed
Merge branch 'release/5.1.0'
2 parents 89e2423 + 706b14e commit 96af1be

63 files changed

Lines changed: 8772 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Discussion: https://discord.gg/RvFM97v
1414

1515
<img src="https://raw.githubusercontent.com/awesomejerry/react-native-qrcode-svg/master/screenshot/android.png" width="150">
1616
<img src="https://raw.githubusercontent.com/awesomejerry/react-native-qrcode-svg/master/screenshot/ios.png" width="150">
17-
<img src="https://raw.githubusercontent.com/awesomejerry/react-native-qrcode-svg/master/screenshot/logo.png" width="150">
1817

1918
## Installation
2019

@@ -97,11 +96,12 @@ Name | Default | Description
9796
size | 100 | Size of rendered image in pixels
9897
value | 'this is a QR code' | Value of the QR code
9998
color | 'black' | Color of the QR code
99+
backgroundColor | 'white' | Color of the background
100100
logo | null | Image source object. Ex. {uri: 'base64string'} or {require('pathToImage')}
101101
logoSize | 20% of size | Size of the imprinted logo. Bigger logo = less error correction in QR code
102102
logoBackgroundColor | backgroundColor | The logo gets a filled quadratic background with this color. Use 'transparent' if your logo already has its own backdrop.
103103
logoMargin | 2 | logo's distance to its wrapper
104-
logoBorderRadius | null | the border-radius of logo image (Android is not supported)
104+
logoBorderRadius | 0 | the border-radius of logo image (Android is not supported)
105105
getRef | null | Get SVG ref for further usage
106106
ecl | 'M' | Error correction level
107107

example/.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": ["react-native"],
3+
"plugins": [
4+
["module-resolver", {
5+
"alias": {
6+
"react-native-qrcode-svg": "../index.js"
7+
}
8+
}]
9+
]
10+
}

example/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

example/.flowconfig

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
10+
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
14+
.*/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
.*/Libraries/polyfills/.*
18+
19+
; Ignore metro
20+
.*/node_modules/metro/.*
21+
22+
[include]
23+
24+
[libs]
25+
node_modules/react-native/Libraries/react-native/react-native-interface.js
26+
node_modules/react-native/flow/
27+
node_modules/react-native/flow-github/
28+
29+
[options]
30+
emoji=true
31+
32+
module.system=haste
33+
module.system.haste.use_name_reducers=true
34+
# get basename
35+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
36+
# strip .js or .js.flow suffix
37+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
38+
# strip .ios suffix
39+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
40+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
41+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
42+
module.system.haste.paths.blacklist=.*/__tests__/.*
43+
module.system.haste.paths.blacklist=.*/__mocks__/.*
44+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
45+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
46+
47+
munge_underscores=true
48+
49+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
50+
51+
module.file_ext=.js
52+
module.file_ext=.jsx
53+
module.file_ext=.json
54+
module.file_ext=.native.js
55+
56+
suppress_type=$FlowIssue
57+
suppress_type=$FlowFixMe
58+
suppress_type=$FlowFixMeProps
59+
suppress_type=$FlowFixMeState
60+
61+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
62+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
63+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
64+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
65+
66+
[version]
67+
^0.75.0

example/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

example/.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle

example/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

example/App.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import React, { Component } from 'react'
2+
import { StyleSheet, ScrollView, View, Button } from 'react-native'
3+
import QRCode from 'react-native-qrcode-svg'
4+
5+
const PATH_TO_LOGO = './logo.jpg'
6+
7+
type Props = {}
8+
export default class App extends Component<Props> {
9+
handlePress = () => {
10+
this.qrcode.toDataURL(this.callback)
11+
}
12+
callback = (dataURL) => {
13+
console.log(dataURL)
14+
}
15+
render () {
16+
return (
17+
<ScrollView contentContainerStyle={styles.container}>
18+
<View style={styles.section}>
19+
<QRCode value='hello world' />
20+
</View>
21+
<View style={styles.section}>
22+
<QRCode
23+
value='hello world'
24+
size={200}
25+
/>
26+
</View>
27+
<View style={styles.section}>
28+
<QRCode
29+
value='hello world'
30+
color='blue'
31+
backgroundColor='yellow'
32+
/>
33+
</View>
34+
<View style={styles.section}>
35+
<QRCode
36+
value='hello world'
37+
logo={require(PATH_TO_LOGO)}
38+
/>
39+
</View>
40+
<View style={styles.section}>
41+
<QRCode
42+
value='hello world'
43+
logo={require(PATH_TO_LOGO)}
44+
logoSize={50}
45+
/>
46+
</View>
47+
<View style={styles.section}>
48+
<QRCode
49+
value='hello world'
50+
logo={require(PATH_TO_LOGO)}
51+
logoMargin={10}
52+
/>
53+
</View>
54+
<View style={styles.section}>
55+
<QRCode
56+
value='hello world'
57+
logo={require(PATH_TO_LOGO)}
58+
logoBorderRadius={15}
59+
/>
60+
</View>
61+
<View style={styles.section}>
62+
<QRCode
63+
value='hello world'
64+
logo={require(PATH_TO_LOGO)}
65+
logoBackgroundColor='blue'
66+
getRef={(c) => (this.qrcode = c)}
67+
/>
68+
<Button title={'getDataURL'} onPress={this.handlePress} />
69+
</View>
70+
<View style={styles.section}>
71+
<QRCode
72+
value='hello world'
73+
ecl='H'
74+
/>
75+
</View>
76+
</ScrollView>
77+
)
78+
}
79+
}
80+
81+
const styles = StyleSheet.create({
82+
container: {
83+
alignItems: 'center',
84+
backgroundColor: '#F5FCFF',
85+
paddingTop: 15,
86+
paddingBottom: 15
87+
},
88+
section: {
89+
marginTop: 15,
90+
marginBottom: 15
91+
}
92+
})

example/android/app/BUCK

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
lib_deps = []
12+
13+
for jarfile in glob(['libs/*.jar']):
14+
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15+
lib_deps.append(':' + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)
20+
21+
for aarfile in glob(['libs/*.aar']):
22+
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23+
lib_deps.append(':' + name)
24+
android_prebuilt_aar(
25+
name = name,
26+
aar = aarfile,
27+
)
28+
29+
android_library(
30+
name = "all-libs",
31+
exported_deps = lib_deps,
32+
)
33+
34+
android_library(
35+
name = "app-code",
36+
srcs = glob([
37+
"src/main/java/**/*.java",
38+
]),
39+
deps = [
40+
":all-libs",
41+
":build_config",
42+
":res",
43+
],
44+
)
45+
46+
android_build_config(
47+
name = "build_config",
48+
package = "com.example",
49+
)
50+
51+
android_resource(
52+
name = "res",
53+
package = "com.example",
54+
res = "src/main/res",
55+
)
56+
57+
android_binary(
58+
name = "app",
59+
keystore = "//android/keystores:debug",
60+
manifest = "src/main/AndroidManifest.xml",
61+
package_type = "debug",
62+
deps = [
63+
":app-code",
64+
],
65+
)

0 commit comments

Comments
 (0)