Company
Date Published
Author
Teodor Ciuraru
Word count
3358
Language
English
Hacker News points
None

Summary

Ditto's integration of React Native with its Rust core involved developing a React Native SDK using the JavaScript Interface (JSI) to enable efficient cross-platform extension. The team evaluated two architectural approaches: embedding current iOS and Android SDKs, which would have been faster but more cumbersome, and using React Native's New Architecture to create a platform-agnostic C++ layer that facilitates Rust interoperability. The latter was chosen for its efficiency and scalability, despite challenges like backward compatibility and a steep learning curve. Ditto opted for using JSI in conjunction with legacy Native Modules to maintain architectural compatibility while leveraging the advantages of the new architecture. Additionally, the team utilized existing JavaScript SDK implementations and WebAssembly to bridge Rust logic, minimizing code duplication. The process involved detailed steps for scaffolding the React Native SDK project, integrating JSI for iOS and Android, and creating a Rust library to demonstrate the capability of calling Rust functions from JavaScript. This strategic endeavor aligns with Ditto's mission to simplify backend complexities and extend its core product across multiple platforms.