react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

(RN - 0.80.0) - RNN - 8.1.0 - Fixes (Android + iOS)

Open manoj-mehra-spraxa opened this issue 6 months ago • 33 comments

What happened?

(RN - 0.80.0) - RNN - 8.1.0 - Fixes (Android + iOS)

What was the expected behaviour?

(RN - 0.80.0) - RNN - 8.1.0 - Fixes (Android + iOS)

Was it tested on latest react-native-navigation?

  • [x] I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

(RN - 0.80.0) - RNN - 8.1.0 - Fixes (Android + iOS)

In what environment did this happen?

React Native Navigation version: : "^8.1.0" React Native version: "0.80.0" Has Fabric (React Native's new rendering system) enabled: (yes/no) y Node version: 20

manoj-mehra-spraxa avatar Jun 27 '25 10:06 manoj-mehra-spraxa

options/params/ColorParser.kt

package com.reactnativenavigation.options.parsers
import android.content.Context
import com.facebook.react.bridge.ColorPropConverter
import com.reactnativenavigation.options.params.Colour
import com.reactnativenavigation.options.params.DontApplyColour
import com.reactnativenavigation.options.params.NullColor
import com.reactnativenavigation.options.params.ReactPlatformColor
import org.json.JSONObject

object ColorParser {
    private const val KEY_RESOURCE_PATHS = "resource_paths"
    private const val VAL_NO_COLOR = "NoColor"

    @JvmStatic
    fun parse(context: Context?, json: JSONObject, colorName: String?): Colour {
        if (json.has(KEY_RESOURCE_PATHS)) {
            return ReactPlatformColor(JSONParser.convert(json))
        }
        return when (val color = json.opt(colorName)) {
            null, VAL_NO_COLOR -> DontApplyColour()
            is Int -> Colour(json.optInt(colorName))
            is JSONObject -> {
                ColorPropConverter.getColor(color, context ?: throw IllegalArgumentException("Context must not be null"))?.let {
                    Colour(it)
                } ?: NullColor()
            }
            else -> NullColor()
        }
    }
}

manoj-mehra-spraxa avatar Jun 27 '25 10:06 manoj-mehra-spraxa

options/params/ReactPlatformColor.kt

package com.reactnativenavigation.options.params

import com.facebook.react.bridge.ColorPropConverter
import com.facebook.react.bridge.ReadableMap
import com.reactnativenavigation.NavigationApplication

private fun parsePlatformColor(paths: ReadableMap): Int {
    return ColorPropConverter.getColor(paths, NavigationApplication.instance) ?: 0 // fallback to black
}

class ReactPlatformColor(private val paths: ReadableMap) :
    Colour(parsePlatformColor(paths)) {

    override fun get(): Int {
        return parsePlatformColor(paths)
    }

    override fun get(defaultValue: Int?): Int {
        return try {
            ColorPropConverter.getColor(paths, NavigationApplication.instance) ?: defaultValue ?: 0
        } catch (e: Exception) {
            defaultValue ?: 0
        }
    }
}

manoj-mehra-spraxa avatar Jun 27 '25 10:06 manoj-mehra-spraxa

react/modal/ModalContentLayout.kt

package com.reactnativenavigation.react.modal

import android.content.Context
import android.view.MotionEvent
import android.view.View
import com.facebook.react.bridge.ReactContext
import com.facebook.react.uimanager.JSTouchDispatcher
import com.facebook.react.uimanager.RootView
import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.react.uimanager.common.UIManagerType
import com.facebook.react.uimanager.events.EventDispatcher
import com.facebook.react.views.view.ReactViewGroup


class ModalContentLayout(context: Context) : ReactViewGroup(context), RootView {

    private val mJSTouchDispatcher = JSTouchDispatcher(this)

    override fun onChildStartedNativeGesture(childView: View?, ev: MotionEvent) {
        mJSTouchDispatcher.onChildStartedNativeGesture(ev, getEventDispatcher())
    }

    override fun onChildEndedNativeGesture(childView: View, ev: MotionEvent) {
        mJSTouchDispatcher.onChildEndedNativeGesture(ev, getEventDispatcher())
    }

    override fun handleException(t: Throwable) {
    getReactContext().handleException(
        if (t is Exception) t else RuntimeException(t)
    )
}

    override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}

    private fun getEventDispatcher(): EventDispatcher {
        val reactContext: ReactContext = getReactContext()
        return UIManagerHelper.getEventDispatcher(reactContext, UIManagerType.FABRIC)
            ?: throw IllegalStateException("EventDispatcher for Fabric UI Manager is not found")
    }

    private fun getReactContext(): ReactContext {
        return this.context as ReactContext
    }

    override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
        mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
        return super.onInterceptTouchEvent(event)
    }

    override fun onTouchEvent(event: MotionEvent): Boolean {
        mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
        super.onTouchEvent(event)
        return true
    }
}

