Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native compatibility #71

Open
Czino opened this issue Jan 20, 2022 · 4 comments
Open

react-native compatibility #71

Czino opened this issue Jan 20, 2022 · 4 comments

Comments

@Czino
Copy link

Czino commented Jan 20, 2022

I was already expecting while reading the README.md that I won't be lucky with react-native.

But I tried the sample integration and already hit the first error that happens somewhere here: bitbox02-api-go.js:

ERROR Error: runtime error: makeslice: len out of range

Is react-native compatibility planned or do you suggest including a webview as a workaround?

@thisconnect
Copy link
Collaborator

Could provide a minimal reproducible example that triggers the errro?
maybe even a git repo?

This is a go error, currently bitbox02-api-js is transpiled with gopherjs

that error is triggered by the makeslice function in the runtime, when the len argument of make( ) called on a slice is either negative of unreasonably big; e.g:

golang/go#38673

@Czino
Copy link
Author

Czino commented Mar 23, 2022

Thanks for not closing the issue.

So, I created this repository here.

At first it was not showing the original error, because of this problem:

[Error: Requiring module "node_modules/bitbox02-api/lib/bitbox02.js", which threw an exception: TypeError: undefined is not an object (evaluating 'argv.length')]

after adding this workaround

global.process.argv = []

I managed to force the above mentioned error. Hope it helps.

Would be great if Bitbox is also react-native compatible

@thisconnect
Copy link
Collaborator

Thanks for the repo ❤️ !! The transpiled go code is just so big 🙈

Running npm run android I got stuck at 97-98% bundling, so then I was looking at 2 things: increase memory for node with NODE_OPTIONS=--max_old_space_size=8192 npm run android
and ignore/exclude bitbox02-api module from babel.

This person has a similar issue with a big lib also using react native babel/babel#12231

For some reason I don't get stuck anymore at 98% building, but the emulator can't connect to the debugger.. here I am afraid I just don't have enough experience with react native. :(

cc @benma

@Czino
Copy link
Author

Czino commented May 6, 2022

If support cannot be guaranteed on the native level for react, do you think including a webview and loading the interface through it would be a viable workaround?

I will probably try it soon if there's no native solution by then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants