Skip to content

Commit

Permalink
feat: rtl support added.
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhnatly committed Apr 26, 2022
1 parent c62f680 commit 670c0a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export function QRCode({
logoSize?: number;
ecl?: "L" | "M" | "Q" | "H";
svg?: any;
isRTL?: boolean;
});
8 changes: 7 additions & 1 deletion lib/QRCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default class QRCode extends PureComponent {
logoSize: PropTypes.number,
ecl: PropTypes.oneOf(["L", "M", "Q", "H"]),
svg: PropTypes.any,
isRTL: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -76,6 +77,7 @@ export default class QRCode extends PureComponent {
innerEyeStyle: "square",
logoSize: 100,
ecl: "H",
isRTL: false,
};

//-----------------------Methods-----------------------
Expand Down Expand Up @@ -396,7 +398,11 @@ export default class QRCode extends PureComponent {
innerEyeStyle={this.props.innerEyeStyle}
size={eyeSize}
color={this.props.color}
x={eyeCoord[0]}
x={
this.props.isRTL
? this.props.size - eyeCoord[0] - eyeSize
: eyeCoord[0]
}
y={eyeCoord[1]}
ratio={this.ratio}
/>
Expand Down

0 comments on commit 670c0a1

Please sign in to comment.