Closed gaspop closed 1 year ago
I am pretty sure the issue is somehow related to your setup and it's not a plugin issue ;)
Can you share me your repo? There are unfortunately informations missing and I need the complete setup to verify it...
Thank you for getting back so quickly! I'm pretty sure it's something with my setup as well, but I don't see anything obvious.
I set up a a repo to test it here
Ok, found it. You have a background set on your .App-header
class, since the scanner will be rendered behind all DOM elements your scanner will never be visible if an element with a background is in front of it ;)
You just need to add some logic to control the background of your own css and set it to transparent if the scan is startet, then everything should work.
It does indeed. I did try the suggestion of adding a class to the body that sets the background color to transparent when starting the scanner, as mentioned in the documentation, but never got that to work so I must have done something wrong.
Thanks for the help!
Describe the bug I've run into the issue mentioned in the instructions, where the element for displaying the camera does not appear in the DOM. The camera is started, as indicated by my phone, but the view isn't rendered. I'm posting this issue as I don't think I've missed anything in the instructions. Could the problem be the web app is using react?
To Reproduce Steps to reproduce the behavior:
function App() { useEffect(() => { const testScan = async () => { await BarcodeScanner.checkPermission({ force: true });
}, [])
return (
Edit
Learn Reactsrc/App.js
and save to reload.); }
export default App;
npm run build npx cap sync
{ "name": "barcode-test", "version": "0.1.0", "private": true, "dependencies": { "@capacitor-community/barcode-scanner": "^3.0.0", "@capacitor/android": "^4.3.0", "@capacitor/core": "^4.3.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "@capacitor/cli": "^4.3.0" } }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="test.barcode">