我的世博XDE是給了我一個新創建的項目如下警告:陣營原生16阿爾法12個遷移PropTypes
下午1時37分35秒警告: checkPropTypes已被移動到一個單獨的 包。訪問React.checkPropTypes不再受支持,並且 將在React 16中完全刪除。請改用 npm上的prop-types軟件包。
1:37:35 PM警告: React.createClass不再受支持。改爲使用一個 純JavaScript類。如果您尚未準備好遷移,則可以在npm上使用 create-react-class作爲插入式替換。
1:37:35 PM Warning: PropTypes已移至單獨的軟件包。 訪問React.PropTypes不再受支持,將在React 16中完全刪除 。請改用npm上的prop-types包。
即使我的代碼似乎是很好..沒有人知道爲什麼我仍然得到這個消息,或者有什麼不對下面的代碼?
代碼
import React, {Component} from 'react';
import Root from './src/Root';
import {View} from 'react-native';
import PropTypes from 'prop-types';
class App extends Component {
render() {
return (<View />);
}
}
App.PropTypes = {}
export default App;
的package.json
{
"name": "WeDo",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.2.1",
"jest-expo": "~20.0.0",
"react-test-renderer": "16.0.0-alpha.12"
},
"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 --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^20.0.0",
"prop-types": "^15.5.10",
"react": "16.0.0-alpha.12",
"react-native": "^0.47.0"
}
}
試試這個:改變'出口默認類根延伸至React.Component''類Root擴展了React.Component',然後在PropTypes聲明之前做一個簡單的導出:'export default Root;'。 – Andy
@Andy:同樣的問題,我簡化了代碼,仍然有這些錯誤 –
做我的解決方案的工作? – Andy