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

IOS - RN 0.80.2 and RNN 8.2.1 RCT_NEW_ARCH_ENABLED - React-RuntimeApple/ReactCommon/RCTHost.h

Open ertugruldogan opened this issue 5 months ago • 5 comments

node_modules/react-native-navigation/lib/ios/RNNReactButtonView.h:2:9 'React-RuntimeApple/ReactCommon/RCTHost.h' file not found

ENV['RCT_NEW_ARCH_ENABLED'] = '1' or ENV['RCT_NEW_ARCH_ENABLED'] = '0' It doesn't matter, the error is as above.

Podfile

ENV['RCT_NEW_ARCH_ENABLED'] = '1'

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!

$RNFirebaseAsStaticFramework = true
$RNFirebaseAnalyticsWithoutAdIdSupport = true

install! 'cocoapods', :deterministic_uuids => false

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

target 'myapp' do
  config = use_native_modules!

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

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Analytics'
  
  pod 'FBSDKCoreKit'
  
  pod 'RNNotifee', :path => '../node_modules/@notifee/react-native'

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = min_ios_version_supported
      end
    end
  end
end

AppDelegate.mm

#import "AppDelegate.h"
#import <Firebase.h>

// Notifee için gerekli import'lar
#import <UserNotifications/UserNotifications.h>
#if __has_include(<RNNotifee/RNNotifee.h>)
#import <RNNotifee/RNNotifee.h>
#define NOTIFEE_ENABLED 1
#else
#define NOTIFEE_ENABLED 0
#endif

#import <ReactNativeNavigation/ReactNativeNavigation.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-swift.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
        return YES;
    }
    
    if ([RCTLinkingManager application:app openURL:url options:options]) {
        return YES;
    }
    
    return NO;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // Firebase initialize
    if ([FIRApp defaultApp] == nil) {
        [FIRApp configure];
    }
    
    // UNUserNotificationCenter delegate'ini ayarla - önemli!
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    
    // React Native Navigation initialize
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    [ReactNativeNavigation bootstrapWithBridge:bridge];
    
    // Badge sayısını sıfırla
    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
    
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Uygulama aktif olunca badge'i temizle
    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
    return [RCTLinkingManager application:application
                     continueUserActivity:userActivity
                       restorationHandler:restorationHandler];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
    return [self bundleURL];
}

- (NSURL *)bundleURL {
#if DEBUG
    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

#pragma mark - Remote Notifications

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
#if NOTIFEE_ENABLED
    // Notifee için device token'ı ayarla
    [[RNNotifee coreDelegate] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
#endif
    
    // Firebase Messaging için APNS token'ı set et
    [FIRMessaging messaging].APNSToken = deviceToken;
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    NSLog(@"Failed to register for remote notifications: %@", error);
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
#if NOTIFEE_ENABLED
    // Notifee için remote notification'ları handle et
    [[RNNotifee coreDelegate] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
#else
    completionHandler(UIBackgroundFetchResultNewData);
#endif
}

#pragma mark - UNUserNotificationCenterDelegate

// Uygulama foreground'dayken notification geldiğinde
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
    
#if NOTIFEE_ENABLED
    // Notifee'ye notification'ı bildir
    [[RNNotifee coreDelegate] userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
#else
    // iOS 14+ için modern options
    if (@available(iOS 14.0, *)) {
        completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
    } else {
        completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
    }
#endif
}

// Kullanıcı notification'a tıkladığında
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void(^)())completionHandler {
    
#if NOTIFEE_ENABLED
    // Notifee'ye response'u bildir
    [[RNNotifee coreDelegate] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
#else
    completionHandler();
#endif
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
    return [ReactNativeNavigation extraModulesForBridge:bridge];
}

@end

AppDelegate.h

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

React Native Navigation version: 8.2.1 React Native version: 0.80.2 Has Fabric (React Native's new rendering system) enabled: (yes/no) = YES


[!IMPORTANT] ENV['RCT_NEW_ARCH_ENABLED'] = '0' React Native Navigation version: 7.45.0 React Native version: 0.80.2 Has Fabric (React Native's new rendering system) enabled: (yes/no) = NO it works smoothly this way

ertugruldogan avatar Jul 29 '25 20:07 ertugruldogan

Since version 0.78.0, React Native uses ReactNativeFactory to instantiate app on iOS. This will support Scene Delegate in the future. RNN has not yet implemented this, and as the documentation states, the last supported React Native version for RNN is 0.77.x.

see https://github.com/wix/react-native-navigation/issues/8057

Omelyan avatar Jul 31 '25 13:07 Omelyan

Maybe this will help https://github.com/wix/react-native-navigation/issues/8026#issuecomment-3185537847 ?

retyui avatar Aug 13 '25 20:08 retyui

Maybe this will help #8026 (comment) ?

It was applied but a different error occurred during this time. https://github.com/wix/react-native-navigation/issues/8026#issuecomment-3180363193

ertugruldogan avatar Aug 15 '25 20:08 ertugruldogan

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

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] avatar Dec 17 '25 22:12 stale[bot]