Expo BarCodeScanner

How can i save the data from the scanner into my state? I’ve tried the solution below, but for some reason my this.state.barcodeData is null.

P.S. Aler function works fine.

handleBarCodeScanned = ({ type, data }) => {
this.setState({ scanned: true, barcodeData: data });

alert(
  `Bar code with type ${type} and data ${data} has been scanned! \n
  `
);

}

Hi.

The problem seems unrelated to the code you posted. If the alert call works, then clearly data contains what you are expecting, so the problem must be elsewhere.

Can you post a Snack that demonstrates the problem?