CRNA, genymotion, expo weird error

纵然是瞬间 提交于 2019-12-10 21:49:58

问题


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

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.

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.


回答1:


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.

EDIT: 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.




回答2:


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.

EDIT: 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.

I hope this sheds some more light to the origin of this "error":

The object you are referring to is actually the response from the call, and it doesn't like it bc of the size. It's not any object, just the response object from a call. If you try destructuring the part you want, then it goes away



来源:https://stackoverflow.com/questions/49364675/crna-genymotion-expo-weird-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!