当前位置 : 主页 > 网页制作 > React >

react-native – CRNA,genymotion,expo奇怪的错误

来源:互联网 收集:自由互联 发布时间:2021-06-15
我正在使用genymotion来运行我的React Native开发环境.加载特定组件时,我收到console.error消息:在使用 unknown的奇怪堆栈跟踪向开发环境发送日志消息时出现问题.代替几个命名函数. 我将问题
我正在使用genymotion来运行我的React Native开发环境.加载特定组件时,我收到console.error消息:在使用< 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>
    )
  }
}

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

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

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

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

网友评论