feat: fixes and formatter

This commit is contained in:
2026-01-12 16:01:32 +01:00
parent 85c6084351
commit 11e632acff
353 changed files with 23315 additions and 27361 deletions
+22 -22
View File
@@ -1,32 +1,32 @@
import React, { useMemo } from "react";
import { View } from "react-native";
import Svg, { Rect } from "react-native-svg";
import { generateQrMatrix } from "../utils/generateQrMatrix";
import React, { useMemo } from 'react'
import { View } from 'react-native'
import Svg, { Rect } from 'react-native-svg'
import { generateQrMatrix } from '../utils/generateQrMatrix'
const DEFAULT_SIZE = 220;
const DEFAULT_SIZE = 220
const QrCode = ({
value,
size = DEFAULT_SIZE,
color = "#FFFFFF",
backgroundColor = "transparent",
errorCorrectionLevel = "M",
color = '#FFFFFF',
backgroundColor = 'transparent',
errorCorrectionLevel = 'M',
}) => {
const { matrix } = useMemo(() => {
try {
return generateQrMatrix({ value, errorCorrectionLevel });
return generateQrMatrix({ value, errorCorrectionLevel })
} catch (error) {
console.error("qr.code.generate.error", error);
return { matrix: [] };
console.error('qr.code.generate.error', error)
return { matrix: [] }
}
}, [value, errorCorrectionLevel]);
}, [value, errorCorrectionLevel])
const cellSize = useMemo(() => {
if (!matrix || !matrix.length) {
return 0;
return 0
}
return size / matrix.length;
}, [matrix, size]);
return size / matrix.length
}, [matrix, size])
return (
<View
@@ -40,10 +40,10 @@ const QrCode = ({
{matrix.map((row, rowIndex) => {
return row.map((isDark, colIndex) => {
if (!isDark) {
return null;
return null
}
const key = `${rowIndex}-${colIndex}`;
const key = `${rowIndex}-${colIndex}`
return (
<Rect
@@ -54,12 +54,12 @@ const QrCode = ({
height={cellSize}
fill={color}
/>
);
});
)
})
})}
</Svg>
</View>
);
};
)
}
export default QrCode;
export default QrCode