wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

npx rnn-link not updating App Delegate correctly (RN 0.69.2 - RNN 7.28.1) #7564

Closed Huseyinnurbaki closed 2 years ago

Huseyinnurbaki commented 2 years ago

πŸ› Bug Report

npx rnn-link script must remove RCTAppSetupRootView. It's breaking RNN.

To Reproduce

  1. npx react-native init AwesomeProject // 0.69.2
  2. npm install --save react-native-navigation
  3. pod install --project-directory=ios
  4. npx rnn-link

Expected behavior

I expect script to remove lines correctly from app.delegate,mm file. Following lines are not removed and it's breaking the navigation.

Screen Shot 2022-07-21 at 22 15 01

Since they are executed after rnn's registered, app throws following errors and if I dismiss it, it partially works.

has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

Script requires an update. Those 2 lines must be removed.

Your Environment

"react-native": "0.69.2", "react-native-navigation": "^7.28.1", IOS

Are you willing to resolve this issue by submitting a Pull Request?

ApargMobile2 commented 1 year ago

Hi, after link script worked its deleted some part of my code, so what is exact fix? can you provide me appdelegate.mm file example just with navigation ? I'm using RN 0.69.6 version

import "AppDelegate.h"

import <React/RCTBridge.h>

import <React/RCTBundleURLProvider.h>

import <React/RCTAppSetupUtils.h>

import

import <ReactNativeNavigation/ReactNativeNavigation.h>

import "RNSplashScreen.h"

import <UserNotifications/UserNotifications.h>

import

import <React/RCTLinkingManager.h>

import "OpenedFromSettings.h"

if __has_include(<VKSdkFramework/VKSdkFramework.h>)

import <VKSdkFramework/VKSdkFramework.h>

else

import <FBSDKCoreKit/FBSDKCoreKit.h>

import "VKSdk.h"

endif

@implementation AppDelegate

// [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]; // [VKSdk processOpenURL:url fromApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]];

return YES; }

OpenedFromSettings *openedFromSettings; // this function is firing when user opened application from device system notification settings: "AppName notification settings";

-(void)userNotificationCenter:(UNUserNotificationCenter )center willPresentNotification:(UNNotification )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); }

////iOS 9 workflow //- (BOOL)application:(UIApplication )app openURL:(NSURL )url options:(NSDictionary<NSString ,id> )options { // // [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]; // [VKSdk processOpenURL:url fromApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]]; // return YES; //}

// Required to register for notifications

/// This method controls whether the concurrentRootfeature of React18 is turned on or off. /// /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). /// @return: true if the concurrentRoot feture is enabled. Otherwise, it returns false.

@end

here is mine, please tell what is wrong here?