Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ env:
USE_CCACHE: 1

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_new:
name: Build iOS Example App (new architecture)
Expand All @@ -49,6 +49,11 @@ jobs:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Comment on lines +52 to +56

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.

- name: Install npm dependencies (bun)
run: bun install

Expand Down Expand Up @@ -95,6 +100,11 @@ jobs:
- name: Install npm dependencies (bun)
run: bun install

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Comment on lines +103 to +107

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.

- name: Disable new architecture in Podfile
run: sed -i "" "s/ENV\['RCT_NEW_ARCH_ENABLED'\] = '1'/ENV['RCT_NEW_ARCH_ENABLED'] = '0'/g" example/ios/Podfile

Expand Down Expand Up @@ -133,4 +143,4 @@ jobs:
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 16' \
build \
CODE_SIGNING_ALLOWED=NO | xcpretty"
CODE_SIGNING_ALLOWED=NO | xcpretty"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A Simple React Native Nitro module for in-app browser.


```sh
bun install react-native-nitro-in-app-browser react-native-nitro-modules@0.26.3
bun install react-native-nitro-in-app-browser react-native-nitro-modules@0.28.0
cd ios && pod install && cd ..
```

Expand Down
292 changes: 185 additions & 107 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
26 changes: 19 additions & 7 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import {Button, SafeAreaView, StyleSheet} from 'react-native';
import NitroInAppBrowser, {
NitroInAppBrowserPresentationStyle,
} from 'react-native-nitro-in-app-browser';
import {Alert, Button, StyleSheet} from 'react-native';
import NitroInAppBrowser from 'react-native-nitro-in-app-browser';
import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context';

const App = () => {
const AppWrapper = () => {
return (
<SafeAreaView style={styles.container}>
<Button
Expand All @@ -15,17 +14,30 @@ const App = () => {
barColor: 'purple',
controlColor: '#000000',
dismissButtonLabel: 'close',
presentationStyle: NitroInAppBrowserPresentationStyle.FullScreen,
presentationStyle: 'fullScreen',
});
} catch (error) {
console.error(error);
Alert.alert('Error', (error as Error).message, [
{
text: 'OK',
onPress: () => {},
},
]);
}
}}
/>
</SafeAreaView>
);
};

const App = () => {
return (
<SafeAreaProvider>
<AppWrapper />
</SafeAreaProvider>
);
};

export default App;

const styles = StyleSheet.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader



class MainApplication : Application(), ReactApplication {

Expand All @@ -35,10 +35,6 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
loadReactNative(this)
}
}
8 changes: 4 additions & 4 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
ext {
buildToolsVersion = "35.0.0"
buildToolsVersion = "36.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 35
compileSdkVersion = 36
targetSdkVersion = 36
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
kotlinVersion = "2.1.20"
}
repositories {
google()
Expand Down
5 changes: 5 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ newArchEnabled=true
# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true

# Use this property to enable edge-to-edge display support.
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.
edgeToEdgeEnabled=false
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions example/android/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/android/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion example/ios/NitroInAppBrowserExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>RCTNewArchEnabled</key>
<true/>
Comment on lines +36 to +37

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.

<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
Loading