Listening to application URLs in React Native

Johannes Lumpe is sharing its experience in using custom URL schemes with React Native from its work on React Native Playground.

One great feature of mobile platforms is deep linking into your application from custom URLs, using custom URL schemes. We wanted this for the React Native Playground iOS app, to share applications easily from any medium, like emails or tweets, using the rnplay:// scheme.

Fortunately, React Native bundles a library to handle incoming requests via URL schemes. Let’s get to it!

  • Define our URL scheme in XCode
  • Modify AppDelegate.m to pass incoming requests to React Native
  • Listen for and handle requests in JavaScript

React Native Linking iOS example on GitHub

Blog post on lum.pe