Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

View.propTypes has been deprecated #1352

Closed
sargunv opened this issue May 3, 2017 · 45 comments
Closed

View.propTypes has been deprecated #1352

sargunv opened this issue May 3, 2017 · 45 comments
Labels

Comments

@sargunv
Copy link

sargunv commented May 3, 2017

I'm using React Native 0.44 with React Navigation 1.0.0-beta.9 and I'm getting the warning "View.propTypes has been deprecated and will be removed in a future version of ReactNative. Use ViewPropTypes instead." when using a TabNavigator.

Relevant commit (I think): facebook/react-native@53905a5

@hdsenevi
Copy link

hdsenevi commented May 4, 2017

Yep, seeing the same thing. I'm using

  • react-native : "0.44.0",
  • react-navigation : "^1.0.0-beta.9",

@JeremyZheng
Copy link

very annoying...

@tulin745
Copy link

tulin745 commented May 4, 2017

me too

@brenordr
Copy link

brenordr commented May 4, 2017

I see this warning everywhere, many components that I use in react native throw it, and most of then don't even use View.propTypes at all (or even use a component that use it),
Any ideas how this warning can be fixed? I'll be happy to explore the ideas and submit a PR here too.

@zhaiyjgithub
Copy link

me too.

@ztplz
Copy link

ztplz commented May 5, 2017

same problem

@tslearn
Copy link

tslearn commented May 5, 2017

me too.

@cielu
Copy link

cielu commented May 5, 2017

强迫症的原因,有个警告很不舒服,所以找到了该文件,把他改掉就行。
目录:node_modules/react-native-tab-view/src/TabViewAnimated.js 第78行,的View.propTypes 改成 ViewPropTypes ,并且在第5行的导入中,增加ViewPropTypes的导入

replace View.propTypes to ViewPropTypes in file node_modules/react-native-tab-view/src/TabViewAnimated.js at line 78 , and import ViewPropTypes at line 5

@keeleycarrigan
Copy link

Getting really angry with React Navigation. NavigationExperimental has officially been removed in RN 0.44 and I can't even get an example project running properly by just running yarn add react-navigation. I have to specifically point it at that project's master. I guess my app is stuck at RN 0.43 because everything isn't ready to port. This is terrible.

@mhmdfy
Copy link

mhmdfy commented May 7, 2017

I have the same problem, and I would rather not have to modify files in node_module folder as it is usually not tracked.

@hdsenevi
Copy link

hdsenevi commented May 8, 2017

I know this is not a fix, but I didn't want to dismiss this warning all the time when I was testing so I ended up doing the following. Hope it helps someone.

console.ignoredYellowBox = ['Warning: View.propTypes'];

This will ignore that specific warning but would show any other warnings (if any)

@slonak79
Copy link

slonak79 commented May 8, 2017

We're also seeing this warning.

    Warning: View.propTypes has been deprecated and will be removed in a future version of ReactNative. Use ViewPropTypes instead.

react-native@0.44.0
react-navigation@1.0.0-beta.7

@xavieracostapolo
Copy link

esta solución me funciono @cielu "replace View.propTypes to ViewPropTypes in file node_modules/react-native-tab-view/src/TabViewAnimated.js at line 78 , and import ViewPropTypes at line 5". tambien remplace en todos los archivos lo mismo, me guiaba con el stacktrace del warning. eso me indicaba donde remplazar. saludos

@razki
Copy link

razki commented May 9, 2017

Update this please

@Lexiwu
Copy link

Lexiwu commented May 10, 2017

Replace View.propTypes to ViewPropTypes in all plugins you used.
That's how I fixed!

@valleywood
Copy link

Same problem for me

@samstr
Copy link

samstr commented May 11, 2017

+1

@keeleycarrigan
Copy link

I think this is something in react-native-tab-view. When I made my own tab view based off what is going on in that this warning went away. Not sure, but just noticed that.

@larryranches
Copy link

+1

@skevy skevy mentioned this issue May 15, 2017
@skevy skevy added this to the 1.0.0-beta.10 milestone May 15, 2017
@skevy
Copy link
Member

skevy commented May 15, 2017

Should be released in 1.0.0-beta.10, as we've upgrade react-native-tab-view.

@qingtian5266
Copy link

in node_modules/react-native-tab-view/src and node_modules/react-native-tab-navigator

all JS files which have "View.propTypes" , should import { ViewPropTypes } from 'react-native' and replace View.propTypes to ViewPropTypes

@Abdul-majid-ashrafi
Copy link

Some problem

@matt-oakes
Copy link

This still seems to be present in 1.0.0-beta.11.

@Abdul-majid-ashrafi
Copy link

Please solve this issue.
Thanks

@jhalborg
Copy link

Still seeing this warning with a tab navigator on 1.0.0-beta.11

@axten
Copy link

axten commented Jun 20, 2017

me to

@ghost
Copy link

ghost commented Jul 3, 2017

Have you a concrete example ?

@kelset
Copy link

kelset commented Jul 3, 2017

Can it be that it is caused by babel-plugin-flow-react-proptypes plugin - that can be found in package.json?

According to the original repo, its latest version is 3.4.1 while the one in the package.json of this lib is 2.2.2.

@matt-oakes
Copy link

matt-oakes commented Jul 3, 2017

The cause is listed above by @cielu: The react-native-tab-view/src/TabViewAnimated.js react-native-swiper/src/index.js files are using a deprecated property and hense is generating a warning.

To fix this issue:

  • Those libraries need to be updated to use the new ViewPropTypes.
  • This library needs to be updated to use the newly updated dependencies.

@davidroman0O
Copy link

I hope it will be fixed quickly because it's really annoying! :)

@kelset
Copy link

