Home  >  Q&A  >  body text

react-native warning in chrome debug tools and can't use react dev-tools

1. I use react@16.0.0-alpha.12, react-native@0.45.1 , which can be used normally in simulation, but in the chrome debugging tool A warning appeared in:

ExceptionsManager.js:71 Warning: PropTypes has been moved to a separate package. Accessing React.PropTypes is no longer supported and will be removed completely in React 16. Use the prop-types package on npm instead. (https://fb.me/migrating-from-react-proptypes)
ExceptionsManager.js:71 Warning: React.createClass is no longer supported. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement. (https://fb.me/migrating-from-react-create-class)

And cannot use react dev-tools for debugging

  1. My code:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react'
import {
  AppRegistry,
  View,
  Text,
  StyleSheet
} from 'react-native'
export default class second extends Component{
  render () {
    return (
      <View style={{
         flex: 1,
        flexDirection: 'column',
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: 'ghostwhite'
      }}>
        <Text style={{fontSize: 28, color: 'cadetblue'}}>class extends</Text>
      </View>
    )
  }
  componentDidMount () {
    console.log('==========')
    this.testConsolelog()
  }
  testConsolelog () {
    console.log('e3423423432')
  }
}

const styles2 = StyleSheet.create({
  bigblue: {
    color: 'blue',
    fontWeight: 'bold',
    fontSize: 30,
  },
  red: {
    color: 'red',
  },
});
AppRegistry.registerComponent('second', () => second);
世界只因有你世界只因有你2665 days ago1017

reply all(2)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-07-03 11:44:25

    In the react16 you are using, the method React.createClass has been deprecated.

    So the react16 version cannot create components through this method. You must use the ES6 way to create components.

    class Test extends React.Component {
        ...
    }

    If you use mixins in your code and must use createClass, you need to introduce another tool library separately.

    var createReactClass = require('create-react-class');

    In addition, React.propTypes can no longer be used. If you want to detect props, a separate tool needs to be introduced in react16.

    import PropTypes from 'prop-types';

    reply
    0
  • 習慣沉默

    習慣沉默2017-07-03 11:44:25

    You can’t use react dev-tools, is it because you don’t have check the box to allow access to file addresses

    reply
    0
  • Cancelreply