staltz / react-native-node

Run a separate Node.js process behind a React Native app
MIT License
1.12k stars 33 forks source link

Unclear FAQ explanation on compiling native libraries #4

Closed aschrijver closed 7 years ago

aschrijver commented 7 years ago

The README at the FAQ section has some text I do not fully understand:

Does it support packages with native bindings?

Yes, in theory, but that's the job of individual libraries having native bindings for android. Most packages don't have. I believe sodium-native has. Hint: if you want to compile the native part of packages, I recommend not trying to cross-compile. Instead, install termux on an Android device and compile from the phone directly.

I assume you mean node packages having native libraries, that require extra care to include. And not the native Java in react-native Gradle projects?

So not these kind of projects in the settings.gradle:

include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/android')
include ':react-native-randombytes'
project(':react-native-randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
include ':react-native-i18n'
project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android')

It would be nice if there was an example that e.g. included the native parts of sodium-native as a demonstration of how to bundle / use that in a project (besides compiling it). Apart from that an explanation or pointer to more compilation instruction would be great.

PS I am looking into node-as-native-libray projects to avoid having to use termux. You can't offer that to end-users. But it is just needed for compilation purposes, not for installing app, right?

Thanks!

staltz commented 7 years ago

I assume you mean node packages having native libraries, that require extra care to include. And not the native Java in react-native Gradle projects?

Yes you assumed correctly.

It would be nice if there was an example that e.g. included the native parts of sodium-native as a demonstration of how to bundle / use that in a project (besides compiling it). Apart from that an explanation or pointer to more compilation instruction would be great.

Yes that would be great.

PS I am looking into node-as-native-libray projects to avoid having to use termux. You can't offer that to end-users. But it is just needed for compilation purposes, not for installing app, right?

That's correct.

aschrijver commented 7 years ago

Thanks a bunch!