React-native-navigation: V7 Next index.js error: `AppRegistry.registerComponent` wasn't called.

Created on 18 Oct 2020  ·  3Comments  ·  Source: wix/react-native-navigation

📚 Documentation

The doc instructions for installing and running the next branch produces AppRegistry.registerComponent wasn't called.

Have you read the Contributing Guidelines on issues? Yes

Reproduction

-- reproduction is here->WixSevenStarter

  1. create project with npx react-native init WixSevenStarter
  2. Test project by running react-native run-ios and project works.
  3. Add react-native-navigation with yarn add react-native-navigation
  4. Run npx rnn-link
  5. Update index.js per docs to :
import { Navigation } from "react-native-navigation";
import App from './App';
// import {name as appName} from './app.json';

// AppRegistry.registerComponent(appName, () => App);
Navigation.registerComponent('com.myApp.WelcomeScreen', () => App);
Navigation.events().registerAppLaunchedListener(() => {
   Navigation.setRoot({
     root: {
       stack: {
         children: [
           {
             component: {
               name: 'com.myApp.WelcomeScreen'
             }
           }
         ]
       }
     }
  });
});
  1. Run yarn start --reset-cache

Output is:

~/Downloads/WixSevenStarter wix-nav 30s
❯ yarn start --reset-cache
yarn run v1.22.5
$ react-native start --reset-cache

               ######                ######
             ###     ####        ####     ###
            ##          ###    ###          ##
            ##             ####             ##
            ##             ####             ##
            ##           ##    ##           ##
            ##         ###      ###         ##
             ##  ########################  ##
          ######    ###            ###    ######
      ###     ##    ##              ##    ##     ###
   ###         ## ###      ####      ### ##         ###
  ##           ####      ########      ####           ##
 ##             ###     ##########     ###             ##
  ##           ####      ########      ####           ##
   ###         ## ###      ####      ### ##         ###
      ###     ##    ##              ##    ##     ###
          ######    ###            ###    ######
             ##  ########################  ##
            ##         ###      ###         ##
            ##           ##    ##           ##
            ##             ####             ##
            ##             ####             ##
            ##          ###    ###          ##
             ###     ####        ####     ###
               ######                ######

warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere



To reload the app press "r"
To open developer menu press "d"

[Sun Oct 18 2020 15:42:14.273]  BUNDLE  ./index.js

[Sun Oct 18 2020 15:43:00.280]  LOG      Running "WixSevenStarter" with {"rootTag":1,"initialProps":{}}
[Sun Oct 18 2020 15:43:00.300]  ERROR    Invariant Violation: "WixSevenStarter" 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.

Have I missed something?

Infrastructure iOS acceptebug documentation

Most helpful comment

@idkjs That bug has already been fixed in master but not yet released. For now you will have to manually set the deployment target in your Podfile to 11.0.

All 3 comments

@guyca Thank for the update. Still getting an error. Here is the result of running pod install --project-directory=ios

~/Github/WixSevenStarter wix-nav
❯ rm -rf node_modules && yarn
yarn install v1.22.5
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] 🔨  Building fresh packages...
✨  Done in 34.09s.

~/Github/WixSevenStarter wix-nav 42s
❯ npx rnn-link

Running Android postlink script.

Linking MainApplication...
   MainApplication already extends NavigationApplication, skipping.
   NavigationReactNativeHost is already used, skipping.
   SOLoader.init() is not called, skipping.
MainApplication.java linked successfully!

Linking MainActivity...
   MainActivity already extends NavigationActivity
   getMainComponentName function was not found.
MainActivity linked successfully!

Linking root build.gradle...
   Kotlin version already specified
   Kotlin plugin already declared
   Already specified minSdkVersion 19
Root build.gradle linked successfully!

Running iOS postlink script.

Linking AppDelegate...
   Removing Unneeded imports
   No imports could be removed. Check the manual installation docs to verify that everything is properly setup:
   https://wix.github.io/react-native-navigation/docs/installing#native-installation
   AppDelegate already imports ReactNativeNavigation.h
   Navigation Bootstrap already present.
   extraModulesForBridge already present.
   Removing Application launch content
   No elements could be removed. Check the manual installation docs to verify that everything is properly setup:
   https://wix.github.io/react-native-navigation/docs/installing#native-installation
AppDelegate linked successfully!

Updating Podfile...
   RNN Pod has not been added to Podfile

React Native Navigation link is completed. Check the logs above for more information.

   If any of the steps failed, check the installation docs and go through the necessary steps manually:
   https://wix.github.io/react-native-navigation/docs/installing#manual-installation

When you're done, don't forget to update the index.js file as mentioned in docs!

Thank you for using React Native Navigation!



~/Github/WixSevenStarter wix-nav
❯ pod install --project-directory=ios
Auto-linking React Native module for target `WixSevenStarter`: ReactNativeNavigation
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] CocoaPods could not find compatible versions for pod "ReactNativeNavigation":
  In Podfile:
    ReactNativeNavigation (from `../node_modules/react-native-navigation`)

Specs satisfying the `ReactNativeNavigation (from `../node_modules/react-native-navigation`)` dependency were found, but they required a higher minimum deployment target.

~/Github/WixSevenStarter wix-nav
❯ 

@idkjs That bug has already been fixed in master but not yet released. For now you will have to manually set the deployment target in your Podfile to 11.0.

I had fixed it doing that but did not want to assume anything. Thanks.

Was this page helpful?
0 / 5 - 0 ratings