React Native is a great framework for buiding mobile apps in JavaScript, but it's only available for iPhone and Android. It's time to bring it to the Apple Watch.

What it does

Executes JavaScript on the watch to render UIKit views on the display. The video demo shows React Native itself running (then crashing shortly thereafter due to a threading issue).

How I built it

A significant amount of reverse engineering: modifying the WatchKit stub to load a UIKit application instead of the default application, expose the private JavaScript and UIKit APIs by using the iPhoneOS framework headers. Check the GitHub for more details about the reverse engineering process.

Challenges I ran into

  • Figuring out how to link a .framework as a dynamic library: otool, install_name_tool
  • Executing JS on a separate thread without crashing the app (unsolved)

Accomplishments that I'm proud of

  • Being able to successfully compile and run UIKit on the Watch

What I learned

  • A lot about the Xcode build system & tooling:
    • .frameworks and .dylib
    • otool, install_name_tool

What's next for React Native for Apple Watch

  • Fix the threaded JS runtime
  • Determine a way to distribute the hack to be used by others.
Share this project: