Reactotron does not support `BigInt()`
A community member raised an issue in the reactotron channel that the library doesn't support BigInt().
Indeed, it does not.
<Button
text="BigInt(0)"
onPress={() => {
console.log(BigInt(0))
}}
/>
Hey, this change seems to cause issue in React Native Android
I'm getting this (non-blocking) error "Property 'BigInt' doesn't exist". I was able to fix it by installing the big-integer package and adding this code to my entrypoint
if (typeof BigInt === 'undefined') {
global.BigInt = require('big-integer');
}
(Btw I'm using a relatively old version of RN ~> 0.67.5)
@mcreusot I just found this thread where it's stated that BigInt support was added to react native in 0.70.
I'll spin up an app with an older version and try and ship a permanent fix for this issue. Thanks for bringing it to my attention!
Hello. I have the same issue.
React native 0.73.4
"reactotron-react-native": "^5.1.3",
I have tried this followed troubleshooting but it didn't help
adb reverse tcp:9090 tcp:9090
How to solve that?
On IOS app works, on android I builds successfully, but I see the same error screen
ReferenceError: Can't find variable: BigInt
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.`
I encountered this same issue as well while following the Reactotron Quick Start guide when shifting over from Flipper.
my package.json:
{
...
"dependencies": {
...
"react-native": 0.72.6,
...
},
"devDependencies": {
...
"reactotron-react-native": "^5.1.4",
"reactotron-redux": "^3.1.9",
...
},
...
}
Since I was switching over from Flipper on a react-native project, I just decided to go with downgrading the dependencies.
Based on https://github.com/infinitered/reactotron/pull/1437/commits/846c8ca281b154cc05054dd3c57c0b30967257a0, the BigInt reference in the serialize.ts of reactotron-core-client was added since v2.9.0 of reactotron-core-client to address the JSON.stringify issue, so I downgraded from there and my package.json now looks like this:
{
...
"dependencies": {
...
"react-native": 0.72.6,
...
},
"devDependencies": {
...
"reactotron-react-native": "5.0.5",
"reactotron-redux": "3.1.7",
"reactotron-core-client": "2.8.13",
...
},
...
}
I was hoping to get away with this without adding the additional big-integer dependency. Perhaps a possible fix to address this in reactotron-core-client could be to add optional-chaining to the fix so that it only targets systems with BigInt?
BigInt?.prototype.toJSON = function() { return this.toString() }
Still reproduce for React Native v0.72.4 (only for Android)
"reactotron-react-native": "^5.1.6",
same issue on "react-native": "0.71.11",
Inspired by @hliejun I came up with the following patch that solves the issue for me. However I have no Idea if it might break things (I didn't try to debug with android / reactotron yet):