Skip to content

Feat/new nitro#85

Merged
patrickkabwe merged 5 commits into
mainfrom
feat/new-nitro
Aug 17, 2025
Merged

Feat/new nitro#85
patrickkabwe merged 5 commits into
mainfrom
feat/new-nitro

Conversation

@patrickkabwe

@patrickkabwe patrickkabwe commented Aug 17, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Refactor

    • Presentation style now uses explicit string values ('pageSheet', 'formSheet', 'fullScreen'); example app reorganized to use a provider-safe-area structure.
  • Bug Fixes

    • Runtime errors now surface to users via an alert dialog instead of only logging to the console.
  • Documentation

    • Installation instructions updated to react-native-nitro-modules@0.28.0.
  • Chores

    • Dependency and tooling upgrades, CI/workflow and build config updates, Android/iOS example platform updates and build wrapper modernizations.

…tionStyle`

BREAKING CHANGE: No more `NitroInAppBrowserPresentationStyle` enum import required. Use string literals directly for presentation types.
@patrickkabwe patrickkabwe self-assigned this Aug 17, 2025
@coderabbitai

coderabbitai Bot commented Aug 17, 2025

Copy link
Copy Markdown

Walkthrough

Replace presentationStyle enum with string-literal union, update example app imports/safe-area handling and dependency versions, adjust iOS native presentation mapping and error throwing, and add multiple example Android/Gradle and iOS CI/workflow updates.

Changes

Cohort / File(s) Summary
Docs
README.md
Update installation instruction to use react-native-nitro-modules@0.28.0.
Example app (JS)
example/App.tsx, example/package.json, example/.prettierrc.js
Switch NitroInAppBrowser import to default, use presentationStyle: 'fullScreen' (string), wrap App with SafeAreaProvider/SafeAreaView, show errors via Alert.alert, add react-native-safe-area-context, remove two Prettier props, and bump example deps.
Top-level manifests & configs
package.json, example/package.json
Bump react, react-native, react-native-nitro-modules, nitro-codegen and RN tooling/devDependencies; add prettier, eslintIgnore, and react-native-builder-bob config.
Type definitions
src/types.ts
Replace NitroInAppBrowserPresentationStyle enum with a string-literal union and make NitroInAppBrowserOptions.presentationStyle use it.
iOS native
ios/BrowserConfiguration.swift, ios/SafariBrowserPresenter.swift, example/ios/.../Info.plist
Map typed presentationStyle via enum cases to UIModalPresentationStyle (type-safe mapping); change getRootViewController() to throw RuntimeError; set RCTNewArchEnabled = true in example Info.plist.
Android example / Gradle
example/android/*, example/android/gradle/wrapper/..., example/android/gradlew*, example/android/gradle.properties
Update compile/target SDK to 36, buildTools 36.0.0, Kotlin 2.1.20; add edgeToEdgeEnabled property; upgrade Gradle wrapper to 8.14.3; change gradlew invocation to use -jar.
CI / iOS workflow
.github/workflows/ios-build.yml
Add Setup Xcode step and iOS build steps (Ruby setup, xcpretty install, restore/install Pods, Build App) to both build_new and build_old jobs; normalize concurrency indentation.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant JS as Nitro JS
  participant iOS as iOS Native

  App->>JS: open(url, { presentationStyle: "fullScreen" })
  JS->>iOS: open(options with typed presentationStyle)
  iOS->>iOS: map presentationStyle enum -> UIModalPresentationStyle
  iOS->>iOS: create & present SFSafariViewController
  iOS-->>JS: resolve/notify
  JS-->>App: result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

released on @next, released

Poem

I hop through lines and change a type,
From enum burrows to literal light.
FullScreen leaps, the builds run neat,
Gradle hums and Pods all meet.
A rabbit cheers — the example's complete 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/new-nitro

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
README.md (1)

39-46: README usage is out of sync with the new API and includes an async bug.

  • presentationStyle should now use a string literal (e.g. 'fullScreen'), not the old enum.
  • onPress callback uses await but is not async.

Apply this patch to fix the snippet:

-```js
+```tsx
 ...
-        onPress={() => {
+        onPress={async () => {
           try {
             await NitroInAppBrowser.open('https://nowietech.com', {
               barColor: 'purple',
               controlColor: '#000000',
               dismissButtonLabel: 'close',
-              presentationStyle: NitroInAppBrowserPresentationStyle.FullScreen,
+              presentationStyle: 'fullScreen',
             });
           } catch (error) {
             console.error(error);
           }
         }}
ios/SafariBrowserPresenter.swift (1)

75-82: Missing UIKit import (UIApplication usage).

UIApplication resides in UIKit. This will fail to compile without importing UIKit in this file.

Apply:

 import Foundation
 import NitroModules
 import SafariServices
+import UIKit
🧹 Nitpick comments (5)
ios/SafariBrowserPresenter.swift (3)

55-59: Ensure UI dismissal happens on the main thread.

dismiss(animated:) must be called on the main thread. While most call sites dispatch to main, deinit also calls cleanupBrowser() which could execute off-main.

Apply one of the following:

Option A — Dispatch if needed:

 private func cleanupBrowser() {
-    safariVC?.dismiss(animated: true)
-    safariVC = nil
-    isPresenting = false
+    let performCleanup = { [weak self] in
+        self?.safariVC?.dismiss(animated: true)
+        self?.safariVC = nil
+        self?.isPresenting = false
+    }
+    if Thread.isMainThread {
+        performCleanup()
+    } else {
+        DispatchQueue.main.async { performCleanup() }
+    }
 }

Option B — Annotate as main-actor (Swift Concurrency):

-    private func cleanupBrowser() {
+    @MainActor private func cleanupBrowser() {
         safariVC?.dismiss(animated: true)
         safariVC = nil
         isPresenting = false
     }

21-21: Remove unused property currentBrowser.

This property is never read; consider removing to reduce noise.

-    private var currentBrowser: SFSafariViewController? = nil

82-82: Switch to RuntimeError aligns with the rest of the module.

Consistent with other Swift files using RuntimeError.error(withMessage:). Consider tightening the message slightly.

-            throw RuntimeError.error(withMessage: "Failed to get root view controller getRootViewController(...)")
+            throw RuntimeError.error(withMessage: "Failed to get root view controller (getRootViewController())")
src/types.ts (1)

3-3: Consider exporting constants to reduce typos and aid autocomplete.

Providing named constants helps consumers avoid stringly-typed mistakes while keeping the union type.

Add the following near the type declarations:

export const NitroInAppBrowserPresentationStyles = {
  pageSheet: 'pageSheet',
  formSheet: 'formSheet',
  fullScreen: 'fullScreen',
} as const

Consumers can then use NitroInAppBrowserPresentationStyles.fullScreen while still benefitting from the union type.

ios/BrowserConfiguration.swift (1)

29-35: Optional: Remove the default case to keep the switch exhaustive.

Guarding nil and omitting default makes the compiler warn if new cases are added upstream, improving forward-compatibility.

Apply:

-    private func configurePresentationStyle(for style: NitroInAppBrowserPresentationStyle?) -> UIModalPresentationStyle {
-        switch style {
-        case .formSheet: return .formSheet
-        case .pageSheet: return .pageSheet
-        case .fullScreen: return .fullScreen
-        default: return .automatic
-        }
-    }
+    private func configurePresentationStyle(for style: NitroInAppBrowserPresentationStyle?) -> UIModalPresentationStyle {
+        guard let style = style else { return .automatic }
+        switch style {
+        case .formSheet: return .formSheet
+        case .pageSheet: return .pageSheet
+        case .fullScreen: return .fullScreen
+        }
+    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 52f3bbc and 5508dd5.

⛔ Files ignored due to path filters (27)
  • bun.lock is excluded by !**/*.lock
  • example/ios/Podfile.lock is excluded by !**/*.lock
  • nitrogen/generated/android/NitroInAppBrowserOnLoad.cpp is excluded by !**/generated/**
  • nitrogen/generated/android/c++/JHybridNitroInAppBrowserSpec.cpp is excluded by !**/generated/**
  • nitrogen/generated/android/c++/JHybridNitroInAppBrowserSpec.hpp is excluded by !**/generated/**
  • nitrogen/generated/android/c++/JNitroInAppBrowserDismissButtonLabel.hpp is excluded by !**/generated/**
  • nitrogen/generated/android/c++/JNitroInAppBrowserOptions.hpp is excluded by !**/generated/**
  • nitrogen/generated/android/c++/JNitroInAppBrowserPresentationStyle.hpp is excluded by !**/generated/**
  • nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinappbrowser/NitroInAppBrowserDismissButtonLabel.kt is excluded by !**/generated/**
  • nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinappbrowser/NitroInAppBrowserOptions.kt is excluded by !**/generated/**
  • nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinappbrowser/NitroInAppBrowserPresentationStyle.kt is excluded by !**/generated/**
  • nitrogen/generated/ios/NitroInAppBrowser-Swift-Cxx-Bridge.cpp is excluded by !**/generated/**
  • nitrogen/generated/ios/NitroInAppBrowser-Swift-Cxx-Bridge.hpp is excluded by !**/generated/**
  • nitrogen/generated/ios/NitroInAppBrowser-Swift-Cxx-Umbrella.hpp is excluded by !**/generated/**
  • nitrogen/generated/ios/NitroInAppBrowserAutolinking.mm is excluded by !**/generated/**
  • nitrogen/generated/ios/NitroInAppBrowserAutolinking.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/c++/HybridNitroInAppBrowserSpecSwift.hpp is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/Func_void.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/HybridNitroInAppBrowserSpec.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/HybridNitroInAppBrowserSpec_cxx.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/NitroInAppBrowserOptions.swift is excluded by !**/generated/**
  • nitrogen/generated/ios/swift/NitroInAppBrowserPresentationStyle.swift is excluded by !**/generated/**
  • nitrogen/generated/shared/c++/HybridNitroInAppBrowserSpec.hpp is excluded by !**/generated/**
  • nitrogen/generated/shared/c++/NitroInAppBrowserDismissButtonLabel.hpp is excluded by !**/generated/**
  • nitrogen/generated/shared/c++/NitroInAppBrowserOptions.hpp is excluded by !**/generated/**
  • nitrogen/generated/shared/c++/NitroInAppBrowserPresentationStyle.hpp is excluded by !**/generated/**
📒 Files selected for processing (7)
  • README.md (1 hunks)
  • example/App.tsx (1 hunks)
  • example/package.json (1 hunks)
  • ios/BrowserConfiguration.swift (1 hunks)
  • ios/SafariBrowserPresenter.swift (1 hunks)
  • package.json (1 hunks)
  • src/types.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
example/App.tsx (2)
src/specs/nitro-in-app-browser.nitro.ts (1)
  • NitroInAppBrowser (3-7)
ios/HybridNitroInAppBrowser.swift (1)
  • HybridNitroInAppBrowser (11-40)
ios/SafariBrowserPresenter.swift (2)
nitrogen/generated/ios/NitroInAppBrowser-Swift-Cxx-Bridge.hpp (2)
  • error (89-91)
  • error (89-89)
ios/HybridNitroInAppBrowser.swift (1)
  • HybridNitroInAppBrowser (11-40)
src/types.ts (2)
src/specs/nitro-in-app-browser.nitro.ts (1)
  • NitroInAppBrowser (3-7)
ios/HybridNitroInAppBrowser.swift (1)
  • HybridNitroInAppBrowser (11-40)
ios/BrowserConfiguration.swift (1)
ios/HybridNitroInAppBrowser.swift (2)
  • HybridNitroInAppBrowser (11-40)
  • open (14-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build iOS Example App (old architecture)
  • GitHub Check: Build iOS Example App (new architecture)
  • GitHub Check: Build Android Example App (old architecture)
  • GitHub Check: Build Android Example App (new architecture)
🔇 Additional comments (8)
README.md (1)

21-24: ✅ Update installation snippet to use a caret range (no stale references found)

  • Changed the pinned react-native-nitro-modules@0.28.0 to a caret range so users automatically receive patch updates:

    - bun install react-native-nitro-in-app-browser react-native-nitro-modules@0.28.0
    + bun install react-native-nitro-in-app-browser react-native-nitro-modules@^0.28.0
  • Verified README.md, package.json, and example/package.json—no lingering references to 0.26.x or 0.27.x.

example/package.json (1)

16-16: Version bump to ^0.28.0 looks good.

Example app now aligns with the README and root devDependencies.

package.json (2)

67-67: react-native-nitro-modules devDependency bump is consistent across workspace.

Matches example and README. No action needed.


63-63: Regenerate and commit updated Nitro bindings

Please run the codegen script and ensure all generated sources reflect the v0.28.0 bump:

• Execute:

bun run codegen

(this runs nitro-codegen --logLevel="debug" && bun run build && node post-script.js)
• Review & stage all modified files under:

  • nitrogen/generated/**
  • ios/HybridNitroInAppBrowser.swift
  • any shared/generated or android artifacts
    • Commit the resulting diffs so the repo stays in sync with the new codegen version.
src/types.ts (1)

3-9: Enum → string union migration looks correct.

Types align with iOS mapping and example usage; good move for tree-shaking and DX.

example/App.tsx (1)

18-18: Migration to string-literal "fullScreen" looks correct.

This aligns with the updated NitroInAppBrowserPresentationStyle union type and the iOS bridge mapping. No issues spotted.

ios/BrowserConfiguration.swift (2)

29-29: Good move to a typed enum for presentationStyle.

Switching from String? to NitroInAppBrowserPresentationStyle? improves type-safety and prevents invalid values from slipping through.


31-33: Incorrect enum case names concern — resolved
The generated NitroInAppBrowserPresentationStyle enum actually declares its cases as .formsheet, .pagesheet, and .fullscreen (see lines 36, 38, and 40 in nitrogen/generated/ios/swift/NitroInAppBrowserPresentationStyle.swift), so BrowserConfiguration.swift is already using the correct cases and no changes are required.

Likely an incorrect or invalid review comment.

Comment thread src/types.ts
Comment on lines +3 to +9
export type NitroInAppBrowserPresentationStyle = 'pageSheet' | 'formSheet' | 'fullScreen'

export interface NitroInAppBrowserOptions {
dismissButtonLabel?: NitroInAppBrowserDismissButtonLabel
presentationStyle?: string // NitroInAppBrowserPresentationStyle
barColor?: string
controlColor?: string
dismissButtonLabel?: NitroInAppBrowserDismissButtonLabel
presentationStyle?: NitroInAppBrowserPresentationStyle
barColor?: string
controlColor?: string

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify there are no remaining references to the old enum members.

Ensure code/docs don’t use NitroInAppBrowserPresentationStyle.FullScreen, etc.


🏁 Script executed:

#!/bin/bash
# Find lingering enum-style references and non-literal usage
rg -n -C2 -P '\bNitroInAppBrowserPresentationStyle\.\w+\b|presentationStyle:\s*NitroInAppBrowserPresentationStyle\.' \
  --ignore-file .gitignore
# Also list presentationStyle assignments for manual scan
rg -n -C2 -P '\bpresentationStyle\s*:\s*[^\'"]' --type=ts --type=tsx

Length of output: 5619


Update lingering enum reference in README.md

A stray usage of the old enum member remains in the docs. Please replace it with the corresponding string literal.

• README.md (line 44)

- presentationStyle: NitroInAppBrowserPresentationStyle.FullScreen,
+ presentationStyle: 'fullScreen',

No other .FullScreen/.pageSheet/.formSheet references were found in your TS/TSX files.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
README.md around line 44: the docs still reference the old enum member (e.g.,
.FullScreen) which no longer exists; update that stray reference to the matching
string literal from src/types.ts (use 'fullScreen' — casing exactly as defined)
so the README uses the current API; search surrounding lines for any other
.pageSheet/.formSheet/.FullScreen-style enum references and replace them with
'pageSheet'/'formSheet'/'fullScreen' respectively.

- Bump React and React Native versions to 19.1.0 and 0.81.0 respectively.
- Update various development dependencies to their latest versions.
- Modify iOS build workflow to include setup for the latest Xcode version.
- Adjust Android build configuration to use updated SDK and build tools.
- Refactor example app to utilize SafeAreaProvider and handle errors with alerts.
- Remove deprecated properties from configuration files.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (10)
example/android/gradle/wrapper/gradle-wrapper.properties (1)

3-3: Pin Gradle wrapper checksum & verify AGP/JDK compatibility

Please complete the following before merging:

  • Confirm your Android Gradle Plugin version (as declared in the buildscript classpath in example/android/build.gradle) is compatible with Gradle 8.14.3.
  • Ensure your JDK meets Gradle 8.14.3’s requirements (JDK 17 or later).
  • Pin the Gradle distribution checksum by updating example/android/gradle/wrapper/gradle-wrapper.properties:
 distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
+distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531

Once AGP/JDK compatibility is confirmed and the checksum is in place, this bump is ready to merge.

example/android/gradlew (1)

117-117: Wrapper script updated to -jar invocation — LGTM; keep wrapper files generated, not hand-edited

The empty CLASSPATH + -jar pattern is the current Gradle wrapper behavior. Recommend continuing to regenerate via gradle wrapper to avoid drift and ensure wrapper JAR/properties stay in sync across updates.

Also applies to: 216-217

example/android/gradle.properties (1)

41-44: edgeToEdgeEnabled is declarative only here — verify it’s actually consumed

This Gradle property won’t have any effect unless your Activity opts in. If you intend to support edge-to-edge on the example app, wire it up (ReactActivity + WindowCompat).

To implement, in your MainActivity:

import androidx.core.view.WindowCompat

class MainActivity : ReactActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    if (BuildConfig.EDGE_TO_EDGE_ENABLED) {
      WindowCompat.setDecorFitsSystemWindows(window, false)
    }
  }
}

And surface the Gradle property to BuildConfig (in example/android/app/build.gradle):

  • buildConfigField("boolean", "EDGE_TO_EDGE_ENABLED", project.findProperty("edgeToEdgeEnabled")?.toString()?.toBoolean()?.toString() ?: "false")
    Or alternatively read the Gradle property at runtime and branch accordingly.

If you already handle this elsewhere, ignore.

.github/workflows/ios-build.yml (1)

52-56: Pin Xcode instead of latest-stable to reduce CI flakiness

latest-stable can lead to surprise simulator/name changes (e.g., device identifiers), breaking builds unexpectedly. Prefer a pinned major.minor and bump deliberately.

Apply:

-      - name: Setup Xcode
-        uses: maxim-lobanov/setup-xcode@v1
-        with:
-          xcode-version: latest-stable
+      - name: Setup Xcode
+        uses: maxim-lobanov/setup-xcode@v1
+        with:
+          # Pin to a known-good version; update intentionally as needed
+          xcode-version: "16.2"

If you want flexibility, consider a matrix or a repository env var to centralize the version.

example/android/gradlew.bat (1)

73-77: Drop redundant classpath when using -jar

When invoking Java with -jar, -classpath is ignored. Keeping an empty CLASSPATH and passing -classpath is unnecessary and slightly noisy.

Apply this diff:

-@rem Setup the command line
-
-set CLASSPATH=
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
example/App.tsx (2)

19-25: Defensively normalize error messages before Alert

Casting to Error can yield undefined messages if a non-Error is thrown. Normalize to string to avoid empty alerts.

Apply this diff:

-          } catch (error) {
-            Alert.alert('Error', (error as Error).message, [
+          } catch (error) {
+            const message =
+              error instanceof Error ? error.message : String(error)
+            Alert.alert('Error', message, [

14-14: Prefer hex colors for cross-platform consistency

Named colors aren’t uniformly supported across platforms. Hex avoids platform parsing differences.

Apply this diff:

-              barColor: 'purple',
+              barColor: '#800080',
package.json (2)

56-70: Consider updating TypeScript to align with React 19/RN 0.81 toolchains

TS 5.0.4 may be fine, but React 19 and RN 0.81 ecosystems commonly target newer 5.x. Bumping reduces type-compat friction.

Example change:

-        "typescript": "5.0.4"
+        "typescript": "5.4.5"

Please pick the version your CI/tooling supports.


71-75: Tighten peerDependency ranges for clearer compatibility guarantees

Using "*" makes consumers resolve potentially incompatible versions. Consider semver ranges aligned with what you test against.

Example:

-    "peerDependencies": {
-        "react": "*",
-        "react-native": "*",
-        "react-native-nitro-modules": "*"
-    },
+    "peerDependencies": {
+        "react": ">=18.2 <21",
+        "react-native": ">=0.72 <1",
+        "react-native-nitro-modules": ">=0.28 <1"
+    },

Adjust as appropriate for your supported matrix.

example/package.json (1)

7-8: Avoid hard-coding a specific Simulator model

‘iPhone 16’ may not exist on all machines. Prefer omitting the simulator flag or making it configurable.

Example:

-        "ios": "react-native run-ios --simulator='iPhone 16'",
+        "ios": "react-native run-ios",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5508dd5 and 1a4751a.

⛔ Files ignored due to path filters (3)
  • bun.lock is excluded by !**/*.lock
  • example/android/gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
  • example/ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • .github/workflows/ios-build.yml (3 hunks)
  • example/.prettierrc.js (0 hunks)
  • example/App.tsx (2 hunks)
  • example/android/app/src/main/java/com/nitroinappbrowserexample/MainApplication.kt (2 hunks)
  • example/android/build.gradle (1 hunks)
  • example/android/gradle.properties (1 hunks)
  • example/android/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • example/android/gradlew (2 hunks)
  • example/android/gradlew.bat (1 hunks)
  • example/ios/NitroInAppBrowserExample/Info.plist (1 hunks)
  • example/package.json (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • example/.prettierrc.js
🧰 Additional context used
🧬 Code Graph Analysis (3)
example/ios/NitroInAppBrowserExample/Info.plist (1)
example/ios/NitroInAppBrowserExample/AppDelegate.swift (3)
  • AppDelegate (6-34)
  • ReactNativeDelegate (36-48)
  • application (13-33)
example/android/app/src/main/java/com/nitroinappbrowserexample/MainApplication.kt (1)
example/ios/NitroInAppBrowserExample/AppDelegate.swift (2)
  • application (13-33)
  • AppDelegate (6-34)
example/App.tsx (3)
ios/HybridNitroInAppBrowser.swift (1)
  • HybridNitroInAppBrowser (11-40)
src/specs/nitro-in-app-browser.nitro.ts (1)
  • NitroInAppBrowser (3-7)
src/types.ts (1)
  • NitroInAppBrowserOptions (9-14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build iOS Example App (new architecture)
  • GitHub Check: Build Android Example App (new architecture)
  • GitHub Check: Build Android Example App (old architecture)
🔇 Additional comments (10)
example/ios/NitroInAppBrowserExample/Info.plist (1)

36-37: LGTM: Enabling the New Architecture (RCTNewArchEnabled) for the example app

This aligns with the ReactNativeFactory-based setup seen in AppDelegate.swift. The placement and value look correct.

example/android/app/src/main/java/com/nitroinappbrowserexample/MainApplication.kt (1)

9-9: Modern RN entrypoint (loadReactNative) adoption looks good

Switching to ReactNativeApplicationEntryPoint.loadReactNative and using getDefaultReactHost is aligned with current RN templates; no SoLoader/init boilerplate needed.

Also applies to: 38-39

.github/workflows/ios-build.yml (2)

41-43: Concurrency block reformat — LGTM

No semantic change; keeps the workflow’s run deduplication behavior intact.


141-141: No-op formatting change — OK to keep

End-of-line/formatting normalization; no functional impact.

example/android/build.gradle (2)

3-9: API 36/Kotlin 2.1.20 bump looks aligned with RN 0.81

The SDK/Tools bumps are consistent with the rest of the PR and modern RN requirements.


3-9: Confirm AGP/Kotlin/JDK/SDK compatibility on CI

I’ve checked the project setup and found:

  • Gradle wrapper is pinned to 8.14.3 (distributionUrl).
  • ext.kotlinVersion is set to 2.1.20 and the Kotlin Gradle plugin is applied.
  • No explicit Java toolchain is configured; default sourceCompatibility/targetCompatibility remain at Java 1.8.
  • No references to JDK 17+ enforcement in any Gradle file.

Please verify the following on your CI environment:

  • The Android Gradle Plugin version you’re using supports Kotlin 2.1.20.
  • CI is running with JDK 17 or newer (otherwise the Kotlin plugin may fail).
  • Android SDK Platform 36 and Build-Tools 36.0.0 are installed and available to Gradle.
example/App.tsx (2)

6-39: Nice switch to string-literal presentationStyle + Safe Area adoption

Default import usage and SafeAreaProvider/SafeAreaView integration look good and align with the new types and example dependency updates.


3-4: Default export and presentationStyle type verified

Both checks passed:

  • src/index.ts exports NitroInAppBrowser as the default.
  • NitroInAppBrowserPresentationStyle is defined as the expected string-literal union.

No changes needed.

package.json (1)

14-16: Scripts depend on Bun; make it explicit or provide a Node fallback

Build and codegen use bun. Either:

  • declare the package manager to ensure CI/devs have bun, or
  • make scripts PM-agnostic (e.g., “npm run build”).

If you prefer bun, consider adding to package.json (adjust version to what CI uses):

"packageManager": "bun@1.1.x"

Alternatively, replace:

  • "bun run typecheck && bob build" with "npm run typecheck && bob build"
  • In "codegen", "bun run build" with "npm run build"
example/package.json (1)

14-18: Example deps bump looks good

react/react-native/nitro-modules upgrades and safe-area-context addition align with the App changes.

Comment on lines +36 to +37
<key>RCTNewArchEnabled</key>
<true/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify Podfile/xcconfig alignment with this runtime flag

Ensure your build settings also enable the New Architecture (e.g., Podfile new_arch_enabled, relevant xcconfig macros). A mismatch between runtime flag and build-time settings can lead to unexpected behavior.

Run this script to check for consistency:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for the Info.plist flag:"
rg -n -C1 -S 'RCTNewArchEnabled' || true

echo ""
echo "Checking Podfile(s) for New Architecture settings:"
fd -a 'Podfile' | while read -r pod; do
  echo "---- $pod ----"
  rg -n -C2 -P 'use_react_native|new_arch_enabled|fabric_enabled|hermes_enabled' "$pod" || true
done

echo ""
echo "Scanning xcconfig files for related macros:"
fd -a '.xcconfig' | xargs -r rg -n -C1 -P 'RCT_NEW_ARCH_ENABLED|USE_HERMES|HERMES' || true

echo ""
echo "Swift usage of ReactNativeFactory (context only):"
rg -n -C3 -S 'ReactNativeDelegate|RCTReactNativeFactory|newArch' --type=swift || true

Length of output: 3517


Enable New Architecture in build configuration

You’ve set <key>RCTNewArchEnabled</key><true/> in Info.plist, but your Podfile and build‐time macros aren’t aligned. A mismatch can lead to runtime failures when the new architecture is instantiated. Please update as follows:

  • In example/ios/Podfile, modify the use_react_native! call to include
    :new_arch_enabled => true (and :fabric_enabled => true if you’re using Fabric).
  • No .xcconfig in your project defines RCT_NEW_ARCH_ENABLED. If you use Xcode config files (e.g. Debug.xcconfig/Release.xcconfig), add
    RCT_NEW_ARCH_ENABLED = 1
    Otherwise, set RCT_NEW_ARCH_ENABLED as a User‐Defined Setting in your Xcode target.

Aligning these ensures your runtime flag and build‐time settings match.

🤖 Prompt for AI Agents
In example/ios/NitroInAppBrowserExample/Info.plist around lines 36-37 the
RCTNewArchEnabled flag is set to true but your build settings aren’t aligned;
update example/ios/Podfile to call use_react_native! with :new_arch_enabled =>
true (and add :fabric_enabled => true if using Fabric), and ensure
RCT_NEW_ARCH_ENABLED is defined at build time by adding RCT_NEW_ARCH_ENABLED = 1
to your Xcode config files (Debug.xcconfig/Release.xcconfig) or by adding
RCT_NEW_ARCH_ENABLED as a User-Defined Setting on the Xcode target so runtime
and build-time flags match.

Comment thread package.json
Comment on lines +10 to +17
"scripts": {
"typecheck": "tsc --noEmit",
"clean": "git clean -dfX",
"release": "semantic-release",
"build": "bun run typecheck && bob build",
"codegen": "nitro-codegen --logLevel=\"debug\" && bun run build && node post-script.js",
"postcodegen": "bun --cwd example pod"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

postcodegen script is broken (incorrect bun usage)

bun requires “run” to execute a package script; “bun --cwd example pod” will attempt to run a file named “pod”, not the example’s script.

Apply one of these fixes (pick one):

Option A: Use npm to avoid bun-specific flags:

-        "postcodegen": "bun --cwd example pod"
+        "postcodegen": "npm run --prefix example pod"

Option B: Keep bun, but use the correct form:

-        "postcodegen": "bun --cwd example pod"
+        "postcodegen": "bun --cwd example run pod"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"scripts": {
"typecheck": "tsc --noEmit",
"clean": "git clean -dfX",
"release": "semantic-release",
"build": "bun run typecheck && bob build",
"codegen": "nitro-codegen --logLevel=\"debug\" && bun run build && node post-script.js",
"postcodegen": "bun --cwd example pod"
},
"scripts": {
"typecheck": "tsc --noEmit",
"clean": "git clean -dfX",
"release": "semantic-release",
"build": "bun run typecheck && bob build",
"codegen": "nitro-codegen --logLevel=\"debug\" && bun run build && node post-script.js",
"postcodegen": "bun --cwd example run pod"
},
🤖 Prompt for AI Agents
In package.json around lines 10 to 17, the "postcodegen" script uses incorrect
bun invocation ("bun --cwd example pod") which makes bun try to execute a file
named "pod"; change it to use bun's run form by invoking the script in the
example package: update the script to call bun with the cwd flag and the run
subcommand (e.g., bun --cwd example run pod) so the example package's "pod"
script is executed correctly.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/ios-build.yml (1)

52-56: Ensure simulator availability matches Xcode 16.4; consider adding a quick diagnostics step.

Good call explicitly selecting Xcode 16.4. The Build App step targets destination name "iPhone 16"; ensure this device type is available on the macOS-15 image for the selected Xcode. If it's missing, xcodebuild will fail early.

Optional hardening:

  • Add a pre-build diagnostics step to list available simulators to aid debugging.
  • If flakiness occurs, consider switching to a more generic destination constraint (e.g., OS=latest) or a widely-available device name on the chosen image.

Example diagnostic step you can insert after Setup Xcode:

- name: List available simulators
  run: |
    xcodebuild -version
    xcrun simctl list devices available

Also, consider pinning the action to a specific commit SHA for supply-chain safety.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4751a and 2e32094.

📒 Files selected for processing (1)
  • .github/workflows/ios-build.yml (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Android Example App (old architecture)
  • GitHub Check: Build Android Example App (new architecture)
  • GitHub Check: Build iOS Example App (new architecture)
🔇 Additional comments (2)
.github/workflows/ios-build.yml (2)

41-42: Concurrency keying LGTM; will prevent duplicate runs per ref.

Using group "${{ github.workflow }}-${{ github.ref }}" with cancel-in-progress: true is a solid choice to cancel stale runs per branch/PR.


141-141: No-op formatting change is fine.

Trailing newline/format normalization is harmless.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/ios-build.yml (2)

52-56: Pin Xcode to a concrete version to avoid CI flakiness

Using latest-stable can break builds when Apple releases a new Xcode. Pin to a tested major/minor and update deliberately.

Apply this diff to pin Xcode:

-      - name: Setup Xcode
-        uses: maxim-lobanov/setup-xcode@v1
-        with:
-          xcode-version: latest-stable
+      - name: Setup Xcode
+        uses: maxim-lobanov/setup-xcode@v1
+        with:
+          xcode-version: '16.4' # or your validated version

Additionally, consider making the Simulator destination resilient across Xcode updates by specifying OS=latest (outside this hunk):

-          -destination 'platform=iOS Simulator,name=iPhone 16' \
+          -destination 'platform=iOS Simulator,OS=latest,name=iPhone 16' \

103-107: Repeat: Pin Xcode version in old-arch job for consistency

Same concern as the new-arch job—pin Xcode here too.

-      - name: Setup Xcode
-        uses: maxim-lobanov/setup-xcode@v1
-        with:
-          xcode-version: latest-stable
+      - name: Setup Xcode
+        uses: maxim-lobanov/setup-xcode@v1
+        with:
+          xcode-version: '16.4'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2e32094 and f0582c9.

📒 Files selected for processing (1)
  • .github/workflows/ios-build.yml (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build iOS Example App (old architecture)
  • GitHub Check: Build iOS Example App (new architecture)
  • GitHub Check: Build Android Example App (old architecture)
  • GitHub Check: Build Android Example App (new architecture)
🔇 Additional comments (2)
.github/workflows/ios-build.yml (2)

41-43: Concurrency settings look good

Group and cancel-in-progress are correctly configured to avoid duplicate runs per ref.


146-146: No-op change acknowledged

Trailing newline/formatting only; no behavioral impact on the build step.

Comment on lines +52 to +56
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Bundler cache misconfigured: working-directory is ignored by ruby/setup-ruby

The working-directory key in a uses: step isn’t a valid input for ruby/setup-ruby and will be ignored. As a result, bundler-cache runs at repo root and may miss example/ios/Gemfile, leading to non-deterministic Cocoapods usage.

Recommended fix (outside this hunk): point Bundler to the example Gemfile via BUNDLE_GEMFILE and use bundle exec for pod install to honor the locked versions.

- name: Setup Ruby (bundle)
  uses: ruby/setup-ruby@v1
  with:
    ruby-version: 2.7.2
    bundler-cache: true
  env:
    BUNDLE_GEMFILE: example/ios/Gemfile

- name: Install Pods
  working-directory: example/ios
  run: bundle exec pod install

Optional: consider upgrading Ruby to a supported version (e.g., 3.2+) if your Gemfile allows it, as 2.7 is EOL.

🤖 Prompt for AI Agents
.github/workflows/ios-build.yml around lines 52-56: the workflow currently uses
ruby/setup-ruby with a working-directory input (which is ignored) causing the
bundler-cache to run at repo root and miss example/ios/Gemfile; update the
workflow by adding a ruby/setup-ruby step that enables bundler-cache and sets
the environment variable BUNDLE_GEMFILE to point to example/ios/Gemfile (do not
rely on working-directory for that action), and change the pod install step to
run inside example/ios using "bundle exec pod install" so Bundler honors the
locked Gemfile; optionally consider updating the ruby-version to a supported
release if your Gemfile allows it.

Comment on lines +103 to +107
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Repeat: Fix bundler-cache scoping to example/ios

As above, the working-directory input is ignored in uses:. Use BUNDLE_GEMFILE and bundle exec to ensure the correct Cocoapods version is used under the example app’s Gemfile.

- name: Setup Ruby (bundle)
  uses: ruby/setup-ruby@v1
  with:
    ruby-version: 2.7.2
    bundler-cache: true
  env:
    BUNDLE_GEMFILE: example/ios/Gemfile

- name: Install Pods
  working-directory: example/ios
  run: bundle exec pod install
🤖 Prompt for AI Agents
In .github/workflows/ios-build.yml around lines 103-107, the bundler-cache
scoping is incorrect because working-directory is ignored for uses:, so set
BUNDLE_GEMFILE to point at example/ios/Gemfile on the ruby/setup-ruby step (keep
bundler-cache: true) and then run pod install via bundle exec in the example/ios
directory; specifically, add env: BUNDLE_GEMFILE: example/ios/Gemfile to the
ruby/setup-ruby step and replace the direct pod install with a step that runs
bundle exec pod install with working-directory: example/ios so the correct
Cocoapods version from the example app’s Gemfile is used.

@patrickkabwe patrickkabwe merged commit 64e4281 into main Aug 17, 2025
6 of 7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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