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

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: 2<IP_ADDRESS> - /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'.

for for 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.

same. Is there a way to remove these warnings?

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

i also get this errro. brush!

saaaaaame! :(

same..

Ignore certain logs with LogBox.ignoreLogs() https://reactnative.dev/blog/2020/07/06/version-0.63#logbox
LogBox.ignoreLogs([
"ViewPropTypes",
"ColorPropType",
])

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

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.

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

@nibblesnbits  - did you read the warning
ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

@nibblesnbits
Sorry some clarification:
PropTypes was a type checker used by React Native before Flow or TypeScript. Some older packages might be still using this. Even some newer ones as its a simple type checker.
if you are seeing these warning and don't specifically use PropTypes in your application then you can, if you wish, add the ignoreLogs above to quieten the warnings until sub packages are updated.

Okay so this is referring specifically to prop-types like in normal react.  That's what I needed clarification on.  Thanks.

From: Gnative @.>
Sent: Friday, April 8, 2022 12:50:42 PM
To: facebook/react-native @.>
Cc: Stephen Collins @.>; Mention @.>
Subject: Re: [facebook/react-native] ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'. (Issue #33557)
@nibblesnbitshttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnibblesnbits&data=04|01||52a3b81329f54c5618ed08da197febee|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637850334464326312|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=weSGgF0ApS2iNr%2FU66pnqy02XpqQNd3%2FBSxh%2BmAJPHw%3D&reserved=0
Sorry some clarification:
PropTypes was a type checker used by React Native before Flow or TypeScript. Some older packages might be still using this. Even some newer ones as its a simple type checker.
if you are seeing these warning and don't specifically use PropTypes in your application then you can, if you wish, add the ignoreLogs above to quieten the warnings until sub packages are updated.
—
Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffacebook%2Freact-native%2Fissues%2F33557%23issuecomment-1093083115&data=04|01||52a3b81329f54c5618ed08da197febee|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637850334464326312|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=7aaq%2B3SxNnH06nWJXHqt%2B4SyntZFskqdGtZ1gurdB74%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABODKJJULRA62M3SS4DXBB3VEBPWFANCNFSM5SMQA42Q&data=04|01||52a3b81329f54c5618ed08da197febee|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637850334464326312|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=YW6lVKWd6lEXce4NUrMopwNo468KKQjTk2ZgqDeKLtU%3D&reserved=0.
You are receiving this because you were mentioned.Message ID: @.***>

Same Problem here.. Anyone got solution?

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

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?

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!!

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

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 !

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

Okay for the time talking because this warning is a ball breaker until all the libraries using it update i am using .
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 come 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!",
])

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.

Hi , same error !
my sdk version 45 , the last one that came out , but I saw that this error only occurs in the last sdk , what I did to solve these warnings this command :
=>expo upgrade  version sdk ex: 44 <= passing another version of the sdk example 44 , this solved it here , the way that the expo kind of forced to upgrade , forced the error

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 place explain in simple terms how to fix this? Or do I just deal with it until dependencies fix this?

facing same issue. ignore logs has no effect on warnings

I face the same error

react 0.68.1 same warnings

Any updates on this issue? It's pretty obstructive and feels like an easy fix from the React Native community

LogBox.ignoreLogs not working on the terminal, anyone has other way?

I have the same error too, and it appears for not only ColorPropTypes but others as well, such as PointPropType, and EdgeInsetsPropType.

LogBox.ignoreLogs not working

So I understand that the suggested way to fix this is to Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types' like the warning suggests. Or if the source of the warning is a package that your code imports then you or the maintainer will need to make a PR to update that package to switch to deprecated-react-native-prop-types.
But that's clearly not an ideal solution. Quote from the Readme of react-native-deprecated-modules, the repo where deprecated-react-native-prop-types is hosted:

You shouldn't use any of these modules in your applications - there is a good replacement for each one.

and

But once you have a moment, please migrate away from the deprecated modules :) In most cases it should be easy!

So what's the "good replacement" for ViewPropTypes and other prop types that used to be exported by React Native?
@yungsters , do you have any advice here? I found your commit where you added the deprecation warning. Is the right fix to migrate to Flow or Typescript? It's fine if that's what the React team wants people to do, but it would be great to put that in the warning message instead of just telling people to use a different deprecated package.

@ajenkins, that's really good feedback. You're right that the deprecation warning should be focused on informing people of what to do to follow what is considered a better alternative (instead of proliferating usage of deprecated code).
The recommendation is indeed to use a type system like TypeScript or Flow.

@yonitou, can you try adding the call to LogBox.ignoreLogs in your index.js (the same module where you call AppRegistry.registerComponent)?
Try to make sure it happens before anything else.

For people having trouble with LogBox, is it possible that LogBox.ignoreLogs() only prevents the yellow pop-up from appearing at the bottom of your device screen? Because I'm still seeing the warnings in the console even when I use LogBox.
It would be nice to remove these warnings from the console too though. I tried using the ignore-warnings package that @goxr3plus recommended, but that's not working for me. I also tried overriding console.warn with console.warn = () => {};, but I'm still seeing the ViewPropTypes warnings. Even putting that line above the imports of the affected packages in my App.js file doesn't resolve the issue.
I'm using Expo 45 and React Native 0.68.2.

Hm, LogBox.ignoreLogs should be ignoring the default console.warn behavior as well. See this code pointer:
https://github.com/facebook/react-native/blob/b331229b06dde31ff92091a163cfabb030082925/Libraries/LogBox/LogBox.js#L152
The only reason I can think of where this fails is if you aren't calling LogBox.ignoreLogs early enough.
Can you try logging when your call to LogBox.ignoreLogs occurs, in order to investigate whether the call happens before or after the deprecation warnings? Also, try looking at the stack trace of the deprecation warning to see where in your app it is being triggered.
Alternately, look for which dependency is depending on the deprecated APIs and consider filing an issue or sending a pull request.

None of the LogBox and ignoreWarning method worked as a solution to hide console warning for me. So I had to comment these lines from react-native/index.js:
  get ViewPropTypes(): $FlowFixMe {     // console.warn(     //   'ViewPropTypes will be removed from React Native. Migrate to ' +     //     "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",     // );     return require('deprecated-react-native-prop-types').ViewPropTypes;   },
is this OK for now?

None of the LogBox and ignoreWarning methods worked as a solution to hide console warnings for me. So I had to comment on these lines from react-native/index.js:
get ViewPropTypes(): $FlowFixMe {
 // console.warn(
    //   'ViewPropTypes will be removed from React Native. Migrate to ' +
    //     "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
    // );
    return require('deprecated-react-native-prop-types').ViewPropTypes;
  },

is this OK for now?

It's not OK. You changes are temporary, it will be overridden when you update react-native.

The best solution for now is to ignore the warning as @Gnative  described.
If you used those prop types directly in your code, then all you have to do is change your import to deprecated-react-native-prop-types as described by @GitForAndrey above.
Else, then its one of the packages you installed that is using the prop type: the solution is to update the package, most packages have released an update to address the issue.
For my case, lottie-react-native - 5.0.1 is the cause of the warning, all I had to do was update to the latest version.

Hm, LogBox.ignoreLogs should be ignoring the default console.warn behavior as well. See this code pointer:
https://github.com/facebook/react-native/blob/b331229b06dde31ff92091a163cfabb030082925/Libraries/LogBox/LogBox.js#L152
The only reason I can think of where this fails is if you aren't calling LogBox.ignoreLogs early enough.
Can you try logging when your call to LogBox.ignoreLogs occurs, in order to investigate whether the call happens before or after the deprecation warnings? Also, try looking at the stack trace of the deprecation warning to see where in your app it is being triggered.
Alternately, look for which dependency is depending on the deprecated APIs and consider filing an issue or sending a pull request.

@yungsters I tried adding a console.log() to where I call LogBox.ignoreLogs() and as you suspected, the console.log() is getting logged after the deprecation warnings. Unfortunately, I've tried moving LogBox.ignoreLogs() as early in my code as possible, and it's still getting called after the deprecation warnings, which doesn't make sense.
I'm using Expo (v45), so it's possible that this is an Expo specific issue. I know which components are causing the deprecation warning (react-native-autocomplete-input and rn-range-slider), so I would've thought that putting the LogBox call before those components get imported would have been good enough. But even if I put LogBox.ignoreLogs() at the very top of my App.js file (the entry point for Expo apps), I'm still getting the deprecation warnings in the console.
I even tried putting the LogBox call at the top of node_modules/expo/AppEntry.js, which is the real entry point of the application that is referenced in "main" in my package.json file. Here's what that code looks like:
// Added these three lines
import { LogBox } from "react-native";
console.log("LogBox.ignoreLogs()");
LogBox.ignoreLogs(["ViewPropTypes"]);

import registerRootComponent from 'expo/build/launch/registerRootComponent';

import App from '../../App';

registerRootComponent(App);

And here's what I see in my console output when I run my app:
› Reloading apps
iOS Bundling complete 114ms
 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  ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
 LOG  LogBox.ignoreLogs()

@ajenkins, the deprecation warnings should include a stack trace. Are you able to find that and share it?
The stack trace should be able to provide a precise explanation for what is causing the deprecation warning to be logged.
If you aren't able to find the stack trace, you can try modifying the ViewPropTypes getter method to explicitly log new Error().stack to your console.

I was only able to get a screenshot of the stack trace from within my app. TagAutocomplete.js, NewTagAutocomplete.js, index.js (the line 4 one), AboutMe.js, InitialAccountSetup.js, and App.js are files in my application.

I also created a minimal reproduction of the LogBox issue if you want to test this for yourself.
Steps to reproduce:

Open https://snack.expo.dev/@ajenkins01/logbox-test
Make sure you're using Expo 45 (bottom right corner)
Switch from Web to My Device (the issue disappears if you use Web for some reason)
Scan the QR code with a device that has Expo Go installed
Open the Logs console
Reload the app if necessary7.

Notice that the warnings disappear if you comment out the import of Autocomplete. LogBox.ignoreAllLogs() doesn't appear to do anything.
Screenshot of what you should see:

This is what I did and this solve my problems.
`
const ignoreWarns = [
"Setting a timer for a long period of time",
"VirtualizedLists should never be nested inside plain ScrollViews with the same orientation",
"ViewPropTypes will be removed",
"AsyncStorage has been extracted from react-native",
"EventEmitter.removeListener",
];
const warn = console.warn;
console.warn = (...arg) => {
for (let i = 0; i < ignoreWarns.length; i++) {
if (arg[0].startsWith(ignoreWarns[i])) {
return;
}
}
warn(...arg);
};
LogBox.ignoreLogs(ignoreWarns);`

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

I guess so hahahaha

My console logs are totally useless now with this deprecation warning for a feature I have never used.

I ended up manually editing all those packages were using this. 😞

Thanks for sharing the Snack and details, @ajenkins.
I investigated this a bit, and I think this might be because the console.warn wrapper logic gets installed via LogBox (in react-native) before the __expoConsoleLog wrapper logic gets installed (in expo). I'll reach out to folks that maintain Expo to confirm.
Also, here is a Snack that offers a simpler repro of LogBox.ignoreLogs being ignored: https://snack.expo.dev/@yungsters/logbox-ignore-logs

@yungsters I agree that this is probably an issue with Expo. Let me know if you want me to open an issue in their repo. Just checked, and I'm not seeing any open (or closed) issues related to LogBox.
I'm curious though if anyone else in this thread is not using Expo (using react-native directly) and still having this issue with the warnings not getting ignored.

lot
thanks i updated "lottie-react-native": "5.1.3" and fixed the problem

@ajenkins I have the same issue and I also use Expo :(
This is soooooo annoying!
Thank you in advance if you will open an issue on Expo too..

ViewPropTypes has been removed from React Native when I upgrade to 0.68.2. So what is solution for now, it always show the redbox and I can't use the app

@nhatnguyenbp I can't use my app too so I have to remove the package cause the error, and I get the package name after try to build it with eas

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?

in your app.js file

Tried all the suggestions above with no luck... so until the warnings are resolved, here's my temporary solution:
Remove console.warn found here, followed by patch-package.

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

Heyy bosss nice answer

Perhaps we all take it upon ourselves to personally message the package authors to push an update and fix this error for everyone? :)
I have tried adding the following to the top of my index.js and app.js with no success.
import {LogBox} from "react-native";
LogBox.ignoreLogs([ "ViewPropTypes will be removed from React Native."])

LogBox.ignoreLogs([ "ViewPropTypes will be removed from React Native."])

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

@adiakritos Try this

LogBox.ignoreLogs([ "ViewPropTypes will be removed from React Native."])

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

@adiakritos Try this

This worked. Thank you!

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

Thank. It worked

Temporary solution.
ignoreWarnings.js
import { LogBox } from "react-native";

if (__DEV__) {
  const ignoreWarns = [
    "EventEmitter.removeListener",
    "[fuego-swr-keys-from-collection-path]",
    "Setting a timer for a long period of time",
    "ViewPropTypes will be removed from React Native",
    "AsyncStorage has been extracted from react-native",
    "exported from 'deprecated-react-native-prop-types'.",
    "Non-serializable values were found in the navigation state.",
    "VirtualizedLists should never be nested inside plain ScrollViews",
  ];

  const warn = console.warn;
  console.warn = (...arg) => {
    for (const warning of ignoreWarns) {
      if (arg[0].startsWith(warning)) {
        return;
      }
    }
    warn(...arg);
  };

  LogBox.ignoreLogs(ignoreWarns);
}

App.js
// import at the very top of everything.
import "../ignoreWarnings";

Thank. It worked

Be careful with this solution. It works, but it breaks the way react-native logs errors.
It was producing this error but wasn't able to trace where it was coming from:
TypeError: null is not an object (evaluating 'keys.filter')
This is a screenshot of where the error was happening:

I couldn't trace the source of this error until I could reproduce it in other simpler apps. It only happens with certain types of errors.
I think it has something to do with the way it appears to overwrite the console.warn method, but I'm not sure. All I know is that the last 6 days have been a challenge to spot this!

I go this error when i run this command: npx react-native run-android on macos
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.

Please someone helppppppppp!

when i run npx react-native run-android this error will show:

Configure project :lottie-react-native
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

Configure project :react-native-reanimated

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date
FAILURE: Build failed with an exception.

Where:
Build file '/Volumes/Os/FinalDrawer/node_modules/react-native-reanimated/android/build.gradle' line: 152

What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.

Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 5s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.

Where:
Build file '/Volumes/Os/FinalDrawer/node_modules/react-native-reanimated/android/build.gradle' line: 152

What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.

Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 5s
at makeError (/Volumes/Os/FinalDrawer/node_modules/execa/index.js:174:9)
at /Volumes/Os/FinalDrawer/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Volumes/Os/FinalDrawer/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Volumes/Os/FinalDrawer/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.
192:FinalDrawer apple$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1234 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

Configure project :lottie-react-native
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

Configure project :react-native-reanimated

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date
FAILURE: Build failed with an exception.

Where:
Build file '/Volumes/Os/FinalDrawer/node_modules/react-native-reanimated/android/build.gradle' line: 152

What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.

Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 5s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.

Where:
Build file '/Volumes/Os/FinalDrawer/node_modules/react-native-reanimated/android/build.gradle' line: 152

What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.

Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 5s
at makeError (/Volumes/Os/FinalDrawer/node_modules/execa/index.js:174:9)
at /Volumes/Os/FinalDrawer/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Volumes/Os/FinalDrawer/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Volumes/Os/FinalDrawer/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.

@korayerdem89  why?

@nibblesnbits
Sorry I was still reacting to your initial sarcastic comment, some clarification:
PropTypes was a type checker used by React / React Native before Flow or TypeScript. This is the 'old' documentation for PropTypes from React 15.5 - https://reactjs.org/docs/typechecking-with-proptypes.html
React Native has, did have, various PropType shapes such as ViewPropType, StylePropType, ColourPropType etc...
If you are seeing these warnings and don't specifically use PropTypes in your application then you can, if you wish, use the LogBox.ignoreLogs([]) to silence the warnings until sub packages are updated.
for example:
import {LogBox} from "react-native";

LogBox.ignoreLogs([
"ViewPropTypes will be removed",
"ColorPropType will be removed",
])

or you could use, below, to silence all PropType warnings
import {LogBox} from "react-native";

LogBox.ignoreLogs([
"exported from 'deprecated-react-native-prop-types'.",
])

Hi @Gnative it's quite strange that - in fact - I receive this error (not warning) while I don't have anywhere any PropTypes in my application.
Do you have any clue?
Many thanks
Stefano

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.

hi, did you solve it? I've copied and paste as well, but still remains.
Many thanks

@smanzini I would think this is because a dependency of your application is using those depreciated React Native PropTypes

GitForAndrey

como resolví el mismo problema. WARN ViewPropTypes se eliminará de React Native. Migrar a ViewPropTypes exportados desde 'deprecated-react-native-prop-types'. Recibí este error después de instalar react-native-camera El curso de mi solución, fui a la carpeta de módulos de nodo -> la carpeta de react-native-camera y encontré el archivo principal RNCamera.js find ViewPropTypes import
import { findNodeHandle, Platform, NativeModules, requireNativeComponent, View, ViewPropTypes, ActivityIndicator, Text, StyleSheet, PermissionsAndroid, } from 'react-native';
elimine la importación de este archivo de 'react-native' y cree una nueva importación import {ViewPropTypes} de 'deprecated-react-native-prop-types';
y su trabajo bueno
Según tengo entendido, este es un error de los paquetes npm antiguos, y si el proyecto está vivo, los desarrolladores lo arreglan en las nuevas versiones. Y tal vez este error desaparezca cuando actualice el paquete a uno más nuevo.

This actually works and you remove the Warning without removing ViewPropTypes.
Thank you

Hey,
https://stackoverflow.com/questions/72755476/invariant-violation-viewproptypes-has-been-removed-from-react-native-migrate-t
checkout the first solution hope it helps

This solution above will be overwritten if you reinstall or update your packages. Not really a good idea to edit files with in node_modules.
If a dependancy has not updated to use 'deprecated-react-native-prop-types' you could use patch-package which will help to persist changes you make to to any dependancies.
It would also be good to create a Pull Request for any dependancies to fix these issues and if the maintainer is slow to update then you could also use a forked version of the package with your changes.

run expo doctor --fix-dependencies.  note the dependencies that are incompatible with the installed expo package version and and upgrade (or downgrade) to versions suggested in the logs.
In my case, i was using an updated version of react-native so  i had to downgrade it and it fixed the issue.

@smanzini I would think this is because a dependency of your application is using those depreciated React Native PropTypes

@Gnative thanks, meanwhile I've resolved rolling back to RN 0.66.3 :-)

I go this error when i run this command: npx react-native run-android on macos 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.

faced the same issue when tried to upgrade RN 66 up to 69. 😠

After battling this issue for hours, I accepted that there's no way to eliminate it without messing with the node_modules but when you have over five libraries using it, it's an absolute pain!
I commented out this line:
get ViewPropTypes(): $FlowFixMe {
   invariant(
     false,
     'ViewPropTypes has been removed from React Native. Migrate to ' +
       "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
   );
 },

in node_modules/react-native/exports
It seems to be how React Native enforces the error. Commenting them out allows your project to run.

With react-native Version 0.69.1, it seems that the deprecation message is now an ERROR (rather than a warning), which stops the app from even starting. I am getting the error message below as a result of the command npx react-native run-android. Obviously, the LogBox workaround does NOT work in this case because the app never starts!
For troubleshooting purposes, I removed any reference to the library react-native-pdf, which has import { ViewPropTypes } from 'react-native'. However, this was not enough to get rid of the error.
 ERROR  Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'., js engine: hermes
 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., js engine: hermes
 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., js engine: hermes

Experiencing the exact same issue... really frustrated. Any ideas?

With react-native Version 0.69.1, it seems that the deprecation message is now an ERROR (rather than a warning), which stops the app from even starting. I am getting the error message below as a result of the command npx react-native run-android. Obviously, the LogBox workaround does NOT work in this case because the app never starts!
For troubleshooting purposes, I removed any reference to the library react-native-pdf, which has import { ViewPropTypes } from 'react-native'. However, this was not enough to get rid of the error.
 ERROR  Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'., js engine: hermes
 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., js engine: hermes
 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., js engine: hermes

Experiencing the exact same issue... really frustrated. Any ideas?

The following is a work around for the react-native-pdf issue:  #669
tldr: In package.json replace "react-native-pdf": "6.5.0" with "react-native-pdf": "https://github.com/wonday/react-native-pdf.git"
This doesn't appear to be an issue with react-native itself but more so to do with libraries that haven't yet been updated to support the latest RN version.

React Native migrations are so painfull... This is what I did to avoid crash and be able to update to v0.69.1. Thanks @stanjhae for the tip!
On react-native v0.69.1:

Install yarn add deprecated-react-native-prop-types.
Replace the corresponding lines in node_modules/react-native/index.js with:

  // Deprecated Prop Types
  get ColorPropType(): $FlowFixMe {
    console.warn(
      'ColorPropType has been removed from React Native! This is a patch. ' +
        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ColorPropType;
  },
  get EdgeInsetsPropType(): $FlowFixMe {
    console.warn(
      'EdgeInsetsPropType has been removed from React Native! This is a patch. ' +
        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
  },
  get PointPropType(): $FlowFixMe {
    console.warn(
      'PointPropType has been removed from React Native! This is a patch.  ' +
        "PointPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').PointPropType;
  },
  get ViewPropTypes(): $FlowFixMe {
    console.warn(
      'ViewPropTypes has been removed from React Native! This is a patch. ' +
        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ViewPropTypes;
  },

Use patch-package to save changes.

React Native migrations are so painfull... This is what I did to avoid crash and be able to update to v0.69.1. Thanks @stanjhae for the tip!
On react-native v0.69.1:
1. Install `yarn add deprecated-react-native-prop-types`.

2. Replace the corresponding lines in `node_modules/react-native/index.js` with:

  // Deprecated Prop Types
  get ColorPropType(): $FlowFixMe {
    console.warn(
      'ColorPropType has been removed from React Native! This is a patch. ' +
        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ColorPropType;
  },
  get EdgeInsetsPropType(): $FlowFixMe {
    console.warn(
      'EdgeInsetsPropType has been removed from React Native! This is a patch. ' +
        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
  },
  get PointPropType(): $FlowFixMe {
    console.warn(
      'PointPropType has been removed from React Native! This is a patch.  ' +
        "PointPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').PointPropType;
  },
  get ViewPropTypes(): $FlowFixMe {
    console.warn(
      'ViewPropTypes has been removed from React Native! This is a patch. ' +
        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ViewPropTypes;
  },

3. Use `patch-package` to save changes.

Is this a temporary solution? Will there be a new update?

i have the same issue i have done many of steps mentioned but stell not working

Check this thread @adelphysi1986 https://github.com/facebook/react-native/issues/33734

https://stackoverflow.com/a/72575759/17672428

https://stackoverflow.com/a/72575759/17672428

Doesn't work for me

Hello everyone, i am facing kind of the same issue after trying to upgrade or project to RN 0.69.2 , the app builds successfully but after the bundle gets installed on device it crashes with:

I am battling this the last two days adn tried everything mentioned in the comments here and on #33734 but nothing worked in my case, any solid solution would be really appreciated

Hello everyone, i am facing kind of the same issue after trying to upgrade or project to RN 0.69.2 , the app builds successfully but after the bundle gets installed on device it crashes with:

I am battling this the last two days and tried everything mentioned in the comments here and on #33734 but nothing worked in my case, any solid solution would be really appreciated

This is what worked for me:
https://github.com/facebook/react-native/issues/33734#issuecomment-1190504278

The person who decided to make this a breaking change was very inspired.

Hello everyone, i am facing kind of the same issue after trying to upgrade or project to RN 0.69.2 , the app builds successfully but after the bundle gets installed on device it crashes with:

I am battling this the last two days and tried everything mentioned in the comments here and on #33734 but nothing worked in my case, any solid solution would be really appreciated

This is what worked for me:
#33734 (comment)

Coming in after days of tweeking the app from the old version to run into 0.69, yes this helps, but coming from a large scale project to upgrade version there will be more changes needed to be done in code and configuration that expected, anyway thanks  a lot

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.

@rStarNarayan you need to upgrade or patch your 3rd party dependencies which use it

ViewPropTypes

thank you,

With react-native Version 0.69.1, it seems that the deprecation message is now an ERROR (rather than a warning), which stops the app from even starting. I am getting the error message below as a result of the command npx react-native run-android. Obviously, the LogBox workaround does NOT work in this case because the app never starts!
For troubleshooting purposes, I removed any reference to the library react-native-pdf, which has import { ViewPropTypes } from 'react-native'. However, this was not enough to get rid of the error.
 ERROR  Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'., js engine: hermes
 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., js engine: hermes
 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., js engine: hermes

same issue. from RN v0.65.0 to 0.69.4
I've been updating my project cuz it needs to on the latest versions. A bit frustrated to have come here after finally building the app properly after all the updates 😪

@choonese just patch it. Don't forget to make patches, it's not so hard. This is the way…

The package react-native-snap-carousel has the same problem. This repository use ViewPropTypes. Update your repositories ou comment for find this problems

I found out !
Check the call stack of the error

The person who decided to make this a breaking change was very inspired.

It's also not even listed in the breaking changes...

Hey all, sorry for the delay here!
We're in the process of removing PropTypes from React Native. As part of this process, we will first introduce a deprecation warning and then remove the proptypes in a future version.
Because of this it is not recommended to ignore the warning as some comments above suggest (I've hidden those comments as outdated to prevent confusion). If you ignore the warning then in a future version you will hit issues like https://github.com/facebook/react-native/issues/33734 when we fully remove the deprecated code.
Recommended Fix
The recommended fix is to find the code that is using PropTypes and switch the import from:
import { ViewPropTypes } from 'react-native';

to:
import { ViewPropTypes } from 'deprecated-react-native-prop-types';

Sometimes, a library you depend on may be using the PropTypes. In that case, it's recommended to submit an issue or PR to the library and/or update to the latest version. In extreme cases (like the library you're using is unmaintained) you may need to fork the library.

For anyone using Typescript you can achieve this functionality pretty easily:
import { View } from 'react-native';

type ViewPropTypes = React.ComponentProps<typeof View>;

@apiel51 the issue is almost never that someone doesn't know how to tweak their own code to handle the deprecation. The issue is that it breaks hundreds of libraries.

@Slapbox fair enough!

Just pointing people at a deprecated- prefixed version doesn't really seem like a solution. Is this replaced by nothing? Is there no new correct way to implement these propTypes?

React Native migrations are so painfull... This is what I did to avoid crash and be able to update to v0.69.1. Thanks @stanjhae for the tip!
On react-native v0.69.1:
1. Install `yarn add deprecated-react-native-prop-types`.

2. Replace the corresponding lines in `node_modules/react-native/index.js` with:

  // Deprecated Prop Types
  get ColorPropType(): $FlowFixMe {
    console.warn(
      'ColorPropType has been removed from React Native! This is a patch. ' +
        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ColorPropType;
  },
  get EdgeInsetsPropType(): $FlowFixMe {
    console.warn(
      'EdgeInsetsPropType has been removed from React Native! This is a patch. ' +
        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
  },
  get PointPropType(): $FlowFixMe {
    console.warn(
      'PointPropType has been removed from React Native! This is a patch.  ' +
        "PointPropType exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').PointPropType;
  },
  get ViewPropTypes(): $FlowFixMe {
    console.warn(
      'ViewPropTypes has been removed from React Native! This is a patch. ' +
        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
    );
    return require('deprecated-react-native-prop-types').ViewPropTypes;
  },

3. Use `patch-package` to save changes.

Is this a temporary solution? Will there be a new update?

Fine!   work for me.  Thanks!

So we're now being FORCED  to use TypeScript??

Is this replaced by nothing? Is there no new correct way to implement these propTypes? Why is it deprecated?

@Slapbox this is replaced by either deprecated-react-native-prop-types, or an actual type system like Typescript. It's deprecated because since the original React prop-types system was created, more powerful type systems like Typescript have emerged and are now a more popular and recommended solution to typing components. By removing these types, users who use a type system won't need to pay the cost of including proptypes in the package itself.

I posted an update here on how we're improving the error reporting on this to make it easier to find the component or library that is using the deprecated prop types.

To all those who say replace the import to
import { ViewPropTypes } from 'deprecated-react-native-prop-types';

Then what is the purpose of depreciation? If it's deprecated, then why should we still import it from a new deprecated module?
Something is going wrong here...

You should move to typescript and stop using prop types long term. I guess
the deprecated module is to buy time before moving into ts.
On Sun 18 Sep 2022 at 11:03 a.m. Mohammad Azimi @.***>
wrote:

To all those who say replace the import to
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
Then what is the purpose of depreciation? If it's deprecated, then why
should we still import it from a new deprecated module?
Something is going wrong here...
—
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/33557#issuecomment-1250337940,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABIPP4ZOB56RL5VFYNLZUDV644MTANCNFSM5SMQA42Q
.
You are receiving this because you commented.Message ID:
@.***>

You should move to typescript and stop using prop types long term. I guess the deprecated module is to buy time before moving into ts.
…
On Sun 18 Sep 2022 at 11:03 a.m. Mohammad Azimi @.> wrote: To all those who say replace the import to import { ViewPropTypes } from 'deprecated-react-native-prop-types'; Then what is the purpose of depreciation? If it's deprecated, then why should we still import it from a new deprecated module? Something is going wrong here... — Reply to this email directly, view it on GitHub <#33557 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIPP4ZOB56RL5VFYNLZUDV644MTANCNFSM5SMQA42Q . You are receiving this because you commented.Message ID: @.>

makes sense now. tnx

Hi, I'm having the same issue but for me, the error occurs when trying to import a component that's exported by default but an index.ts file exports it as a named component.
If I switch to import it as default the error is gone... seems different from what all are talking about when they have this error that's why I'm asking if it's related in some way.
Example:
src/components/test/index.tsx
const Test = () => {return <View><Text>Testing</Text></View>}
export default Test;

src/components/index.ts
export {default as Test} from './components/test';
when importing the  component like:
import {Test} from 'components';
We are getting the above error with ViewPropTypes, BUT:
if we import the component as:
import Test from 'components/test'
### everything is working as expected w/o any error;

warning you have a library containing ViewPropTypes in react-native -> it will not be supported
to fix:
step 1. Find: import ViewPropTypes from 'react-native'; you can search in libr from node_modules
step 2. replace all with: import ViewPropTypes from 'deprecated-react-native-prop-types';

Hello everyone!
I would like to share my solution and hope it will be helpful for you.
let me know if you know a better solution :)
We are needed following packages:
https://www.npmjs.com/package/patch-package
https://www.npmjs.com/package/deprecated-react-native-prop-types
Steps:

yarn add patch-package deprecated-react-native-prop-types
Set up patch package (ref to the doc above)
Open node_modules/react-native/index.js
Find // Deprecated Prop Types and replace deprecated types below with these:

// 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;
  },

execute from the project root: npx patch-package react-native
try to find [project]/patches/react-native.patch
everything done

My patch file looks like this:
diff --git a/node_modules/react-native/index.js b/node_modules/react-native/index.js
index d59ba34..4a640e3 100644
--- a/node_modules/react-native/index.js
+++ b/node_modules/react-native/index.js
@@ -435,32 +435,16 @@ module.exports = {
   },
   // Deprecated Prop Types
   get ColorPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'ColorPropType has been removed from React Native. Migrate to ' +
-        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ColorPropType;
   },
   get EdgeInsetsPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
-        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
   },
   get PointPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'PointPropType has been removed from React Native. Migrate to ' +
-        "PointPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').PointPropType;
   },
   get ViewPropTypes(): $FlowFixMe {
-    invariant(
-      false,
-      'ViewPropTypes has been removed from React Native. Migrate to ' +
-        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ViewPropTypes;
   },
 };

Hi all, I can confirm that the solution shared by, @qDanik, should work I implemented my own same solution using the package-package after manually changing in node-modules the issue with React Native deprecates the ViewPropTypes.
Basically, you have to add them back for now as a solution and use patch-package to persist the changes made in the node_modules.
PS: Make sure you add package-package also in scrips as "postinstall": "patch-package" so when you install something you will overwrite rn with the patches folder content created after installing the lib.
Hope helps :)

I've searched the node-modules and changed every import from the "deprecated-react-native-prop-types" but the app crashes with this error  "Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-type".  I don't know which package may be importing ViewPropTypes incorrectly, I checked twice and couldn't find any incorrect import. Does anyone know how to find the node-module that still imports ViewPropTypes from react-native?

@qDanik your solution worked. Any idea how do I find which packages are the ones importing deprecated ViewProptypes?

@Mihai-github I've applied the solution but still get the same error. Do you know if there is a way to see which other files may have the incorrect import?

@cassde have you added the patch-package after you did the changes and added as a postinstall and also npm install or yarn install or anything you are using to install packages?

@Mihai-github yes, and I haven't installed any new packages after that so I'm not sure where the error is coming from. I also searched all the node modules and every one of them has the correct import now, but somehow I still get this error.

move to TypeScript should not be the solution

@qDanik your solution worked. Any idea how do I find which packages are the ones importing deprecated ViewProptypes?

You shouldn't find any dependencies insecure another packages. Just make a patch for the react-native package and everything will work well.
P.S. Don't forget to setup patch-packages as described in the library guide. I mean post install and etc.

@qDanik you are a genius man! It works for me.

[Solved] ERROR Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from ‘deprecated-react-native-prop-types’

@hramos @javache @RSNara
The above comment appears to be SEO spam. I'd suggest the user be muted or banned from posting in the issues for this repository.

After patching the package (see qDanik's solution) if you still see an error like this you'll need to patch the library (node-modules/react-native/index.js) even further.
TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.source')
Add this on top somewhere
import { ImagePropTypes, TextPropTypes } from 'deprecated-react-native-prop-types';

Then find the part where:
get Image(): Image {
    return require('./Libraries/Image/Image')
  },

and patch it with
get Image(): Image {
    return {
      propTypes: ImagePropTypes,
      ...require('./Libraries/Image/Image')
    }
  },

Apply this to other components that complain eg. get Text(): Text {
then run the patch-package again so it'll regenerate the patch file.
Errors are not very visible if you're using hermes. Just disable hermes to see see the errors and after fixing it you can re-enable it.

People who are saying "Move to typescript" My project currently uses typescript, but I'm not understanding how to make the changes to "move to typescript"
Please help! Thank you

People who are saying "Move to typescript" My project currently uses typescript, but I'm not understanding how to make the changes to "move to typescript"
Please help! Thank you

Use my solution provided above.

this is the solution to error/warning. But it likes wrong way edit node_modules and patch it.

Why react-native doesn't import "deprecated" module by default in case it is installed?
Why expo-cli doesn't import "deprecated" module by default in case it is used by default template?
someone have another solution that not need to edit "node_modules" folder?

Hello everyone!
I would like to share my solution and hope it will be helpful for you. let me know if you know a better solution :)
We are needed following packages: https://www.npmjs.com/package/patch-package https://www.npmjs.com/package/deprecated-react-native-prop-types
Steps:

yarn add patch-package deprecated-react-native-prop-types
Set up patch package (ref to the doc above)
Open node_modules/react-native/index.js
Find // Deprecated Prop Types and replace deprecated types below with these:

// 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;
  },

execute cmd from the project root: npx patch-package react-native
Let's try to find [project]/patches/react-native.patch
Congrats!

My patch file looks like this:
diff --git a/node_modules/react-native/index.js b/node_modules/react-native/index.js
index d59ba34..4a640e3 100644
--- a/node_modules/react-native/index.js
+++ b/node_modules/react-native/index.js
@@ -435,32 +435,16 @@ module.exports = {
   },
   // Deprecated Prop Types
   get ColorPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'ColorPropType has been removed from React Native. Migrate to ' +
-        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ColorPropType;
   },
   get EdgeInsetsPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
-        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
   },
   get PointPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'PointPropType has been removed from React Native. Migrate to ' +
-        "PointPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').PointPropType;
   },
   get ViewPropTypes(): $FlowFixMe {
-    invariant(
-      false,
-      'ViewPropTypes has been removed from React Native. Migrate to ' +
-        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ViewPropTypes;
   },
 };

For anyone that is actually using TypeScript in their code base and is really confused about what they need to do, here's what I figured out:

Specifically in my case, I'm working on a code base that was migrated from JS to TypeScript but it wasn't fully refactored, so there are remains of PropTypes, hence my confusion
PropTypes are a runtime way to enforce type checking on your props, for example a style prop
It works by extending your component with the propTypes attribute where each key is a prop name and the value is the PropType, for example:

...
import { ViewPropTypes } from "react-native";

class MyCustomButton extends Component {
  ...
}
// Can be defined inside the class above as well
MyCustonButton.propTypes = {
  style: ViewPropTypes.style;
}

ViewPropTypes holds definitions for the types of each prop in ViewProps, so the type for the style prop is ViewPropTypes.style which is actually a runtime validator for ViewProps.style
However, since you are using TypeScript, you don't need runtime validations, you need valid TypeScript that uses the right types.
So remove any propTypes declarations and re-write your component in a TypeScript way, as for the above example:

import { ViewStyle } from "react-native";

interface MyCustomButtonProps {
  style: ViewStyle;
}

class MyCustonButton extends Component {
  public constructor(props: MyCustomButtonProps) {
    ...
  }
  ...
}

For each type you need to change, find the prop in the @types/react-native/index.d.ts file and use the type of that prop.
I hope this helps!
(As for dependencies that are getting broken, you need to either upgrade them / patch them)

@ucheNkadiCode see my comment above on how to fix your TypeScript project

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?

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.

Hi, devs
So, edit node_modules is not good 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!

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

CONGRATULATIONS, YOU ARE WELCOME 😉🇧🇷

This is the solution for error/warning WORKS! But, looks like wrong way. Edit node_modules and run patch it?!

Why react-native doesn't import "deprecated" module by default in case it is installed?
Why expo-cli doesn't import "deprecated" module by default in case it is used by default template?
someone have another solution that not need to edit "node_modules" folder?

Hello everyone!
I would like to share my solution and hope it will be helpful for you. let me know if you know a better solution :)
We are needed following packages: https://www.npmjs.com/package/patch-package https://www.npmjs.com/package/deprecated-react-native-prop-types
Steps:

yarn add patch-package deprecated-react-native-prop-types
Set up patch package (ref to the doc above)
Open node_modules/react-native/index.js
Find // Deprecated Prop Types and replace deprecated types below with these:

// 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;
  },

execute cmd from the project root: npx patch-package react-native
Let's try to find [project]/patches/react-native.patch
Congrats!

My patch file looks like this:
diff --git a/node_modules/react-native/index.js b/node_modules/react-native/index.js
index d59ba34..4a640e3 100644
--- a/node_modules/react-native/index.js
+++ b/node_modules/react-native/index.js
@@ -435,32 +435,16 @@ module.exports = {
   },
   // Deprecated Prop Types
   get ColorPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'ColorPropType has been removed from React Native. Migrate to ' +
-        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ColorPropType;
   },
   get EdgeInsetsPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
-        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
   },
   get PointPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'PointPropType has been removed from React Native. Migrate to ' +
-        "PointPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').PointPropType;
   },
   get ViewPropTypes(): $FlowFixMe {
-    invariant(
-      false,
-      'ViewPropTypes has been removed from React Native. Migrate to ' +
-        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ViewPropTypes;
   },
 };

I find solution without edit NODE_MODULES, look here: https://github.com/facebook/react-native/issues/33557#issuecomment-1347241805

Thank you!!! You helped a lot.

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:

.../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'));
.../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

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?

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; }

@niloriver my "alias" stopped working too. How you resolve that?
with this code?

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; }

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

👍🏻 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?

I was having the same error and was lucky to resolve it within a short time. In my case, I followed the following steps:

Install the patch-package by going to this website.

https://www.npmjs.com/package/patch-package

Install deprecated-react-native-prop-types –

npm install deprecated-react-native-prop-types
OR
yarn add deprecated-react-native-prop-types

Go to node_modules/react-native/index.js and change this starting from:

// Deprecated Prop Types  get ColorPropType(): $FlowFixMe {    invariant(      false,      "ColorPropType has been removed from React Native. Migrate to " +        "ColorPropType exported from 'deprecated-react-native-prop-types'.",   );  },  get EdgeInsetsPropType(): $FlowFixMe {    invariant(      false,      "EdgeInsetsPropType has been removed from React Native. Migrate to " +        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",    );  },  get PointPropType(): $FlowFixMe {    invariant(      false,      "PointPropType has been removed from React Native. Migrate to " +       "PointPropType exported from 'deprecated-react-native-prop-types'.",   );  },  get ViewPropTypes(): $FlowFixMe {   invariant(     false,     "ViewPropTypes has been removed from React Native. Migrate to " +       "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",   );  },

With this:

// 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
},

Save patch by running this command

npx patch-package react-native
Rebuild App
Note: If you upgrade react-native, you will need to reapply this patch.

@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
      },

I had this problem with lottie-react-native. Resolved after library upgrade.

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!

@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?

Just look at the log and stacktraces

This is the solution for error/warning WORKS! But, looks like wrong way. Edit node_modules and run patch it?!

Why react-native doesn't import "deprecated" module by default in case it is installed?
Why expo-cli doesn't import "deprecated" module by default in case it is used by default template?
someone have another solution that not need to edit "node_modules" folder?

Hello everyone!
I would like to share my solution and hope it will be helpful for you. let me know if you know a better solution :)
We are needed following packages: https://www.npmjs.com/package/patch-package https://www.npmjs.com/package/deprecated-react-native-prop-types
Steps:

yarn add patch-package deprecated-react-native-prop-types
Set up patch package (ref to the doc above)
Open node_modules/react-native/index.js
Find // Deprecated Prop Types and replace deprecated types below with these:

// 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;
  },

execute cmd from the project root: npx patch-package react-native
Let's try to find [project]/patches/react-native.patch
Congrats!

My patch file looks like this:
diff --git a/node_modules/react-native/index.js b/node_modules/react-native/index.js
index d59ba34..4a640e3 100644
--- a/node_modules/react-native/index.js
+++ b/node_modules/react-native/index.js
@@ -435,32 +435,16 @@ module.exports = {
   },
   // Deprecated Prop Types
   get ColorPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'ColorPropType has been removed from React Native. Migrate to ' +
-        "ColorPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ColorPropType;
   },
   get EdgeInsetsPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
-        "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
   },
   get PointPropType(): $FlowFixMe {
-    invariant(
-      false,
-      'PointPropType has been removed from React Native. Migrate to ' +
-        "PointPropType exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').PointPropType;
   },
   get ViewPropTypes(): $FlowFixMe {
-    invariant(
-      false,
-      'ViewPropTypes has been removed from React Native. Migrate to ' +
-        "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
-    );
+    return require('deprecated-react-native-prop-types').ViewPropTypes;
   },
 };

Thank you bro , it works for me <3

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!!!

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.