因为ViewPropTypes已经从“react原生”中删除了,并且使用它的包没有更新。此错误出现在生成应用程序之后。
ERROR Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.我正在使用的软件包:
"@react-native-clipboard/clipboard": "^1.10.0",
"@react-native-community/checkbox": "^0.5.12",
"@react-native-firebase/app": "^14.11.0",
"@react-native-firebase/auth": "^14.9.4",
"@react-native-firebase/database": "^14.11.0",
"@react-native-firebase/firestore": "^14.11.0",
"@react-native-google-signin/google-signin": "^7.2.2",
"@react-native-masked-view/masked-view": "github:react-native-masked-view/masked-view",
"@react-native-picker/picker": "^2.4.1",
"@react-navigation/bottom-tabs": "^6.3.1",
"@react-navigation/native": "^6.0.10",
"@react-navigation/stack": "^6.2.1",
"axios": "^0.27.2",
"base-64": "^1.0.0",
"num-words": "^1.2.2",
"numeral": "^2.0.6",
"pdf-lib": "^1.17.1",
"react": "17.0.2",
"react-native": "^0.69.0",
"react-native-blob-util": "^0.16.1",
"react-native-country-picker-modal": "^2.0.0",
"react-native-date-picker": "^4.2.2",
"react-native-fbsdk-next": "^8.0.5",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.5.0",
"react-native-html-to-pdf": "^0.12.0",
"react-native-pdf": "^6.5.0",
"react-native-picker-select": "^8.0.4",
"react-native-progress": "^5.0.0",
"react-native-radio-input": "^0.9.4",
"react-native-ratings": "^8.1.0",
"react-native-safe-area-context": "^4.2.5",
"react-native-screens": "^3.13.1",
"react-native-share": "^7.5.0",
"react-native-signature-canvas": "^4.3.1",
"react-native-vector-icons": "^9.1.0",
"react-native-webview": "^11.21.2",
"react-scripts": "^5.0.1"有解决办法吗?
发布于 2022-07-27 10:00:24
我可以建议您执行本github讨论中概述的步骤。
步骤
npm install deprecated-react-native-prop-types或yarn add deprecated-react-native-prop-types安装不推荐的反应-本机支持类型。对此:
// Deprecated Prop Types
get ColorPropType(): $FlowFixMe {
return require("deprecated-react-native-prop-types").ColorPropType
},
get EdgeInsetsPropType(): $FlowFixMe {
return require("deprecated-react-native-prop-types").EdgeInsetsPropType
},
get PointPropType(): $FlowFixMe {
return require("deprecated-react-native-prop-types").PointPropType
},
get ViewPropTypes(): $FlowFixMe {
return require("deprecated-react-native-prop-types").ViewPropTypes
},npx patch-package react-native以保存修补程序。唯一要记住的是,这个补丁将需要在每次升级时重新应用,以响应本机,或者直到相关库被更新,以从废弃的-react本机-支持类型导入。
支持戈古达提供这个答案。
发布于 2022-07-02 04:46:06
我也犯了同样的错误,我遵循了以下步骤,并解决了这个问题。这是因为react本机已经从库中删除了视图支持类型,但是仍然有一些外部模块需要使用它。
npm i deprecated-react-native-prop-types@2.2.0src文件夹(在我的示例中是在RNCamera.js中)并查找import {
findNodeHandle,
Platform,
NativeModules,
ViewPropTypes,
requireNativeComponent,
View,
ActivityIndicator,
Text,
StyleSheet,
PermissionsAndroid,
} from 'react-native';在下面的代码中,删除ViewPropTypes并粘贴下面的命令
import { ViewPropTypes } from 'deprecated-react-native-prop-types';保存该文件并再次运行它,希望它有助于<3
发布于 2022-07-01 19:27:44
我在使用反光镜时也犯了同样的错误。我通过安装npm i deprecated-react-native-prop-types@2.2.0并在node_modules/react-native-camera中替换来修复它
所有导入都在文件中。
import { ViewPropTypes } from 'react-native'; 为
import { ViewPropTypes } from 'deprecated-react-native-prop-types';https://stackoverflow.com/questions/72755476
复制相似问题