Can't get cornerPoints / bounds in Camera module on onBarCodeScanned event

Please provide the following:

  1. SDK Version: 45
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m trying to get the cornerPoints when scanning a barcode using the Camera module. According to the updated documentation this should be provided with Expo SDK 45.

But I’m only getting the following fields:

  • data: the content of the barcode
  • type: the type of the barcode
  • target

None of those fields contain the cornerPoints.

I’ve also gone through the source code of the camera and barcode scanner module and couldn’t find any issues that would prevent the result containing the cornerPoints.

I can’t use the BarCodeScanner module, because I require the torch mode of the Camera module.

Below is a small example app that I used to test the issue.

import React, {useEffect, useState} from "react";
import {StyleSheet, Text, Vibration, View, TouchableOpacity} from 'react-native';
import {Camera, CameraType} from "expo-camera";
import {BarCodeScanner} from "expo-barcode-scanner";

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

  function onBarCodeScanned(scanningResult) {
    Vibration.vibrate(500);
    console.log('===================')
    console.log('scanningResult')
    console.log(scanningResult)
    console.log('===================')
  }

  useEffect(() => {
    (async () => {
      const { status } = await BarCodeScanner.requestPermissionsAsync();
      setHasPermission(status === 'granted');
    })();
  }, []);

  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}>
      <Camera
        onBarCodeScanned={scanned? undefined : onBarCodeScanned}
        style={{flex: 1, width: '100%'}}
        barCodeScannerSettings={{
          barCodeTypes: [
            BarCodeScanner.Constants.BarCodeType.code128,
            BarCodeScanner.Constants.BarCodeType.code39,
            BarCodeScanner.Constants.BarCodeType.code93,
            BarCodeScanner.Constants.BarCodeType.codabar,
            BarCodeScanner.Constants.BarCodeType.datamatrix,
            BarCodeScanner.Constants.BarCodeType.ean13,
            BarCodeScanner.Constants.BarCodeType.ean8,
            BarCodeScanner.Constants.BarCodeType.itf14,
            BarCodeScanner.Constants.BarCodeType.qr,
            BarCodeScanner.Constants.BarCodeType.upc_a,
            BarCodeScanner.Constants.BarCodeType.upc_e,
            BarCodeScanner.Constants.BarCodeType.pdf417,
            BarCodeScanner.Constants.BarCodeType.aztec,
          ]
        }}
      >
        <View style={styles.buttonContainer}>
          <TouchableOpacity
            style={styles.button}
            onPress={() => {
              setType(type === CameraType.back ? CameraType.front : CameraType.back);
            }}>
            <Text style={styles.text}> Flip </Text>
          </TouchableOpacity>
        </View>
      </Camera>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    width: '100%',
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
  buttonContainer: {
    flex: 1,
    backgroundColor: 'transparent',
    flexDirection: 'row',
    margin: 20,
  }
});