kelset commented Jul 10, 2017

I think react-native-tab-view v0.0.67 fixes its portion of the issue (released yesterday-ish); @matt-oakes I can't find the dependency on react-native-swiper in this lib :/

@vsofroniev
Copy link

Has there been any progress with this? Updating to 1.0.0-beta.11 does not fix the warning.
Like @kelset, I too cannot find a dependency to react-native-swiper

This has been open for a while and also marked as a bug, it would be great if we could get a fix out for this!

@junajan
Copy link

junajan commented Jul 23, 2017

+1

@nhducit
Copy link

nhducit commented Aug 9, 2017

there is code mod to rename automatically
https://github.com/reactjs/react-codemod#reactnative-view-proptypes

@matt-oakes
Copy link

I actually think that all the dependencies on this library have not been fixed and this issue doesn't come up anymore.

In my case, I was still seeing the warning, but it was actually due to another library which is not brought in by React Navigation. In my case it was react-native-google-signin.

To see where it's coming from, take a look at the stack trace of the warning:

screenshot 2017-08-09 22 29 49

As far as I can tell, this issue has been fixed for this library and should be closed. Someone, please correct me if I'm wrong, however!

@AlanFoster
Copy link

I can confirm that the latest version of react-navigation has fixed this issue 👍


If you're wanting to know what libraries you depend on that need upgraded:

I was getting this warning within my jest tests, and I was able to work out which modules were failing via editing node_modules/react-native/Libraries/Core/ExceptionsManager.js to have:

   function reactConsoleErrorHandler() {
+   console.log(new Error().stack);
    console._errorOriginal.apply(console, arguments);
    if (!console.reportErrorsAsExceptions) {
      return;
    }

    if (arguments[0] && arguments[0].stack) {
      reportException(arguments[0], /* isFatal */ false);
    } else {
    ...

That way my tests output the stack containing the libraries that needed to be updated:

console.log node_modules/react-native/Libraries/Core/ExceptionsManager.js:71
  Error
      at BufferedConsole.reactConsoleErrorHandler [as error] (/app/node_modules/react-native/Libraries/Core/ExceptionsManager.js:71:13)
      at printWarning (/app/node_modules/fbjs/lib/warning.js:36:17)
      at warning (/app/node_modules/fbjs/lib/warning.js:60:22)
      at Function.get [as propTypes] (/app/node_modules/react-native/Libraries/Components/View/View.js:184:1)

      at Object.<anonymous> (/app/node_modules/react-native-modal-datetime-picker/src/CustomDatePickerIOS/index.js:98:341)
                   ^^^ This is the component that needs upgraded

      at Runtime._execModule (/app/node_modules/jest-runtime/build/index.js:447:13)
      at Runtime.requireModule (/app/node_modules/jest-runtime/build/index.js:295:14)
      at Runtime.requireModuleOrMock (/app/node_modules/jest-runtime/build/index.js:365:19)
      at Object.<anonymous> (/app/node_modules/react-native-modal-datetime-picker/src/index.js:3:26)
      at Runtime._execModule (/app/node_modules/jest-runtime/build/index.js:447:13)
console.error node_modules/react-native/Libraries/Core/ExceptionsManager.js:72
  Warning: View.propTypes has been deprecated and will be removed in a future version of ReactNative. Use ViewPropTypes instead.

In this case I had to upgrade react-native-modal-datetime-picker and all warnings were gone

@matt-oakes
Copy link

Great! I think this issue should be closed in that case. For anyone still seeing the warning, use the method above from @AlanFoster to check where it's coming from.

@sargunv
Copy link
Author

sargunv commented Aug 10, 2017

Excellent, thanks!

@sargunv sargunv closed this as completed Aug 10, 2017
@jeremyfrancis
Copy link

ViewStylePropTypes must be used now. I changed them all manually and got it working but it gives me a lot of warnings.

sericaia pushed a commit to newsuk/times-components that referenced this issue Oct 31, 2017
* fix: replaces View.propTypes with ViewPropTypes

react-navigation/react-navigation#1352

* fix: lint
tiberiumihai added a commit to tiberiumihai/react-native-facebook-login that referenced this issue Nov 6, 2017
Use ViewPropTypes instead.

View.propTypes is intended for DEV mode.
So, when I'm using this awesome library, in DEV mode it works perfectly fine, but as soon as I build the release version, it crashes.

Using react-native 0.50.0 with react 16.0.0.

More info here:
react-navigation/react-navigation#1352
facebook/react-native#16352
@ymz2012
Copy link

ymz2012 commented Nov 10, 2017

ViewPropTypes is not defined

@cmedinasoriano1
Copy link

@ymz2012 you should change

import React, { PropTypes } from 'react'

to

import React from 'react'
import { ViewPropTypes } from 'react-native'

@arunjkumarp
Copy link

How you remove View.propTypes.style. / how find which lib have the issue ?

My project is working in simulator but not in real device.

How i find which library have issue.

"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"axios": "^0.17.1",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-collapsible": "^0.9.0",
"react-native-country-picker-modal": "^0.5.1",
"react-native-dash": "0.0.7",
"react-native-datepicker": "^1.6.0",
"react-native-elements": "^0.17.0",
"react-native-form-validator": "^0.2.0",
"react-native-modal-dropdown": "^0.5.0",
"react-native-router-flux": "^4.0.0-beta.28",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.13",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-persist": "^5.5.0",
"redux-thunk": "^2.2.0",
"rm": "^0.1.8",
"validate.js": "^0.12.0"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
},

@brentvatne
Copy link
Member

@arunjkumarp - search in node_modules for it and remove. update libraries to latest

@react-navigation react-navigation locked and limited conversation to collaborators Mar 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests