@Shalindor

Почему у меня возникает ошибка при компиляции с react native drawer navigation?

при сборке я получаю ошибку

TypeError: Cannot read property 'isConfigured' of undefined


```

import React from 'react';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {RoutesEnum} from 'common/typescript/enums/routing.enum';
import Users from 'screens/Users/Users';
import Products from 'screens/Products/Products';
import Cart from 'screens/Cart/Cart';
const Drawer = createDrawerNavigator();
const MenuNavigation = () => {
  return (
    <Drawer.Navigator>
      <Drawer.Screen name={RoutesEnum.Users} component={Users} />
      <Drawer.Screen name={RoutesEnum.Products} component={Products} />
      <Drawer.Screen name={RoutesEnum.Cart} component={Cart} />
    </Drawer.Navigator>
  );
};

export default MenuNavigation;


App

import 'react-native-gesture-handler';
import React, {FC, useEffect} from 'react';
import {SafeAreaView} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';

import SplashScreen from 'react-native-splash-screen';
import {additionalWeek} from 'common/constants/colors.constant';

import {enableScreens} from 'react-native-screens';
import MenuNavigation from 'screens/navigation/MenuNavigation';

enableScreens();

const App: FC = () => {
  useEffect(() => {
    setTimeout(() => {
      SplashScreen.hide();
    }, 200);
  }, []);

  return (
    <NavigationContainer>
      <SafeAreaView style={{flex: 1, backgroundColor: additionalWeek}}>
        <MenuNavigation />
      </SafeAreaView>
    </NavigationContainer>
  );
};

export default App;


babel config

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        extensions: [
          '.ios.js',
          '.android.js',
          '.js',
          '.ts',
          '.tsx',
          '.svg',
          '.png',
          '.jpg',
          '.json',
        ],
        alias: {
          components: './src/components',
          styles: './src/styles',
          screens: './src/screens',
          common: './src/common',
        },
      },
      'react-native-reanimated/plugin',
    ],
  ],
};


metro config

const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

const defaultConfig = getDefaultConfig(__dirname);
const {assetExts, sourceExts} = defaultConfig.resolver;

/**
 * Metro configuration
 * https://facebook.github.io/metro/docs/configuration
 *
 * @type {import('metro-config').MetroConfig}
 */
const config = {
  transformer: {
    babelTransformerPath: require.resolve('react-native-svg-transformer'),
  },
  resolver: {
    assetExts: assetExts.filter(ext => ext !== 'svg'),
    sourceExts: [...sourceExts, 'svg'],
  },
};

module.exports = mergeConfig(defaultConfig, config);


package json

{
"name": "ReactNative",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/drawer": "^6.6.6",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/stack": "^6.3.20",
    "i": "^0.3.7",
    "npm": "^10.2.3",
    "react": "18.2.0",
    "react-native": "0.72.6",
    "react-native-gesture-handler": "^2.14.0",
    "react-native-paper": "^5.11.3",
    "react-native-reanimated": "^3.6.1",
    "react-native-safe-area-context": "^4.7.4",
    "react-native-screens": "^3.27.0",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.14.0",
    "react-native-svg-transformer": "^1.1.0",
    "styled-components": "^6.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "@tsconfig/react-native": "^3.0.0",
    "@types/react": "^18.0.24",
    "@types/react-native-drawer-layout": "^1.3.10",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "babel-plugin-module-resolver": "^5.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }
}
  • Вопрос задан
  • 76 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы