Nativebase: Warning: Accessing PropTypes on React Native 44

Created on 25 May 2017  路  22Comments  路  Source: GeekyAnts/NativeBase

Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

Here is what I import:

import {View, Text} from 'native-base'

NativeBase 2.1.4
React Native 0.44.0
I guess it is caused by this.

awaiting response

Most helpful comment

I was seeing the warning on the JS console (origin: node_modules/native-base-shoutem-theme/src/StyleProvider.js), so I made a quick&dirty search to find other occurrences. That's what I got:

$ grep -r "import.*\<PropTypes\>.*react" node_modules/**/src
node_modules/native-base-shoutem-theme/src/connectStyle.js:import React, { PropTypes } from 'react';
node_modules/native-base-shoutem-theme/src/StyleProvider.js:import React, { Children, PropTypes } from 'react';
node_modules/native-base/src/basic/SwipeRow.js:import React, { Component, PropTypes } from 'react';
node_modules/native-base/src/basic/Swipe/index.js:import React, { Component, PropTypes } from "react";
node_modules/native-base/src/basic/Swipe/NativeButton.js:import React, { PropTypes } from "react";

yarn.lock.txt, package.json.txt

All 22 comments

@ZevenFang What is the version of React you are on?

16.0.0-alpha.6

@ZevenFang Can you share your package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "devDependencies": {
    "jest-expo": "^1.0.0",
    "react-native-scripts": "0.0.29",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "/node_modules/(?!native-base)/"
    ]
  },
  "dependencies": {
    "@expo/ex-navigation": "^3.0.0",
    "@expo/vector-icons": "^4.1.1",
    "dva": "^1.2.1",
    "expo": "^17.0.0",
    "native-base": "^2.1.4",
    "react": "16.0.0-alpha.6",
    "react-dom": "^15.0.0",
    "react-native": "^0.44.0"
  }
}

Here is my repo.

@ZevenFang Can you got to your node_modules and check for React Native's version?

Yes, it's 0.44.0.
image

@ZevenFang Just a try,
Re-install node_modules

I try to install with npm, and it works. But it doesn't work with yarn.

I am running into this same issue! Tried everything, still broken

@ZevenFang You can check your yarn.lock file for this, in case you have older versions of dependencies

@ZevenFang I tried installing using the package.json provided by you, by yarn
It works fine

It prints error when I run test on travis.

I find a solution here.

@ZevenFang Seems that its not because of NativeBase

It may caused by NativeBase.
image

Accessing PropTypes here directly.
image

Yes, looks like an issue with NativeBase cc @shivrajkumar

Fixed with 2.1.5

Thank you very much.

I was seeing the warning on the JS console (origin: node_modules/native-base-shoutem-theme/src/StyleProvider.js), so I made a quick&dirty search to find other occurrences. That's what I got:

$ grep -r "import.*\<PropTypes\>.*react" node_modules/**/src
node_modules/native-base-shoutem-theme/src/connectStyle.js:import React, { PropTypes } from 'react';
node_modules/native-base-shoutem-theme/src/StyleProvider.js:import React, { Children, PropTypes } from 'react';
node_modules/native-base/src/basic/SwipeRow.js:import React, { Component, PropTypes } from 'react';
node_modules/native-base/src/basic/Swipe/index.js:import React, { Component, PropTypes } from "react";
node_modules/native-base/src/basic/Swipe/NativeButton.js:import React, { PropTypes } from "react";

yarn.lock.txt, package.json.txt

Was this page helpful?
0 / 5 - 0 ratings