CRNA,genymotion,世博奇怪的错误

Rob*_*zak 3 genymotion react-native expo

我正在使用genymotion来运行我的React Native开发环境.当一个特定的组件加载时,我得到console.error消息:there was a problem sending log messages to your development environment使用一个奇怪的堆栈跟踪<unknown>代替几个命名函数.

我将问题缩小到我的代码中的一个组件:

class Questions extends React.Component {
  constructor(props){
    super(props);
    this.state = {
                  style: 'all',
                  selected: ''}
  }
  render = () => {
    return (
      <View style={styles.questions}>
        <ScrollView>
          {(this.props.questions && this.state.style == 'all')&&
            this.props.questions.map(post => {
              return (
                <TouchableHighlight onPress={() => this.loadQuestion(post)} key={post.ID + new Date(post.post_date)} style={styles.questionCard} >
                  <View style={styles.questionCard} >
                    <View style={styles.title}>
                      <Text style={{color: 'white'}}>{post.post_title}</Text>
                      <Text style={{color: 'white'}}> - {post.display_name} {utils.timeSince(new Date(post.post_date))}</Text>
                    </View>
                  </View>
                </TouchableHighlight>
              )
            })
          }
        </ScrollView>
      </View>
    )
  }
}
Run Code Online (Sandbox Code Playgroud)

每当这个组件加载时,我得到了上面提到的console.error.我知道这不是很多,我甚至不期待答案,但我不知所措.

如果你谷歌确切的错误消息你将在Github上找到一个没有解决方案的问题,提到它可能是expo sdk中的错误(这是有意义的)并链接404s的另一个问题.

Rob*_*zak 11

好吧,我想我解决了它,问题实际上是在我的utils函数中timeSince.我有一个迷失的console.log()语句,当我删除它时,错误就消失了.显然,使用此配置,您无法从内部资产调用console.log().

编辑:好的,所以经过一些进一步的调试,当你尝试console.log()一个对象时,抛出这个错误,它与日志的来源无关.