react-native-qrcode-svg 6.3.2 → 6.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/Example/.bundle/config +2 -0
  2. package/Example/.eslintrc.js +4 -0
  3. package/Example/.prettierrc.js +7 -0
  4. package/Example/.watchmanconfig +1 -0
  5. package/Example/Gemfile +9 -0
  6. package/Example/Gemfile.lock +103 -0
  7. package/Example/README.md +48 -0
  8. package/Example/__tests__/App.test.tsx +17 -0
  9. package/Example/android/app/build.gradle +119 -0
  10. package/Example/android/app/debug.keystore +0 -0
  11. package/Example/android/app/proguard-rules.pro +10 -0
  12. package/Example/android/app/src/debug/AndroidManifest.xml +9 -0
  13. package/Example/android/app/src/main/AndroidManifest.xml +25 -0
  14. package/Example/android/app/src/main/java/com/example/MainActivity.kt +22 -0
  15. package/Example/android/app/src/main/java/com/example/MainApplication.kt +45 -0
  16. package/Example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  17. package/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  18. package/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  19. package/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  20. package/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  21. package/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  22. package/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  23. package/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  24. package/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  25. package/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  26. package/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  27. package/Example/android/app/src/main/res/values/strings.xml +3 -0
  28. package/Example/android/app/src/main/res/values/styles.xml +9 -0
  29. package/Example/android/build.gradle +21 -0
  30. package/Example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  31. package/Example/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  32. package/Example/android/gradle.properties +41 -0
  33. package/Example/android/gradlew +249 -0
  34. package/Example/android/gradlew.bat +92 -0
  35. package/Example/android/settings.gradle +4 -0
  36. package/Example/app.json +4 -0
  37. package/Example/babel.config.js +4 -0
  38. package/Example/dist/index.html +24 -0
  39. package/Example/global.d.ts +7 -0
  40. package/Example/index.js +14 -0
  41. package/Example/ios/.xcode.env +11 -0
  42. package/Example/ios/Example/AppDelegate.h +6 -0
  43. package/Example/ios/Example/AppDelegate.mm +31 -0
  44. package/Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  45. package/Example/ios/Example/Images.xcassets/Contents.json +6 -0
  46. package/Example/ios/Example/Info.plist +52 -0
  47. package/Example/ios/Example/LaunchScreen.storyboard +47 -0
  48. package/Example/ios/Example/main.m +10 -0
  49. package/Example/ios/Example.xcodeproj/project.pbxproj +698 -0
  50. package/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +88 -0
  51. package/Example/ios/Example.xcworkspace/contents.xcworkspacedata +10 -0
  52. package/Example/ios/ExampleTests/ExampleTests.m +66 -0
  53. package/Example/ios/ExampleTests/Info.plist +24 -0
  54. package/Example/ios/Podfile +55 -0
  55. package/Example/ios/Podfile.lock +1378 -0
  56. package/Example/jest.config.js +3 -0
  57. package/Example/macos/.xcode.env +1 -0
  58. package/Example/macos/.xcode.env.local +2 -0
  59. package/Example/macos/Example-macOS/AppDelegate.h +6 -0
  60. package/Example/macos/Example-macOS/AppDelegate.mm +40 -0
  61. package/Example/macos/Example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
  62. package/Example/macos/Example-macOS/Assets.xcassets/Contents.json +6 -0
  63. package/Example/macos/Example-macOS/Base.lproj/Main.storyboard +684 -0
  64. package/Example/macos/Example-macOS/Example.entitlements +12 -0
  65. package/Example/macos/Example-macOS/Info.plist +47 -0
  66. package/Example/macos/Example-macOS/main.m +5 -0
  67. package/Example/macos/Example.xcodeproj/project.pbxproj +567 -0
  68. package/Example/macos/Example.xcodeproj/xcshareddata/xcschemes/Example-macOS.xcscheme +78 -0
  69. package/Example/macos/Example.xcworkspace/contents.xcworkspacedata +10 -0
  70. package/Example/macos/Podfile +26 -0
  71. package/Example/macos/Podfile.lock +1233 -0
  72. package/Example/metro.config.js +47 -0
  73. package/Example/package.json +53 -0
  74. package/Example/src/App.tsx +130 -0
  75. package/Example/src/assets/google.png +0 -0
  76. package/Example/src/assets/ruby.svg +12 -0
  77. package/Example/src/components/Description.tsx +16 -0
  78. package/Example/src/styles.ts +21 -0
  79. package/Example/tsconfig.json +9 -0
  80. package/Example/webpack.config.js +60 -0
  81. package/Example/yarn.lock +8957 -0
  82. package/README.md +0 -6
  83. package/index.d.ts +10 -2
  84. package/package.json +11 -2
  85. package/src/LogoSVG/index.js +22 -0
  86. package/src/LogoSVG/index.native.js +24 -0
  87. package/src/index.js +158 -125
  88. package/src/utils.js +7 -0
  89. package/.github/workflows/npmpublish.yml +0 -31
  90. package/.huskyrc +0 -5
  91. package/.lintstagedrc +0 -3
