I'm trying to integrate a QrCode payment system in my app, I'm using the OpenPix API. I'm testing the example code that is on their website (https://developers.openpix.com.br/en/docs/plugin/plugin-react/), and right from the start I'm facing this error:
Maximum call stack size exceeded (native stack depth)
, can anyone help me?
import 'core-js/stable';
import { useState } from 'react';
import { useOpenPix } from '@openpix/react';
import QRCode from 'react-native-qrcode-svg';
const App = () => {
const [charge, setCharge] = useState(null);
const onPay = (charge) => {
// TODO do something
console.log('charge was paid');
}
const { chargeCreate } = useOpenPix({
appID: process.env.APP_ID,
onPay,
});
const newCharge = async () => {
const payload = {
correlationID: 'myCorrelationID',
value: 1, // one cent
comment: 'Donate',
}
const { charge, error } = await chargeCreate(payload);
if (error) {
setError(error);
return;
}
setCharge(charge);
}
if (charge) {
return (
<QRCode
size={200}
value={brCode}
/>
);
}
return (
<>
<button onClick={newCharge}>
Create New Charge
</button>
</>
)
}
export default App;