react-native - 如何解决 react-native-paper 和 Redux 中的此错误?
问题描述
错误 :
错误:无法
react-native-paper/lib/typescript/src/core/settings
从index.js
项目中找到 react-native-paper/lib/typescript/src/core/settings 中的模块。
我正在使用react-native-paper
和Redux
一起,但我无法设置环境。如何设置环境以同时使用两者?
是的,我链接了依赖项。就像我不使用 Redux 并传入App<App />
一样。AppRegistery()
但是每当我包装<App />
另一个组件时,它都会显示错误
index.js:
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './App';
import { Provider as StoreProvider} from 'react-native-paper/lib/typescript/src/core/settings';
import { Provider as PaperProvider } from 'react-native-paper';
const store = createStore(RootReducer,applyMiddleware(thunk))
export default function MyApp() {
return (
<StoreProvider store = {store}>
<PaperProvider>
<App />
</PaperProvider>
</StoreProvider>
);
}
AppRegistry.registerComponent(appName, () => MyApp);
包.json:
{
"dependencies": {
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-firebase/app": "^7.2.0",
"@react-native-firebase/auth": "^8.0.4",
"@react-navigation/material-bottom-tabs": "^5.2.10",
"@react-navigation/native": "^5.5.0",
"@react-navigation/stack": "^5.4.2",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-elements": "^2.0.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-paper": "^3.10.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.8.0",
"react-native-simple-toast": "^1.1.2",
"react-native-tab-view": "^2.14.4",
"react-native-vector-icons": "^6.6.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
}
解决方案
我找到了错误原因。它在导入paperProvider
. 它应该react-native-paper
只从导入,但我从导入,'react-native-paper/lib/typescript/src/core/settings'
所以它导致了这个当前错误。实际上,它是由 VScode 扩展自动导入的。
推荐阅读
- php - 从下拉菜单中显示特定选项的内容
- c# - 在 C# 中对多维数组进行操作
- c++ - Cannot load protocol buffer with ReadBinaryProto Tensorflow
- python - 将字典中的所有替换正则表达式应用于给定文本的最快方法
- python-3.x - 将包含集合的数据框列的每一行转换为包含列表的列
- java - javaFX中的WebView,不适用于Whatsapp web
- godot - 如何在 Godot 3 中添加 3D 场景的多个实例?
- r - 使用 LIME 预测 R 中的 logit 模型?
- entity-framework-core - 从 dbset core 2.1 获取属性值
- vba - VBA excel-2010 listbox1.SelectedIndex 抛出错误