Skip to content

docs(react-native): update deep link setup instructions#668

Open
victoreronmosele wants to merge 3 commits intokinde-oss:mainfrom
victoreronmosele:chore/upgrade-react-native-sdk-setup-instructions
Open

docs(react-native): update deep link setup instructions#668
victoreronmosele wants to merge 3 commits intokinde-oss:mainfrom
victoreronmosele:chore/upgrade-react-native-sdk-setup-instructions

Conversation

@victoreronmosele
Copy link
Member

@victoreronmosele victoreronmosele commented Feb 22, 2026

Description (required)

This PR updates the deep link setup instructions to the SDK's latest version requirements.

Summary by CodeRabbit

  • Documentation
    • Replaced manual Android linking with a centralized dependency declaration and simplified setup steps
    • Moved iOS guidance to a CocoaPods-focused flow and removed manual Xcode linking examples
    • Reworked deep linking section (renamed and restructured) with platform-specific guidance
    • Added tabbed Swift and Objective-C AppDelegate examples for custom scheme and universal links
    • Updated headings and styling for clearer, modernized setup guidance

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

Walkthrough

Updated the React Native SDK documentation to remove manual Android native-linking, declare required dependencies centrally, and modernize iOS integration with CocoaPods and language-aware (Swift/Objective-C) AppDelegate tabbed examples; deep linking guidance was restructured into platform-specific, tabbed instructions.

Changes

Cohort / File(s) Summary
React Native SDK Documentation
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx
Removed Android manual linking and native-file edits; added a "Required dependencies" section listing react-native-app-auth, react-native-keychain, and react-native-get-random-values. Replaced iOS manual linking with CocoaPods-centric instructions. Reworked deep linking into a "Configure deep linking" section with tabbed, language-aware AppDelegate code samples for Swift and Objective‑C (custom scheme and universal link handling). Updated headings and structure to reflect the new dependency and platform-specific setup flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through docs with nimble feet,

Cleared the links and set deps neat,
Swift and ObjC now side by side,
Deep links sorted, tabs as guide,
A tidy path for builds complete.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: updating deep link setup instructions for React Native SDK documentation to match latest version requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the sdk label Feb 22, 2026
@victoreronmosele victoreronmosele marked this pull request as ready for review February 22, 2026 17:57
@victoreronmosele victoreronmosele requested a review from a team as a code owner February 22, 2026 17:57
@victoreronmosele victoreronmosele marked this pull request as draft February 22, 2026 17:57
@victoreronmosele victoreronmosele marked this pull request as ready for review February 22, 2026 17:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 235-253: The code calls
authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with:) using
userActivity.webpageURL which is an optional; update the
AppDelegate.application(_:continue:restorationHandler:) branch to safely unwrap
the URL (e.g., if let url = userActivity.webpageURL) and pass the non-optional
url to delegate.resumeExternalUserAgentFlow(with:), only returning true when
both the delegate exists and the unwrapped url is passed; keep the fallback to
RCTLinkingManager.application(...).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx (2)

275-284: Inconsistent nil-guard on authorizationFlowManagerDelegate across ObjC handlers.

The custom-scheme handler (line 280) calls resumeExternalUserAgentFlowWithURL: directly on self.authorizationFlowManagerDelegate without a nil-check, while the universal-link handler (line 295) wraps the same call in if (self.authorizationFlowManagerDelegate). Messaging nil in Objective-C is safe and returns NO, so there is no crash risk, but for consistency either pattern should be applied uniformly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around
lines 275 - 284, The custom-scheme handler method application:openURL:options:
calls [self.authorizationFlowManagerDelegate
resumeExternalUserAgentFlowWithURL:url] without a nil-check; make this
consistent with the universal-link handler by first checking
self.authorizationFlowManagerDelegate before invoking
resumeExternalUserAgentFlowWithURL: (i.e., only call
resumeExternalUserAgentFlowWithURL: if self.authorizationFlowManagerDelegate is
non-nil and return YES when it returns YES, otherwise fall back to calling
RCTLinkingManager application:openURL:options:).

261-263: RCTLinkingManager.h import belongs in AppDelegate.m, not AppDelegate.h.

RCTLinkingManager is only referenced in the .m implementation methods. Importing it in the public .h header needlessly widens the visible interface. Moving it to the .m file follows the standard Objective-C convention of importing symbols where they are used.

♻️ Proposed refactor
  // AppDelegate.h
  + `#import` <React/RCTLinkingManager.h>   ← remove from here
    `#import` "RNAppAuthAuthorizationFlowManager.h"
  // AppDelegate.m  (add at the top of the file)
