Я обнаружил ошибку в своем проекте React Native при попытке запустить приложение. Сообщение об ошибке следующее:
A module failed to load due to an error and AppRegistry.registerComponent wasn't called, JS engine: Hermes
изменить мой код index.js
/**
* @format
*/
import {AppRegistry, AppState} from 'react-native'; // Combined import from 'react-native'
import App from './App'; // Main component import
import {name as appName} from './app.json'; // Import the app name from app.json
import './src/utils/i18n'; // Import for internationalization
import messaging from '@react-native-firebase/messaging'; // Import Firebase Messaging
import store from './src/redux/store/store'; // Redux store
import * as FcmSlice from './src/redux/slices/FcmSlice'; // Redux slice for FCM
import {enableScreens} from 'react-native-screens'; // Optimize navigation using screens
import 'react-native-reanimated'; // For animations in React Native
enableScreens(); // Enables optimized screens for better navigation performance
// Firebase background message handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
if (AppState.currentState === 'background') {
// Dispatch the message to the Redux store
store.dispatch(FcmSlice.getfcmMessage(remoteMessage));
}
console.log('Message handled in the background!', remoteMessage);
});
// Register the main app component
AppRegistry.registerComponent(appName, () => App);
Подробнее здесь: https://stackoverflow.com/questions/790 ... istry-regi
Ошибка React Native: модуль не удалось загрузить из-за ошибки, и AppRegistry.registerComponent не был вызван, механизм J ⇐ Android
Форум для тех, кто программирует под Android
1727328376
Anonymous
Я обнаружил ошибку в своем проекте React Native при попытке запустить приложение. Сообщение об ошибке следующее:
A module failed to load due to an error and AppRegistry.registerComponent wasn't called, JS engine: Hermes
изменить мой код index.js
/**
* @format
*/
import {AppRegistry, AppState} from 'react-native'; // Combined import from 'react-native'
import App from './App'; // Main component import
import {name as appName} from './app.json'; // Import the app name from app.json
import './src/utils/i18n'; // Import for internationalization
import messaging from '@react-native-firebase/messaging'; // Import Firebase Messaging
import store from './src/redux/store/store'; // Redux store
import * as FcmSlice from './src/redux/slices/FcmSlice'; // Redux slice for FCM
import {enableScreens} from 'react-native-screens'; // Optimize navigation using screens
import 'react-native-reanimated'; // For animations in React Native
enableScreens(); // Enables optimized screens for better navigation performance
// Firebase background message handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
if (AppState.currentState === 'background') {
// Dispatch the message to the Redux store
store.dispatch(FcmSlice.getfcmMessage(remoteMessage));
}
console.log('Message handled in the background!', remoteMessage);
});
// Register the main app component
AppRegistry.registerComponent(appName, () => App);
Подробнее здесь: [url]https://stackoverflow.com/questions/79025624/react-native-error-a-module-failed-to-load-due-to-an-error-and-appregistry-regi[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия