CRNA、genymotion、expo 奇怪的错误 [英] CRNA, genymotion, expo weird error

查看:27
本文介绍了CRNA、genymotion、expo 奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using genymotion to run my React Native dev environment. When a specific component loads, I get the console.error message: there was a problem sending log messages to your development environment with a weird stack trace that uses <unknown> in place of several named functions.

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

I narrowed the problem down to just one component in my code:

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>
    )
  }
}

每当加载此组件时,我都会收到上面提到的 console.error.我知道这没什么好继续的,我什至不期待答案,但我很茫然.

Whenever this component loads, I got the console.error mentioned above. I know this isn't much to go on and I don't really even expect an answer, but I'm at a loss.

如果你用谷歌搜索那个确切的错误信息,你会在 Github 上发现一个没有解决的问题,提到它可能是 expo sdk 中的一个错误(这是有道理的)并链接了另一个 404s 问题.

If you google that exact error message you will find one issue on Github with no resolution, mentioning that it may be an error in the expo sdk (which makes sense) and linking another issue that 404s.

推荐答案

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

Okay I think I solved it, the problem was actually in my utils function timeSince. I had a stray console.log() statement and when I removed it the error went away. Apparently with this configuration you cannot call console.log() from internal assets.

好的,经过进一步调试后,当您尝试 console.log() 一个对象时会引发此错误,日志的来源无关紧要.

Okay so after some further debugging, this error is thrown when you try to console.log() an object, it doesn't matter where the log originates.

这篇关于CRNA、genymotion、expo 奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