-
Notifications
You must be signed in to change notification settings - Fork 4
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 prototype #1
Comments
I seem to have gotten slightly further along with https://github.com/mojodna/surveyor-prototype In order for it to pick up The last error I ran into was:
|
FTR, var protobuf = require('protocol-buffers')
var fs = require('browserify-fs')
var path = require('path-browserify')
module.exports = protobuf(fs.readFileSync(path.join(__dirname, '..', 'schema.proto'), 'utf-8')) |
IIRC, there's a way to configure Webpack to provide alternative versions of dependencies when Related:
osm-p2p, etc. are all built to target browsers using browserify, so to wedge them into a React Native app, we'll either need to incorporate browserify into RN's packager or figure out how to achieve similar results. Haul uses Webpack, which seems promising. |
After mojodna/surveyor-prototype@8f33146, it gets much further along, but RN now bails with:
|
Vaguely relevant: pouchdb/pouchdb#3787 |
The source of the "unexpected token" error is |
With that addressed, I'm back to |
...which is not from osm-p2p at all, but rather from |
Inline node_modules/hyperlog/messages.js per developmentseed/field-data-collection#1 and babelify node_modules/asyncstorage-down.
Inlining it (which is what module.exports = protobuf('message Node {\n required uint32 change = 1;\n required string key = 2;\n required string log = 3;\n optional uint32 seq = 4;\n optional bytes identity = 7;\n optional bytes signature = 8;\n required bytes value = 5;\n repeated string links = 6;\n}\n\nmessage Entry {\n required uint32 change = 1;\n required string node = 2;\n repeated string links = 3;\n optional string log = 4;\n optional uint32 seq = 5;\n}\n\nmessage Log {\n required string log = 1;\n required uint32 seq = 2;\n}\n\nmessage Handshake {\n required uint32 version = 1;\n optional string mode = 2 [default = "sync"];\n optional bytes metadata = 3;\n optional bool live = 4;\n}'); And now, after mojodna/surveyor-prototype@a88d632, we have a non-build-related error:
|
There's a react-native variant of Sidenote: why am I spending so much time on this? @gmaclennan and I are (I think) convinced that React Native is a better path than Cordova, etc, and this represents a pretty fundamental challenge that we need to overcome in order to be successful (and is likely to be a similar problem within the Cordova world). |
GitHub link to that: https://github.com/mvayngrib/react-native-randombytes |
This simplifies the installation process:
but I still end up with:
(which I thought was a result of |
From deep in the weeds: osm-p2p / leveldb is probably going to need native filesystem access to have decent performance, so we'll likely need to see whether / how to expose native FS functions (or native leveldb). |
So far I've been having issues getting react-native and osm-p2p working together.
The challenge is getting react-native to run node modules.
Here are some things I've tried:
TypeError
that traced to the messages.js file in hyperlog.react-native doesn't support indexeddb, but that should be solved with the
react-native-level
module: https://github.com/developmentseed/field-data-collection/blob/master/prototypes/react-native/FieldDataCollection/lib/osm-p2p.jsThe text was updated successfully, but these errors were encountered: