JSI & Reactive Options #7004
swabbass
started this conversation in
Enhancements & New Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation
Today, our API uses ReactNative "Bridge" in order to process RNN commands, and that is a 2 part topic that can be described as follow:
We had a discussion about these topics and to move our library forward to be more modern, clean, and more importantly fast.
Feel free to comment, share your thoughts, maybe suggestions, changes.
JSI
Consider using
JavaScriptInterface
in order to make RNN commands synchronous, hence, "immediate" access from JS thread to Native threads.There are a couple of examples of how it might being done.
Inspired by Reanimated 2.0 SharedValue,
which is in a simplified way, holds the JS Object to Native object parsing and caching, providing
worklets
that acts as a wrapper to run a function in the native side and running a native function in the js thread, synchronously, and using the parsing part to manage the arguments and more cool stuff, thx to C++;That enables us on android to access native code faster via JSI & NDK code, and on iOS just to call functions and declare options natively.
Reactive Options
Options can be reactive in a way when calling
mergeOptions
, or any other command that has options, we should change the only attributes without any unused extra objects, aside from those needed in the process, and aggregate the changes to subscribed views.concepts:
SharedValue
for fast access.ViewController
once changes take place.Added Value
Such change should have a clear goal on how this awesome lib should go, and it should be:
Workplan
JSI
dependencies.JSI
integrability.JSI
ready inner JS API, as an opt-in, feature.CC: @yogevbd
Beta Was this translation helpful? Give feedback.
All reactions