+ `#import` <React/RCTLinkingManager.h>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx` around
lines 261 - 263, The import of RCTLinkingManager.h should be removed from
AppDelegate.h and added to AppDelegate.m where the linking methods are
implemented; update the header to only include
RNAppAuthAuthorizationFlowManager.h (or other public headers) and move `#import
<React/RCTLinkingManager.h>` into AppDelegate.m near the implementation of the
methods that reference RCTLinkingManager to keep the public interface clean and
follow Objective-C import conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 186-202: The bridging header guidance is incomplete: ensure
AppDelegate+RNAppAuth.h (or your existing Objective-C Bridging Header) also
imports RCTLinkingManager so Swift can call RCTLinkingManager methods used by
RNAppAuth; add `#import` <React/RCTLinkingManager.h> alongside the existing
RNAppAuthAuthorizationFlowManager import, and update Step 2 to instruct
developers to add these imports to their existing bridging header instead of
replacing it if one already exists.

---

Duplicate comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 235-254: The conditional previously passed an optional to a
non-optional parameter; update the AppDelegate
application(_:continue:restorationHandler:) to safely unwrap
userActivity.webpageURL in the if-chain and pass the unwrapped url to
authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with:), as shown by
the new let url = userActivity.webpageURL check and the call to
resumeExternalUserAgentFlow(with: url); if that returns false, fall back to
RCTLinkingManager.application(..., continue: userActivity, restorationHandler:
restorationHandler).

---

Nitpick comments:
In `@src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx`:
- Around line 275-284: The custom-scheme handler method
application:openURL:options: calls [self.authorizationFlowManagerDelegate
resumeExternalUserAgentFlowWithURL:url] without a nil-check; make this
consistent with the universal-link handler by first checking
self.authorizationFlowManagerDelegate before invoking
resumeExternalUserAgentFlowWithURL: (i.e., only call
resumeExternalUserAgentFlowWithURL: if self.authorizationFlowManagerDelegate is
non-nil and return YES when it returns YES, otherwise fall back to calling
RCTLinkingManager application:openURL:options:).
- Around line 261-263: The import of RCTLinkingManager.h should be removed from
AppDelegate.h and added to AppDelegate.m where the linking methods are
implemented; update the header to only include
RNAppAuthAuthorizationFlowManager.h (or other public headers) and move `#import
<React/RCTLinkingManager.h>` into AppDelegate.m near the implementation of the
methods that reference RCTLinkingManager to keep the public interface clean and
follow Objective-C import conventions.

Comment on lines +186 to +202
1. Create a new file, `AppDelegate+RNAppAuth.h`, in the **same folder as your `AppDelegate.swift`** and add the following code:

```objc title="AppDelegate+RNAppAuth.h"
#import "RNAppAuthAuthorizationFlowManager.h"
```

2. Set the Objective-C Bridging Header path in your Xcode Build Settings to `$(SRCROOT)/$(TARGET_NAME)/AppDelegate+RNAppAuth.h`.

<details>
<summary>Open for steps</summary>

- Open the project in Xcode.
- Select the project in the navigator, then the app target.
- Open the **Build Settings** tab.
- Search for **bridging**.
- Set **Objective-C Bridging Header** to $(SRCROOT)/$(TARGET_NAME)/AppDelegate+RNAppAuth.h.
</details>
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing #import <React/RCTLinkingManager.h> in the bridging header — build will fail.

AppDelegate+RNAppAuth.h only imports RNAppAuthAuthorizationFlowManager.h, but RCTLinkingManager is called directly in both the custom-scheme and universal-link Swift methods added in Step 3. Without exposing that header to Swift, the project won't compile.

React Native App Auth's own docs note that a bridging header is needed to bridge the Objective-C code the package uses, and AppDelegate+RNAppAuth.h is the file to create. That file must also include every header you'll be referring to from Swift code — for React Native, the fundamental headers come from the React static library and need to be explicitly listed, including #import <React/RCTLinkingManager.h>.

Additionally, Step 2 instructs developers to replace the Objective-C Bridging Header setting with this new file. Projects that already have a bridging header configured (common in customised RN projects) will lose those imports. The instructions should clarify: if a bridging header already exists, add the import(s) to that existing file instead of creating a new one and changing the path.

🐛 Proposed fix for the bridging header content
  ```objc title="AppDelegate+RNAppAuth.h"
+ `#import` <React/RCTLinkingManager.h>
  `#import` "RNAppAuthAuthorizationFlowManager.h"
</details>

And add a note alongside Step 2, e.g.:

> **Note:** If your project already has an Objective-C Bridging Header configured, add the above imports to that existing file rather than creating a new one.

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @src/content/docs/developer-tools/sdks/native/react-native-sdk.mdx around
lines 186 - 202, The bridging header guidance is incomplete: ensure
AppDelegate+RNAppAuth.h (or your existing Objective-C Bridging Header) also
imports RCTLinkingManager so Swift can call RCTLinkingManager methods used by
RNAppAuth; add #import <React/RCTLinkingManager.h> alongside the existing
RNAppAuthAuthorizationFlowManager import, and update Step 2 to instruct
developers to add these imports to their existing bridging header instead of
replacing it if one already exists.


