Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. #33557

Closed
kodeandoec opened this issue Apr 3, 2022 · 155 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer

Comments

@kodeandoec
Copy link

Description

Recentrly update React ANtive Version to
"react-native": "0.68.0",
and have this issue

WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN EdgeInsetsPropType will be removed from React Native. Migrate to EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'. WARN EdgeInsetsPropType will be removed from React Native. Migrate to EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'. WARN PointPropType will be removed from React Native. Migrate to PointPropType exported from 'deprecated-react-native-prop-types'. WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

Version

0.68.0

Output of npx react-native info

System:
OS: macOS 12.3.1
CPU: (8) x64 Apple M1
Memory: 30.51 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.8.0 - /usr/local/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 8.5.5 - /usr/local/bin/npm
Watchman: 2022.03.14.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 30, 32
Build Tools: 30.0.2, 32.0.0, 32.1.0
System Images: android-30 | Intel x86 Atom_64, android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.0 => 0.68.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

npx react-native start

Snack, code example, screenshot, or link to a repository

WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN EdgeInsetsPropType will be removed from React Native. Migrate to EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.
WARN EdgeInsetsPropType will be removed from React Native. Migrate to EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.
WARN PointPropType will be removed from React Native. Migrate to PointPropType exported from 'deprecated-react-native-prop-types'.
WARN ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

@Adnan-Bacic
Copy link
Contributor

Adnan-Bacic commented Apr 5, 2022

i got the same warning with ColorPropType:

ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'.

for my project i dont use this directly, but when i search in node_modules/ it appears in some of the libraries i use.

so the only solution i see is for those libraries to be updated.

for example, i had this error from react-native-maps. and i found that someone had already made a pr earlier:
react-native-maps/react-native-maps#4096

seems like a simple fix. but the work seems to fall on the libraries changing the import, instead of the react-native library.

@wimil
Copy link

wimil commented Apr 6, 2022

same

@nibblesnbits
Copy link

Same, but I don't actually know what it's referring to. I don't use anything by that name directly in my code.

@Poplizal
Copy link

Poplizal commented Apr 7, 2022

i also get this errro. brush!

@petrishevalexander
Copy link

saaaaaame! :(

@viniibp
Copy link

viniibp commented Apr 7, 2022

same..

@Gnative

This comment was marked as outdated.

@nibblesnbits
Copy link

So now we just ignore deprecation messages now instead of learning what we actually need to fix? Sounds like a great practice...

@Gnative
Copy link

Gnative commented Apr 8, 2022

So now we just ignore deprecation messages now instead of learning what we actually need to fix? Sounds like a great practice...

@nibblesnbits Obviously if you see this warning you should update your application or handle that how you like. As mentioned above, an issue was about sub packages not having changed to 'deprecated-react-native-prop-types and those throwing the error.

Thanks for your comment to make a clarification.

@nibblesnbits
Copy link

@Gnative, obviously if there is no documentation on what ViewPropTypes actually is within https://reactnative.dev/, no one will know what to update.

@Gnative
Copy link

Gnative commented Apr 8, 2022

@nibblesnbits - did you read the warning

ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

@Gnative

This comment was marked as outdated.

@nibblesnbits
Copy link

nibblesnbits commented Apr 8, 2022 via email

@PAAPII10
Copy link

Same Problem here.. Anyone got solution?

@GitForAndrey
Copy link

GitForAndrey commented Apr 17, 2022

how i solved the same problem.
WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
i got this error after install react-native-camera
The course of my solution, I went to the node-modules folder -> the react-native-camera folder and found the main file RNCamera.js
find ViewPropTypes import

import {
findNodeHandle,
Platform,
NativeModules,
requireNativeComponent,
View,
ViewPropTypes,
ActivityIndicator,
Text,
StyleSheet,
PermissionsAndroid,
} from 'react-native';

delete import this file from 'react-native'
and create new import
import {ViewPropTypes} from 'deprecated-react-native-prop-types';

and its work good

as I understand it, this is a mistake of the old npm packages, and if the project is alive, then the developers fix it in new versions. And maybe this error will go away when you update the package to a newer one.

rrosatti added a commit to rrosatti/react-native-geographql that referenced this issue Apr 17, 2022
The 'ViewPropTypes' is not being used directly in this application, it's coming
from some lib. So, it could be safely ignored
ref: facebook/react-native#33557
rrosatti added a commit to rrosatti/react-native-geographql that referenced this issue Apr 17, 2022
The 'ViewPropTypes' is not being used directly in this application, it's coming
from some lib. So, it could be safely ignored
ref: facebook/react-native#33557
rrosatti added a commit to rrosatti/react-native-geographql that referenced this issue Apr 17, 2022
The 'ViewPropTypes' is not being used directly in this application, it's coming
from some lib. So, it could be safely ignored
ref: facebook/react-native#33557
@hssrrw
Copy link

hssrrw commented Apr 22, 2022

Does anybody know why those types became deprecated? Yes, we can import them from 'deprecated-react-native-prop-types' but what are non-deprecated alternatives now?

@kockok
Copy link

kockok commented Apr 26, 2022

Up until now, is that the best solution is to just IGNORE the warning? I think they should deprecate it in the underlaying codebase! Or at least provide us a config option to dismiss the warning!!

@Gnative
Copy link

Gnative commented Apr 26, 2022

If you have fixed the depreciation in your own codebase and the warning is coming from installed packages then I guess yes ignoring the warning is an option.

You could make a pull request for those packages that are causing the warnings.

@jrhager84
Copy link

Something tells me this warning is going to LINGER for quite some time with some of the older packages.

@yonitou
Copy link

yonitou commented May 6, 2022

I tried your solutions to ignore the warnings but this is really weird, it doesn't work. I already used LogBox plenty of times to ignore some warnings and it worked perfectly well but I just kept trying for 2 hours to ignore these ones and it's not working doesn't matter what

I tried :

  • LogBox.ignoreLogs([ "ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'." ]);
  • LogBox.ignoreLogs([ "ColorPropType will be removed from React Native" ]);
    LogBox.ignoreLogs([ "exported from 'deprecated-react-native-prop-types'." ]);

Could you help ? Thx !

@Adnan-Bacic
Copy link
Contributor

I tried your solutions to ignore the warnings but this is really weird, it doesn't work. I already used LogBox plenty of times to ignore some warnings and it worked perfectly well but I just kept trying for 2 hours to ignore these ones and it's not working doesn't matter what

I tried :

  • LogBox.ignoreLogs([ "ColorPropType will be removed from React Native. Migrate to ColorPropType exported from 'deprecated-react-native-prop-types'." ]);
  • LogBox.ignoreLogs([ "ColorPropType will be removed from React Native" ]);
    LogBox.ignoreLogs([ "exported from 'deprecated-react-native-prop-types'." ]);

Could you help ? Thx !

It looks like you have spaces at the end of the sentences.
Also i think you can write each string in the same array, you dont have to LogBox.ignoreLogs() multiple times

@goxr3plus
Copy link

goxr3plus commented May 6, 2022

Okay for the time talking because this warning is a ball breaker until all the libraries using it update i am dong the following.

If you like to see the errors just don't use this solution but for me i need to see important stuff on the console not warnings spam. Gave you two extra warnings types in case you are using NativeBase and React-Native-Gesture-Handler version 2.2.0 ++ that comes with expo 45

import { LogBox } from 'react-native'
import ignoreWarnings from 'ignore-warnings';

ignoreWarnings('warn',['ViewPropTypes','[react-native-gesture-handler]'])

LogBox.ignoreLogs([
	'ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from \'deprecated-react-native-prop-types\'.',
	'NativeBase: The contrast ratio of',
	"[react-native-gesture-handler] Seems like you\'re using an old API with gesture components, check out new Gestures system!",
])

@yonitou
Copy link

yonitou commented May 9, 2022

Thanks for the help @Adnan-Bacic but unfortunately, I don't have any spaces at the end of my sentences. I copied and pasted almost all of the variants that had been posted on this thread and the warning is always here. I don't get how this is possible since I succeeded to make it work with other warning messages.

@itorres-1
Copy link

itorres-1 commented May 11, 2022

Can someone explain this in a react native noob friendly way? Where am I supposed to put the LogBox.ignoreLogs(...) statements? No matter where I've put it, these warnings pop up (app.config.js, my first screen that shows up, wherever). Is there a central place to put it? I don't like the idea of polluting my code with these statements due to dependencies. Could someone please explain in simple terms how to fix this? Or do I just deal with it until dependencies fix this?

@codeplaygoa
Copy link

facing same issue. ignore logs has no effect on warnings

@FatmaMahmoud698
Copy link

I face the same error

@omaryoussef
Copy link

Yea this seems like a weird solution, there's tons of libraries out there that use this option and the expectation to patch every single one of them manually is bad, is there a more automated solution/configuration we can use?

@qdanik
Copy link

qdanik commented Dec 9, 2022

Yea this seems like a weird solution, there's tons of libraries out there that use this option and the expectation to patch every single one of them manually is bad, is there a more automated solution/configuration we can use?

You should patch just react-native package like to back some things to the lowest version. You shouldn't patch every library just react-native package.

@vinaciotm

This comment was marked as outdated.

@vinaciotm

This comment was marked as outdated.

@iPachDev
Copy link

iPachDev commented Jan 3, 2023

Other Solution

the package "react-native-slider" is based from "@react-native-community/slider".

step 1: Remove react-native-slider

npm uninstall --save react-native-slider

step 2: Install slider community.

npm install --save @react-native-community/slider

step 3: Edit files:

  1. .../node_modules/react-native-media-controls/dist/react-native-media-controls.cjs.development.js
    var RNSlider = _interopDefault(require('react-native-slider'));
    to var RNSlider = _interopDefault(require('@react-native-community/slider'));
  2. .../node_modules/react-native-media-controls/dist/react-native-media-controls.cjs.production.min.js
    Here find text react-native-slider and change with @react-native-community/slider

With simples steps you can should run the proyect

@tiagomsmagalhaes
Copy link

STEP 3:

  • Edit babel.config.js file:
  • add in presets array this string: "module:metro-react-native-babel-preset".
  • add in plugins array this array:
[

       "module-resolver",
       {
         root: ["."],
         resolvePath(sourcePath, currentFile) {
           if (
             sourcePath === "react-native" &&
             !(
               (
                 currentFile.includes("node_modules/react-native/") || // macos/linux paths
                 currentFile.includes("node_modules\\react-native\\")
               ) // windows path
             ) &&
             !(
               currentFile.includes("resolver/react-native/") ||
               currentFile.includes("resolver\\react-native\\")
             )
           ) {
             return path.resolve(__dirname, "resolver/react-native");
           }
           return undefined;
         },
       },
     ]

STEP 4: run expo r -c

🎉 CONGRATULATIONS, YOU ARE WELCOME 😉🇧🇷

@vinaciotm where does path come from?

@laitlhadj
Copy link

@tiagomsmagalhaes
var path = require('path');

@niloriver
Copy link

Thanks. After hours trying to solve with patch this solution seems to be the best.

After I applied "resolvePath()" my "alias" stopped working so I had to adapt.

resolvePath(sourcePath, currentFile, opt) { if ( sourcePath.includes("@utils") || sourcePath.includes("@components") || sourcePath.includes("@scenes") || sourcePath.includes("@theme") || sourcePath.includes("@modules") ) { const fullPath = path.resolve( __dirname, "src", sourcePath.replace("@", "") ); return fullPath; } return undefined; }

@tult-rk
Copy link

tult-rk commented Jan 13, 2023

@niloriver my "alias" stopped working too. How do you resolve that?

with this code? I have edited my babel.config.js like this but still not working.

resolvePath(sourcePath, currentFile, opt) { if ( sourcePath.includes("@utils") || sourcePath.includes("@components") || sourcePath.includes("@scenes") || sourcePath.includes("@theme") || sourcePath.includes("@modules") ) { const fullPath = path.resolve( __dirname, "src", sourcePath.replace("@", "") ); return fullPath; } return undefined; }

@vinaciotm I using yarn not expo, so how can I use it with yarn?

STEP 4:
run expo r -c

@karimessouabni
Copy link

If you are facing this problem because you installed this package recently, I recommend installing https://www.npmjs.com/package/react-native-floating-action instead

@SiddigHope
Copy link

👍🏻 white_check_mark Hi, devs

So, edit the node_modules is bad way to solve the problem

I am using React Native with Expo CLI (RN 0.70.5, EXPO 47.0.8)

👉🏻 Follow step by step and be happy!

rocket LETS GO!!

STEP 1:

* run `yarn add --dev babel-plugin-module-resolver deprecated-react-native-prop-types`

STEP 2:

* in your root project create folder `resolver`, inside this create another folder `react-native`, inside this create `index.js` file.
  _looks like: `./resolver/react-native/index.js`_

* open the file and paste this:
import * as StandardModule from "react-native";

const deprecatedProps = {
  ImagePropTypes: require("deprecated-react-native-prop-types/DeprecatedImagePropType"),
  TextPropTypes: require("deprecated-react-native-prop-types/DeprecatedTextPropTypes"),
  ViewPropTypes: require("deprecated-react-native-prop-types/DeprecatedViewPropTypes"),
  ColorPropType: require("deprecated-react-native-prop-types/DeprecatedColorPropType"),
  EdgeInsetsPropType: require("deprecated-react-native-prop-types/DeprecatedEdgeInsetsPropType"),
  PointPropType: require("deprecated-react-native-prop-types/DeprecatedPointPropType"),
};

const imgProx = new Proxy(StandardModule.Image, {
  get(_, prop) {
    if (prop === "propTypes") return deprecatedProps.ImagePropTypes;
    return Reflect.get(...arguments);
  },
});

const txtProx = new Proxy(StandardModule.Text, {
  get(_, prop) {
    if (prop === "propTypes") return deprecatedProps.TextPropTypes;
    return Reflect.get(...arguments);
  },
});

const objProx = new Proxy(StandardModule, {
  get(_, prop) {
    if (prop in deprecatedProps) {
      return deprecatedProps[prop];
    }
    if (prop === "Image") {
      return imgProx;
    }
    if (prop === "Text") {
      return txtProx;
    }
    return Reflect.get(...arguments);
  },
});

module.exports = objProx;

STEP 3:

* Edit `babel.config.js` file:

* add in `presets` array this string: `"module:metro-react-native-babel-preset"`.

* add in `plugins` array this array:
[

       "module-resolver",
       {
         root: ["."],
         resolvePath(sourcePath, currentFile) {
           if (
             sourcePath === "react-native" &&
             !(
               (
                 currentFile.includes("node_modules/react-native/") || // macos/linux paths
                 currentFile.includes("node_modules\\react-native\\")
               ) // windows path
             ) &&
             !(
               currentFile.includes("resolver/react-native/") ||
               currentFile.includes("resolver\\react-native\\")
             )
           ) {
             return path.resolve(__dirname, "resolver/react-native");
           }
           return undefined;
         },
       },
     ]

STEP 4: run expo r -c

tada CONGRATULATIONS, YOU ARE WELCOME winkbrazil

it gives and error saying "app-root/App.js: path is not defined"
how can I fix this?

@Usama-Saud

This comment was marked as outdated.

@tult-rk
Copy link

tult-rk commented Feb 2, 2023

@SiddigHope

it gives and error saying "app-root/App.js: path is not defined"
how can I fix this?

path is missing. add

var path = require('path')

@niloriver after adding the resolvePath my alias is stopped working too, so i update the resovelvePath with:

    resolvePath(sourcePath, currentFile, opt) {
        var path = require('path')
        if (
          sourcePath === 'react-native' &&
          !(
            (
              currentFile.includes('node_modules/react-native/') || // macos/linux paths
              currentFile.includes('node_modules\\react-native\\')
            ) // windows path
          ) &&
          !(
            currentFile.includes('resolver/react-native/') ||
            currentFile.includes('resolver\\react-native\\')
          )
        ) {
          return path.resolve(__dirname, 'resolver/react-native')
        }
        var resolve = require('babel-plugin-module-resolver').resolvePath(sourcePath, currentFile, opt)
        return resolve
      },

@jongha
Copy link

jongha commented Feb 5, 2023

I had this problem with lottie-react-native. Resolved after library upgrade. I recommend checking the other libraries you depend on.

@Eshtreeli
Copy link

i face the same issue i tried every solution even i tried developers on freelancer no one could know what is wrong idont use PropTypes any where after i have done the react native index file solution another problem showed TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.style') i am really frustrated please any help!

@grkemtneri
Copy link

grkemtneri commented Apr 13, 2023

@SiddigHope

it gives and error saying "app-root/App.js: path is not defined"
how can I fix this?

path is missing. add

var path = require('path')

@niloriver after adding the resolvePath my alias is stopped working too, so i update the resovelvePath with:

    resolvePath(sourcePath, currentFile, opt) {
        var path = require('path')
        if (
          sourcePath === 'react-native' &&
          !(
            (
              currentFile.includes('node_modules/react-native/') || // macos/linux paths
              currentFile.includes('node_modules\\react-native\\')
            ) // windows path
          ) &&
          !(
            currentFile.includes('resolver/react-native/') ||
            currentFile.includes('resolver\\react-native\\')
          )
        ) {
          return path.resolve(__dirname, 'resolver/react-native')
        }
        var resolve = require('babel-plugin-module-resolver').resolvePath(sourcePath, currentFile, opt)
        return resolve
      },

TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[4], "C:\Users\gorke\Desktop\projects\mobile\resolver\react-native").UIManager.getViewManagerConfig')

I started getting such an error, how can I solve it?

version 0.71.6

@ArcherLucky
Copy link

Just look at the log and stacktraces

OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this issue May 22, 2023
Summary:
## Overview

When I implemented `ignoreLogs` it was originally just to move `console.ignoreYellowBox` over to LogBox. When I did that, I also added filtering for console messages too. My thought process was: Developers probably don't want to configure hiding logs twice, so the LogBox method can handle both.

This was a mistake. We should never hide console errors and warnings, because it completely silences important feedback to the users such as deprecation warnings. These issues should be fixed, not silenced, and since adding the silencing behavior it's clear that this feature is being abused to ignore legitimate warnings that need address.

Issue facebook#33557 is a great reason why - the correct fix for this is not to ignore the errors, it's to address the deprecation / removal of the API. Allowing an easy `ignoreLog` method to hide the problem made this migration much more painful.

Thus, we're reverting back to the pre-logbox behavior of always showing console logs, even if they're ignored by LogBox in the app UI. Hopefully, this results in more of these issue being addressed instead of ignored.

Changelog:
[General] [Changed] - Do not filter errors/warnings from console

Reviewed By: yungsters

Differential Revision: D40724661

fbshipit-source-id: de3d2db1b0c32dee96acf92c9b1ca07ba0f4e218
@yigitGoldtag

This comment was marked as outdated.

@shamp-dev
Copy link

how i solved the same problem. WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. i got this error after install react-native-camera The course of my solution, I went to the node-modules folder -> the react-native-camera folder and found the main file RNCamera.js find ViewPropTypes import

import { findNodeHandle, Platform, NativeModules, requireNativeComponent, View, ViewPropTypes, ActivityIndicator, Text, StyleSheet, PermissionsAndroid, } from 'react-native';

delete import this file from 'react-native' and create new import import {ViewPropTypes} from 'deprecated-react-native-prop-types';

and its work good

as I understand it, this is a mistake of the old npm packages, and if the project is alive, then the developers fix it in new versions. And maybe this error will go away when you update the package to a newer one.

I updated all library files having ViewPropTypes and PropTypes from "prop-types"
I changed my terminal directory to library folder (react-native-snap-carousel)
Problem I faced while updating was this package took so long to install. Might be my internet issue.

But it actually worked for me!

Thanks!!!

@facebook facebook locked as too heated and limited conversation to collaborators Sep 25, 2024
@rickhanlonii
Copy link
Member

Update

PropTypes were originally deprecated in React in 2017. React Native deprecated PropTypes in 2021.

In React 19, we’re removing the propType checks from the React package, and using them will be silently ignored.

While this may cause frustration in the short-term, forcing a migration now (after 7 years of deprecations) will increase app perf (by not running the checks) and prevent greater frustration in the future (since type systems are more robust)

This means, even if you migrate to deprecated-react-native-prop-types or apply the patches suggested in this thread, those props will not be validated in React 19, and you're opening yourself up to bugs. For this reason, I've went ahead an hidden the comments suggesting patching.

I know this is frustrating, but please migrate to a type system, or file an issue or fork in package dependencies that still use PropTypes. Locking the thread because I can't keep up with the comments recommending patching react native.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests