From 3dd3b71b967ab162398a63b05fb0a580ec93e5c9 Mon Sep 17 00:00:00 2001 From: Sidhanshu Monga Date: Mon, 27 Jul 2020 04:48:55 +0530 Subject: [PATCH] Update create-barcode.js --- components/create-barcode/create-barcode.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/create-barcode/create-barcode.js b/components/create-barcode/create-barcode.js index 86f57cf..af9f727 100644 --- a/components/create-barcode/create-barcode.js +++ b/components/create-barcode/create-barcode.js @@ -22,9 +22,6 @@ import moment from 'moment' export default function CreateBarcode() { const image = React.useRef(null); const [name, setName] = React.useState(""); - const [randomNum, setRandomNum] = React.useState( - Math.floor(Math.random() * 1000) - ); const [barcode, setBarcode] = React.useState(null); const [prints, setNumberOfPrints] = React.useState(0); @@ -33,8 +30,7 @@ export default function CreateBarcode() { // const [hasPermission, setHasPermission] = React.useState(null); const genrateBarcode = () => { - setRandomNum(Math.floor(Math.random() * 1000)); - setBarcode(name.substr(0, 3).toUpperCase() + randomNum + moment(new Date()).format('DDMMYY')); + setBarcode(name); Keyboard.dismiss(); }; @@ -132,7 +128,8 @@ export default function CreateBarcode() { changeName(text)} - placeholder="Enter Customer Name" + placeholder="Enter Customer ID" + maxLength={12} />