-3

I'm looking for a way to share a React Native component with 3rd parties without having to share the actual source code.

Something like a .jar in Java or a .dll for C#.

enter image description here

So assuming we have company A and company B, i (as company B) am looking for a way to provide a react native library to company A without being able to navigate through my source code.

Ideally I want others to be able to

import CustomComponent from '...myCustomComponent';

but not being able to look in the actual code.

Any thoughts are welcome.

6
  • Thanks for your input. I understand it seems like a request for feasibility study by the community but it really isn't. Maybe it is not the right place to ask the question. A yes or no answer from someone who had a similar problem in the past would be ok (so that i know i should/shouldn't waste any more time). A pointing direction would be even better for sure. Thanks anyway. Will keep looking for alternatives. – Gr3at Apr 5 at 13:52
  • 1
    Can't bring myself to close this one, especially with the close reason the other community members have chosen. This isn't a request for code-writing assistance; it is a question about deployment. – Robert Harvey Apr 5 at 14:51
  • There is something called a "Web Assembly" that may allow what you desire. The link here may be a start to answer your question: developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm Problem with Javascript is that it can be uglified, minified, and obfuscated--but not provided as a binary. – Berin Loritsch Apr 5 at 20:26
  • This is the spec: webassembly.org – Berin Loritsch Apr 5 at 20:28
0

Following Berin Loritsch's commented suggestion, i looked into Web assembly as a solution.

So just putting my findings here for possible future reference.

Objective

Share react native components with third parties, while hiding as much code as possible.

Possible solutions (until now)

  1. Minify, obfuscate and/or uglify js code altogether.

    • pros: easy to implement.
    • cons: doesn't actually hides any part of the code.
  2. Utilize Web Assembly for parts of the business logic

    • pros:
      • it also proivdes a performance boost for cpu hungry operations.
      • the compiled wasm file is not that easy to decompile and follow the logic.
    • cons:
      • addition of extra complexity - i.e. more programming languages in the game.
      • requires a WebView to actually utilize Web Assembly.
  3. Take advantage of the underlying C++ capabilities existing both for IOS and Android platforms and implement parts of the business logic there.

    • pros:
      • close to chip => higher performance.
      • compiled library => as secure/hiden as possible (i think).
    • cons: more difficult/time consumming to implement.
  4. Move as much logic as possible in a backend system and provide an API.

New contributor
Gr3at is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.