manoj-mehra-spraxa avatar Jun 27 '25 10:06 manoj-mehra-spraxa

iOS Fixes also available if you need comment here

manoj-mehra-spraxa avatar Jun 27 '25 10:06 manoj-mehra-spraxa

@manojmehra-spraxa would love to see the ios fix if you have one!

kamiranoff avatar Jun 27 '25 18:06 kamiranoff

iOS Fixes also available if you need comment here

Thanks a lot for that. Yes the iOS fixes would help a lot ! :)

apponthebeach avatar Jul 02 '25 08:07 apponthebeach

react-native-navigation/lib/ios/RNNAppDelegate.mm

#import "RNNAppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import "RCTAppSetupUtils.h"
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTImageLoader.h>
#import <React/RCTBridgeProxy.h>
#import <react/utils/ManagedObjectWrapper.h>
// NOTE: Removed the problematic import
// #import <react/config/ReactNativeConfig.h>

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

@interface RNNAppDelegate () <RCTTurboModuleManagerDelegate> {}
@end

@implementation RNNAppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    RCTAppSetupPrepareApp(application, self.newArchEnabled);
    RCTSetNewArchEnabled(TRUE);
    RCTEnableTurboModuleInterop(YES);
    RCTEnableTurboModuleInteropBridgeProxy(YES);

    // Create RCTRootViewFactory inline
    RCTRootViewFactory *factory = [self createRCTRootViewFactory];
    

    return YES;
}

- (RCTRootViewFactory *)createRCTRootViewFactory
{
  __weak __typeof(self) weakSelf = self;
  RCTBundleURLBlock bundleUrlBlock = ^{
    RCTAppDelegate *strongSelf = weakSelf;
    return strongSelf.bundleURL;
  };

  RCTRootViewFactoryConfiguration *configuration =
      [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
                                                       newArchEnabled:self.newArchEnabled];

  return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
}

#pragma mark RCTTurboModuleManagerDelegate

- (Class)getModuleClassFromName:(const char *)name {
    return RCTCoreModulesClassProvider(name);
}

- (std::shared_ptr<facebook::react::TurboModule>)
    getTurboModule:(const std::string &)name
         jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker {
    return nullptr;
}

- (std::shared_ptr<facebook::react::TurboModule>)
    getTurboModule:(const std::string &)name
        initParams:(const facebook::react::ObjCTurboModule::InitParams &)params {
    return nullptr;
}

- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass {
    return RCTAppSetupDefaultModuleFromClass(moduleClass, self.dependencyProvider);
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
    [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
                format:@"Subclasses must implement a valid sourceURLForBridge method"];
    return nil;
}

- (BOOL)concurrentRootEnabled {
    return true;
}

@end

manoj-mehra-spraxa avatar Jul 02 '25 10:07 manoj-mehra-spraxa

in podfile add this lines

RCT_NEW_ARCH_ENABLED=1

pod 'ReactNativeNavigation', :path => '../node_modules/react-native-navigation'

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!
RCT_NEW_ARCH_ENABLED=1
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'SampleProject' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

pod 'ReactNativeNavigation', :path => '../node_modules/react-native-navigation'

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

manoj-mehra-spraxa avatar Jul 02 '25 10:07 manoj-mehra-spraxa

@apponthebeach , @kamiranoff iOS fixes are available now check now

manoj-mehra-spraxa avatar Jul 02 '25 10:07 manoj-mehra-spraxa

@apponthebeach , @kamiranoff iOS fixes are available now check now

Haven't tried yet, but thank you very much for taking the time!

kamiranoff avatar Jul 02 '25 12:07 kamiranoff

@manojmehra-spraxa thanks for that. I try a bit during lunch break, but still have the "No such module 'ReactNativeNavigation'" error for iOS. I will take a better look after my day of work

apponthebeach avatar Jul 02 '25 12:07 apponthebeach

can you provide some files like podfile , etc and did you change the RNNAppDelegate.mm file inside node module !

manoj-mehra-spraxa avatar Jul 02 '25 13:07 manoj-mehra-spraxa

can you provide some files like podfile , etc and did you change the RNNAppDelegate.mm file inside node module !

Hey @manojmehra-spraxa

Thanks to take some time following my reply

I create a project from scratch to test your fixes.

Here is my podfile

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!
RCT_NEW_ARCH_ENABLED=1

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'project_rnn' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  pod 'ReactNativeNavigation', :path => '../node_modules/react-native-navigation'
  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

here is my node_modules/react-native-navigation/lib/iOS/RNNAppDelegate.mm

#import "RNNAppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import "RCTAppSetupUtils.h"
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTImageLoader.h>
#import <React/RCTBridgeProxy.h>
#import <react/utils/ManagedObjectWrapper.h>
// NOTE: Removed the problematic import
// #import <react/config/ReactNativeConfig.h>

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

