Skip to content

Commit 670c0a1

Browse files
committed
feat: rtl support added.
1 parent c62f680 commit 670c0a1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.DS_Store

6 KB
Binary file not shown.

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ export function QRCode({
2828
logoSize?: number;
2929
ecl?: "L" | "M" | "Q" | "H";
3030
svg?: any;
31+
isRTL?: boolean;
3132
});

lib/QRCode.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default class QRCode extends PureComponent {
6262
logoSize: PropTypes.number,
6363
ecl: PropTypes.oneOf(["L", "M", "Q", "H"]),
6464
svg: PropTypes.any,
65+
isRTL: PropTypes.bool,
6566
};
6667

6768
static defaultProps = {
@@ -76,6 +77,7 @@ export default class QRCode extends PureComponent {
7677
innerEyeStyle: "square",
7778
logoSize: 100,
7879
ecl: "H",
80+
isRTL: false,
7981
};
8082

8183
//-----------------------Methods-----------------------
@@ -396,7 +398,11 @@ export default class QRCode extends PureComponent {
396398
innerEyeStyle={this.props.innerEyeStyle}
397399
size={eyeSize}
398400
color={this.props.color}
399-
x={eyeCoord[0]}
401+
x={
402+
this.props.isRTL
403+
? this.props.size - eyeCoord[0] - eyeSize
404+
: eyeCoord[0]
405+
}
400406
y={eyeCoord[1]}
401407
ratio={this.ratio}
402408
/>

0 commit comments

Comments
 (0)