Giter Club home page Giter Club logo

Comments (4)

alanjhughes avatar alanjhughes commented on July 23, 2024 1

@yohavrotsztein see referenced PR

from expo.

Harishhrk avatar Harishhrk commented on July 23, 2024

facing the same issue

import React, { useState, useEffect } from "react";
import { Text, View, StyleSheet, Button, Dimensions } from "react-native";
import { CameraView, Camera } from "expo-camera";
import { BlurView } from "expo-blur";

export default function App() {
  const [hasPermission, setHasPermission] = useState(null);
  const [scanned, setScanned] = useState(false);

  const { width, height } = Dimensions.get('window');
  const squareSize = Math.min(width, height) * 0.6; // Set the square size to 60% of the smaller dimension
  const topHeight = (height - squareSize) / 2;
  const sideWidth = (width - squareSize) / 2;

  useEffect(() => {
    const getCameraPermissions = async () => {
      const { status } = await Camera.requestCameraPermissionsAsync();
      setHasPermission(status === "granted");
    };

    getCameraPermissions();
  }, []);
  const handleBarCodeScanned = ({ type, data }) => {
    setScanned(true);
    alert(`Bar code with type ${type} and data ${data} has been scanned!`);
  };

  if (hasPermission === null) {
    return <Text>Requesting for camera permission</Text>;
  }
  if (hasPermission === false) {
    return <Text>No access to camera</Text>;
  }

  return (
    <View style={styles.container}>
      <CameraView
      enableTorch= {true}
        onBarcodeScanned={scanned ? undefined : handleBarCodeScanned}
        barcodeScannerSettings={{
          barcodeTypes: ["qr", "pdf417"],
        }}
        style={StyleSheet.absoluteFillObject}
      />
         <View style={styles.overlay}>
        {/* Top Blur */}
        <BlurView intensity={50} style={[styles.blur, { top: 0, height: 250, width }]} />
        {/* Bottom Blur */}
        <BlurView intensity={50} style={[styles.blur, { bottom: 0, height: 250, width }]} />
        {/* Left Blur */}
        <BlurView intensity={50} style={[styles.blur, { top: 250, height: 235, width: 100, right:320 }]} />
        {/* Right Blur */}
        <BlurView intensity={50} style={[styles.blur, { top: 250, height: 235, left: 320, width: sideWidth }]} />
      </View>
      {scanned && (
        <Button title={"Tap to Scan Again"} onPress={() => setScanned(false)} />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  overlay: {
    ...StyleSheet.absoluteFillObject,
    justifyContent: 'center',
    alignItems: 'center',
  },
  blur: {
    position: 'absolute',
    backgroundColor: 'rgba(0, 0, 0, 0.7 )',
  },
});

from expo.

expo-bot avatar expo-bot commented on July 23, 2024

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

from expo.

yohavrotsztein avatar yohavrotsztein commented on July 23, 2024

Same here. And the torch is really the center of my app. Any news about this?

from expo.

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.