@oguzhnatly/react-native-custom-qr-codes 2.0.0

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.
@@ -0,0 +1,30 @@
1
+ /*
2
+
3
+ index.js
4
+
5
+ This file exports a function for drawing the outer eye pieces of a QRCode
6
+
7
+ --Geoff Natin 11/1/18 17:41
8
+
9
+ */
10
+ import { drawCirclesPiece } from "./circle";
11
+ import { drawDiamondPiece } from "./diamond";
12
+ import { drawNone } from "./none";
13
+ import { drawSquarePiece } from "./square";
14
+
15
+ //Returns an SVG Element for an outer eye piece in the style of the outerEyeStyle
16
+ export function drawOuterEyePiece(x, y, modules, pieceProperties, props) {
17
+ switch (props.outerEyeStyle) {
18
+ case "square":
19
+ return drawSquarePiece(x, y, modules, pieceProperties, props);
20
+ case "circles":
21
+ return drawCirclesPiece(x, y, modules, pieceProperties, props);
22
+ case "diamond":
23
+ return drawDiamondPiece(x, y, modules, pieceProperties, props);
24
+ case "circle":
25
+ case "rounded":
26
+ return drawNone(x, y, modules, pieceProperties, props);
27
+ default:
28
+ return drawSquarePiece(x, y, modules, pieceProperties, props);
29
+ }
30
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+
3
+ import { View } from "react-native";
4
+
5
+ //Returns an SVG Element for a piece of the 'circle' outerEyeStyle
6
+ export function drawNone(x, y, modules, pieceProperties, props) {
7
+ return <View key={x + ":" + y} />;
8
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+
3
+ square.js
4
+
5
+ This file exports a function for drawing a square outer eye piece for a QRCode
6
+
7
+ --Geoff Natin 11/1/18 17:41
8
+
9
+ */
10
+ import React, { Component } from "react";
11
+ import Svg, { Rect } from "react-native-svg";
12
+
13
+ //Returns an SVG Element for a piece of the 'square' outerEyeStyle
14
+ export function drawSquarePiece(x, y, modules, pieceProperties, props) {
15
+ var length = modules.length;
16
+ var width = props.size;
17
+ var height = props.size;
18
+ var xsize = width / length;
19
+ var ysize = height / length;
20
+ var px = x * xsize;
21
+ var py = y * ysize;
22
+ return (
23
+ <Rect
24
+ key={px + ":" + py}
25
+ x={px}
26
+ y={py}
27
+ width={xsize}
28
+ height={ysize}
29
+ fill={props.color}
30
+ />
31
+ );
32
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@oguzhnatly/react-native-custom-qr-codes",
3
+ "version": "2.0.0",
4
+ "main": "index.js",
5
+ "description": "Customizable QR codes for React Native with TypeScript and RTL support",
6
+ "keywords": [
7
+ "react-native",
8
+ "react-native-component",
9
+ "react",
10
+ "mobile",
11
+ "ios",
12
+ "android",
13
+ "qr-code",
14
+ "custom-qr-code"
15
+ ],
16
+ "author": {
17
+ "name": "Oguzhan Atalay",
18
+ "url": "https://github.com/oguzhnatly"
19
+ },
20
+ "homepage": "https://github.com/oguzhnatly/react-native-custom-qr-codes",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/oguzhnatly/react-native-custom-qr-codes"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/oguzhnatly/react-native-custom-qr-codes/issues"
27
+ },
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "prop-types": "^15.5.10",
31
+ "styled-components": "^5.3.5"
32
+ },
33
+ "peerDependencies": {
34
+ "react-native-svg": "^6.2.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/react-native": "^0.67.5"
38
+ }
39
+ }