@interface RNNAppDelegate () <RCTTurboModuleManagerDelegate> {}
@end

@implementation RNNAppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    RCTAppSetupPrepareApp(application, self.newArchEnabled);
    RCTSetNewArchEnabled(TRUE);
    RCTEnableTurboModuleInterop(YES);
    RCTEnableTurboModuleInteropBridgeProxy(YES);

    // Create RCTRootViewFactory inline
    RCTRootViewFactory *factory = [self createRCTRootViewFactory];
    

    return YES;
}

- (RCTRootViewFactory *)createRCTRootViewFactory
{
  __weak __typeof(self) weakSelf = self;
  RCTBundleURLBlock bundleUrlBlock = ^{
    RCTAppDelegate *strongSelf = weakSelf;
    return strongSelf.bundleURL;
  };

  RCTRootViewFactoryConfiguration *configuration =
      [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
                                                       newArchEnabled:self.newArchEnabled];

  return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
}

#pragma mark RCTTurboModuleManagerDelegate

- (Class)getModuleClassFromName:(const char *)name {
    return RCTCoreModulesClassProvider(name);
}

- (std::shared_ptr<facebook::react::TurboModule>)
    getTurboModule:(const std::string &)name
         jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker {
    return nullptr;
}

- (std::shared_ptr<facebook::react::TurboModule>)
    getTurboModule:(const std::string &)name
        initParams:(const facebook::react::ObjCTurboModule::InitParams &)params {
    return nullptr;
}

- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass {
    return RCTAppSetupDefaultModuleFromClass(moduleClass, self.dependencyProvider);
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
    [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
                format:@"Subclasses must implement a valid sourceURLForBridge method"];
    return nil;
}

- (BOOL)concurrentRootEnabled {
    return true;
}

@end

here is my AppDelegate.swift where the error "No such module 'ReactNativeNavigation'" occurred.

import UIKit
import React
import ReactNativeNavigation
import ReactAppDependencyProvider

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "project_rnn",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}

Here is my Package.json

{
  "name": "project_rnn",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native/new-app-screen": "0.80.1",
    "react": "19.1.0",
    "react-native": "0.80.1",
    "react-native-navigation": "^8.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "19.0.0",
    "@react-native-community/cli-platform-android": "19.0.0",
    "@react-native-community/cli-platform-ios": "19.0.0",
    "@react-native/babel-preset": "0.80.1",
    "@react-native/eslint-config": "0.80.1",
    "@react-native/metro-config": "0.80.1",
    "@react-native/typescript-config": "0.80.1",
    "@types/jest": "^29.5.13",
    "@types/react": "^19.1.0",
    "@types/react-test-renderer": "^19.1.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.1.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

``

apponthebeach avatar Jul 02 '25 15:07 apponthebeach

During pod install the dection of a swift AppDelegate wasn't working.

This output during the process was the key teller.

ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration

Using this pr https://github.com/wix/react-native-navigation/pull/8056/files and manually applying it to the file the app was successfully compiled.

The problem is that I got an React error after this change.

"PROJECT_NAME" has not been registered

Still trying to fix

fernandopontue avatar Jul 03 '25 14:07 fernandopontue

@fernandopontue

Thanks a lot. I've got the same error as yours. Will investigate this one right now.

apponthebeach avatar Jul 03 '25 14:07 apponthebeach

@fernandopontue I realised the problem was AppDelegate.swift which is different in RN 0.80 from older version, so rnn-link did not change anything in it. I try to change it a bit so that he would work with RNN. Unfortunately, I ended up with an error : Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeMicrotasksCxx' could not be found.

@manojmehra-spraxa did you managed to have a completely functional app with RN 0.80 and RNN 8.1.0 ? If so, can you explain us a bit more how you did it ?

Here is my new AppDelegate.swift

import UIKit
import React
import ReactNativeNavigation
import ReactAppDependencyProvider

@main
class AppDelegate: RNNAppDelegate {

  override
  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    let factory = RCTReactNativeFactory(delegate: self)
    self.dependencyProvider = RCTAppDependencyProvider()

    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "project_rnn",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
  
  
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}

apponthebeach avatar Jul 07 '25 08:07 apponthebeach

Amazing work! Can you create a pr with all fixes?

gosha212 avatar Jul 09 '25 12:07 gosha212

here is the AppDelegate.swift file @apponthebeach you can check this as i missed this file to add here

import UIKit
import React
import ReactNativeNavigation
import ReactAppDependencyProvider

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "SampleProject",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}

manoj-mehra-spraxa avatar Jul 11 '25 05:07 manoj-mehra-spraxa

@manojmehra-spraxa can you share a github repo or a sample project where you have made [email protected] work with [email protected].

