Plibr
Здравствуйте, кто нибудь знает как решать эти ошибки? необходимые инфо добавил внизу:
ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
ERROR TypeError: Cannot read property 'useContext' of null, js engine: hermes
LOG Running "iosTesting" with {"rootTag":1,"initialProps":{}}
ERROR Invariant Violation: "iosTesting" 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., js engine: hermes
"dependencies": {
"@gorhom/bottom-sheet": "^4.5.1",
"@react-native-community/slider": "^4.4.3",
"@react-native-picker/picker": "^2.6.1",
"@react-native-segmented-control/segmented-control": "^2.4.2",
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/core": "^6.4.10",
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.3.20",
"react": "18.2.0",
"react-native": "0.72.7",
"react-native-gesture-handler": "^2.14.0",
"react-native-reanimated": "^3.6.0",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^4.7.4",
"react-native-screens": "^3.27.0",
"react-native-track-player": "^4.0.1",
"react-native-vector-icons": "^10.0.2",
"react-native-windows": "^0.72.20"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.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-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"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"
}
npm ls react
iosTesting@0.0.1 /Users/username/myProject
├─┬ @gorhom/bottom-sheet@4.6.4
│ ├─┬ @gorhom/portal@1.0.14
│ │ └── react@18.2.0 deduped
│ └── react@18.2.0 deduped
├─┬ @react-native-picker/picker@2.7.7
│ └── react@18.2.0 deduped
├─┬ @react-native-segmented-control/segmented-control@2.5.2
│ └── react@18.2.0 deduped
├─┬ @react-navigation/bottom-tabs@6.6.1
│ ├─┬ @react-navigation/elements@1.3.31
│ │ └── react@18.2.0 deduped
│ └── react@18.2.0 deduped
├─┬ @react-navigation/core@6.4.17
│ ├── react@18.2.0 deduped
│ └─┬ use-latest-callback@0.2.1
│ └── react@18.2.0 deduped
├─┬ @react-navigation/native@6.1.18
│ └── react@18.2.0 deduped
├─┬ @react-navigation/stack@6.4.1
│ └── react@18.2.0 deduped
├─┬ react-native-gesture-handler@2.18.1
│ └── react@18.2.0 deduped
├─┬ react-native-reanimated-carousel@3.5.1
│ └── react@18.2.0 deduped
├─┬ react-native-reanimated@3.14.0
│ └── react@18.2.0 deduped
├─┬ react-native-safe-area-context@4.10.8
│ └── react@18.2.0 deduped
├─┬ react-native-screens@3.33.0
│ ├─┬ react-freeze@1.0.4
│ │ └── react@18.2.0 deduped
│ └── react@18.2.0 deduped
├─┬ react-native-track-player@4.1.1
│ └── react@18.2.0 deduped
├─┬ react-native-windows@0.72.36
│ ├─┬ react-shallow-renderer@16.15.0
│ │ └── react@18.2.0 deduped
│ ├── react@18.2.0 deduped
│ └─┬ use-sync-external-store@1.2.2
│ └── react@18.2.0 deduped
├─┬ react-native@0.72.7
│ └── react@18.2.0 deduped
├─┬ react-test-renderer@18.2.0
│ └── react@18.2.0 deduped
└── react@18.2.0
Vitaliy
?
да вроде всё написано.
у вас точно не похоже на п.1 (версии RN и react на всякий случай сравните с шаблоном, но вроде ок
и точно не похоже на п.3 - судя по списку зависимостей в выводе npm ls
так что остается только п.2, где-то правила хуков нарушили. прочитайте то что там по ссылке рекомендуют сделать, проверьте где у вас может быть нарушена последовательность их выполнения, например
или просто шаг за шагом вглубину отключайте экраны (импорты, рендеринг) и проверяйте где ошибка может быть
по крайней мере если ориентироваться на то что написано, лучше ничего в голову не приходит
I
Добрый вечер, возник такой вопрос, фронт утверждает что лучше делать проект на чистом js без использования фрейворков есть ли у этого какие то плюсы?