Lukas1h / react-native-kindle

Library for running react-native on Kindle e-readers.
https://www.npmjs.com/package/react-native-kindle
11 stars 0 forks source link

How to connent network? #2

Open ixunuo opened 5 months ago

ixunuo commented 5 months ago

It's really a wonderful project, but I found when I use fetch or XMLHttpRequest, nothing happend. I tried my best but nothing works. Do you have some ideas?

Lukas1h commented 5 months ago

Yeah unfortunately I've had the same problem. It's one of the main things that's halted development of some more useful applications.

I think the way Amazon does it in there applications is fetching data in the native Java side, and then sending it over to the JavaScript side. Unfortunately, we can't do that since we can't compile our own native launcher for the JavaScript bundle.

I currently have no idea of how to solve the problem, but if you have any ideas I'd love to work out a solution with you!

One of the solutions I've considered, but have not tested, is finding a way to run some sort of external application that does the fetch request on behalf of the JavaScript and then sends it to the JavaScript side. I think this might be possible using LIPC stuff.

It's possible for the ImageView to access network images I believe, so it should be possible for the JavaScript code to access network requests some how.

ixunuo commented 5 months ago

using LIPC to transfer data is possible. Have you already found how to run lipc in react app?

Lukas1h commented 5 months ago

Unfortunately, not yet.

The Kindle web apps (their actual name escapes me at the moment) have a dbgCmd function that's used to interact with LIPC. I think a similar function must exist somewhere for the KPP framework.

ixunuo commented 5 months ago

it's disappointing. In fact, I've also tried many methods, but lipc not works.