ramaerion avatar Jul 14 '25 07:07 ramaerion

@fernandopontue I realised the problem was AppDelegate.swift which is different in RN 0.80 from older version, so rnn-link did not change anything in it. I try to change it a bit so that he would work with RNN. Unfortunately, I ended up with an error : Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeMicrotasksCxx' could not be found.

@manojmehra-spraxa did you managed to have a completely functional app with RN 0.80 and RNN 8.1.0 ? If so, can you explain us a bit more how you did it ?

Here is my new AppDelegate.swift

import UIKit
import React
import ReactNativeNavigation
import ReactAppDependencyProvider

@main
class AppDelegate: RNNAppDelegate {

  override
  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    let factory = RCTReactNativeFactory(delegate: self)
    self.dependencyProvider = RCTAppDependencyProvider()

    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "project_rnn",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
  
  
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}

You can try it by changing the ReactNativeNavigation.podspec file in the root of the library, similar to this PR https://github.com/wix/react-native-navigation/pull/8056

huynhuchuy2001 avatar Jul 16 '25 03:07 huynhuchuy2001

here is the AppDelegate.swift file @apponthebeach you can check this as i missed this file to add here

import UIKit
import React
import ReactNativeNavigation
import ReactAppDependencyProvider

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "SampleProject",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}

Yes I got this one @manojmehra-spraxa, but in this file you did not use RNNAppDelegate. It's still the same AppDelegate as before implementing RNN. Does not sound a good approach to me or do I miss something ?

apponthebeach avatar Jul 16 '25 10:07 apponthebeach

@fernandopontue I realised the problem was AppDelegate.swift which is different in RN 0.80 from older version, so rnn-link did not change anything in it. I try to change it a bit so that he would work with RNN. Unfortunately, I ended up with an error : Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeMicrotasksCxx' could not be found.

@apponthebeach I am also getting the Invariant Violation error even when using the updated AppDelegate.swift. Any idea how to fix this?

[runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...):
'NativeMicrotasksCxx' could not be found.
Verify that a module by this name is registered in the native binary., js engine: hermes

Thanks for the patches! Hope they will be integrated soon!

nbonamy avatar Jul 23 '25 00:07 nbonamy

@fernandopontue I realised the problem was AppDelegate.swift which is different in RN 0.80 from older version, so rnn-link did not change anything in it. I try to change it a bit so that he would work with RNN. Unfortunately, I ended up with an error : Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeMicrotasksCxx' could not be found.

@apponthebeach I am also getting the Invariant Violation error even when using the updated AppDelegate.swift. Any idea how to fix this?

[runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...):
'NativeMicrotasksCxx' could not be found.
Verify that a module by this name is registered in the native binary., js engine: hermes

Thanks for the patches! Hope they will be integrated soon!

@nbonamy I try to search a bit but right now I have a lot to do with my clients and the migration to Android SDK 35 for some of them and it's a lot for me to dive into the RNN code. With the last RNN version, I was able to build the app without any trouble with RN 0.77 which I will rely on for my clients. As for 0.80, Il will check back in September see what's have been done.

apponthebeach avatar Jul 30 '25 06:07 apponthebeach

@manoj-mehra-spraxa Thanks for your help! for anyone else it might be worth mentioning if you have issues with pod install, then you might need to comment out s.dependency "React-rncore" from ReactNativeNavigation.podspec. My issue might be more related to using RN 81 though.

jwh-hutchison avatar Sep 11 '25 08:09 jwh-hutchison

Are you able to make it work with RN81 with that?

nbonamy avatar Sep 11 '25 21:09 nbonamy

@nbonamy

Are you able to make it work with RN81 with that?

No actually, it was compiling fine but it would never initialise the initial component mount, honestly I've given up with iOS for now and I'm just going to wait until RNN supports RN81 on iOS (the only reason I am in the process of upgrading is because Google Play is requiring all apps use 16KB page-sizes for their android .so native libraries, so there isn't the same urgency for iOS as with Android).

jwh-hutchison avatar Sep 12 '25 05:09 jwh-hutchison

android different error: https://github.com/wix/react-native-navigation/issues/8116 [runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'PlatformConstatns' cound not be found Image

Aikenwu avatar Sep 24 '25 12:09 Aikenwu

android different error: #8116 [runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'PlatformConstatns' cound not be found Image

Fixed, see original response

Aikenwu avatar Sep 25 '25 10:09 Aikenwu

Appreciate your effort @manoj-mehra-spraxa.

It works on Android, but I’ve been stuck on the iOS version for weeks.

Image

DevRedaKhalaf avatar Sep 30 '25 08:09 DevRedaKhalaf

Image

Facing this issue after making changing and running android app

nikhilsmartdata-123 avatar Oct 14 '25 08:10 nikhilsmartdata-123