</details>

<!-- fingerprinting:phantom:poseidon:churro -->

<!-- This is an auto-generated reply by CodeRabbit -->

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without exposing that header to Swift, the project won't compile

The project does compile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🌐 Web query:

React Native RCTLinkingManager Swift import bridging header

💡 Result:

To use RCTLinkingManager from Swift, you typically don’t import it in Swift directly—you expose the Objective‑C header to Swift via an Objective‑C bridging header, then call it from AppDelegate.swift.

1) Add RCTLinkingManager to your bridging header

Create (or edit) ios/<YourApp>/<YourApp>-Bridging-Header.h and add:

`#import` <React/RCTLinkingManager.h>

This is a common React Native Swift bridging-header pattern and explicitly includes RCTLinkingManager for Swift visibility. [1]

Also make sure Xcode is pointing at the file:
Build Settings → Swift Compiler - General → Objective-C Bridging Header (set the relative path). [2]

2) Forward deep links in AppDelegate.swift

In your AppDelegate.swift, forward URL opens to React Native:

override func application(
  _ app: UIApplication,
  open url: URL,
  options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
  return RCTLinkingManager.application(app, open: url, options: options)
}

This is the standard Swift equivalent of the Objective‑C openURL forwarding. [3]

Universal Links (optional)

override func application(
  _ application: UIApplication,
  continue userActivity: NSUserActivity,
  restorationHandler: `@escaping` ([UIUserActivityRestoring]?) -> Void
) -> Bool {
  return RCTLinkingManager.application(application, continue: userActivity, restorationHandler: restorationHandler)
}

[4]

Notes / common gotchas

  • If you’re integrating other SDKs that also handle openURL, you must combine the handlers into one openURL method (iOS only allows one). [5]

Sources: [1] [2] [3] [4] [5]


🌐 Web query:

React Native 0.70 RCTLinkingManager Swift automatic import module map

💡 Result:

To use RCTLinkingManager from Swift in a React Native 0.70 iOS app, you have two workable paths:

Option A (most common): Use a Bridging Header (no Swift import React needed)

  1. Create/ensure you have an Objective‑C bridging header (e.g. YourApp-Bridging-Header.h).

  2. Add:

    `#import` <React/RCTLinkingManager.h>

    (RN’s Swift/native-module docs call out that Swift↔ObjC interop requires a bridging header that imports the React headers you need.) [1]

  3. In AppDelegate.swift, call RCTLinkingManager normally (no import React required).

A common gotcha: make sure the #import <React/RCTLinkingManager.h> is actually compiled via the bridging header / correct target settings; otherwise Xcode will complain it can’t find the header. [2]

Option B: Enable an auto-generated module map so Swift can import React

If your goal is specifically “Swift automatic import” (i.e. import React), you need the React pods to define modules (generate module maps). CocoaPods’ standard fix is to enable modular headers:

  • In your ios/Podfile add one of:
    • use_modular_headers! (global), or
    • :modular_headers => true for specific pods

This is the documented CocoaPods approach when Swift pods (or Swift code) need module maps for dependencies that “do not define modules.” [3]

Then run:

cd ios
rm -rf Pods Podfile.lock
pod install

Which should you pick?

  • If you only need RCTLinkingManager in the app delegate, Option A is usually simplest.
  • If you want to freely import React in Swift across the app (and avoid bridging-header imports), use Option B.

Sources: React Native Swift/bridging-header guidance [1], RCTLinkingManager header import workaround [2], CocoaPods modular-headers/module-map requirement explanation [3].


@victoreronmosele, thank you for the clarification! I stand corrected. If the project compiles successfully without explicitly importing RCTLinkingManager in the bridging header, then my concern was unfounded.

It's possible that React Native's build configuration or module maps are making RCTLinkingManager available to Swift through other mechanisms (such as modular headers via CocoaPods). Since you've tested this and confirmed it works, the documentation as written should be fine.

I appreciate you taking the time to verify and correct my review comment!


🧠 Learnings used
Learnt from: victoreronmosele
Repo: kinde-oss/documentation PR: 639
File: src/content/docs/developer-tools/sdks/native/flutter-sdk.mdx:178-226
Timestamp: 2025-12-12T01:58:25.587Z
Learning: In Flutter SDK documentation using flutter_appauth, the `net.openid.appauth.RedirectUriReceiverActivity` is automatically handled by the plugin when the `appAuthRedirectScheme` manifest placeholder is set in `build.gradle`. Only `net.openid.appauth.AuthorizationManagementActivity` needs to be explicitly added to `AndroidManifest.xml` to configure its `taskAffinity` attribute for apps with `minSdkVersion < 30`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant