Javascript 未调用构造函数,但调用了render

Javascript 未调用构造函数,但调用了render,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我有一些React本机代码,其中包含以下React类: import React, { Component } from 'react'; import { ScrollView, StyleSheet, TouchableHighlight, View, Text, Platform } from 'react-native'; import { bindActionCreators } from 'redux' import { connect } from 'react-redux';

我有一些React本机代码,其中包含以下React类:

import React, { Component } from 'react';
import { ScrollView, StyleSheet, TouchableHighlight, View, Text,  Platform } from 'react-native';
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux';

export default class MyList extends Component {
  constructor(props) {
      super(props);
      console.log("In constructor!");
      //some other code
  }

  componentWillMount() {
    console.log("In componentWillMount!");
  }

  render() {
    console.log("In render method!");
        return ( 
        <ScrollView
          horizontal={true} 
          showsHorizontalScrollIndicator={true}
          onLayout={this._onScrollViewLayout}
          onScroll={this._onScroll}
          ref={SCROLLVIEW_REF}
          scrollEventThrottle={8}
        > 
         //some other code
         </ScrollView>

        );
  }
}
为什么我不能在
构造函数
组件willmount
中看到日志记录,这应该在
呈现
方法之前调用

编辑


对于日志记录,我使用的是
react-native-log-android

看起来问题可能出在
react-native-log-android

我刚刚在Google Chrome上测试了你的代码,看起来效果不错

也许这将有助于查明问题是否出在react原生日志android上?

Constructor
componentWillMount
仅被调用一次(当安装组件时)。之后,每次组件更新时,都不会调用这些方法,而是调用
render
。您是说即使在安装组件时也不会调用这些方法吗?好的,但是这些方法的日志应该仍然会出现,对吗?日志记录是一个中间件,当调用构造函数时,它在范围内,对吗?
 ReactNativeJS: In render method!