ReactWindows / third-party-module-status

A list of third-party React Native modules that should be / have been / are being ported to react-native-windows.
1 stars 0 forks source link

realm for react-native-windows #1

Open rozele opened 7 years ago

rozele commented 7 years ago

After a bit of discovery, implementation of this module is a bit more challenging than initially thought. Realm is quite a bit different from other native modules in that it injects a hook to add native callbacks in JavaScriptCore when the JSC runtime is first initialized.

We'll need to do the following at least: 1) Write the Chakra(Core) equivalent of https://github.com/realm/realm-js/tree/master/src/jsc and https://github.com/realm/realm-js/tree/master/src/node. 2) Add .vcxproj build files that are compatible with UWP (unfortunately node-gyp only generates build files that work on Win32) 3) Establish a mechanism for Realm to integrate the native callbacks in Chakra(Core)

I've reached out to Realm for guidance on the first two, and it may be something we can collaborate on.

Regarding the third part, I think we can unseal the ChakraJavaScriptExecutor and allow realm to thread through a custom JavaScriptExecutor that is initialized with the native callbacks in Chakra. This approach will only support one module that extends the JS runtime at a time, so it would be better to add some mixin architecture or native JavaScript module hooks, but it will work in the immediate term.

jakallergis commented 6 years ago

@rozele is there any progress on that?

rozele commented 6 years ago

@jakallergis - no, but I think some folks have had success writing a native module for realm that uses the NuGet package. That approach does lose some of the perf benefits because of communication over the bridge.