@@ -0,0 +1,47 @@
1
+ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2
+
3
+ /**
4
+ * Metro configuration
5
+ * https://facebook.github.io/metro/docs/configuration
6
+ *
7
+ * @type {import('metro-config').MetroConfig}
8
+ */
9
+ const path = require('path');
10
+ const exclusionList = require('metro-config/src/defaults/exclusionList');
11
+ const escape = require('escape-string-regexp');
12
+ const pack = require('../package.json');
13
+
14
+ const root = path.resolve(__dirname, '..');
15
+
16
+ const modules = [...Object.keys(pack.peerDependencies), 'react-native-macos'];
17
+
18
+ const config = {
19
+ projectRoot: __dirname,
20
+ watchFolders: [root],
21
+
22
+ // We need to make sure that only one version is loaded for peerDependencies
23
+ // So we exclude them at the root, and alias them to the versions in example's node_modules
24
+ resolver: {
25
+ blockList: exclusionList(
26
+ modules.map(
27
+ m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
28
+ ),
29
+ new RegExp(`${path.join(__dirname, 'macos').replace(/[/\\]+/g, '/')}.*`),
30
+ ),
31
+
32
+ extraNodeModules: modules.reduce((acc, name) => {
33
+ acc[name] = path.join(__dirname, 'node_modules', name);
34
+ return acc;
35
+ }, {}),
36
+ },
37
+
38
+ transformer: {
39
+ getTransformOptions: async () => ({
40
+ transform: {
41
+ experimentalImportSupport: false,
42
+ },
43
+ }),
44
+ },
45
+ };
46
+
47
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "Example",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "android": "react-native run-android",
7
+ "ios": "react-native run-ios",
8
+ "web": "webpack serve",
9
+ "macos": "react-native run-macos",
10
+ "lint": "eslint .",
11
+ "prettier": "prettier --write ./src/**/*.{tsx,ts}",
12
+ "start": "react-native start",
13
+ "test": "jest",
14
+ "tsc": "tsc"
15
+ },
16
+ "dependencies": {
17
+ "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
18
+ "@svgr/webpack": "^8.1.0",
19
+ "file-loader": "^6.2.0",
20
+ "react": "18.2.0",
21
+ "react-native": "^0.73.6",
22
+ "react-native-macos": "^0.73.0-0",
23
+ "react-native-qrcode-svg": "link:../",
24
+ "react-native-svg": "^15.5.0",
25
+ "react-native-web": "^0.19.10",
26
+ "webpack": "^5.91.0"
27
+ },
28
+ "devDependencies": {
29
+ "@babel/core": "^7.20.0",
30
+ "@babel/preset-env": "^7.20.0",
31
+ "@babel/runtime": "^7.25.4",
32
+ "@react-native/babel-preset": "^0.75.0-main",
33
+ "@react-native/eslint-config": "0.73.2",
34
+ "@react-native/metro-config": "0.73.5",
35
+ "@react-native/typescript-config": "0.73.1",
36
+ "@types/react": "^18.2.6",
37
+ "@types/react-test-renderer": "^18.0.0",
38
+ "babel-jest": "^29.6.3",
39
+ "babel-loader": "^9.1.3",
40
+ "eslint": "^8.19.0",
41
+ "eslint-plugin-prettier": "^5.1.3",
42
+ "jest": "^29.6.3",
43
+ "prettier": "^3.2.5",
44
+ "react-dom": "^18.2.0",
45
+ "react-test-renderer": "18.2.0",
46
+ "typescript": "5.0.4",
47
+ "webpack-cli": "^5.1.4",
48
+ "webpack-dev-server": "^5.0.4"
49
+ },
50
+ "engines": {
51
+ "node": ">=18"
52
+ }
53
+ }
@@ -0,0 +1,130 @@
1
+ import React from 'react';
2
+ import {SafeAreaView, ScrollView, Text} from 'react-native';
3
+ import SVG from './assets/ruby.svg';
4
+ import Description from './components/Description';
5
+ import QRCode from 'react-native-qrcode-svg';
6
+ import styles from './styles';
7
+
8
+ const rubyUrl = 'https://www.ruby-lang.org/';
9
+ const googleUrl = 'https://www.google.com/';
10
+ const qrCodeSize = 200;
11
+ const logoSize = 100;
12
+
13
+ const defaultQRCode = (
14
+ <Description text="Default QR code">
15
+ <QRCode />
16
+ </Description>
17
+ );
18
+
19
+ const colorfulQRCODe = (
20
+ <Description text="QR code with changed colors">
21
+ <QRCode
22
+ value="Some colorful qr code"
23
+ size={qrCodeSize}
24
+ color="darkblue"
25
+ backgroundColor="lightblue"
26
+ />
27
+ </Description>
28
+ );
29
+
30
+ const urlPngQRCode = (
31
+ <Description text="QR code with PNG from url avatar">
32
+ <QRCode
33
+ value={googleUrl}
34
+ size={qrCodeSize}
35
+ logo="https://cdn1.iconfinder.com/data/icons/google-s-logo/150/Google_Icons-09-512.png"
36
+ logoSize={logoSize}
37
+ logoBorderRadius={200}
38
+ />
39
+ </Description>
40
+ );
41
+
42
+ const localPngQRCode = (
43
+ <Description text="QR code with local PNG avatar">
44
+ <QRCode
45
+ value={googleUrl}
46
+ size={qrCodeSize}
47
+ logo={require('./assets/google.png')}
48
+ logoSize={logoSize}
49
+ />
50
+ </Description>
51
+ );
52
+
53
+ const localPngBackgroundColorQRCode = (
54
+ <Description text="QR code with local PNG with background color avatar">
55
+ <QRCode
56
+ value={googleUrl}
57
+ size={qrCodeSize}
58
+ logo={require('./assets/google.png')}
59
+ logoBackgroundColor="pink"
60
+ logoSize={logoSize}
61
+ />
62
+ </Description>
63
+ );
64
+
65
+ const urlSvgQRCode = (
66
+ <Description text="QR code with SVG from url avatar">
67
+ <QRCode
68
+ value={rubyUrl}
69
+ size={qrCodeSize}
70
+ logoSVG="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/ruby.svg"
71
+ logoSize={logoSize}
72
+ />
73
+ </Description>
74
+ );
75
+
76
+ const xml = `
77
+ <svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'>
78
+ <path d='M20,100l74-5l6-75zM61,35l37-2l-29-24z' fill='#b11' fill-rule='evenodd'/>
79
+ <path d='M21,100l74-5l-47-4zM98,33c4-12,5-29-14-33l-15,9l29,24z' fill='#811' fill-rule='evenodd'/>
80
+ <path d='M7,67l14,33l11-38z' fill='#d44' fill-rule='evenodd'/>
81
+ <path d='M29,61l42,13l-10-42zM56,0h28l-16,10zM1,51l-1,29l7-13z' fill='#c22' fill-rule='evenodd'/>
82
+ <path d='M32,61l39,13c-14,13-30,24-50,26z' fill='#a00' fill-rule='evenodd'/>
83
+ <path d='M61,35l10,39l17-23zM32,61l16,30c9-5,16-11,23-17l-39-13z' fill='#900' fill-rule='evenodd'/>
84
+ <path d='M61,35l27,17l10-20l-37,3z' fill='#800' fill-rule='evenodd'/>
85
+ <path d='M71,74l23,21l-6-44zM0,80c1,19,15,20,21,20l-14-33l-7,13zM7,67l-2,26c4,6,9,7,15,6c-4-11-13-32-13-32zM69,9l30,4c-1-7-6-11-15-13l-15,9z' fill='#911' fill-rule='evenodd'/>
86
+ <path d='M1,51l6,16l25-5l29-27l8-26l-13-9l-22,8c-6,7-20,19-20,19c-1,1-9,16-13,24z' fill='#ebb' fill-rule='evenodd'/>
87
+ <path d='M21,21c15-14,34-23,42-16c7,8-1,26-16,40c-14,15-33,24-41,17c-7-7,1-26,15-41z' fill='#b11' fill-rule='evenodd'/>
88
+ </svg>
89
+ `;
90
+
91
+ const stringSvgQRCode = (
92
+ <Description text="QR code with raw SVG (string) avatar">
93
+ <QRCode
94
+ value={rubyUrl}
95
+ size={qrCodeSize}
96
+ logoSVG={xml}
97
+ logoSize={logoSize}
98
+ />
99
+ </Description>
100
+ );
101
+
102
+ const localSvgQRCode = (
103
+ <Description text="QR code with local SVG avatar">
104
+ <QRCode
105
+ value={rubyUrl}
106
+ size={qrCodeSize}
107
+ logoSVG={SVG}
108
+ logoSize={logoSize}
109
+ />
110
+ </Description>
111
+ );
112
+
113
+ const App = () => {
114
+ return (
115
+ <SafeAreaView>
116
+ <ScrollView contentContainerStyle={styles.scrollViewContainer}>
117
+ <Text style={styles.title}>Example usages of QRCode component</Text>
118
+ {defaultQRCode}
119
+ {colorfulQRCODe}
120
+ {urlPngQRCode}
121
+ {localPngQRCode}
122
+ {localPngBackgroundColorQRCode}
123
+ {urlSvgQRCode}
124
+ {stringSvgQRCode}
125
+ {localSvgQRCode}
126
+ </ScrollView>
127
+ </SafeAreaView>
128
+ );
129
+ };
130
+ export default App;
Binary file
@@ -0,0 +1,12 @@
1
+ <svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'>
2
+ <path d='M20,100l74-5l6-75zM61,35l37-2l-29-24z' fill='#b11' fill-rule='evenodd'/>
3
+ <path d='M21,100l74-5l-47-4zM98,33c4-12,5-29-14-33l-15,9l29,24z' fill='#811' fill-rule='evenodd'/>
4
+ <path d='M7,67l14,33l11-38z' fill='#d44' fill-rule='evenodd'/>
5
+ <path d='M29,61l42,13l-10-42zM56,0h28l-16,10zM1,51l-1,29l7-13z' fill='#c22' fill-rule='evenodd'/>
6
+ <path d='M32,61l39,13c-14,13-30,24-50,26z' fill='#a00' fill-rule='evenodd'/>
7
+ <path d='M61,35l10,39l17-23zM32,61l16,30c9-5,16-11,23-17l-39-13z' fill='#900' fill-rule='evenodd'/>
8
+ <path d='M61,35l27,17l10-20l-37,3z' fill='#800' fill-rule='evenodd'/>
9
+ <path d='M71,74l23,21l-6-44zM0,80c1,19,15,20,21,20l-14-33l-7,13zM7,67l-2,26c4,6,9,7,15,6c-4-11-13-32-13-32zM69,9l30,4c-1-7-6-11-15-13l-15,9z' fill='#911' fill-rule='evenodd'/>
10
+ <path d='M1,51l6,16l25-5l29-27l8-26l-13-9l-22,8c-6,7-20,19-20,19c-1,1-9,16-13,24z' fill='#ebb' fill-rule='evenodd'/>
11
+ <path d='M21,21c15-14,34-23,42-16c7,8-1,26-16,40c-14,15-33,24-41,17c-7-7,1-26,15-41z' fill='#b11' fill-rule='evenodd'/>
12
+ </svg>
@@ -0,0 +1,16 @@
1
+ import {Text, View} from 'react-native';
2
+ import React from 'react';
3
+ import styles from '../styles';
4
+
5
+ type DescriptionProps = {
6
+ text: string;
7
+ children: React.ReactNode;
8
+ };
9
+
10
+ const Description = ({text, children}: DescriptionProps) => (
11
+ <View style={styles.scrollViewElement}>
12
+ <Text style={styles.text}>{text}</Text>
13
+ {children}
14
+ </View>
15
+ );
16
+ export default Description;
@@ -0,0 +1,21 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ title: {
5
+ marginTop: 6,
6
+ fontSize: 36,
7
+ fontWeight: 'bold',
8
+ },
9
+ text: {
10
+ fontSize: 24,
11
+ },
12
+ scrollViewElement: {
13
+ alignItems: 'center',
14
+ margin: '1%',
15
+ paddingVertical: 12,
16
+ },
17
+ scrollViewContainer: {
18
+ alignItems: 'center',
19
+ },
20
+ });
21
+ export default styles;
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@react-native/typescript-config/tsconfig.json",
3
+ "include": ["src/**/*", "global.d.ts"],
4
+ "esModuleInterop": true,
5
+ "compilerOptions": {
6
+ "jsx": "react",
7
+ "skipLibCheck": true
8
+ }
9
+ }
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const fromRoot = _ => path.resolve(__dirname, _);
5
+
6
+ module.exports = {
7
+ mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
8
+ entry: fromRoot('index.js'),
9
+ output: {
10
+ path: fromRoot('dist'),
11
+ filename: 'bundle.web.js',
12
+ },
13
+ devServer: {
14
+ static: {directory: fromRoot('dist')},
15
+ devMiddleware: {publicPath: '/'},
16
+ },
17
+ module: {
18
+ rules: [
19
+ {
20
+ test: /\.(jsx?|tsx?)$/,
21
+ use: {loader: 'babel-loader'},
22
+ include: [
23
+ fromRoot('index.js'),
24
+ fromRoot('src/'),
25
+ fromRoot('node_modules/react-native-qrcode-svg'),
26
+ ],
27
+ },
28
+ {
29
+ test: /\.(gif|jpe?g|png)$/i,
30
+ use: [
31
+ {
32
+ loader: 'file-loader',
33
+ options: {esModule: false},
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ test: /\.svg$/,
39
+ use: ['@svgr/webpack'],
40
+ },
41
+ ],
42
+ },
43
+ resolve: {
44
+ symlinks: false,
45
+ alias: {
46
+ 'react-native$': 'react-native-web',
47
+ react: path.resolve('./node_modules/react'),
48
+ },
49
+ extensions: [
50
+ '.web.ts',
51
+ '.ts',
52
+ '.web.tsx',
53
+ '.tsx',
54
+ '.web.js',
55
+ '.js',
56
+ '.web.jsx',
57
+ '.jsx',
58
+ ],
59
+ },
60
+ };