skip to Main Content

Uncaught Error: Component ‘Privont’ has not been registered in React Native App

I’m getting the following error in my React Native app:

"Uncaught Error: ‘Privont’ 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."

I’ve checked my code, and it seems that "Privont" hasn’t been registered. Here’s what I’ve tried so far:

  • Restarted the Metro bundler.
  • Verified that I’m running Metro in the correct project directory.
  • Checked the AppRegistry.registerComponent call in my code.

The error points to AppRegistry.js at line 205.

Here is my code:

1. index.js

import * as React from 'react';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import './Core/translations/i18next';
import {Provider} from 'react-redux';
import {PersistGate} from 'reduxjs-toolkit-persist/integration/react';
import {persistedStore, store} from './src/redux/store';

const AppWrapper = () => (
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistedStore}>
      <App />
    </PersistGate>
  </Provider>
);

AppRegistry.registerComponent(appName, () => AppWrapper);

2. app.json

{
  "name": "Privont",
  "displayName": "Privont"
}

3. AppDelegate.mm

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  // Add this line to call the above function
    ClearKeychainIfNecessary();
  self.moduleName = @"Privont";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

Here is the error image : See Image

2

Answers


  1. Chosen as BEST ANSWER

    I was using the deprecated react-native-push-notification package. I uninstalled it and replaced it with @notifee/react-native, which is working fine.


  2. Ok, so one thing I notice is that in index.js in the last line, you are registering App, but before you are using an AppWrapper

    try registering that instead of App:

    // Register AppWrapper instead of App 
    AppRegistry.registerComponent(appName, () => AppWrapper);
    

    Also make sure to call npx react-native start --reset-cache or whatever command you are using from the root of your project.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search