react-native-qrcode-scanner icon indicating copy to clipboard operation
react-native-qrcode-scanner copied to clipboard

ViewPropTypes has been removed from React Native

Open AhmadHussain755 opened this issue 2 years ago • 10 comments

What's happening?

How can it be reproduced?

Build details?

AhmadHussain755 avatar Jul 14 '22 06:07 AhmadHussain755

This issue is caused by react-native-camera .

supriyoMondal avatar Jul 14 '22 13:07 supriyoMondal

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

Aarvis avatar Jul 17 '22 20:07 Aarvis

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

DanielGBullido avatar Aug 15 '22 16:08 DanielGBullido

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.

Legion2 avatar Aug 19 '22 11:08 Legion2

How can I use this library with react native vision camera

aapa96 avatar Aug 31 '22 07:08 aapa96

Any news about this? Using a non maintained package is not possible ;)

fdelavra avatar Sep 15 '22 00:09 fdelavra

我也有同样问题 如何手动修改不可维护包 是不是不太科学

zfy171 avatar Sep 15 '22 06:09 zfy171

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:

  1. Remove the ViewPropTypes from the original compound import statement.
  2. 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.

RickReac avatar Oct 20 '22 14:10 RickReac

  1. npm install deprecated-react-native-prop-types or yarn add deprecated-react-native-prop-types
  2. Add "postinstall": "patch-package" to <your-project-root>/package.json in "scripts"
  3. Add the patch file in <your-project-root>/patches
  4. npm install or yarn 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';
 

CostachescuCristinel avatar Nov 25 '22 12:11 CostachescuCristinel

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.

SaadBazaz avatar Dec 06 '22 16:12 SaadBazaz