react-native-qrcode-scanner
react-native-qrcode-scanner copied to clipboard
ViewPropTypes has been removed from React Native
What's happening?
How can it be reproduced?
Build details?
This issue is caused by react-native-camera .
This issue is caused by react-native-camera .
Yes, I got this issue and temporarily followed this fix suggested in react-native-camera issues bucket https://github.com/react-native-camera/react-native-camera/issues/3423
Works smooth now
Hi
you need to use https://github.com/mrousavy/react-native-vision-camera beacuse https://github.com/react-native-camera/react-native-camera/issues/3423 is deprecated.
please update your repo to use react-native-vision-camera
We updated to react-native 0.69.4 and now our app wont start because react-native-camera
which is an unmaintained dependency of this project uses the removed ViewPropTypes
of react-native. The only path forward is to replace react-native-camera
with react-native-vision-camera
.
How can I use this library with react native vision camera
Any news about this? Using a non maintained package is not possible ;)
我也有同样问题 如何手动修改不可维护包 是不是不太科学
You can use the deprecated-react-native-prop-types with npm install deprecated-react-native-prop-types --save.
Had to do some hacking in node_modules/react-native-camera/src/RNCamera.js:
- Remove the ViewPropTypes from the original compound import statement.
- Add import { ViewPropTypes } from 'deprecated-react-native-prop-types'; right above import PropTypes
I know it's not the clean/right/correct/recommended way to fix this, But if you need a quick solution, this may help.
-
npm install deprecated-react-native-prop-types
oryarn add deprecated-react-native-prop-types
- Add
"postinstall": "patch-package"
to<your-project-root>/package.json
in"scripts"
- Add the patch file in
<your-project-root>/patches
-
npm install
oryarn
your project
react-native-camera+4.2.1.patch
NOTE: This patch adds deprecated-react-native-prop-types@^2.3.0
as a react-native-camera
dependency in its package.json
, however, I cannot get it to actually install it automatically.
diff --git a/node_modules/react-native-camera/package.json b/node_modules/react-native-camera/package.json
index 5e2dc63..cea2a2d 100644
--- a/node_modules/react-native-camera/package.json
+++ b/node_modules/react-native-camera/package.json
@@ -9,7 +9,8 @@
"logo": "https://opencollective.com/opencollective/logo.txt"
},
"dependencies": {
- "prop-types": "^15.6.2"
+ "prop-types": "^15.6.2",
+ "deprecated-react-native-prop-types": "^2.3.0"
},
"devDependencies": {
"@babel/runtime": "^7.3.1",
diff --git a/node_modules/react-native-camera/src/RNCamera.js b/node_modules/react-native-camera/src/RNCamera.js
index b7a271a..9408751 100644
--- a/node_modules/react-native-camera/src/RNCamera.js
+++ b/node_modules/react-native-camera/src/RNCamera.js
@@ -5,7 +5,6 @@ import {
findNodeHandle,
Platform,
NativeModules,
- ViewPropTypes,
requireNativeComponent,
View,
ActivityIndicator,
@@ -13,6 +12,7 @@ import {
StyleSheet,
PermissionsAndroid,
} from 'react-native';
+import { ViewPropTypes } from "deprecated-react-native-prop-types";
import type { FaceFeature } from './FaceDetector';
Any plans on migrating this cool library to React Native Vision Camera? We've updated React Native and now the app crashes because of the deprecation.