Git Product home page Git Product logo

Comments (9)

vincenzoiacovone avatar vincenzoiacovone commented on May 26, 2024 2

I'm using class component
Tired of trying and trying workarounds, version changes, debugging..
Sure that after the first rendering all works well..
Switch on caveman mode:

added this style in the Camera component:

    style={{
        ...StyleSheet.absoluteFill,
        width: Dimensions.get('screen').width,
        height: Dimensions.get('screen').height + this.state.update,
      }}

and this in componentDidMount:

    let context = this;
    setTimeout(function () {
      context.setState({update: 1});
    }, 500);

from react-native-vision-camera.

GioMaugeri avatar GioMaugeri commented on May 26, 2024 1

Did you try 3.9.1? There might be a fix for this issue in there but I have not verified my self. Had same issue on android 10 device

Yes I tried but I got same error

from react-native-vision-camera.

frenbergFNX avatar frenbergFNX commented on May 26, 2024 1
    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

from react-native-vision-camera.

frenbergFNX avatar frenbergFNX commented on May 26, 2024

Did you try 3.9.1? There might be a fix for this issue in there but I have not verified my self. Had same issue on android 10 device

from react-native-vision-camera.

oscar-b avatar oscar-b commented on May 26, 2024

#2583

from react-native-vision-camera.

GioMaugeri avatar GioMaugeri commented on May 26, 2024
    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

This worked also for me both for android 11 and android 13 thanks.

from react-native-vision-camera.

GioMaugeri avatar GioMaugeri commented on May 26, 2024
    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

I covered the component that contains the camera with a condition of a boolean value, but with this trick now the app sometimes crash.

This is the code that call the component:

{cameraVisibile && <ScannerScreen onChangeCameraVisible={onChangeCameraVisible} onQrCheck={onQrCheck} />}

And this is the component of before:

<Camera
       codeScanner={codeScanner}
       device={device}
       isActive={true}
       audio={false}
       photo={false}
       video={false}
       onInitialized={() => setHack(1)}
       style={[StyleSheet.absoluteFill, {width: Dimensions.get('screen').width + hack}]}
       onTouchEnd={() => setEnableOnCodeScanned(true)}
     />

There isn't also a way to disable the camera component without create each time a new component? Or a way to resolve in my way, with an external value?

from react-native-vision-camera.

mrousavy avatar mrousavy commented on May 26, 2024

Duplicate of #2583

from react-native-vision-camera.

ShreyasSathyanarayana avatar ShreyasSathyanarayana commented on May 26, 2024

the hack is working, I was also facing the same issue. Tq for the help..........

from react-native-vision-camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.