react-native – CRNA,genymotion,expo奇怪的错误
发布时间:2020-12-15 09:33:09 所属栏目:百科 来源:网络整理
导读:我正在使用genymotion来运行我的React Native开发环境.加载特定组件时,我收到console.error消息:在使用 unknown的奇怪堆栈跟踪向开发环境发送日志消息时出现问题.代替几个命名函数. 我将问题缩小到我的代码中的一个组件: class Questions extends React.Co
我正在使用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()一个对象时,抛出这个错误,它与日志的来源无关. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |